4e6c5916952ac4d5caadc3a56083a3b01ec3d724
[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 <links>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 !! end
1340
1341 !! test
1342 Isolated close tags should be treated as literal text (bug 52760)
1343 !! options
1344 parsoid=wt2html
1345 !! wikitext
1346 </b>
1347
1348 <s.foo>s</s>
1349 !! html/php+tidy
1350 <p>&lt;s.foo&gt;s</p>
1351 !! html/parsoid
1352 <p>&lt;s.foo&gt;s</p>
1353 !! end
1354
1355 ###
1356 ### Special characters
1357 ###
1358
1359 !! test
1360 Bare pipe character (bug 52363)
1361 !! wikitext
1362 |
1363 !! html
1364 <p>|
1365 </p>
1366 !! end
1367
1368 !! test
1369 Bare pipe character from a template (bug 52363)
1370 !! wikitext
1371 {{pipe}}
1372 !! html
1373 <p>|
1374 </p>
1375 !! end
1376
1377 ###
1378 ### <nowiki> test cases
1379 ###
1380
1381 !! test
1382 <nowiki> unordered list
1383 !! wikitext
1384 <nowiki>* This is not an unordered list item.</nowiki>
1385 !! html/php
1386 <p>* This is not an unordered list item.
1387 </p>
1388 !! html/parsoid
1389 <p><span typeof="mw:Nowiki">* This is not an unordered list item.</span></p>
1390 !! end
1391
1392 !! test
1393 <nowiki> spacing
1394 !! wikitext
1395 <nowiki>Lorem ipsum dolor
1396
1397 sed abit.
1398 sed nullum.
1399
1400 :and a colon
1401 </nowiki>
1402 !! html/php
1403 <p>Lorem ipsum dolor
1404
1405 sed abit.
1406 sed nullum.
1407
1408 :and a colon
1409
1410 </p>
1411 !! html/parsoid
1412 <p><span typeof="mw:Nowiki">Lorem ipsum dolor
1413
1414 sed abit.
1415 sed nullum.
1416
1417 :and a colon
1418 </span></p>
1419 !! end
1420
1421 !! test
1422 nowiki 3
1423 !! wikitext
1424 :There is not nowiki.
1425 :There is <nowiki>nowiki</nowiki>.
1426
1427 #There is not nowiki.
1428 #There is <nowiki>nowiki</nowiki>.
1429
1430 *There is not nowiki.
1431 *There is <nowiki>nowiki</nowiki>.
1432 !! html/php
1433 <dl><dd>There is not nowiki.</dd>
1434 <dd>There is nowiki.</dd></dl>
1435 <ol><li>There is not nowiki.</li>
1436 <li>There is nowiki.</li></ol>
1437 <ul><li>There is not nowiki.</li>
1438 <li>There is nowiki.</li></ul>
1439
1440 !! html/parsoid
1441 <dl><dd data-parsoid='{}'>There is not nowiki.</dd>
1442 <dd data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</dd></dl>
1443
1444 <ol><li data-parsoid='{}'>There is not nowiki.</li>
1445 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ol>
1446
1447 <ul><li data-parsoid='{}'>There is not nowiki.</li>
1448 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ul>
1449 !! end
1450
1451 !! test
1452 Entities inside <nowiki>
1453 !! wikitext
1454 <nowiki>&lt;</nowiki>
1455 !! html
1456 <p>&lt;
1457 </p>
1458 !! end
1459
1460 !! test
1461 Entities inside template parameters
1462 !! wikitext
1463 {{echo|&ndash;}}
1464 !! html/php+tidy
1465 <p>–</p>
1466 !! html/parsoid
1467 <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>
1468 !! end
1469
1470 !! test
1471 Properly escape nowiki when combined with other wiki markup
1472 !! options
1473 parsoid=html2wt
1474 !! html/parsoid
1475 <p>* &lt;/nowiki&gt; tag</p>
1476 !! wikitext
1477 <nowiki>*</nowiki> <nowiki>&lt;/nowiki&gt;</nowiki> tag
1478 !! end
1479
1480 !! test
1481 T93824: Put escaped HTML tags inside nowiki
1482 !! options
1483 parsoid=html2wt
1484 !! html/parsoid
1485 <p>&lt;h2&gt;foo&lt;/h2&gt;</p>
1486 !! wikitext
1487 <nowiki><h2>foo</h2></nowiki>
1488 !! end
1489
1490 !! test
1491 T71950: 1. Put nowiki as close to cause as possible, even with non-quote escapable chars
1492 !! options
1493 parsoid=html2wt
1494 !! html/parsoid
1495 <p>This text: L'<a rel="mw:WikiLink" href="./Foo">Foo</a>
1496 This text: L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1497 This text: L'''<a rel="mw:WikiLink" href="./Foo">Foo</a>''</p>
1498 !! wikitext
1499 This text: L'[[Foo]]
1500 This text: L<nowiki>''</nowiki>[[Foo]]
1501 This text: L<nowiki>'''</nowiki>[[Foo]]<nowiki>''</nowiki>
1502 !! end
1503
1504 # This test fails because wikitext whitespace is not normalized before comparing.
1505 !! test
1506 T71950: 2. Put nowiki as close to cause as possible, after ' :'
1507 !! options
1508 parsoid=html2wt
1509 !! html/parsoid
1510 <p>This text : L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1511 </p>
1512 !! wikitext
1513 This text : L<nowiki>''</nowiki>[[Foo]]
1514 !! end
1515
1516 # This test and the next one are html2wt only as they test that incorrect wikitext
1517 # passed in template arguments gets escaped or wrapped in nowikis where required.
1518 !! test
1519 T71482: Use {{!}} instead of nowiki for single pipe in template argument
1520 !! options
1521 parsoid=html2wt
1522 !! html/parsoid
1523 <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>
1524 <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>
1525 !! wikitext
1526 {{echo|foo{{!}}bar}}
1527 {{echo|<nowiki>foo|bar |[[</nowiki>}}
1528 !! end
1529
1530 !! test
1531 T53961: Output correct nowikis in template arguments
1532 !! options
1533 parsoid=html2wt
1534 !! html/parsoid
1535 <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>
1536 <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>
1537 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a [[ b&quot;}},&quot;i&quot;:0}}]}" about="#mwt3"></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 | {{ ]]&quot;}},&quot;i&quot;:0}}]}" about="#mwt4"></span>
1539 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a }&quot;}},&quot;i&quot;:0}}]}" about="#mwt5"></span></p>
1540 !! wikitext
1541 {{echo|a [ b}}
1542 {{echo|a <nowiki>}}</nowiki> b}}
1543 {{echo|<nowiki>a [[ b</nowiki>}}
1544 {{echo|a {{!}} <nowiki>{{ ]]</nowiki>}}
1545 {{echo|a <nowiki>}</nowiki>}}
1546 !! end
1547
1548 !! test
1549 Cases where "!!" needs nowiki protection
1550 !! options
1551 parsoid=html2wt
1552 !! html/parsoid
1553 <table>
1554 <tr><th>this needs protection !! here</th></tr>
1555 </table>
1556
1557 <table>
1558 <tr><th>this does not need
1559 protection !! here</th></tr>
1560 </table>
1561 !! wikitext
1562 {|
1563 !<nowiki>this needs protection !! here</nowiki>
1564 |}
1565
1566 {|
1567 !this does not need
1568 protection !! here
1569 |}
1570 !! end
1571
1572 ###
1573 ### Comments
1574 ###
1575 !! test
1576 Comments and Indent-Pre
1577 !! wikitext
1578 <!-- comment 1 --> asdf
1579
1580 <!-- comment 1 --> asdf
1581 <!-- comment 2 -->
1582
1583 <!-- comment 1 --> asdf
1584 <!-- comment 2 -->xyz
1585
1586 <!-- comment 1 --> asdf
1587 <!-- comment 2 --> xyz
1588 !! html
1589 <pre>asdf
1590 </pre>
1591 <pre>asdf
1592 </pre>
1593 <pre>asdf
1594 </pre>
1595 <p>xyz
1596 </p>
1597 <pre>asdf
1598 xyz
1599 </pre>
1600 !! end
1601
1602 !! test
1603 Comment test 2a
1604 !! wikitext
1605 asdf
1606 <!-- comment 1 -->
1607 jkl
1608 !! html
1609 <p>asdf
1610 jkl
1611 </p>
1612 !! end
1613
1614 !! test
1615 Comment test 2b
1616 !! wikitext
1617 asdf
1618 <!-- comment 1 -->
1619
1620 jkl
1621 !! html
1622 <p>asdf
1623 </p><p>jkl
1624 </p>
1625 !! end
1626
1627 !! test
1628 Comment test 3
1629 !! wikitext
1630 asdf
1631 <!-- comment 1 -->
1632 <!-- comment 2 -->
1633 jkl
1634 !! html
1635 <p>asdf
1636 jkl
1637 </p>
1638 !! end
1639
1640 !! test
1641 Comment test 4
1642 !! wikitext
1643 asdf<!-- comment 1 -->jkl
1644 !! html
1645 <p>asdfjkl
1646 </p>
1647 !! end
1648
1649 !! test
1650 Comment spacing
1651 !! wikitext
1652 a
1653 <!-- foo --> b <!-- bar -->
1654 c
1655 !! html
1656 <p>a
1657 </p>
1658 <pre> b
1659 </pre>
1660 <p>c
1661 </p>
1662 !! end
1663
1664 !! test
1665 Comment whitespace
1666 !! wikitext
1667 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1668 !! html
1669
1670 !! end
1671
1672 !! test
1673 Comment semantics and delimiters
1674 !! wikitext
1675 <!-- --><!----><!-----><!------>
1676 !! html/php
1677
1678 !! html/parsoid
1679 <!-- --><!----><!--&#x2D;--><!--&#x2D;&#x2D;-->
1680 !! end
1681
1682 !! test
1683 Comment semantics and delimiters, redux
1684 !! wikitext
1685 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1686 -- foo -- funky huh? ... -->
1687 !! html/php
1688
1689 !! html/parsoid
1690 <!-- In SGML every "foo" here would actually show up in the text &#x2D;&#x2D; foo &#x2D;&#x2D; bar
1691 &#x2D;&#x2D; foo &#x2D;&#x2D; funky huh? ... -->
1692 !! end
1693
1694 !! test
1695 Comment semantics and delimiters: directors cut
1696 !! wikitext
1697 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1698 everything starting with < followed by !-- until the first -- and > we see,
1699 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1700 -->-->
1701 !! html/php
1702 <p>--&gt;
1703 </p>
1704 !! html/parsoid
1705 <!-- ... However we like to keep things simple and somewhat XML&#x2D;ish so we eat
1706 everything starting with < followed by !&#x2D;&#x2D; until the first &#x2D;&#x2D; and &#x3E; we see,
1707 that wouldn't be valid XML however, since in XML &#x2D;&#x2D; has to terminate a comment
1708 --><p>--></p>
1709 !! end
1710
1711 !! test
1712 Comment semantics: nesting
1713 !! wikitext
1714 <!--<!-- no, we're not going to do anything fancy here -->-->
1715 !! html/php
1716 <p>--&gt;
1717 </p>
1718 !! html/parsoid
1719 <!--<!&#x2D;&#x2D; no, we're not going to do anything fancy here --><p>--></p>
1720 !! end
1721
1722 # Parsoid closes the unclosed comment, even if it means a slight
1723 # round-trip diff.
1724 !! test
1725 Comment semantics: unclosed comment at end
1726 !! options
1727 parsoid=wt2html,html2html
1728 !! wikitext
1729 <!--This comment will run out to the end of the document
1730 !! html/php
1731
1732 !! html/parsoid
1733 <!--This comment will run out to the end of the document-->
1734 !! end
1735
1736 !! test
1737 Comment semantics: normalize comments to play nice with XML and browsers
1738 !! wikitext
1739 <!-- Browsers --!> think this is closed -->
1740 <!--> This would normally be text -->
1741 <!---> As would this -->
1742 <!-- XML doesn't like trailing dashes -------->
1743 <!-- Nor doubled hyphens -- anywhere in the data -->
1744 But this is not a comment.
1745 !! html/php
1746 <p>But this is not a comment.
1747 </p>
1748 !! html/parsoid
1749 <!-- Browsers &#x2D;&#x2D;!&#x3E; think this is closed -->
1750 <!--&#x3E; This would normally be text -->
1751 <!--&#x2D;&#x3E; As would this -->
1752 <!-- XML doesn't like trailing dashes &#x2D;&#x2D;&#x2D;&#x2D;&#x2D;&#x2D;-->
1753 <!-- Nor doubled hyphens &#x2D;&#x2D; anywhere in the data -->
1754 <p>But this is not a comment.</p>
1755 !! end
1756
1757 !! test
1758 Comment semantics: round-trip even text which contains encoded -->
1759 !! wikitext
1760 <!-- hello & goodbye - > --&gt; --&amp;gt; --&xx -->
1761 !! html/parsoid
1762 <!-- hello &#x26; goodbye &#x2D; &#x3E; &#x2D;&#x2D;&#x3E; &#x2D;&#x2D;&#x26;gt; &#x2D;&#x2D;&#x26;xx -->
1763 !! end
1764
1765 !! test
1766 Comment in template title
1767 !! wikitext
1768 {{f<!---->oo}}
1769 !! html
1770 <p>FOO
1771 </p>
1772 !! end
1773
1774 !! test
1775 Comment on its own line post-expand
1776 !! wikitext
1777 a
1778 {{blank}}<!---->
1779 b
1780 !! html
1781 <p>a
1782 </p><p>b
1783 </p>
1784 !! end
1785
1786 !! test
1787 Comment on its own line post-expand with non-significant whitespace
1788 !! wikitext
1789 a
1790 {{blank}} <!---->
1791 b
1792 !! html
1793 <p>a
1794 </p><p>b
1795 </p>
1796 !! end
1797
1798 !! test
1799 Multiple comments should still parse as SOL-transparent
1800 !! options
1801 parsoid=wt2html,wt2wt
1802 !! wikitext
1803 <!--c1-->*a
1804 <!--c2--><!--c3--><!--c4-->*b
1805 !! html/php
1806 <ul><li>a</li>
1807 <li>b</li></ul>
1808
1809 !! html/parsoid
1810 <!--c1--><ul>
1811 <li>a
1812 </li>
1813 <!--c2--><!--c3--><!--c4-->
1814 <li>b
1815 </li>
1816 </ul>
1817 !! end
1818
1819 ###
1820 ### paragraph wrapping tests
1821 ###
1822 !! test
1823 No block tags
1824 !! wikitext
1825 a
1826
1827 b
1828 !! html
1829 <p>a
1830 </p><p>b
1831 </p>
1832 !! end
1833
1834 !! test
1835 Block tag on one line (<div>)
1836 !! wikitext
1837 a <div>foo</div>
1838
1839 b
1840 !! html
1841 a <div>foo</div>
1842 <p>b
1843 </p>
1844 !! html+tidy
1845 <p>a</p>
1846 <div>foo</div>
1847 <p>b</p>
1848 !! end
1849
1850 !! test
1851 Block tag on one line (<blockquote>)
1852 !! wikitext
1853 a <blockquote>foo</blockquote>
1854
1855 b
1856 !! html
1857 a <blockquote>foo</blockquote>
1858 <p>b
1859 </p>
1860 !! html+tidy
1861 <p>a</p>
1862 <blockquote>
1863 <p>foo</p>
1864 </blockquote>
1865 <p>b</p>
1866 !! end
1867
1868 !! test
1869 Block tag on both lines (<div>)
1870 !! wikitext
1871 a <div>foo</div>
1872
1873 b <div>foo</div>
1874 !! html
1875 a <div>foo</div>
1876 b <div>foo</div>
1877
1878 !! html+tidy
1879 <p>a</p>
1880 <div>foo</div>
1881 <p>b</p>
1882 <div>foo</div>
1883 !! end
1884
1885 !! test
1886 Block tag on both lines (<blockquote>)
1887 !! wikitext
1888 a <blockquote>foo</blockquote>
1889
1890 b <blockquote>foo</blockquote>
1891 !! html
1892 a <blockquote>foo</blockquote>
1893 b <blockquote>foo</blockquote>
1894
1895 !! html+tidy
1896 <p>a</p>
1897 <blockquote>
1898 <p>foo</p>
1899 </blockquote>
1900 <p>b</p>
1901 <blockquote>
1902 <p>foo</p>
1903 </blockquote>
1904 !! end
1905
1906 !! test
1907 Multiple lines without block tags
1908 !! wikitext
1909 <div>foo</div> a
1910 b
1911 c
1912 d<!--foo--> e
1913 x <div>foo</div> z
1914 !! html
1915 <div>foo</div> a
1916 <p>b
1917 c
1918 d e
1919 </p>
1920 x <div>foo</div> z
1921
1922 !! html+tidy
1923 <div>foo</div>
1924 <p>a</p>
1925 <p>b c d e</p>
1926 <p>x</p>
1927 <div>foo</div>
1928 <p>z</p>
1929 !! end
1930
1931 # Tidy strips out the empty <div> tags. Parsoid doesn't.
1932 # So, we have a separate section for Parsoid. We don't want
1933 # to mimic this stripping behavior in Parsoid. It affects
1934 # editing experience and also requires us to maintain additional
1935 # info for RT-ing.
1936 !! test
1937 Empty lines between lines with block tags
1938 !! wikitext
1939 <div></div>
1940
1941
1942 <div></div>a
1943
1944 b
1945 <div>a</div>b
1946
1947 <div>b</div>d
1948
1949
1950 <div>e</div>
1951 !! html
1952 <div></div>
1953 <p><br />
1954 </p>
1955 <div></div>a
1956 <p>b
1957 </p>
1958 <div>a</div>b
1959 <div>b</div>d
1960 <p><br />
1961 </p>
1962 <div>e</div>
1963
1964 !! html+tidy
1965 <p><br /></p>
1966 <p>a</p>
1967 <p>b</p>
1968 <div>a</div>
1969 <p>b</p>
1970 <div>b</div>
1971 <p>d</p>
1972 <p><br /></p>
1973 <div>e</div>
1974 !! html/parsoid
1975 <div data-parsoid='{"stx":"html"}'></div>
1976
1977 <p><br /></p>
1978 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
1979
1980 <p>b</p>
1981 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
1982
1983 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
1984
1985 <p><br /></p>
1986 <div data-parsoid='{"stx":"html"}'>e</div>
1987 !! end
1988
1989 ## PHP parser emits output which is broken
1990 !! test
1991 Unclosed HTML p-tags should be handled properly
1992 !! wikitext
1993 <div><p>foo</div>
1994 a
1995
1996 b
1997 !! html/php+tidy
1998 <div>
1999 <p>foo</p>
2000 </div>
2001 <p>a</p>
2002 <p>b</p>
2003 !! html/parsoid
2004 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
2005 <p>a</p>
2006 <p>b</p>
2007 !! end
2008
2009 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
2010 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
2011 ## them for now.
2012 !! test
2013 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
2014 !! options
2015 parsoid=wt2html
2016 !! wikitext
2017 a [[Category:A1]] [[Category:A2]]
2018 [[Category:A3]]
2019 [[Category:A4]]
2020 !! html/parsoid
2021 <p>a</p>
2022 <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"/>
2023 !! end
2024
2025 !! test
2026 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
2027 !! options
2028 parsoid=wt2html
2029 !! wikitext
2030 [[Category:A1]]a
2031 !! html/parsoid
2032 <link rel="mw:PageProp/Category" href="./Category:A1"/><p>a</p>
2033 !! end
2034
2035 ###
2036 ### Preformatted text
2037 ###
2038 !! test
2039 Preformatted text
2040 !! wikitext
2041 This is some
2042 Preformatted text
2043 With ''italic''
2044 And '''bold'''
2045 And a [[Main Page|link]]
2046 !! html
2047 <pre>This is some
2048 Preformatted text
2049 With <i>italic</i>
2050 And <b>bold</b>
2051 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
2052 </pre>
2053 !! end
2054
2055 !! test
2056 Tabs don't trigger preformatted text
2057 !! wikitext
2058 This is not
2059 preformatted text.
2060 This is preformatted text.
2061 So is this.
2062 !! html/php
2063 <p> This is not
2064 preformatted text.
2065 </p>
2066 <pre>This is preformatted text.
2067 So is this.
2068 </pre>
2069 !! html/parsoid
2070 <p> This is not
2071 preformatted text.</p>
2072 <pre>This is preformatted text.
2073 So is this.</pre>
2074 !! end
2075
2076 !! test
2077 Space before tab needs nowiki pre protection
2078 !! options
2079 parsoid=html2wt
2080 !! html/parsoid
2081 <p> a</p>
2082 !! wikitext
2083 <nowiki> </nowiki> a
2084 !! end
2085
2086 !! test
2087 Ident preformatting with inline content
2088 !! wikitext
2089 a
2090 ''b''
2091 !! html
2092 <pre>a
2093 <i>b</i>
2094 </pre>
2095 !! end
2096
2097 !! test
2098 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
2099 !! wikitext
2100 <pre><nowiki>
2101 <b>
2102 <cite>
2103 <em>
2104 </nowiki></pre>
2105 !! html
2106 <pre>
2107 &lt;b&gt;
2108 &lt;cite&gt;
2109 &lt;em&gt;
2110 </pre>
2111
2112 !! end
2113
2114 !! test
2115 Regression with preformatted in <center>
2116 !! wikitext
2117 <center>
2118 Blah
2119 </center>
2120 !! html
2121 <center>
2122 <pre>Blah
2123 </pre>
2124 </center>
2125
2126 !! end
2127
2128 !! test
2129 Bug 52763: Preformatted in <blockquote>
2130 !! wikitext
2131 <blockquote>
2132 Blah
2133 {|
2134 |
2135 indented cell (no pre-wrapping!)
2136 |}
2137 </blockquote>
2138 !! html
2139 <blockquote>
2140 <p> Blah
2141 </p>
2142 <table>
2143 <tr>
2144 <td>
2145 <p> indented cell (no pre-wrapping!)
2146 </p>
2147 </td></tr></table>
2148 </blockquote>
2149
2150 !! end
2151
2152 !! test
2153 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
2154 !! wikitext
2155 <blockquote>
2156 Foo
2157
2158 Bar
2159 </blockquote>
2160 !! html
2161 <blockquote>
2162 <p>Foo
2163 </p><p>Bar
2164 </p>
2165 </blockquote>
2166
2167 !! end
2168
2169 !! test
2170 Bug 15491: <ins>/<del> in blockquote
2171 !! wikitext
2172 <blockquote>
2173 Foo <del>bar</del> <ins>baz</ins> quux
2174 </blockquote>
2175 !! html
2176 <blockquote>
2177 <p>Foo <del>bar</del> <ins>baz</ins> quux
2178 </p>
2179 </blockquote>
2180
2181 !! end
2182
2183 # Note that the p-wrapping is newline sensitive, which could be
2184 # considered a bug: tidy will wrap only the 'Foo' in the example
2185 # below in a <p> tag. (see comment 23-25 of bug #6200)
2186 !! test
2187 Bug 15491: <ins>/<del> in blockquote (2)
2188 !! wikitext
2189 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2190 </blockquote>
2191 !! html
2192 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2193 </blockquote>
2194
2195 !! html+tidy
2196 <blockquote>
2197 <p>Foo</p>
2198 <del>bar</del> <ins>baz</ins> quux</blockquote>
2199 !! end
2200
2201 !! test
2202 <pre> with attributes (bug 3202)
2203 !! wikitext
2204 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2205 !! html
2206 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2207
2208 !! end
2209
2210 !! test
2211 <pre> with width attribute (bug 3202)
2212 !! wikitext
2213 <pre width="8">Narrow screen goodies</pre>
2214 !! html
2215 <pre width="8">Narrow screen goodies</pre>
2216
2217 !! end
2218
2219 !! test
2220 <pre> with forbidden attribute (bug 3202)
2221 !! wikitext
2222 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
2223 !! html
2224 <pre width="8">Narrow screen goodies</pre>
2225
2226 !! end
2227
2228 !! test
2229 Entities inside <pre>
2230 !! wikitext
2231 <pre>&lt;</pre>
2232 !! html
2233 <pre>&lt;</pre>
2234
2235 !! end
2236
2237 !! test
2238 <pre> with forbidden attribute values (bug 3202)
2239 !! wikitext
2240 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
2241 !! html
2242 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
2243
2244 !! end
2245
2246 !! test
2247 <nowiki> inside <pre> (bug 13238)
2248 !! wikitext
2249 <pre>
2250 <nowiki>
2251 </pre>
2252 <pre>
2253 <nowiki></nowiki>
2254 </pre>
2255 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
2256 !! html
2257 <pre>
2258 &lt;nowiki&gt;
2259 </pre>
2260 <pre>
2261
2262 </pre>
2263 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2264
2265 !! end
2266
2267 !! test
2268 <nowiki> and <pre> preference (first one wins)
2269 !! wikitext
2270 <pre>
2271 <nowiki>
2272 </pre>
2273 </nowiki>
2274 </pre>
2275
2276 <nowiki>
2277 <pre>
2278 <nowiki>
2279 </pre>
2280 </nowiki>
2281 </pre>
2282
2283 !! html/php
2284 <pre>
2285 &lt;nowiki&gt;
2286 </pre>
2287 <p>&lt;/nowiki&gt;
2288 &lt;/pre&gt;
2289 </p><p>
2290 &lt;pre&gt;
2291 &lt;nowiki&gt;
2292 &lt;/pre&gt;
2293
2294 &lt;/pre&gt;
2295 </p>
2296 !! html/parsoid
2297 <pre data-parsoid='{"stx":"html","strippedNL":true}'>&lt;nowiki>
2298 </pre>
2299 <p><span typeof="mw:Placeholder" data-parsoid='{"src":"&lt;/nowiki>"}'>&lt;/nowiki></span>
2300 &lt;/pre></p>
2301
2302 <p><span typeof="mw:Nowiki">
2303 &lt;pre>
2304 &lt;nowiki>
2305 &lt;/pre>
2306 </span>
2307 &lt;/pre></p>
2308 !! end
2309
2310 !! test
2311 </pre> inside nowiki
2312 !! wikitext
2313 <nowiki></pre></nowiki>
2314 !! html
2315 <p>&lt;/pre&gt;
2316 </p>
2317 !! end
2318
2319 # Parsoid doesn't strip empty tags, like Tidy does.
2320 !! test
2321 Empty pre; pre inside other HTML tags (bug 54946)
2322 !! options
2323 parsoid=wt2html,wt2wt
2324 !! wikitext
2325 a
2326
2327 <div><pre>
2328 foo
2329 </pre></div>
2330 <pre></pre>
2331 !! html/php
2332 <p>a
2333 </p>
2334 <div><pre>
2335 foo
2336 </pre></div>
2337 <pre></pre>
2338
2339 !! html/php+tidy
2340 <p>a</p>
2341 <div>
2342 <pre>
2343 foo
2344 </pre></div>
2345 !! html/parsoid
2346 <p>a</p>
2347
2348 <div><pre>foo
2349 </pre></div>
2350 <pre></pre>
2351 !! end
2352
2353 !! test
2354 HTML pre followed by indent-pre
2355 !! wikitext
2356 <pre>foo</pre>
2357 bar
2358 !! html
2359 <pre>foo</pre>
2360 <pre>bar
2361 </pre>
2362 !! end
2363
2364 # Note that tidy removes the empty <p> tags from the start and end.
2365 # Parsoid does not, by design.
2366 !!test
2367 Block tag pre
2368 !! wikitext
2369 <p><pre>foo</pre></p>
2370 !! html/php+tidy
2371 <pre>
2372 foo
2373 </pre>
2374 !! html/parsoid
2375 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2376 !!end
2377
2378 !!test
2379 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2380 !! wikitext
2381 {{echo|}}
2382 !! html
2383
2384 !!end
2385
2386 !!test
2387 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2388 !! wikitext
2389 {{echo|
2390 foo}}
2391 !! html
2392 <p>foo
2393 </p>
2394 !!end
2395
2396 !! test
2397 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2398 !! wikitext
2399 {{echo|a
2400 b}}
2401 !! html
2402 <pre>a
2403 </pre>
2404 <p>b
2405 </p>
2406 !!end
2407
2408 !! test
2409 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2410 !! wikitext
2411 {{echo|a
2412 b
2413 c
2414 d
2415 e
2416 }}
2417 !! html
2418 <pre>a
2419 </pre>
2420 <p>b
2421 c
2422 </p>
2423 <pre>d
2424 </pre>
2425 <p>e
2426 </p>
2427 !!end
2428
2429 !!test
2430 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2431 !! wikitext
2432 {{echo| foo}}
2433
2434 {{echo| foo}}{{echo| bar}}
2435
2436 {{echo| foo}}
2437 {{echo| bar}}
2438
2439 {{echo|<!--cmt--> foo}}
2440
2441 <!--cmt-->{{echo| foo}}
2442
2443 {{echo|{{echo| }}bar}}
2444 !! html
2445 <pre>foo
2446 </pre>
2447 <pre>foo bar
2448 </pre>
2449 <pre>foo
2450 bar
2451 </pre>
2452 <pre>foo
2453 </pre>
2454 <pre>foo
2455 </pre>
2456 <pre>bar
2457 </pre>
2458 !!end
2459
2460 !! test
2461 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2462 !! wikitext
2463 {{echo| }}a
2464
2465 {{echo|
2466 }}a
2467
2468 {{echo|
2469 b}}
2470
2471 {{echo|a
2472 }}b
2473
2474 {{echo|a
2475 }} b
2476 !! html
2477 <pre>a
2478 </pre>
2479 <p><br />
2480 </p>
2481 <pre>a
2482 </pre>
2483 <p><br />
2484 </p>
2485 <pre>b
2486 </pre>
2487 <p>a
2488 </p>
2489 <pre>b
2490 </pre>
2491 <p>a
2492 </p>
2493 <pre>b
2494 </pre>
2495 !!end
2496
2497 !! test
2498 Pres with newline attributes
2499 !! wikitext
2500 <pre class="one
2501 two">hi</pre>
2502 !! html/php
2503 <pre class="one two">hi</pre>
2504
2505 !! html/parsoid
2506 <pre class="one
2507 two" data-parsoid='{"stx":"html"}'>hi</pre>
2508 !! end
2509
2510 !! test
2511 Things that look like <pre> tags aren't treated as such
2512 !! wikitext
2513 Barack Obama <President> of the United States
2514 <President></President>
2515 !! html
2516 <p>Barack Obama &lt;President&gt; of the United States
2517 &lt;President&gt;&lt;/President&gt;
2518 </p>
2519 !! end
2520
2521 ## PHP parser discards the "<pre " string
2522 !! test
2523 Handle broken pre-like tags (bug 64025)
2524 !! options
2525 parsoid=wt2html
2526 !! wikitext
2527 {{echo|<pre <pre>x</pre>}}
2528
2529 <table><pre </table>
2530 !! html/php
2531 <pre>x</pre>
2532 <table><pre></pre></table>
2533
2534 !! html/parsoid
2535 <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>
2536
2537
2538 <p>&lt;pre </p>
2539
2540 <table></table>
2541 !! end
2542
2543 !! test
2544 Parsoid: handle pre with space after attribute
2545 !! options
2546 parsoid=wt2html
2547 !! wikitext
2548 <pre style="width:50%;" >{{echo|foo}}</pre>
2549 !! html/php
2550 <pre style="width:50%;">{{echo|foo}}</pre>
2551
2552 !! html/parsoid
2553 <pre style="width:50%;">{{echo|foo}}</pre>
2554 !! end
2555
2556 # TODO / maybe: fix wt2wt for this
2557 !! test
2558 Parsoid: Don't paragraph-wrap fosterable content
2559 !! options
2560 parsoid=wt2html
2561 !! wikitext
2562 {|
2563 <td></td>
2564 <td></td>
2565
2566
2567
2568 |}
2569 !! html
2570 <table>
2571
2572 <tbody>
2573 <tr>
2574 <td></td>
2575
2576 <td></td></tr>
2577
2578
2579
2580 </tbody></table>
2581 !! end
2582
2583 !! test
2584 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2585 !! options
2586 parsoid=wt2html
2587 !! wikitext
2588 {|
2589 <td>
2590 <td>
2591 </td>
2592
2593
2594
2595 |}
2596 !! html
2597 <table>
2598
2599 <tbody>
2600 <tr>
2601 <td></td>
2602
2603 <td>
2604 </td></tr>
2605
2606
2607
2608 </tbody></table>
2609 !! end
2610
2611
2612 #--------------------------------------------------------------------
2613 # Transclusion parameter whitespace stripping tests
2614 # Behavior is different for positional and named parameters
2615 #--------------------------------------------------------------------
2616 !! test
2617 Templates: Strip leading and trailing whitespace from named-param values
2618 !! wikitext
2619 {{echo|1= a }}
2620
2621 {{echo|1= {{echo|b}} }}
2622
2623 {{echo| 1 =
2624 c }}
2625
2626 {{echo| 1 =
2627 * d
2628 }}
2629 !! html
2630 <p>a
2631 </p><p>b
2632 </p><p>c
2633 </p>
2634 <ul><li> d</li></ul>
2635
2636 !! end
2637
2638 !! test
2639 Templates: Don't strip whitespace from positional-param values
2640 !! wikitext
2641 {{echo|a }}
2642
2643 {{echo|{{echo|b}} }}
2644
2645 {{echo| c
2646 }}
2647
2648 {{echo| {{echo|d}}
2649 }}
2650
2651 {{echo|
2652 e}}
2653
2654 {{echo|
2655 * f}}
2656
2657 {{echo|
2658 }}g
2659 !! html
2660 <p>a
2661 </p><p>b
2662 </p>
2663 <pre>c
2664 </pre>
2665 <p><br />
2666 </p>
2667 <pre>d
2668 </pre>
2669 <p><br />
2670 </p>
2671 <pre>e
2672 </pre>
2673 <p><br />
2674 </p>
2675 <ul><li> f</li></ul>
2676 <p><br />
2677 </p>
2678 <pre>g
2679 </pre>
2680 !! end
2681
2682 !! test
2683 Templates: Handle empty comment-and-ws-only lines correctly
2684 !! wikitext
2685 {{echo|foo
2686 <!--should be ignored-->
2687 <!--should be ignored as well-->
2688 bar}}
2689 !! html
2690 <p>foo
2691 bar
2692 </p>
2693 !! end
2694
2695 !! test
2696 Templates: Handle comments in the target
2697 !! wikitext
2698 {{echo
2699 <!-- should be ignored -->
2700 |foo}}
2701
2702 {{echo<!-- should be ignored -->
2703 |foo}}
2704
2705 {{echo<!-- should be ignored -->|foo}}
2706
2707 {{<!-- should be ignored -->echo|foo}}
2708 !!html/parsoid
2709 <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>
2710
2711 <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>
2712
2713 <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>
2714
2715 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2716 !!end
2717
2718 !! test
2719 Templates: Handle comments in parameter names (bug 67657)
2720 !! wikitext
2721 {{echo|1
2722 <!-- should be ignored -->
2723 =foo}}
2724
2725 {{echo|
2726 <!-- should be ignored -->
2727 1 = foo}}
2728
2729 {{echo|1<!-- should be ignored --> = foo}}
2730
2731 {{echo|<!-- should be ignored -->1 = foo}}
2732 !!html/parsoid
2733 <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>
2734
2735 <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>
2736
2737 <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>
2738
2739 <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>
2740 !!end
2741
2742 !! test
2743 Templates: Other wikitext in parameter names (bug 67657)
2744 !! wikitext
2745 {{echo|''1''=foo}}
2746 !!html/parsoid
2747 <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>
2748 !!html/php
2749 <p>{{{1}}}
2750 </p>
2751 !!end
2752
2753 #--------------------------------------------------------------------
2754 # Transclusion parameter escaping tests
2755 #--------------------------------------------------------------------
2756 !! test
2757 Templates: Parsoid parameter escaping test 1
2758 !! wikitext
2759 {{echo|[foo]|{{echo|[bar]}}}}
2760 !! html/php+tidy
2761 <p>[foo]</p>
2762 !! html/parsoid
2763 <p about="#mwt1" typeof="mw:Transclusion"
2764 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2765 !! end
2766
2767 !! test
2768 Parsoid: Pipes in external links in template parameter
2769 !! wikitext
2770 {{echo|[{{echo|http://example.com}} link]}}
2771 !! html/php+tidy
2772 <p><a rel="nofollow" class="external text" href="http://example.com">link</a></p>
2773 !! html/parsoid
2774 <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>
2775 !! end
2776
2777 !! test
2778 Parsoid: pipe in transclusion parameter
2779 !! wikitext
2780 {{echo|http://foo.com/a&#124;b}}
2781 !! html/php+tidy
2782 <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</a></p>
2783 !! html/parsoid
2784 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2785 typeof="mw:Transclusion"
2786 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>
2787 !! end
2788
2789 !! test
2790 Parsoid: Pipe in external link target and content in template parameter
2791 !! options
2792 parsoid=html2wt,wt2wt
2793 !! wikitext
2794 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2795 !! html/php+tidy
2796 <p><a rel="nofollow" class="external text" href="http://foo.com/a%7Cb">a|b</a></p>
2797 !! html/parsoid
2798 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2799 typeof="mw:Transclusion"
2800 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2801 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2802 !! end
2803
2804 !! test
2805 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2806 !! options
2807 parsoid
2808 !! wikitext
2809 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2810 !! html
2811 <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>
2812 !! end
2813
2814 !! test
2815 Templates: Don't escape already nowiki-escaped text in template parameters
2816 !! options
2817 parsoid=html2wt,wt2wt
2818 !! wikitext
2819 {{echo|foo<nowiki>|</nowiki>bar}}
2820 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2821 {{echo|<nowiki></nowiki>}}
2822 !! html/php+tidy
2823 <p>foo|bar &lt;div&gt;</p>
2824 !! html/parsoid
2825 <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>
2826 <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>
2827 <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>
2828 </p>
2829 !! end
2830
2831 ## Bug 52824
2832 !! test
2833 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2834 !! options
2835 parsoid=html2wt,wt2wt
2836 !! wikitext
2837 {{echo|{{echo|1=bar}}}}
2838 !! html/php+tidy
2839 <p>bar</p>
2840 !! html/parsoid
2841 <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>
2842 !! end
2843
2844 ## Bug 56733
2845 !! test
2846 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2847 !! wikitext
2848 {{echo|a : b}}
2849 !! html/php+tidy
2850 <p>a&#160;: b</p>
2851 !! html/parsoid
2852 <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>
2853 !! end
2854
2855 ## Bug T73412
2856 !! test
2857 Templates: Preserve blank parameter names
2858 !! wikitext
2859 {{echo|=foo}}
2860 !! html/php+tidy
2861 <p>{{{1}}}</p>
2862 !! html/parsoid
2863 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2864 !! end
2865
2866 !! test
2867 Templates: Preserve blank parameter names in other positions
2868 !! wikitext
2869 {{blank_param|bar|=foo}}
2870 !! html/php+tidy
2871 <p>bar foo</p>
2872 !! html/parsoid
2873 <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
2874 foo</p>
2875 !! end
2876
2877 ###
2878 ### Parsoid-centric tests for testing RT edge cases for pre
2879 ###
2880
2881 !!test
2882 1a. Indent-Pre and Comments
2883 !! wikitext
2884 a
2885 <!--a-->
2886 c
2887 !! html
2888 <pre>a
2889 </pre>
2890 <p>c
2891 </p>
2892 !!end
2893
2894 !!test
2895 1b. Indent-Pre and Comments
2896 !! wikitext
2897 a
2898 <!--a-->
2899 c
2900 !! html
2901 <pre>a
2902 </pre>
2903 <p>c
2904 </p>
2905 !!end
2906
2907 !!test
2908 1c. Indent-Pre and Comments
2909 !! wikitext
2910 <!--a--> a
2911
2912 <!--a--> a
2913 !! html
2914 <pre> a
2915 </pre>
2916 <pre> a
2917 </pre>
2918 !!end
2919
2920 !!test
2921 1d. Indent-Pre and Comments
2922 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2923 !! wikitext
2924 <!--a--> a
2925
2926 <!--b-->b
2927 !! html
2928 <pre>a
2929 </pre>
2930 <pre>b
2931 </pre>
2932 !!end
2933
2934 !!test
2935 2a. Indent-Pre and tables
2936 !! wikitext
2937 {|
2938 |-
2939 !h1!!h2
2940 |foo||bar
2941 |}
2942 !! html
2943 <table>
2944
2945 <tr>
2946 <th>h1</th>
2947 <th>h2
2948 </th>
2949 <td>foo</td>
2950 <td>bar
2951 </td></tr></table>
2952
2953 !!end
2954
2955 !!test
2956 2b. Indent-Pre and tables
2957 !! wikitext
2958 {|
2959 |-
2960 |foo
2961 |}
2962 !! html
2963 <table>
2964
2965 <tr>
2966 <td>foo
2967 </td></tr></table>
2968
2969 !!end
2970
2971 !!test
2972 2c. Indent-Pre and tables (bug 42252)
2973 !! wikitext
2974 {|
2975 |+ foo
2976 ! | bar
2977 |}
2978 !! html
2979 <table>
2980 <caption> foo
2981 </caption>
2982 <tr>
2983 <th> bar
2984 </th></tr></table>
2985
2986 !!end
2987
2988 !!test
2989 2d. Indent-Pre and tables
2990 !! wikitext
2991 a
2992 {|
2993 | b
2994 |}
2995 !! html/php
2996 <pre>a
2997 </pre>
2998 <table>
2999 <tr>
3000 <td> b
3001 </td></tr></table>
3002
3003 !! html/parsoid
3004 <pre>a</pre>
3005 <table>
3006 <tbody><tr><td> b</td></tr>
3007 </tbody></table>
3008 !!end
3009
3010 !!test
3011 2e. Indent-Pre and table-line syntax
3012 !! wikitext
3013 a
3014 | b
3015 | c
3016 !! html/php
3017 <pre>a
3018 | b
3019 | c
3020 </pre>
3021 !!end
3022
3023 !!test
3024 2f. Indent-pre started by table-line syntax
3025 !! wikitext
3026 a
3027 | b
3028 | c
3029 !! html/php
3030 <p>a
3031 </p>
3032 <pre>| b
3033 | c
3034 </pre>
3035 !! html/parsoid
3036 <p>a</p>
3037 <pre>
3038 | b
3039 | c</pre>
3040 !!end
3041
3042 !!test
3043 3a. Indent-Pre and block tags (single-line html)
3044 !! wikitext
3045 a <p> foo </p>
3046 b <div> foo </div>
3047 c <blockquote> foo </blockquote>
3048 <span> foo </span>
3049 !! html
3050 a <p> foo </p>
3051 b <div> foo </div>
3052 c <blockquote> foo </blockquote>
3053 <pre><span> foo </span>
3054 </pre>
3055 !! html/parsoid
3056 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
3057 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3058 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
3059 <pre><span> foo </span>
3060 </pre>
3061 !! html+tidy
3062 <p>a</p>
3063 <p>foo</p>
3064 <p>b</p>
3065 <div>foo</div>
3066 <p>c</p>
3067 <blockquote>
3068 <p>foo</p>
3069 </blockquote>
3070 <pre>
3071 <span> foo </span>
3072 </pre>
3073 !! end
3074
3075 !!test
3076 3b. Indent-Pre and block tags (multi-line html)
3077 !! wikitext
3078 a <span>foo</span>
3079 b <div> foo </div>
3080 !! html
3081 <pre>a <span>foo</span>
3082 </pre>
3083 b <div> foo </div>
3084
3085 !! html/parsoid
3086 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3087 b <div data-parsoid='{"stx":"html"}'> foo </div>
3088 !! html+tidy
3089 <pre>
3090 a <span>foo</span>
3091 </pre>
3092 <p>b</p>
3093 <div>foo</div>
3094 !!end
3095
3096 !!test
3097 3c. Indent-Pre and block tags (pre-content on separate line)
3098 !! wikitext
3099 <p>
3100 foo
3101 </p>
3102
3103 <div>
3104 foo
3105 </div>
3106
3107 <center>
3108 foo
3109 </center>
3110
3111 <blockquote>
3112 foo
3113 </blockquote>
3114
3115 <blockquote>
3116 <pre>
3117 foo
3118 </pre>
3119 </blockquote>
3120
3121 <table><tr><td>
3122 foo
3123 </td></tr></table>
3124
3125 <ul><li>
3126 foo
3127 </li></ul>
3128
3129 !! html
3130 <p>
3131 foo
3132 </p>
3133 <div>
3134 <pre>foo
3135 </pre>
3136 </div>
3137 <center>
3138 <pre>foo
3139 </pre>
3140 </center>
3141 <blockquote>
3142 <p> foo
3143 </p>
3144 </blockquote>
3145 <blockquote>
3146 <pre>
3147 foo
3148 </pre>
3149 </blockquote>
3150 <table><tr><td>
3151 <pre>foo
3152 </pre>
3153 </td></tr></table>
3154 <ul><li>
3155 foo
3156 </li></ul>
3157
3158 !!end
3159
3160 !!test
3161 4. Indent-Pre and extension tags
3162 !! wikitext
3163 a <gallery>
3164 File:foobar.jpg
3165 </gallery>
3166 !! html
3167 a <ul class="gallery mw-gallery-traditional">
3168 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
3169 <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>
3170 <div class="gallerytext">
3171 </div>
3172 </div></li>
3173 </ul>
3174
3175 !! html+tidy
3176 <p>a</p>
3177 <ul class="gallery mw-gallery-traditional">
3178 <li class="gallerybox" style="width: 155px">
3179 <div style="width: 155px">
3180 <div class="thumb" style="width: 150px;">
3181 <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>
3182 </div>
3183 <div class="gallerytext"></div>
3184 </div>
3185 </li>
3186 </ul>
3187 !!end
3188
3189 !! test
3190 Table wikitext syntax outside wiki-tables
3191 !! wikitext
3192 a
3193 ! not a table heading
3194 |- not a table row
3195 | not a table cell
3196 | class="foo bar" | baz
3197 b
3198 |}
3199 |-
3200 c
3201 !! html
3202 <p>a
3203 ! not a table heading
3204 |- not a table row
3205 | not a table cell
3206 | class="foo bar" | baz
3207 b
3208 |}
3209 |-
3210 c
3211 </p>
3212 !! end
3213
3214 !!test
3215 Render paragraphs when indent-pre is suppressed in blocklevels
3216 !! wikitext
3217 <blockquote>
3218 foo
3219
3220 bar
3221 </blockquote>
3222 !! html
3223 <blockquote>
3224 <p> foo
3225 </p><p> bar
3226 </p>
3227 </blockquote>
3228
3229 !!end
3230
3231 !!test
3232 4. Multiple spaces at start-of-line
3233 !! wikitext
3234 <p> foo </p>
3235 foo
3236 {|
3237 |foo
3238 |}
3239 !! html
3240 <p> foo </p>
3241 <pre> foo
3242 </pre>
3243 <table>
3244 <tr>
3245 <td>foo
3246 </td></tr></table>
3247
3248 !!end
3249
3250 ## NOTE: the leading white-space chars on empty line are significant
3251 !! test
3252 5a. White-space in indent-pre
3253 !! wikitext
3254 a<br />
3255
3256 b
3257 !! html
3258 <pre>a<br />
3259
3260 b
3261 </pre>
3262 !! end
3263
3264 ## NOTE: the leading white-space chars on empty line are significant
3265 !! test
3266 5b. White-space in indent-pre
3267 !! wikitext
3268 a
3269
3270 b
3271
3272
3273 c
3274 !! html
3275 <pre>a
3276
3277 b
3278
3279
3280 c
3281 </pre>
3282 !! end
3283
3284 !! test
3285 5c. White-space in indent-pre
3286 !! wikitext
3287 ''a''
3288 ''b''
3289 ''c''
3290 !! html
3291 <pre><i>a</i>
3292 <i>b</i>
3293 <i>c</i>
3294 </pre>
3295 !! end
3296
3297 !! test
3298 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3299 !! wikitext
3300 a
3301
3302 <!-- continue -->
3303 b
3304
3305 c
3306
3307 d
3308 !! html
3309 <pre>a
3310
3311 b
3312 </pre>
3313 <pre>c
3314
3315 </pre>
3316 <p>d
3317 </p>
3318 !! end
3319
3320 !! test
3321 7a. Indent-pre and category links
3322 !! options
3323 parsoid=wt2html,wt2wt
3324 !! wikitext
3325 [[Category:foo]] <!-- No pre-wrapping -->
3326 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3327 !! html/php+tidy
3328 !! html/parsoid
3329 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3330 <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 -->
3331 !! end
3332
3333 ## We used to, but no longer wt2wt this test since the default serializer
3334 ## will normalize all categories to serialize on their own line.
3335 ## This wikitext usage is going to be fairly uncommon in production and
3336 ## selser will take care of preserving formatting in those scenarios.
3337 !! test
3338 7b. Indent-pre and category links
3339 !! options
3340 parsoid=wt2html
3341 !! wikitext
3342 [[Category:foo]] a
3343 [[Category:foo]] {{echo|b}}
3344 !! html/parsoid
3345 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3346 <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>
3347 !! end
3348
3349 !! test
3350 Indent-Pre: Newlines in comments shouldn't affect sol state
3351 !! wikitext
3352 a <!--
3353 foo
3354 --> b
3355 !! html/php+tidy
3356 <p>a b</p>
3357 !! html/parsoid
3358 <p>a <!--
3359 foo
3360 --> b</p>
3361 !! end
3362
3363 ###
3364 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3365 ###
3366
3367 !!test
3368 HTML-pre: 1. embedded newlines
3369 !! wikitext
3370 <pre>foo</pre>
3371
3372 <pre>
3373 foo
3374 </pre>
3375
3376 <pre>
3377
3378 foo
3379 </pre>
3380
3381 <pre>
3382
3383
3384 foo
3385 </pre>
3386 !! html/php+tidy
3387 <pre>
3388 foo
3389 </pre>
3390 <pre>
3391 foo
3392 </pre>
3393 <pre>
3394
3395 foo
3396 </pre>
3397 <pre>
3398
3399
3400 foo
3401 </pre>
3402 !! html/parsoid
3403 <pre data-parsoid='{"stx":"html"}'>foo</pre>
3404
3405 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
3406 foo
3407 </pre>
3408
3409 <pre data-parsoid='{"stx":"html"}'>
3410
3411 foo
3412 </pre>
3413
3414 <pre data-parsoid='{"stx":"html"}'>
3415
3416
3417 foo
3418 </pre>
3419 !!end
3420
3421 !! test
3422 HTML-pre: big spaces
3423 !! wikitext
3424 <pre>
3425
3426
3427
3428
3429 haha
3430
3431
3432
3433
3434 haha
3435
3436
3437
3438
3439 </pre>
3440 !! html/php+tidy
3441 <pre>
3442
3443
3444
3445
3446 haha
3447
3448
3449
3450
3451 haha
3452
3453
3454
3455
3456 </pre>
3457 !! html/parsoid
3458 <pre data-parsoid='{"stx":"html"}'>
3459
3460
3461
3462
3463 haha
3464
3465
3466
3467
3468 haha
3469
3470
3471
3472
3473 </pre>
3474 !! end
3475
3476 !!test
3477 HTML-pre: 2: indented text
3478 !! wikitext
3479 <pre>
3480 foo
3481 </pre>
3482 !! html
3483 <pre>
3484 foo
3485 </pre>
3486
3487 !!end
3488
3489 !!test
3490 HTML-pre: 3: other wikitext
3491 !! wikitext
3492 <pre>
3493 * foo
3494 # bar
3495 = no-h =
3496 '' no-italic ''
3497 [[ NoLink ]]
3498 </pre>
3499 !! html/php
3500 <pre>
3501 * foo
3502 # bar
3503 = no-h =
3504 '' no-italic ''
3505 [[ NoLink ]]
3506 </pre>
3507
3508 !! html/parsoid
3509 <pre data-parsoid='{"stx":"html","strippedNL":true}'>* foo
3510 # bar
3511 = no-h =
3512 '' no-italic ''
3513 [[ NoLink ]]
3514 </pre>
3515 !!end
3516
3517 ###
3518 ### Definition lists
3519 ###
3520 !! test
3521 Simple definition
3522 !! wikitext
3523 ; name : Definition
3524 !! html
3525 <dl><dt> name&#160;</dt>
3526 <dd> Definition</dd></dl>
3527
3528 !! end
3529
3530 !! test
3531 Definition list for indentation only
3532 !! wikitext
3533 : Indented text
3534 !! html
3535 <dl><dd> Indented text</dd></dl>
3536
3537 !! end
3538
3539 !! test
3540 Definition list with no space
3541 !! wikitext
3542 ;name:Definition
3543 !! html
3544 <dl><dt>name</dt>
3545 <dd>Definition</dd></dl>
3546
3547 !!end
3548
3549 !! test
3550 Definition list with URL link
3551 !! wikitext
3552 ; http://example.com/ : definition
3553 !! html
3554 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3555 <dd> definition</dd></dl>
3556
3557 !! end
3558
3559 !! test
3560 Definition list with bracketed URL link
3561 !! wikitext
3562 ;[http://www.example.com/ Example]:Something about it
3563 !! html
3564 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3565 <dd>Something about it</dd></dl>
3566
3567 !! end
3568
3569 !! test
3570 Definition list with wikilink containing colon
3571 !! wikitext
3572 ; [[Help:FAQ]]: The least-read page on Wikipedia
3573 !! html
3574 <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>
3575 <dd> The least-read page on Wikipedia</dd></dl>
3576
3577 !! end
3578
3579 # At Brion's and JeLuF's insistence... :)
3580 !! test
3581 Definition list with news link containing colon
3582 !! wikitext
3583 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
3584 !! html/php
3585 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3586 <dd> This isn't even a real newsgroup!</dd></dl>
3587
3588 !! html/parsoid
3589 <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>
3590 !! end
3591
3592 !! test
3593 Malformed definition list with colon
3594 !! wikitext
3595 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3596 !! html
3597 <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>
3598
3599 !! end
3600
3601 !! test
3602 Definition lists: colon in external link text
3603 !! wikitext
3604 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3605 !! html
3606 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3607 <dd> OK, I made that up</dd></dl>
3608
3609 !! end
3610
3611 !! test
3612 Definition lists: colon in HTML attribute
3613 !! wikitext
3614 ;<b style="display: inline">bold</b>
3615 !! html
3616 <dl><dt><b style="display: inline">bold</b></dt></dl>
3617
3618 !! end
3619
3620 !! test
3621 Definition lists: self-closed tag
3622 !! wikitext
3623 ;one<br/>two : two-line fun
3624 !! html
3625 <dl><dt>one<br />two&#160;</dt>
3626 <dd> two-line fun</dd></dl>
3627
3628 !! end
3629
3630 !! test
3631 Bug 11748: Literal closing tags
3632 !! wikitext
3633 <dl>
3634 <dt>test 1</dt>
3635 <dd>test test test test test</dd>
3636 <dt>test 2</dt>
3637 <dd>test test test test test</dd>
3638 </dl>
3639 !! html
3640 <dl>
3641 <dt>test 1</dt>
3642 <dd>test test test test test</dd>
3643 <dt>test 2</dt>
3644 <dd>test test test test test</dd>
3645 </dl>
3646
3647 !! end
3648
3649 !! test
3650 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3651 !! wikitext
3652 <ul><li>
3653 ; term : description
3654 * unordered
3655 </li></ul>
3656 !! html
3657 <ul><li>
3658 <dl><dt> term&#160;</dt>
3659 <dd> description</dd></dl>
3660 <ul><li> unordered</li></ul>
3661 </li></ul>
3662
3663 !! end
3664
3665 !! test
3666
3667 Definition list with empty definition and following paragraph
3668 !! wikitext
3669 ; term:
3670 Paragraph text
3671 !! html
3672 <dl><dt> term</dt>
3673 <dd></dd></dl>
3674 <p>Paragraph text
3675 </p>
3676 !! end
3677
3678 !! test
3679 Nested definition lists using html syntax
3680 !! wikitext
3681 <dl><dt>x</dt>
3682 <dd>a</dd>
3683 <dd>b</dd></dl>
3684
3685 !! end
3686
3687 !! test
3688 Definition Lists: No nesting: Multiple dd's
3689 !! wikitext
3690 ;x
3691 :a
3692 :b
3693 !! html
3694 <dl><dt>x</dt>
3695 <dd>a</dd>
3696 <dd>b</dd></dl>
3697
3698 !! end
3699
3700 !! test
3701 Definition Lists: Indentation: Regular
3702 !! wikitext
3703 :i1
3704 ::i2
3705 :::i3
3706 !! html
3707 <dl><dd>i1
3708 <dl><dd>i2
3709 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3710
3711 !! end
3712
3713 !! test
3714 Definition Lists: Indentation: Missing 1st level
3715 !! wikitext
3716 ::i2
3717 :::i3
3718 !! html
3719 <dl><dd><dl><dd>i2
3720 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3721
3722 !! end
3723
3724 !! test
3725 Definition Lists: Indentation: Multi-level indent
3726 !! wikitext
3727 :::i3
3728 !! html
3729 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3730
3731 !! end
3732
3733 !! test
3734 Definition Lists: Hacky use to indent tables
3735 !! wikitext
3736 ::{|
3737 |foo
3738 |bar
3739 |}
3740 this text
3741 should be left alone
3742 !! html
3743 <dl><dd><dl><dd><table>
3744 <tr>
3745 <td>foo
3746 </td>
3747 <td>bar
3748 </td></tr></table></dd></dl></dd></dl>
3749 <p>this text
3750 should be left alone
3751 </p>
3752 !! end
3753
3754 !! test
3755 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3756 !! wikitext
3757 <!-- foo -->
3758 ::{|
3759 |foo
3760 |bar
3761 |}<!-- bar -->
3762 this text
3763 should be left alone
3764 !! html/parsoid
3765 <!-- foo -->
3766 <dl><dd><dl><dd><table><tr>
3767 <td>foo</td>
3768 <td>bar</td>
3769 </tr></table><!-- bar --></dd></dl></dd></dl>
3770 <p>this text
3771 should be left alone</p>
3772 !! end
3773
3774 !! test
3775 Definition Lists: Hacky use to indent tables, with comment before table
3776 !! wikitext
3777 ::<!-- foo -->{|
3778 |foo
3779 |}
3780 !! html/parsoid
3781 <dl><dd><dl><dd><!-- foo --><table><tr>
3782 <td>foo</td>
3783 </tr></table></dd></dl></dd></dl>
3784 !! end
3785
3786 # The trailing whitespace in this test is to catch a regression in
3787 # Parsoid after T54473.
3788 !! test
3789 Definition Lists: Hacky use to indent tables (WS-insensitive)
3790 !! wikitext
3791 : {|
3792 |a
3793 |}
3794 !! html/php
3795 <dl><dd><table>
3796 <tr>
3797 <td>a
3798 </td></tr></table></dd></dl>
3799
3800 !! html/parsoid
3801 <dl><dd> <table>
3802 <tbody><tr><td>a</td></tr>
3803 </tbody></table> </dd></dl>
3804 !! end
3805
3806 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3807 ## as an empty dt item. It also ignores all but the last ";" when followed
3808 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3809 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3810 ## ";"s.
3811 ##
3812 ## Ex: ";;t2 ::d2" is transformed into:
3813 ##
3814 ## <dl>
3815 ## <dt>t2 </dt>
3816 ## <dd>
3817 ## <dl>
3818 ## <dt></dt>
3819 ## <dd>d2</dd>
3820 ## </dl>
3821 ## </dd>
3822 ## </dl>
3823 ##
3824 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3825 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3826 ##
3827 ## <dl>
3828 ## <dt>
3829 ## <dl>
3830 ## <dt>t2 </dt>
3831 ## <dd>:d2</dd>
3832 ## </dl>
3833 ## </dt>
3834 ## </dl>
3835 ##
3836 ## All Parsoid only definition list tests have this difference.
3837 ##
3838 ## See also: https://phabricator.wikimedia.org/T8569
3839 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3840
3841 !! test
3842 Table / list interaction: indented table with lists in table contents
3843 !! wikitext
3844 :{|
3845 |-
3846 | a
3847 * b
3848 |-
3849 | c
3850 * d
3851 |}
3852 !! html
3853 <dl><dd><table>
3854
3855 <tr>
3856 <td> a
3857 <ul><li> b</li></ul>
3858 </td></tr>
3859 <tr>
3860 <td> c
3861 <ul><li> d</li></ul>
3862 </td></tr></table></dd></dl>
3863
3864 !! end
3865
3866 !!test
3867 Table / list interaction: lists nested in tables nested in indented lists
3868 !! wikitext
3869 :{|
3870 |
3871 :a
3872 :b
3873 |
3874 *c
3875 *d
3876 |}
3877
3878 *e
3879 *f
3880 !! html
3881 <dl><dd><table>
3882 <tr>
3883 <td>
3884 <dl><dd>a</dd>
3885 <dd>b</dd></dl>
3886 </td>
3887 <td>
3888 <ul><li>c</li>
3889 <li>d</li></ul>
3890 </td></tr></table></dd></dl>
3891 <ul><li>e</li>
3892 <li>f</li></ul>
3893
3894 !!end
3895
3896 !! test
3897 Definition Lists: Nesting: Multi-level (Parsoid only)
3898 !! options
3899 parsoid
3900 !! wikitext
3901 ;t1 :d1
3902 ;;t2 ::d2
3903 ;;;t3 :::d3
3904 !! html
3905 <dl>
3906 <dt>t1 </dt>
3907 <dd>d1</dd>
3908 <dt>
3909 <dl>
3910 <dt>t2 </dt>
3911 <dd>:d2</dd>
3912 <dt>
3913 <dl>
3914 <dt>t3 </dt>
3915 <dd>::d3</dd>
3916 </dl>
3917 </dt>
3918 </dl>
3919 </dt>
3920 </dl>
3921
3922
3923 !! end
3924
3925
3926 !! test
3927 Definition Lists: Nesting: Test 2 (Parsoid only)
3928 !! wikitext
3929 ;t1
3930 ::d2
3931 !! html/php+tidy
3932 <dl>
3933 <dt>t1</dt>
3934 <dd>
3935 <dl>
3936 <dd>d2</dd>
3937 </dl>
3938 </dd>
3939 </dl>
3940 !! html/parsoid
3941 <dl>
3942 <dt>t1</dt>
3943 <dd>
3944 <dl>
3945 <dd>d2</dd>
3946 </dl>
3947 </dd>
3948 </dl>
3949
3950 !! end
3951
3952
3953 !! test
3954 Definition Lists: Nesting: Test 3 (Parsoid only)
3955 !! wikitext
3956 :;t1
3957 ::::d2
3958 !! html/php+tidy
3959 <dl>
3960 <dd>
3961 <dl>
3962 <dt>t1</dt>
3963 <dd>
3964 <dl>
3965 <dd>
3966 <dl>
3967 <dd>d2</dd>
3968 </dl>
3969 </dd>
3970 </dl>
3971 </dd>
3972 </dl>
3973 </dd>
3974 </dl>
3975 !! html/parsoid
3976 <dl>
3977 <dd>
3978 <dl>
3979 <dt>t1</dt>
3980 <dd>
3981 <dl>
3982 <dd>
3983 <dl>
3984 <dd>d2</dd>
3985 </dl>
3986 </dd>
3987 </dl>
3988 </dd>
3989 </dl>
3990 </dd>
3991 </dl>
3992
3993 !! end
3994
3995
3996 !! test
3997 Definition Lists: Nesting: Test 4
3998 !! wikitext
3999 ::;t3
4000 :::d3
4001 !! html
4002 <dl><dd><dl><dd><dl><dt>t3</dt>
4003 <dd>d3</dd></dl></dd></dl></dd></dl>
4004
4005 !! end
4006
4007
4008 ## The Parsoid team believes the following three test exposes a
4009 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
4010 ## wrong to close the <dl> after the <dt> containing the <ul>.)
4011 ## It also exposes a "misfeature" in tidy, which doesn't like
4012 ## <dl> tags with a single <dt> child; it converts the <dt> into
4013 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
4014 !! test
4015 Definition Lists: Mixed Lists: Test 1
4016 !! wikitext
4017 :;* foo
4018 ::* bar
4019 :; baz
4020 !! html/php
4021 <dl><dd><dl><dt><ul><li> foo</li>
4022 <li> bar</li></ul></dt></dl>
4023 <dl><dt> baz</dt></dl></dd></dl>
4024
4025 !! html/php+tidy
4026 <dl>
4027 <dd>
4028 <dl>
4029 <dd>
4030 <ul>
4031 <li>foo</li>
4032 <li>bar</li>
4033 </ul>
4034 </dd>
4035 </dl>
4036 <dl>
4037 <dt>baz</dt>
4038 </dl>
4039 </dd>
4040 </dl>
4041 !! html/parsoid
4042 <dl>
4043 <dd><dl>
4044 <dt><ul>
4045 <li> foo
4046 </li>
4047 </ul></dt>
4048 <dd><ul>
4049 <li> bar
4050 </li>
4051 </ul></dd>
4052 <dt> baz</dt>
4053 </dl></dd>
4054 </dl>
4055 !! end
4056
4057 !! test
4058 Definition Lists: Mixed Lists: Test 2
4059 !! wikitext
4060 *: d1
4061 *: d2
4062 !! html
4063 <ul><li><dl><dd> d1</dd>
4064 <dd> d2</dd></dl></li></ul>
4065
4066 !! end
4067
4068
4069 !! test
4070 Definition Lists: Mixed Lists: Test 3
4071 !! wikitext
4072 *::: d1
4073 *::: d2
4074 !! html
4075 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
4076 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
4077
4078 !! end
4079
4080
4081 !! test
4082 Definition Lists: Mixed Lists: Test 4
4083 !! wikitext
4084 *;d1 :d2
4085 *;d3 :d4
4086 !! html
4087 <ul><li><dl><dt>d1&#160;</dt>
4088 <dd>d2</dd>
4089 <dt>d3&#160;</dt>
4090 <dd>d4</dd></dl></li></ul>
4091
4092 !! end
4093
4094
4095 !! test
4096 Definition Lists: Mixed Lists: Test 5
4097 !! wikitext
4098 *:d1
4099 *:: d2
4100 !! html
4101 <ul><li><dl><dd>d1
4102 <dl><dd> d2</dd></dl></dd></dl></li></ul>
4103
4104 !! end
4105
4106
4107 !! test
4108 Definition Lists: Mixed Lists: Test 6
4109 !! wikitext
4110 #*:d1
4111 #*::: d3
4112 !! html
4113 <ol><li><ul><li><dl><dd>d1
4114 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4115
4116 !! end
4117
4118
4119 !! test
4120 Definition Lists: Mixed Lists: Test 7
4121 !! wikitext
4122 :* d1
4123 :* d2
4124 !! html
4125 <dl><dd><ul><li> d1</li>
4126 <li> d2</li></ul></dd></dl>
4127
4128 !! end
4129
4130
4131 !! test
4132 Definition Lists: Mixed Lists: Test 8
4133 !! wikitext
4134 :* d1
4135 ::* d2
4136 !! html
4137 <dl><dd><ul><li> d1</li></ul>
4138 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
4139
4140 !! end
4141
4142
4143 !! test
4144 Definition Lists: Mixed Lists: Test 9
4145 !! wikitext
4146 *;foo :bar
4147 !! html
4148 <ul><li><dl><dt>foo&#160;</dt>
4149 <dd>bar</dd></dl></li></ul>
4150
4151 !! end
4152
4153
4154 !! test
4155 Definition Lists: Mixed Lists: Test 10
4156 !! wikitext
4157 *#;foo :bar
4158 !! html
4159 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4160 <dd>bar</dd></dl></li></ol></li></ul>
4161
4162 !! end
4163
4164 # The Parsoid team disagrees with the PHP parser's seemingly-random
4165 # rules regarding dd/dt on the next two tests. Parsoid is more
4166 # consistent, and recognizes the shared nesting and keeps the
4167 # still-open tags around until the nesting is complete.
4168 # (And tidy again converts <dt> to <dd> before 'bar'.)
4169
4170 !! test
4171 Definition Lists: Mixed Lists: Test 11
4172 !! wikitext
4173 *#*#;*;;foo :bar
4174 *#*#;boo :baz
4175 !! html/php
4176 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4177 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4178 <dl><dt>boo&#160;</dt>
4179 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4180
4181 !! html/php+tidy
4182 <ul>
4183 <li>
4184 <ol>
4185 <li>
4186 <ul>
4187 <li>
4188 <ol>
4189 <li>
4190 <dl>
4191 <dt>foo&#160;</dt>
4192 <dd>
4193 <ul>
4194 <li>
4195 <dl>
4196 <dd>
4197 <dl>
4198 <dt>bar</dt>
4199 </dl>
4200 </dd>
4201 </dl>
4202 </li>
4203 </ul>
4204 </dd>
4205 </dl>
4206 <dl>
4207 <dt>boo&#160;</dt>
4208 <dd>baz</dd>
4209 </dl>
4210 </li>
4211 </ol>
4212 </li>
4213 </ul>
4214 </li>
4215 </ol>
4216 </li>
4217 </ul>
4218 !! html/parsoid
4219 <ul>
4220 <li>
4221 <ol>
4222 <li>
4223 <ul>
4224 <li>
4225 <ol>
4226 <li>
4227 <dl>
4228 <dt>
4229 <ul>
4230 <li>
4231 <dl>
4232 <dt>
4233 <dl>
4234 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4235 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4236 </dl></dt>
4237 </dl></li>
4238 </ul></dt>
4239 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4240 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4241 </dl></li>
4242 </ol></li>
4243 </ul></li>
4244 </ol></li>
4245 </ul>
4246 !! end
4247
4248
4249 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
4250 # From whitelist:
4251 # * The test is wrong, there are two colons where there should be :;
4252 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4253 !! test
4254 Definition Lists: Weird Ones: Test 1
4255 !! wikitext
4256 *#;*::;; foo : bar (who uses this?)
4257 !! html/php
4258 <ul><li><ol><li><dl><dt> foo&#160;</dt>
4259 <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>
4260
4261 !! html/php+tidy
4262 <ul>
4263 <li>
4264 <ol>
4265 <li>
4266 <dl>
4267 <dt>foo&#160;</dt>
4268 <dd>
4269 <ul>
4270 <li>
4271 <dl>
4272 <dd>
4273 <dl>
4274 <dd>
4275 <dl>
4276 <dd>
4277 <dl>
4278 <dt>bar (who uses this?)</dt>
4279 </dl>
4280 </dd>
4281 </dl>
4282 </dd>
4283 </dl>
4284 </dd>
4285 </dl>
4286 </li>
4287 </ul>
4288 </dd>
4289 </dl>
4290 </li>
4291 </ol>
4292 </li>
4293 </ul>
4294 !! html/parsoid
4295 <ul>
4296 <li>
4297 <ol>
4298 <li>
4299 <dl>
4300 <dt>
4301 <ul>
4302 <li>
4303 <dl>
4304 <dd>
4305 <dl>
4306 <dd>
4307 <dl>
4308 <dt>
4309 <dl>
4310 <dt> foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span></dt>
4311 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
4312 </dl></dt>
4313 </dl></dd>
4314 </dl></dd>
4315 </dl></li>
4316 </ul></dt>
4317 </dl></li>
4318 </ol></li>
4319 </ul>
4320 !! end
4321
4322 !! test
4323 Definition Lists: colons occurring in tags
4324 !! wikitext
4325 ;a:b
4326 ;'''a:b'''
4327 ;<i>a:b</i>
4328 ;<span>a:b</span>
4329 ;<div>a:b</div>
4330 ;<div>a
4331 :b</div>
4332 ;{{echo|a:b}}
4333 ;{{echo|''a:b''}}
4334 ;;;''a:b''
4335 !! html+tidy
4336 <dl>
4337 <dt>a</dt>
4338 <dd>b</dd>
4339 <dt><b>a:b</b></dt>
4340 <dt><i>a:b</i></dt>
4341 <dt><span>a:b</span></dt>
4342 <dd>
4343 <div>a:b</div>
4344 </dd>
4345 <dd>
4346 <div>a
4347 <dl>
4348 <dd>b</dd>
4349 </dl>
4350 </div>
4351 </dd>
4352 <dt>a</dt>
4353 <dd>b</dd>
4354 <dt><i>a:b</i></dt>
4355 </dl>
4356 <dl>
4357 <dd>
4358 <dl>
4359 <dd>
4360 <dl>
4361 <dt><i>a:b</i></dt>
4362 </dl>
4363 </dd>
4364 </dl>
4365 </dd>
4366 </dl>
4367 !! html/parsoid
4368 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4369 <dt><b>a:b</b></dt>
4370 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4371 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4372 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4373 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4374 <dd>b</dd>
4375 <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>
4376 <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>
4377 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4378 !! end
4379
4380 !! test
4381 Definition Lists: colons and tables 1
4382 !! wikitext
4383 :{|
4384 | x
4385 |}
4386 :{|
4387 | y
4388 |}
4389 !! html
4390 <dl><dd><table>
4391 <tr>
4392 <td> x
4393 </td></tr></table></dd></dl>
4394 <dl><dd><table>
4395 <tr>
4396 <td> y
4397 </td></tr></table></dd></dl>
4398
4399 !! end
4400
4401 # Parsoid's output (as documented below) differs from php's in this case.
4402 # This is probably a bug. If we fixup parsoid to match php's output, the
4403 # above test should pass and the below test case can be removed. It is
4404 # unclear which output is more desirable.
4405
4406 !! test
4407 Definition Lists: colons and tables 2
4408 !! wikitext
4409 :{|
4410 | x
4411 |}
4412 :{|
4413 | y
4414 |}
4415 !! html/parsoid
4416 <dl><dd><table>
4417 <tr>
4418 <td> x
4419 </td></tr></table></dd>
4420 <dd><table>
4421 <tr>
4422 <td> y
4423 </td></tr></table></dd></dl>
4424 !! end
4425
4426 !! test
4427 Definition Lists: template interaction
4428 !! wikitext
4429 ::{{definition_list}}
4430
4431 :one
4432 ::{{definition_list}}
4433 :::two
4434 :::three
4435 ::four
4436 !! html/parsoid
4437 <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">
4438 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4439
4440 <dl><dd data-parsoid='{}'>one
4441 <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">
4442 </span><dd about="#mwt2">two
4443 <dl><dd>two</dd>
4444 <dd>three</dd></dl></dd>
4445 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4446 !! end
4447
4448
4449 ###
4450 ### External links
4451 ###
4452 !! test
4453 External links: non-bracketed
4454 !! wikitext
4455 Non-bracketed: http://example.com
4456 !! html
4457 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4458 </p>
4459 !! end
4460
4461 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4462 !! test
4463 External links: numbered
4464 !! wikitext
4465 Numbered: [http://example.com]
4466 Numbered: [http://example.net]
4467 Numbered: [http://example.com]
4468 !! html/php
4469 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4470 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4471 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4472 </p>
4473 !! html/parsoid
4474 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
4475 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
4476 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
4477 !!end
4478
4479 !! test
4480 External links: specified text
4481 !! wikitext
4482 Specified text: [http://example.com link]
4483 !! html
4484 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4485 </p>
4486 !!end
4487
4488 !! test
4489 External links: trail
4490 !! wikitext
4491 Linktrails should not work for external links: [http://example.com link]s
4492 !! html
4493 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4494 </p>
4495 !! end
4496
4497 !! test
4498 External links: dollar sign in URL
4499 !! wikitext
4500 http://example.com/1$2345
4501 !! html
4502 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4503 </p>
4504 !! end
4505
4506 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4507 !! test
4508 External links: dollar sign in URL (autonumber)
4509 !! wikitext
4510 [http://example.com/1$2345]
4511 !! html/php
4512 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4513 </p>
4514 !! html/parsoid
4515 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4516 !!end
4517
4518 !! test
4519 External links: open square bracket forbidden in URL (bug 4377)
4520 !! options
4521 parsoid=wt2html,wt2wt,html2html
4522 !! wikitext
4523 http://example.com/1[2345
4524 !! html/php
4525 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4526 </p>
4527 !! html/parsoid
4528 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4529 !! end
4530
4531 !! test
4532 External links: open square bracket forbidden in URL (named) (bug 4377)
4533 !! options
4534 parsoid=wt2html,html2html
4535 !! wikitext
4536 [http://example.com/1[2345]
4537 !! html/php
4538 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4539 </p>
4540 !! html/parsoid
4541 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4542 !!end
4543
4544 # parsoid adds a space before the link name
4545 !! test
4546 External links: open square bracket forbidden in URL (named) (bug 4377)
4547 Parsoid variant.
4548 !! wikitext
4549 [http://example.com/1 [2345]
4550 !! html
4551 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4552 </p>
4553 !!end
4554
4555 !! test
4556 External links: nowiki in URL link text (bug 6230)
4557 !! wikitext
4558 [http://example.com/ <nowiki>''example site''</nowiki>]
4559 !! html
4560 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4561 </p>
4562 !! end
4563
4564 !! test
4565 External links: newline forbidden in text (bug 6230 regression check)
4566 !! wikitext
4567 [http://example.com/ first
4568 second]
4569 !! html
4570 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4571 second]
4572 </p>
4573 !!end
4574
4575 !! test
4576 External links: Pipe char between url and text
4577 !! wikitext
4578 [http://example.com | link]
4579 !! html
4580 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4581 </p>
4582 !!end
4583
4584 !! test
4585 External links: protocol-relative URL in brackets
4586 !! wikitext
4587 [//example.com/ Test]
4588 !! html
4589 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4590 </p>
4591 !! end
4592
4593 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4594 !! test
4595 External links: protocol-relative URL in brackets without text
4596 !! wikitext
4597 [//example.com]
4598 !! html/php
4599 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4600 </p>
4601 !! html/parsoid
4602 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4603 !! end
4604
4605 !! test
4606 External links: protocol-relative URL in free text is left alone
4607 !! wikitext
4608 //example.com/Foo
4609 !! html
4610 <p>//example.com/Foo
4611 </p>
4612 !!end
4613
4614 !! test
4615 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
4616 !! wikitext
4617 foo//example.com/Foo
4618 !! html
4619 <p>foo//example.com/Foo
4620 </p>
4621 !! end
4622
4623 !! test
4624 External links: with no contents
4625 !! wikitext
4626 [http://en.wikipedia.org/wiki/Foo]
4627
4628 [[wikipedia:Foo|Bar]]
4629
4630 [[wikipedia:Foo|<span>Bar</span>]]
4631 !! html/php
4632 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4633 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4634 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4635 </p>
4636 !! html/parsoid
4637 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4638 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4639 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4640 !! end
4641
4642 !! test
4643 External links: Free with trailing punctuation
4644 !! wikitext
4645 http://example.com,
4646 http://example.com;
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/url_with_(brackets)
4654 (http://example.com/url_without_brackets)
4655 http://example.com/url_with_entity&amp;
4656 http://example.com/url_with_entity&#x26;
4657 http://example.com/url_with_entity&#038;
4658 http://example.com/url_with_entity&nbsp;
4659 http://example.com/url_with_entity&#xA0;
4660 http://example.com/url_with_entity&#160;
4661 http://example.com/url_with_entity&lt;
4662 http://example.com/url_with_entity&#x3C;
4663 http://example.com/url_with_entity&#60;
4664 !! html/php
4665 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4666 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4667 <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/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4674 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4675 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4676 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</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">http://example.com/url_with_entity</a>&#160;
4679 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#xa0;
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>&lt;
4682 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#x3c;
4683 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#60;
4684 </p>
4685 !! html/parsoid
4686 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>,
4687 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>;
4688 <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/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4695 (<a rel="mw:ExtLink" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4696 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4697 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</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">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>
4700 <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>
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;#160;","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;lt;","srcContent":"&lt;"}'>&lt;</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;#x3C;","srcContent":"&lt;"}'>&lt;</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;#60;","srcContent":"&lt;"}'>&lt;</span></p>
4705 !! end
4706
4707 !! test
4708 External links: tricky Parsoid html2html case
4709 !! options
4710 parsoid=wt2html,wt2wt,html2html
4711 !! wikitext
4712 http://example.com/url_with_entity&amp;amp;
4713 !! html/php
4714 <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>;
4715 </p>
4716 !! html/parsoid
4717 <p><a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;amp">http://example.com/url_with_entity&amp;amp</a>;</p>
4718 !! end
4719
4720 !! test
4721 External links: Free with trailing quotes (T113666)
4722 !! wikitext
4723 '''News:''' Stuff here
4724
4725 news:'a'b''c''d e
4726 !! html/php
4727 <p><b>News:</b> Stuff here
4728 </p><p><a rel="nofollow" class="external free" href="news:'a'b">news:'a'b</a><i>c</i>d e
4729 </p>
4730 !! html/parsoid
4731 <p><b>News:</b> Stuff here</p>
4732 <p><a rel="mw:ExtLink" href="news:'a'b">news:'a'b</a><i>c</i>d e</p>
4733 !! end
4734
4735 !! test
4736 External links: Lone protocols are never linked (T105697)
4737 !! wikitext
4738 http://
4739 http://;
4740 (http://)
4741 bitcoin:
4742 bitcoin:;
4743 (bitcoin:)
4744 !! html
4745 <p>http://
4746 http://;
4747 (http://)
4748 bitcoin:
4749 bitcoin:;
4750 (bitcoin:)
4751 </p>
4752 !! end
4753
4754 !! test
4755 External links: No preceding word characters allowed (bug 65278)
4756 !! wikitext
4757 NOPEhttp://example.com
4758 N0http://example.com
4759 ok:http://example.com
4760 ok-http://example.com
4761 !! html
4762 <p>NOPEhttp://example.com
4763 N0http://example.com
4764 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4765 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4766 </p>
4767 !! end
4768
4769 !! test
4770 External image
4771 !! wikitext
4772 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4773 !! html
4774 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4775 </p>
4776 !! end
4777
4778 !! test
4779 External image from https
4780 !! wikitext
4781 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4782 !! html
4783 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4784 </p>
4785 !! end
4786
4787 !! test
4788 External image (when not allowed)
4789 !! options
4790 wgAllowExternalImages=0
4791 !! wikitext
4792 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4793 !! html
4794 <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>
4795 </p>
4796 !! end
4797
4798 !! test
4799 Link to non-http image, no img tag
4800 !! wikitext
4801 Link to non-http image, no img tag: ftp://example.com/test.jpg
4802 !! html
4803 <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>
4804 </p>
4805 !! end
4806
4807 !! test
4808 External links: terminating separator
4809 !! wikitext
4810 Terminating separator: http://example.com/thing,
4811 !! html
4812 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4813 </p>
4814 !! end
4815
4816 !! test
4817 External links: intervening separator
4818 !! wikitext
4819 Intervening separator: http://example.com/1,2,3
4820 !! html
4821 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4822 </p>
4823 !! end
4824
4825 !! test
4826 External links: old bug with URL in query
4827 !! wikitext
4828 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4829 !! html
4830 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4831 </p>
4832 !! end
4833
4834 !! test
4835 External links: old URL-in-URL bug, mixed protocols
4836 !! wikitext
4837 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4838 !! html
4839 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4840 </p>
4841 !!end
4842
4843 !! test
4844 External links: URL in text
4845 !! wikitext
4846 URL in text: [http://example.com http://example.com]
4847 !! html
4848 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4849 </p>
4850 !! end
4851
4852 !! test
4853 External links: Clickable images
4854 !! wikitext
4855 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4856 !! html/php
4857 <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>
4858 </p>
4859 !! html/parsoid
4860 <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>
4861 !! end
4862
4863 !! test
4864 External links: raw ampersand
4865 !! wikitext
4866 Old &amp; use: http://x&y
4867 !! html
4868 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4869 </p>
4870 !! end
4871
4872 !! test
4873 External links: encoded ampersand
4874 !! wikitext
4875 Old &amp; use: http://x&amp;y
4876 !! html/php
4877 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4878 </p>
4879 !! html/parsoid
4880 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4881 !! end
4882
4883 !! test
4884 External links: encoded equals (bug 6102)
4885 !! wikitext
4886 http://example.com/?foo&#61;bar
4887 !! html/php
4888 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4889 </p>
4890 !! html/parsoid
4891 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4892 !! end
4893
4894 ##
4895 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4896 ## does it number them. As discussed in bug 53505, we can identify
4897 ## autonumbered links via CSS.
4898 ##
4899
4900 !! test
4901 External links: [raw ampersand]
4902 !! wikitext
4903 Old &amp; use: [http://x&y]
4904 !! html/php
4905 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4906 </p>
4907 !! html/parsoid
4908 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4909 !! end
4910
4911 # note that parsoid html is identical to [raw ampersand] case; so html2wt
4912 # mode will return the [raw ampersand] wikitext
4913 !! test
4914 External links: [encoded ampersand]
4915 !! options
4916 parsoid=wt2html,wt2wt,html2html
4917 !! wikitext
4918 Old &amp; use: [http://x&amp;y]
4919 !! html/php
4920 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4921 </p>
4922 !! html/parsoid
4923 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4924 !! end
4925
4926 !! test
4927 External links: [raw equals]
4928 !! wikitext
4929 [http://example.com/?foo=bar]
4930 !! html/php
4931 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4932 </p>
4933 !! html/parsoid
4934 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4935 !! end
4936
4937 # note that parsoid html is identical to [raw equals] case; so html2wt
4938 # mode will return the [raw equals] wikitext
4939 !! test
4940 External links: [encoded equals] (bug 6102)
4941 !! options
4942 parsoid=wt2html,wt2wt,html2html
4943 !! wikitext
4944 [http://example.com/?foo&#61;bar]
4945 !! html/php
4946 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4947 </p>
4948 !! html/parsoid
4949 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4950 !! end
4951
4952 # xxx parsoid strips the IDN character, so the round-trip tests will
4953 # obviously fail and are disabled. --cscott
4954 !! test
4955 External links: [IDN ignored character reference in hostname; strip it right off]
4956 !! options
4957 parsoid=wt2html,wt2wt,html2html
4958 !! wikitext
4959 [http://e&zwnj;xample.com/]
4960 !! html/php
4961 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
4962 </p>
4963 !! html/parsoid
4964 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
4965 !! end
4966
4967 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
4968 # Where an external link could easily circumvent the sanitization of the text of
4969 # a link like this (where an IDN-ignore character is in the URL somewhere), this
4970 # test demands a higher standard. That's a bit strange.
4971 #
4972 # Example:
4973 #
4974 # http://e‌xample.com -> [http://example.com|http://example.com]
4975 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
4976 #
4977 # The first example is sanitized, but the second is not. Any security benefits
4978 # from this production are trivial to circumvent. Either remove this test and
4979 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
4980 # the test accordingly.
4981 #
4982 # All our love,
4983 # The Parsoid team.
4984 # xxx parsoid strips the IDN character, so the round-trip tests will
4985 # obviously fail and are disabled. --cscott
4986 !! test
4987 External links: IDN ignored character reference in hostname; strip it right off
4988 !! options
4989 parsoid=wt2html,html2html
4990 !! wikitext
4991 http://e&zwnj;xample.com/
4992 !! html/php
4993 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
4994 </p>
4995 !! html/parsoid
4996 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
4997 !! end
4998
4999 !! test
5000 External links: www.jpeg.org (bug 554)
5001 !! wikitext
5002 http://www.jpeg.org
5003 !! html
5004 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
5005 </p>
5006 !! end
5007
5008 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
5009 !! test
5010 External links: URL within URL (original bug 2)
5011 !! wikitext
5012 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
5013 !! html/php
5014 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
5015 </p>
5016 !! html/parsoid
5017 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
5018 !! end
5019
5020 !! test
5021 BUG 361: URL inside bracketed URL
5022 !! wikitext
5023 [http://www.example.com/foo http://www.example.com/bar]
5024 !! html
5025 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
5026 </p>
5027 !! end
5028
5029 !! test
5030 BUG 361: URL within URL, not bracketed
5031 !! wikitext
5032 http://www.example.com/foo?=http://www.example.com/bar
5033 !! html
5034 <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>
5035 </p>
5036 !! end
5037
5038 !! test
5039 BUG 289: ">"-token in URL-tail
5040 !! wikitext
5041 http://www.example.com/<hello>
5042 !! html
5043 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
5044 </p>
5045 !!end
5046
5047 !! test
5048 BUG 289: literal ">"-token in URL-tail
5049 !! wikitext
5050 http://www.example.com/<b>html</b>
5051 !! html/php
5052 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
5053 </p>
5054 !! html/parsoid
5055 <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>
5056 !! end
5057
5058 !! test
5059 BUG 289: ">"-token in bracketed URL
5060 !! wikitext
5061 [http://www.example.com/<hello> stuff]
5062 !! html
5063 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
5064 </p>
5065 !!end
5066
5067 !! test
5068 BUG 289: literal ">"-token in bracketed URL
5069 !! wikitext
5070 [http://www.example.com/<b>html</b> stuff]
5071 !! html
5072 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
5073 </p>
5074 !!end
5075
5076 !! test
5077 BUG 289: literal double quote at end of URL
5078 !! wikitext
5079 http://www.example.com/"hello"
5080 !! html
5081 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
5082 </p>
5083 !!end
5084
5085 !! test
5086 BUG 289: literal double quote in bracketed URL
5087 !! wikitext
5088 [http://www.example.com/"hello" stuff]
5089 !! html
5090 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
5091 </p>
5092 !!end
5093
5094 !! test
5095 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
5096 !! wikitext
5097 [http://www.example.com test]
5098 !! html
5099 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
5100 </p>
5101 !! end
5102
5103 !! test
5104 External links: link text with spaces
5105 !! wikitext
5106 [http://www.example.com a b c]
5107 [http://www.example.com ''a'' ''b'']
5108 !! html
5109 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5110 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5111 </p>
5112 !! end
5113
5114 !! test
5115 External links: wiki links within external link (Bug 3695)
5116 !! options
5117 parsoid=wt2html,html2html
5118 !! wikitext
5119 [http://example.com [[wikilink]] embedded in ext link]
5120 !! html/php
5121 <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>
5122 </p>
5123 !! html/parsoid
5124 <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>
5125 !! end
5126
5127 !! test
5128 BUG 787: Links with one slash after the url protocol are invalid
5129 !! wikitext
5130 http:/example.com
5131
5132 [http:/example.com title]
5133 !! html
5134 <p>http:/example.com
5135 </p><p>[http:/example.com title]
5136 </p>
5137 !! end
5138
5139 !! test
5140 Bracketed external links with template-generated invalid target
5141 !! wikitext
5142 [{{echo|http:/example.com}} title]
5143 !! html
5144 <p>[http:/example.com title]
5145 </p>
5146 !! end
5147
5148 !! test
5149 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
5150 !! wikitext
5151 ''[http://example.com text'']
5152 [http://example.com '''text]'''
5153 ''Something [http://example.com in italic'']
5154 ''Something [http://example.com mixed''''', even bold]'''
5155 '''''Now [http://example.com both''''']
5156 !! html
5157 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5158 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5159 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5160 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5161 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5162 </p>
5163 !! end
5164
5165
5166 !! test
5167 Bug 4781: %26 in URL
5168 !! wikitext
5169 http://www.example.com/?title=AT%26T
5170 !! html/php
5171 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5172 </p>
5173 !! html/parsoid
5174 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
5175 !! end
5176
5177 # According to http://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5178 # % is actually legal in HTML5. Any change in output would need testing though.
5179 !! test
5180 Bug 4781, 5267: %25 in URL
5181 !! wikitext
5182 http://www.example.com/?title=100%25_Bran
5183 !! html/php
5184 <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>
5185 </p>
5186 !! html/parsoid
5187 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
5188 !! end
5189
5190 !! test
5191 Bug 4781, 5267: %28, %29 in URL
5192 !! wikitext
5193 http://www.example.com/?title=Ben-Hur_%281959_film%29
5194 !! html/php
5195 <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>
5196 </p>
5197 !! html/parsoid
5198 <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>
5199 !! end
5200
5201
5202 !! test
5203 Bug 4781: %26 in autonumber URL
5204 !! wikitext
5205 [http://www.example.com/?title=AT%26T]
5206 !! html/php
5207 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5208 </p>
5209 !! html/parsoid
5210 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
5211 !! end
5212
5213 !! test
5214 Bug 4781, 5267: %26 in autonumber URL
5215 !! wikitext
5216 [http://www.example.com/?title=100%25_Bran]
5217 !! html/php
5218 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5219 </p>
5220 !! html/parsoid
5221 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
5222 !! end
5223
5224 !! test
5225 Bug 4781, 5267: %28, %29 in autonumber URL
5226 !! wikitext
5227 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5228 !! html/php
5229 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5230 </p>
5231 !! html/parsoid
5232 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5233 !! end
5234
5235
5236 !! test
5237 Bug 4781: %26 in bracketed URL
5238 !! wikitext
5239 [http://www.example.com/?title=AT%26T link]
5240 !! html/php
5241 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5242 </p>
5243 !! html/parsoid
5244 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
5245 !! end
5246
5247 !! test
5248 Bug 4781, 5267: %25 in bracketed URL
5249 !! wikitext
5250 [http://www.example.com/?title=100%25_Bran link]
5251 !! html
5252 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5253 </p>
5254 !! end
5255
5256 !! test
5257 Bug 4781, 5267: %28, %29 in bracketed URL
5258 !! wikitext
5259 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5260 !! html/php
5261 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5262 </p>
5263 !! html/parsoid
5264 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5265 !! end
5266
5267 !! test
5268 External link containing a period in the anchor. (bug 63947)
5269 !! wikitext
5270 [//foo.org/bar#baz. bang]
5271
5272 [//foo.org/bar. bang]
5273 !! html/php
5274 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5275 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5276 </p>
5277 !! html/parsoid
5278 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
5279 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
5280 !! end
5281
5282 !! test
5283 External link containing a single quote. (bug 63947)
5284 !! wikitext
5285 [//foo.org/bar'baz]
5286
5287 [//foo.org/bar'baz bang]
5288 !! html/php
5289 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
5290 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
5291 </p>
5292 !! html/parsoid
5293 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
5294 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
5295 !! end
5296
5297 !! test
5298 External link containing double-single-quotes in text '' (bug 4598 sanity check)
5299 !! wikitext
5300 Some [http://example.com/ pretty ''italics'' and stuff]!
5301 !! html
5302 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5303 </p>
5304 !! end
5305
5306 !! test
5307 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
5308 !! wikitext
5309 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5310 !! html
5311 <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>
5312 </p>
5313 !! end
5314
5315 !! test
5316 External link containing double-single-quotes with no space separating the url from text in italics
5317 !! wikitext
5318 [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]].]
5319 !! html/php
5320 <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>
5321 </p>
5322 !! html/php+tidy
5323 <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>
5324 !! html/parsoid
5325 <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>
5326 !! end
5327
5328 !! test
5329 External link with comments in link text
5330 !! wikitext
5331 [http://www.google.com Google <!-- comment -->]
5332 !! html/php
5333 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5334 </p>
5335 !! html/parsoid
5336 <p><a rel="mw:ExtLink" href="http://www.google.com">Google <!-- comment --></a></p>
5337 !! end
5338
5339 !! test
5340 External link to bare IPv4 address
5341 !! wikitext
5342 [http://192.168.0.1 Link]
5343 !! html/php
5344 <p><a rel="nofollow" class="external text" href="http://192.168.0.1">Link</a>
5345 </p>
5346 !! html/parsoid
5347 <p><a rel="mw:ExtLink" href="http://192.168.0.1">Link</a></p>
5348 !! end
5349
5350 !! test
5351 URL-encoding in URL functions (single parameter)
5352 !! wikitext
5353 {{localurl:Some page|amp=&}}
5354 !! html
5355 <p>/index.php?title=Some_page&amp;amp=&amp;
5356 </p>
5357 !! end
5358
5359 !! test
5360 URL-encoding in URL functions (multiple parameters)
5361 !! wikitext
5362 {{localurl:Some page|q=?&amp=&}}
5363 !! html
5364 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5365 </p>
5366 !! end
5367
5368 !! test
5369 Brackets in urls
5370 !! wikitext
5371 http://example.com/index.php?foozoid%5B%5D=bar
5372
5373 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5374 !! html/php
5375 <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>
5376 </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>
5377 </p>
5378 !! html/parsoid
5379 <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>
5380
5381 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
5382 !! end
5383
5384 !! test
5385 IPv6 urls, autolink format (T23261)
5386 !! wikitext
5387 http://[2404:130:0:1000::187:2]/index.php
5388
5389 Examples from RFC 2373, section 2.2:
5390 * http://[1080::8:800:200C:417A]/unicast
5391 * http://[FF01::101]/multicast
5392 * http://[::1]/loopback
5393 * http://[::]/unspecified
5394 * http://[::13.1.68.3]/ipv4compat
5395 * http://[::FFFF:129.144.52.38]/ipv4compat
5396
5397 Examples from RFC 2732, section 2:
5398 * http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5399 * http://[1080:0:0:0:8:800:200C:417A]/index.html
5400 * http://[3ffe:2a00:100:7031::1]
5401 * http://[1080::8:800:200C:417A]/foo
5402 * http://[::192.9.5.5]/ipng
5403 * http://[::FFFF:129.144.52.38]:80/index.html
5404 * http://[2010:836B:4179::836B:4179]
5405
5406 !! html/php
5407 <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>
5408 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5409 </p>
5410 <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>
5411 <li> <a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5412 <li> <a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5413 <li> <a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5414 <li> <a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5415 <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>
5416 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5417 </p>
5418 <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>
5419 <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>
5420 <li> <a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5421 <li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5422 <li> <a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5423 <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>
5424 <li> <a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5425
5426 !! html/parsoid
5427 <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>
5428
5429 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5430 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5431 <li> <a rel="mw:ExtLink" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5432 <li> <a rel="mw:ExtLink" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5433 <li> <a rel="mw:ExtLink" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5434 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5435 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5436
5437 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5438 <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>
5439 <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>
5440 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5441 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5442 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5443 <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>
5444 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5445 !! end
5446
5447 !! test
5448 IPv6 urls, bracketed format (T23261)
5449 !! wikitext
5450 [http://[2404:130:0:1000::187:2]/index.php test]
5451
5452 Examples from RFC 2373, section 2.2:
5453 * [http://[1080::8:800:200C:417A] unicast]
5454 * [http://[FF01::101] multicast]
5455 * [http://[::1]/ loopback]
5456 * [http://[::] unspecified]
5457 * [http://[::13.1.68.3] ipv4compat]
5458 * [http://[::FFFF:129.144.52.38] ipv4compat]
5459
5460 Examples from RFC 2732, section 2:
5461 * [http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5462 * [http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5463 * [http://[3ffe:2a00:100:7031::1] 3]
5464 * [http://[1080::8:800:200C:417A]/foo 4]
5465 * [http://[::192.9.5.5]/ipng 5]
5466 * [http://[::FFFF:129.144.52.38]:80/index.html 6]
5467 * [http://[2010:836B:4179::836B:4179] 7]
5468
5469 !! html/php
5470 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5471 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5472 </p>
5473 <ul><li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5474 <li> <a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5475 <li> <a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5476 <li> <a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5477 <li> <a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5478 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5479 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5480 </p>
5481 <ul><li> <a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5482 <li> <a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5483 <li> <a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5484 <li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5485 <li> <a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5486 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5487 <li> <a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5488
5489 !! html/parsoid
5490 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php">test</a></p>
5491
5492 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5493 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5494 <li> <a rel="mw:ExtLink" href="http://[FF01::101]">multicast</a></li>
5495 <li> <a rel="mw:ExtLink" href="http://[::1]/">loopback</a></li>
5496 <li> <a rel="mw:ExtLink" href="http://[::]">unspecified</a></li>
5497 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]">ipv4compat</a></li>
5498 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5499
5500 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5501 <ul><li> <a rel="mw:ExtLink" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5502 <li> <a rel="mw:ExtLink" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5503 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5504 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5505 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">5</a></li>
5506 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5507 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5508 !! end
5509
5510 !! test
5511 Non-extlinks in brackets
5512 !! wikitext
5513 [foo]
5514 [foo bar]
5515 [foo ''bar'']
5516 [fool's] errand
5517 [fool's errand]
5518 [{{echo|foo}}]
5519 [{{echo|foo}} bar]
5520 [{{echo|foo}} ''bar'']
5521 [{{echo|foo}}l's] errand
5522 [{{echo|foo}}l's errand]
5523 [url={{echo|foo}}]
5524 [url=http://example.com]
5525 [http:// bare protocols don't count]
5526 !! html/php
5527 <p>[foo]
5528 [foo bar]
5529 [foo <i>bar</i>]
5530 [fool's] errand
5531 [fool's errand]
5532 [foo]
5533 [foo bar]
5534 [foo <i>bar</i>]
5535 [fool's] errand
5536 [fool's errand]
5537 [url=foo]
5538 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5539 [http:// bare protocols don't count]
5540 </p>
5541 !! html/parsoid
5542 <p>[foo]
5543 [foo bar]
5544 [foo <i>bar</i>]
5545 [fool's] errand
5546 [fool's errand]
5547 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span>]
5548 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> bar]
5549 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> <i>bar</i>]
5550 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span>] errand
5551 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span> errand]
5552 [<span typeof="mw:Placeholder" data-parsoid='{"src":"url={{echo|foo}}"}'>url=foo</span>]
5553 [url=<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>]
5554 [http:// bare protocols don't count]</p>
5555 !! end
5556
5557 !! test
5558 Percent encoding in external links
5559 !! wikitext
5560 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
5561 !! html/php
5562 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
5563 </p>
5564 !! html/parsoid
5565 <p><a rel="mw:ExtLink"
5566 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
5567 !! end
5568
5569 !! test
5570 Use url link syntax for links where the content is equal the link target
5571 !! wikitext
5572 http://example.com
5573 !! html/php
5574 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5575 </p>
5576 !! html/parsoid
5577 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5578 !! end
5579
5580 !! test
5581 Parenthesis in external links, especially URL links
5582 !! wikitext
5583 http://example.com)
5584
5585 http://example.com/test)
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/a)b
5596
5597 [http://example.com) foo]
5598 !! html/php
5599 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5600 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
5601 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</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/a)b">http://example.com/a)b</a>
5606 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5607 </p>
5608 !! html/parsoid
5609 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
5610 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
5611 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</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/a)b">http://example.com/a)b</a></p>
5616 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
5617 !! end
5618
5619 !! test
5620 Parenthesis in external links, w/ transclusion or comment
5621 !! wikitext
5622 (http://example.com/{{echo|hi}})
5623
5624 (http://example.com<!-- hi -->)
5625 !! html/php
5626 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5627 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5628 </p>
5629 !! html/parsoid
5630 <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>
5631
5632 <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>
5633 !! end
5634
5635 !! test
5636 Serialize <a> tags with invalid link targets as plain text
5637 !! options
5638 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
5639 !! html/parsoid
5640 <a rel="mw:WikiLink" href="[[foo]]">text</a>
5641 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
5642 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
5643 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
5644 !! wikitext
5645 text
5646 <nowiki>*</nowiki>text
5647 <nowiki>[[foo]]</nowiki>
5648 <nowiki>*a [[foo]]</nowiki>
5649 !! end
5650
5651 !! test
5652 mw:ExtLink -vs- mw:WikiLink (T94723)
5653 !! options
5654 parsoid=html2wt
5655 !! html/parsoid
5656 <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>
5657 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
5658 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5659 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5660 <p>
5661 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5662 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5663 </p>
5664 !! wikitext
5665 [[Foo|Bar]]
5666 [[Foo|Bar]]
5667 [[wikipedia:Foo|Bar]]
5668 [[wikipedia:Foo|Bar]]
5669
5670 [[wikipedia:European_Robin|European Robin]]
5671 [[wikipedia:European_Robin|European Robin]]
5672 !! end
5673
5674 !! test
5675 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
5676 !! options
5677 parsoid=wt2wt
5678 !! wikitext
5679 [http://en.wikipedia.org/wiki/European_Robin European Robin]
5680 !! html/parsoid
5681 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
5682 !! end
5683
5684
5685 ###
5686 ### Quotes
5687 ###
5688
5689 !! test
5690 Quotes
5691 !! wikitext
5692 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5693
5694 Normal text. '''''Bold italic text.''''' Normal text.
5695 !! html
5696 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5697 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5698 </p>
5699 !! end
5700
5701
5702 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5703 # parser strips. The wikitext contains just the first half of the bold
5704 # quote pair.
5705 !! test
5706 Unclosed and unmatched quotes
5707 !! wikitext
5708 '''''Bold italic text '''with bold deactivated''' in between.'''''
5709
5710 '''''Bold italic text ''with italic deactivated'' in between.'''''
5711
5712 '''Bold text..
5713
5714 ..spanning two paragraphs (should not work).'''
5715
5716 '''Bold tag left open
5717
5718 ''Italic tag left open
5719
5720 Normal text.
5721
5722 <!-- Unmatching number of opening, closing tags: -->
5723 '''This year''''s election ''should'' beat '''last year''''s.
5724
5725 ''Tom'''s car is bigger than ''Susan'''s.
5726
5727 Plain ''italic'''s plain
5728 !! html/php
5729 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5730 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5731 </p><p><b>Bold text..</b>
5732 </p><p>..spanning two paragraphs (should not work).
5733 </p><p><b>Bold tag left open</b>
5734 </p><p><i>Italic tag left open</i>
5735 </p><p>Normal text.
5736 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5737 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5738 </p><p>Plain <i>italic'</i>s plain
5739 </p>
5740 !! html/parsoid
5741 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5742 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5743 </p><p><b>Bold text..</b>
5744 </p><p>..spanning two paragraphs (should not work).<b></b>
5745 </p><p><b>Bold tag left open</b>
5746 </p><p><i>Italic tag left open</i>
5747 </p><p>Normal text.
5748 </p>
5749 <!-- Unmatching number of opening, closing tags: -->
5750 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5751 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5752 </p><p>Plain <i>italic'</i>s plain
5753 </p>
5754 !! end
5755
5756 ###
5757 ### Tables
5758 ###
5759 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5760 ###
5761
5762 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5763 # is the bare minimum required by the spec, see:
5764 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5765 # Parsoid team replies: empty table tags are legal in HTML5
5766 !! test
5767 A table with no data.
5768 !! options
5769 parsoid=wt2html
5770 !! wikitext
5771 {||}
5772 !! html/php
5773
5774 !! html/parsoid
5775 <table></table>
5776
5777 !! end
5778
5779 !! test
5780 A table with stray table end tags on start tag line (wt2html)
5781 !! options
5782 parsoid=wt2html
5783 !! wikitext
5784 {|style="color: red;"|}
5785
5786 {|style="color: red;" |}
5787 |foo
5788 |}
5789
5790 {|style="color: red;"|} id="foo"
5791 |foo
5792 |}
5793
5794 {|style="color: red;" |} id="foo"
5795 |foo
5796 |}
5797 !! html
5798 <table style="color: red;"></table>
5799
5800 <table style="color: red;">
5801 <tbody><tr>
5802 <td>foo</td>
5803 </tr></tbody>
5804 </table>
5805
5806 <table style="color: red;" id="foo">
5807 <tbody><tr>
5808 <td>foo</td>
5809 </tr></tbody>
5810 </table>
5811
5812 <table style="color: red;" id="foo">
5813 <tbody><tr>
5814 <td>foo</td>
5815 </tr></tbody>
5816 </table>
5817
5818 !! end
5819
5820 !! test
5821 A table with no data (take 2)
5822 !! wikitext
5823 {|
5824 |}
5825 !! html/parsoid
5826 <table></table>
5827 !! end
5828
5829 # A table with nothing but a caption is invalid XHTML, we might want to render
5830 # this as <p>caption</p>
5831 # Parsoid team replies: table with only a caption is legal in HTML5
5832 !! test
5833 A table with nothing but a caption
5834 !! wikitext
5835 {|
5836 |+ caption
5837 |}
5838 !! html/php
5839 <table>
5840 <caption> caption
5841 </caption><tr><td></td></tr></table>
5842
5843 !! html/parsoid
5844 <table><caption> caption</caption></table>
5845 !! end
5846
5847 !! test
5848 A table with caption with default-spaced attributes and a table row
5849 !! wikitext
5850 {|
5851 |+ style="color: red;" | caption1
5852 |-
5853 | foo
5854 |}
5855 !! html
5856 <table>
5857 <caption style="color: red;"> caption1
5858 </caption>
5859 <tr>
5860 <td> foo
5861 </td></tr></table>
5862
5863 !! end
5864
5865 !! test
5866 A table with captions with non-default spaced attributes and a table row
5867 !! wikitext
5868 {|
5869 |+style="color: red;"|caption2
5870 |+ style="color: red;"| caption3
5871 |-
5872 | foo
5873 |}
5874 !! html
5875 <table>
5876 <caption style="color: red;">caption2
5877 </caption>
5878 <caption style="color: red;"> caption3
5879 </caption>
5880 <tr>
5881 <td> foo
5882 </td></tr></table>
5883
5884 !! end
5885
5886 !! test
5887 Table td-cell syntax variations
5888 !! wikitext
5889 {|
5890 | foo bar foo | baz
5891 | foo bar foo || baz
5892 | style='color:red;' | baz
5893 | style='color:red;' || baz
5894 |}
5895 !! html
5896 <table>
5897 <tr>
5898 <td> baz
5899 </td>
5900 <td> foo bar foo </td>
5901 <td> baz
5902 </td>
5903 <td style="color:red;"> baz
5904 </td>
5905 <td> style='color:red;' </td>
5906 <td> baz
5907 </td></tr></table>
5908
5909 !! end
5910
5911 !! test
5912 Simple table
5913 !! wikitext
5914 {|
5915 | 1 || 2
5916 |-
5917 | 3 || 4
5918 |}
5919 !! html
5920 <table>
5921 <tr>
5922 <td> 1 </td>
5923 <td> 2
5924 </td></tr>
5925 <tr>
5926 <td> 3 </td>
5927 <td> 4
5928 </td></tr></table>
5929
5930 !! end
5931
5932 !! test
5933 Simple table but with multiple dashes for row wikitext
5934 !! wikitext
5935 {|
5936 | foo
5937 |-----
5938 | bar
5939 |}
5940 !! html
5941 <table>
5942 <tr>
5943 <td> foo
5944 </td></tr>
5945 <tr>
5946 <td> bar
5947 </td></tr></table>
5948
5949 !! end
5950
5951 !! test
5952 Multiplication table
5953 !! wikitext
5954 {| border="1" cellpadding="2"
5955 |+Multiplication table
5956 |-
5957 ! &times; !! 1 !! 2 !! 3
5958 |-
5959 ! 1
5960 | 1 || 2 || 3
5961 |-
5962 ! 2
5963 | 2 || 4 || 6
5964 |-
5965 ! 3
5966 | 3 || 6 || 9
5967 |-
5968 ! 4
5969 | 4 || 8 || 12
5970 |-
5971 ! 5
5972 | 5 || 10 || 15
5973 |}
5974 !! html
5975 <table border="1" cellpadding="2">
5976 <caption>Multiplication table
5977 </caption>
5978 <tr>
5979 <th> &#215; </th>
5980 <th> 1 </th>
5981 <th> 2 </th>
5982 <th> 3
5983 </th></tr>
5984 <tr>
5985 <th> 1
5986 </th>
5987 <td> 1 </td>
5988 <td> 2 </td>
5989 <td> 3
5990 </td></tr>
5991 <tr>
5992 <th> 2
5993 </th>
5994 <td> 2 </td>
5995 <td> 4 </td>
5996 <td> 6
5997 </td></tr>
5998 <tr>
5999 <th> 3
6000 </th>
6001 <td> 3 </td>
6002 <td> 6 </td>
6003 <td> 9
6004 </td></tr>
6005 <tr>
6006 <th> 4
6007 </th>
6008 <td> 4 </td>
6009 <td> 8 </td>
6010 <td> 12
6011 </td></tr>
6012 <tr>
6013 <th> 5
6014 </th>
6015 <td> 5 </td>
6016 <td> 10 </td>
6017 <td> 15
6018 </td></tr></table>
6019
6020 !! end
6021
6022 !! test
6023 Accept "||" in table headings
6024 !! wikitext
6025 {|
6026 !h1 || h2
6027 |}
6028 !! html
6029 <table>
6030 <tr>
6031 <th>h1 </th>
6032 <th> h2
6033 </th></tr></table>
6034
6035 !! end
6036
6037 !! test
6038 Accept "!!" in table data
6039 !! wikitext
6040 {|
6041 | Foo!! ||
6042 |}
6043 !! html
6044 <table>
6045 <tr>
6046 <td> Foo!! </td>
6047 <td>
6048 </td></tr></table>
6049
6050 !! html/parsoid
6051 <table>
6052 <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>
6053 </tbody></table>
6054 !! end
6055
6056 !! test
6057 Accept "||" in indented table headings
6058 !! wikitext
6059 :{|
6060 !h1 || h2
6061 |}
6062 !! html
6063 <dl><dd><table>
6064 <tr>
6065 <th>h1 </th>
6066 <th> h2
6067 </th></tr></table></dd></dl>
6068
6069 !! end
6070
6071 !! test
6072 Accept "!!" in templates
6073 !! wikitext
6074 {|
6075 !a {{echo|b!!c}}
6076 |}
6077 !! html/php
6078 <table>
6079 <tr>
6080 <th>a b</th>
6081 <th>c
6082 </th></tr></table>
6083
6084 !! html/parsoid
6085 <table>
6086 <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>
6087 !! end
6088
6089 !! test
6090 Accept "!!" in table headings after newline
6091 !! wikitext
6092 {|
6093 !a
6094 b!!c
6095 |}
6096 !! html/php
6097 <table>
6098 <tr>
6099 <th>a
6100 <p>b!!c
6101 </p>
6102 </th></tr></table>
6103
6104 !! html/parsoid
6105 <table>
6106 <tbody><tr><th>a
6107 <p>b!!c</p></th></tr>
6108 </tbody></table>
6109 !! end
6110
6111 !! test
6112 Accept "!!" in table data of mixed wikitext / html syntax
6113 !! wikitext
6114 {|
6115 !a
6116 <tr><td>b!!c</td></tr>
6117 |}
6118 !! html+tidy
6119 <table>
6120 <tr>
6121 <th>a</th>
6122 </tr>
6123 <tr>
6124 <td>b!!c</td>
6125 </tr>
6126 </table>
6127 !! html/parsoid
6128 <table>
6129 <tbody><tr><th>a</th></tr>
6130 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6131 </tbody></table>
6132 !! end
6133
6134 !! test
6135 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6136 !! wikitext
6137 {|
6138 !| h1
6139 || a
6140 |}
6141 !! html
6142 <table>
6143 <tr>
6144 <th> h1
6145 </th>
6146 <td> a
6147 </td></tr></table>
6148
6149 !! end
6150
6151 !!test
6152 Accept "| !" at start of line in tables (ignore !-attribute)
6153 !! wikitext
6154 {|
6155 |-
6156 | !style="color:red" | bar
6157 |}
6158 !! html
6159 <table>
6160
6161 <tr>
6162 <td> bar
6163 </td></tr></table>
6164
6165 !!end
6166
6167 !!test
6168 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 +/-
6169 !! wikitext
6170 {|
6171 |-
6172 |style='color:red;'|+1
6173 |style='color:blue;'|-1
6174 |-
6175 | 1 || 2 || 3
6176 | 1 ||+2 ||-3
6177 |-
6178 | +1
6179 | -1
6180 |}
6181 !! html
6182 <table>
6183
6184 <tr>
6185 <td style="color:red;">+1
6186 </td>
6187 <td style="color:blue;">-1
6188 </td></tr>
6189 <tr>
6190 <td> 1 </td>
6191 <td> 2 </td>
6192 <td> 3
6193 </td>
6194 <td> 1 </td>
6195 <td>+2 </td>
6196 <td>-3
6197 </td></tr>
6198 <tr>
6199 <td> +1
6200 </td>
6201 <td> -1
6202 </td></tr></table>
6203
6204 !!end
6205
6206 !! test
6207 Table rowspan
6208 !! wikitext
6209 {| border=1
6210 | Cell 1, row 1
6211 |rowspan=2| Cell 2, row 1 (and 2)
6212 | Cell 3, row 1
6213 |-
6214 | Cell 1, row 2
6215 | Cell 3, row 2
6216 |}
6217 !! html
6218 <table border="1">
6219 <tr>
6220 <td> Cell 1, row 1
6221 </td>
6222 <td rowspan="2"> Cell 2, row 1 (and 2)
6223 </td>
6224 <td> Cell 3, row 1
6225 </td></tr>
6226 <tr>
6227 <td> Cell 1, row 2
6228 </td>
6229 <td> Cell 3, row 2
6230 </td></tr></table>
6231
6232 !! end
6233
6234 !! test
6235 Nested table
6236 !! wikitext
6237 {| border=1
6238 | &alpha;
6239 |
6240 {| bgcolor=#ABCDEF border=2
6241 |nested
6242 |-
6243 |table
6244 |}
6245 |the original table again
6246 |}
6247 !! html
6248 <table border="1">
6249 <tr>
6250 <td> &#945;
6251 </td>
6252 <td>
6253 <table bgcolor="#ABCDEF" border="2">
6254 <tr>
6255 <td>nested
6256 </td></tr>
6257 <tr>
6258 <td>table
6259 </td></tr></table>
6260 </td>
6261 <td>the original table again
6262 </td></tr></table>
6263
6264 !! end
6265
6266 !! test
6267 Invalid attributes in table cell (bug 1830)
6268 !! wikitext
6269 {|
6270 |Cell:|broken
6271 |}
6272 !! html
6273 <table>
6274 <tr>
6275 <td>broken
6276 </td></tr></table>
6277
6278 !! end
6279
6280 !! test
6281 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6282 !! wikitext
6283 {|
6284 | title="foo" |bar
6285 | title="foo<nowiki>|</nowiki>" |bar
6286 | title="foo<nowiki>|</nowiki>" bar
6287 |}
6288 !! html/php
6289 <table>
6290 <tr>
6291 <td title="foo">bar
6292 </td>
6293 <td title="foo&#124;">bar
6294 </td>
6295 <td> title="foo|" bar
6296 </td></tr></table>
6297
6298 !! html/parsoid
6299 <table>
6300 <tbody><tr><td title="foo">bar</td>
6301 <td title="foo|" data-parsoid='{"a":{"title":"foo|"},"sa":{"title":"foo&lt;nowiki>|&lt;/nowiki>"},"autoInsertedEnd":true}'>bar</td>
6302 <td> title="foo<span typeof="mw:Nowiki">|</span>" bar</td></tr>
6303 </tbody></table>
6304 !! end
6305
6306 # See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
6307 # N.B. The "|}" to close the table is missing from the input, so parsoid's
6308 # *2wt modes will fail.
6309 !! test
6310 Table security: embedded pipes
6311 !! options
6312 parsoid=wt2html,html2html
6313 !! wikitext
6314 {|
6315 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6316 !! html/php
6317 <table>
6318 <tr>
6319 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6320 <td>]" onmouseover="alert(document.cookie)"&gt;test
6321 </td>
6322 </tr>
6323 </table>
6324
6325 !! html/parsoid
6326 <table><tbody>
6327 <tr>
6328 <td data-parsoid='{"startTagSrc":"| ","attrSepSrc":"|","autoInsertedEnd":true}'><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
6329 !! end
6330
6331 # FIXME: The output seems broken. Filed as T110268.
6332 !! test
6333 ! and || in td attributes should not be parsed as <th>/<td>
6334 !! options
6335 parsoid=wt2html
6336 !! wikitext
6337 {|
6338 | style="color: red !important;" data-contrived="put this here ||" | foo
6339 |}
6340 !! html/php
6341 <table>
6342 <tr>
6343 <td> style="color: red !important;" data-contrived="put this here </td>
6344 <td> foo
6345 </td></tr></table>
6346
6347 !! html/parsoid
6348 <table>
6349 <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>
6350 </tbody></table>
6351 !! end
6352
6353 !! test
6354 Indented table markup mixed with indented pre content (proposed in bug 6200)
6355 !! wikitext
6356 <table>
6357 <tr>
6358 <td>
6359 Text that should be rendered preformatted
6360 </td>
6361 </tr>
6362 </table>
6363 !! html
6364 <table>
6365 <tr>
6366 <td>
6367 <pre>Text that should be rendered preformatted
6368 </pre>
6369 </td>
6370 </tr>
6371 </table>
6372
6373 !! end
6374
6375 !! test
6376 1. Template-generated table cell attributes and cell content
6377 !! wikitext
6378 {|
6379 |{{table_attribs}}
6380 | {{table_attribs}}
6381 || {{table_attribs_5}}
6382 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6383 |align=center {{table_attribs}}
6384 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6385 |}
6386 !! html
6387 <table>
6388 <tr>
6389 <td style="color:red;">Foo
6390 </td>
6391 <td style="color:red;">Foo
6392 </td>
6393 <td> style="color:red;"</td>
6394 <td>Bar
6395 </td>
6396 <td style="color:red;">Foo
6397 </td>
6398 <td align="center" style="color:red;">Foo
6399 </td>
6400 <td align="center" style="color:red;">Foo
6401 </td></tr></table>
6402
6403 !! end
6404
6405 !! test
6406 2. Template-generated table cell attributes and cell content
6407 !! wikitext
6408 {|
6409 |{{table_attribs_2}}
6410 |}
6411 !! html/php
6412 <table>
6413 <tr>
6414 <td style="color:red;">Foo
6415 </td>
6416 <td>Bar</td>
6417 <td>Baz
6418 </td></tr></table>
6419
6420 !! html/parsoid
6421 <table>
6422 <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>
6423 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6424 </tbody></table>
6425 !! end
6426
6427 !! test
6428 3. Template-generated table cell attributes and cell content
6429 !! wikitext
6430 {|
6431 !align=center {{table_header_cells}}
6432 |-
6433 |align=center {{table_cells}}
6434 |}
6435 !! html/php
6436 <table>
6437 <tr>
6438 <th align="center" style="color:red;">Foo</th>
6439 <th style="color:red;"><i>Bar</i></th>
6440 <th style="color:brown;"><i>Foo</i> and Baz
6441 </th></tr>
6442 <tr>
6443 <td align="center" style="color:red;">Foo</td>
6444 <td style="color:red;"><i>Bar</i></td>
6445 <td style="color:brown;"><i>Foo</i> and Baz
6446 </td></tr></table>
6447
6448 !! html/parsoid
6449 <table>
6450 <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>
6451 <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>
6452 </tbody></table>
6453 !! end
6454
6455 !! test
6456 4. Template-generated table cell attributes and cell content inside a templated table
6457 !! wikitext
6458 {{tbl-start}}
6459 !align=center {{table_header_cells}}
6460 |-
6461 |align=center {{table_cells}}
6462 {{tbl-end}}
6463 !! html/php
6464 <table>
6465 <tr>
6466 <th align="center" style="color:red;">Foo</th>
6467 <th style="color:red;"><i>Bar</i></th>
6468 <th style="color:brown;"><i>Foo</i> and Baz
6469 </th></tr>
6470 <tr>
6471 <td align="center" style="color:red;">Foo</td>
6472 <td style="color:red;"><i>Bar</i></td>
6473 <td style="color:brown;"><i>Foo</i> and Baz
6474 </td></tr></table>
6475
6476 !! html/parsoid
6477 <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}}]}'>
6478 <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>
6479 <tr>
6480 <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>
6481 </tbody></table>
6482 !! end
6483
6484 ## Edge case fix to prevent future regressions
6485 !! test
6486 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
6487 !! wikitext
6488 {|
6489 |{{table_attribs_7}}
6490 |}
6491 <references />
6492 !! html/parsoid
6493 <table>
6494 <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>
6495 </tbody></table>
6496 <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>
6497 !! end
6498
6499 !! test
6500 Table with row followed by newlines and table heading
6501 !! wikitext
6502 {|
6503 |-
6504
6505 ! foo
6506 |}
6507 !! html
6508 <table>
6509
6510
6511 <tr>
6512 <th> foo
6513 </th></tr></table>
6514
6515 !! end
6516
6517 !! test
6518 Table with empty line following the start tag
6519 !! wikitext
6520 {|
6521
6522 |-
6523 | foo
6524 |}
6525 !! html
6526 <table>
6527
6528
6529 <tr>
6530 <td> foo
6531 </td></tr></table>
6532
6533 !! end
6534
6535 # FIXME: Preserve the attribute properly (with an empty string as value) in
6536 # the PHP parser. Parsoid implements the behavior below.
6537 !! test
6538 Table attributes with empty value
6539 !! wikitext
6540 {|
6541 | style=| hello
6542 |}
6543 !! html/parsoid
6544 <table>
6545 <tbody>
6546 <tr>
6547 <td style=""> hello
6548 </td></tr></tbody></table>
6549
6550 !! end
6551
6552 !! test
6553 Wikitext table with a lot of comments
6554 !! wikitext
6555 {|
6556 <!-- c0 -->
6557 | foo
6558 <!-- c1 -->
6559 |-<!-- c2 -->
6560 <!-- c3 -->
6561 |<!-- c4 -->
6562 <!-- c5 -->
6563 |}
6564 !! html
6565 <table>
6566 <tr>
6567 <td> foo
6568 </td></tr>
6569 <tr>
6570 <td>
6571 </td></tr></table>
6572
6573 !! end
6574
6575 !! test
6576 Wikitext table comments represented in parsoid dom
6577 !! wikitext
6578 {|<!--c1--><!--c2-->
6579 |-<!--c3-->
6580 | x
6581 |}
6582 !! html/php+tidy
6583 <table>
6584 <tr>
6585 <td>x</td>
6586 </tr>
6587 </table>
6588 !! html/parsoid
6589 <table><!--c1--><!--c2-->
6590 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
6591 <td data-parsoid='{"autoInsertedEnd":true}'> x</td></tr>
6592 </tbody></table>
6593 !! end
6594
6595 !! test
6596 Wikitext table with double-line table cell
6597 !! wikitext
6598 {|
6599 |a
6600 b
6601 |}
6602 !! html
6603 <table>
6604 <tr>
6605 <td>a
6606 <p>b
6607 </p>
6608 </td></tr></table>
6609
6610 !! end
6611
6612 !! test
6613 Table cell with a single comment
6614 !! wikitext
6615 {|
6616 | <!-- c1 -->
6617 | a
6618 |}
6619 !! html
6620 <table>
6621 <tr>
6622 <td>
6623 </td>
6624 <td> a
6625 </td></tr></table>
6626
6627 !! end
6628
6629 !! test
6630 Table-cell after a comment-only-empty-line
6631 !! wikitext
6632 {|
6633 |a
6634 <!--c1-->
6635 <!--c2-->| b
6636 |}
6637 !! html
6638 <table>
6639 <tr>
6640 <td>a
6641 </td>
6642 <td> b
6643 </td></tr></table>
6644
6645 !! html/parsoid
6646 <table>
6647 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
6648 <!--c1-->
6649 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
6650 </tbody></table>
6651
6652 !! end
6653
6654 !! test
6655 Build table with {{!}}
6656 !! wikitext
6657 {{{!}} class="wikitable"
6658 ! header
6659 ! second header
6660 {{!}}- style="color:red;"
6661 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
6662 {{!}}}
6663 !! html
6664 <table class="wikitable">
6665 <tr>
6666 <th> header
6667 </th>
6668 <th> second header
6669 </th></tr>
6670 <tr style="color:red;">
6671 <td> data </td>
6672 <td style="color:red;"> second data
6673 </td></tr></table>
6674
6675 !! end
6676
6677 !! test
6678 Build table with pipe as data
6679 !! wikitext
6680 {| class="wikitable"
6681 ! header
6682 ! second header
6683 |- style="color:red;"
6684 | data || style="color:red;" | second data
6685 |-
6686 | style="color:red;" | data with | || style="color:red;" | second data with |
6687 |-
6688 || data with | ||| second data with |
6689 |}
6690 !! html
6691 <table class="wikitable">
6692 <tr>
6693 <th> header
6694 </th>
6695 <th> second header
6696 </th></tr>
6697 <tr style="color:red;">
6698 <td> data </td>
6699 <td style="color:red;"> second data
6700 </td></tr>
6701 <tr>
6702 <td style="color:red;"> data with | </td>
6703 <td style="color:red;"> second data with |
6704 </td></tr>
6705 <tr>
6706 <td> data with | </td>
6707 <td> second data with |
6708 </td></tr></table>
6709
6710 !! end
6711
6712 !! test
6713 Build table with wikilink
6714 !! wikitext
6715 {| class="wikitable"
6716 ! header || second header
6717 |- style="color:red;"
6718 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
6719 |-
6720 | data || second data [[Main Page|link|text with pipe]]
6721 |}
6722 !! html
6723 <table class="wikitable">
6724 <tr>
6725 <th> header </th>
6726 <th> second header
6727 </th></tr>
6728 <tr style="color:red;">
6729 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
6730 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
6731 </td></tr>
6732 <tr>
6733 <td> data </td>
6734 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
6735 </td></tr></table>
6736
6737 !! end
6738
6739 # The expected HTML structure in this test is debatable. The PHP parser does
6740 # not parse this kind of table at all. The main focus for Parsoid is on
6741 # round-tripping, so this output is ok for now. TODO: revisit!
6742 !! test
6743 Wikitext table with html-syntax row
6744 !! wikitext
6745 {|
6746 |-
6747 <td>foo</td>
6748 |}
6749 !! html/parsoid
6750 <table>
6751 <tbody>
6752 <tr>
6753 <td>foo</td></tr></tbody></table>
6754 !! end
6755
6756 ## Note that Parsoid output differs from PHP and PHP+tidy here.
6757 ## The lack of <tr> tags in the PHP output is arguably a bug in the
6758 ## PHP parser, which tidy then compounds by fostering the content
6759 ## entirely out of the table. Parsoid recognizes the table context
6760 ## and generates <tr> and <td> wrappers as needed. Hopefully nobody
6761 ## depends on PHP's treatment of broken table markup!
6762 !! test
6763 Implicit <td> after a |-
6764 !! options
6765 parsoid=wt2html,html2html
6766 !! wikitext
6767 {|
6768 |-
6769 a
6770 |}
6771 !! html/php
6772 <table>
6773
6774 a
6775 </table>
6776
6777 !! html/php+tidy
6778 <p>a</p>
6779 !! html/parsoid
6780 <table>
6781 <tr><td>a</td></tr>
6782 </table>
6783 !! end
6784
6785 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
6786 !! test
6787 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
6788 !! options
6789 parsoid=wt2html,html2html
6790 !! wikitext
6791 {|
6792 |-
6793 |
6794 a
6795 |-
6796 b
6797 |}
6798 !! html/php
6799 <table>
6800
6801 <tr>
6802 <td>
6803 <pre>a
6804 </pre>
6805 </td></tr>
6806 b
6807 </table>
6808
6809 !! html/php+tidy
6810 <p>b</p>
6811 <table>
6812 <tr>
6813 <td>
6814 <pre>
6815 a
6816 </pre></td>
6817 </tr>
6818 </table>
6819 !! html/parsoid
6820 <table>
6821 <tbody>
6822 <tr><td><pre>a</pre></td></tr>
6823 <tr><td> b</td></tr>
6824 </tbody>
6825 </table>
6826 !! end
6827
6828 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
6829 # Parsoid generates the missing <td>, so wt2wt won't succeed.
6830 !! test
6831 Lists should be recognized in an implicit <td> context
6832 !! options
6833 parsoid=wt2html,html2html
6834 !! wikitext
6835 {|
6836 |-
6837 *a
6838 |}
6839 !! html/php
6840 <table>
6841
6842 <ul><li>a</li></ul>
6843 </table>
6844
6845 !! html/php+tidy
6846 <ul>
6847 <li>a</li>
6848 </ul>
6849 !! html/parsoid
6850 <table>
6851 <tr>
6852 <td><ul>
6853 <li>a</li>
6854 </ul></td>
6855 </tr>
6856 </table>
6857 !! end
6858
6859 !! test
6860 Table cells not properly parsed in an implicit-td context
6861 !! wikitext
6862 {|
6863 |-
6864 {{table_attribs_4}} || a || b
6865 |}
6866 !! html/php+tidy
6867 <table>
6868 <tr>
6869 <td style="background-color:#DC241f;" width="10px"></td>
6870 <td>a</td>
6871 <td>b</td>
6872 </tr>
6873 </table>
6874 !! html/parsoid
6875 <table>
6876 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
6877 <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>
6878 </tbody></table>
6879 !! end
6880
6881 !! test
6882 Parsoid: Round-trip tables directly followed by content (bug 51219)
6883 !! options
6884 parsoid=wt2html,wt2wt
6885 !! wikitext
6886 {|
6887 |foo
6888 |} bar
6889
6890 {|
6891 |baz
6892 |}<b>quux</b>
6893 !! html+tidy
6894 <table>
6895 <tr>
6896 <td>foo</td>
6897 </tr>
6898 </table>
6899 <p>bar</p>
6900 <table>
6901 <tr>
6902 <td>baz</td>
6903 </tr>
6904 </table>
6905 <p><b>quux</b></p>
6906 !! end
6907
6908 !! test
6909 Parsoid: Default to a newline after tables in new content (bug 51219)
6910 !! options
6911 parsoid=html2wt
6912 !! html/parsoid
6913 <table><tbody>
6914 <tr><td>foo</td></tr></tbody></table> bar
6915 <table><tbody>
6916 <tr><td>baz</td></tr></tbody></table><b>quux</b>
6917 !! wikitext
6918 {|
6919 |foo
6920 |}
6921 <nowiki> </nowiki>bar
6922 {|
6923 |baz
6924 |}
6925 '''quux'''
6926 !! end
6927
6928 !! test
6929 Parsoid: newline inducing block nodes don't suppress <nowiki>
6930 !! options
6931 parsoid=html2wt
6932 !! html/parsoid
6933 a<h1>foo</h1>
6934 !! wikitext
6935 <nowiki> </nowiki>a
6936
6937 = foo =
6938 !! end
6939
6940 !! test
6941 Parsoid: Row-syntax table headings followed by comment & table cells
6942 !! options
6943 parsoid=wt2html,wt2wt
6944 !! wikitext
6945 {|
6946 ! foo || bar
6947 <!-- foo --> || baz || quux
6948 |}
6949 !! html/php
6950 <table>
6951 <tr>
6952 <th> foo </th>
6953 <th> bar
6954 </th>
6955 <td> baz </td>
6956 <td> quux
6957 </td></tr></table>
6958
6959 !! html/parsoid
6960 <table>
6961 <tbody><tr><th> foo </th><th> bar
6962 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
6963 </tbody></table>
6964 !! end
6965
6966 !!test
6967 Parsoid: Recover better from broken table attributes
6968 !!options
6969 parsoid=wt2html
6970 !!wikitext
6971 {| class="foo
6972 | class="bar" |
6973 foo
6974 |}
6975 !!html/php+tidy
6976 <table class="foo">
6977 <tr>
6978 <td class="bar">
6979 <p>foo</p>
6980 </td>
6981 </tr>
6982 </table>
6983 !!html/parsoid
6984 <table class="foo">
6985 <tr>
6986 <td class="bar">
6987 <p>foo</p></td></tr>
6988 </tbody></table>
6989 !!end
6990
6991 !! test
6992 Tables: Digest broken attributes on table and tr tag
6993 !! options
6994 parsoid=wt2html
6995 !! wikitext
6996 {| || |} ++
6997 |- || || ++ --
6998 |- > [
6999 |}
7000 !! html
7001 <table>
7002 <tbody>
7003 <tr></tr>
7004 <tr></tr>
7005 </tbody></table>
7006 !! end
7007
7008 !! test
7009 Strip unsupported table tags
7010 !! options
7011 parsoid=html2wt
7012 !! html/parsoid
7013 <table>
7014 <thead>
7015 <tr>
7016 <th>Month</th>
7017 <th>Savings</th>
7018 </tr>
7019 </thead>
7020 <tbody>
7021 <tr>
7022 <td>January</td>
7023 <td>$100</td>
7024 </tr>
7025 <tr>
7026 <td>February</td>
7027 <td>$80</td>
7028 </tr>
7029 </tbody>
7030 <tfoot>
7031 <tr>
7032 <td>Sum</td>
7033 <td>$180</td>
7034 </tr>
7035 </tfoot>
7036 </table>
7037 !! wikitext
7038 {|
7039
7040 !Month
7041 !Savings
7042
7043 |January
7044 |$100
7045
7046 |-
7047 |February
7048 |$80
7049
7050 |Sum
7051 |$180
7052
7053 |}
7054 !! end
7055
7056 !!test
7057 Testing serialization after deletion of table cells
7058 !!options
7059 parsoid={
7060 "modes": ["wt2wt", "selser"],
7061 "changes": [
7062 ["#x", "remove"]
7063 ]
7064 }
7065 !!wikitext
7066 {|
7067 !h1 !!h2 !!h3
7068 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
7069 |}
7070 !! wikitext/edited
7071 {|
7072 !h1 !!h2 !!h3
7073 |c2 |||c3
7074 |}
7075 !!end
7076
7077 ###
7078 ### Internal links
7079 ###
7080 !! test
7081 Plain link, capitalized
7082 !! wikitext
7083 [[Main Page]]
7084 !! html
7085 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7086 </p>
7087 !! end
7088
7089 !! test
7090 Plain link, uncapitalized
7091 !! wikitext
7092 [[main Page]]
7093 !! html
7094 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
7095 </p>
7096 !! end
7097
7098 !! test
7099 Piped link
7100 !! wikitext
7101 [[Main Page|The Main Page]]
7102 !! html
7103 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7104 </p>
7105 !! end
7106
7107 !! test
7108 Piped link with comment in link text
7109 !! wikitext
7110 [[Main Page|The Main<!--front--> Page]]
7111 !! html
7112 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7113 </p>
7114 !! end
7115
7116 !! test
7117 Piped link with multiple pipe characters in link text
7118 !! wikitext
7119 [[Main Page||The|Main|Page|]]
7120 !! html/php
7121 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7122 </p>
7123 !! html/parsoid
7124 <p><a rel="mw:WikiLink" href="Main_Page" title="Main Page">|The|Main|Page|</a></p>
7125 !! end
7126
7127 !! test
7128 Broken link
7129 !! wikitext
7130 [[Zigzagzogzagzig]]
7131 !! html
7132 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7133 </p>
7134 !! end
7135
7136 !! test
7137 Broken link with fragment
7138 !! wikitext
7139 [[Zigzagzogzagzig#zug]]
7140 !! html
7141 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7142 </p>
7143 !! end
7144
7145 !! test
7146 Special page link with fragment
7147 !! wikitext
7148 [[Special:Version#anchor]]
7149 !! html
7150 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7151 </p>
7152 !! end
7153
7154 !! test
7155 Nonexistent special page link with fragment
7156 !! wikitext
7157 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7158 !! html
7159 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7160 </p>
7161 !! end
7162
7163 !! test
7164 Link with prefix
7165 !! wikitext
7166 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7167 !! html
7168 <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>
7169 </p>
7170 !! end
7171
7172 !! test
7173 Link with suffix
7174 !! wikitext
7175 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7176 !! html
7177 <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>!!!
7178 </p>
7179 !! end
7180
7181 !! article
7182 prefixed article
7183 !! text
7184 Some text
7185 !! endarticle
7186
7187 !! test
7188 Bug 43661: Piped links with identical prefixes
7189 !! wikitext
7190 [[prefixed article|prefixed articles with spaces]]
7191
7192 [[prefixed article|prefixed articlesaoeu]]
7193
7194 [[Main Page|Main Page test]]
7195 !! html
7196 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7197 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7198 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7199 </p>
7200 !! end
7201
7202
7203 !! test
7204 Link with HTML entity in suffix / tail
7205 !! wikitext
7206 [[Main Page]]&quot;, [[Main Page]]&#97;
7207 !! html/php
7208 <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;
7209 </p>
7210 !! html/parsoid
7211 <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>
7212 !! end
7213
7214 !! test
7215 Link with 3 brackets
7216 !! wikitext
7217 [[[Main Page]]]
7218 Foo [[[Main Page]]]
7219 !! html
7220 <p>[[[Main Page]]]
7221 Foo [[[Main Page]]]
7222 </p>
7223 !! end
7224
7225 !! test
7226 Link with 4 brackets
7227 !! wikitext
7228 [[[[Main Page]]]]
7229 !! html
7230 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7231 </p>
7232 !! end
7233
7234 !! test
7235 Piped link with 3 brackets
7236 !! wikitext
7237 [[[main page|the main page]]]
7238 !! html
7239 <p>[[[main page|the main page]]]
7240 </p>
7241 !! end
7242
7243 !! test
7244 Piped link with extlink-like text
7245 !! wikitext
7246 [[Main Page|[bar]]]
7247 [[Main Page|This is a [bar]]]
7248 !! html/php
7249 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7250 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7251 </p>
7252 !! html/parsoid
7253 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7254 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a></p>
7255 !! end
7256
7257 !! test
7258 Link with multiple pipes
7259 !! wikitext
7260 [[Main Page|The|Main|Page]]
7261 !! html
7262 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7263 </p>
7264 !! end
7265
7266 # Note that parsoid does not munge anchor text; all non-space
7267 # characters are valid in HTML5 ids.
7268 !! test
7269 Anchor containing a #. (bug 63430)
7270 !! wikitext
7271 [[Main Page#And#Link]]
7272 !! html/php
7273 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
7274 </p>
7275 !! html/parsoid
7276 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link" title="Main Page">Main Page#And#Link</a></p>
7277 !! end
7278
7279 !! test
7280 Link to namespaces
7281 !! wikitext
7282 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7283 !! html
7284 <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>
7285 </p>
7286 !! end
7287
7288 !! test
7289 Link with space in namespace
7290 !! wikitext
7291 [[User talk:Foo bar]]
7292 !! html
7293 <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>
7294 </p>
7295 !! end
7296
7297 !! article
7298 MemoryAlpha:AlphaTest
7299 !! text
7300 This is an article in the MemoryAlpha namespace
7301 (which shadows the memoryalpha interwiki link).
7302 !! endarticle
7303
7304 !! test
7305 Namespace takes precedence over interwiki link (bug 51680)
7306 !! wikitext
7307 [[MemoryAlpha:AlphaTest]]
7308 !! html
7309 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7310 </p>
7311 !! end
7312
7313 # The previous test doesn't work correctly in html2*, due to not recognizing the
7314 # link as an internal one. This one checks for the correct behavior.
7315 !! test
7316 Link to namespace preferred over interwiki with correct rel attribute
7317 !! options
7318 parsoid=html2wt,html2html
7319 !! html/parsoid
7320 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7321 !! wikitext
7322 [[MemoryAlpha:AlphaTest]]
7323 !! end
7324
7325 !! test
7326 Piped link to namespace
7327 !! wikitext
7328 [[Meta:Disclaimers|The disclaimers]]
7329 !! html
7330 <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>
7331 </p>
7332 !! end
7333
7334 !! test
7335 Link containing }
7336 !! wikitext
7337 [[Usually caused by a typo (oops}]]
7338 !! html
7339 <p>[[Usually caused by a typo (oops}]]
7340 </p>
7341 !! end
7342
7343 !! article
7344 7% Solution
7345 !! text
7346 Just a test of an article title containing a percent.
7347 !! endarticle
7348
7349 !! test
7350 Link containing % (not as a hex sequence)
7351 !! wikitext
7352 [[7% Solution]]
7353 !! html/php
7354 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7355 </p>
7356 !! html/parsoid
7357 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
7358 !! end
7359
7360 # note that the parsoid HTML is identical to the previous test output,
7361 # so the previous test ensures that the html2wt mode will generate the
7362 # "not as a hex sequence" wikitext.
7363 !! test
7364 Link containing % as a single hex sequence interpreted to char
7365 !! options
7366 parsoid=wt2wt,wt2html,html2html
7367 !! wikitext
7368 [[7%25 Solution]]
7369 !! html/php
7370 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7371 </p>
7372 !! html/parsoid
7373 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
7374 !!end
7375
7376 !! test
7377 Link containing % as a double hex sequence interpreted to hex sequence
7378 !! wikitext
7379 [[7%2525 Solution]]
7380 !! html
7381 <p>[[7%2525 Solution]]
7382 </p>
7383 !!end
7384
7385 # note that parsoid does not munge anchor text; all non-space
7386 # characters are valid in HTML5 anchors.
7387 !! test
7388 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7389 Example for such a section: == < ==
7390 !! wikitext
7391 [[%23%3c]][[%23%3e]]
7392 !! html/php
7393 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7394 </p>
7395 !! html/parsoid
7396 <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>
7397 !! end
7398
7399 !! test
7400 Link containing "<#" and ">#" as a hex sequences
7401 !! wikitext
7402 [[%3c%23]][[%3e%23]]
7403 !! html
7404 <p>[[%3c%23]][[%3e%23]]
7405 </p>
7406 !! end
7407
7408 !! test
7409 Link containing an equals sign
7410 !! wikitext
7411 [[Special:BookSources/isbn=4-00-026157-6]]
7412 !! html/php
7413 <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>
7414 </p>
7415 !! html/parsoid
7416 <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>
7417 !! end
7418
7419 !! article
7420 Foo~bar
7421 !! text
7422 Just a test of an article title containing a tilde.
7423 !! endarticle
7424
7425 # note that links containing signatures, like [[Foo~~~~]], are
7426 # massaged by the pre-save transform (PST) and so the tildes are never
7427 # seen by the parser.
7428 !! test
7429 Link containing a tilde
7430 !! wikitext
7431 [[Foo~bar]]
7432 !! html/php
7433 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
7434 </p>
7435 !! html/parsoid
7436 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
7437 !! end
7438
7439 !! test
7440 Link containing double-single-quotes '' (bug 4598)
7441 !! wikitext
7442 [[Lista d''e paise d''o munno]]
7443 !! html/php
7444 <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>
7445 </p>
7446 !! html/parsoid
7447 <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>
7448 !! end
7449
7450 !! test
7451 Link containing double-single-quotes '' in text (bug 4598 sanity check)
7452 !! wikitext
7453 Some [[Link|pretty ''italics'' and stuff]]!
7454 !! html/php
7455 <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>!
7456 </p>
7457 !! html/parsoid
7458 <p>Some <a rel="mw:WikiLink" href="Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
7459 !! end
7460
7461 !! test
7462 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
7463 !! wikitext
7464 ''Some [[Link|pretty ''italics'' and stuff]]!''
7465 !! html
7466 <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>
7467 </p>
7468 !! end
7469
7470 !! test
7471 Link with double quotes in title part (literal) and alternate part (interpreted)
7472 !! wikitext
7473 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
7474
7475 [[''Pentecoste'']]
7476
7477 [[''Pentecoste''|Pentecoste]]
7478
7479 [[''Pentecoste''|''Pentecoste'']]
7480 !! html/php
7481 <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>
7482 </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>
7483 </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>
7484 </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>
7485 </p>
7486 !! html/parsoid
7487 <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>
7488 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
7489 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
7490 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
7491 !! end
7492
7493 !! test
7494 Broken image links with HTML captions (bug 39700)
7495 !! wikitext
7496 [[File:Nonexistent|<script></script>]]
7497 [[File:Nonexistent|100x100px|<script></script>]]
7498 [[File:Nonexistent|&lt;]]
7499 [[File:Nonexistent|a<i>b</i>c]]
7500 !! html/php
7501 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7502 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7503 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
7504 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
7505 </p>
7506 !! html/parsoid
7507 <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>
7508 <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>
7509 <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>
7510 <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>
7511 !! end
7512
7513 !! test
7514 Plain link to URL
7515 !! wikitext
7516 [[http://www.example.com]]
7517 !! html/php
7518 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
7519 </p>
7520 !! html/parsoid
7521 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
7522 !! end
7523
7524 !! test
7525 Plain link to URL with link text
7526 !! wikitext
7527 [[http://www.example.com Link text]]
7528 !! html
7529 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
7530 </p>
7531 !! end
7532
7533 !! test
7534 Plain link to protocol-relative URL
7535 !! wikitext
7536 [[//www.example.com]]
7537 !! html/php
7538 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
7539 </p>
7540 !! html/parsoid
7541 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
7542 !! end
7543
7544 !! test
7545 Plain link to protocol-relative URL with link text
7546 !! wikitext
7547 [[//www.example.com Link text]]
7548 !! html
7549 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
7550 </p>
7551 !! end
7552
7553 !! test
7554 Plain link to page with question mark in title
7555 !! wikitext
7556 [[A?b]]
7557
7558 [[A?b|Baz]]
7559 !! html
7560 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
7561 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
7562 </p>
7563 !! end
7564
7565
7566 # I'm fairly sure the expected result here is wrong.
7567 # We want these to be URL links, not pseudo-pages with URLs for titles....
7568 # However the current output is also pretty screwy.
7569 #
7570 # ----
7571 # I'm changing it to match the current output--it arguably makes more
7572 # sense in the light of the test above. Old expected result was:
7573 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
7574 #</p>
7575 # But I think this test is bordering on "garbage in, garbage out" anyway.
7576 # -- wtm
7577 !! test
7578 Piped link to URL
7579 !! wikitext
7580 Piped link to URL: [[http://www.example.com|an example URL]]
7581 !! html/php
7582 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
7583 </p>
7584 !! html/parsoid
7585 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
7586 !! end
7587
7588 !! test
7589 BUG 2: [[page|http://url/]] should link to page, not http://url/
7590 !! wikitext
7591 [[Main Page|http://url/]]
7592 !! html/php
7593 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
7594 </p>
7595 !! html/parsoid
7596 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
7597 !! end
7598
7599 # Parsoid does not mark self-links, by design.
7600 !! test
7601 BUG 337: Escaped self-links should be bold
7602 !! options
7603 title=[[Bug462]]
7604 !! wikitext
7605 [[Bu&#103;462]] [[Bug462]]
7606 !! html/php
7607 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
7608 </p>
7609 !! html/php+tidy
7610 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
7611 !! html/parsoid
7612 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
7613 !! end
7614
7615 !! test
7616 Self-link to section should not be bold
7617 !! options
7618 title=[[Main Page]]
7619 !! wikitext
7620 [[Main Page#section]]
7621 !! html
7622 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
7623 </p>
7624 !! end
7625
7626 !! article
7627 00
7628 !! text
7629 This is 00.
7630 !! endarticle
7631
7632 !!test
7633 Self-link to numeric title
7634 !!options
7635 title=[[0]]
7636 !! wikitext
7637 [[0]]
7638 !! html
7639 <p><strong class="selflink">0</strong>
7640 </p>
7641 !!end
7642
7643 !!test
7644 Link to numeric-equivalent title
7645 !!options
7646 title=[[0]]
7647 !! wikitext
7648 [[00]]
7649 !! html
7650 <p><a href="/wiki/00" title="00">00</a>
7651 </p>
7652 !!end
7653
7654 !! test
7655 <nowiki> inside a link
7656 !! wikitext
7657 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
7658 !! html
7659 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
7660 </p>
7661 !! end
7662
7663 !! test
7664 Non-breaking spaces in title
7665 !! wikitext
7666 [[&nbsp; Main &nbsp; Page &nbsp;]]
7667 !! html
7668 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
7669 </p>
7670 !!end
7671
7672 !! test
7673 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
7674 !! options
7675 language=ca
7676 !! wikitext
7677 '''[[Main Page]]'''
7678 !! html
7679 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
7680 </p>
7681 !! end
7682
7683 !! test
7684 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
7685 !! options
7686 language=ca
7687 !! wikitext
7688 ''[[Main Page]]''
7689 !! html
7690 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
7691 </p>
7692 !! end
7693
7694 !! test
7695 Internal link with en linktrail: no apostrophes (bug 27473)
7696 !! options
7697 language=en
7698 !! wikitext
7699 [[Something]]'nice
7700 !! html
7701 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
7702 </p>
7703 !! end
7704
7705 !! test
7706 Internal link with ca linktrail with apostrophes (bug 27473)
7707 !! options
7708 language=ca
7709 !! wikitext
7710 [[Something]]'nice
7711 !! html
7712 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
7713 </p>
7714 !! end
7715
7716 !! test
7717 Internal link with kaa linktrail with apostrophes (bug 27473)
7718 !! options
7719 language=kaa
7720 !! wikitext
7721 [[Something]]'nice
7722 !! html
7723 <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>
7724 </p>
7725 !! end
7726
7727 !! test
7728 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
7729 !! wikitext
7730 [[User:Foo/Test/63636:Bar|Test]]
7731 !! html/php
7732 <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>
7733 </p>
7734 !! html/parsoid
7735 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
7736 !! end
7737
7738 !! test
7739 Purely hash wikilink
7740 !! options
7741 title=[[User:test/123]]
7742 !! wikitext
7743 [[#a|b]]
7744 !! html/php
7745 <p><a href="#a">b</a>
7746 </p>
7747 !! html/parsoid
7748 <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>
7749 !! end
7750
7751 !! test
7752 1. Interaction of linktrail and template encapsulation
7753 !! options
7754 parsoid
7755 !! wikitext
7756 {{echo|[[Foo]]}}l
7757 !! html
7758 <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>
7759 !! end
7760
7761 !! test
7762 2. Interaction of linktrail and template encapsulation
7763 !! options
7764 parsoid
7765 !! wikitext
7766 {{echo|Some [[Fool]]}}s
7767 !! html
7768 <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>
7769 !! end
7770
7771 !! test
7772 3. Interaction of linktrail and template encapsulation
7773 !! options
7774 parsoid
7775 !! wikitext
7776 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
7777 !! html
7778 <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>
7779 !! end
7780
7781 !! article
7782 Söfnuður
7783 !! text
7784 Test.
7785 !! endarticle
7786
7787 !! test
7788 Internal link with is link prefix
7789 !! options
7790 language=is
7791 !! wikitext
7792 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
7793 !! html
7794 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
7795 </p>
7796 !! end
7797
7798 !! article
7799 Mótmælendatrú
7800 !! text
7801 Test.
7802 !! endarticle
7803
7804 !! test
7805 Internal link with is link trail and link prefix
7806 !! options
7807 language=is
7808 !! wikitext
7809 [[mótmælendatrú|xxx]]ar
7810 [[mótmælendatrú]]ar
7811 mótmælenda[[söfnuður]]
7812 mótmælenda[[söfnuður|söfnuðir]]
7813 mótmælenda[[söfnuður|söfnuðir]]xxx
7814 !! html
7815 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
7816 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
7817 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
7818 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
7819 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
7820 </p>
7821 !! end
7822
7823 !! test
7824 Parsoid link trail escaping
7825 !! options
7826 parsoid=html2wt,html2html
7827 !! html/parsoid
7828 <p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p>
7829 !! wikitext
7830 [[apple]]<nowiki/>s
7831 !! end
7832
7833 !! test
7834 Parsoid link prefix escaping
7835 !! options
7836 language=is
7837 parsoid=html2wt,html2html
7838 !! html/parsoid
7839 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p>
7840 !! wikitext
7841 Aðrir mótmælenda<nowiki/>[[söfnuður]]
7842 !! end
7843
7844 !! test
7845 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
7846 !! wikitext
7847 [[Foo| bar]]
7848
7849 [[Foo| ''bar'']]
7850
7851 [http://wp.org foo]
7852
7853 [http://wp.org ''foo'']
7854 !! html
7855 <p><a href="/wiki/Foo" title="Foo"> bar</a>
7856 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
7857 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
7858 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
7859 </p>
7860 !! end
7861
7862 !! test
7863 Parsoid: Scoped parsing should handle mixed transclusions and plain text
7864 !! options
7865 parsoid
7866 !! wikitext
7867 [[Foo|{{echo|a}} b {{echo|c}}]]
7868 !! html
7869 <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>
7870 !! end
7871
7872 !! test
7873 Link with angle bracket after anchor
7874 !! wikitext
7875 [[Foo#<bar>]]
7876 !! html/php
7877 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
7878 </p>
7879 !! html/parsoid
7880 <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>
7881 !! end
7882
7883 ###
7884 ### Interwiki links (see maintenance/interwiki.sql)
7885 ###
7886
7887 !! test
7888 Inline interwiki link
7889 !! options
7890 parsoid=wt2html,wt2wt,html2html
7891 !! wikitext
7892 [[MeatBall:SoftSecurity]]
7893 !! html/php
7894 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
7895 </p>
7896 !! html/parsoid
7897 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
7898 !! end
7899
7900 !! test
7901 Inline interwiki link with empty title (bug 2372)
7902 !! options
7903 parsoid=wt2html,wt2wt,html2html
7904 !! wikitext
7905 [[MeatBall:]]
7906 !! html/php
7907 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
7908 </p>
7909 !! html/parsoid
7910 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
7911 !! end
7912
7913 !! test
7914 Interwiki link encoding conversion (bug 1636)
7915 !! wikitext
7916 *[[Wikipedia:ro:Olteni&#0355;a]]
7917 *[[Wikipedia:ro:Olteni&#355;a]]
7918 !! html
7919 <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>
7920 <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>
7921
7922 !! html+tidy
7923 <ul>
7924 <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>
7925 <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>
7926 </ul>
7927 !! end
7928
7929 !! test
7930 Interwiki link with fragment (bug 2130)
7931 !! wikitext
7932 [[MeatBall:SoftSecurity#foo]]
7933 !! html
7934 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
7935 </p>
7936 !! end
7937
7938 # Ideally the wikipedia: prefix here should be proto-relative too
7939 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
7940 # define the 'en' prefix, and originally the test used 'wikipedia',
7941 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
7942 # article.
7943 !! test
7944 Different interwiki prefixes mapping to the same URL
7945 !! wikitext
7946 [[:en:Foo]]
7947
7948 [[:en:Foo|Foo]]
7949
7950 [[wikipedia:Foo]]
7951
7952 [[:wikipedia:Foo|Foo]]
7953
7954 [[wikipedia:en:Foo]]
7955
7956 [[:wikipedia:en:Foo]]
7957
7958 [[ wikiPEdia :Foo]]
7959 !! html/parsoid
7960 <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>
7961
7962 <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>
7963
7964 <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>
7965
7966 <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>
7967
7968 <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>
7969
7970 <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>
7971
7972 <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>
7973 !! end
7974
7975 !! test
7976 Interwiki links that cannot be represented in wiki syntax
7977 !! wikitext
7978 [[meatball:ok]]
7979 [[meatball:ok#foo|ok with fragment]]
7980 [[meatball:ok_as_well?|ok ending with ? mark]]
7981 [http://de.wikipedia.org/wiki/Foo?action=history has query]
7982 [http://de.wikipedia.org/wiki/#foo is just fragment]
7983
7984 !! html/php
7985 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
7986 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
7987 <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>
7988 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
7989 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
7990 </p>
7991 !! html/parsoid
7992 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
7993 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
7994 <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>
7995 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
7996 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
7997 !! end
7998
7999 !! test
8000 Interwiki links: trail
8001 !! wikitext
8002 [[wikipedia:Foo|Ba]]r
8003 !! html/php
8004 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
8005 </p>
8006 !! html/parsoid
8007 <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>
8008 !! end
8009
8010 !! test
8011 Local interwiki link
8012 !! options
8013 parsoid=wt2html,wt2wt,html2html
8014 !! wikitext
8015 [[local:Template:Foo]]
8016 !! html/php
8017 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
8018 </p>
8019 !! html/parsoid
8020 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
8021 !! end
8022
8023 # Parsoid does not mark self-links, by design.
8024 !! test
8025 Local interwiki link: self-link to current page
8026 !! options
8027 title=[[Main Page]]
8028 parsoid=wt2html,wt2wt,html2html
8029 !! wikitext
8030 [[local:Main Page]]
8031 !! html/php
8032 <p><strong class="selflink">local:Main Page</strong>
8033 </p>
8034 !! html/parsoid
8035 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
8036 !! end
8037
8038 !! test
8039 Local interwiki link: prefix only (bug 64167)
8040 !! options
8041 parsoid=wt2html,wt2wt,html2html
8042 !! wikitext
8043 [[local:]]
8044 !! html/php
8045 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
8046 </p>
8047 !! html/parsoid
8048 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
8049 !! end
8050
8051 !! test
8052 Local interwiki link: with additional interwiki prefix (bug 61357)
8053 !! options
8054 parsoid=wt2html,wt2wt,html2html
8055 !! wikitext
8056 [[local:meatball:Hello]]
8057 !! html/php
8058 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8059 </p>
8060 !! html/parsoid
8061 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8062 !! end
8063
8064 !! test
8065 Multiple local interwiki link prefixes
8066 !! wikitext
8067 [[local:local:local:local:mi:local:Foo]]
8068 !! options
8069 parsoid=wt2html,wt2wt,html2html
8070 !! html/php
8071 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8072 </p>
8073 !! html/parsoid
8074 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8075 !! end
8076
8077 ###
8078 ### Interlanguage links
8079 ### Language links (so that searching for '### language' matches..)
8080 ###
8081
8082 !! test
8083 Interlanguage link
8084 !! options
8085 parsoid=wt2html,wt2wt,html2html
8086 !! wikitext
8087 Blah blah blah
8088 [[zh:Chinese]]
8089 !! html/php
8090 <p>Blah blah blah
8091 </p>
8092 !! html/parsoid
8093 <p>Blah blah blah</p>
8094 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8095 !! end
8096
8097 !! test
8098 Interlanguage link with spacing
8099 !! options
8100 parsoid=wt2html,wt2wt,html2html
8101 !! wikitext
8102 Blah blah blah
8103 [[ zh : Chinese ]]
8104 !! html/php
8105 <p>Blah blah blah
8106 </p>
8107 !! html/parsoid
8108 <p>Blah blah blah</p>
8109 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8110 !! end
8111
8112 !! test
8113 Double interlanguage link
8114 !! options
8115 parsoid=wt2html,wt2wt,html2html
8116 !! wikitext
8117 Blah blah blah
8118 [[es:Spanish]]
8119 [[zh:Chinese]]
8120 !! html/php
8121 <p>Blah blah blah
8122 </p>
8123 !! html/parsoid
8124 <p>Blah blah blah</p>
8125 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8126 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8127 !! end
8128
8129 !! test
8130 Interlanguage link variations
8131 !! options
8132 parsoid=wt2html,wt2wt,html2html
8133 !! wikitext
8134 Blah blah blah
8135 [[ es :Spanish]]
8136 [[ ZH :Chinese]]
8137 [[es:Foo_bar]]
8138 !! html/php
8139 <p>Blah blah blah
8140 </p>
8141 !! html/parsoid
8142 <p>Blah blah blah</p>
8143 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
8144 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
8145 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
8146 !! end
8147
8148 !! test
8149 Space and question mark encoding in interlanguage links (T95473)
8150 !! options
8151 parsoid=wt2html,wt2wt,html2html
8152 !! wikitext
8153 Blah blah blah
8154 [[es:Foo bar?]]
8155 !! html/php
8156 <p>Blah blah blah
8157 </p>
8158 !! html/parsoid
8159 <p>Blah blah blah</p>
8160 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
8161 !! end
8162
8163 !! test
8164 Interlanguage link, with prefix links
8165 !! options
8166 language=ln
8167 !! wikitext
8168 Blah blah blah
8169 [[zh:Chinese]]
8170 !! html/php
8171 <p>Blah blah blah
8172 </p>
8173 !! html/parsoid
8174 <p>Blah blah blah</p>
8175 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8176 !! end
8177
8178 !! test
8179 Double interlanguage link, with prefix links (bug 8897)
8180 !! options
8181 language=ln
8182 !! wikitext
8183 Blah blah blah
8184 [[es:Spanish]]
8185 [[zh:Chinese]]
8186 !! html/php
8187 <p>Blah blah blah
8188 </p>
8189 !! html/parsoid
8190 <p>Blah blah blah</p>
8191 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8192 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8193 !! end
8194
8195 !! test
8196 "Extra" interlanguage links (bug 32189 / gerrit 111390)
8197 !! wikitext
8198 Blah blah blah
8199 [[mul:Article]]
8200 !! html/php
8201 <p>Blah blah blah
8202 </p>
8203 !! html/parsoid
8204 <p>Blah blah blah</p>
8205 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
8206 !! end
8207
8208 !! test
8209 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
8210 !! options
8211 language=ln
8212 !! wikitext
8213 [[WW&nbsp;II]]
8214 !! html
8215 <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>
8216 </p>
8217 !! end
8218
8219 !! test
8220 Parsoid bug 53221: Wikilinks should be properly entity-escaped
8221 !! options
8222 parsoid=html2wt
8223 !! html/parsoid
8224 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8225 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8226 !! wikitext
8227 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
8228
8229 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
8230 !! end
8231
8232 !! test
8233 Parsoid: handle constructor well
8234 !! wikitext
8235 [[constructor]]
8236
8237 [[constructor:foo]]
8238 !! html/php
8239 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
8240 </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>
8241 </p>
8242 !! html/parsoid
8243 <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>
8244
8245 <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>
8246 !! end
8247
8248 !! article
8249 ko:
8250 !! text
8251 Test.
8252 !! endarticle
8253
8254 # Note that `ko` isn't a known interlanguage prefix
8255 !! test
8256 Parsoid: recognize interlanguage links without a target page
8257 !! options
8258 ill
8259 !! wikitext
8260 [[es:]]
8261
8262 [[ko:]]
8263 !! html/php
8264 es:
8265 !! html/parsoid
8266 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
8267
8268 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8269 !! end
8270
8271 # Note that `ko` isn't a known interwiki prefix
8272 !! test
8273 Parsoid: recognize interwiki links without a target page
8274 !! options
8275 parsoid=wt2html,wt2wt,html2html
8276 !! wikitext
8277 [[:es:]]
8278
8279 [[:ko:]]
8280 !! html/php
8281 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
8282 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
8283 </p>
8284 !! html/parsoid
8285 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
8286 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8287 !! end
8288
8289 !! test
8290 Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
8291 !! wikitext
8292 [[mi:Foo]]
8293 !! html/php
8294 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
8295 </p>
8296 !! html/parsoid
8297 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
8298 !! end
8299
8300 !! test
8301 Interlanguage link with preceding local interwiki link (bug 68085)
8302 !! options
8303 parsoid=wt2html,wt2wt,html2html
8304 !! wikitext
8305 Blah blah blah
8306 [[local:es:Spanish]]
8307 !! html/php
8308 <p>Blah blah blah
8309 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
8310 </p>
8311 !! html/parsoid
8312 <p>Blah blah blah
8313 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
8314 !! end
8315
8316 !! test
8317 Looks like an interlanguage link, but is actually a local interwiki
8318 !! options
8319 parsoid=wt2html,wt2wt,html2html
8320 !! wikitext
8321 Blah blah blah
8322 [[mi:Template:Foo]]
8323 !! html/php
8324 <p>Blah blah blah
8325 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
8326 </p>
8327 !! html/parsoid
8328 <p>Blah blah blah
8329 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
8330 !! end
8331
8332 ###
8333 ### Redirects, Parsoid-only
8334 ###
8335
8336 !! test
8337 1. Simple redirect to page
8338 !! wikitext
8339 #REDIRECT [[Main Page]]
8340 !! html/parsoid
8341 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8342 !! end
8343
8344 !! test
8345 2. Other redirect variants
8346 !! wikitext
8347 #REDIRECT [[Main_Page]]
8348 !! html/parsoid
8349 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
8350 !! end
8351
8352 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
8353 # This tests the Parsoid bail-out code.
8354 !! test
8355 3. Other redirect variants
8356 !! wikitext
8357 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
8358 !! html/parsoid
8359 <ol><li data-parsoid>REDIRECT [[[[Bar]]]]</li></ol>
8360 !! end
8361
8362 !! test
8363 4. Redirect to a templated destination
8364 !! wikitext
8365 #REDIRECT [[{{echo|Foo}}bar]]
8366 !! html/parsoid
8367 <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"}]]}'/>
8368 !! end
8369
8370 !! test
8371 Empty redirect
8372 !! options
8373 parsoid=wt2html,wt2wt
8374 !! wikitext
8375 #REDIRECT [[]]
8376 !! html/parsoid
8377 <ol>
8378 <li>REDIRECT [[]]</li></ol>
8379 !! end
8380
8381 !! test
8382 Optional colon in #REDIRECT
8383 !! options
8384 # the colon is archaic syntax. we support it for wt2html, but we
8385 # don't care that it roundtrips back to the modern syntax.
8386 parsoid=wt2html,html2html
8387 !! wikitext
8388 #REDIRECT:[[Main Page]]
8389 !! html/parsoid
8390 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8391 !! end
8392
8393 !! test
8394 Whitespace in #REDIRECT with optional colon
8395 !! options
8396 # the colon and gratuitous whitespace is archaic syntax. we support
8397 # it for wt2html, but we don't care that it roundtrips back to the
8398 # modern syntax (without extra whitespace)
8399 parsoid=wt2html,html2html
8400 !! wikitext
8401
8402 #REDIRECT
8403 :
8404 [[Main Page]]
8405 !! html/parsoid
8406 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8407 !! end
8408
8409 !! test
8410 Piped link in #REDIRECT
8411 !! options
8412 # content after piped link is ignored. we support this syntax,
8413 # but don't care that the piped link is lost when we roundtrip this.
8414 parsoid=wt2html
8415 !! wikitext
8416 #REDIRECT [[Main Page|bar]]
8417 !! html/parsoid
8418 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8419 !! end
8420
8421 !! test
8422 Redirect to category (T104502)
8423 !! options
8424 parsoid=wt2html,wt2wt
8425 !! wikitext
8426 #REDIRECT [[Category:Foo]]
8427 !! html/parsoid
8428 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8429 !! end
8430
8431 !! test
8432 Redirect to category with URL encoding (T104502)
8433 !! options
8434 parsoid=wt2html
8435 !! wikitext
8436 #REDIRECT [[Category%3AFoo]]
8437 !! html/parsoid
8438 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8439 !! end
8440
8441 !! test
8442 Redirect to category page
8443 !! wikitext
8444 #REDIRECT [[:Category:Foo]]
8445 !! html/parsoid
8446 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8447 !! end
8448
8449 !! test
8450 Redirect to image page (1)
8451 !! wikitext
8452 #REDIRECT [[File:Wiki.png]]
8453 !! html/parsoid
8454 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
8455 !! end
8456
8457 !! test
8458 Redirect to image page (2)
8459 !! wikitext
8460 #REDIRECT [[Image:Wiki.png]]
8461 !! html/parsoid
8462 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
8463 !! end
8464
8465 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
8466 # Next test confirms this.
8467 !! test
8468 Redirect to language (1) (T104918)
8469 !! options
8470 parsoid=wt2html,wt2wt,html2html
8471 !! wikitext
8472 #REDIRECT [[en:File:Wiki.png]]
8473 !! html/parsoid
8474 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8475 !! end
8476
8477 !! test
8478 Redirect to language (2) (T104918)
8479 !! wikitext
8480 #REDIRECT [[:en:File:Wiki.png]]
8481 !! html/parsoid
8482 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8483 !! end
8484
8485 !! test
8486 Redirect to interwiki (T104918)
8487 !! wikitext
8488 #REDIRECT [[meatball:File:Wiki.png]]
8489 !! html/parsoid
8490 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
8491 !! end
8492
8493 !! test
8494 Non-English #REDIRECT
8495 !! options
8496 language=is
8497 !! wikitext
8498 #TILVÍSUN [[Main Page]]
8499 !! html/parsoid
8500 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
8501 !! end
8502
8503 !! test
8504 Redirect syntax under text isn't considered a redirect
8505 !! wikitext
8506 some text
8507 #redirect [[Main Page]]
8508 !! html/parsoid
8509 <p>some text</p>
8510 <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>
8511 !! end
8512
8513 # FIXME: Should hoist the redirect to the top of the page and ensure there
8514 # is only one.
8515 !! test
8516 New redirect
8517 !! options
8518 parsoid=html2wt
8519 !! html/parsoid
8520 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
8521 !! wikitext
8522 Foo
8523 #REDIRECT [[Foo]]
8524 !! end
8525
8526 ##
8527 ## XHTML tidiness
8528 ###
8529
8530 !! test
8531 <br> to <br />
8532 !! wikitext
8533 1<br>2<br />3
8534 !! html
8535 <p>1<br />2<br />3
8536 </p>
8537 !! end
8538
8539 !! test
8540 Broken br tag sanitization
8541 !! wikitext
8542 </br>
8543 !! html/php
8544 <p>&lt;/br&gt;
8545 </p>
8546 !! end
8547
8548 # TODO: Fix html2html mode (bug 51055)!
8549 !! test
8550 Parsoid: Broken br tag recognition
8551 !! options
8552 parsoid=wt2html
8553 !! wikitext
8554 </br>
8555
8556 <br/ >
8557 !! html+tidy
8558 <p><br /></p>
8559 <p><br /></p>
8560 !! end
8561
8562 !! test
8563 Incorrecly removing closing slashes from correctly formed XHTML
8564 !! wikitext
8565 <br style="clear:both;" />
8566 !! html
8567 <p><br style="clear:both;" />
8568 </p>
8569 !! end
8570
8571 !! test
8572 Failing to transform badly formed HTML into correct XHTML
8573 !! wikitext
8574 <br style="clear: left;">
8575 <br style="clear: right;">
8576 <br style="clear: both;">
8577 !! html
8578 <p><br style="clear: left;" />
8579 <br style="clear: right;" />
8580 <br style="clear: both;" />
8581 </p>
8582 !!end
8583
8584 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
8585 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
8586 !! test
8587 Handling html with a div self-closing tag
8588 !! wikitext
8589 <div title />
8590 <div title/>
8591 <div title/ >
8592 <div title=bar />
8593 <div title=bar/>
8594 <div title=bar/ >
8595 !! html/php
8596 <p>&lt;div title /&gt;
8597 &lt;div title/&gt;
8598 </p>
8599 <div>
8600 <p>&lt;div title=bar /&gt;
8601 &lt;div title=bar/&gt;
8602 </p>
8603 <div title="bar/"></div>
8604 </div>
8605
8606 !! html/parsoid
8607 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8608 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8609 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
8610 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8611 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8612 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
8613 !! end
8614
8615 !! test
8616 Handling html with a br self-closing tag
8617 !! wikitext
8618 <br title />
8619 <br title/>
8620 <br title/ >
8621 <br title=bar />
8622 <br title=bar/>
8623 <br title=bar/ >
8624 !! html/php
8625 <p><br title="" />
8626 <br title="" />
8627 <br />
8628 <br title="bar" />
8629 <br title="bar" />
8630 <br title="bar/" />
8631 </p>
8632 !! html/parsoid
8633 <p><br title="" />
8634 <br title="" />
8635 <br title="" />
8636 <br title="bar" />
8637 <br title="bar" />
8638 <br title="bar/" />
8639 </p>
8640 !! end
8641
8642 !! test
8643 Horizontal ruler (should it add that extra space?)
8644 !! wikitext
8645 <hr>
8646 <hr >
8647 foo <hr
8648 > bar
8649 !! html+tidy
8650 <hr />
8651 <hr />
8652 <p>foo</p>
8653 <hr />
8654 <p>bar</p>
8655 !! end
8656
8657 !! test
8658 Horizontal ruler -- 4+ dashes render hr
8659 !! wikitext
8660 ----
8661 !! html
8662 <hr />
8663
8664 !! end
8665
8666 !! test
8667 Horizontal ruler -- eats additional dashes on the same line
8668 !! wikitext
8669 ---------
8670 !! html
8671 <hr />
8672
8673 !! end
8674
8675 !! test
8676 Horizontal ruler -- does not collapse dashes on consecutive lines
8677 !! wikitext
8678 ----
8679 ----
8680 !! html
8681 <hr />
8682 <hr />
8683
8684 !! end
8685
8686 !! test
8687 Horizontal ruler -- <4 dashes render as plain text
8688 !! wikitext
8689 ---
8690 !! html
8691 <p>---
8692 </p>
8693 !! end
8694
8695 !! test
8696 Horizontal ruler -- Supports content following dashes on same line
8697 !! wikitext
8698 ---- Foo
8699 !! html
8700 <hr /> Foo
8701
8702 !! html+tidy
8703 <hr />
8704 <p>Foo</p>
8705 !! end
8706
8707 ###
8708 ### Block-level elements
8709 ###
8710 !! test
8711 Common list
8712 !! wikitext
8713 *Common list
8714 * item 2
8715 *item 3
8716 !! html
8717 <ul><li>Common list</li>
8718 <li> item 2</li>
8719 <li>item 3</li></ul>
8720
8721 !! end
8722
8723 !! test
8724 Numbered list
8725 !! wikitext
8726 #Numbered list
8727 #item 2
8728 # item 3
8729 !! html
8730 <ol><li>Numbered list</li>
8731 <li>item 2</li>
8732 <li> item 3</li></ol>
8733
8734 !! end
8735
8736 !! test
8737 Mixed list
8738 !! wikitext
8739 *Mixed list
8740 *# with numbers
8741 ** and bullets
8742 *# and numbers
8743 *bullets again
8744 **bullet level 2
8745 ***bullet level 3
8746 ***#Number on level 4
8747 **bullet level 2
8748 **#Number on level 3
8749 **#Number on level 3
8750 *#number level 2
8751 *Level 1
8752 *** Level 3
8753 #** Level 3, but ordered
8754 !! html
8755 <ul><li>Mixed list
8756 <ol><li> with numbers</li></ol>
8757 <ul><li> and bullets</li></ul>
8758 <ol><li> and numbers</li></ol></li>
8759 <li>bullets again
8760 <ul><li>bullet level 2
8761 <ul><li>bullet level 3
8762 <ol><li>Number on level 4</li></ol></li></ul></li>
8763 <li>bullet level 2
8764 <ol><li>Number on level 3</li>
8765 <li>Number on level 3</li></ol></li></ul>
8766 <ol><li>number level 2</li></ol></li>
8767 <li>Level 1
8768 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
8769 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
8770
8771 !! end
8772
8773 !! test
8774 Nested lists 1
8775 !! wikitext
8776 *foo
8777 **bar
8778 !! html
8779 <ul><li>foo
8780 <ul><li>bar</li></ul></li></ul>
8781
8782 !! end
8783
8784 !! test
8785 Nested lists 2
8786 !! wikitext
8787 **foo
8788 *bar
8789 !! html
8790 <ul><li><ul><li>foo</li></ul></li>
8791 <li>bar</li></ul>
8792
8793 !! end
8794
8795 !! test
8796 Nested lists 3 (first element empty)
8797 !! wikitext
8798 *
8799 **bar
8800 !! html
8801 <ul><li>
8802 <ul><li>bar</li></ul></li></ul>
8803
8804 !! end
8805
8806 !! test
8807 Nested lists 4 (first element empty)
8808 !! wikitext
8809 **
8810 *bar
8811 !! html
8812 <ul><li><ul><li></li></ul></li>
8813 <li>bar</li></ul>
8814
8815 !! end
8816
8817 !! test
8818 Nested lists 5 (both elements empty)
8819 !! wikitext
8820 **
8821 *
8822 !! html
8823 <ul><li><ul><li></li></ul></li>
8824 <li></li></ul>
8825
8826 !! end
8827
8828 !! test
8829 Nested lists 6 (both elements empty)
8830 !! wikitext
8831 *
8832 **
8833 !! html
8834 <ul><li>
8835 <ul><li></li></ul></li></ul>
8836
8837 !! end
8838
8839 !! test
8840 Nested lists 7 (skip initial nesting levels)
8841 !! wikitext
8842 *** foo
8843 !! html
8844 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
8845
8846 !! end
8847
8848 !! test
8849 Nested lists 8 (multiple nesting transitions)
8850 !! wikitext
8851 * foo
8852 *** bar
8853 ** baz
8854 * boo
8855 !! html
8856 <ul><li> foo
8857 <ul><li><ul><li> bar</li></ul></li>
8858 <li> baz</li></ul></li>
8859 <li> boo</li></ul>
8860
8861 !! end
8862
8863 !! test
8864 Nested lists 9 (extension interaction)
8865 !! options
8866 parsoid
8867 !! wikitext
8868 *<references />
8869 !! html/parsoid
8870 <ul><li data-parsoid='{}'><ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
8871 !! end
8872
8873 !! test
8874 1. Lists with start-of-line-transparent tokens before bullets: Comments
8875 !! wikitext
8876 *foo
8877 *<!--cmt-->bar
8878 <!--cmt-->*baz
8879 !! html
8880 <ul><li>foo</li>
8881 <li>bar</li>
8882 <li>baz</li></ul>
8883
8884 !! end
8885
8886 !! test
8887 2. Lists with start-of-line-transparent tokens before bullets: Template close
8888 !! wikitext
8889 *foo {{echo|bar
8890 }}*baz
8891 !! html
8892 <ul><li>foo bar</li>
8893 <li>baz</li></ul>
8894
8895 !! end
8896
8897 !! test
8898 List items are not parsed correctly following a <pre> block (bug 785)
8899 !! wikitext
8900 * <pre>foo</pre>
8901 * <pre>bar</pre>
8902 * zar
8903 !! html/php
8904 <ul><li> <pre>foo</pre></li>
8905 <li> <pre>bar</pre></li>
8906 <li> zar</li></ul>
8907
8908 !! html/parsoid
8909 <ul><li> <pre data-parsoid='{"stx":"html"}'>foo</pre></li>
8910 <li> <pre data-parsoid='{"stx":"html"}'>bar</pre></li>
8911 <li> zar</li></ul>
8912 !! end
8913
8914 !! test
8915 List items from template
8916 !! wikitext
8917
8918 {{inner list}}
8919 * item 2
8920
8921 * item 0
8922 {{inner list}}
8923 * item 2
8924
8925 * item 0
8926 * notSOL{{inner list}}
8927 * item 2
8928 !! html
8929 <ul><li> item 1</li>
8930 <li> item 2</li></ul>
8931 <ul><li> item 0</li>
8932 <li> item 1</li>
8933 <li> item 2</li></ul>
8934 <ul><li> item 0</li>
8935 <li> notSOL</li>
8936 <li> item 1</li>
8937 <li> item 2</li></ul>
8938
8939 !! end
8940
8941 !! test
8942 List interrupted by empty line or heading
8943 !! wikitext
8944 * foo
8945
8946 ** bar
8947 == A heading ==
8948 * Another list item
8949 !! html
8950 <ul><li> foo</li></ul>
8951 <ul><li><ul><li> bar</li></ul></li></ul>
8952 <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>
8953 <ul><li> Another list item</li></ul>
8954
8955 !!end
8956
8957 !!test
8958 Multiple list tags generated by templates
8959 !! wikitext
8960 {{echo|<li>}}a
8961 {{echo|<li>}}b
8962 {{echo|<li>}}c
8963 !! html
8964 <li>a
8965 <li>b
8966 <li>c</li>
8967 </li>
8968 </li>
8969
8970 !! html+tidy
8971 <ul>
8972 <li>a</li>
8973 <li>b</li>
8974 <li>c</li>
8975 </ul>
8976 !!end
8977
8978 !!test
8979 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
8980 !! wikitext
8981 *a
8982 <!--This line will NOT split the list-->
8983 *b
8984 <!--This line will NOT split the list either-->
8985 *c
8986 <!--foo--> <!----> <!--This line NOT split the list either-->
8987 *d
8988 !! html
8989 <ul><li>a</li>
8990 <li>b</li>
8991 <li>c</li>
8992 <li>d</li></ul>
8993
8994 !!end
8995
8996 !!test
8997 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
8998 !! wikitext
8999 *a
9000 <!--This line will NOT split the list-->
9001 *b
9002 <!--This line will NOT split the list either-->
9003 *c
9004 <!--foo--> <!----> <!--This line NOT split the list
9005 either-->
9006 *d
9007 !! html
9008 <ul><li>a</li>
9009 <li>b</li>
9010 <li>c</li>
9011 <li>d</li></ul>
9012
9013 !!end
9014
9015 !!test
9016 Test the li-hack
9017 (The PHP parser relies on Tidy for the hack)
9018 !!options
9019 parsoid=wt2html,wt2wt
9020 !! wikitext
9021 * foo
9022 * <li>li-hack
9023 * {{echo|<li>templated li-hack}}
9024 * <!--foo--> <li> unsupported li-hack with preceding comments
9025
9026 <ul>
9027 <li><li>not a li-hack
9028 </li>
9029 </ul>
9030 !! html+tidy
9031 <ul>
9032 <li>foo</li>
9033 <li>li-hack</li>
9034 <li>templated li-hack</li>
9035 <li>unsupported li-hack with preceding comments</li>
9036 </ul>
9037 <ul>
9038 <li>not a li-hack</li>
9039 </ul>
9040 !!end
9041
9042 !! test
9043 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
9044 !! options
9045 parsoid
9046 !! wikitext
9047 # foo
9048 ## bar
9049 * foo
9050 ** bar
9051 : foo
9052 :: bar
9053 !! html
9054 <ol>
9055 <li> foo<ol>
9056 <li> bar</li>
9057 </ol></li>
9058 </ol><ul>
9059 <li> foo<ul>
9060 <li> bar</li>
9061 </ul></li>
9062 </ul><dl>
9063 <dd> foo<dl>
9064 <dd> bar</dd>
9065 </dl></dd>
9066 </dl>
9067 !! end
9068
9069 !! test
9070 Parsoid: Test of whitespace serialization with Templated bullets
9071 !! options
9072 parsoid
9073 !! wikitext
9074 * {{bullet}}
9075 !! html
9076 <ul>
9077 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
9078 </ul>
9079 !! end
9080
9081 # ------------------------------------------------------------------------
9082 # The next set of tests are about Parsoid's ability to handle badly nested
9083 # tags (parse, minimize scope of fixup, and roundtrip back)
9084 # ------------------------------------------------------------------------
9085
9086 !! test
9087 Unbalanced closing block tags break a list
9088 (php parser relies on Tidy to fix up)
9089 !! wikitext
9090 <div>
9091 *a</div><div>
9092 *b</div>
9093 !! html+tidy
9094 <div>
9095 <ul>
9096 <li>a</li>
9097 </ul>
9098 </div>
9099 <div>
9100 <ul>
9101 <li>b</li>
9102 </ul>
9103 </div>
9104 !! end
9105
9106 # Parsoid fails this test, but it might be tricky to support properly.
9107 # See bug 68395.
9108 !! test
9109 Unbalanced closing non-block tags don't break a list
9110 (php parser relies on Tidy to fix up)
9111 !! wikitext
9112 <span>
9113 *a</span><span>
9114 *b</span>
9115 !! html/php+tidy
9116 <ul>
9117 <li><span>a</span></li>
9118 <li><span>b</span></li>
9119 </ul>
9120 !! html/parsoid
9121 <span>
9122 <ul>
9123 <li>a<span></span>
9124 </li>
9125 <li>b
9126 </li>
9127 </ul>
9128 </span>
9129 !! end
9130
9131 !! test
9132 Unclosed formatting tags that straddle lists are closed and reopened
9133 (php parser relies on Tidy to fix up)
9134 !! options
9135 parsoid=wt2html,wt2wt,html2html
9136 !! wikitext
9137 # <s> a
9138 # b </s>
9139 !! html/php+tidy
9140 <ol>
9141 <li><s>a</s></li>
9142 <li><s>b</s></li>
9143 </ol>
9144 !! html/parsoid
9145 <ol><li> <s> a</s></li>
9146 <li><s> b </s></li></ol>
9147 !! end
9148
9149 # See bug 68395.
9150 !!test
9151 1. List embedded in a formatting tag
9152 !! wikitext
9153 <small>
9154 * foo
9155 </small>
9156 !! html/php+tidy
9157 <ul>
9158 <li><small>foo</small></li>
9159 </ul>
9160 !! html/parsoid
9161 <small>
9162 <ul>
9163 <li> foo</li>
9164 </ul>
9165 </small>
9166 !!end
9167
9168 ## Ugly Parsoid output here
9169 ## Not sure what the right output is.
9170 !!test
9171 2. List embedded in a formatting tag
9172 !! wikitext
9173 <small>
9174 *a
9175 *b</small>
9176 !! html/php+tidy
9177 <ul>
9178 <li><small>a</small></li>
9179 <li><small>b</small></li>
9180 </ul>
9181 !! html/parsoid
9182 <small></small>
9183 <ul><small>
9184 <li>a</li>
9185 </small>
9186 <li><small>b</small></li>
9187 </ul>
9188 !!end
9189
9190 # Ugly Parsoid and PHP parser output here
9191 # Not sure if we want to make this a test!
9192 #
9193 ## !!test
9194 ## 3. Unclosed formatting tags in list elements
9195 ## !! wikitext
9196 ## *<small>a
9197 ## *<small>b
9198 ## !! html/php+tidy
9199 ## <ul>
9200 ## <li><small>a</small></li>
9201 ## <li><small><small>b</small></small></li>
9202 ## </ul>
9203 ## !! html/parsoid
9204 ## <ul>
9205 ## <li><small>a</small></li>
9206 ## <small>
9207 ## <li><small>b</small></li>
9208 ## </small></ul>
9209 ## !!end
9210
9211 # This is a bug in the PHP parser + tidy combination.
9212 # (The </tr> tag gets parsed as text and html-escaped by PHP,
9213 # and then fostered out of the table by tidy.)
9214 # We believe the Parsoid output to be correct.
9215 !! test
9216 Table with missing opening <tr> tag
9217 !! options
9218 parsoid=wt2html,wt2wt
9219 !! wikitext
9220 <table>
9221 <td>foo</td>
9222 </tr>
9223 </table>
9224 !! html+tidy
9225 <table>
9226 <tr>
9227 <td>foo</td>
9228 </tr>
9229 </table>
9230 !! end
9231
9232 ###
9233 ### Magic Words
9234 ###
9235
9236 # Note that the current date is hard-coded as
9237 # 1970-01-01T00:02:03Z (a Thursday)
9238 # when running parser tests. The timezone is also fixed to GMT, so
9239 # local date will be identical to current date.
9240
9241 !! test
9242 Magic Word: {{CURRENTDAY}}
9243 !! wikitext
9244 {{CURRENTDAY}}
9245 !! html
9246 <p>1
9247 </p>
9248 !! end
9249
9250 !! test
9251 Magic Word: {{CURRENTDAY2}}
9252 !! wikitext
9253 {{CURRENTDAY2}}
9254 !! html
9255 <p>01
9256 </p>
9257 !! end
9258
9259 !! test
9260 Magic Word: {{CURRENTDAYNAME}}
9261 !! wikitext
9262 {{CURRENTDAYNAME}}
9263 !! html
9264 <p>Thursday
9265 </p>
9266 !! end
9267
9268 !! test
9269 Magic Word: {{CURRENTDOW}}
9270 !! wikitext
9271 {{CURRENTDOW}}
9272 !! html
9273 <p>4
9274 </p>
9275 !! end
9276
9277 !! test
9278 Magic Word: {{CURRENTMONTH}}
9279 !! wikitext
9280 {{CURRENTMONTH}}
9281 !! html
9282 <p>01
9283 </p>
9284 !! end
9285
9286 !! test
9287 Magic Word: {{CURRENTMONTH1}}
9288 !! wikitext
9289 {{CURRENTMONTH1}}
9290 !! html
9291 <p>1
9292 </p>
9293 !! end
9294
9295 !! test
9296 Magic Word: {{CURRENTMONTHABBREV}}
9297 !! wikitext
9298 {{CURRENTMONTHABBREV}}
9299 !! html
9300 <p>Jan
9301 </p>
9302 !! end
9303
9304 !! test
9305 Magic Word: {{CURRENTMONTHNAME}}
9306 !! wikitext
9307 {{CURRENTMONTHNAME}}
9308 !! html
9309 <p>January
9310 </p>
9311 !! end
9312
9313 !! test
9314 Magic Word: {{CURRENTMONTHNAMEGEN}}
9315 !! wikitext
9316 {{CURRENTMONTHNAMEGEN}}
9317 !! html
9318 <p>January
9319 </p>
9320 !! end
9321
9322 !! test
9323 Magic Word: {{CURRENTTIME}}
9324 !! wikitext
9325 {{CURRENTTIME}}
9326 !! html
9327 <p>00:02
9328 </p>
9329 !! end
9330
9331 !! test
9332 Magic Word: {{CURRENTHOUR}}
9333 !! wikitext
9334 {{CURRENTHOUR}}
9335 !! html
9336 <p>00
9337 </p>
9338 !! end
9339
9340 !! test
9341 Magic Word: {{CURRENTWEEK}} (@bug 4594)
9342 !! wikitext
9343 {{CURRENTWEEK}}
9344 !! html
9345 <p>1
9346 </p>
9347 !! end
9348
9349 !! test
9350 Magic Word: {{CURRENTYEAR}}
9351 !! wikitext
9352 {{CURRENTYEAR}}
9353 !! html
9354 <p>1970
9355 </p>
9356 !! end
9357
9358 !! test
9359 Magic Word: {{CURRENTTIMESTAMP}}
9360 !! wikitext
9361 {{CURRENTTIMESTAMP}}
9362 !! html
9363 <p>19700101000203
9364 </p>
9365 !! end
9366
9367 !! test
9368 Magic Words LOCAL (UTC)
9369 !! wikitext
9370 * {{LOCALMONTH}}
9371 * {{LOCALMONTH1}}
9372 * {{LOCALMONTHNAME}}
9373 * {{LOCALMONTHNAMEGEN}}
9374 * {{LOCALMONTHABBREV}}
9375 * {{LOCALDAY}}
9376 * {{LOCALDAY2}}
9377 * {{LOCALDAYNAME}}
9378 * {{LOCALYEAR}}
9379 * {{LOCALTIME}}
9380 * {{LOCALHOUR}}
9381 * {{LOCALWEEK}}
9382 * {{LOCALDOW}}
9383 * {{LOCALTIMESTAMP}}
9384 !! html
9385 <ul><li> 01</li>
9386 <li> 1</li>
9387 <li> January</li>
9388 <li> January</li>
9389 <li> Jan</li>
9390 <li> 1</li>
9391 <li> 01</li>
9392 <li> Thursday</li>
9393 <li> 1970</li>
9394 <li> 00:02</li>
9395 <li> 00</li>
9396 <li> 1</li>
9397 <li> 4</li>
9398 <li> 19700101000203</li></ul>
9399
9400 !! end
9401
9402 !! test
9403 Magic Word: {{FULLPAGENAME}}
9404 !! options
9405 title=[[User:Ævar Arnfjörð Bjarmason]]
9406 !! wikitext
9407 {{FULLPAGENAME}}
9408 !! html
9409 <p>User:Ævar Arnfjörð Bjarmason
9410 </p>
9411 !! end
9412
9413 !! test
9414 Magic Word: {{FULLPAGENAMEE}}
9415 !! options
9416 title=[[User:Ævar Arnfjörð Bjarmason]]
9417 !! wikitext
9418 {{FULLPAGENAMEE}}
9419 !! html
9420 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9421 </p>
9422 !! end
9423
9424 !! test
9425 Magic Word: {{TALKSPACE}}
9426 !! options
9427 title=[[User:Ævar Arnfjörð Bjarmason]]
9428 !! wikitext
9429 {{TALKSPACE}}
9430 !! html
9431 <p>User talk
9432 </p>
9433 !! end
9434
9435 !! test
9436 Magic Word: {{TALKSPACE}}, same namespace
9437 !! options
9438 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9439 !! wikitext
9440 {{TALKSPACE}}
9441 !! html
9442 <p>User talk
9443 </p>
9444 !! end
9445
9446 !! test
9447 Magic Word: {{TALKSPACE}}, main namespace
9448 !! options
9449 title=[[Parser Test]]
9450 !! wikitext
9451 {{TALKSPACE}}
9452 !! html
9453 <p>Talk
9454 </p>
9455 !! end
9456
9457 !! test
9458 Magic Word: {{TALKSPACEE}}
9459 !! options
9460 title=[[User:Ævar Arnfjörð Bjarmason]]
9461 !! wikitext
9462 {{TALKSPACEE}}
9463 !! html
9464 <p>User_talk
9465 </p>
9466 !! end
9467
9468 !! test
9469 Magic Word: {{SUBJECTSPACE}}
9470 !! options
9471 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9472 !! wikitext
9473 {{SUBJECTSPACE}}
9474 !! html
9475 <p>User
9476 </p>
9477 !! end
9478
9479 !! test
9480 Magic Word: {{SUBJECTSPACE}}, same namespace
9481 !! options
9482 title=[[User:Ævar Arnfjörð Bjarmason]]
9483 !! wikitext
9484 {{SUBJECTSPACE}}
9485 !! html
9486 <p>User
9487 </p>
9488 !! end
9489
9490 !! test
9491 Magic Word: {{SUBJECTSPACE}}, main namespace
9492 !! options
9493 title=[[Parser Test]]
9494 !! wikitext
9495 {{SUBJECTSPACE}}
9496 !! html
9497
9498 !! end
9499
9500 !! test
9501 Magic Word: {{SUBJECTSPACEE}}
9502 !! options
9503 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9504 !! wikitext
9505 {{SUBJECTSPACEE}}
9506 !! html
9507 <p>User
9508 </p>
9509 !! end
9510
9511 !! test
9512 Magic Word: {{NAMESPACE}}
9513 !! options
9514 title=[[User:Ævar Arnfjörð Bjarmason]]
9515 !! wikitext
9516 {{NAMESPACE}}
9517 !! html
9518 <p>User
9519 </p>
9520 !! end
9521
9522 !! test
9523 Magic Word: {{NAMESPACEE}}
9524 !! options
9525 title=[[User:Ævar Arnfjörð Bjarmason]]
9526 !! wikitext
9527 {{NAMESPACEE}}
9528 !! html
9529 <p>User
9530 </p>
9531 !! end
9532
9533 !! test
9534 Magic Word: {{NAMESPACENUMBER}}
9535 !! options
9536 title=[[User:Ævar Arnfjörð Bjarmason]]
9537 !! wikitext
9538 {{NAMESPACENUMBER}}
9539 !! html
9540 <p>2
9541 </p>
9542 !! end
9543
9544 !! test
9545 Magic Word: {{SUBPAGENAME}}
9546 !! options
9547 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9548 !! wikitext
9549 {{SUBPAGENAME}}
9550 !! html
9551 <p>sub ö
9552 </p>
9553 !! end
9554
9555 !! test
9556 Magic Word: {{SUBPAGENAMEE}}
9557 !! options
9558 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9559 !! wikitext
9560 {{SUBPAGENAMEE}}
9561 !! html
9562 <p>sub_%C3%B6
9563 </p>
9564 !! end
9565
9566 !! test
9567 Magic Word: {{ROOTPAGENAME}}
9568 !! options
9569 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9570 !! wikitext
9571 {{ROOTPAGENAME}}
9572 !! html
9573 <p>Ævar Arnfjörð Bjarmason
9574 </p>
9575 !! end
9576
9577 !! test
9578 Magic Word: {{ROOTPAGENAMEE}}
9579 !! options
9580 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9581 !! wikitext
9582 {{ROOTPAGENAMEE}}
9583 !! html
9584 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9585 </p>
9586 !! end
9587
9588 !! test
9589 Magic Word: {{BASEPAGENAME}}
9590 !! options
9591 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9592 !! wikitext
9593 {{BASEPAGENAME}}
9594 !! html
9595 <p>Ævar Arnfjörð Bjarmason
9596 </p>
9597 !! end
9598
9599 !! test
9600 Magic Word: {{BASEPAGENAMEE}}
9601 !! options
9602 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9603 !! wikitext
9604 {{BASEPAGENAMEE}}
9605 !! html
9606 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9607 </p>
9608 !! end
9609
9610 !! test
9611 Magic Word: {{TALKPAGENAME}}
9612 !! options
9613 title=[[User:Ævar Arnfjörð Bjarmason]]
9614 !! wikitext
9615 {{TALKPAGENAME}}
9616 !! html
9617 <p>User talk:Ævar Arnfjörð Bjarmason
9618 </p>
9619 !! end
9620
9621 !! test
9622 Magic Word: {{TALKPAGENAMEE}}
9623 !! options
9624 title=[[User:Ævar Arnfjörð Bjarmason]]
9625 !! wikitext
9626 {{TALKPAGENAMEE}}
9627 !! html
9628 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9629 </p>
9630 !! end
9631
9632 !! test
9633 Magic Word: {{SUBJECTPAGENAME}}
9634 !! options
9635 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9636 !! wikitext
9637 {{SUBJECTPAGENAME}}
9638 !! html
9639 <p>User:Ævar Arnfjörð Bjarmason
9640 </p>
9641 !! end
9642
9643 !! test
9644 Magic Word: {{SUBJECTPAGENAMEE}}
9645 !! options
9646 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9647 !! wikitext
9648 {{SUBJECTPAGENAMEE}}
9649 !! html
9650 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9651 </p>
9652 !! end
9653
9654 !! test
9655 Magic Word: {{NUMBEROFFILES}}
9656 !! wikitext
9657 {{NUMBEROFFILES}}
9658 !! html
9659 <p>5
9660 </p>
9661 !! end
9662
9663 !! test
9664 Magic Word: {{PAGENAME}}
9665 !! options
9666 title=[[User:Ævar Arnfjörð Bjarmason]]
9667 !! wikitext
9668 {{PAGENAME}}
9669 !! html
9670 <p>Ævar Arnfjörð Bjarmason
9671 </p>
9672 !! end
9673
9674 !! test
9675 Magic Word: {{PAGENAME}} with metacharacters
9676 !! options
9677 title=[['foo & bar = baz']]
9678 !! wikitext
9679 ''{{PAGENAME}}''
9680 !! html/php
9681 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
9682 </p>
9683 !! html+tidy
9684 <p><i>'foo &amp; bar = baz'</i></p>
9685 !! end
9686
9687 !! test
9688 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
9689 !! options
9690 title=[[*RFC 1234 http://example.com/]]
9691 !! wikitext
9692 {{PAGENAME}}
9693 !! html/php
9694 <p>&#42;RFC&#32;1234 http&#58;//example.com/
9695 </p>
9696 !! html+tidy
9697 <p>*RFC 1234 http://example.com/</p>
9698 !! end
9699
9700 !! test
9701 Magic Word: {{PAGENAMEE}}
9702 !! options
9703 title=[[User:Ævar Arnfjörð Bjarmason]]
9704 !! wikitext
9705 {{PAGENAMEE}}
9706 !! html
9707 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9708 </p>
9709 !! end
9710
9711 !! test
9712 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
9713 !! options
9714 title=[[*RFC 1234 http://example.com/]]
9715 !! wikitext
9716 {{PAGENAMEE}}
9717 !! html/php
9718 <p>&#42;RFC_1234_http&#58;//example.com/
9719 </p>
9720 !! html+tidy
9721 <p>*RFC_1234_http://example.com/</p>
9722 !! end
9723
9724 !! test
9725 Magic Word: {{REVISIONID}}
9726 !! wikitext
9727 {{REVISIONID}}
9728 !! html
9729 <p>1337
9730 </p>
9731 !! end
9732
9733 !! test
9734 Magic Word: {{SCRIPTPATH}}
9735 !! wikitext
9736 {{SCRIPTPATH}}
9737 !! html
9738 <p>/
9739 </p>
9740 !! end
9741
9742 !! test
9743 Magic Word: {{STYLEPATH}}
9744 !! wikitext
9745 {{STYLEPATH}}
9746 !! html
9747 <p>/skins
9748 </p>
9749 !! end
9750
9751 !! test
9752 Magic Word: {{SERVER}}
9753 !! wikitext
9754 {{SERVER}}
9755 !! html
9756 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9757 </p>
9758 !! end
9759
9760 !! test
9761 Magic Word: {{SERVERNAME}}
9762 !! wikitext
9763 {{SERVERNAME}}
9764 !! html
9765 <p>example.org
9766 </p>
9767 !! end
9768
9769 !! test
9770 Magic Word: {{SITENAME}}
9771 !! wikitext
9772 {{SITENAME}}
9773 !! html
9774 <p>MediaWiki
9775 </p>
9776 !! end
9777
9778 !! test
9779 Case-sensitive magic words, when cased differently, should just be template transclusions
9780 !! wikitext
9781 {{CurrentMonth}}
9782 {{currentday}}
9783 {{cURreNTweEK}}
9784 {{currentHour}}
9785 !! html
9786 <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>
9787 <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>
9788 <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>
9789 <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>
9790 </p>
9791 !! end
9792
9793 !! test
9794 Case-insensitive magic words should still work with weird casing.
9795 !! wikitext
9796 {{sErVeRNaMe}}
9797 {{LCFirst:AOEU}}
9798 {{ucFIRST:aoeu}}
9799 {{SERver}}
9800 !! html
9801 <p>example.org
9802 aOEU
9803 Aoeu
9804 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9805 </p>
9806 !! end
9807
9808 # From plwiki:PLOS_ONE
9809 !! test
9810 Parsoid: Page property magic word with magic word contents
9811 !! wikitext
9812 {{DISPLAYTITLE:''{{PAGENAME}}''}}
9813 !! html/parsoid
9814 <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>"}]]}'/>
9815 !! end
9816
9817 !! test
9818 Parsoid: Template-generated DISPLAYTITLE
9819 !! wikitext
9820 {{{{echo|DISPLAYTITLE}}:Foo}}
9821 !! html/parsoid
9822 <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}}]}'/>
9823 !! end
9824
9825 !! test
9826 Namespace 1 {{ns:1}}
9827 !! wikitext
9828 {{ns:1}}
9829 !! html
9830 <p>Talk
9831 </p>
9832 !! end
9833
9834 !! test
9835 Namespace 1 {{ns:01}}
9836 !! wikitext
9837 {{ns:01}}
9838 !! html
9839 <p>Talk
9840 </p>
9841 !! end
9842
9843 !! test
9844 Namespace 0 {{ns:0}} (bug 4783)
9845 !! wikitext
9846 {{ns:0}}
9847 !! html
9848
9849 !! end
9850
9851 !! test
9852 Namespace 0 {{ns:00}} (bug 4783)
9853 !! wikitext
9854 {{ns:00}}
9855 !! html
9856
9857 !! end
9858
9859 !! test
9860 Namespace -1 {{ns:-1}}
9861 !! wikitext
9862 {{ns:-1}}
9863 !! html
9864 <p>Special
9865 </p>
9866 !! end
9867
9868 !! test
9869 Namespace User {{ns:User}}
9870 !! wikitext
9871 {{ns:User}}
9872 !! html
9873 <p>User
9874 </p>
9875 !! end
9876
9877 !! test
9878 Namespace User talk {{ns:User_talk}}
9879 !! wikitext
9880 {{ns:User_talk}}
9881 !! html
9882 <p>User talk
9883 </p>
9884 !! end
9885
9886 !! test
9887 Namespace User talk {{ns:uSeR tAlK}}
9888 !! wikitext
9889 {{ns:uSeR tAlK}}
9890 !! html
9891 <p>User talk
9892 </p>
9893 !! end
9894
9895 !! test
9896 Namespace File {{ns:File}}
9897 !! wikitext
9898 {{ns:File}}
9899 !! html
9900 <p>File
9901 </p>
9902 !! end
9903
9904 !! test
9905 Namespace File {{ns:Image}}
9906 !! wikitext
9907 {{ns:Image}}
9908 !! html
9909 <p>File
9910 </p>
9911 !! end
9912
9913 !! test
9914 Namespace (lang=de) Benutzer {{ns:User}}
9915 !! options
9916 language=de
9917 !! wikitext
9918 {{ns:User}}
9919 !! html
9920 <p>Benutzer
9921 </p>
9922 !! end
9923
9924 !! test
9925 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
9926 !! options
9927 language=de
9928 !! wikitext
9929 {{ns:3}}
9930 !! html
9931 <p>Benutzer Diskussion
9932 </p>
9933 !! end
9934
9935
9936 !! test
9937 Urlencode
9938 !! wikitext
9939 {{urlencode:hi world?!}}
9940 {{urlencode:hi world?!|WIKI}}
9941 {{urlencode:hi world?!|PATH}}
9942 {{urlencode:hi world?!|QUERY}}
9943 !! html
9944 <p>hi+world%3F%21
9945 hi_world%3F!
9946 hi%20world%3F%21
9947 hi+world%3F%21
9948 </p>
9949 !! end
9950
9951 !! test
9952 Magic Word: prioritize type info over data-parsoid
9953 !! options
9954 parsoid=html2wt
9955 !! html/parsoid
9956 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
9957 !! wikitext
9958 __FORCETOC__
9959 !! end
9960
9961 !! test
9962 Magic Word: serialize on separate line (parsoid)
9963 !! options
9964 parsoid=wt2wt,html2wt
9965 !! wikitext
9966 foo
9967 __NOTOC__
9968 bar
9969 !! html/parsoid
9970 foo<meta property="mw:PageProp/notoc"/>bar
9971 !! end
9972
9973 !! test
9974 Magic Word: rt non-english wikis
9975 !! options
9976 parsoid=wt2wt
9977 language=de
9978 !! wikitext
9979 __NOEDITSECTION__
9980 !! html/parsoid
9981 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
9982 !! end
9983
9984 !!test
9985 __proto__ is treated as normal wikitext (T105997)
9986 !!wikitext
9987 __proto__
9988 !!html
9989 <p>__proto__
9990 </p>
9991 !!end
9992
9993 ###
9994 ### Magic links
9995 ###
9996 !! test
9997 Magic links: internal link to RFC (bug 479)
9998 !! wikitext
9999 [[RFC 123]]
10000 !! html/php
10001 <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>
10002 </p>
10003 !! html/parsoid
10004 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
10005 !! end
10006
10007 !! test
10008 Magic links: RFC (bug 479)
10009 !! wikitext
10010 RFC 822
10011 !! html/php
10012 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10013 </p>
10014 !! html/parsoid
10015 <p><a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a></p>
10016 !! end
10017
10018 !! test
10019 Magic links: RFC (bug 65278)
10020 !! wikitext
10021 This is RFC 822 but thisRFC 822 is not RFC 822linked.
10022 !! html/php
10023 <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.
10024 </p>
10025 !! html/parsoid
10026 <p>This is <a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a> but thisRFC 822 is not RFC 822linked.</p>
10027 !! end
10028
10029 !! test
10030 Magic links: RFC (w/ non-newline whitespace, bug 28950/29025)
10031 !! wikitext
10032 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
10033 RFC
10034 822
10035 !! html/php
10036 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10037 RFC
10038 822
10039 </p>
10040 !! html/parsoid
10041 <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>
10042 RFC
10043 822</p>
10044 !! end
10045
10046 !! test
10047 Magic links: ISBN (bug 1937)
10048 !! wikitext
10049 ISBN 0-306-40615-2
10050 !! html/php
10051 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
10052 </p>
10053 !! html/parsoid
10054 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
10055 !! end
10056
10057 !! test
10058 Magic links: ISBN (bug 65278)
10059 !! wikitext
10060 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
10061 !! html/php
10062 <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.
10063 </p>
10064 !! html/parsoid
10065 <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>
10066 !! end
10067
10068 !! test
10069 Magic links: ISBN (w/ non-newline whitespace, bug 28950/29025)
10070 !! wikitext
10071 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
10072 ISBN
10073 9780316098113
10074 ISBN 978
10075 0316098113
10076 !! html/php
10077 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
10078 ISBN
10079 9780316098113
10080 ISBN 978
10081 0316098113
10082 </p>
10083 !! html/parsoid
10084 <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>
10085 ISBN
10086 9780316098113
10087 ISBN 978
10088 0316098113</p>
10089 !! end
10090
10091 !! test
10092 Magic links: PMID incorrectly converts space to underscore
10093 !! wikitext
10094 PMID 1234
10095 !! html/php
10096 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10097 </p>
10098 !! html/parsoid
10099 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a></p>
10100 !! end
10101
10102 !! test
10103 Magic links: PMID (bug 65278)
10104 !! wikitext
10105 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
10106 !! html/php
10107 <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.
10108 </p>
10109 !! html/parsoid
10110 <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>
10111 !! end
10112
10113 !! test
10114 Magic links: PMID (w/ non-newline whitespace, bug 28950/29025)
10115 !! wikitext
10116 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
10117 PMID
10118 1234
10119 !! html/php
10120 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10121 PMID
10122 1234
10123 </p>
10124 !! html/parsoid
10125 <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>
10126 PMID
10127 1234</p>
10128 !! end
10129
10130 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
10131 # since these are ExtLinkText, not MagicLinkText
10132 !! test
10133 Magic links: use appropriate serialization for "almost" magic links.
10134 !! wikitext
10135 X[[Special:BookSources/0978739256|foo]]
10136
10137 X[//tools.ietf.org/html/rfc1234 foo]
10138 !! html/php
10139 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
10140 </p><p>X<a rel="nofollow" class="external text" href="//tools.ietf.org/html/rfc1234">foo</a>
10141 </p>
10142 !! html/parsoid
10143 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
10144 <p>X<a rel="mw:ExtLink" href="//tools.ietf.org/html/rfc1234">foo</a></p>
10145 !! end
10146
10147 ###
10148 ### Templates
10149 ####
10150
10151 !! test
10152 Nonexistent template
10153 !! wikitext
10154 {{thistemplatedoesnotexist}}
10155 !! html
10156 <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>
10157 </p>
10158 !! end
10159
10160 !! test
10161 Template with invalid target containing tags
10162 !! wikitext
10163 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10164 !! html
10165 <p>{{a<b>b</b>|foo|a=b|a = b}}
10166 </p>
10167 !! end
10168
10169 !! test
10170 Template with invalid target containing unclosed tag
10171 !! wikitext
10172 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10173 !! html
10174 <p>{{a<b>|foo|a=b|a = b}}</b>
10175 </p>
10176 !! end
10177
10178 !! test
10179 Template with invalid target containing wikilink
10180 !! wikitext
10181 {{[[Main Page]]}}
10182 !! html/php
10183 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
10184 </p>
10185 !! html/parsoid
10186 <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>
10187 !! end
10188
10189 !! test
10190 Template with just whitespace in it, bug #68421
10191 !! wikitext
10192 {{echo|{{ }}}}
10193 !! html/parsoid
10194 <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>
10195 !! end
10196
10197 !! article
10198 Template:test
10199 !! text
10200 This is a test template
10201 !! endarticle
10202
10203 !! test
10204 Simple template
10205 !! wikitext
10206 {{test}}
10207 !! html
10208 <p>This is a test template
10209 </p>
10210 !! end
10211
10212 !! test
10213 Template with explicit namespace
10214 !! wikitext
10215 {{Template:test}}
10216 !! html
10217 <p>This is a test template
10218 </p>
10219 !! end
10220
10221
10222 !! article
10223 Template:paramtest
10224 !! text
10225 This is a test template with parameter {{{param}}}
10226 !! endarticle
10227
10228 !! test
10229 Template parameter
10230 !! wikitext
10231 {{paramtest|param=foo}}
10232 !! html
10233 <p>This is a test template with parameter foo
10234 </p>
10235 !! end
10236
10237 !! article
10238 Template:paramtestnum
10239 !! text
10240 [[{{{1}}}|{{{2}}}]]
10241 !! endarticle
10242
10243 !! test
10244 Template unnamed parameter
10245 !! wikitext
10246 {{paramtestnum|Main Page|the main page}}
10247 !! html
10248 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
10249 </p>
10250 !! end
10251
10252 !! article
10253 Template:templatesimple
10254 !! text
10255 (test)
10256 !! endarticle
10257
10258 !! article
10259 Template:templateredirect
10260 !! text
10261 #redirect [[Template:templatesimple]]
10262 !! endarticle
10263
10264 !! article
10265 Template:templateasargtestnum
10266 !! text
10267 {{{{{1}}}}}
10268 !! endarticle
10269
10270 !! article
10271 Template:templateasargtest
10272 !! text
10273 {{template{{{templ}}}}}
10274 !! endarticle
10275
10276 !! article
10277 Template:templateasargtest2
10278 !! text
10279 {{{{{templ}}}}}
10280 !! endarticle
10281
10282 !! test
10283 Template with template name as unnamed argument
10284 !! wikitext
10285 {{templateasargtestnum|templatesimple}}
10286 !! html
10287 <p>(test)
10288 </p>
10289 !! end
10290
10291 !! test
10292 Template with template name as argument
10293 !! wikitext
10294 {{templateasargtest|templ=simple}}
10295 !! html
10296 <p>(test)
10297 </p>
10298 !! end
10299
10300 !! test
10301 Template with template name as argument (2)
10302 !! wikitext
10303 {{templateasargtest2|templ=templatesimple}}
10304 !! html
10305 <p>(test)
10306 </p>
10307 !! end
10308
10309 !! article
10310 Template:templateasargtestdefault
10311 !! text
10312 {{{{{templ|templatesimple}}}}}
10313 !! endarticle
10314
10315 !! article
10316 Template:templa
10317 !! text
10318 '''templ'''
10319 !! endarticle
10320
10321 !! test
10322 Template with default value
10323 !! wikitext
10324 {{templateasargtestdefault}}
10325 !! html
10326 <p>(test)
10327 </p>
10328 !! end
10329
10330 !! test
10331 Template with default value (value set)
10332 !! wikitext
10333 {{templateasargtestdefault|templ=templa}}
10334 !! html
10335 <p><b>templ</b>
10336 </p>
10337 !! end
10338
10339 !! test
10340 Template redirect
10341 !! wikitext
10342 {{templateredirect}}
10343 !! html/php
10344 <p>(test)
10345 </p>
10346 !! html/parsoid
10347 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
10348 !! end
10349
10350 !! test
10351 Template with argument in separate line
10352 !! wikitext
10353 {{ templateasargtest |
10354 templ = simple }}
10355 !! html
10356 <p>(test)
10357 </p>
10358 !! end
10359
10360 !! test
10361 Template with complex template as argument
10362 !! wikitext
10363 {{paramtest|
10364 param ={{ templateasargtest |
10365 templ = simple }}}}
10366 !! html
10367 <p>This is a test template with parameter (test)
10368 </p>
10369 !! end
10370
10371 !! test
10372 Template with thumb image (with link in description)
10373 !! wikitext
10374 {{paramtest|param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
10375 !! html/php
10376 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>
10377
10378 !! html+tidy
10379 <p>This is a test template with parameter</p>
10380 <div class="thumb tright">
10381 <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>
10382 <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>
10383 </div>
10384 </div>
10385 !! html/parsoid
10386 <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>
10387 !! end
10388
10389 !! article
10390 Template:complextemplate
10391 !! text
10392 {{{1}}} {{paramtest|
10393 param ={{{param}}}}}
10394 !! endarticle
10395
10396 !! test
10397 Template with complex arguments
10398 !! wikitext
10399 {{complextemplate|
10400 param ={{ templateasargtest |
10401 templ = simple }}|[[Template:complextemplate|link]]}}
10402 !! html
10403 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
10404 </p>
10405 !! end
10406
10407 !! test
10408 BUG 553: link with two variables in a piped link
10409 !! wikitext
10410 {|
10411 |[[{{{1}}}|{{{2}}}]]
10412 |}
10413 !! html/php
10414 <table>
10415 <tr>
10416 <td>[[{{{1}}}|{{{2}}}]]
10417 </td></tr></table>
10418
10419 !! html/parsoid
10420 <table>
10421 <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>
10422 !! end
10423
10424 # See: T2553
10425 !! test
10426 Abort table cell attribute parsing on wikilink
10427 !! wikitext
10428 {|
10429 | testing [[one|two]] | three || four
10430 | testing one two | three || four
10431 |}
10432 !! html/php
10433 <table>
10434 <tr>
10435 <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>
10436 <td> four
10437 </td>
10438 <td> three </td>
10439 <td> four
10440 </td></tr></table>
10441
10442 !! html/parsoid
10443 <table>
10444 <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>
10445 <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>
10446 </tbody></table>
10447 !! end
10448
10449 !! test
10450 Don't abort table cell attribute parsing if wikilink is found in template arg
10451 !! wikitext
10452 {|
10453 | Test {{#tag:ref|One two "[[three]]" four}}
10454 |}
10455 !! html/parsoid
10456 <table>
10457 <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>
10458 </tbody></table>
10459 !! end
10460
10461 !! test
10462 Magic variable as template parameter
10463 !! wikitext
10464 {{paramtest|param={{SITENAME}}}}
10465 !! html
10466 <p>This is a test template with parameter MediaWiki
10467 </p>
10468 !! end
10469
10470 !! article
10471 Template:linktest
10472 !! text
10473 [[{{{param}}}|link]]
10474 !! endarticle
10475
10476 !! test
10477 Template parameter as link source
10478 !! wikitext
10479 {{linktest|param=Main Page}}
10480 !! html
10481 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
10482 </p>
10483 !! end
10484
10485 !!article
10486 Template:paramtest2
10487 !! text
10488 including another template, {{paramtest|param={{{arg}}}}}
10489 !! endarticle
10490
10491 !! test
10492 Template passing argument to another template
10493 !! wikitext
10494 {{paramtest2|arg='hmm'}}
10495 !! html
10496 <p>including another template, This is a test template with parameter 'hmm'
10497 </p>
10498 !! end
10499
10500 !! article
10501 Template:Linktest2
10502 !! text
10503 Main Page
10504 !! endarticle
10505
10506 !! test
10507 Template as link source
10508 !! wikitext
10509 [[{{linktest2}}]]
10510
10511 [[{{linktest2}}|Main Page]]
10512
10513 [[{{linktest2}}]]Page
10514 !! html
10515 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10516 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10517 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
10518 </p>
10519 !! end
10520
10521
10522 !! article
10523 Template:loop1
10524 !! text
10525 {{loop2}}
10526 !! endarticle
10527
10528 !! article
10529 Template:loop2
10530 !! text
10531 {{loop1}}
10532 !! endarticle
10533
10534 !! test
10535 Template infinite loop
10536 !! wikitext
10537 {{loop1}}
10538 !! html
10539 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
10540 </p>
10541 !! end
10542
10543 !! test
10544 Template from main namespace
10545 !! wikitext
10546 {{:Main Page}}
10547 !! html
10548 <p>blah blah
10549 </p>
10550 !! end
10551
10552 !! article
10553 Template:table
10554 !! text
10555 {|
10556 | 1 || 2
10557 |-
10558 | 3 || 4
10559 |}
10560 !! endarticle
10561
10562 !! test
10563 BUG 529: Template with table, not included at beginning of line
10564 !! wikitext
10565 foo {{table}}
10566 !! html
10567 <p>foo
10568 </p>
10569 <table>
10570 <tr>
10571 <td> 1 </td>
10572 <td> 2
10573 </td></tr>
10574 <tr>
10575 <td> 3 </td>
10576 <td> 4
10577 </td></tr></table>
10578
10579 !! end
10580
10581 !! test
10582 BUG 523: Template shouldn't eat newline (or add an extra one before table)
10583 !! wikitext
10584 foo
10585 {{table}}
10586 !! html
10587 <p>foo
10588 </p>
10589 <table>
10590 <tr>
10591 <td> 1 </td>
10592 <td> 2
10593 </td></tr>
10594 <tr>
10595 <td> 3 </td>
10596 <td> 4
10597 </td></tr></table>
10598
10599 !! end
10600
10601 !! test
10602 BUG 41: Template parameters shown as broken links
10603 !! wikitext
10604 {{{parameter}}}
10605 !! html
10606 <p>{{{parameter}}}
10607 </p>
10608 !! end
10609
10610 !! test
10611 Template with targets containing wikilinks
10612 !! wikitext
10613 {{[[foo]]}}
10614
10615 {{[[{{echo|foo}}]]}}
10616
10617 {{{{echo|[[foo}}]]}}
10618 !! html
10619 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10620 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10621 </p><p>{{[[foo}}]]
10622 </p>
10623 !! end
10624
10625 !! article
10626 Template:''
10627 !! text
10628 bar
10629 !! endarticle
10630
10631 !! test
10632 Templates: Double quotes as template target
10633 !! wikitext
10634 foo {{''}} baz
10635 !! html/php
10636 <p>foo bar baz
10637 </p>
10638 !! html/parsoid
10639 <p>foo <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"&#39;&#39;"},"params":{},"i":0}}]}'>bar</span> baz
10640 </p>
10641 !! end
10642
10643 !! article
10644 Template:MSGNW test
10645 !! text
10646 ''None'' of '''this''' should be
10647 * interpreted
10648 but rather passed unmodified
10649 {{test}}
10650 <gallery>
10651 File:Foobar.jpg
10652 </gallery>
10653 <!-- comment -->
10654 !! endarticle
10655
10656 # hmm, fix this or just deprecate msgnw and document its behavior?
10657 !! test
10658 msgnw keyword
10659 !! wikitext
10660 {{msgnw:MSGNW test}}
10661 !! html/php
10662 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
10663 &#42; interpreted
10664 &#32;but rather passed unmodified
10665 &#123;&#123;test&#125;&#125;
10666 &#60;gallery&#62;
10667 File:Foobar.jpg
10668 &#60;/gallery&#62;
10669 &#60;!-- comment --&#62;
10670 </p>
10671 !! end
10672
10673 !! test
10674 int keyword
10675 !! wikitext
10676 {{int:youhavenewmessages|lots of money|not!}}
10677 !! html
10678 <p>You have lots of money (not!).
10679 </p>
10680 !! end
10681
10682 !! test
10683 int keyword - non-existing message
10684 !! wikitext
10685 {{int:var}}
10686 !! html
10687 <p>&lt;var&gt;
10688 </p>
10689 !! end
10690
10691 !! article
10692 Template:Includes
10693 !! text
10694 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
10695 !! endarticle
10696
10697 !! test
10698 <includeonly> and <noinclude> being included
10699 !! wikitext
10700 {{Includes}}
10701 !! html
10702 <p>Foobar
10703 </p>
10704 !! end
10705
10706 !! article
10707 Template:Includes2
10708 !! text
10709 <onlyinclude>Foo</onlyinclude>bar
10710 !! endarticle
10711
10712 !! test
10713 <onlyinclude> being included
10714 !! wikitext
10715 {{Includes2}}
10716 !! html
10717 <p>Foo
10718 </p>
10719 !! end
10720
10721
10722 !! article
10723 Template:Includes3
10724 !! text
10725 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
10726 !! endarticle
10727
10728 !! test
10729 <onlyinclude> and <includeonly> being included
10730 !! wikitext
10731 {{Includes3}}
10732 !! html
10733 <p>Foo
10734 </p>
10735 !! end
10736
10737 !! test
10738 <includeonly> and <noinclude> on a page
10739 !! wikitext
10740 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
10741 !! html
10742 <p>Foozar
10743 </p>
10744 !! end
10745
10746 !! test
10747 Un-closed <noinclude>
10748 !! wikitext
10749 <noinclude>
10750 !! html
10751 !! end
10752
10753 !! test
10754 <onlyinclude> on a page
10755 !! wikitext
10756 <onlyinclude>Foo</onlyinclude>bar
10757 !! html
10758 <p>Foobar
10759 </p>
10760 !! end
10761
10762 !! test
10763 Un-closed <onlyinclude>
10764 !! wikitext
10765 <onlyinclude>
10766 !! html
10767 !! end
10768
10769 !!test
10770 Self-closed noinclude, includeonly, onlyinclude tags
10771 !! wikitext
10772 <noinclude />
10773 <includeonly />
10774 <onlyinclude />
10775 !! html
10776 <p><br />
10777 </p>
10778 !!end
10779
10780 !!test
10781 Unbalanced includeonly and noinclude tags
10782 !! wikitext
10783 {|
10784 |a</noinclude>
10785 |b</noinclude></noinclude>
10786 |c</noinclude></includeonly>
10787 |d</includeonly></includeonly>
10788 |}
10789 !! html
10790 <table>
10791 <tr>
10792 <td>a
10793 </td>
10794 <td>b
10795 </td>
10796 <td>c&lt;/includeonly&gt;
10797 </td>
10798 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
10799 </td></tr></table>
10800
10801 !!end
10802
10803 !! article
10804 Template:Includeonly section
10805 !! text
10806 <includeonly>
10807 ==Includeonly section==
10808 </includeonly>
10809 ==Section T-1==
10810 !!endarticle
10811
10812 !! test
10813 Bug 6563: Edit link generation for section shown by <includeonly>
10814 !! wikitext
10815 {{includeonly section}}
10816 !! html
10817 <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>
10818 <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>
10819
10820 !! end
10821
10822 # Uses same input as the contents of [[Template:Includeonly section]]
10823 !! test
10824 Bug 6563: Section extraction for section shown by <includeonly>
10825 !! options
10826 section=T-2
10827 !! wikitext
10828 <includeonly>
10829 ==Includeonly section==
10830 </includeonly>
10831 ==Section T-2==
10832 !! html
10833 ==Section T-2==
10834 !! end
10835
10836 !! test
10837 Bug 6563: Edit link generation for section suppressed by <includeonly>
10838 !! wikitext
10839 <includeonly>
10840 ==Includeonly section==
10841 </includeonly>
10842 ==Section 1==
10843 !! html
10844 <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>
10845
10846 !! end
10847
10848 !! test
10849 Bug 6563: Section extraction for section suppressed by <includeonly>
10850 !! options
10851 section=1
10852 !! wikitext
10853 <includeonly>
10854 ==Includeonly section==
10855 </includeonly>
10856 ==Section 1==
10857 !! html
10858 ==Section 1==
10859 !! end
10860
10861 !! test
10862 Un-closed <includeonly>
10863 !! wikitext
10864 <includeonly>
10865 !! html
10866 !! end
10867
10868 ## We used to, but no longer wt2wt this test since the default serializer
10869 ## will normalize the include directives to serialize on their own line.
10870 ## Selser will take care of preserving formatting in scenarios where they
10871 ## intermingled with other wikitext.
10872 !! test
10873 Includes and comments at SOL
10874 !! options
10875 parsoid=wt2html,html2html
10876 !! wikitext
10877 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
10878
10879 <noinclude>
10880 some
10881 </noinclude>* stuff
10882 * here
10883
10884 <includeonly>can have stuff</includeonly>=== here ===
10885
10886 !! html/php
10887 <h2><span class="mw-headline" id="hu">hu</span></h2>
10888 <p>some
10889 </p>
10890 <ul><li> stuff</li>
10891 <li> here</li></ul>
10892 <h3><span class="mw-headline" id="here">here</span></h3>
10893
10894 !! html/parsoid
10895 <!-- 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>
10896
10897 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
10898 <p>some</p>
10899 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
10900 <li> here</li></ul>
10901
10902 <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>
10903
10904 !! end
10905
10906 # TODO: test with DOM fragment reuse!
10907 !! test
10908 Parsoid: DOM fragment reuse
10909 !! options
10910 parsoid=wt2wt,wt2html
10911 !! wikitext
10912 a{{echo|b<table></table>c}}d
10913
10914 a{{echo|b
10915 <table></table>
10916 c}}d
10917
10918 {{echo|a
10919
10920 <table></table>
10921
10922 b}}
10923 !! html
10924 <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>
10925
10926 <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">
10927 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
10928 </span><p about="#mwt2">cd</p>
10929
10930 <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">
10931
10932 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
10933
10934 </span><p about="#mwt3">b</p>
10935 !! end
10936
10937 !! test
10938 Parsoid: Merge double tds (T52603)
10939 !! options
10940 parsoid
10941 !! wikitext
10942 {|
10943 |{{echo|{{!}} foo}}
10944 |}
10945 !! html
10946 <table><tbody>
10947 <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>
10948 </tbody></table>
10949 !! end
10950
10951 !! test
10952 Parsoid: Merge double tds in nested transclusion content (T52603)
10953 !! options
10954 parsoid
10955 !! wikitext
10956 {{echo|<div>}}
10957 {|
10958 |{{echo|{{!}} foo}}
10959 |}
10960 {{echo|</div>}}
10961 !! html
10962 <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}}]}'>
10963 <table><tbody>
10964 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
10965 </tbody></table>
10966 </div>
10967 !! end
10968
10969 ###
10970 ### <includeonly> and <noinclude> in attributes
10971 ###
10972 !!test
10973 0. includeonly around the entire attribute
10974 !! wikitext
10975 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
10976 !! html
10977 <p><span id="v2">bar</span>
10978 </p>
10979 !!end
10980
10981 !!test
10982 1. includeonly in html attr key
10983 !! wikitext
10984 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
10985 !! html
10986 <p><span id="foo">bar</span>
10987 </p>
10988 !!end
10989
10990 !!test
10991 2. includeonly in html attr value
10992 !! wikitext
10993 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
10994 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
10995 !! html
10996 <p><span id="v1">bar</span>
10997 <span id="v1">bar</span>
10998 </p>
10999 !!end
11000
11001 !!test
11002 3. includeonly in part of an attr value
11003 !! wikitext
11004 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
11005 !! html
11006 <p><span style="color:red;">bar</span>
11007 </p>
11008 !!end
11009
11010 !!test
11011 4. includeonly in table attributes
11012 !! wikitext
11013 {|
11014 |- <noinclude>
11015 |-
11016 |a
11017 </noinclude>
11018 |- <includeonly>
11019 |-
11020 |b
11021 </includeonly>
11022 |}
11023 !! html
11024 <table>
11025
11026
11027 <tr>
11028 <td>a
11029 </td></tr>
11030 </table>
11031
11032 !!end
11033
11034 ###
11035 ### Token Stream Patcher tests
11036 ###
11037 ### These tests won't always pass wt2wt and other modes because
11038 ### on serialization, the table will be output on a new line.
11039 ### For now, we are blacklisting them, and using this to test selser.
11040 ###
11041
11042 !!test
11043 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
11044 !!options
11045 parsoid=wt2html,wt2wt
11046 !!wikitext
11047 {{echo|}}{| width = '100%'
11048 |foo
11049 |}
11050 !!html/parsoid
11051 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
11052 <tbody><tr><td>foo</td></tr>
11053 </tbody></table>
11054 !!end
11055
11056 ## We used to, but no longer wt2wt this test since the default serializer
11057 ## will normalize the include directives to serialize on their own line.
11058 ## Selser will take care of preserving formatting in scenarios where they
11059 ## intermingled with other wikitext.
11060 !!test
11061 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
11062 !!options
11063 parsoid=wt2html
11064 !!wikitext
11065 <includeonly>a</includeonly>{| {{{b}}}
11066 |c
11067 |}
11068 !!html/parsoid
11069 <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}}}":""}}'>
11070 <tbody><tr><td>c</td></tr>
11071 </tbody></table>
11072
11073 !!end
11074
11075 ###
11076 ### Testing parsing of templates where a template arg
11077 ### has the same name as the template itself.
11078 ###
11079
11080 !! article
11081 Template:quote
11082 !! text
11083 {{{quote|{{{1}}}}}}
11084 !! endarticle
11085
11086 !!test
11087 Templates: Template Name/Arg clash: 1. Use of positional param
11088 !! wikitext
11089 {{quote|foo}}
11090 !! html
11091 <p>foo
11092 </p>
11093 !!end
11094
11095 !!test
11096 Templates: Template Name/Arg clash: 2. Use of named param
11097 !! wikitext
11098 {{quote|quote=foo}}
11099 !! html
11100 <p>foo
11101 </p>
11102 !!end
11103
11104 !!test
11105 Templates: Template Name/Arg clash: 3. Use of named param with empty input
11106 !! wikitext
11107 {{quote|quote}}
11108 !! html
11109 <p>quote
11110 </p>
11111 !!end
11112
11113 ###
11114 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
11115 ###
11116
11117 !!test
11118 Templates: 1. Simple use
11119 !! wikitext
11120 {{echo|Foo}}
11121 !! html
11122 <p>Foo
11123 </p>
11124 !!end
11125
11126 !!test
11127 Templates: 2. Inside a block tag
11128 !! wikitext
11129 <div>{{echo|Foo}}</div>
11130 <blockquote>{{echo|Foo}}</blockquote>
11131 !! html
11132 <div>Foo</div>
11133 <blockquote>Foo</blockquote>
11134
11135 !! html+tidy
11136 <div>Foo</div>
11137 <blockquote>
11138 <p>Foo</p>
11139 </blockquote>
11140 !!end
11141
11142 !!test
11143 Templates: P-wrapping: 1a. Templates on consecutive lines
11144 !! wikitext
11145 {{echo|Foo}}
11146 {{echo|bar}}
11147 !! html
11148 <p>Foo
11149 bar
11150 </p>
11151 !!end
11152
11153 !!test
11154 Templates: P-wrapping: 1b. Templates on consecutive lines
11155 !! wikitext
11156 Foo
11157
11158 {{echo|bar}}
11159 {{echo|baz}}
11160 !! html
11161 <p>Foo
11162 </p><p>bar
11163 baz
11164 </p>
11165 !!end
11166
11167 !!test
11168 Templates: P-wrapping: 1c. Templates on consecutive lines
11169 !! wikitext
11170 {{echo|Foo}}
11171 {{echo|bar}} <div>baz</div>
11172 !! html
11173 <p>Foo
11174 </p>
11175 bar <div>baz</div>
11176
11177 !! html+tidy
11178 <p>Foo</p>
11179 <p>bar</p>
11180 <div>baz</div>
11181 !! end
11182
11183 !!test
11184 Templates: P-wrapping: 1d. Template preceded by comment-only line
11185 !!options
11186 parsoid
11187 !! wikitext
11188 <!-- foo -->
11189 {{echo|Bar}}
11190 !! html
11191 <!-- foo -->
11192
11193 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
11194 !!end
11195
11196 !!test
11197 Templates: Inline Text: 1. Multiple template uses
11198 !! wikitext
11199 {{echo|Foo}}bar{{echo|baz}}
11200 !! html
11201 <p>Foobarbaz
11202 </p>
11203 !!end
11204
11205 !!test
11206 Templates: Inline Text: 2. Back-to-back template uses
11207 !! wikitext
11208 {{echo|Foo}}{{echo|bar}}
11209 !! html
11210 <p>Foobar
11211 </p>
11212 !!end
11213
11214 !!test
11215 Templates: Block Tags: 1. Multiple template uses
11216 !! wikitext
11217 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
11218 !! html
11219 <div>Foo</div><div>bar</div><div>baz</div>
11220
11221 !!end
11222
11223 !!test
11224 Templates: Block Tags: 2. Back-to-back template uses
11225 !! wikitext
11226 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
11227 !! html
11228 <div>Foo</div><div>bar</div>
11229
11230 !!end
11231
11232 # This is an edge case relating to paragraph wrapping.
11233 !!test
11234 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
11235 !! wikitext
11236 {{echo|a
11237 b</p>}}
11238 !! html/parsoid
11239 <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
11240 b</p>
11241 !!end
11242
11243 !!test
11244 Templates: Links: 1. Simple example
11245 !! wikitext
11246 {{echo|[[Foo|bar]]}}
11247 !! html
11248 <p><a href="/wiki/Foo" title="Foo">bar</a>
11249 </p>
11250 !!end
11251
11252 !!test
11253 Templates: Links: 2. Generation of link href
11254 !! wikitext
11255 [[{{echo|Foo}}|bar]]
11256 !! html
11257 <p><a href="/wiki/Foo" title="Foo">bar</a>
11258 </p>
11259 !!end
11260
11261 !!test
11262 Templates: Links: 3. Generation of part of a link href
11263 !! wikitext
11264 [[Fo{{echo|o}}|bar]]
11265
11266 [[Foo{{echo|bar}}]]
11267
11268 [[Foo{{echo|bar}}baz]]
11269
11270 [[Foo{{echo|bar}}|bar]]
11271
11272 [[:Foo{{echo|bar}}]]
11273
11274 [[:Foo{{echo|bar}}|bar]]
11275 !! html
11276 <p><a href="/wiki/Foo" title="Foo">bar</a>
11277 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11278 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
11279 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11280 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11281 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11282 </p>
11283 !!end
11284
11285 !!test
11286 Templates: Links: 4. Multiple templates generating link href
11287 !! wikitext
11288 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
11289 !! html
11290 <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>
11292 !!end
11293
11294 !!test
11295 Templates: Links: 5. Generation of link text
11296 !! wikitext
11297 [[Foo|{{echo|bar}}]]
11298 !! html
11299 <p><a href="/wiki/Foo" title="Foo">bar</a>
11300 </p>
11301 !!end
11302
11303 !!test
11304 Templates: Links: 5. Nested templates (only outermost template should be marked)
11305 !! wikitext
11306 {{echo|[[{{echo|Foo}}|bar]]}}
11307 !! html
11308 <p><a href="/wiki/Foo" title="Foo">bar</a>
11309 </p>
11310 !!end
11311
11312 !!test
11313 Templates: HTML Tag: 1. Generation of HTML attr. key
11314 !! wikitext
11315 <div {{echo|style}}="color:red;">foo</div>
11316 !! html
11317 <div style="color:red;">foo</div>
11318
11319 !!end
11320
11321 !!test
11322 Templates: HTML Tag: 2. Generation of HTML attr. value
11323 !! wikitext
11324 <div style={{echo|'color:red;'}}>foo</div>
11325 !! html
11326 <div style="color:red;">foo</div>
11327
11328 !!end
11329
11330 !!test
11331 Templates: HTML Tag: 3. Generation of HTML attr key and value
11332 !! wikitext
11333 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
11334 !! html
11335 <div style="color:red;">foo</div>
11336
11337 !!end
11338
11339 !!test
11340 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
11341 !! wikitext
11342 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
11343 !! html
11344 <div title="This is a long title with just one piece templated">foo</div>
11345
11346 !!end
11347
11348 !!test
11349 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
11350 !! wikitext
11351 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
11352 !! html
11353 <div title="This is a long title with just one piece templated">foo</div>
11354
11355 !!end
11356
11357 !!test
11358 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
11359 !! wikitext
11360 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
11361 !! html
11362 <div title="This is a long title with just one piece templated">foo</div>
11363
11364 !!end
11365
11366 # SSS FIXME: While it is great we added support for all this,
11367 # do we want to make this part of the spec? Maybe we want to
11368 # deprecate this kind of usage in the future?
11369 !!test
11370 Templates: HTML Tag: 7. Generation of partial attribute key string
11371 !! wikitext
11372 <div st{{echo|yle}}="color:red;">foo</div>
11373 !! html
11374 <div style="color:red;">foo</div>
11375
11376 !!end
11377
11378 !! test
11379 Templates: HTML Tag: 8. Template-generated attribute (k=v)
11380 !! wikitext
11381 <div {{echo|1=id="v1"}}>bar</div>
11382 !! html
11383 <div id="v1">bar</div>
11384
11385 !!end
11386
11387 !! test
11388 Templates: HTML Tag: 9. Multiple template-generated attributes
11389 !! wikitext
11390 <div {{echo|1=id="v1" title="foo"}}>bar</div>
11391 !! html
11392 <div id="v1" title="foo">bar</div>
11393
11394 !!end
11395
11396 !! test
11397 Templates: Support for templates generating attributes and content
11398 !! wikitext
11399 {| {{mixed_attr_content_template}}
11400 |-
11401 |bar
11402 |}
11403 !! html/php
11404 <table style="color:red;" title="T48811">
11405
11406 <tr>
11407 <td>foo
11408 </td></tr>
11409 <tr>
11410 <td>bar
11411 </td></tr></table>
11412
11413 !! html/parsoid
11414 <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|}"]}'>
11415 <tbody><tr>
11416 <td>foo</td></tr>
11417 <tr>
11418 <td>bar</td></tr>
11419 </tbody></table>
11420 !!end
11421
11422 !! test
11423 1. Entities and nowikis inside templated attributes should be handled correctly
11424 !! wikitext
11425 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
11426 !! html/php
11427 <div style="background:#f9f9f9;">foo</div>
11428
11429 !! html/parsoid
11430 <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>
11431 !! end
11432
11433 !! test
11434 2. Entities and nowikis inside templated attributes should be handled correctly
11435 !! wikitext
11436 {|
11437 |{{table_attribs_3}}
11438 |}
11439 !! html/php
11440 <table>
11441 <tr>
11442 <td style="background:#f9f9f9;">Foo
11443 </td></tr></table>
11444
11445 !! html/parsoid
11446 <table>
11447 <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>
11448 </tbody></table>
11449 !! end
11450
11451 !! test
11452 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11453 !! wikitext
11454 {{tbl-start}}
11455 |{{table_attribs_3}}
11456 {{tbl-end}}
11457 !! html/php
11458 <table>
11459 <tr>
11460 <td style="background:#f9f9f9;">Foo
11461 </td></tr></table>
11462
11463 !! html/parsoid
11464 <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}}]}'>
11465 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
11466 </tbody></table>
11467 !! end
11468
11469 # T107622
11470 !! test
11471 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11472 !! wikitext
11473 {|
11474 | {{table_attribs_6}} hi
11475 |}
11476 !! html/php
11477 <table>
11478 <tr>
11479 <td style="background: red;"> hi
11480 </td></tr></table>
11481
11482 !! html/parsoid
11483 <table>
11484 <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>
11485 </tbody></table>
11486 !! end
11487
11488 !!test
11489 Templates: HTML Tables: 1. Generating start of a HTML table
11490 !! wikitext
11491 {{echo|<table><tr><td>foo</td>}}</tr></table>
11492 !! html
11493 <table><tr><td>foo</td></tr></table>
11494
11495 !!end
11496
11497 !!test
11498 Templates: HTML Tables: 2a. Generating middle of a HTML table
11499 !! wikitext
11500 <table><tr>{{echo|<td>foo</td>}}</tr></table>
11501 !! html
11502 <table><tr><td>foo</td></tr></table>
11503
11504 !!end
11505
11506 !!test
11507 Templates: HTML Tables: 2b. Generating middle of a HTML table
11508 !! wikitext
11509 <table>{{echo|<tr><td>foo</td></tr>}}</table>
11510 !! html
11511 <table><tr><td>foo</td></tr></table>
11512
11513 !!end
11514
11515 !!test
11516 Templates: HTML Tables: 3. Generating end of a HTML table
11517 !! wikitext
11518 <table><tr>{{echo|<td>foo</td></tr></table>}}
11519 !! html
11520 <table><tr><td>foo</td></tr></table>
11521
11522 !!end
11523
11524 !!test
11525 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
11526 !! wikitext
11527 {{echo|<table>}}<tr><td>foo</td></tr></table>
11528 !! html
11529 <table><tr><td>foo</td></tr></table>
11530
11531 !!end
11532
11533 !!test
11534 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
11535 !! wikitext
11536 <table>{{echo|<tr>}}<td>foo</td></tr></table>
11537 !! html
11538 <table><tr><td>foo</td></tr></table>
11539
11540 !!end
11541
11542 !!test
11543 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
11544 !! wikitext
11545 <table><tr>{{echo|<td>}}foo</td></tr></table>
11546 !! html
11547 <table><tr><td>foo</td></tr></table>
11548
11549 !!end
11550
11551 !!test
11552 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
11553 !! wikitext
11554 <table><tr><td>foo{{echo|</td>}}</tr></table>
11555 !! html
11556 <table><tr><td>foo</td></tr></table>
11557
11558 !!end
11559
11560 !!test
11561 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
11562 !! wikitext
11563 <table><tr><td>foo</td>{{echo|</tr>}}</table>
11564 !! html
11565 <table><tr><td>foo</td></tr></table>
11566
11567 !!end
11568
11569 !!test
11570 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
11571 !! wikitext
11572 <table><tr><td>foo</td></tr>{{echo|</table>}}
11573 !! html
11574 <table><tr><td>foo</td></tr></table>
11575
11576 !!end
11577
11578 !!test
11579 Templates: HTML Tables: 5. Proper fostering of categories from inside
11580 !!options
11581 parsoid=wt2html,wt2wt
11582 !! wikitext
11583 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
11584 <!--Two categories (Bug 50330)-->
11585 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
11586 !! html
11587 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
11588 <!--Two categories (Bug 50330)-->
11589 <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>
11590 !!end
11591
11592 !!test
11593 Templates: Wiki Tables: 1a. Fostering of entire template content
11594 !! wikitext
11595 {|
11596 {{echo|a}}
11597 |}
11598 !! html
11599 <table>
11600 a
11601 <tr><td></td></tr></table>
11602
11603 !! html+tidy
11604 <p>a</p>
11605 <table>
11606 <tr>
11607 <td></td>
11608 </tr>
11609 </table>
11610 !! end
11611
11612 !!test
11613 Templates: Wiki Tables: 1b. Fostering of entire template content
11614 !! wikitext
11615 {|
11616 {{echo|<div>}}
11617 foo
11618 {{echo|</div>}}
11619 |}
11620 !! html
11621 <table>
11622 <div>
11623 <p>foo
11624 </p>
11625 </div>
11626 <tr><td></td></tr></table>
11627
11628 !! html+tidy
11629 <div>
11630 <p>foo</p>
11631 </div>
11632 <table>
11633 <tr>
11634 <td></td>
11635 </tr>
11636 </table>
11637 !! end
11638
11639 !!test
11640 Templates: Wiki Tables: 2. Fostering of partial template content
11641 !! wikitext
11642 {|
11643 {{echo|a
11644 <div>b</div>}}
11645 |}
11646 !! html
11647 <table>
11648 a
11649 <div>b</div>
11650 <tr><td></td></tr></table>
11651
11652 !! html+tidy
11653 <p>a</p>
11654 <div>b</div>
11655 <table>
11656 <tr>
11657 <td></td>
11658 </tr>
11659 </table>
11660 !! end
11661
11662 !!test
11663 Templates: Wiki Tables: 3. td-content via multiple templates
11664 !! wikitext
11665 {|
11666 {{echo|{{pipe}}a}}{{echo|b}}
11667 |}
11668 !! html
11669 <table>
11670 <tr>
11671 <td>ab
11672 </td></tr></table>
11673
11674 !!end
11675
11676 !!test
11677 Templates: Wiki Tables: 4. Templated tags, no content
11678 !! wikitext
11679 {{tbl-start}}
11680 {{tbl-end}}
11681 !! html
11682 <table>
11683 <tr><td></td></tr></table>
11684
11685 !!end
11686
11687 !!test
11688 Templates: Wiki Tables: 5. Templated tags, regular td-tags
11689 !! wikitext
11690 {{tbl-start}}
11691 |foo
11692 {{tbl-end}}
11693 !! html
11694 <table>
11695 <tr>
11696 <td>foo
11697 </td></tr></table>
11698
11699 !!end
11700
11701 !!test
11702 Templates: Wiki Tables: 6. Templated tags, templated td-tags
11703 !! wikitext
11704 {{tbl-start}}
11705 {{!}}foo
11706 {{tbl-end}}
11707 !! html
11708 <table>
11709 <tr>
11710 <td>foo
11711 </td></tr></table>
11712
11713 !!end
11714
11715 ## This test case is very specific to Parsoid's internals
11716 ## and is hence only tested for Parsoid's code. Parsoid uses
11717 ## a <meta> marker tag for <ref> tags and they are expanded
11718 ## much later. We are verifying that this <meta> tag usage
11719 ## doesn't prevent foster parenting.
11720 !!test
11721 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
11722 !!wikitext
11723 {{PartialTable}}<ref>foo</ref>
11724 |}
11725
11726 <references />
11727 !!html/parsoid
11728 <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">
11729 <tbody>
11730 </tbody></table>
11731
11732 <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>
11733 !!end
11734
11735 !! test
11736 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
11737 !! wikitext
11738 {{echo|
11739 {{{!}}
11740 {{!}}-}}
11741 <onlyinclude>
11742 |foo
11743 </onlyinclude>
11744 {{!}}}
11745 !! html/parsoid
11746 <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{{!}}}"]}'>
11747 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
11748 <tbody><tr>
11749
11750 <td>foo
11751 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
11752 </tbody></table>
11753 !! end
11754
11755 !!test
11756 Templates: Lists: Multi-line list-items via templates
11757 !! wikitext
11758 *{{echo|a {{nonexistent|
11759 unused}}}}
11760 *{{echo|b {{nonexistent|
11761 unused}}}}
11762 !! html
11763 <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>
11764 <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>
11765
11766 !!end
11767
11768 !!test
11769 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
11770 !! wikitext
11771 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
11772 !! html
11773 <p><i>ab</i>c<i>d</i>e
11774 </p>
11775 !!end
11776
11777 !!test
11778 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
11779 (PHP parser generates misnested html)
11780 !! wikitext
11781 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
11782 !! html/parsoid
11783 <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>
11784 !!end
11785
11786 !!test
11787 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
11788 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
11789 !! options
11790 parsoid=wt2html,wt2wt
11791 !! wikitext
11792 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
11793 !! html
11794 <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>
11795 <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>
11796 <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>
11797 !!end
11798
11799 !!test
11800 Templates: Ugly nesting: 4. Divs opened/closed across templates
11801 !! wikitext
11802 a<div>b{{echo|c</div>d}}e
11803 !! html
11804 a<div>bc</div>de
11805
11806 !! html+tidy
11807 <p>a</p>
11808 <div>bc</div>
11809 <p>de</p>
11810 !! end
11811
11812 !!test
11813 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
11814 (Parsoid-centric)
11815 !! options
11816 parsoid
11817 !! wikitext
11818 {|
11819 |{{echo|foo</table>}}
11820 |bar
11821 |}
11822 !! html
11823 <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|}"]}'>
11824
11825 <tbody>
11826 <tr>
11827 <td>foo</td></tr></tbody></table><span about="#mwt1">
11828 </span><span about="#mwt1">|bar</span><span about="#mwt1">
11829 |}</span>
11830 !!end
11831
11832 !!test
11833 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
11834 (Parsoid-centric)
11835 !! options
11836 parsoid
11837 !! wikitext
11838 <table>
11839 <tr>
11840 <td>
11841 <table>
11842 <tr>
11843 <td>1. {{echo|foo </table>}}</td>
11844 <td> bar </td>
11845 <td>2. {{echo|baz </table>}}</td>
11846 </tr>
11847 <tr>
11848 <td>abc</td>
11849 </tr>
11850 </table>
11851 </td>
11852 </tr>
11853 <tr>
11854 <td>xyz</td>
11855 </tr>
11856 </table>
11857 !! html
11858 <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>"]}'>
11859 <tbody><tr>
11860 <td>
11861 <table>
11862 <tbody><tr>
11863 <td>1. foo </td></tr></tbody></table></td>
11864 <td> bar </td>
11865 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
11866 </span><span about="#mwt2">
11867 </span><span about="#mwt2">
11868 </span><span about="#mwt2">abc</span><span about="#mwt2">
11869 </span><span about="#mwt2">
11870 </span><span about="#mwt2">
11871 </span><span about="#mwt2">
11872 </span><span about="#mwt2">
11873 </span><span about="#mwt2">
11874 </span><span about="#mwt2">xyz</span><span about="#mwt2">
11875 </span><span about="#mwt2">
11876 </span>
11877 !!end
11878
11879 !! test
11880 Templates: Ugly templates: 3. newline-only template parameter
11881 !! wikitext
11882 foo {{echo|
11883 }}
11884 !! html
11885 <p>foo
11886 </p>
11887 !! end
11888
11889 # This looks like a bug: a single newline triggers p/br for some reason.
11890 !! test
11891 Templates: Ugly templates: 4. newline-only template parameter inconsistency
11892 !! wikitext
11893 {{echo|
11894 }}
11895 !! html
11896 <p><br />
11897 </p>
11898 !! end
11899
11900 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
11901 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
11902 !! test
11903 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
11904 !! wikitext
11905 {{echo|<table>}}
11906 {{echo|<div>foo}}
11907 {{echo|</table>}}
11908 !! html/parsoid
11909 <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
11910 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
11911 </table>
11912 !! end
11913
11914 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
11915 # that are "identical" and generate nesting cycles in the algorithm
11916 !! test
11917 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
11918 !! wikitext
11919 {{echo|<table><tr><td><table>}}
11920 {{echo|<div>}}
11921 {{echo|</div>}}
11922 !! html/parsoid
11923 <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"}'>
11924 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
11925 </table></td></tr></tbody></table>
11926 !! end
11927
11928 !! test
11929 Templates: Parameters substituted at the top-level
11930 !! wikitext
11931 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
11932 !! html/php
11933 <p><i>who</i> me? <b>never!</b>
11934 </p>
11935 !! html/parsoid
11936 <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>
11937 !! end
11938
11939 !!test
11940 Parser Functions: 1. Simple example
11941 !! wikitext
11942 {{uc:foo}}
11943 !! html
11944 <p>FOO
11945 </p>
11946 !!end
11947
11948 !!test
11949 Parser Functions: 2. Nested use (only outermost should be marked up)
11950 !! wikitext
11951 {{uc:{{lc:FOO}}}}
11952 !! html
11953 <p>FOO
11954 </p>
11955 !!end
11956
11957 ###
11958 ### Pre-save transform tests
11959 ###
11960 !! test
11961 pre-save transform: subst:
11962 !! options
11963 pst
11964 !! wikitext
11965 {{subst:test}}
11966 !! html/php
11967 This is a test template
11968 !! end
11969
11970 !! test
11971 pre-save transform: normal template
11972 !! options
11973 pst
11974 !! wikitext
11975 {{test}}
11976 !! html/php
11977 {{test}}
11978 !! end
11979
11980 !! test
11981 pre-save transform: nonexistent template
11982 !! options
11983 pst
11984 !! wikitext
11985 {{thistemplatedoesnotexist}}
11986 !! html/php
11987 {{thistemplatedoesnotexist}}
11988 !! end
11989
11990 !! test
11991 pre-save transform: subst magic variables
11992 !! options
11993 pst
11994 !! wikitext
11995 {{subst:SITENAME}}
11996 !! html/php
11997 MediaWiki
11998 !! end
11999
12000 # This is bug 89, which I fixed. -- wtm
12001 !! test
12002 pre-save transform: subst: templates with parameters
12003 !! options
12004 pst
12005 !! wikitext
12006 {{subst:paramtest|param="something else"}}
12007 !! html/php
12008 This is a test template with parameter "something else"
12009 !! end
12010
12011 !! article
12012 Template:nowikitest
12013 !! text
12014 <nowiki>'''not wiki'''</nowiki>
12015 !! endarticle
12016
12017 !! test
12018 pre-save transform: nowiki in subst (bug 1188)
12019 !! options
12020 pst
12021 !! wikitext
12022 {{subst:nowikitest}}
12023 !! html/php
12024 <nowiki>'''not wiki'''</nowiki>
12025 !! end
12026
12027 !! article
12028 Template:commenttest
12029 !! text
12030 This template has <!-- a comment --> in it.
12031 !! endarticle
12032
12033 !! test
12034 pre-save transform: comment in subst (bug 1936)
12035 !! options
12036 pst
12037 !! wikitext
12038 {{subst:commenttest}}
12039 !! html/php
12040 This template has <!-- a comment --> in it.
12041 !! end
12042
12043 !! test
12044 pre-save transform: unclosed tag
12045 !! options
12046 pst noxml
12047 !! wikitext
12048 <nowiki>'''not wiki'''
12049 !! html/php
12050 <nowiki>'''not wiki'''
12051 !! end
12052
12053 !! test
12054 pre-save transform: mixed tag case
12055 !! options
12056 pst noxml
12057 !! wikitext
12058 <NOwiki>'''not wiki'''</noWIKI>
12059 !! html/php
12060 <NOwiki>'''not wiki'''</noWIKI>
12061 !! end
12062
12063 !! test
12064 pre-save transform: unclosed comment in <nowiki>
12065 !! options
12066 pst noxml
12067 !! wikitext
12068 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12069 !! html/php
12070 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12071 !!end
12072
12073 # Leading @ in this template definition works around a limitation
12074 # in parsoid's parserTests which otherwise strips the <span> from the
12075 # result (confusing it for a template wrapper)
12076 !! article
12077 Template:dangerous
12078 !!text
12079 @<span onmouseover="alert('crap')">Oh no</span>
12080 !!endarticle
12081
12082 !!test
12083 (confirming safety of fix for subst bug 1936)
12084 !! wikitext
12085 {{Template:dangerous}}
12086 !! html
12087 <p>@<span>Oh no</span>
12088 </p>
12089 !! end
12090
12091 !! test
12092 pre-save transform: comment containing gallery (bug 5024)
12093 !! options
12094 pst
12095 !! wikitext
12096 <!-- <gallery>data</gallery> -->
12097 !! html/php
12098 <!-- <gallery>data</gallery> -->
12099 !!end
12100
12101 !! test
12102 pre-save transform: comment containing extension
12103 !! options
12104 pst
12105 !! wikitext
12106 <!-- <tag>data</tag> -->
12107 !! html/php
12108 <!-- <tag>data</tag> -->
12109 !!end
12110
12111 !! test
12112 pre-save transform: comment containing nowiki
12113 !! options
12114 pst
12115 !! wikitext
12116 <!-- <nowiki>data</nowiki> -->
12117 !! html/php
12118 <!-- <nowiki>data</nowiki> -->
12119 !!end
12120
12121 !! test
12122 pre-save transform: <noinclude> in subst (bug 3298)
12123 !! options
12124 pst
12125 !! wikitext
12126 {{subst:Includes}}
12127 !! html/php
12128 Foobar
12129 !! end
12130
12131 !! test
12132 pre-save transform: <onlyinclude> in subst (bug 3298)
12133 !! options
12134 pst
12135 !! wikitext
12136 {{subst:Includes2}}
12137 !! html/php
12138 Foo
12139 !! end
12140
12141 !! article
12142 Template:SubstTest
12143 !!text
12144 {{<includeonly>subst:</includeonly>Includes}}
12145 !! endarticle
12146
12147 !! article
12148 Template:SafeSubstTest
12149 !! text
12150 {{<includeonly>safesubst:</includeonly>Includes}}
12151 !! endarticle
12152
12153 !! test
12154 bug 22297: safesubst: works during PST
12155 !! options
12156 pst
12157 !! wikitext
12158 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
12159 !! html/php
12160 FoobarFoobar
12161 !! end
12162
12163 !! test
12164 bug 22297: safesubst: works during normal parse
12165 !! wikitext
12166 {{SafeSubstTest}}
12167 !! html
12168 <p>Foobar
12169 </p>
12170 !! end
12171
12172 !! test
12173 subst: does not work during normal parse
12174 !! wikitext
12175 {{SubstTest}}
12176 !! html
12177 <p>{{subst:Includes}}
12178 </p>
12179 !! end
12180
12181 !! test
12182 pre-save transform: context links ("pipe trick")
12183 !! options
12184 pst
12185 !! wikitext
12186 [[Article (context)|]]
12187 [[Bar:Article|]]
12188 [[:Bar:Article|]]
12189 [[Bar:Article (context)|]]
12190 [[:Bar:Article (context)|]]
12191 [[|Article]]
12192 [[|Article (context)]]
12193 [[Bar:X (Y) Z|]]
12194 [[:Bar:X (Y) Z|]]
12195 !! html/php
12196 [[Article (context)|Article]]
12197 [[Bar:Article|Article]]
12198 [[:Bar:Article|Article]]
12199 [[Bar:Article (context)|Article]]
12200 [[:Bar:Article (context)|Article]]
12201 [[Article]]
12202 [[Article (context)]]
12203 [[Bar:X (Y) Z|X (Y) Z]]
12204 [[:Bar:X (Y) Z|X (Y) Z]]
12205 !! end
12206
12207 !! test
12208 pre-save transform: context links ("pipe trick") with interwiki prefix
12209 !! options
12210 pst
12211 !! wikitext
12212 [[interwiki:Article|]]
12213 [[:interwiki:Article|]]
12214 [[interwiki:Bar:Article|]]
12215 [[:interwiki:Bar:Article|]]
12216 !! html/php
12217 [[interwiki:Article|Article]]
12218 [[:interwiki:Article|Article]]
12219 [[interwiki:Bar:Article|Bar:Article]]
12220 [[:interwiki:Bar:Article|Bar:Article]]
12221 !! end
12222
12223 !! test
12224 pre-save transform: context links ("pipe trick") with parens in title
12225 !! options
12226 pst title=[[Somearticle (context)]]
12227 !! wikitext
12228 [[|Article]]
12229 !! html/php
12230 [[Article (context)|Article]]
12231 !! end
12232
12233 !! test
12234 pre-save transform: context links ("pipe trick") with comma in title
12235 !! options
12236 pst title=[[Someplace, Somewhere]]
12237 !! wikitext
12238 [[|Otherplace]]
12239 [[Otherplace, Elsewhere|]]
12240 [[Otherplace, Elsewhere, Anywhere|]]
12241 !! html/php
12242 [[Otherplace, Somewhere|Otherplace]]
12243 [[Otherplace, Elsewhere|Otherplace]]
12244 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
12245 !! end
12246
12247 !! test
12248 pre-save transform: context links ("pipe trick") with parens and comma
12249 !! options
12250 pst title=[[Someplace (IGNORED), Somewhere]]
12251 !! wikitext
12252 [[|Otherplace]]
12253 [[Otherplace (place), Elsewhere|]]
12254 !! html/php
12255 [[Otherplace, Somewhere|Otherplace]]
12256 [[Otherplace (place), Elsewhere|Otherplace]]
12257 !! end
12258
12259 !! test
12260 pre-save transform: context links ("pipe trick") with comma and parens
12261 !! options
12262 pst title=[[Who, me? (context)]]
12263 !! wikitext
12264 [[|Yes, you.]]
12265 [[Me, Myself, and I (1937 song)|]]
12266 !! html/php
12267 [[Yes, you. (context)|Yes, you.]]
12268 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
12269 !! end
12270
12271 !! test
12272 pre-save transform: context links ("pipe trick") with namespace
12273 !! options
12274 pst title=[[Ns:Somearticle]]
12275 !! wikitext
12276 [[|Article]]
12277 !! html/php
12278 [[Ns:Article|Article]]
12279 !! end
12280
12281 !! test
12282 pre-save transform: context links ("pipe trick") with namespace and parens
12283 !! options
12284 pst title=[[Ns:Somearticle (context)]]
12285 !! wikitext
12286 [[|Article]]
12287 !! html/php
12288 [[Ns:Article (context)|Article]]
12289 !! end
12290
12291 !! test
12292 pre-save transform: context links ("pipe trick") with namespace and comma
12293 !! options
12294 pst title=[[Ns:Somearticle, Context, Whatever]]
12295 !! wikitext
12296 [[|Article]]
12297 !! html/php
12298 [[Ns:Article, Context, Whatever|Article]]
12299 !! end
12300
12301 !! test
12302 pre-save transform: context links ("pipe trick") with namespace, comma and parens
12303 !! options
12304 pst title=[[Ns:Somearticle, Context (context)]]
12305 !! wikitext
12306 [[|Article]]
12307 !! html/php
12308 [[Ns:Article (context)|Article]]
12309 !! end
12310
12311 !! test
12312 pre-save transform: context links ("pipe trick") with namespace, parens and comma
12313 !! options
12314 pst title=[[Ns:Somearticle (IGNORED), Context]]
12315 !! wikitext
12316 [[|Article]]
12317 !! html/php
12318 [[Ns:Article, Context|Article]]
12319 !! end
12320
12321 !! test
12322 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
12323 !! options
12324 pst
12325 !! wikitext
12326 [[Article(context)|]]
12327 [[Bar:Article(context)|]]
12328 [[:Bar:Article(context)|]]
12329 [[|Article(context)]]
12330 [[Bar:X(Y)Z|]]
12331 [[:Bar:X(Y)Z|]]
12332 !! html/php
12333 [[Article(context)|Article]]
12334 [[Bar:Article(context)|Article]]
12335 [[:Bar:Article(context)|Article]]
12336 [[Article(context)]]
12337 [[Bar:X(Y)Z|X(Y)Z]]
12338 [[:Bar:X(Y)Z|X(Y)Z]]
12339 !! end
12340
12341 !! test
12342 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
12343 !! options
12344 pst
12345 !! wikitext
12346 [[Article (context)|]]
12347 [[Bar:Article (context)|]]
12348 [[:Bar:Article (context)|]]
12349 [[|Article (context)]]
12350 [[Bar:X (Y) Z|]]
12351 [[:Bar:X (Y) Z|]]
12352 !! html/php
12353 [[Article (context)|Article]]
12354 [[Bar:Article (context)|Article]]
12355 [[:Bar:Article (context)|Article]]
12356 [[Article (context)]]
12357 [[Bar:X (Y) Z|X (Y) Z]]
12358 [[:Bar:X (Y) Z|X (Y) Z]]
12359 !! end
12360
12361 !! test
12362 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
12363 !! options
12364 pst
12365 !! wikitext
12366 [[Article(context)|]]
12367 [[Bar:Article(context)|]]
12368 [[:Bar:Article(context)|]]
12369 [[|Article(context)]]
12370 [[Bar:X(Y)Z|]]
12371 [[:Bar:X(Y)Z|]]
12372 !! html/php
12373 [[Article(context)|Article]]
12374 [[Bar:Article(context)|Article]]
12375 [[:Bar:Article(context)|Article]]
12376 [[Article(context)]]
12377 [[Bar:X(Y)Z|X(Y)Z]]
12378 [[:Bar:X(Y)Z|X(Y)Z]]
12379 !! end
12380
12381 !! test
12382 pre-save transform: context links ("pipe trick") with commas (bug 21660)
12383 !! options
12384 pst
12385 !! wikitext
12386 [[Article (context), context|]]
12387 [[Article (context),context|]]
12388 [[Bar:Article (context), context|]]
12389 [[Bar:Article (context),context|]]
12390 [[:Bar:Article (context), context|]]
12391 [[:Bar:Article (context),context|]]
12392 !! html/php
12393 [[Article (context), context|Article]]
12394 [[Article (context),context|Article]]
12395 [[Bar:Article (context), context|Article]]
12396 [[Bar:Article (context),context|Article]]
12397 [[:Bar:Article (context), context|Article]]
12398 [[:Bar:Article (context),context|Article]]
12399 !! end
12400
12401 !! test
12402 pre-save transform: trim trailing empty lines
12403 !! options
12404 pst
12405 !! wikitext
12406 Empty lines are trimmed
12407
12408
12409
12410
12411 !! html/php
12412 Empty lines are trimmed
12413 !! end
12414
12415 !! test
12416 pre-save transform: Signature expansion
12417 !! options
12418 pst
12419 !! wikitext
12420 * ~~~
12421 * <noinclude>~~~</noinclude>
12422 * <includeonly>~~~</includeonly>
12423 * <onlyinclude>~~~</onlyinclude>
12424 !! html/php
12425 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
12426 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
12427 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
12428 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
12429 !! end
12430
12431
12432 !! test
12433 pre-save transform: Signature expansion in nowiki tags (bug 93)
12434 !! options
12435 pst disabled
12436 !! wikitext
12437 Shall not expand:
12438
12439 <nowiki>~~~~</nowiki>
12440
12441 <includeonly><nowiki>~~~~</nowiki></includeonly>
12442
12443 <noinclude><nowiki>~~~~</nowiki></noinclude>
12444
12445 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12446
12447 {{subst:Foo}} shall be converted to FOO
12448
12449 As well as inside noinclude/onlyinclude
12450 <noinclude>{{subst:Foo}}</noinclude>
12451 <onlyinclude>{{subst:Foo}}</onlyinclude>
12452
12453 But not inside includeonly
12454 <includeonly>{{subst:Foo}}</includeonly>
12455 !! html/php
12456 Shall not expand:
12457
12458 <nowiki>~~~~</nowiki>
12459
12460 <includeonly><nowiki>~~~~</nowiki></includeonly>
12461
12462 <noinclude><nowiki>~~~~</nowiki></noinclude>
12463
12464 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12465
12466 FOO shall be converted to FOO
12467
12468 As well as inside noinclude/onlyinclude
12469 <noinclude>FOO</noinclude>
12470 <onlyinclude>FOO</onlyinclude>
12471
12472 But not inside includeonly
12473 <includeonly>{{subst:Foo}}</includeonly>
12474 !! end
12475
12476 !! test
12477 Parsoid: Recognize nowiki with trailing space in tags
12478 !! options
12479 parsoid=wt2html
12480 !! wikitext
12481 <nowiki ><div>[[foo]]</nowiki >
12482
12483 a<nowiki / >b
12484
12485 c<nowiki />d
12486
12487 e<nowiki/ >f
12488 !! html
12489 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12490 <p>ab</p>
12491 <p>cd</p>
12492 <p>ef</p>
12493 !! end
12494
12495 !! test
12496 Parsoid: Recognize nowiki with odd capitalization
12497 !! options
12498 parsoid=wt2html
12499 !! wikitext
12500 <noWikI ><div>[[foo]]</Nowiki >
12501 !! html
12502 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12503 !! end
12504
12505
12506 !! test
12507 Parsoid: Escape nowiki with trailing space in tags
12508 !! options
12509 parsoid=html2wt
12510 !! html/parsoid
12511 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
12512 <p>a&lt;nowiki /&gt;b</p>
12513 <p>c&lt;nowiki/ &gt;d</p>
12514 !! wikitext
12515 &lt;nowiki &gt; foo &lt;/nowiki &gt;
12516
12517 a&lt;nowiki /&gt;b
12518
12519 c&lt;nowiki/ &gt;d
12520 !! end
12521
12522 !! test
12523 Parsoid: Escape weird noWikI capitalizations
12524 !! options
12525 parsoid=html2wt
12526 !! html/parsoid
12527 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
12528 !! wikitext
12529 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
12530 !! end
12531
12532 ###
12533 ### Message transform tests
12534 ###
12535 !! test
12536 message transform: magic variables
12537 !! options
12538 msg
12539 !! wikitext
12540 {{SITENAME}}
12541 !! html
12542 MediaWiki
12543 !! end
12544
12545 !! test
12546 message transform: should not transform wiki markup
12547 !! options
12548 msg
12549 !! wikitext
12550 ''test''
12551 !! html
12552 ''test''
12553 !! end
12554
12555 !! test
12556 message transform: <noinclude> in transcluded template (bug 4926)
12557 !! options
12558 msg
12559 !! wikitext
12560 {{Includes}}
12561 !! html
12562 Foobar
12563 !! end
12564
12565 !! test
12566 message transform: <onlyinclude> in transcluded template (bug 4926)
12567 !! options
12568 msg
12569 !! wikitext
12570 {{Includes2}}
12571 !! html
12572 Foo
12573 !! end
12574
12575 !! test
12576 {{#special:}} page name, known
12577 !! options
12578 msg
12579 !! wikitext
12580 {{#special:Recentchanges}}
12581 !! html
12582 Special:RecentChanges
12583 !! end
12584
12585 !! test
12586 {{#special:}} page name with subpage, known
12587 !! options
12588 msg
12589 !! wikitext
12590 {{#special:Recentchanges/param}}
12591 !! html
12592 Special:RecentChanges/param
12593 !! end
12594
12595 !! test
12596 {{#special:}} page name, unknown
12597 !! options
12598 msg
12599 !! wikitext
12600 {{#special:foobar nonexistent}}
12601 !! html
12602 Special:Foobar nonexistent
12603 !! end
12604
12605 !! test
12606 {{#speciale:}} page name, known
12607 !! options
12608 msg
12609 !! wikitext
12610 {{#speciale:Recentchanges}}
12611 !! html
12612 Special:RecentChanges
12613 !! end
12614
12615 !! test
12616 {{#speciale:}} page name with subpage, known
12617 !! options
12618 msg
12619 !! wikitext
12620 {{#speciale:Recentchanges/param}}
12621 !! html
12622 Special:RecentChanges/param
12623 !! end
12624
12625 !! test
12626 {{#speciale:}} page name, unknown
12627 !! options
12628 msg
12629 !! wikitext
12630 {{#speciale:foobar nonexistent}}
12631 !! html
12632 Special:Foobar_nonexistent
12633 !! end
12634
12635 ###
12636 ### Images
12637 ###
12638 ### For Parsoid-specific tests, see
12639 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
12640
12641 !! test
12642 Simple image
12643 !! options
12644 parsoid=wt2html,wt2wt,html2html
12645 !! wikitext
12646 [[Image:foobar.jpg]]
12647 !! html/php
12648 <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>
12649 </p>
12650 !! html/parsoid
12651 <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>
12652 !! end
12653
12654 !! test
12655 Simple image (using File: namespace, now canonical)
12656 !! wikitext
12657 [[File:Foobar.jpg]]
12658 !! html/php
12659 <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>
12660 </p>
12661 !! html/parsoid
12662 <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>
12663 !! end
12664
12665 !! test
12666 Right-aligned image
12667 !! wikitext
12668 [[File:Foobar.jpg|right]]
12669 !! html/php
12670 <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>
12671
12672 !! html/parsoid
12673 <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>
12674 !! end
12675
12676 !! test
12677 Image with caption
12678 !! wikitext
12679 [[File:Foobar.jpg|right|Caption text]]
12680 !! html/php
12681 <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>
12682
12683 !! html/parsoid
12684 <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>
12685 !! end
12686
12687 !! test
12688 Image with caption, bug 53312 #1
12689 !! wikitext
12690 [[File:Foobar.jpg|right|Caption page stuff]]
12691 !! html/php
12692 <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>
12693
12694 !! html/parsoid
12695 <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>
12696 !! end
12697
12698 !! test
12699 Image with caption, bug 53312 #2
12700 !! wikitext
12701 [[File:Foobar.jpg|right|Caption page=]]
12702 !! html/php
12703 <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>
12704
12705 !! html/parsoid
12706 <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>
12707 !! end
12708
12709 !! test
12710 Image with caption, bug 53312 #3
12711 !! wikitext
12712 [[File:Foobar.jpg|right|Caption page=stuff]]
12713 !! html/php
12714 <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>
12715
12716 !! html/parsoid
12717 <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>
12718 !! end
12719
12720 !! test
12721 Allow empty links in image captions (Bug 60753)
12722 !! options
12723 thumbsize=220
12724 !! wikitext
12725 [[File:Foobar.jpg|thumb|Caption [[Link1]]
12726 [[]]
12727 [[Link2]]
12728 ]]
12729 !! html/php
12730 <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>
12731
12732 !! html/parsoid
12733 <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>
12734 [[]]
12735 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
12736 </figcaption></figure>
12737 !! end
12738
12739 !! test
12740 Titles in unlinked images (T23454)
12741 !! wikitext
12742 [[File:Foobar.jpg|link=|stuff]]
12743 !! html/php
12744 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
12745 </p>
12746 !! end
12747
12748 !! test
12749 Link with empty target
12750 !! wikitext
12751 [[]]
12752 !! html
12753 <p>[[]]
12754 </p>
12755 !! end
12756
12757 !! test
12758 Image with link trail
12759 !! wikitext
12760 Linktrails should not work for images: [[File:Foobar.jpg]]s
12761 !! html/php
12762 <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
12763 </p>
12764 !! html/parsoid
12765 <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>
12766 !! end
12767
12768 !! test
12769 Image with empty attribute
12770 !! options
12771 parsoid=wt2html,wt2wt,html2html
12772 !! wikitext
12773 [[File:Foobar.jpg|right||Caption text]]
12774 !! html/php
12775 <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>
12776
12777 !! html/parsoid
12778 <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>
12779 !! end
12780
12781 !! test
12782 1. Block image with individual attributes from templates
12783 !! wikitext
12784 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
12785 !! html/php
12786 <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>
12787
12788 !! html/parsoid
12789 <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>
12790 !! end
12791
12792 !! test
12793 2. Block Image with individual attributes from templates
12794 !! wikitext
12795 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
12796 !! html/php
12797 <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>
12798
12799 !! html/parsoid
12800 <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>
12801 !! end
12802
12803 !! test
12804 3. Inline image with individual attributes from templates
12805 !! wikitext
12806 [[File:Foobar.jpg|{{echo|50px}}]]
12807 !! html/php
12808 <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>
12809 </p>
12810 !! html/parsoid
12811 <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>
12812 !! end
12813
12814 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
12815 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
12816 !! test
12817 Image with multiple attributes from the same template
12818 !! wikitext
12819 [[File:Foobar.jpg|{{image_attribs}}]]
12820 !! html/php
12821 <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>
12822
12823 !! html/parsoid
12824 <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>
12825 !! end
12826
12827 !! test
12828 Image with link tails
12829 !! options
12830 thumbsize=220
12831 !! wikitext
12832 123[[File:Foobar.jpg]]456
12833 123[[File:Foobar.jpg|right]]456
12834 123[[File:Foobar.jpg|thumb]]456
12835 !! html/php
12836 <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
12837 </p>
12838 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
12839 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
12840
12841 !! html/php+tidy
12842 <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>
12843 <p>123</p>
12844 <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>
12845 <p>456 123</p>
12846 <div class="thumb tright">
12847 <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>
12848 <div class="thumbcaption">
12849 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
12850 </div>
12851 </div>
12852 </div>
12853 <p>456</p>
12854 !! html/parsoid
12855 <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>
12856 <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>
12857 <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>
12858 !! end
12859
12860 !! test
12861 Image with multiple captions -- only last one is accepted
12862 !! wikitext
12863 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
12864 !! html/php
12865 <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>
12866
12867 !! html/parsoid
12868 <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>
12869 !! end
12870
12871 !! test
12872 Image with multiple widths -- use last
12873 !! wikitext
12874 [[File:Foobar.jpg|200px|300px|caption]]
12875 !! html/php
12876 <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>
12877 </p>
12878 !! html/parsoid
12879 <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>
12880 !! end
12881
12882 !! test
12883 Image with multiple alignments -- use first (bug 48664)
12884 !! options
12885 thumbsize=220
12886 !! wikitext
12887 [[File:Foobar.jpg|thumb|left|right|center|caption]]
12888
12889 [[File:Foobar.jpg|middle|text-top|caption]]
12890 !! html/php
12891 <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>
12892 <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>
12893 </p>
12894 !! html/parsoid
12895 <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>
12896 <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>
12897 !! end
12898
12899 !! test
12900 Image with width attribute at different positions
12901 !! wikitext
12902 [[File:Foobar.jpg|200px|right|Caption]]
12903 [[File:Foobar.jpg|right|200px|Caption]]
12904 [[File:Foobar.jpg|right|Caption|200px]]
12905 !! html/php
12906 <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>
12907 <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>
12908 <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>
12909
12910 !! html/parsoid
12911 <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>
12912 <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>
12913 <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>
12914 !! end
12915
12916 # a sad bit of backward-compatibility
12917 !! test
12918 Image with size specified with pxpx (bug 13500, 51628)
12919 !! options
12920 parsoid=wt2html,wt2wt,html2html
12921 !! wikitext
12922 [[File:Foobar.jpg|20pxpx]]
12923 [[File:Foobar.jpg|200x20pxpx]]
12924 !! html/php
12925 <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>
12926 <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>
12927 </p>
12928 !! html/parsoid
12929 <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>
12930 !! end
12931
12932 !! test
12933 Image with link parameter, wiki target
12934 !! wikitext
12935 [[File:Foobar.jpg|link=Main Page]]
12936 !! html/php
12937 <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>
12938 </p>
12939 !! html/parsoid
12940 <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>
12941 !! end
12942
12943 # parsoid bug 49293 (part 1)
12944 !! test
12945 Image with link parameter, URL target
12946 !! wikitext
12947 [[File:Foobar.jpg|link=http://example.com/]]
12948 !! html/php
12949 <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>
12950 </p>
12951 !! html/parsoid
12952 <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>
12953 !! end
12954
12955 # parsoid bug 49293 (part 2)
12956 !! test
12957 Image with link parameter, protocol-less URL target
12958 !! wikitext
12959 [[File:Foobar.jpg|link=//example.com/]]
12960 !! html/php
12961 <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>
12962 </p>
12963 !! html/parsoid
12964 <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>
12965 !! end
12966
12967 !! test
12968 Escaping non-block captions (T107435)
12969 !! options
12970 parsoid={
12971 "modes": ["wt2wt"],
12972 "changes": [
12973 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
12974 ]
12975 }
12976 !! wikitext
12977 [[Image:Foobar.jpg|caption]]
12978 !! wikitext/edited
12979 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
12980 !! end
12981
12982 # wgExternalLinkTarget not supported by Parsoid
12983 !! test
12984 Image with link parameter, wgExternalLinkTarget
12985 !! wikitext
12986 [[Image:foobar.jpg|link=http://example.com/]]
12987 !! config
12988 wgExternalLinkTarget='foobar'
12989 !! html/php
12990 <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>
12991 </p>
12992 !! end
12993
12994 !! test
12995 Image with link parameter, wgNoFollowLinks set to false
12996 !! wikitext
12997 [[Image:foobar.jpg|link=http://example.com/]]
12998 !! config
12999 wgNoFollowLinks=false
13000 !! html
13001 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13002 </p>
13003 !! end
13004
13005 !! test
13006 Image with link parameter, wgNoFollowDomainExceptions
13007 !! wikitext
13008 [[Image:foobar.jpg|link=http://example.com/]]
13009 !! config
13010 wgNoFollowDomainExceptions='example.com'
13011 !! html
13012 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13013 </p>
13014 !! end
13015
13016 # wgExternalLinkTarget not supported by Parsoid
13017 !! test
13018 Image with link parameter, wgExternalLinkTarget, unnamed parameter
13019 !! wikitext
13020 [[Image:foobar.jpg|link=http://example.com/|Title]]
13021 !! config
13022 wgExternalLinkTarget='foobar'
13023 !! html/php
13024 <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>
13025 </p>
13026 !! end
13027
13028 !! test
13029 Image with empty link parameter
13030 !! wikitext
13031 [[File:Foobar.jpg|link=]]
13032 !! html/php
13033 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
13034 </p>
13035 !! html/parsoid
13036 <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>
13037 !! end
13038
13039 !! test
13040 Image with link parameter (wiki target) and unnamed parameter
13041 !! wikitext
13042 [[File:Foobar.jpg|link=Main_Page|Title]]
13043 !! html/php
13044 <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>
13045 </p>
13046 !! html/parsoid
13047 <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>
13048 !! end
13049
13050 !! test
13051 Image with link parameter (URL target) and unnamed parameter
13052 !! wikitext
13053 [[File:Foobar.jpg|link=http://example.com/|Title]]
13054 !! html/php
13055 <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>
13056 </p>
13057 !! html/parsoid
13058 <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>
13059 !! end
13060
13061 !! test
13062 Thumbnail image with link parameter
13063 !! options
13064 thumbsize=220
13065 parsoid=wt2html,wt2wt,html2html
13066 !! wikitext
13067 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
13068 !! html/php
13069 <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>
13070
13071 !! html/parsoid
13072 <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>
13073 !! end
13074
13075 !! test
13076 Manually-specified thumbnail image
13077 !! options
13078 thumbsize=220
13079 !! wikitext
13080 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
13081 !! html/php
13082 <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>
13083
13084 !! html/parsoid
13085 <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>
13086 !! end
13087
13088 !! test
13089 Manually-specified thumbnail image with explicit link to wiki page
13090 !! options
13091 thumbsize=220
13092 parsoid=wt2html,wt2wt,html2html
13093 !! wikitext
13094 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
13095 !! html/php
13096 <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>
13097
13098 !! html/parsoid
13099 <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>
13100 !! end
13101
13102 !! test
13103 Manually-specified thumbnail image with explicit link to url
13104 !! options
13105 thumbsize=220
13106 parsoid=wt2html,wt2wt,html2html
13107 !! wikitext
13108 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
13109 !! html/php
13110 <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>
13111
13112 !! html/parsoid
13113 <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>
13114 !! end
13115
13116 !! test
13117 Manually-specified thumbnail image with explicit no link
13118 !! options
13119 thumbsize=220
13120 parsoid=wt2html,wt2wt,html2html
13121 !! wikitext
13122 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
13123 !! html/php
13124 <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>
13125
13126 !! html/parsoid
13127 <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>
13128 !! end
13129
13130 !! test
13131 Manually-specified thumbnail image with explicit link and alt text
13132 !! options
13133 thumbsize=220
13134 parsoid=wt2html,wt2wt,html2html
13135 !! wikitext
13136 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
13137 !! html/php
13138 <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>
13139
13140 !! html/parsoid
13141 <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>
13142 !! end
13143
13144 !! test
13145 Image with frame and link
13146 !! options
13147 parsoid=wt2html,wt2wt,html2html
13148 !! wikitext
13149 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
13150 !! html/php
13151 <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>
13152
13153 !! html/parsoid
13154 <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>
13155 !! end
13156
13157 !! test
13158 Image with frame and link and explicit alt
13159 !! options
13160 parsoid=wt2html,wt2wt,html2html
13161 !! wikitext
13162 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
13163 !! html/php
13164 <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>
13165
13166 !! html/parsoid
13167 <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>
13168 !! end
13169
13170 !! test
13171 Image with wiki markup in implicit alt
13172 !! wikitext
13173 [[Image:Foobar.jpg|testing '''bold''' in alt]]
13174
13175 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
13176 !! html/php
13177 <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>
13178 </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>
13179 </p>
13180 !! html/parsoid
13181 <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>
13182 <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>
13183 !! end
13184
13185 !! test
13186 Alt image option should handle most kinds of wikitext without barfing
13187 !! wikitext
13188 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
13189 !! html/php
13190 <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>
13191
13192 !! html/parsoid
13193 <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>
13194 !! end
13195
13196 ###################
13197 # Conflicting image format options.
13198 # First option specified should 'win'.
13199 # All three cases in each test should be identical.
13200
13201 !! test
13202 Image with 'frameless' first.
13203 !! options
13204 parsoid=wt2html,wt2wt,html2html
13205 !! wikitext
13206 [[File:Foobar.jpg|frameless|caption]]
13207
13208 [[File:Foobar.jpg|frameless|frame|caption]]
13209
13210 [[File:Foobar.jpg|frameless|thumb|caption]]
13211 !! html/php
13212 <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>
13213 </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>
13214 </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>
13215 </p>
13216 !! html/parsoid
13217 <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>
13218 <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>
13219 <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>
13220 !! end
13221
13222 !! test
13223 Image with 'frame' first.
13224 !! options
13225 parsoid=wt2html,wt2wt,html2html
13226 !! wikitext
13227 [[File:Foobar.jpg|frame|caption]]
13228 [[File:Foobar.jpg|frame|frameless|caption]]
13229 [[File:Foobar.jpg|frame|thumb|caption]]
13230 !! html/php
13231 <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>
13232 <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>
13233 <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>
13234
13235 !! html/parsoid
13236 <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>
13237 <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>
13238 <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>
13239 !! end
13240
13241 !! test
13242 Image with 'thumb' first.
13243 !! options
13244 parsoid=wt2html,wt2wt,html2html
13245 !! wikitext
13246 [[File:Foobar.jpg|thumb|caption]]
13247 [[File:Foobar.jpg|thumb|frameless|caption]]
13248 [[File:Foobar.jpg|thumb|frame|caption]]
13249 !! html/php
13250 <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>
13251 <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>
13252 <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>
13253
13254 !! html/parsoid
13255 <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>
13256 <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>
13257 <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>
13258 !! end
13259
13260 ###################
13261 # Image sizing.
13262 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
13263 # and https://phabricator.wikimedia.org/T64258
13264 # Foobar has actual size of 1941x220
13265 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
13266 # a scalable format.
13267 # 2. Framed images always ignore size options; always render at default size.
13268 # 3. "Unspecified format" and border are the only types which can be
13269 # enlarged.
13270
13271 !! test
13272 Image: "unspecified format" and border enlarge
13273 !! options
13274 parsoid=wt2html,wt2wt,html2html
13275 !! wikitext
13276 [[File:Foobar.jpg|2000px]]
13277
13278 [[File:Foobar.jpg|border|2000px]]
13279 !! html/php
13280 <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>
13281 </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>
13282 </p>
13283 !! html/parsoid
13284 <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>
13285 <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>
13286 !! end
13287
13288 !! test
13289 Image: "unspecified format" and border reduce
13290 !! options
13291 parsoid=wt2html,wt2wt,html2html
13292 !! wikitext
13293 [[File:Foobar.jpg|1000px]]
13294
13295 [[File:Foobar.jpg|border|1000px]]
13296 !! html/php
13297 <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>
13298 </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>
13299 </p>
13300 !! html/parsoid
13301 <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>
13302 <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>
13303 !! end
13304
13305 !! test
13306 Image: thumbs reduce
13307 !! options
13308 parsoid=wt2html,wt2wt,html2html
13309 !! wikitext
13310 [[File:Foobar.jpg|thumb|50px]]
13311 !! html/php
13312 <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>
13313
13314 !! html/parsoid
13315 <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>
13316 !! end
13317
13318 !! test
13319 Image: bitmap thumbs can't be enlarged past original size, but vector can.
13320 !! options
13321 parsoid=wt2html,wt2wt,html2html
13322 !! wikitext
13323 [[File:Foobar.jpg|thumb|2000px]]
13324
13325 [[File:Foobar.svg|thumb|2000px]]
13326 !! html/php
13327 <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>
13328 <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>
13329
13330 !! html/parsoid
13331 <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>
13332 <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>
13333 !! end
13334
13335 !! test
13336 Image: frameless can reduce in size
13337 !! options
13338 parsoid=wt2html,wt2wt,html2html
13339 !! wikitext
13340 [[File:Foobar.jpg|frameless|50px]]
13341 !! html/php
13342 <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>
13343 </p>
13344 !! html/parsoid
13345 <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>
13346 !! end
13347
13348 !! test
13349 Image: bitmap frameless can't be enlarged past original size, but vector can
13350 !! options
13351 parsoid=wt2html,wt2wt,html2html
13352 !! wikitext
13353 [[File:Foobar.jpg|frameless|2000px]]
13354
13355 [[File:Foobar.svg|frameless|2000px]]
13356 !! html/php
13357 <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>
13358 </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>
13359 </p>
13360 !! html/parsoid
13361 <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>
13362 <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>
13363 !! end
13364
13365 !! test
13366 Image: framed images are always unscaled.
13367 !! options
13368 parsoid=wt2html,wt2wt,html2html
13369 !! wikitext
13370 [[File:Foobar.jpg|frame]]
13371
13372 [[File:Foobar.jpg|frame|50px]]
13373
13374 [[File:Foobar.jpg|frame|50x50px]]
13375
13376 [[File:Foobar.jpg|frame|2000px]]
13377 !! html/php
13378 <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>
13379 <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>
13380 <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>
13381 <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>
13382
13383 !! html/parsoid
13384 <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>
13385 <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>
13386 <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>
13387 <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>
13388 !! end
13389
13390 ###################
13391
13392 !! test
13393 Link to image page- image page normally doesn't exists, hence edit link
13394 Add test with existing image page
13395 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
13396 !! wikitext
13397 [[:Image:test]]
13398 !! html
13399 <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>
13400 </p>
13401 !! end
13402
13403 !! test
13404 bug 18784 Link to non-existent image page with caption should use caption as link text
13405 !! wikitext
13406 [[:Image:test|caption]]
13407 !! html
13408 <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>
13409 </p>
13410 !! end
13411
13412 !! test
13413 Frameless image caption with a free URL
13414 !! wikitext
13415 [[File:Foobar.jpg|http://example.com]]
13416 !! html/php
13417 <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>
13418 </p>
13419 !! html/parsoid
13420 <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>
13421 !! end
13422
13423 !! test
13424 Thumbnail image caption with a free URL
13425 !! options
13426 thumbsize=220
13427 !! wikitext
13428 [[File:Foobar.jpg|thumb|http://example.com]]
13429 !! html/php
13430 <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>
13431
13432 !! html/parsoid
13433 <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>
13434 !! end
13435
13436 !! test
13437 Thumbnail image caption with a free URL and explicit alt
13438 !! options
13439 thumbsize=220
13440 parsoid=wt2html,wt2wt,html2html
13441 !! wikitext
13442 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
13443 !! html/php
13444 <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>
13445
13446 !! html/parsoid
13447 <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>
13448 !! end
13449
13450 !! test
13451 SVG thumbnails with no language set
13452 !! options
13453 !! wikitext
13454 [[File:Foobar.svg|thumb|caption]]
13455 !! html/php
13456 <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>
13457
13458 !! html/parsoid
13459 <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>
13460 !! end
13461
13462 !! test
13463 SVG thumbnails with language de
13464 !! options
13465 parsoid=wt2html,wt2wt,html2html
13466 !! wikitext
13467 [[File:Foobar.svg|thumb|caption|lang=de]]
13468 !! html/php
13469 <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>
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" lang="de" 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 invalid language code
13477 !! options
13478 parsoid=wt2html,wt2wt,html2html
13479 !! wikitext
13480 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
13481 !! html/php
13482 <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>
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/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>
13486 !! end
13487
13488 !! test
13489 BUG 1887: A ISBN with a thumbnail
13490 !! wikitext
13491 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
13492 !! html/php
13493 <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>
13494
13495 !! html/parsoid
13496 <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>
13497 !! end
13498
13499 !! test
13500 BUG 1887: A RFC with a thumbnail
13501 !! wikitext
13502 [[File:Foobar.jpg|thumb|This is RFC 12354]]
13503 !! html/php
13504 <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>
13505
13506 !! html/parsoid
13507 <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>
13508 !! end
13509
13510 !! test
13511 BUG 1887: A mailto link with a thumbnail
13512 !! wikitext
13513 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
13514 !! html/php
13515 <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>
13516
13517 !! html/parsoid
13518 <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>
13519 !! end
13520
13521 # Pending resolution to bug 368
13522 !! test
13523 BUG 648: Frameless image caption with a link
13524 !! wikitext
13525 [[File:Foobar.jpg|text with a [[link]] in it]]
13526 !! html/php
13527 <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>
13528 </p>
13529 !! html/parsoid
13530 <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>
13531 !! end
13532
13533 !! test
13534 BUG 648: Frameless image caption with a link (suffix)
13535 !! wikitext
13536 [[File:Foobar.jpg|text with a [[link]]foo in it]]
13537 !! html/php
13538 <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>
13539 </p>
13540 !! html/parsoid
13541 <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>
13542 !! end
13543
13544 !! test
13545 BUG 648: Frameless image caption with an interwiki link
13546 !! wikitext
13547 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
13548 !! html/php
13549 <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>
13550 </p>
13551 !! html/parsoid
13552 <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>
13553 !! end
13554
13555 !! test
13556 BUG 648: Frameless image caption with a piped interwiki link
13557 !! wikitext
13558 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
13559 !! html/php
13560 <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>
13561 </p>
13562 !! html/parsoid
13563 <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>
13564 !! end
13565
13566 !! test
13567 T107474: Frameless image caption with <nowiki>
13568 !! wikitext
13569 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
13570 !! html/parsoid
13571 <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>
13572 !! end
13573
13574 !! test
13575 Escape HTML special chars in image alt text
13576 !! wikitext
13577 [[File:Foobar.jpg|& < > "]]
13578 !! html/php
13579 <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>
13580 </p>
13581 !! html/parsoid
13582 <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>
13583 !! end
13584
13585 !! test
13586 BUG 499: Alt text should have &#1234;, not &amp;1234;
13587 !! wikitext
13588 [[File:Foobar.jpg|&#9792;]]
13589 !! html/php
13590 <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>
13591 </p>
13592 !! html/parsoid
13593 <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>
13594 !! end
13595
13596 !! test
13597 Broken image caption with link
13598 !! options
13599 parsoid=wt2html,wt2wt,html2html
13600 !! wikitext
13601 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
13602 !! html/php
13603 <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.
13604 </p>
13605 !! html/parsoid
13606 <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>
13607 !! end
13608
13609 !! test
13610 Image caption containing another image
13611 !! wikitext
13612 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
13613 !! html/php
13614 <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>
13615
13616 !! html/parsoid
13617 <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>
13618 !! end
13619
13620 !! test
13621 Image: caption containing a newline
13622 !! wikitext
13623 [[File:Foobar.jpg|This
13624 *is some text]]
13625 !! html/php
13626 <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>
13627 </p>
13628 !! html/parsoid
13629 <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>
13630 !!end
13631
13632 !!test
13633 Image: caption containing leading space
13634 (The leading space should not trigger nowiki escaping in wt2wt mode)
13635 !! wikitext
13636 [[File:Foobar.jpg|thumb| bar]]
13637 !! html/php
13638 <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>
13639
13640 !! html/parsoid
13641 <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>
13642 !!end
13643
13644 !! test
13645 Image: caption containing a table
13646 !! options
13647 parsoid=wt2html,wt2wt,html2html
13648 !! wikitext
13649 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
13650 {|
13651 ! Foo !! Bar
13652 |-
13653 | Foo1 || Bar1
13654 |}
13655 and some more text.]]
13656 !! html/php
13657 <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>
13658
13659 !! html/parsoid
13660 <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
13661 <table>
13662 <tbody>
13663 <tr><th>Foo </th><th>Bar</th></tr>
13664 <tr>
13665 <td>Foo1 </td>
13666 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
13667 !! end
13668
13669 !! test
13670 Bug 3090: External links other than http: in image captions
13671 !! wikitext
13672 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
13673 !! html/php
13674 <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>
13675
13676 !! html/parsoid
13677 <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>
13678 !! end
13679
13680 !! test
13681 Custom class
13682 !! options
13683 parsoid=wt2html,wt2wt,html2html
13684 !! wikitext
13685 [[Image:foobar.jpg|a|class=b]]
13686 !! html/php
13687 <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>
13688 </p>
13689 !! html/parsoid
13690 <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>
13691 !! end
13692
13693 !! test
13694 Localized image handling (1).
13695 !! options
13696 parsoid=wt2html,wt2wt,html2html
13697 language=es
13698 !! wikitext
13699 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
13700 !! html/php
13701 <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>
13702
13703 !! html/parsoid
13704 <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>
13705 !! end
13706
13707 !! test
13708 Localized image handling (2).
13709 !! options
13710 thumbsize=220
13711 parsoid=wt2html,wt2wt,html2html
13712 language=es
13713 !! wikitext
13714 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
13715 !! html/php
13716 <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>
13717
13718 !! html/parsoid
13719 <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>
13720 !! end
13721
13722 !! test
13723 "border", "frameless" and "class" attributes on an image.
13724 !! options
13725 thumbsize=220
13726 parsoid=wt2html,wt2wt,html2html
13727 !! wikitext
13728 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
13729 !! html/php
13730 <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>
13731 </p>
13732 !! html/parsoid
13733 <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>
13734 !! end
13735
13736 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
13737 !! test
13738 Invalid image attributes (bug 62500)
13739 !! options
13740 thumbsize=220
13741 parsoid=wt2html,wt2wt,html2html
13742 !! wikitext
13743 [[File:Foobar.jpg|thumb|float|left|caption]]
13744
13745 [[File:Foobar.jpg|thumb|righ|caption]]
13746
13747 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
13748 !! html/php
13749 <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>
13750 <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>
13751 <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>
13752
13753 !! html/parsoid
13754 <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>
13755 <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>
13756 <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>
13757 !! end
13758
13759 !! article
13760 File:Barfoo.jpg
13761 !! text
13762 #REDIRECT [[File:Barfoo.jpg]]
13763 !! endarticle
13764
13765 # FIXME: Parsoid should run this test -- but we'd need to teach the
13766 # mockAPI about the redirected Barfoo.jpg image.
13767 !! test
13768 Redirected image
13769 !! wikitext
13770 [[Image:Barfoo.jpg]]
13771 !! html/php
13772 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
13773 </p>
13774 !! end
13775
13776 !! test
13777 Missing image with uploads disabled
13778 !! options
13779 wgEnableUploads=0
13780 !! wikitext
13781 [[File:Foobaz.jpg]]
13782 !! html/php
13783 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
13784 </p>
13785 !! html/parsoid
13786 <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>
13787 !! end
13788
13789 # Parsoid-specific testing for images
13790 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
13791 # Currently imperfect due to a flaw in the Parsoid testrunner
13792 # Work in progress
13793 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
13794 # image tests.
13795
13796 !! test
13797 Parsoid-specific image handling - simple image with size and middle alignment
13798 !! wikitext
13799 [[File:Foobar.jpg|middle|50px]]
13800 !! html/parsoid
13801 <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>
13802 !! end
13803
13804 !! test
13805 Parsoid-specific image handling - simple image with size, middle alignment,
13806 non-standard namespace alias
13807 !! options
13808 parsoid=wt2wt,wt2html,html2html
13809 !! wikitext
13810 [[Image:Foobar.jpg|middle|50px]]
13811 !! html/parsoid
13812 <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>
13813 !! end
13814
13815 !! test
13816 Parsoid-specific image handling - simple image with size and middle alignment
13817 (existing content)
13818 !! wikitext
13819 [[File:Foobar.jpg|50px|middle]]
13820 !! html/parsoid
13821 <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>
13822 !! end
13823
13824 !! test
13825 Parsoid-specific image handling - simple image with size and middle alignment
13826 and non-standard namespace name
13827 !! options
13828 parsoid=wt2html,wt2wt,html2html
13829 !! wikitext
13830 [[Image:Foobar.jpg|50px|middle]]
13831 !! html/parsoid
13832 <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>
13833 !! end
13834
13835 !! test
13836 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
13837 !! wikitext
13838 [[File:Foobar.jpg|500x10px|baseline|caption]]
13839 !! html/parsoid
13840 <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>
13841 !! end
13842
13843 !! test
13844 Parsoid-specific image handling - simple image with border and size spec
13845 !! wikitext
13846 [[File:Foobar.jpg|50px|border|caption]]
13847 !! html/parsoid
13848 <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>
13849 !! end
13850
13851 !! test
13852 Parsoid-specific image handling - thumbnail with halign, valign, and caption
13853 !! wikitext
13854 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
13855 !! html/parsoid
13856 <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>
13857 !! end
13858
13859 !! test
13860 Parsoid-specific image handling - thumbnail with halign, valign, and caption
13861 (existing content)
13862 !! wikitext
13863 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
13864 !! html/parsoid
13865 <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>
13866 !! end
13867
13868 !! test
13869 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
13870 !! wikitext
13871 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
13872 !! html/parsoid
13873 <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>
13874 !! end
13875
13876 !! test
13877 Parsoid-specific image handling - thumbnail with specific size, halign,
13878 valign, and caption (existing content)
13879 !! wikitext
13880 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
13881 !! html/parsoid
13882 <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>
13883 !! end
13884
13885 !! test
13886 Parsoid-specific image handling - framed image with specific size and caption
13887 (size is ignored)
13888 !! options
13889 parsoid=wt2html,wt2wt,html2html
13890 !! wikitext
13891 [[File:Foobar.jpg|frame|500x50px|caption]]
13892 !! html/parsoid
13893 <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>
13894 !! end
13895
13896 !! test
13897 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
13898 (size is ignored)
13899 !! options
13900 parsoid=wt2html,wt2wt,html2html
13901 !! wikitext
13902 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
13903 !! html/parsoid
13904 <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>
13905 !! end
13906
13907 !! test
13908 Parsoid-specific image handling - frameless image with specific size, border, and caption
13909 !! wikitext
13910 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
13911 !! html/parsoid
13912 <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>
13913 !! end
13914
13915 !! test
13916 Parsoid-specific image handling - simple image with a formatted caption
13917 !! wikitext
13918 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
13919 !! html/parsoid
13920 <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>
13921 !! end
13922
13923 !! test
13924 Parsoid-specific image handling - caption with a template in it
13925 !! wikitext
13926 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
13927 !! html/parsoid
13928 <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>
13929 !! end
13930
13931 !! test
13932 Parsoid-specific image handling - caption with unbalanced tags in it
13933 !! options
13934 parsoid=wt2html,wt2wt,html2html
13935 !! wikitext
13936 foo
13937 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
13938 bar
13939 !! html/parsoid
13940 <p>foo</p>
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 <center>unbalanced tag in it.</center></figcaption></figure>
13942 <p>bar</p>
13943 !! end
13944
13945 !! test
13946 Parsoid-specific image handling - empty caption (1)
13947 !! options
13948 parsoid=wt2html,wt2wt
13949 !! wikitext
13950 [[File:Foobar.jpg|thumb|]]
13951 !! html/parsoid
13952 <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>
13953 !! end
13954
13955 # empty captions don't get serialized unless we're in the "round trip" case
13956 !! test
13957 Parsoid-specific image handling - empty caption (2)
13958 !! options
13959 parsoid=html2wt
13960 !! html/parsoid
13961 <figure class="mw-default-size" typeof="mw:Image/Thumb">
13962 <a href="./File:Foobar.jpg">
13963 <img resource="./File:Foobar.jpg"
13964 src="//example.com/images/3/3a/Foobar.jpg"
13965 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
13966 height="25" width="220"/>
13967 </a>
13968 <figcaption></figcaption>
13969 </figure>
13970 !! wikitext
13971 [[File:Foobar.jpg|thumb]]
13972 !! end
13973
13974 !! test
13975 Parsoid-specific image handling - whitespace caption
13976 !! wikitext
13977 [[File:Foobar.jpg|thumb| ]]
13978 !! html/parsoid
13979 <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>
13980 !! end
13981
13982 !! test
13983 Parsoid-specific image handling - lang option
13984 !! wikitext
13985 foo
13986 [[File:Foobar.svg|lang=de|caption]]
13987 bar
13988 !! html/parsoid
13989 <p>foo
13990 <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>
13991 bar</p>
13992 !! end
13993
13994 ## Edge case bugs in Parsoid from T93580
13995 !! test
13996 T93580: 1. Templated <ref> inside block images
13997 !! wikitext
13998 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
13999
14000 <references />
14001 !! html/parsoid
14002 <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>
14003
14004 <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>
14005 !! end
14006
14007 !! test
14008 T93580: 2. <ref> inside inline images
14009 !! wikitext
14010 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
14011
14012 <references />
14013 !! html/parsoid
14014 <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>
14015
14016 <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>
14017 !! end
14018
14019 !! test
14020 T93580: 3. Templated <ref> inside inline images
14021 !! wikitext
14022 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
14023
14024 <references />
14025 !! html/parsoid
14026 <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>
14027
14028 <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>
14029 !! end
14030
14031 ###
14032 ### Subpages
14033 ###
14034 !! article
14035 Subpage test/subpage
14036 !! text
14037 foo
14038 !! endarticle
14039
14040 !! test
14041 Subpage link
14042 !! options
14043 subpage title=[[Subpage test]]
14044 !! wikitext
14045 [[/subpage]]
14046 !! html
14047 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
14048 </p>
14049 !! end
14050
14051 !! test
14052 Subpage noslash link
14053 !! options
14054 subpage title=[[Subpage test]]
14055 !! wikitext
14056 [[/subpage/]]
14057 !! html
14058 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
14059 </p>
14060 !! end
14061
14062 !! article
14063 Subpage test/1/2/subpage
14064 !! text
14065 blah
14066 !! endarticle
14067
14068 !! test
14069 Relative subpage noslash link
14070 !! options
14071 parsoid=wt2wt,wt2html,html2html
14072 subpage title=[[Subpage test/1/2/3/4]]
14073 !! wikitext
14074 [[../../subpage/]]
14075
14076 [[../../subpage]]
14077 !! html/php
14078 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
14079 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
14080 </p>
14081 !! html/parsoid
14082 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
14083 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
14084 !! end
14085
14086 !! test
14087 Parsoid: dot-slash prefixed wikilinks
14088 !! wikitext
14089 [[./foo]]
14090
14091 [[././bar]]
14092
14093 [[././baz/]]
14094 !! html/php
14095 <p>[[./foo]]
14096 </p><p>[[././bar]]
14097 </p><p>[[././baz/]]
14098 </p>
14099 !! html/parsoid
14100 <p>[[./foo]]
14101 </p><p>[[././bar]]
14102 </p><p>[[././baz/]]
14103 </p>
14104 !! end
14105
14106 !! test
14107 Render invalid page names as plain text (bug 51090)
14108 !! wikitext
14109 [[./../foo|bar]]
14110 [[foo�|bar]]
14111 [[foo/.|bar]]
14112 [[foo/..|bar]]
14113 [[foo~~~bar]]
14114 [[foo>bar]]
14115 [[foo[bar]]
14116 [[.]]
14117 [[..]]
14118 [[foo././bar]]
14119
14120 [[{{echo|./../foo}}|bar]]
14121 [[{{echo|foo/.}}|bar]]
14122 [[{{echo|foo/..}}|bar]]
14123 [[{{echo|foo~~~~bar}}]]
14124 [[{{echo|foo>bar}}]]
14125 [[{{echo|foo././bar}}]]
14126 [[{{echo|foo{bar}}]]
14127 [[{{echo|foo}bar}}]]
14128 [[{{echo|foo[bar}}]]
14129 [[{{echo|foo]bar}}]]
14130 [[{{echo|foo<bar}}]]
14131 !!html/php
14132 <p>[[./../foo|bar]]
14133 [[foo�|bar]]
14134 [[foo/.|bar]]
14135 [[foo/..|bar]]
14136 [[foo~~~bar]]
14137 [[foo&gt;bar]]
14138 [[foo[bar]]
14139 [[.]]
14140 [[..]]
14141 [[foo././bar]]
14142 </p><p>[[./../foo|bar]]
14143 [[foo/.|bar]]
14144 [[foo/..|bar]]
14145 [[foo~~~~bar]]
14146 [[foo&gt;bar]]
14147 [[foo././bar]]
14148 [[foo{bar]]
14149 [[foo}bar]]
14150 [[foo[bar]]
14151 [[foo]bar]]
14152 [[foo&lt;bar]]
14153 </p>
14154 !!html/parsoid
14155 <p>[[./../foo|bar]]
14156 [[foo�|bar]]
14157 [[foo/.|bar]]
14158 [[foo/..|bar]]
14159 [[foo~~~bar]]
14160 [[foo>bar]]
14161 [[foo[bar]]
14162 [[.]]
14163 [[..]]
14164 [[foo././bar]]</p>
14165
14166 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
14167 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
14168 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
14169 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
14170 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
14171 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
14172 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
14173 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
14174 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
14175 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
14176 [[<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>
14177 !!end
14178
14179 !! test
14180 Disabled subpages
14181 !! wikitext
14182 [[/subpage]]
14183 !! html
14184 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
14185 </p>
14186 !! end
14187
14188 !! test
14189 BUG 561: {{/Subpage}}
14190 !! options
14191 subpage title=[[Page]]
14192 !! wikitext
14193 {{/Subpage}}
14194 !! html
14195 <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>
14196 </p>
14197 !! end
14198
14199 ###
14200 ### Categories
14201 ###
14202 !! article
14203 Category:MediaWiki User's Guide
14204 !! text
14205 blah
14206 !! endarticle
14207
14208 !! test
14209 Link to category
14210 !! wikitext
14211 [[:Category:MediaWiki User's Guide]]
14212 !! html
14213 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
14214 </p>
14215 !! end
14216
14217 !! test
14218 Simple category
14219 !! options
14220 cat
14221 !! wikitext
14222 [[Category:MediaWiki User's Guide]]
14223 !! html
14224 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14225 !! end
14226
14227 !! test
14228 PAGESINCATEGORY invalid title fatal (r33546 fix)
14229 !! wikitext
14230 {{PAGESINCATEGORY:<bogus>}}
14231 !! html
14232 <p>0
14233 </p>
14234 !! end
14235
14236 !! test
14237 Category with different sort key
14238 !! options
14239 cat
14240 !! wikitext
14241 [[Category:MediaWiki User's Guide|Foo]]
14242 !! html
14243 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14244 !! end
14245
14246 !! test
14247 Category with identical sort key
14248 !! options
14249 cat
14250 !! wikitext
14251 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14252 !! html
14253 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14254 !! end
14255
14256 !! test
14257 Category with empty sort key
14258 !! options
14259 cat
14260 pst
14261 !! wikitext
14262 [[Category:MediaWiki User's Guide|]]
14263 !! html
14264 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14265 !! end
14266
14267 !! test
14268 Category with empty sort key and parentheses
14269 !! options
14270 cat
14271 pst
14272 !! wikitext
14273 [[Category:Foo (bar)|]]
14274 !! html
14275 [[Category:Foo (bar)|Foo]]
14276 !! end
14277
14278 ## We used to, but no longer wt2wt this test since the default serializer
14279 ## will normalize all categories to serialize on their own line.
14280 ## This wikitext usage is going to be fairly uncommon in production and
14281 ## selser will take care of preserving formatting in those scenarios.
14282 !! test
14283 Category with link tail
14284 !! options
14285 cat
14286 pst
14287 parsoid=wt2html
14288 !! wikitext
14289 123[[Category:Foo]]456
14290 !! html/php
14291 123[[Category:Foo]]456
14292 !! html/parsoid
14293 <p>123<link rel="mw:PageProp/Category" href="Category:Foo"/>456</p>
14294 !! end
14295
14296 !! test
14297 Category with template
14298 !! options
14299 cat
14300 pst
14301 !! wikitext
14302 [[Category:{{echo|Foo}}]]
14303 !! html
14304 [[Category:{{echo|Foo}}]]
14305 !! end
14306
14307 !! test
14308 Category with template in sort key
14309 !! options
14310 cat
14311 pst
14312 !! wikitext
14313 [[Category:Foo|{{echo|Bar}}]]
14314 !! html
14315 [[Category:Foo|{{echo|Bar}}]]
14316 !! end
14317
14318 !! test
14319 Category with template in sort key and title
14320 !! options
14321 cat
14322 pst
14323 !! wikitext
14324 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14325 !! html
14326 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14327 !! end
14328
14329 ## We used to, but no longer wt2wt this test since the default serializer
14330 ## will normalize all categories to serialize on their own line.
14331 ## This wikitext usage is going to be fairly uncommon in production and
14332 ## selser will take care of preserving formatting in those scenarios.
14333 !! test
14334 Category / paragraph interactions
14335 !! options
14336 parsoid=wt2html
14337 !! wikitext
14338 Foo [[Category:Baz]] Bar
14339
14340 Foo [[Category:Baz]]
14341 Bar
14342
14343 Foo
14344 [[Category:Baz]]
14345 Bar
14346
14347 Foo
14348 [[Category:Baz]] Bar
14349
14350 Foo
14351 [[Category:Baz]]
14352 [[Category:Baz]]
14353 [[Category:Baz]]
14354 Bar
14355
14356 [[Category:Baz]]
14357 [[Category:Baz]]
14358 [[Category:Baz]]
14359
14360 [[Category:Baz]]
14361 {{echo|[[Category:Baz]]}}
14362 [[Category:Baz]]
14363 !! html/php
14364 <p>Foo Bar
14365 </p><p>Foo
14366 Bar
14367 </p><p>Foo
14368 Bar
14369 </p><p>Foo Bar
14370 </p><p>Foo
14371 Bar
14372 </p>
14373 !! html/parsoid
14374 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14375 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14376 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14377 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14378 <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>
14379 <link rel="mw:PageProp/Category" href="Category:Baz"/>
14380 !! end
14381
14382 ## We used to, but no longer wt2wt this test since the default serializer
14383 ## will normalize all categories to serialize on their own line.
14384 ## This wikitext usage is going to be fairly uncommon in production and
14385 ## selser will take care of preserving formatting in those scenarios.
14386 ##
14387 ## The whitespace on the empty line is part of the test. Please do not delete
14388 !! test
14389 1. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14390 !! options
14391 parsoid=wt2html
14392 !! wikitext
14393 This
14394
14395 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
14396
14397 {{echo|[[Category:Foo]] and so should this!}}
14398 !! html/php
14399 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
14400 </p>
14401 !! html/parsoid
14402 <p>This
14403
14404 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
14405
14406 <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>
14407 !! end
14408
14409 ## Parsoid will not try to wt2wt this while preserving newlines because
14410 ## it suppresses excess newlines within list items -- and we don't want to
14411 ## introduce a special case just for categories, which is, in reality somewhat
14412 ## odd behavior -- categories are unlikely to be used in list items like this
14413 ## in top-level pages and are only likely to show up in template-generated
14414 ## list items where this RT-ing is a non-issue.
14415 ##
14416 ## The whitespace on the empty line is part of the test. Please do not delete
14417 !! test
14418 2. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14419 !! options
14420 parsoid=wt2html
14421 !! wikitext
14422 * This
14423
14424 [[Category:Foo]] and this should be part of the same list item
14425 * So should this
14426
14427 {{echo|[[Category:Foo]] and this should be part of the same list item}}
14428 !! html
14429 <ul><li>This and this should be part of the same list item</li>
14430 <li>So should this and this should be part of the same list item</li></ul>
14431 !! html/parsoid
14432 <ul>
14433 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
14434 <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>
14435 </ul>
14436 !! end
14437
14438 ## Newlines and categories that follow the last item of a list
14439 ## are treated differently because this (list followed by categories)
14440 ## is an extremely common pattern on wikis.
14441 !! test
14442 3. Categories and newlines: newline suppression for last list item should RT properly
14443 !! wikitext
14444 * a
14445 * b
14446
14447 [[Category:Foo]]
14448
14449 [[Category:Bar]]
14450 [[Category:Baz]]
14451 !! html/parsoid
14452 <ul><li> a</li>
14453 <li> b</li></ul>
14454
14455 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14456
14457 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14458 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14459 !! end
14460
14461 !! test
14462 4. Categories and newlines: newline suppression for last list item should RT properly
14463 !! wikitext
14464 * a
14465 **** b
14466
14467 [[Category:Foo]]
14468 !! html/parsoid
14469 <ul><li> a
14470 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
14471
14472 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14473 !! end
14474
14475 ## only wt2html for this to make sure the algo only applies to the rightmost path
14476 !! test
14477 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
14478 !! options
14479 parsoid=wt2html
14480 !! wikitext
14481 * a
14482 ** b
14483 [[Category:Foo]]
14484 * c
14485 ** d
14486 [[Category:Foo]]
14487 !! html/parsoid
14488 <ul><li> a
14489 <ul><li> b
14490 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
14491 <li> c
14492 <ul><li> d</li></ul></li></ul>
14493 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14494 !! end
14495
14496 ## We used to, but no longer wt2wt this test since the default serializer
14497 ## will normalize all categories to serialize on their own line.
14498 ## This wikitext usage is going to be fairly uncommon in production and
14499 ## selser will take care of preserving formatting in those scenarios.
14500 !! test
14501 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
14502 !! options
14503 parsoid=wt2html
14504 !! wikitext
14505 * a [[Category:Foo]]
14506 !! html/parsoid
14507 <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>
14508 !! end
14509
14510 # This test also demonstrates because of newline+category tunneling
14511 # through the list hander, template wrapping doesn't expand to the
14512 # containing list when the list item swallows the category.
14513 !! test
14514 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
14515 !! wikitext
14516 * {{echo|a
14517 [[Category:Foo]]}}
14518 !! html/parsoid
14519 <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</span><span about="#mwt1">
14520 </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>
14521 !! end
14522
14523 !! test
14524 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
14525 !! wikitext
14526 * a
14527
14528 {{echo|[[Category:Foo]]
14529 [[Category:Bar]]}}
14530 [[Category:Baz]]
14531 !! html/parsoid
14532 <ul><li> a</li></ul>
14533
14534 <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">
14535 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14536 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14537 !! end
14538
14539 !! test
14540 Parsoid: Serialize link to category page with colon escape
14541 !! options
14542 parsoid
14543 !! wikitext
14544
14545 [[:Category:Foo]]
14546 [[:Category:Foo|Bar]]
14547 !! html
14548 <p>
14549 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
14550 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
14551 </p>
14552 !! end
14553
14554 # We used to, but no longer wt2wt this test since the default serializer
14555 # will normalize all categories to serialize on their own line.
14556 # This wikitext usage is going to be fairly uncommon in production and
14557 # selser will take care of preventing whitespace insertion if this
14558 # occurs in an article.
14559 #
14560 # html2html disabled for the same reason (whitespace insertion between
14561 # x and y).
14562 #
14563 # html2wt disabled because it localizes the "Category" namespace.
14564 !! test
14565 Link prefix/suffixes aren't applied to category links
14566 !! options
14567 parsoid=wt2html
14568 language=is
14569 !! wikitext
14570 x[[Category:Foo]]y
14571 !! html/php
14572 <p>xy
14573 </p>
14574 !! html/parsoid
14575 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
14576 !! end
14577
14578 !! test
14579 Parsoid: Serialize link to file page with colon escape
14580 !! options
14581 parsoid
14582 !! wikitext
14583
14584 [[:File:Foo.png]]
14585 [[:File:Foo.png|Bar]]
14586 !! html
14587 <p>
14588 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
14589 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
14590 </p>
14591 !! end
14592
14593 !! test
14594 Parsoid: Serialize a genuine category link without colon escape
14595 !! options
14596 parsoid
14597 !! wikitext
14598 [[Category:Foo]]
14599 [[Category:Foo|Bar]]
14600 !! html
14601 <link rel="mw:PageProp/Category" href="./Category:Foo">
14602 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
14603 !! end
14604
14605 !! test
14606 Normalize hrefs properly before testing for invalid link targets (bug 70894)
14607 !! options
14608 parsoid=html2wt
14609 !! html/parsoid
14610 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
14611 !! wikitext
14612 [[Category:Toxine bactérienne]]
14613 !! end
14614
14615 !! test
14616 Parsoid: Defaultsort
14617 !! wikitext
14618 {{DEFAULTSORT:Foo}}
14619 !! html/parsoid
14620 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
14621 !! end
14622
14623 !! test
14624 Parsoid: Defaultsort (template-generated)
14625 !! wikitext
14626 {{{{echo|DEFAULTSORT}}:Foo}}
14627 !! html/parsoid
14628 <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}}]}'/>
14629 !! end
14630
14631 ###
14632 ### Inter-language links
14633 ###
14634 !! test
14635 Interlanguage links
14636 !! options
14637 ill
14638 !! wikitext
14639 [[es:Alimento]]
14640 [[fr:Nourriture]]
14641 [[zh:食品]]
14642 !! html/php
14643 es:Alimento fr:Nourriture zh:食品
14644 !! html/parsoid
14645 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
14646 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
14647 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
14648 !! end
14649
14650 !! test
14651 Duplicate interlanguage links (bug 24502)
14652 !! options
14653 ill
14654 !! wikitext
14655 [[es:1]]
14656 [[es:2]]
14657 [[fr:1]]
14658 [[fr:2]]
14659 !! html/php
14660 es:1 fr:1
14661 !! html/parsoid
14662 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
14663 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
14664 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
14665 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
14666 !! end
14667
14668 ###
14669 ### Sections
14670 ###
14671 !! test
14672 Basic section headings
14673 !! wikitext
14674 == Headline 1 ==
14675 Some text
14676
14677 ==Headline 2==
14678 More
14679 ===Smaller headline===
14680 Blah blah
14681 !! html
14682 <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>
14683 <p>Some text
14684 </p>
14685 <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>
14686 <p>More
14687 </p>
14688 <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>
14689 <p>Blah blah
14690 </p>
14691 !! end
14692
14693 !! test
14694 Section headings with TOC
14695 !! wikitext
14696 == Headline 1 ==
14697 === Subheadline 1 ===
14698 ===== Skipping a level =====
14699 ====== Skipping a level ======
14700
14701 == Headline 2 ==
14702 Some text
14703 ===Another headline===
14704 !! html
14705 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14706 <ul>
14707 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
14708 <ul>
14709 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
14710 <ul>
14711 <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>
14712 <ul>
14713 <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>
14714 </ul>
14715 </li>
14716 </ul>
14717 </li>
14718 </ul>
14719 </li>
14720 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
14721 <ul>
14722 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
14723 </ul>
14724 </li>
14725 </ul>
14726 </div>
14727
14728 <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>
14729 <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>
14730 <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>
14731 <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>
14732 <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>
14733 <p>Some text
14734 </p>
14735 <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>
14736
14737 !! end
14738
14739 !! test
14740 TOC anchors don't collide
14741 !! wikitext
14742 __FORCETOC__
14743 == Headline 2 ==
14744 == Headline ==
14745 == Headline 2 ==
14746 == Headline ==
14747 !! html/php
14748 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14749 <ul>
14750 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
14751 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
14752 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
14753 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
14754 </ul>
14755 </div>
14756
14757 <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>
14758 <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>
14759 <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>
14760 <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>
14761
14762 !! end
14763
14764 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
14765 !! test
14766 Handling of sections up to level 6 and beyond
14767 !! wikitext
14768 = Level 1 Heading=
14769 == Level 2 Heading==
14770 === Level 3 Heading===
14771 ==== Level 4 Heading====
14772 ===== Level 5 Heading=====
14773 ====== Level 6 Heading======
14774 ======= Level 7 Heading=======
14775 ======== Level 8 Heading========
14776 ========= Level 9 Heading=========
14777 ========== Level 10 Heading==========
14778 !! html
14779 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14780 <ul>
14781 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
14782 <ul>
14783 <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>
14784 <ul>
14785 <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>
14786 <ul>
14787 <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>
14788 <ul>
14789 <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>
14790 <ul>
14791 <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>
14792 <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>
14793 <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>
14794 <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>
14795 <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>
14796 </ul>
14797 </li>
14798 </ul>
14799 </li>
14800 </ul>
14801 </li>
14802 </ul>
14803 </li>
14804 </ul>
14805 </li>
14806 </ul>
14807 </div>
14808
14809 <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>
14810 <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>
14811 <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>
14812 <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>
14813 <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>
14814 <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>
14815 <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>
14816 <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>
14817 <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>
14818 <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>
14819
14820 !! end
14821
14822 !! test
14823 TOC regression (T11764)
14824 !! wikitext
14825 == title 1 ==
14826 === title 1.1 ===
14827 ==== title 1.1.1 ====
14828 === title 1.2 ===
14829 == title 2 ==
14830 === title 2.1 ===
14831 !! html
14832 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14833 <ul>
14834 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14835 <ul>
14836 <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>
14837 <ul>
14838 <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>
14839 </ul>
14840 </li>
14841 <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>
14842 </ul>
14843 </li>
14844 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
14845 <ul>
14846 <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>
14847 </ul>
14848 </li>
14849 </ul>
14850 </div>
14851
14852 <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>
14853 <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>
14854 <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>
14855 <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>
14856 <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>
14857 <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>
14858
14859 !! end
14860
14861 !! test
14862 TOC for heading containing <span id="..."></span> (T96153)
14863 !! wikitext
14864 __FORCETOC__
14865 ==<span id="old-anchor"></span>New title==
14866 !! html/php
14867 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14868 <ul>
14869 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
14870 </ul>
14871 </div>
14872
14873 <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>
14874
14875 !! end
14876
14877 !! test
14878 TOC with wgMaxTocLevel=3 (bug 6204)
14879 !! options
14880 wgMaxTocLevel=3
14881 !! wikitext
14882 == title 1 ==
14883 === title 1.1 ===
14884 ==== title 1.1.1 ====
14885 === title 1.2 ===
14886 == title 2 ==
14887 === title 2.1 ===
14888 !! html
14889 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14890 <ul>
14891 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14892 <ul>
14893 <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>
14894 <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>
14895 </ul>
14896 </li>
14897 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
14898 <ul>
14899 <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>
14900 </ul>
14901 </li>
14902 </ul>
14903 </div>
14904
14905 <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>
14906 <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>
14907 <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>
14908 <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>
14909 <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>
14910 <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>
14911
14912 !! end
14913
14914 !! test
14915 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
14916 !! options
14917 wgMaxTocLevel=3
14918 !! wikitext
14919 ==Section 1==
14920 ===Section 1.1===
14921 ====Section 1.1.1====
14922 ====Section 1.1.1.1====
14923 ==Section 2==
14924 !! html
14925 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14926 <ul>
14927 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
14928 <ul>
14929 <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>
14930 </ul>
14931 </li>
14932 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
14933 </ul>
14934 </div>
14935
14936 <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>
14937 <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>
14938 <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>
14939 <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>
14940 <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>
14941
14942 !! end
14943
14944
14945 !! test
14946 Resolving duplicate section names
14947 !! wikitext
14948 == Foo bar ==
14949 == Foo bar ==
14950 !! html
14951 <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>
14952 <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>
14953
14954 !! end
14955
14956 !! test
14957 Resolving duplicate section names with differing case (bug 10721)
14958 !! wikitext
14959 == Foo bar ==
14960 == Foo Bar ==
14961 !! html
14962 <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>
14963 <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>
14964
14965 !! end
14966
14967 !! article
14968 Template:sections
14969 !! text
14970 ===Section 1===
14971 ==Section 2==
14972 !! endarticle
14973
14974 !! test
14975 Template with sections, __NOTOC__
14976 !! wikitext
14977 __NOTOC__
14978 ==Section 0==
14979 {{sections}}
14980 ==Section 4==
14981 !! html
14982 <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>
14983 <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>
14984 <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>
14985 <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>
14986
14987 !! end
14988
14989 !! test
14990 __NOEDITSECTION__ keyword
14991 !! wikitext
14992 __NOEDITSECTION__
14993 ==Section 1==
14994 ==Section 2==
14995 !! html
14996 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
14997 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
14998
14999 !! end
15000
15001 !! test
15002 Link inside a section heading
15003 !! wikitext
15004 ==Section with a [[Main Page|link]] in it==
15005 !! html
15006 <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>
15007
15008 !! end
15009
15010 !! test
15011 TOC regression (T14077)
15012 !! wikitext
15013 __TOC__
15014 == title 1 ==
15015 === title 1.1 ===
15016 == title 2 ==
15017 !! html
15018 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15019 <ul>
15020 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15021 <ul>
15022 <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>
15023 </ul>
15024 </li>
15025 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
15026 </ul>
15027 </div>
15028
15029 <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>
15030 <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>
15031 <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>
15032
15033 !! end
15034
15035 !! test
15036 BUG 1219 URL next to image (good)
15037 !! wikitext
15038 http://example.com [[File:Foobar.jpg]]
15039 !! html/php
15040 <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>
15041 </p>
15042 !! html/parsoid
15043 <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>
15044 !!end
15045
15046 !! test
15047 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
15048 !! wikitext
15049 ===
15050 The line above must have a trailing space!
15051 === <!--
15052 --> <!-- -->
15053 But just in case it doesn't...
15054 !! html
15055 <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>
15056 <p>The line above must have a trailing space!
15057 </p>
15058 <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>
15059 <p>But just in case it doesn't...
15060 </p>
15061 !! end
15062
15063 !! test
15064 Header with special characters (bug 25462)
15065 !! wikitext
15066 The tooltips shall not show entities to the user (ie. be double escaped)
15067
15068 == text > text ==
15069 section 1
15070
15071 == text < text ==
15072 section 2
15073
15074 == text & text ==
15075 section 3
15076
15077 == text ' text ==
15078 section 4
15079
15080 == text " text ==
15081 section 5
15082 !! html
15083 <p>The tooltips shall not show entities to the user (ie. be double escaped)
15084 </p>
15085 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15086 <ul>
15087 <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>
15088 <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>
15089 <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>
15090 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
15091 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
15092 </ul>
15093 </div>
15094
15095 <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>
15096 <p>section 1
15097 </p>
15098 <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>
15099 <p>section 2
15100 </p>
15101 <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>
15102 <p>section 3
15103 </p>
15104 <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>
15105 <p>section 4
15106 </p>
15107 <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>
15108 <p>section 5
15109 </p>
15110 !! end
15111
15112 !! test
15113 Header with space, plus and underscore as entity
15114 !! wikitext
15115 Id should not contain + for spaces
15116
15117 == Space between Text ==
15118 section 1
15119
15120 == Space-Entity&#32;between&#32;Text ==
15121 section 2
15122
15123 == Plus+between+Text ==
15124 section 3
15125
15126 == Plus-Entity&#43;between&#43;Text ==
15127 section 4
15128
15129 == Underscore_between_Text ==
15130 section 5
15131
15132 == Underscore-Entity&#95;between&#95;Text ==
15133 section 6
15134
15135 [[#Space between Text]]
15136 [[#Space-Entity&#32;between&#32;Text]]
15137 [[#Plus+between+Text]]
15138 [[#Plus-Entity&#43;between&#43;Text]]
15139 [[#Underscore_between_Text]]
15140 [[#Underscore-Entity&#95;between&#95;Text]]
15141 !! html
15142 <p>Id should not contain + for spaces
15143 </p>
15144 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15145 <ul>
15146 <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>
15147 <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>
15148 <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>
15149 <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>
15150 <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>
15151 <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>
15152 </ul>
15153 </div>
15154
15155 <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>
15156 <p>section 1
15157 </p>
15158 <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>
15159 <p>section 2
15160 </p>
15161 <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>
15162 <p>section 3
15163 </p>
15164 <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>
15165 <p>section 4
15166 </p>
15167 <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>
15168 <p>section 5
15169 </p>
15170 <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>
15171 <p>section 6
15172 </p><p><a href="#Space_between_Text">#Space between Text</a>
15173 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
15174 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
15175 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
15176 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
15177 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
15178 </p>
15179 !! end
15180
15181 !! test
15182 Headers with excess '=' characters
15183 (Are similar tests necessary beyond the 1st level?)
15184 !! wikitext
15185 =foo==
15186 ==foo=
15187 =''italic'' heading==
15188 ==''italic'' heading=
15189 !! html
15190 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15191 <ul>
15192 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
15193 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
15194 <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>
15195 <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>
15196 </ul>
15197 </div>
15198
15199 <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>
15200 <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>
15201 <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>
15202 <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>
15203
15204 !! end
15205
15206 !! test
15207 HTML headers vs TOC (bug 23393)
15208 (__NOEDITSECTION__ for clearer output, doesn't matter here)
15209 !! wikitext
15210 <h1>Header 1</h1>
15211 == Header 1.1 ==
15212 == Header 1.2 ==
15213
15214 <h1>Header 2
15215 </h1>
15216 == Header 2.1 ==
15217 == Header 2.2 ==
15218 __NOEDITSECTION__
15219 !! html
15220 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15221 <ul>
15222 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
15223 <ul>
15224 <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>
15225 <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>
15226 </ul>
15227 </li>
15228 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
15229 <ul>
15230 <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>
15231 <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>
15232 </ul>
15233 </li>
15234 </ul>
15235 </div>
15236
15237 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
15238 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
15239 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
15240 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
15241 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
15242 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
15243
15244 !! end
15245
15246 !! test
15247 Single-line or multiline-comments can follow headings
15248 !! options
15249 parsoid=wt2html,wt2wt
15250 !! wikitext
15251 ==foo==<!---->
15252 ==bar==<!--c1-->
15253 ==baz==<!--
15254 c2
15255 c3-->
15256 !! html
15257 <h2><span class="mw-headline" id="foo">foo</span></h2>
15258 <h2><span class="mw-headline" id="bar">bar</span></h2>
15259 <h2><span class="mw-headline" id="baz">baz</span></h2>
15260
15261 !! end
15262
15263 !! test
15264 BUG 1219 URL next to image (broken)
15265 !! wikitext
15266 http://example.com[[File:Foobar.jpg]]
15267 !! html/php
15268 <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>
15269 </p>
15270 !! html/parsoid
15271 <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>
15272 !!end
15273
15274 !! test
15275 Bug 1186 news: in the middle of text
15276 !! wikitext
15277 http://en.wikinews.org/wiki/Wikinews:Workplace
15278 !! html
15279 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
15280 </p>
15281 !!end
15282
15283
15284 !! test
15285 Namespaced link must have a title
15286 !! wikitext
15287 [[Project:]]
15288 !! html
15289 <p>[[Project:]]
15290 </p>
15291 !!end
15292
15293 !! test
15294 Namespaced link must have a title (bad fragment version)
15295 !! wikitext
15296 [[Project:#fragment]]
15297 !! html
15298 <p>[[Project:#fragment]]
15299 </p>
15300 !!end
15301
15302
15303 ###
15304 ### HTML tags and HTML attributes
15305 ###
15306
15307 !! test
15308 div with no attributes
15309 !! wikitext
15310 <div>HTML rocks</div>
15311 !! html
15312 <div>HTML rocks</div>
15313
15314 !! end
15315
15316 !! test
15317 div with double-quoted attribute
15318 !! wikitext
15319 <div id="rock">HTML rocks</div>
15320 !! html
15321 <div id="rock">HTML rocks</div>
15322
15323 !! end
15324
15325 !! test
15326 div with single-quoted attribute
15327 !! wikitext
15328 <div id='rock'>HTML rocks</div>
15329 !! html
15330 <div id="rock">HTML rocks</div>
15331
15332 !! end
15333
15334 !! test
15335 div with unquoted attribute
15336 !! wikitext
15337 <div id=rock>HTML rocks</div>
15338 !! html
15339 <div id="rock">HTML rocks</div>
15340
15341 !! end
15342
15343 !! test
15344 div with illegal double attributes
15345 !! wikitext
15346 <div id="a" id="b">HTML rocks</div>
15347 !! html
15348 <div id="b">HTML rocks</div>
15349
15350 !!end
15351
15352 # FIXME: produce empty string instead of "class" in the PHP parser, following
15353 # the HTML5 spec.
15354 !! test
15355 div with empty attribute value, space before equals
15356 !! options
15357 parsoid
15358 !! wikitext
15359 <div class =>HTML rocks</div>
15360 !! html
15361 <div class="">HTML rocks</div>
15362
15363 !! end
15364
15365 !! test
15366 div with multiple empty attribute values
15367 !! options
15368 parsoid
15369 !! wikitext
15370 <div id= title=>HTML rocks</div>
15371 !! html
15372 <div id="" title="">HTML rocks</div>
15373
15374 !! end
15375
15376 !! test
15377 table with multiple empty attribute values
15378 !! options
15379 parsoid
15380 !! wikitext
15381 {| title= id=
15382 | hi
15383 |}
15384 !! html
15385 <table title="" id="">
15386 <tbody><tr><td> hi</td></tr>
15387 </tbody></table>
15388 !! end
15389
15390 !! test
15391 div with braces in attribute value
15392 !! wikitext
15393 <div title="{}">Foo</div>
15394 !! html/php
15395 <div title="&#123;}">Foo</div>
15396
15397 !! html/parsoid
15398 <div title="{}">Foo</div>
15399 !! end
15400
15401 # This it very inconsistent in the PHP parser: it returns
15402 # class="class" if there is a space between the name and the equal sign (see
15403 # 'div with empty attribute value, space before equals'), but strips the
15404 # attribute completely if the space is missing. We hope that not much content
15405 # depends on this, so are implementing the behavior below in Parsoid for
15406 # consistencies' sake.
15407 # FIXME: fix this behavior in the PHP parser?
15408 !! test
15409 div with empty attribute value, no space before equals
15410 !! options
15411 parsoid=wt2html,html2html
15412 !! wikitext
15413 <div class=>HTML rocks</div>
15414 !! html/php
15415 <div>HTML rocks</div>
15416
15417 !! html/parsoid
15418 <div class="">HTML rocks</div>
15419 !! end
15420
15421 !! test
15422 HTML multiple attributes correction
15423 !! wikitext
15424 <p class="error" class="awesome">Awesome!</p>
15425 !! html
15426 <p class="awesome">Awesome!</p>
15427
15428 !!end
15429
15430 !! test
15431 Table multiple attributes correction
15432 !! wikitext
15433 {|
15434 !+ class="error" class="awesome"| status
15435 |}
15436 !! html
15437 <table>
15438 <tr>
15439 <th class="awesome"> status
15440 </th></tr></table>
15441
15442 !!end
15443
15444 !! test
15445 DIV IN UPPERCASE
15446 !! wikitext
15447 <DIV ID="x">HTML ROCKS</DIV>
15448 !! html
15449 <div id="x">HTML ROCKS</div>
15450
15451 !!end
15452
15453 !! test
15454 Non-ASCII pseudo-tags are rendered as text
15455 !! wikitext
15456 <khyô>
15457 !! html
15458 <p>&lt;khyô&gt;
15459 </p>
15460 !! end
15461
15462 !! test
15463 Pseudo-tag with URL 'name' renders as url link
15464 !! wikitext
15465 <http://example.com/>
15466 !! html
15467 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
15468 </p>
15469 !! end
15470
15471 !! test
15472 text with amp in the middle of nowhere
15473 !! wikitext
15474 Remember AT&T?
15475 !! html
15476 <p>Remember AT&amp;T?
15477 </p>
15478 !! end
15479
15480 !! test
15481 text with character entity: eacute
15482 !! wikitext
15483 I always thought &eacute; was a cute letter.
15484 !! html
15485 <p>I always thought &#233; was a cute letter.
15486 </p>
15487 !! html+tidy
15488 <p>I always thought é was a cute letter.</p>
15489 !! end
15490
15491 !! test
15492 text with entity-escaped character entity-like string: eacute
15493 !! wikitext
15494 I always thought &amp;eacute; was a cute letter.
15495 !! html
15496 <p>I always thought &amp;eacute; was a cute letter.
15497 </p>
15498 !! end
15499
15500 !! test
15501 text with undefined character entity: xacute
15502 !! wikitext
15503 I always thought &xacute; was a cute letter.
15504 !! html
15505 <p>I always thought &amp;xacute; was a cute letter.
15506 </p>
15507 !! end
15508
15509 !! test
15510 HTML5 tags
15511 !! wikitext
15512 <data value="5">five</data>
15513 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
15514 <mark>This highlighted text</mark>
15515 !! html
15516 <p><data value="5">five</data>
15517 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
15518 <mark>This highlighted text</mark>
15519 </p>
15520 !! end
15521
15522 !! test
15523 HTML tag with leading space is parsed as text
15524 !! wikitext
15525 < div>foo< /div>
15526 !! html
15527 <p>&lt; div&gt;foo&lt; /div&gt;
15528 </p>
15529 !! end
15530
15531 ###
15532 ### Nesting tests (see bug 41545, 50604, 51081)
15533 ###
15534
15535 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
15536 # Note that html2wt is considerably more difficult if we use <b> in
15537 # the test case, instead of <big>
15538 !! test
15539 Ensure that HTML adoption agency algorithm is properly implemented.
15540 !! wikitext
15541 <big>X<big>Y</big>Z</big>
15542 !! html
15543 <p><big>X<big>Y</big>Z</big>
15544 </p>
15545 !! end
15546
15547 # This was bug 41545 in the PHP parser.
15548 # Note that tidy doesn't handle this correctly.
15549 !! test
15550 Nesting of <kbd>
15551 !! wikitext
15552 <kbd>X<kbd>Y</kbd>Z</kbd>
15553 !! html
15554 <p><kbd>X<kbd>Y</kbd>Z</kbd>
15555 </p>
15556 !! end
15557
15558 # The following cases were bug 51081 in the PHP parser.
15559 # Note that there are some other nestable tags (b, i, etc) which are
15560 # not covered; see bug 51081 for discussion.
15561
15562 # Note that tidy doesn't handle this correctly.
15563 !! test
15564 Nesting of <em>
15565 !! wikitext
15566 <em>X<em>Y</em>Z</em>
15567 !! html
15568 <p><em>X<em>Y</em>Z</em>
15569 </p>
15570 !! end
15571
15572 # Note that tidy doesn't handle this correctly.
15573 !! test
15574 Nesting of <strong>
15575 !! wikitext
15576 <strong>X<strong>Y</strong>Z</strong>
15577 !! html
15578 <p><strong>X<strong>Y</strong>Z</strong>
15579 </p>
15580 !! end
15581
15582 !! test
15583 Nesting of <q>
15584 !! wikitext
15585 <q>X<q>Y</q>Z</q>
15586 !! html+tidy
15587 <p><q>X<q>Y</q>Z</q></p>
15588 !! end
15589
15590 # Note that tidy doesn't handle this correctly.
15591 !! test
15592 Nesting of <ruby>
15593 !! wikitext
15594 <ruby>X<ruby>Y</ruby>Z</ruby>
15595 !! html
15596 <p><ruby>X<ruby>Y</ruby>Z</ruby>
15597 </p>
15598 !! end
15599
15600 # Note that tidy doesn't handle this correctly.
15601 !! test
15602 Nesting of <bdo>
15603 !! wikitext
15604 <bdo>X<bdo>Y</bdo>Z</bdo>
15605 !! html
15606 <p><bdo>X<bdo>Y</bdo>Z</bdo>
15607 </p>
15608 !! end
15609
15610
15611 ###
15612 ### Media links
15613 ###
15614
15615 !! test
15616 Media link
15617 !! wikitext
15618 [[Media:Foobar.jpg]]
15619 !! html
15620 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
15621 </p>
15622 !! end
15623
15624 !! test
15625 Media link with text
15626 !! wikitext
15627 [[Media:Foobar.jpg|A neat file to look at]]
15628 !! html
15629 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
15630 </p>
15631 !! end
15632
15633 # FIXME: this is still bad HTML tag nesting
15634 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
15635 !! test
15636 Media link with nasty text
15637 !! wikitext
15638 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
15639 !! html
15640 <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>
15641
15642 !! html+tidy
15643 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
15644 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
15645 !! end
15646
15647 !! test
15648 Media link to nonexistent file (bug 1702)
15649 !! wikitext
15650 [[Media:No such.jpg]]
15651 !! html
15652 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
15653 </p>
15654 !! end
15655
15656 !! test
15657 Image link to nonexistent file (bug 1850 - good)
15658 !! wikitext
15659 [[File:No_such.jpg]]
15660 !! html/php
15661 <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>
15662 </p>
15663 !! html/parsoid
15664 <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>
15665 !! end
15666
15667 !! test
15668 :Image link to nonexistent file (bug 1850 - bad)
15669 !! wikitext
15670 [[:Image:No such.jpg]]
15671 !! html/php
15672 <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>
15673 </p>
15674 !! html/parsoid
15675 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
15676 !! end
15677
15678
15679
15680 !! test
15681 Character reference normalization in link text (bug 1938)
15682 !! wikitext
15683 [[Main Page|this&that]]
15684 !! html
15685 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
15686 </p>
15687 !!end
15688
15689 !! article
15690 אַ
15691 !! text
15692 Test for unicode normalization
15693
15694 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
15695 !! endarticle
15696
15697 !! test
15698 (bug 19451) Links should refer to the normalized form.
15699 !! wikitext
15700 [[&#xFB2E;]]
15701 [[&#x5d0;&#x5b7;]]
15702 [[&#x5d0;ַ]]
15703 [[א&#x5b7;]]
15704 [[אַ]]
15705 !! html
15706 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
15707 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
15708 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
15709 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
15710 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
15711 </p>
15712 !! end
15713
15714 !! test
15715 Empty attribute crash test (bug 2067)
15716 !! wikitext
15717 <font color="">foo</font>
15718 !! html
15719 <p><font color="">foo</font>
15720 </p>
15721 !! end
15722
15723 !! test
15724 Empty attribute crash test single-quotes (bug 2067)
15725 !! wikitext
15726 <font color=''>foo</font>
15727 !! html
15728 <p><font color="">foo</font>
15729 </p>
15730 !! end
15731
15732 !! test
15733 Attribute test: equals, then nothing
15734 !! wikitext
15735 <font color=>foo</font>
15736 !! html
15737 <p><font>foo</font>
15738 </p>
15739 !! end
15740
15741 !! test
15742 Attribute test: unquoted value
15743 !! wikitext
15744 <font color=x>foo</font>
15745 !! html
15746 <p><font color="x">foo</font>
15747 </p>
15748 !! end
15749
15750 !! test
15751 Attribute test: unquoted but illegal value (hash)
15752 !! wikitext
15753 <font color=#x>foo</font>
15754 !! html
15755 <p><font color="#x">foo</font>
15756 </p>
15757 !! end
15758
15759 # Parsoid does not serialize to empty attribute syntax,
15760 # so wt2wt and html2wt cases are skipped
15761 !! test
15762 Attribute test: no value (T54330)
15763 !! options
15764 parsoid=wt2html,html2html
15765 !! wikitext
15766 <font color>foo</font>
15767 !! html/php
15768 <p><font color="">foo</font>
15769 </p>
15770 !! html/parsoid
15771 <p><font color="">foo</font></p>
15772 !! end
15773
15774 !! test
15775 Bug 2095: link with three closing brackets
15776 !! wikitext
15777 [[Main Page]]]
15778 !! html/php
15779 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
15780 </p>
15781 !! html/parsoid
15782 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
15783 !! end
15784
15785 !! test
15786 Bug 2095: link with pipe and three closing brackets
15787 !! wikitext
15788 [[Main Page|link]]]
15789 !! html/php
15790 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
15791 </p>
15792 !! html/parsoid
15793 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
15794 !! end
15795
15796 !! test
15797 Bug 2095: link with pipe and three closing brackets, version 2
15798 !! wikitext
15799 [[Main Page|[http://example.com/]]]
15800 !! html/php
15801 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
15802 </p>
15803 !! html/parsoid
15804 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
15805 !! end
15806
15807
15808 ###
15809 ### Safety
15810 ###
15811
15812 !! article
15813 Template:Dangerous attribute
15814 !! text
15815 " onmouseover="alert(document.cookie)
15816 !! endarticle
15817
15818 !! article
15819 Template:Dangerous style attribute
15820 !! text
15821 border-size: expression(alert(document.cookie))
15822 !! endarticle
15823
15824 !! article
15825 Template:Div style
15826 !! text
15827 <div style="float: right; {{{1}}}">Magic div</div>
15828 !! endarticle
15829
15830 !! test
15831 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
15832 !! wikitext
15833 <div title="{{test}}"></div>
15834 !! html
15835 <div title="This is a test template"></div>
15836
15837 !! end
15838
15839 # Parsoid has enough context to handle this case
15840 !! test
15841 Bug 2304: HTML attribute safety (dangerous template; 2309)
15842 !! wikitext
15843 <div title="{{dangerous attribute}}"></div>
15844 !! html/php
15845 <div title=""></div>
15846
15847 !! html/parsoid
15848 <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>
15849 !! end
15850
15851 !! test
15852 Bug 2304: HTML attribute safety (dangerous style template; 2309)
15853 !! wikitext
15854 <div style="{{dangerous style attribute}}"></div>
15855 !! html
15856 <div style="/* insecure input */"></div>
15857
15858 !! end
15859
15860 !! test
15861 Bug 2304: HTML attribute safety (safe parameter; 2309)
15862 !! wikitext
15863 {{div style|width: 200px}}
15864 !! html
15865 <div style="float: right; width: 200px">Magic div</div>
15866
15867 !! end
15868
15869 !! test
15870 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
15871 !! wikitext
15872 {{div style|width: expression(alert(document.cookie))}}
15873 !! html
15874 <div style="/* insecure input */">Magic div</div>
15875
15876 !! end
15877
15878 !! test
15879 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
15880 !! wikitext
15881 {{div style|"><script>alert(document.cookie)</script>}}
15882 !! html
15883 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
15884
15885 !! end
15886
15887 !! test
15888 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
15889 !! wikitext
15890 {{div style|" ><script>alert(document.cookie)</script>}}
15891 !! html
15892 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
15893
15894 !! end
15895
15896 !! test
15897 Bug 2304: HTML attribute safety (link)
15898 !! wikitext
15899 <div title="[[Main Page]]"></div>
15900 !! html
15901 <div title="&#91;&#91;Main Page]]"></div>
15902
15903 !! end
15904
15905 !! test
15906 Bug 2304: HTML attribute safety (italics)
15907 !! wikitext
15908 <div title="''foobar''"></div>
15909 !! html
15910 <div title="&#39;&#39;foobar&#39;&#39;"></div>
15911
15912 !! end
15913
15914 !! test
15915 Bug 2304: HTML attribute safety (bold)
15916 !! wikitext
15917 <div title="'''foobar'''"></div>
15918 !! html
15919 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
15920
15921 !! end
15922
15923
15924 !! test
15925 Bug 2304: HTML attribute safety (ISBN)
15926 !! wikitext
15927 <div title="ISBN 1234567890"></div>
15928 !! html
15929 <div title="&#73;SBN 1234567890"></div>
15930
15931 !! end
15932
15933 !! test
15934 Bug 2304: HTML attribute safety (RFC)
15935 !! wikitext
15936 <div title="RFC 1234"></div>
15937 !! html
15938 <div title="&#82;FC 1234"></div>
15939
15940 !! end
15941
15942 !! test
15943 Bug 2304: HTML attribute safety (PMID)
15944 !! wikitext
15945 <div title="PMID 1234567890"></div>
15946 !! html
15947 <div title="&#80;MID 1234567890"></div>
15948
15949 !! end
15950
15951 !! test
15952 Bug 2304: HTML attribute safety (web link)
15953 !! wikitext
15954 <div title="http://example.com/"></div>
15955 !! html
15956 <div title="http&#58;//example.com/"></div>
15957
15958 !! end
15959
15960 !! test
15961 Bug 2304: HTML attribute safety (named web link)
15962 !! wikitext
15963 <div title="[http://example.com/ link]"></div>
15964 !! html
15965 <div title="&#91;http&#58;//example.com/ link]"></div>
15966
15967 !! end
15968
15969 !! test
15970 Bug 3244: HTML attribute safety (extension; safe)
15971 !! wikitext
15972 <div style="<nowiki>background:blue</nowiki>"></div>
15973 !! html
15974 <div style="background:blue"></div>
15975
15976 !! end
15977
15978 !! test
15979 Bug 3244: HTML attribute safety (extension; unsafe)
15980 !! wikitext
15981 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
15982 !! html
15983 <div style="/* insecure input */"></div>
15984
15985 !! end
15986
15987 # More MSIE fun discovered by Tom Gilder
15988
15989 !! test
15990 MSIE CSS safety test: spurious slash
15991 !! wikitext
15992 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
15993 !! html
15994 <div style="/* insecure input */">evil</div>
15995
15996 !! end
15997
15998 !! test
15999 MSIE CSS safety test: hex code
16000 !! wikitext
16001 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
16002 !! html
16003 <div style="/* insecure input */">evil</div>
16004
16005 !! end
16006
16007 !! test
16008 MSIE CSS safety test: comment in url
16009 !! wikitext
16010 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
16011 !! html
16012 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
16013
16014 !! end
16015
16016 !! test
16017 MSIE CSS safety test: comment in expression
16018 !! wikitext
16019 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
16020 !! html
16021 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
16022
16023 !! end
16024
16025 !! test
16026 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
16027 !! wikitext
16028 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
16029 !! html
16030 <p style="/* invalid control char */">A</p>
16031
16032 !! end
16033
16034 !! test
16035 MSIE 6 CSS safety test: Fullwidth (bug 55332)
16036 !! wikitext
16037 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
16038 <div style="top:EXPRESSION(alert())">B</div>
16039 !! html
16040 <p style="/* insecure input */">A</p>
16041 <div style="/* insecure input */">B</div>
16042
16043 !! end
16044
16045 !! test
16046 MSIE 6 CSS safety test: IPA extensions (bug 55332)
16047 !! wikitext
16048 <div style="background-image:uʀʟ(javascript:alert())">A</div>
16049 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
16050 !! html
16051 <div style="/* insecure input */">A</div>
16052 <p style="/* insecure input */">B</p>
16053
16054 !! end
16055
16056 !! test
16057 MSIE 6 CSS safety test: sup/sub script (bug 55332)
16058 !! wikitext
16059 <div style="background-image:url⁽javascript:alert())">A</div>
16060 <div style="background-image:url₍javascript:alert())">B</div>
16061 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
16062 !! html
16063 <div style="/* insecure input */">A</div>
16064 <div style="/* insecure input */">B</div>
16065 <p style="/* insecure input */">C</p>
16066
16067 !! end
16068
16069 # FIXME: Parsoid fails to sanitize this! See T58846.
16070 !! test
16071 Opera -o-link CSS
16072 !! wikitext
16073 <div
16074 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;"
16075 style="-o-link:attr(title);-o-link-source:current">X</div>
16076 !! html
16077 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
16078
16079 !! end
16080
16081 !! test
16082 MSIE 6 CSS safety test: Repetition markers (bug 55332)
16083 !! wikitext
16084 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
16085 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
16086 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
16087 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
16088 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
16089 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
16090 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
16091 !! html
16092 <p style="/* insecure input */">A</p>
16093 <p style="/* insecure input */">B</p>
16094 <p style="/* insecure input */">C</p>
16095 <p style="/* insecure input */">D</p>
16096 <p style="/* insecure input */">E</p>
16097 <p style="/* insecure input */">F</p>
16098 <p style="/* insecure input */">G</p>
16099
16100 !! end
16101
16102 !! test
16103 Table attribute legitimate extension
16104 !! wikitext
16105 {|
16106 !+ style="<nowiki>color:blue</nowiki>"| status
16107 |}
16108 !! html
16109 <table>
16110 <tr>
16111 <th style="color:blue"> status
16112 </th></tr></table>
16113
16114 !!end
16115
16116 !! test
16117 Table attribute safety
16118 !! wikitext
16119 {|
16120 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
16121 |}
16122 !! html
16123 <table>
16124 <tr>
16125 <th style="/* insecure input */"> status
16126 </th></tr></table>
16127
16128 !! end
16129
16130 !! test
16131 CSS line continuation 1
16132 !! wikitext
16133 <div style="background-image: u\&#10;rl(test.jpg);"></div>
16134 !! html
16135 <div style="/* insecure input */"></div>
16136
16137 !! end
16138
16139 !! test
16140 CSS line continuation 2
16141 !! wikitext
16142 <div style="background-image: u\&#13;rl(test.jpg); "></div>
16143 !! html
16144 <div style="/* invalid control char */"></div>
16145
16146 !! end
16147
16148 !! article
16149 Template:Identity
16150 !! text
16151 {{{1}}}
16152 !! endarticle
16153
16154 !! test
16155 Expansion of multi-line templates in attribute values (bug 6255)
16156 !! wikitext
16157 <div style="background: {{identity|#00FF00}}">-</div>
16158 !! html
16159 <div style="background: #00FF00">-</div>
16160
16161 !! end
16162
16163
16164 !! test
16165 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
16166 !! wikitext
16167 <div style="background:
16168 #00FF00">-</div>
16169 !! html/php
16170 <div style="background: #00FF00">-</div>
16171
16172 !! html/parsoid
16173 <div style="background:
16174 #00FF00">-</div>
16175 !! end
16176
16177 !! test
16178 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
16179 !! wikitext
16180 <div style="background: &#10;#00FF00">-</div>
16181 !! html
16182 <div style="background: &#10;#00FF00">-</div>
16183
16184 !! end
16185
16186 !! test
16187 evil <math>-wiki-tags without Extension:Math enabled
16188 !! wikitext
16189 <math><img src="some evil external link"><script>some_evil_javascript();</script></math>
16190 !! html+tidy
16191 <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>
16192 !! end
16193
16194 ###
16195 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
16196 ###
16197 !! test
16198 Parser hook: empty input
16199 !! wikitext
16200 <tag></tag>
16201 !! html/php
16202 <pre>
16203 ''
16204 array (
16205 )
16206 </pre>
16207
16208 !! end
16209
16210 !! test
16211 Parser hook: empty input using terminated empty elements
16212 !! wikitext
16213 <tag/>
16214 !! html/php
16215 <pre>
16216 NULL
16217 array (
16218 )
16219 </pre>
16220
16221 !! end
16222
16223 !! test
16224 Parser hook: empty input using terminated empty elements (space before)
16225 !! wikitext
16226 <tag />
16227 !! html/php
16228 <pre>
16229 NULL
16230 array (
16231 )
16232 </pre>
16233
16234 !! end
16235
16236 !! test
16237 Parser hook: basic input
16238 !! wikitext
16239 <tag>input</tag>
16240 !! html/php
16241 <pre>
16242 'input'
16243 array (
16244 )
16245 </pre>
16246
16247 !! end
16248
16249
16250 !! test
16251 Parser hook: case insensitive
16252 !! wikitext
16253 <TAG>input</TAG>
16254 !! html/php
16255 <pre>
16256 'input'
16257 array (
16258 )
16259 </pre>
16260
16261 !! end
16262
16263
16264 !! test
16265 Parser hook: case insensitive, redux
16266 !! wikitext
16267 <TaG>input</TAg>
16268 !! html/php
16269 <pre>
16270 'input'
16271 array (
16272 )
16273 </pre>
16274
16275 !! end
16276
16277 !! test
16278 Parser hook: nested tags
16279 !! options
16280 noxml
16281 !! wikitext
16282 <tag><tag></tag></tag>
16283 !! html/php
16284 <pre>
16285 '<tag>'
16286 array (
16287 )
16288 </pre>&lt;/tag&gt;
16289
16290 !! end
16291
16292 !! test
16293 Parser hook: basic arguments
16294 !! wikitext
16295 <tag width=200 height = "100" depth = '50' square></tag>
16296 !! html/php
16297 <pre>
16298 ''
16299 array (
16300 'width' => '200',
16301 'height' => '100',
16302 'depth' => '50',
16303 'square' => '',
16304 )
16305 </pre>
16306
16307 !! end
16308
16309 !! test
16310 Parser hook: argument containing a forward slash (bug 5344)
16311 !! wikitext
16312 <tag filename='/tmp/bla'></tag>
16313 !! html/php
16314 <pre>
16315 ''
16316 array (
16317 'filename' => '/tmp/bla',
16318 )
16319 </pre>
16320
16321 !! end
16322
16323 !! test
16324 Parser hook: empty input using terminated empty elements (bug 2374)
16325 !! wikitext
16326 <tag foo=bar/>text
16327 !! html/php
16328 <pre>
16329 NULL
16330 array (
16331 'foo' => 'bar',
16332 )
16333 </pre>text
16334
16335 !! end
16336
16337 # </tag> should be output literally since there is no matching tag that begins it
16338 !! test
16339 Parser hook: basic arguments using terminated empty elements (bug 2374)
16340 !! wikitext
16341 <tag width=200 height = "100" depth = '50' square/>
16342 other stuff
16343 </tag>
16344 !! html/php
16345 <pre>
16346 NULL
16347 array (
16348 'width' => '200',
16349 'height' => '100',
16350 'depth' => '50',
16351 'square' => '',
16352 )
16353 </pre>
16354 <p>other stuff
16355 &lt;/tag&gt;
16356 </p>
16357 !! end
16358
16359 ###
16360 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
16361 ###
16362
16363 !! test
16364 Parser hook: static parser hook not inside a comment
16365 !! wikitext
16366 <statictag>hello, world</statictag>
16367 <statictag action=flush/>
16368 !! html/php
16369 <p>hello, world
16370 </p>
16371 !! end
16372
16373
16374 !! test
16375 Parser hook: static parser hook inside a comment
16376 !! wikitext
16377 <!-- <statictag>hello, world</statictag> -->
16378 <statictag action=flush/>
16379 !! html/php
16380 <p><br />
16381 </p>
16382 !! end
16383
16384 # Nested template calls; this case was broken by Parser.php rev 1.506,
16385 # since reverted.
16386
16387 !! article
16388 Template:One-parameter
16389 !! text
16390 (My parameter is: {{{1}}})
16391 !! endarticle
16392
16393 !! article
16394 Template:Map-one-parameter
16395 !! text
16396 {{{{{1}}}|{{{2}}}}}
16397 !! endarticle
16398
16399 !! test
16400 Nested template calls
16401 !! wikitext
16402 {{Map-one-parameter|One-parameter|param}}
16403 !! html
16404 <p>(My parameter is: param)
16405 </p>
16406 !! end
16407
16408
16409 ###
16410 ### Sanitizer
16411 ###
16412
16413 # HTML+Tidy effectively strips out the empty tags completely
16414 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
16415 # which Tidy would have done for the PHP parser had there been content inside it.
16416 !! test
16417 Sanitizer: Closing of open tags
16418 !! wikitext
16419 <s></s><table></table>
16420 !! html
16421 <s></s><table></table>
16422
16423 !! html/parsoid
16424 <p><s></s></p><table></table>
16425 !! end
16426
16427 !! test
16428 Sanitizer: Closing of open but not closed tags
16429 !! wikitext
16430 <s>foo
16431 !! html
16432 <p><s>foo</s>
16433 </p>
16434 !! end
16435
16436 !! test
16437 Sanitizer: Closing of closed but not open tags
16438 !! options
16439 parsoid=wt2html
16440 !! wikitext
16441 </s>
16442 !! html/php+tidy
16443 !! html/parsoid
16444 !! end
16445
16446 !! test
16447 Sanitizer: Closing of closed but not open table tags
16448 !! options
16449 parsoid=wt2html
16450 !! wikitext
16451 Table not started</td></tr></table>
16452 !! html/php+tidy
16453 <p>Table not started</p>
16454 !! html/parsoid
16455 <p>Table not started</p>
16456 !! end
16457
16458 !! test
16459 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
16460 !! wikitext
16461 <span id="æ: v">byte</span>[[#æ: v|backlink]]
16462 !! html
16463 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
16464 </p>
16465 !! end
16466
16467 # In HTML5, the restrictions are that id must contain at least one character,
16468 # and must not contain any space characters.
16469 !! test
16470 Sanitizer: Validating the contents of the id attribute (bug 4515)
16471 !! options
16472 disabled
16473 !! wikitext
16474 <br id="" /><br id="a space" />
16475 !! html
16476 Something ...
16477 !! end
16478
16479 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
16480 !! test
16481 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
16482 !! options
16483 disabled
16484 !! wikitext
16485 <br id="foo" /><br id="foo" />
16486 !! html
16487 Something need to be done. foo-2 ?
16488 !! end
16489
16490 !! test
16491 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
16492 !! wikitext
16493 <div itemscope>
16494 <meta itemprop="hello" content="world">
16495 <meta http-equiv="refresh" content="5">
16496 <meta itemprop="hello" http-equiv="refresh" content="5">
16497 <link itemprop="hello" href="{{SERVER}}">
16498 <link rel="stylesheet" href="{{SERVER}}">
16499 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
16500 </div>
16501 !! html
16502 <div itemscope="">
16503 <p> <meta itemprop="hello" content="world" />
16504 &lt;meta http-equiv="refresh" content="5"&gt;
16505 <meta itemprop="hello" content="5" />
16506 </p>
16507 <link itemprop="hello" href="http&#58;//example.org" />
16508 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
16509 <link itemprop="hello" href="http&#58;//example.org" />
16510 </div>
16511
16512 !! end
16513
16514 !! test
16515 Language converter: output gets cut off unexpectedly (bug 5757)
16516 !! options
16517 language=zh
16518 !! wikitext
16519 this bit is safe: }-
16520
16521 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
16522
16523 then we get cut off here: }-
16524
16525 all additional text is vanished
16526 !! html
16527 <p>this bit is safe: }-
16528 </p><p>but if we add a conversion instance: xxx
16529 </p><p>then we get cut off here: }-
16530 </p><p>all additional text is vanished
16531 </p>
16532 !! end
16533
16534 !! test
16535 Self closed html pairs (bug 5487)
16536 !! options
16537 !! wikitext
16538 <center><font id="bug" />Centered text</center>
16539 <div><font id="bug2" />In div text</div>
16540 !! html
16541 <center>&lt;font id="bug" /&gt;Centered text</center>
16542 <div>&lt;font id="bug2" /&gt;In div text</div>
16543
16544 !! end
16545
16546 #
16547 #
16548 #
16549
16550 !! test
16551 Punctuation: nbsp before exclamation
16552 !! wikitext
16553 C'est grave !
16554 !! html
16555 <p>C'est grave&#160;!
16556 </p>
16557 !! end
16558
16559 !! test
16560 Punctuation: CSS !important (bug 11874)
16561 !! wikitext
16562 <div style="width:50% !important">important</div>
16563 !! html
16564 <div style="width:50% !important">important</div>
16565
16566 !!end
16567
16568 !! test
16569 Punctuation: CSS ! important (bug 11874; with space after)
16570 !! wikitext
16571 <div style="width:50% ! important">important</div>
16572 !! html
16573 <div style="width:50% ! important">important</div>
16574
16575 !!end
16576
16577 !! test
16578 HTML bullet list, closed tags (bug 5497)
16579 !! wikitext
16580 <ul>
16581 <li>One</li>
16582 <li>Two</li>
16583 </ul>
16584 !! html/php
16585 <ul>
16586 <li>One</li>
16587 <li>Two</li>
16588 </ul>
16589
16590 !! html/parsoid
16591 <ul data-parsoid='{"stx":"html"}'>
16592 <li data-parsoid='{"stx":"html"}'>One</li>
16593 <li data-parsoid='{"stx":"html"}'>Two</li>
16594 </ul>
16595
16596 !! end
16597
16598 !! test
16599 HTML bullet list, unclosed tags (bug 5497)
16600 !! wikitext
16601 <ul>
16602 <li>One
16603 <li>Two
16604 </ul>
16605 !! html/php+tidy
16606 <ul>
16607 <li>One</li>
16608 <li>Two</li>
16609 </ul>
16610 !! html/parsoid
16611 <ul data-parsoid='{"stx":"html"}'>
16612 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
16613 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
16614 </ul>
16615
16616 !! end
16617
16618 !! test
16619 HTML ordered list, closed tags (bug 5497)
16620 !! wikitext
16621 <ol>
16622 <li>One</li>
16623 <li>Two</li>
16624 </ol>
16625 !! html/php
16626 <ol>
16627 <li>One</li>
16628 <li>Two</li>
16629 </ol>
16630
16631 !! html/parsoid
16632 <ol data-parsoid='{"stx":"html"}'>
16633 <li data-parsoid='{"stx":"html"}'>One</li>
16634 <li data-parsoid='{"stx":"html"}'>Two</li>
16635 </ol>
16636
16637 !! end
16638
16639 !! test
16640 HTML ordered list, unclosed tags (bug 5497)
16641 !! options
16642 !! wikitext
16643 <ol>
16644 <li>One
16645 <li>Two
16646 </ol>
16647 !! html/php+tidy
16648 <ol>
16649 <li>One</li>
16650 <li>Two</li>
16651 </ol>
16652 !! html/parsoid
16653 <ol data-parsoid='{"stx":"html"}'>
16654 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
16655 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
16656 </ol>
16657
16658 !! end
16659
16660 !! test
16661 HTML nested bullet list, closed tags (bug 5497)
16662 !! wikitext
16663 <ul>
16664 <li>One</li>
16665 <li>Two:
16666 <ul>
16667 <li>Sub-one</li>
16668 <li>Sub-two</li>
16669 </ul>
16670 </li>
16671 </ul>
16672 !! html
16673 <ul>
16674 <li>One</li>
16675 <li>Two:
16676 <ul>
16677 <li>Sub-one</li>
16678 <li>Sub-two</li>
16679 </ul>
16680 </li>
16681 </ul>
16682
16683 !! end
16684
16685 !! test
16686 HTML nested bullet list, open tags (bug 5497)
16687 !! wikitext
16688 <ul>
16689 <li>One
16690 <li>Two:
16691 <ul>
16692 <li>Sub-one
16693 <li>Sub-two
16694 </ul>
16695 </ul>
16696 !! html/php+tidy
16697 <ul>
16698 <li>One</li>
16699 <li>Two:
16700 <ul>
16701 <li>Sub-one</li>
16702 <li>Sub-two</li>
16703 </ul>
16704 </li>
16705 </ul>
16706 !! html/parsoid
16707 <ul>
16708 <li>One
16709 </li>
16710 <li>Two:
16711 <ul>
16712 <li>Sub-one
16713 </li>
16714 <li>Sub-two
16715 </li>
16716 </ul>
16717 </li>
16718 </ul>
16719
16720 !! end
16721
16722 !! test
16723 HTML nested ordered list, closed tags (bug 5497)
16724 !! wikitext
16725 <ol>
16726 <li>One</li>
16727 <li>Two:
16728 <ol>
16729 <li>Sub-one</li>
16730 <li>Sub-two</li>
16731 </ol>
16732 </li>
16733 </ol>
16734 !! html
16735 <ol>
16736 <li>One</li>
16737 <li>Two:
16738 <ol>
16739 <li>Sub-one</li>
16740 <li>Sub-two</li>
16741 </ol>
16742 </li>
16743 </ol>
16744
16745 !! end
16746
16747 !! test
16748 HTML nested ordered list, open tags (bug 5497)
16749 !! wikitext
16750 <ol>
16751 <li>One
16752 <li>Two:
16753 <ol>
16754 <li>Sub-one
16755 <li>Sub-two
16756 </ol>
16757 </ol>
16758 !! html/php
16759 <ol>
16760 <li>One
16761 <li>Two:
16762 <ol>
16763 <li>Sub-one
16764 <li>Sub-two
16765 </ol>
16766 </ol>
16767
16768 !! html/parsoid
16769 <ol>
16770 <li>One
16771 </li>
16772 <li>Two:
16773 <ol>
16774 <li>Sub-one
16775 </li>
16776 <li>Sub-two
16777 </li>
16778 </ol>
16779 </li>
16780 </ol>
16781
16782 !! end
16783
16784 !! test
16785 HTML ordered list item with parameters oddity
16786 !! wikitext
16787 <ol><li id="fragment">One</li>
16788 </ol>
16789 !! html
16790 <ol><li id="fragment">One</li>
16791 </ol>
16792
16793 !! end
16794
16795 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
16796 !!test
16797 bug 5918: autonumbering
16798 !! wikitext
16799 [http://first/] [http://second] [ftp://ftp]
16800
16801 ftp://inlineftp
16802
16803 [mailto:enclosed@mail.tld With target]
16804
16805 [mailto:enclosed@mail.tld]
16806
16807 mailto:inline@mail.tld
16808 !! html/php
16809 <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>
16810 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
16811 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
16812 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
16813 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
16814 </p>
16815 !! html/parsoid
16816 <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>
16817 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
16818 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
16819 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
16820 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
16821 !! end
16822
16823
16824 #
16825 # Security and HTML correctness
16826 # From Nick Jenkins' fuzz testing
16827 #
16828
16829 !! test
16830 Fuzz testing: Parser13
16831 !! wikitext
16832 {|
16833 | http://a|
16834 !! html
16835 <table>
16836 <tr>
16837 <td>
16838 </td>
16839 </tr>
16840 </table>
16841
16842 !! end
16843
16844 !! test
16845 Fuzz testing: Parser14
16846 !! wikitext
16847 == onmouseover= ==
16848 http://__TOC__
16849 !! html
16850 <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>
16851 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16852 <ul>
16853 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
16854 </ul>
16855 </div>
16856
16857
16858 !! html+tidy
16859 <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>
16860 <p>http://</p>
16861 <div id="toc" class="toc">
16862 <div id="toctitle">
16863 <h2>Contents</h2>
16864 </div>
16865 <ul>
16866 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
16867 </ul>
16868 </div>
16869 <p></p>
16870 !! end
16871
16872 !! test
16873 Fuzz testing: Parser14-table
16874 !! wikitext
16875 ==a==
16876 {| STYLE=__TOC__
16877 !! html
16878 <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>
16879 <table style="&#95;_TOC&#95;_">
16880 <tr><td></td></tr>
16881 </table>
16882
16883 !! html+tidy
16884 <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>
16885 <table style="__TOC__">
16886 <tr>
16887 <td></td>
16888 </tr>
16889 </table>
16890 !! end
16891
16892 # Known to produce bogus xml (extra </td>)
16893 !! test
16894 Fuzz testing: Parser16
16895 !! options
16896 noxml
16897 !! wikitext
16898 {|
16899 !https://||||||
16900 !! html
16901 <table>
16902 <tr>
16903 <th>https://</th>
16904 <th></th>
16905 <th></th>
16906 <th>
16907 </td>
16908 </tr>
16909 </table>
16910
16911 !! html+tidy
16912 <table>
16913 <tr>
16914 <th>https://</th>
16915 <th></th>
16916 <th></th>
16917 <th></th>
16918 </tr>
16919 </table>
16920 !! end
16921
16922 !! test
16923 Fuzz testing: Parser21
16924 !! wikitext
16925 {|
16926 ! irc://{{ftp://a" onmouseover="alert('hello world');"
16927 |
16928 !! html
16929 <table>
16930 <tr>
16931 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
16932 </th>
16933 <td>
16934 </td>
16935 </tr>
16936 </table>
16937
16938 !! end
16939
16940 !! test
16941 Fuzz testing: Parser22
16942 !! wikitext
16943 http://===r:::https://b
16944
16945 {|
16946 !! html
16947 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
16948 </p>
16949 <table>
16950 <tr><td></td></tr>
16951 </table>
16952
16953 !! end
16954
16955 # Known to produce bad XML for now
16956 !! test
16957 Fuzz testing: Parser24
16958 !! options
16959 noxml
16960 !! wikitext
16961 {|
16962 {{{|
16963 <u CLASS=
16964 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
16965 <br style="onmouseover='alert(document.cookie);' " />
16966
16967 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
16968 |
16969 !! html
16970 <table>
16971 {{{|
16972 <u class="&#124;">}}}} &gt;
16973 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
16974
16975 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
16976 <tr>
16977 <td></u>
16978 </td>
16979 </tr>
16980 </table>
16981
16982 !! end
16983
16984 # Note: the current result listed for this is not what the original one was,
16985 # but the original bug was JavaScript injection, which is fixed in any case.
16986 # It's not clear that the original result listed was any more correct than the
16987 # current one. Original result:
16988 # <p>{{{|
16989 # </p>
16990 # <li class="&#124;&#124;">
16991 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
16992 !!test
16993 Fuzz testing: Parser25 (bug 6055)
16994 !! wikitext
16995 {{{
16996 |
16997 <LI CLASS=||
16998 >
16999 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
17000 !! html
17001 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17002 </p>
17003 !! end
17004
17005 !!test
17006 Fuzz testing: URL adjacent extension (with space, clean)
17007 !! wikitext
17008 http://example.com <nowiki>junk</nowiki>
17009 !! html/php
17010 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
17011 </p>
17012 !! html/parsoid
17013 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
17014 !! end
17015
17016 !!test
17017 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
17018 !! wikitext
17019 http://example.com<nowiki>junk</nowiki>
17020 !! html/php
17021 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
17022 </p>
17023 !! html/parsoid
17024 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
17025 !! end
17026
17027 !!test
17028 Fuzz testing: URL adjacent extension (no space, dirty; pre)
17029 !! wikitext
17030 http://example.com<pre>junk</pre>
17031 !! html/php
17032 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
17033
17034 !! html/php+tidy
17035 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
17036 <pre>
17037 junk
17038 </pre>
17039 !! html/parsoid
17040 <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>
17041 !!end
17042
17043 !!test
17044 Fuzz testing: image with bogus manual thumbnail
17045 !! wikitext
17046 [[Image:foobar.jpg|thumbnail= ]]
17047 !! html/php
17048 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
17049
17050 !! html/parsoid
17051 <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>
17052 !!end
17053
17054 !! test
17055 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
17056 !! wikitext
17057 <pre dir="&#10;"></pre>
17058 !! html
17059 <pre dir="&#10;"></pre>
17060
17061 !! end
17062
17063 !! test
17064 Parsing optional HTML elements (Bug 6171)
17065 !! options
17066 !! wikitext
17067 <table>
17068 <tr>
17069 <td> Some tabular data</td>
17070 <td> More tabular data ...
17071 <td> And yet som tabular data</td>
17072 </tr>
17073 </table>
17074 !! html
17075 <table>
17076 <tr>
17077 <td> Some tabular data</td>
17078 <td> More tabular data ...
17079 </td><td> And yet som tabular data</td>
17080 </tr>
17081 </table>
17082
17083 !! end
17084
17085 !! test
17086 Correct handling of <td>, <tr> (Bug 6171)
17087 !! options
17088 !! wikitext
17089 <table>
17090 <tr>
17091 <td> Some tabular data</td>
17092 <td> More tabular data ...</td>
17093 <td> And yet som tabular data</td>
17094 </tr>
17095 </table>
17096 !! html
17097 <table>
17098 <tr>
17099 <td> Some tabular data</td>
17100 <td> More tabular data ...</td>
17101 <td> And yet som tabular data</td>
17102 </tr>
17103 </table>
17104
17105 !! end
17106
17107
17108 !! test
17109 Parsing crashing regression (fr:JavaScript)
17110 !! wikitext
17111 </body></x>
17112 !! html
17113 <p>&lt;/body&gt;&lt;/x&gt;
17114 </p>
17115 !! end
17116
17117 !! test
17118 Inline wiki vs wiki block nesting
17119 !! wikitext
17120 '''Bold paragraph
17121
17122 New wiki paragraph
17123 !! html
17124 <p><b>Bold paragraph</b>
17125 </p><p>New wiki paragraph
17126 </p>
17127 !! end
17128
17129 # FIXME: The current php output is documented
17130 # and desired output is the parsoid target.
17131 !! test
17132 Inline HTML vs wiki block nesting
17133 !! wikitext
17134 <b>Bold paragraph
17135
17136 New wiki paragraph
17137 !! html/php
17138 <p><b>Bold paragraph
17139 </p><p>New wiki paragraph</b>
17140 </p>
17141 !! html/parsoid
17142 <p><b>Bold paragraph</b>
17143 </p><p>New wiki paragraph
17144 </p>
17145 !! end
17146
17147 # Original result was this:
17148 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
17149 # </p>
17150 # While that might be marginally more intuitive, maybe, the six-apostrophe
17151 # construct is clearly pathological and the result stated here (which is what
17152 # the parser actually does) is about as reasonable as anything.
17153 !!test
17154 Mixing markup for italics and bold
17155 !! options
17156 !! wikitext
17157 '''bold''''''bold''bolditalics'''''
17158 !! html
17159 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
17160 </p>
17161 !! end
17162
17163
17164 !! article
17165 Xyzzyx
17166 !! text
17167 Article for special page transclusion test
17168 !! endarticle
17169
17170 !! test
17171 Special page transclusion
17172 !! options
17173 !! wikitext
17174 {{Special:Prefixindex/Xyzzyx}}
17175 !! html
17176 <div class="mw-prefixindex-body"><ul class="mw-prefixindex-list"><li> <a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a> </li>
17177 </ul></div>
17178
17179 !! end
17180
17181 !! test
17182 Special page transclusion twice (bug 5021)
17183 !! options
17184 !! wikitext
17185 {{Special:Prefixindex/Xyzzyx}}
17186 {{Special:Prefixindex/Xyzzyx}}
17187 !! html
17188 <div class="mw-prefixindex-body"><ul class="mw-prefixindex-list"><li> <a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a> </li>
17189 </ul></div>
17190 <div class="mw-prefixindex-body"><ul class="mw-prefixindex-list"><li> <a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a> </li>
17191 </ul></div>
17192
17193 !! end
17194
17195 !! test
17196 Transclusion of default MediaWiki message
17197 !! wikitext
17198 {{MediaWiki:Mainpage}}
17199 !! html
17200 <p>Main Page
17201 </p>
17202 !! end
17203
17204 !! test
17205 Transclusion of nonexistent MediaWiki message
17206 !! wikitext
17207 {{MediaWiki:Mainpagexxx}}
17208 !! html
17209 <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>
17210 </p>
17211 !! end
17212
17213 !! test
17214 Transclusion of MediaWiki message with underscore
17215 !! wikitext
17216 {{MediaWiki:history_short}}
17217 !! html
17218 <p>History
17219 </p>
17220 !! end
17221
17222 !! test
17223 Transclusion of MediaWiki message with space
17224 !! wikitext
17225 {{MediaWiki:history short}}
17226 !! html
17227 <p>History
17228 </p>
17229 !! end
17230
17231 !! test
17232 Invalid header with following text
17233 !! wikitext
17234 = x = y
17235 !! html
17236 <p>= x = y
17237 </p>
17238 !! end
17239
17240
17241 !! test
17242 Section extraction test (section 0)
17243 !! options
17244 section=0
17245 !! wikitext
17246 start
17247 ==a==
17248 ===aa===
17249 ====aaa====
17250 ==b==
17251 ===ba===
17252 ===bb===
17253 ====bba====
17254 ===bc===
17255 ==c==
17256 ===ca===
17257 !! html/php
17258 start
17259 !! end
17260
17261 !! test
17262 Section extraction test (section 1)
17263 !! options
17264 section=1
17265 !! wikitext
17266 start
17267 ==a==
17268 ===aa===
17269 ====aaa====
17270 ==b==
17271 ===ba===
17272 ===bb===
17273 ====bba====
17274 ===bc===
17275 ==c==
17276 ===ca===
17277 !! html/php
17278 ==a==
17279 ===aa===
17280 ====aaa====
17281 !! end
17282
17283 !! test
17284 Section extraction test (section 2)
17285 !! options
17286 section=2
17287 !! wikitext
17288 start
17289 ==a==
17290 ===aa===
17291 ====aaa====
17292 ==b==
17293 ===ba===
17294 ===bb===
17295 ====bba====
17296 ===bc===
17297 ==c==
17298 ===ca===
17299 !! html/php
17300 ===aa===
17301 ====aaa====
17302 !! end
17303
17304 !! test
17305 Section extraction test (section 3)
17306 !! options
17307 section=3
17308 !! wikitext
17309 start
17310 ==a==
17311 ===aa===
17312 ====aaa====
17313 ==b==
17314 ===ba===
17315 ===bb===
17316 ====bba====
17317 ===bc===
17318 ==c==
17319 ===ca===
17320 !! html/php
17321 ====aaa====
17322 !! end
17323
17324 !! test
17325 Section extraction test (section 4)
17326 !! options
17327 section=4
17328 !! wikitext
17329 start
17330 ==a==
17331 ===aa===
17332 ====aaa====
17333 ==b==
17334 ===ba===
17335 ===bb===
17336 ====bba====
17337 ===bc===
17338 ==c==
17339 ===ca===
17340 !! html/php
17341 ==b==
17342 ===ba===
17343 ===bb===
17344 ====bba====
17345 ===bc===
17346 !! end
17347
17348 !! test
17349 Section extraction test (section 5)
17350 !! options
17351 section=5
17352 !! wikitext
17353 start
17354 ==a==
17355 ===aa===
17356 ====aaa====
17357 ==b==
17358 ===ba===
17359 ===bb===
17360 ====bba====
17361 ===bc===
17362 ==c==
17363 ===ca===
17364 !! html/php
17365 ===ba===
17366 !! end
17367
17368 !! test
17369 Section extraction test (section 6)
17370 !! options
17371 section=6
17372 !! wikitext
17373 start
17374 ==a==
17375 ===aa===
17376 ====aaa====
17377 ==b==
17378 ===ba===
17379 ===bb===
17380 ====bba====
17381 ===bc===
17382 ==c==
17383 ===ca===
17384 !! html/php
17385 ===bb===
17386 ====bba====
17387 !! end
17388
17389 !! test
17390 Section extraction test (section 7)
17391 !! options
17392 section=7
17393 !! wikitext
17394 start
17395 ==a==
17396 ===aa===
17397 ====aaa====
17398 ==b==
17399 ===ba===
17400 ===bb===
17401 ====bba====
17402 ===bc===
17403 ==c==
17404 ===ca===
17405 !! html/php
17406 ====bba====
17407 !! end
17408
17409 !! test
17410 Section extraction test (section 8)
17411 !! options
17412 section=8
17413 !! wikitext
17414 start
17415 ==a==
17416 ===aa===
17417 ====aaa====
17418 ==b==
17419 ===ba===
17420 ===bb===
17421 ====bba====
17422 ===bc===
17423 ==c==
17424 ===ca===
17425 !! html/php
17426 ===bc===
17427 !! end
17428
17429 !! test
17430 Section extraction test (section 9)
17431 !! options
17432 section=9
17433 !! wikitext
17434 start
17435 ==a==
17436 ===aa===
17437 ====aaa====
17438 ==b==
17439 ===ba===
17440 ===bb===
17441 ====bba====
17442 ===bc===
17443 ==c==
17444 ===ca===
17445 !! html/php
17446 ==c==
17447 ===ca===
17448 !! end
17449
17450 !! test
17451 Section extraction test (section 10)
17452 !! options
17453 section=10
17454 !! wikitext
17455 start
17456 ==a==
17457 ===aa===
17458 ====aaa====
17459 ==b==
17460 ===ba===
17461 ===bb===
17462 ====bba====
17463 ===bc===
17464 ==c==
17465 ===ca===
17466 !! html/php
17467 ===ca===
17468 !! end
17469
17470 !! test
17471 Section extraction test (nonexistent section 11)
17472 !! options
17473 section=11
17474 !! wikitext
17475 start
17476 ==a==
17477 ===aa===
17478 ====aaa====
17479 ==b==
17480 ===ba===
17481 ===bb===
17482 ====bba====
17483 ===bc===
17484 ==c==
17485 ===ca===
17486 !! html/php
17487 !! end
17488
17489 !! test
17490 Section extraction test with bogus heading (section 1)
17491 !! options
17492 section=1
17493 !! wikitext
17494 ==a==
17495 ==bogus== not a legal section
17496 ==b==
17497 !! html/php
17498 ==a==
17499 ==bogus== not a legal section
17500 !! end
17501
17502 !! test
17503 Section extraction test with bogus heading (section 2)
17504 !! options
17505 section=2
17506 !! wikitext
17507 ==a==
17508 ==bogus== not a legal section
17509 ==b==
17510 !! html/php
17511 ==b==
17512 !! end
17513
17514 !! test
17515 Section extraction test with comment after heading (section 1)
17516 !! options
17517 section=1
17518 !! wikitext
17519 ==a==
17520 ==b== <!-- -->
17521 ==c==
17522 !! html/php
17523 ==a==
17524 !! end
17525
17526 !! test
17527 Section extraction test with comment after heading (section 2)
17528 !! options
17529 section=2
17530 !! wikitext
17531 ==a==
17532 ==b== <!-- -->
17533 ==c==
17534 !! html/php
17535 ==b== <!-- -->
17536 !! end
17537
17538 !! test
17539 Section extraction test with bogus <nowiki> heading (section 1)
17540 !! options
17541 section=1
17542 !! wikitext
17543 ==a==
17544 ==bogus== <nowiki>not a legal section</nowiki>
17545 ==b==
17546 !! html/php
17547 ==a==
17548 ==bogus== <nowiki>not a legal section</nowiki>
17549 !! end
17550
17551 !! test
17552 Section extraction test with bogus <nowiki> heading (section 2)
17553 !! options
17554 section=2
17555 !! wikitext
17556 ==a==
17557 ==bogus== <nowiki>not a legal section</nowiki>
17558 ==b==
17559 !! html/php
17560 ==b==
17561 !! end
17562
17563 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
17564 # instead of respecting commented sections
17565 !! test
17566 Section extraction prefixed by comment (section 1)
17567 !! options
17568 section=1
17569 !! wikitext
17570 <!-- -->==sec1==
17571 ==sec2==
17572 !! html/php
17573 ==sec2==
17574 !!end
17575
17576 !! test
17577 Section extraction prefixed by comment (section 2)
17578 !! options
17579 section=2
17580 !! wikitext
17581 <!-- -->==sec1==
17582 ==sec2==
17583 !! html/php
17584
17585 !!end
17586
17587 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
17588 # instead of respecting HTML-style headings
17589 !! test
17590 Section extraction, mixed wiki and html (section 1)
17591 !! options
17592 section=1
17593 !! wikitext
17594 <h2>unmarked</h2>
17595 unmarked
17596 ==1==
17597 one
17598 ==2==
17599 two
17600 !! html/php
17601 ==1==
17602 one
17603 !! end
17604
17605 !! test
17606 Section extraction, mixed wiki and html (section 2)
17607 !! options
17608 section=2
17609 !! wikitext
17610 <h2>unmarked</h2>
17611 unmarked
17612 ==1==
17613 one
17614 ==2==
17615 two
17616 !! html/php
17617 ==2==
17618 two
17619 !! end
17620
17621
17622 # Formerly testing for bug 3342
17623 !! test
17624 Section extraction, heading surrounded by <noinclude>
17625 !! options
17626 section=1
17627 !! wikitext
17628 <noinclude>==unmarked==</noinclude>
17629 ==marked==
17630 !! html/php
17631 ==marked==
17632 !!end
17633
17634 # Test behavior of bug 19910
17635 !! test
17636 Sectiion with all-equals
17637 !! options
17638 section=2
17639 !! wikitext
17640 ===
17641 The line above must have a trailing space
17642 === <!--
17643 --> <!-- -->
17644 But just in case it doesn't...
17645 !! html/php
17646 === <!--
17647 --> <!-- -->
17648 But just in case it doesn't...
17649 !! end
17650
17651 !! test
17652 Section replacement test (section 0)
17653 !! options
17654 replace=0,"xxx"
17655 !! wikitext
17656 start
17657 ==a==
17658 ===aa===
17659 ====aaa====
17660 ==b==
17661 ===ba===
17662 ===bb===
17663 ====bba====
17664 ===bc===
17665 ==c==
17666 ===ca===
17667 !! html/php
17668 xxx
17669
17670 ==a==
17671 ===aa===
17672 ====aaa====
17673 ==b==
17674 ===ba===
17675 ===bb===
17676 ====bba====
17677 ===bc===
17678 ==c==
17679 ===ca===
17680 !! end
17681
17682 !! test
17683 Section replacement test (section 1)
17684 !! options
17685 replace=1,"xxx"
17686 !! wikitext
17687 start
17688 ==a==
17689 ===aa===
17690 ====aaa====
17691 ==b==
17692 ===ba===
17693 ===bb===
17694 ====bba====
17695 ===bc===
17696 ==c==
17697 ===ca===
17698 !! html/php
17699 start
17700 xxx
17701
17702 ==b==
17703 ===ba===
17704 ===bb===
17705 ====bba====
17706 ===bc===
17707 ==c==
17708 ===ca===
17709 !! end
17710
17711 !! test
17712 Section replacement test (section 2)
17713 !! options
17714 replace=2,"xxx"
17715 !! wikitext
17716 start
17717 ==a==
17718 ===aa===
17719 ====aaa====
17720 ==b==
17721 ===ba===
17722 ===bb===
17723 ====bba====
17724 ===bc===
17725 ==c==
17726 ===ca===
17727 !! html/php
17728 start
17729 ==a==
17730 xxx
17731
17732 ==b==
17733 ===ba===
17734 ===bb===
17735 ====bba====
17736 ===bc===
17737 ==c==
17738 ===ca===
17739 !! end
17740
17741 !! test
17742 Section replacement test (section 3)
17743 !! options
17744 replace=3,"xxx"
17745 !! wikitext
17746 start
17747 ==a==
17748 ===aa===
17749 ====aaa====
17750 ==b==
17751 ===ba===
17752 ===bb===
17753 ====bba====
17754 ===bc===
17755 ==c==
17756 ===ca===
17757 !! html/php
17758 start
17759 ==a==
17760 ===aa===
17761 xxx
17762
17763 ==b==
17764 ===ba===
17765 ===bb===
17766 ====bba====
17767 ===bc===
17768 ==c==
17769 ===ca===
17770 !! end
17771
17772 !! test
17773 Section replacement test (section 4)
17774 !! options
17775 replace=4,"xxx"
17776 !! wikitext
17777 start
17778 ==a==
17779 ===aa===
17780 ====aaa====
17781 ==b==
17782 ===ba===
17783 ===bb===
17784 ====bba====
17785 ===bc===
17786 ==c==
17787 ===ca===
17788 !! html/php
17789 start
17790 ==a==
17791 ===aa===
17792 ====aaa====
17793 xxx
17794
17795 ==c==
17796 ===ca===
17797 !! end
17798
17799 !! test
17800 Section replacement test (section 5)
17801 !! options
17802 replace=5,"xxx"
17803 !! wikitext
17804 start
17805 ==a==
17806 ===aa===
17807 ====aaa====
17808 ==b==
17809 ===ba===
17810 ===bb===
17811 ====bba====
17812 ===bc===
17813 ==c==
17814 ===ca===
17815 !! html/php
17816 start
17817 ==a==
17818 ===aa===
17819 ====aaa====
17820 ==b==
17821 xxx
17822
17823 ===bb===
17824 ====bba====
17825 ===bc===
17826 ==c==
17827 ===ca===
17828 !! end
17829
17830 !! test
17831 Section replacement test (section 6)
17832 !! options
17833 replace=6,"xxx"
17834 !! wikitext
17835 start
17836 ==a==
17837 ===aa===
17838 ====aaa====
17839 ==b==
17840 ===ba===
17841 ===bb===
17842 ====bba====
17843 ===bc===
17844 ==c==
17845 ===ca===
17846 !! html/php
17847 start
17848 ==a==
17849 ===aa===
17850 ====aaa====
17851 ==b==
17852 ===ba===
17853 xxx
17854
17855 ===bc===
17856 ==c==
17857 ===ca===
17858 !! end
17859
17860 !! test
17861 Section replacement test (section 7)
17862 !! options
17863 replace=7,"xxx"
17864 !! wikitext
17865 start
17866 ==a==
17867 ===aa===
17868 ====aaa====
17869 ==b==
17870 ===ba===
17871 ===bb===
17872 ====bba====
17873 ===bc===
17874 ==c==
17875 ===ca===
17876 !! html/php
17877 start
17878 ==a==
17879 ===aa===
17880 ====aaa====
17881 ==b==
17882 ===ba===
17883 ===bb===
17884 xxx
17885
17886 ===bc===
17887 ==c==
17888 ===ca===
17889 !! end
17890
17891 !! test
17892 Section replacement test (section 8)
17893 !! options
17894 replace=8,"xxx"
17895 !! wikitext
17896 start
17897 ==a==
17898 ===aa===
17899 ====aaa====
17900 ==b==
17901 ===ba===
17902 ===bb===
17903 ====bba====
17904 ===bc===
17905 ==c==
17906 ===ca===
17907 !! html/php
17908 start
17909 ==a==
17910 ===aa===
17911 ====aaa====
17912 ==b==
17913 ===ba===
17914 ===bb===
17915 ====bba====
17916 xxx
17917
17918 ==c==
17919 ===ca===
17920 !!end
17921
17922 !! test
17923 Section replacement test (section 9)
17924 !! options
17925 replace=9,"xxx"
17926 !! wikitext
17927 start
17928 ==a==
17929 ===aa===
17930 ====aaa====
17931 ==b==
17932 ===ba===
17933 ===bb===
17934 ====bba====
17935 ===bc===
17936 ==c==
17937 ===ca===
17938 !! html/php
17939 start
17940 ==a==
17941 ===aa===
17942 ====aaa====
17943 ==b==
17944 ===ba===
17945 ===bb===
17946 ====bba====
17947 ===bc===
17948 xxx
17949 !! end
17950
17951 !! test
17952 Section replacement test (section 10)
17953 !! options
17954 replace=10,"xxx"
17955 !! wikitext
17956 start
17957 ==a==
17958 ===aa===
17959 ====aaa====
17960 ==b==
17961 ===ba===
17962 ===bb===
17963 ====bba====
17964 ===bc===
17965 ==c==
17966 ===ca===
17967 !! html/php
17968 start
17969 ==a==
17970 ===aa===
17971 ====aaa====
17972 ==b==
17973 ===ba===
17974 ===bb===
17975 ====bba====
17976 ===bc===
17977 ==c==
17978 xxx
17979 !! end
17980
17981 !! test
17982 Section replacement test with initial whitespace (bug 13728)
17983 !! options
17984 replace=2,"xxx"
17985 !! wikitext
17986 Preformatted initial line
17987 ==a==
17988 ===a===
17989 !! html/php
17990 Preformatted initial line
17991 ==a==
17992 xxx
17993 !! end
17994
17995
17996 !! test
17997 Section extraction, heading followed by pre with 20 spaces (bug 6398)
17998 !! options
17999 section=1
18000 !! wikitext
18001 ==a==
18002 a
18003 !! html/php
18004 ==a==
18005 a
18006 !! end
18007
18008 !! test
18009 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
18010 !! options
18011 section=1
18012 !! wikitext
18013 ==a==
18014 a
18015 !! html/php
18016 ==a==
18017 a
18018 !! end
18019
18020
18021 !! test
18022 Section extraction, <pre> around bogus header (bug 10309)
18023 !! options
18024 noxml section=2
18025 !! wikitext
18026 == Section One ==
18027 <pre>
18028 =======
18029 </pre>
18030
18031 == Section Two ==
18032 stuff
18033 !! html/php
18034 == Section Two ==
18035 stuff
18036 !! end
18037
18038 !! test
18039 Section replacement, <pre> around bogus header (bug 10309)
18040 !! options
18041 noxml replace=2,"xxx"
18042 !! wikitext
18043 == Section One ==
18044 <pre>
18045 =======
18046 </pre>
18047
18048 == Section Two ==
18049 stuff
18050 !! html/php
18051 == Section One ==
18052 <pre>
18053 =======
18054 </pre>
18055
18056 xxx
18057 !! end
18058
18059
18060 !! test
18061 Handling of &#x0A; in URLs
18062 !! wikitext
18063 ** irc://&#x0A;a
18064 !! html/php
18065 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18066
18067 !! html/parsoid
18068 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
18069 a">irc://
18070 a</a></li></ul></li></ul>
18071 !! end
18072
18073 !! test
18074 Handling of %0A in URLs
18075 !! wikitext
18076 ** irc://%0Aa
18077 !! html/php
18078 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18079
18080 !! html/parsoid
18081 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18082 !! end
18083
18084
18085 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
18086 !! test
18087 5 quotes, code coverage +1 line
18088 !! options
18089 parsoid=wt2html
18090 !! wikitext
18091 '''''
18092 !! html/php
18093 !! html/parsoid
18094 <p><b><i></i></b></p>
18095 !! end
18096
18097 # same html as previous, but wikitext adjusted to match parsoid html2wt
18098 # note that wt2html and html2html will put the <i> before the <b>
18099 !! test
18100 5 quotes, code coverage +1 line w/ nowiki (1)
18101 !! options
18102 parsoid=wt2wt,html2wt
18103 !! wikitext
18104 '''''<nowiki/>'''''
18105 !! html/php
18106 <p><i></i>
18107 </p>
18108 !! html/parsoid
18109 <p><b><i></i></b></p>
18110 !! end
18111
18112 # same as previous, just swapping the <i> and <b>
18113 !! test
18114 5 quotes, code coverage +1 line w/ nowiki (2)
18115 !! wikitext
18116 '''''<nowiki/>'''''
18117 !! html/php
18118 <p><i></i>
18119 </p>
18120 !! html/parsoid
18121 <p><i><b></b></i></p>
18122 !! end
18123
18124 !! test
18125 Special:Search page linking.
18126 !! wikitext
18127 {{Special:search}}
18128 !! html
18129 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
18130 </p>
18131 !! end
18132
18133 !! test
18134 {{!}} is a magic word
18135 !! wikitext
18136 {{!}} is a magic word there and {{!}} is still a magic word here
18137 | is not a magic word here but {{!}} is still a magic word here
18138 !! html/php
18139 <p>| is a magic word there and | is still a magic word here
18140 | is not a magic word here but | is still a magic word here
18141 </p>
18142 !! html/parsoid
18143 <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
18144 | 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>
18145
18146 !! end
18147
18148 !! test
18149 Say the magic word
18150 !! options
18151 title=[[Parser test]]
18152 !! wikitext
18153 * {{PAGENAME}}
18154 * {{PAGENAMEE}}
18155 * {{FULLPAGENAME}}
18156 * {{FULLPAGENAMEE}}
18157 * {{BASEPAGENAME}}
18158 * {{BASEPAGENAMEE}}
18159 * {{SUBPAGENAME}}
18160 * {{SUBPAGENAMEE}}
18161 * {{ROOTPAGENAME}}
18162 * {{ROOTPAGENAMEE}}
18163 * {{TALKPAGENAME}}
18164 * {{TALKPAGENAMEE}}
18165 * {{SUBJECTPAGENAME}}
18166 * {{SUBJECTPAGENAMEE}}
18167 * {{NAMESPACEE}}
18168 * {{NAMESPACE}}
18169 * {{NAMESPACENUMBER}}
18170 * {{TALKSPACE}}
18171 * {{TALKSPACEE}}
18172 * {{SUBJECTSPACE}}
18173 * {{SUBJECTSPACEE}}
18174 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
18175 !! html
18176 <ul><li> Parser test</li>
18177 <li> Parser_test</li>
18178 <li> Parser test</li>
18179 <li> Parser_test</li>
18180 <li> Parser test</li>
18181 <li> Parser_test</li>
18182 <li> Parser test</li>
18183 <li> Parser_test</li>
18184 <li> Parser test</li>
18185 <li> Parser_test</li>
18186 <li> Talk:Parser test</li>
18187 <li> Talk:Parser_test</li>
18188 <li> Parser test</li>
18189 <li> Parser_test</li>
18190 <li> </li>
18191 <li> </li>
18192 <li> 0</li>
18193 <li> Talk</li>
18194 <li> Talk</li>
18195 <li> </li>
18196 <li> </li>
18197 <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>
18198
18199 !! end
18200 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
18201
18202 !! test
18203 Gallery
18204 !! wikitext
18205 <gallery>
18206 image1.png |
18207 image2.gif|||||
18208
18209 image3|
18210 image4 |300px| centre
18211 image5.svg| http://///////
18212 [[x|xx]]]]
18213 * image6
18214 </gallery>
18215 !! html
18216 <ul class="gallery mw-gallery-traditional">
18217 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18218 <div class="thumb" style="height: 150px;">Image1.png</div>
18219 <div class="gallerytext">
18220 </div>
18221 </div></li>
18222 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18223 <div class="thumb" style="height: 150px;">Image2.gif</div>
18224 <div class="gallerytext">
18225 <p>||||
18226 </p>
18227 </div>
18228 </div></li>
18229 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18230 <div class="thumb" style="height: 150px;">Image3</div>
18231 <div class="gallerytext">
18232 </div>
18233 </div></li>
18234 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18235 <div class="thumb" style="height: 150px;">Image4</div>
18236 <div class="gallerytext">
18237 <p>300px| centre
18238 </p>
18239 </div>
18240 </div></li>
18241 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18242 <div class="thumb" style="height: 150px;">Image5.svg</div>
18243 <div class="gallerytext">
18244 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
18245 </p>
18246 </div>
18247 </div></li>
18248 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18249 <div class="thumb" style="height: 150px;">* image6</div>
18250 <div class="gallerytext">
18251 </div>
18252 </div></li>
18253 </ul>
18254
18255 !! end
18256
18257 !! test
18258 Gallery (with options)
18259 !! wikitext
18260 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
18261 File:Nonexistent.jpg|caption
18262 File:Nonexistent.jpg
18263 image:foobar.jpg|some '''caption''' [[Main Page]]
18264 image:foobar.jpg
18265 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
18266 </gallery>
18267 !! html
18268 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
18269 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
18270 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18271 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18272 <div class="gallerytext">
18273 <p>caption
18274 </p>
18275 </div>
18276 </div></li>
18277 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18278 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18279 <div class="gallerytext">
18280 </div>
18281 </div></li>
18282 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18283 <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>
18284 <div class="gallerytext">
18285 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18286 </p>
18287 </div>
18288 </div></li>
18289 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18290 <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>
18291 <div class="gallerytext">
18292 </div>
18293 </div></li>
18294 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18295 <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>
18296 <div class="gallerytext">
18297 <p>Blabla|blabla.
18298 </p>
18299 </div>
18300 </div></li>
18301 </ul>
18302
18303 !! end
18304
18305 !! test
18306 Gallery with link that has fragment
18307 !! wikitext
18308 <gallery>
18309 image:foobar.jpg|link=Main_Page
18310 image:foobar.jpg|link=Main_Page#section
18311 image:foobar.jpg|link=Main Page#section|caption
18312 </gallery>
18313 !! html
18314 <ul class="gallery mw-gallery-traditional">
18315 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18316 <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>
18317 <div class="gallerytext">
18318 </div>
18319 </div></li>
18320 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18321 <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>
18322 <div class="gallerytext">
18323 </div>
18324 </div></li>
18325 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18326 <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>
18327 <div class="gallerytext">
18328 <p>caption
18329 </p>
18330 </div>
18331 </div></li>
18332 </ul>
18333
18334 !! end
18335
18336 !! test
18337 Gallery with wikitext inside caption
18338 !! wikitext
18339 <gallery>
18340 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
18341 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
18342 </gallery>
18343 !! html
18344 <ul class="gallery mw-gallery-traditional">
18345 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18346 <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>
18347 <div class="gallerytext">
18348 <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>
18349 </p>
18350 </div>
18351 </div></li>
18352 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18353 <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>
18354 <div class="gallerytext">
18355 <p>This is a test template
18356 </p>
18357 </div>
18358 </div></li>
18359 </ul>
18360
18361 !! end
18362
18363 !! test
18364 gallery (with showfilename option)
18365 !! wikitext
18366 <gallery showfilename>
18367 File:Nonexistent.jpg|caption
18368 File:Nonexistent.jpg
18369 image:foobar.jpg|some '''caption''' [[Main Page]]
18370 File:Foobar.jpg
18371 </gallery>
18372 !! html
18373 <ul class="gallery mw-gallery-traditional">
18374 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18375 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18376 <div class="gallerytext">
18377 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
18378 caption
18379 </p>
18380 </div>
18381 </div></li>
18382 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18383 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18384 <div class="gallerytext">
18385 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
18386 </p>
18387 </div>
18388 </div></li>
18389 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18390 <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>
18391 <div class="gallerytext">
18392 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
18393 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18394 </p>
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/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>
18399 <div class="gallerytext">
18400 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
18401 </p>
18402 </div>
18403 </div></li>
18404 </ul>
18405
18406 !! end
18407
18408 !! test
18409 Gallery (with namespace-less filenames)
18410 !! wikitext
18411 <gallery>
18412 File:Nonexistent.jpg
18413 Nonexistent.jpg
18414 image:foobar.jpg
18415 foobar.jpg
18416 </gallery>
18417 !! html
18418 <ul class="gallery mw-gallery-traditional">
18419 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18420 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18421 <div class="gallerytext">
18422 </div>
18423 </div></li>
18424 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18425 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18426 <div class="gallerytext">
18427 </div>
18428 </div></li>
18429 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18430 <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>
18431 <div class="gallerytext">
18432 </div>
18433 </div></li>
18434 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18435 <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>
18436 <div class="gallerytext">
18437 </div>
18438 </div></li>
18439 </ul>
18440
18441 !! end
18442
18443 !! test
18444 HTML Hex character encoding (spells the word "JavaScript")
18445 !! options
18446 parsoid=wt2html,wt2wt,html2html
18447 !! wikitext
18448 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
18449 !! html/php
18450 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
18451 </p>
18452 !! html/php+tidy
18453 <p>JavaScript</p>
18454 !! html/parsoid
18455 <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>
18456 !! end
18457
18458 !! test
18459 HTML Hex character encoding bogus encoding (bug 26437 regression check)
18460 !! wikitext
18461 &#xsee;&#XSEE;
18462 !! html/php
18463 <p>&amp;#xsee;&amp;#XSEE;
18464 </p>
18465 !! html/parsoid
18466 <p>&amp;#xsee;&amp;#XSEE;</p>
18467 !! end
18468
18469 !! test
18470 HTML Hex character encoding mixed case
18471 !! options
18472 parsoid=wt2html,wt2wt,html2html
18473 !! wikitext
18474 &#xEE;&#Xee;
18475 !! html/php
18476 <p>&#xee;&#xee;
18477 </p>
18478 !! html/php+tidy
18479 <p>îî</p>
18480 !! html/parsoid
18481 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
18482 !! end
18483
18484 # See: http://www.w3.org/TR/html5/syntax.html#character-references
18485 # Note that U+000C (form feed) is not a valid XML character, so
18486 # it is banned even though allowed in HTML5.
18487 !! test
18488 Illegal character references (T106578)
18489 !! wikitext
18490 ; Null: &#00;
18491 ; FF: &#xC;
18492 ; CR: &#xD;
18493 ; Control (low): &#8;
18494 ; Control (high): &#x7F; &#x9F;
18495 ; Surrogate: &#xD83D;&#xDCA9;
18496 ; This is an okay astral character: &#x1F4A9;
18497 !! html+tidy
18498 <dl>
18499 <dt>Null</dt>
18500 <dd>&amp;#00;</dd>
18501 <dt>FF</dt>
18502 <dd>&amp;#xC;</dd>
18503 <dt>CR</dt>
18504 <dd>&amp;#xD;</dd>
18505 <dt>Control (low)</dt>
18506 <dd>&amp;#8;</dd>
18507 <dt>Control (high)</dt>
18508 <dd>&amp;#x7F; &amp;#x9F;</dd>
18509 <dt>Surrogate</dt>
18510 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
18511 <dt>This is an okay astral character</dt>
18512 <dd>💩</dd>
18513 </dl>
18514 !! end
18515
18516 !! test
18517 __FORCETOC__ override
18518 !! wikitext
18519 __NEWSECTIONLINK__
18520 __FORCETOC__
18521 !! html/php
18522 <p><br />
18523 </p>
18524 !! end
18525
18526 !! test
18527 ISBN code coverage
18528 !! wikitext
18529 ISBN 978-0-1234-56&#x20;789
18530 !! html
18531 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
18532 </p>
18533 !! html+tidy
18534 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
18535 !! html/parsoid
18536 <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>
18537 !! end
18538
18539 !! test
18540 ISBN followed by 5 spaces
18541 !! wikitext
18542 ISBN
18543 !! html
18544 <p>ISBN
18545 </p>
18546 !! end
18547
18548 !! test
18549 Double ISBN
18550 !! wikitext
18551 ISBN ISBN 1234567890
18552 !! html/php
18553 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18554 </p>
18555 !! html/parsoid
18556 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
18557 !! end
18558
18559 # Uppercase X and lowercase x as well
18560 !! test
18561 ISBN with an X
18562 !! wikitext
18563 ISBN 3-462-04561-X
18564 ISBN 3-462-04561-x
18565 ISBN 080442957X
18566 ISBN 080442957x
18567 ISBN 978080442957X
18568 ISBN 978080442957x
18569 !! html/php
18570 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
18571 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
18572 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
18573 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
18574 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
18575 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
18576 </p>
18577 !! html/parsoid
18578 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
18579 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
18580 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
18581 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
18582 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
18583 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
18584 !! end
18585
18586 !! test
18587 ISBN with empty prefix (parsoid test)
18588 !! wikitext
18589 ISBN 1234567890
18590 !! html/php
18591 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18592 </p>
18593 !! html/parsoid
18594 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
18595 !! end
18596
18597 !! test
18598 Bug 22905: <abbr> followed by ISBN followed by </a>
18599 !! wikitext
18600 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
18601 !! html/php
18602 <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>
18603 </p>
18604 !! html/parsoid
18605 <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>
18606 !! end
18607
18608 !! test
18609 Double RFC
18610 !! wikitext
18611 RFC RFC 1234
18612 !! html
18613 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
18614 </p>
18615 !! end
18616
18617 !! test
18618 Double RFC with a wiki link
18619 !! wikitext
18620 RFC [[RFC 1234]]
18621 !! html
18622 <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>
18623 </p>
18624 !! end
18625
18626 !! test
18627 RFC code coverage
18628 !! wikitext
18629 RFC 983&#x20;987
18630 !! html
18631 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
18632 </p>
18633 !! html+tidy
18634 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
18635 !! end
18636
18637 !! test
18638 Centre-aligned image
18639 !! wikitext
18640 [[Image:foobar.jpg|centre]]
18641 !! html
18642 <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>
18643
18644 !!end
18645
18646 !! test
18647 None-aligned image
18648 !! wikitext
18649 [[Image:foobar.jpg|none]]
18650 !! html
18651 <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>
18652
18653 !!end
18654
18655 !! test
18656 Width + Height sized image (using px) (height is ignored)
18657 !! wikitext
18658 [[Image:foobar.jpg|640x480px]]
18659 !! html
18660 <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>
18661 </p>
18662 !!end
18663
18664 !! test
18665 Width-sized image (using px, no following whitespace)
18666 !! wikitext
18667 [[Image:foobar.jpg|640px]]
18668 !! html
18669 <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>
18670 </p>
18671 !!end
18672
18673 !! test
18674 Width-sized image (using px, with following whitespace - test regression from r39467)
18675 !! wikitext
18676 [[Image:foobar.jpg|640px ]]
18677 !! html
18678 <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>
18679 </p>
18680 !!end
18681
18682 !! test
18683 Width-sized image (using px, with preceding whitespace - test regression from r39467)
18684 !! wikitext
18685 [[Image:foobar.jpg| 640px]]
18686 !! html
18687 <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>
18688 </p>
18689 !!end
18690
18691 !! test
18692 Image with page parameter
18693 !! options
18694 djvu
18695 !! wikitext
18696 [[File:LoremIpsum.djvu|page=2]]
18697 !! html/php
18698 <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>
18699 </p>
18700 !! html/parsoid
18701 <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>
18702 !! end
18703
18704 !! test
18705 Another italics / bold test
18706 !! wikitext
18707 ''' ''x'
18708 !! html
18709 <pre>'<i> </i>x'
18710 </pre>
18711 !!end
18712
18713 # FIXME: The php output seems broken. It's interleaving some open/close tags.
18714 !! test
18715 dt/dd/dl test
18716 !! wikitext
18717 :;;;::
18718 !! html/php
18719 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
18720
18721 !! html/parsoid
18722 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
18723
18724 !!end
18725
18726
18727 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
18728 !! test
18729 Images with the "|" character in the comment
18730 !! wikitext
18731 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
18732 !! html/php
18733 <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>
18734
18735 !! html/parsoid
18736 <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>
18737 !! end
18738
18739 !! test
18740 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
18741 !! wikitext
18742 <html><script>alert(1);</script></html>
18743 !! html
18744 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
18745 </p>
18746 !! end
18747
18748 !! test
18749 HTML with raw HTML ($wgRawHtml==true)
18750 !! options
18751 wgRawHtml=1
18752 !! wikitext
18753 <html><script>alert(1);</script></html>
18754 !! html
18755 <p><script>alert(1);</script>
18756 </p>
18757 !! end
18758
18759 !! test
18760 Parents of subpages, one level up
18761 !! options
18762 subpage title=[[Subpage test/L1/L2/L3]]
18763 !! wikitext
18764 [[../|L2]]
18765 !! html
18766 <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>
18767 </p>
18768 !! end
18769
18770
18771 !! test
18772 Parents of subpages, one level up, not named
18773 !! options
18774 subpage title=[[Subpage test/L1/L2/L3]]
18775 !! wikitext
18776 [[../]]
18777 !! html
18778 <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>
18779 </p>
18780 !! end
18781
18782
18783
18784 !! test
18785 Parents of subpages, two levels up
18786 !! options
18787 subpage title=[[Subpage test/L1/L2/L3]]
18788 !! wikitext
18789 [[../../|L1]]2
18790
18791 [[../../|L1]]l
18792 !! html
18793 <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
18794 </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>
18795 </p>
18796 !! end
18797
18798 !! test
18799 Parents of subpages, two levels up, without trailing slash or name.
18800 !! options
18801 subpage title=[[Subpage test/L1/L2/L3]]
18802 !! wikitext
18803 [[../..]]
18804 !! html
18805 <p>[[../..]]
18806 </p>
18807 !! end
18808
18809 !! test
18810 Parents of subpages, two levels up, with lots of extra trailing slashes.
18811 !! options
18812 subpage title=[[Subpage test/L1/L2/L3]]
18813 !! wikitext
18814 [[../../////]]
18815 !! html
18816 <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>
18817 </p>
18818 !! end
18819
18820 !! article
18821 Subpage test/L1/L2/L3Sibling
18822 !! text
18823 Sibling article
18824 !! endarticle
18825
18826 !! test
18827 Transclusion of a sibling page (one level up)
18828 !! options
18829 subpage title=[[Subpage test/L1/L2/L3]]
18830 !! wikitext
18831 {{../L3Sibling}}
18832 !! html
18833 <p>Sibling article
18834 </p>
18835 !! end
18836
18837 !! test
18838 Transclusion of a child page
18839 !! options
18840 subpage title=[[Subpage test/L1/L2]]
18841 !! wikitext
18842 {{/L3Sibling}}
18843 !! html
18844 <p>Sibling article
18845 </p>
18846 !! end
18847
18848 !! test
18849 Non-transclusion because of too many up levels
18850 !! options
18851 subpage title=[[Subpage test/L1/L2/L3]]
18852 !! wikitext
18853 {{../../../../More than parent}}
18854 !! html
18855 <p>{{../../../../More than parent}}
18856 </p>
18857 !! end
18858
18859 !! test
18860 Definition list code coverage
18861 !! wikitext
18862 ; title : def
18863 ; title : def
18864 ;title: def
18865 !! html/php
18866 <dl><dt> title &#160;</dt>
18867 <dd> def</dd>
18868 <dt> title&#160;</dt>
18869 <dd> def</dd>
18870 <dt>title</dt>
18871 <dd> def</dd></dl>
18872
18873 !! html/parsoid
18874 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
18875 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
18876 <dt>title</dt><dd> def</dd></dl>
18877 !! end
18878
18879 !! test
18880 Don't fall for the self-closing div
18881 !! wikitext
18882 <div>hello world</div/>
18883 !! html
18884 <div>hello world</div>
18885
18886 !! end
18887
18888 !! test
18889 MSGNW magic word
18890 !! wikitext
18891 {{MSGNW:msg}}
18892 !! html/php
18893 <p>&#91;&#91;:Template:Msg&#93;&#93;
18894 </p>
18895 !! end
18896
18897 !! test
18898 RAW magic word
18899 !! wikitext
18900 {{RAW:QUERTY}}
18901 !! html
18902 <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>
18903 </p>
18904 !! end
18905
18906 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
18907 !! test
18908 Always escape literal '>' in output, not just after '<'
18909 !! wikitext
18910 ><>
18911 !! html
18912 <p>&gt;&lt;&gt;
18913 </p>
18914 !! end
18915
18916 !! test
18917 Template caching
18918 !! wikitext
18919 {{Test}}
18920 {{Test}}
18921 !! html
18922 <p>This is a test template
18923 This is a test template
18924 </p>
18925 !! end
18926
18927
18928 !! article
18929 MediaWiki:Fake
18930 !! text
18931 ==header==
18932 !! endarticle
18933
18934 !! test
18935 Inclusion of !userCanEdit() content
18936 !! wikitext
18937 {{MediaWiki:Fake}}
18938 !! html
18939 <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>
18940
18941 !! end
18942
18943
18944 !! test
18945 Out-of-order TOC heading levels
18946 !! wikitext
18947 ==2==
18948 ======6======
18949 ===3===
18950 =1=
18951 =====5=====
18952 ==2==
18953 !! html
18954 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18955 <ul>
18956 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
18957 <ul>
18958 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
18959 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
18960 </ul>
18961 </li>
18962 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
18963 <ul>
18964 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
18965 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
18966 </ul>
18967 </li>
18968 </ul>
18969 </div>
18970
18971 <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>
18972 <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>
18973 <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>
18974 <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>
18975 <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>
18976 <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>
18977
18978 !! end
18979
18980
18981 !! test
18982 ISBN with a dummy number
18983 !! wikitext
18984 ISBN ---
18985 !! html
18986 <p>ISBN ---
18987 </p>
18988 !! end
18989
18990
18991 !! test
18992 ISBN with space-delimited number
18993 !! wikitext
18994 ISBN 92 9017 032 8
18995 !! html
18996 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
18997 </p>
18998 !! end
18999
19000
19001 !! test
19002 ISBN with multiple spaces, no number
19003 !! wikitext
19004 ISBN foo
19005 !! html
19006 <p>ISBN foo
19007 </p>
19008 !! end
19009
19010
19011 !! test
19012 ISBN length
19013 !! wikitext
19014 ISBN 123456789
19015
19016 ISBN 1234567890
19017
19018 ISBN 12345678901
19019 !! html
19020 <p>ISBN 123456789
19021 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19022 </p><p>ISBN 12345678901
19023 </p>
19024 !! end
19025
19026
19027 !! test
19028 ISBN with trailing year (bug 8110)
19029 !! wikitext
19030 ISBN 1-234-56789-0 - 2006
19031
19032 ISBN 1 234 56789 0 - 2006
19033 !! html
19034 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
19035 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
19036 </p>
19037 !! end
19038
19039
19040 !! test
19041 anchorencode
19042 !! wikitext
19043 {{anchorencode:foo bar©#%n}}
19044 !! html
19045 <p>foo_bar.C2.A9.23.25n
19046 </p>
19047 !! end
19048
19049 !! test
19050 anchorencode trims spaces
19051 !! wikitext
19052 {{anchorencode: __pretty__please__}}
19053 !! html
19054 <p>pretty_please
19055 </p>
19056 !! end
19057
19058 !! test
19059 anchorencode deals with links
19060 !! wikitext
19061 {{anchorencode: [[hello|world]] [[hi]]}}
19062 !! html
19063 <p>world_hi
19064 </p>
19065 !! end
19066
19067 !! test
19068 anchorencode deals with templates
19069 !! wikitext
19070 {{anchorencode: {{Foo}} }}
19071 !! html
19072 <p>FOO
19073 </p>
19074 !! end
19075
19076 !! test
19077 anchorencode encodes like the TOC generator: (bug 18431)
19078 !! wikitext
19079 === _ +:.3A%3A&&amp;]] ===
19080 {{anchorencode: _ +:.3A%3A&&amp;]] }}
19081 __NOEDITSECTION__
19082 !! html
19083 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
19084 <p>.2B:.3A.253A.26.26.5D.5D
19085 </p>
19086 !! end
19087
19088 !! test
19089 Bug 6200: blockquotes and paragraph formatting
19090 !! wikitext
19091 <blockquote>
19092 foo
19093 </blockquote>
19094
19095 bar
19096
19097 baz
19098 !! html
19099 <blockquote>
19100 <p>foo
19101 </p>
19102 </blockquote>
19103 <p>bar
19104 </p>
19105 <pre>baz
19106 </pre>
19107 !! end
19108
19109 !! test
19110 Bug 8293: Use of center tag ruins paragraph formatting
19111 !! wikitext
19112 <center>
19113 foo
19114 </center>
19115
19116 bar
19117
19118 baz
19119 !! html
19120 <center>
19121 <p>foo
19122 </p>
19123 </center>
19124 <p>bar
19125 </p>
19126 <pre>baz
19127 </pre>
19128 !! end
19129
19130 !!test
19131 Parsing of overlapping (improperly nested) inline html tags
19132 !! wikitext
19133 <span><s>x</span></s>
19134 !! html/php
19135 <p><span><s>x&lt;/span&gt;</s></span>
19136 </p>
19137 !! html/parsoid
19138 <p><span><s>x</s></span>
19139 </p>
19140 !!end
19141
19142 ###
19143 ### Language variants related tests
19144 ###
19145 !! test
19146 Self-link in language variants
19147 !! options
19148 title=[[Dunav]] language=sr
19149 !! wikitext
19150 Both [[Dunav]] and [[Дунав]] are names for this river.
19151 !! html
19152 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
19153 </p>
19154 !!end
19155
19156 !! article
19157 Дуна
19158 !! text
19159 content
19160 !! endarticle
19161
19162 !! test
19163 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
19164 !! options
19165 title=[[Duna]] language=sr
19166 !! wikitext
19167 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
19168 !! html
19169 <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.
19170 </p>
19171 !! end
19172
19173 !! test
19174 Link to a section of a variant of this title shouldn't be parsed as self-link
19175 !! options
19176 title=[[Duna]] language=sr
19177 !! wikitext
19178 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
19179 !! html
19180 <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.
19181 </p>
19182 !! end
19183
19184 !! test
19185 Link to pages in language variants
19186 !! options
19187 language=sr
19188 !! wikitext
19189 Main Page can be written as [[Маин Паге]]
19190 !! html
19191 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
19192 </p>
19193 !!end
19194
19195
19196 !! test
19197 Multiple links to pages in language variants
19198 !! options
19199 language=sr
19200 !! wikitext
19201 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
19202 !! html
19203 <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>.
19204 </p>
19205 !!end
19206
19207
19208 !! test
19209 Simple template in language variants
19210 !! options
19211 language=sr
19212 !! wikitext
19213 {{тест}}
19214 !! html
19215 <p>This is a test template
19216 </p>
19217 !! end
19218
19219
19220 !! test
19221 Template with explicit namespace in language variants
19222 !! options
19223 language=sr
19224 !! wikitext
19225 {{Template:тест}}
19226 !! html
19227 <p>This is a test template
19228 </p>
19229 !! end
19230
19231
19232 !! test
19233 Basic test for template parameter in language variants
19234 !! options
19235 language=sr
19236 !! wikitext
19237 {{парамтест|param=foo}}
19238 !! html
19239 <p>This is a test template with parameter foo
19240 </p>
19241 !! end
19242
19243
19244 !! test
19245 Simple category in language variants
19246 !! options
19247 language=sr cat
19248 !! wikitext
19249 [[Category:МедиаWики Усер'с Гуиде]]
19250 !! html
19251 <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>
19252 !! end
19253
19254
19255 !! article
19256 Category:分类
19257 !! text
19258 blah
19259 !! endarticle
19260
19261 !! article
19262 Category:分類
19263 !! text
19264 blah
19265 !! endarticle
19266
19267 ## We used to, but no longer wt2wt this test since the default serializer
19268 ## will normalize all categories to serialize on their own line.
19269 ## This wikitext usage is going to be fairly uncommon in production and
19270 ## selser will take care of preserving formatting in those scenarios.
19271 !! test
19272 Don't convert blue categorylinks to another variant (bug 33210)
19273 !! options
19274 cat
19275 language=zh
19276 parsoid=wt2html
19277 !! wikitext
19278 [[A]][[Category:分类]]
19279 !! html/php
19280 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
19281 !! html/parsoid
19282 <p><a rel="mw:WikiLink" href="A" title="A">A</a></p>
19283 <link rel="mw:PageProp/Category" href="Category:分类"/>
19284 !! end
19285
19286 !! test
19287 Stripping -{}- tags (language variants)
19288 !! options
19289 language=sr
19290 !! wikitext
19291 Latin proverb: -{Ne nuntium necare}-
19292 !! html
19293 <p>Latin proverb: Ne nuntium necare
19294 </p>
19295 !! end
19296
19297
19298 !! test
19299 Prevent conversion with -{}- tags (language variants)
19300 !! options
19301 language=sr variant=sr-ec
19302 !! wikitext
19303 Latinski: -{Ne nuntium necare}-
19304 !! html
19305 <p>Латински: Ne nuntium necare
19306 </p>
19307 !! end
19308
19309
19310 !! test
19311 Prevent conversion of text with -{}- tags (language variants)
19312 !! options
19313 language=sr variant=sr-ec
19314 !! wikitext
19315 Latinski: -{Ne nuntium necare}-
19316 !! html
19317 <p>Латински: Ne nuntium necare
19318 </p>
19319 !! end
19320
19321
19322 !! test
19323 Prevent conversion of links with -{}- tags (language variants)
19324 !! options
19325 language=sr variant=sr-ec
19326 !! wikitext
19327 -{[[Main Page]]}-
19328 !! html
19329 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19330 </p>
19331 !! end
19332
19333
19334 !! test
19335 -{}- tags within headlines (within html for parserConvert())
19336 !! options
19337 language=sr variant=sr-ec
19338 !! wikitext
19339 == -{Naslov}- ==
19340 !! html
19341 <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>
19342
19343 !! end
19344
19345
19346 !! test
19347 Explicit definition of language variant alternatives
19348 !! options
19349 language=zh variant=zh-tw
19350 !! wikitext
19351 -{zh:China;zh-tw:Taiwan}-, not China
19352 !! html
19353 <p>Taiwan, not China
19354 </p>
19355 !! end
19356
19357
19358 !! test
19359 Conversion around HTML tags
19360 !! options
19361 language=sr variant=sr-ec
19362 !! wikitext
19363 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
19364 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
19365 !! html
19366 <p>
19367 <span title="ЛаCтин">ски</span>
19368 </p>
19369 !! end
19370
19371
19372 !! test
19373 Explicit session-wise language variant mapping (A flag and - flag)
19374 !! options
19375 language=zh variant=zh-tw
19376 !! wikitext
19377 Taiwan is not China.
19378 But -{A|zh:China;zh-tw:Taiwan}- is China,
19379 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
19380 and -{China}- is China.
19381 !! html
19382 <p>Taiwan is not China.
19383 But Taiwan is Taiwan,
19384 (This should be stripped!)
19385 and China is China.
19386 </p>
19387 !! end
19388
19389 !! test
19390 Explicit session-wise language variant mapping (H flag for hide)
19391 !! options
19392 language=zh variant=zh-tw
19393 !! wikitext
19394 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
19395 Taiwan is China.
19396 !! html
19397 <p>(This should be stripped!)
19398 Taiwan is Taiwan.
19399 </p>
19400 !! end
19401
19402 !! test
19403 Adding explicit conversion rule for title (T flag)
19404 !! options
19405 language=zh variant=zh-tw showtitle
19406 !! wikitext
19407 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19408 !! html
19409 Taiwan
19410 <p>Should be stripped!
19411 </p>
19412 !! end
19413
19414 !! test
19415 Testing that changing the language variant here in the tests actually works
19416 !! options
19417 language=zh variant=zh showtitle
19418 !! wikitext
19419 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19420 !! html
19421 China
19422 <p>Should be stripped!
19423 </p>
19424 !! end
19425
19426 !! test
19427 Recursive conversion of alt and title attrs shouldn't clear converter state
19428 !! options
19429 language=zh variant=zh-cn showtitle
19430 !! wikitext
19431 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
19432 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
19433 !! html
19434 China
19435 <p>
19436 Should be stripped<span title="Exclamation">!</span>
19437 </p>
19438 !! end
19439
19440 !! test
19441 Bug 24072: more test on conversion rule for title
19442 !! options
19443 language=zh variant=zh-tw showtitle
19444 !! wikitext
19445 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19446 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
19447 !! html
19448 Taiwan
19449 <p>This should be stripped!
19450 This won't take interferes with the title rule.
19451 </p>
19452 !! end
19453
19454 !! test
19455 Partly disable title conversion if variant == main language code
19456 !! options
19457 language=zh variant=zh title=[[ZH]] showtitle
19458 !! wikitext
19459 -{T|zh-cn:CN;zh-tw:TW}-
19460 !! html
19461 ZH
19462 <p>
19463 </p>
19464 !! end
19465
19466 !! test
19467 Partly disable title conversion if variant == main language code, more
19468 !! options
19469 language=zh variant=zh title=[[ZH]] showtitle
19470 !! wikitext
19471 -{T|TW}-
19472 !! html
19473 ZH
19474 <p>
19475 </p>
19476 !! end
19477
19478 !! test
19479 Raw output of variant escape tags (R flag)
19480 !! options
19481 language=zh variant=zh-tw
19482 !! wikitext
19483 Raw: -{R|zh:China;zh-tw:Taiwan}-
19484 !! html
19485 <p>Raw: zh:China;zh-tw:Taiwan
19486 </p>
19487 !! end
19488
19489 !! test
19490 Strings evaluating false shouldn't be ignored by Language converter (T51072)
19491 !! options
19492 language=zh variant=zh-cn
19493 !! input
19494 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
19495 !! result
19496 <p>0
19497 </p>
19498 !! end
19499
19500 !! test
19501 Conversion rules from [numeric-only string] to [something else] (T48634)
19502 !! options
19503 language=zh variant=zh-cn
19504 !! input
19505 -{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
19506 !! result
19507 <p>D12345EE12345
19508 </p>
19509 !! end
19510
19511 !! test
19512 Bidirectional converter rule entries with an empty value should be ignored (T53551)
19513 !! options
19514 language=zh variant=zh-cn
19515 !! input
19516 -{H|zh-cn:foo;zh-tw:;}-foobar
19517 !! result
19518 <p>foobar
19519 </p>
19520 !! end
19521
19522 !! test
19523 Unidirectional converter rule entries with an empty "from" string should be ignored (T53551)
19524 !! options
19525 language=zh variant=zh-cn
19526 !! input
19527 -{H|=>zh-cn:foo;}-foobar
19528 !! result
19529 <p>foobar
19530 </p>
19531 !! end
19532
19533 !! test
19534 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
19535 !! options
19536 language=zh variant=zh-cn
19537 !! input
19538 -{H|}-foobar
19539 !! result
19540 <p>foobar
19541 </p>
19542 !! end
19543
19544 !! test
19545 Nested using of manual convert syntax
19546 !! options
19547 language=zh variant=zh-hk
19548 !! wikitext
19549 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
19550 !! html
19551 <p>Nested: Hello Hong Kong!
19552 </p>
19553 !! end
19554
19555 !! test
19556 Proper conversion of text in external links
19557 !! options
19558 language=sr variant=sr-ec
19559 !! wikitext
19560 http://www.google.com
19561 gopher://www.google.com
19562 [http://www.google.com http://www.google.com]
19563 [gopher://www.google.com gopher://www.google.com]
19564 [https://www.google.com irc://www.google.com]
19565 [ftp://www.google.com www.google.com/ftp://dir]
19566 [//www.google.com www.google.com]
19567 !! html
19568 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
19569 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
19570 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
19571 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
19572 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
19573 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
19574 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
19575 </p>
19576 !! end
19577
19578 !! test
19579 Do not convert roman numbers to language variants
19580 !! options
19581 language=sr variant=sr-ec
19582 !! wikitext
19583 Fridrih IV je car.
19584 !! html
19585 <p>Фридрих IV је цар.
19586 </p>
19587 !! end
19588
19589 !! test
19590 Unclosed language converter markup "-{"
19591 !! options
19592 language=sr
19593 !! wikitext
19594 -{T|hello
19595 !! html
19596 <p>-{T|hello
19597 </p>
19598 !! end
19599
19600 !! test
19601 Don't convert raw rule "-{R|=&gt;}-" to "=>"
19602 !! options
19603 language=sr
19604 !! wikitext
19605 -{R|=&gt;}-
19606 !! html
19607 <p>=&gt;
19608 </p>
19609 !!end
19610
19611 !! test
19612 Don't break link parsing if language converter markup is in the caption.
19613 !! options
19614 language=sr variant=sr-ec
19615 !! wikitext
19616 [[Main Page|-{R|main page}-]]
19617 !! html
19618 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
19619 </p>
19620 !! end
19621
19622 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19623 !! test
19624 Don't break image parsing if language converter markup is in the caption.
19625 !! options
19626 language=sr
19627 !! wikitext
19628 [[File:Foobar.jpg|-{R|caption}-]]
19629 !! html/parsoid
19630 <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>
19631 </p>
19632 !! end
19633
19634 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19635 !! test
19636 Don't break list handling if language converter markup is in the item.
19637 !! options
19638 language=zh variant=zh-cn
19639 !! wikitext
19640 ;-{zh-cn:AAA;zh-tw:BBB}-
19641 !! html/php
19642 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
19643
19644 !! html/parsoid
19645 <dl><dt>AAA
19646 </dt></dl>
19647 !! end
19648
19649 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19650 !! test
19651 Don't break table handling if language converter markup is in the cell.
19652 !! options
19653 language=sr variant=sr-ec
19654 !! wikitext
19655 {|
19656 |-
19657 | -{R|B}-
19658 |}
19659 !! html/php
19660 <table>
19661
19662 <tr>
19663 <td>Б}-
19664 </td></tr></table>
19665
19666 !! html/parsoid
19667 <table>
19668
19669 <tr>
19670 <td> B
19671 </td></tr></table>
19672
19673 !! end
19674
19675 !! test
19676 Bug 529: Uncovered bullet
19677 !! wikitext
19678 * Foo {{bullet}}
19679 !! html
19680 <ul><li> Foo </li>
19681 <li> Bar</li></ul>
19682
19683 !! end
19684
19685 # Plain MediaWiki does not remove empty lists, but tidy actually does.
19686 # Templates in Wikipedia rely on this behavior, as tidy has always been
19687 # enabled there. These tests are normally run *without* tidy, so specify the
19688 # full output here.
19689 # To test realistic parsing behavior, apply a tidy-like transformation to both
19690 # the expected output and your parser's output.
19691 !! test
19692 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
19693 !! wikitext
19694 ******* Foo {{bullet}}
19695 !! html
19696 <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>
19697 <li> Bar</li></ul>
19698
19699 !! end
19700
19701 !! test
19702 Bug 529: Uncovered table already at line-start
19703 !! wikitext
19704 x
19705
19706 {{table}}
19707 y
19708 !! html
19709 <p>x
19710 </p>
19711 <table>
19712 <tr>
19713 <td> 1 </td>
19714 <td> 2
19715 </td></tr>
19716 <tr>
19717 <td> 3 </td>
19718 <td> 4
19719 </td></tr></table>
19720 <p>y
19721 </p>
19722 !! end
19723
19724 !! test
19725 Bug 529: Uncovered bullet in parser function result
19726 !! wikitext
19727 * Foo {{lc:{{bullet}} }}
19728 !! html
19729 <ul><li> Foo </li>
19730 <li> bar</li></ul>
19731
19732 !! end
19733
19734 !! test
19735 Bug 5678: Double-parsed template argument
19736 !! wikitext
19737 {{lc:{{{1}}}|hello}}
19738 !! html
19739 <p>{{{1}}}
19740 </p>
19741 !! end
19742
19743 !! test
19744 Bug 5678: Double-parsed template invocation
19745 !! wikitext
19746 {{lc:{{paramtest {{!}} param = hello }} }}
19747 !! html
19748 <p>{{paramtest | param = hello }}
19749 </p>
19750 !! end
19751
19752 !! test
19753 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
19754 !! options
19755 language=cs
19756 title=[[Main Page]]
19757 !! wikitext
19758 {{PRVNÍVELKÉ:ěščř}}
19759 {{prvnívelké:ěščř}}
19760 {{PRVNÍMALÉ:ěščř}}
19761 {{prvnímalé:ěščř}}
19762 {{MALÁ:ěščř}}
19763 {{malá:ěščř}}
19764 {{VELKÁ:ěščř}}
19765 {{velká:ěščř}}
19766 !! html
19767 <p>Ěščř
19768 Ěščř
19769 ěščř
19770 ěščř
19771 ěščř
19772 ěščř
19773 ĚŠČŘ
19774 ĚŠČŘ
19775 </p>
19776 !! end
19777
19778 !! test
19779 Morwen/13: Unclosed link followed by heading
19780 !! wikitext
19781 [[link
19782 ==heading==
19783 !! html
19784 <p>[[link
19785 </p>
19786 <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>
19787
19788 !! end
19789
19790 !! test
19791 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
19792 !! wikitext
19793 {{foo|
19794 =heading=
19795 !! html
19796 <p>{{foo|
19797 </p>
19798 <h1><span class="mw-headline" id="heading">heading</span></h1>
19799
19800 !! end
19801
19802 !! test
19803 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
19804 !! wikitext
19805 {{foo|
19806 ==heading==
19807 !! html
19808 <p>{{foo|
19809 </p>
19810 <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>
19811
19812 !! end
19813
19814 !! test
19815 Tildes in comments
19816 !! options
19817 pst
19818 !! wikitext
19819 <!-- ~~~~ -->
19820 !! html
19821 <!-- ~~~~ -->
19822 !! end
19823
19824 !! test
19825 Paragraphs inside divs (no extra line breaks)
19826 !! wikitext
19827 <div>Line one
19828
19829 Line two</div>
19830 !! html
19831 <div>Line one
19832 Line two</div>
19833
19834 !! end
19835
19836 !! test
19837 Paragraphs inside divs (extra line break on open)
19838 !! wikitext
19839 <div>
19840 Line one
19841
19842 Line two</div>
19843 !! html
19844 <div>
19845 <p>Line one
19846 </p>
19847 Line two</div>
19848
19849 !! end
19850
19851 !! test
19852 Paragraphs inside divs (extra line break on close)
19853 !! wikitext
19854 <div>Line one
19855
19856 Line two
19857 </div>
19858 !! html
19859 <div>Line one
19860 <p>Line two
19861 </p>
19862 </div>
19863
19864 !! end
19865
19866 !! test
19867 Paragraphs inside divs (extra line break on open and close)
19868 !! wikitext
19869 <div>
19870 Line one
19871
19872 Line two
19873 </div>
19874 !! html
19875 <div>
19876 <p>Line one
19877 </p><p>Line two
19878 </p>
19879 </div>
19880
19881 !! end
19882
19883 !! test
19884 Nesting tags, paragraphs on lines which begin with <div>
19885 !! wikitext
19886 <div></div><strong>A
19887 B</strong>
19888 !! html/php+tidy
19889 <p><strong>A</strong></p>
19890 <p><strong>B</strong></p>
19891 !! html/parsoid
19892 <div></div>
19893 <p><strong>A
19894 B</strong>
19895 </p>
19896 !! end
19897
19898 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
19899 !! test
19900 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
19901 !! wikitext
19902 <blockquote>Line one
19903
19904 Line two</blockquote>
19905 !! html
19906 <blockquote>Line one
19907 Line two</blockquote>
19908
19909 !! html+tidy
19910 <blockquote>
19911 <p>Line one Line two</p>
19912 </blockquote>
19913 !! end
19914
19915 !! test
19916 Bug 6200: paragraphs inside blockquotes (extra line break on open)
19917 !! wikitext
19918 <blockquote>
19919 Line one
19920
19921 Line two</blockquote>
19922 !! html
19923 <blockquote>
19924 <p>Line one
19925 </p>
19926 Line two</blockquote>
19927
19928 !! html+tidy
19929 <blockquote>
19930 <p>Line one</p>
19931 Line two</blockquote>
19932 !! end
19933
19934 !! test
19935 Bug 6200: paragraphs inside blockquotes (extra line break on close)
19936 !! wikitext
19937 <blockquote>Line one
19938
19939 Line two
19940 </blockquote>
19941 !! html
19942 <blockquote>Line one
19943 <p>Line two
19944 </p>
19945 </blockquote>
19946
19947 !! html+tidy
19948 <blockquote>
19949 <p>Line one</p>
19950 <p>Line two</p>
19951 </blockquote>
19952 !! end
19953
19954 !! test
19955 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
19956 !! wikitext
19957 <blockquote>
19958 Line one
19959
19960 Line two
19961 </blockquote>
19962 !! html
19963 <blockquote>
19964 <p>Line one
19965 </p><p>Line two
19966 </p>
19967 </blockquote>
19968
19969 !! html+tidy
19970 <blockquote>
19971 <p>Line one</p>
19972 <p>Line two</p>
19973 </blockquote>
19974 !! end
19975
19976 !! test
19977 Paragraphs inside blockquotes/divs (no extra line breaks)
19978 !! wikitext
19979 <blockquote><div>Line one
19980
19981 Line two</div></blockquote>
19982 !! html
19983 <blockquote><div>Line one
19984 Line two</div></blockquote>
19985
19986 !! end
19987
19988 !! test
19989 Paragraphs inside blockquotes/divs (extra line break on open)
19990 !! wikitext
19991 <blockquote><div>
19992 Line one
19993
19994 Line two</div></blockquote>
19995 !! html
19996 <blockquote><div>
19997 <p>Line one
19998 </p>
19999 Line two</div></blockquote>
20000
20001 !! end
20002
20003 !! test
20004 Paragraphs inside blockquotes/divs (extra line break on close)
20005 !! wikitext
20006 <blockquote><div>Line one
20007
20008 Line two
20009 </div></blockquote>
20010 !! html
20011 <blockquote><div>Line one
20012 <p>Line two
20013 </p>
20014 </div></blockquote>
20015
20016 !! end
20017
20018 !! test
20019 Paragraphs inside blockquotes/divs (extra line break on open and close)
20020 !! wikitext
20021 <blockquote><div>
20022 Line one
20023
20024 Line two
20025 </div></blockquote>
20026 !! html
20027 <blockquote><div>
20028 <p>Line one
20029 </p><p>Line two
20030 </p>
20031 </div></blockquote>
20032
20033 !! end
20034
20035 !! test
20036 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
20037 !! options
20038 wgLinkHolderBatchSize=0
20039 !! wikitext
20040 [[meatball:1]]
20041 [[meatball:2]]
20042 [[meatball:3]]
20043 !! html
20044 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
20045 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
20046 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
20047 </p>
20048 !! end
20049
20050 !! test
20051 Free external link invading image caption
20052 !! wikitext
20053 [[Image:Foobar.jpg|thumb|http://x|hello]]
20054 !! html
20055 <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>
20056
20057 !! end
20058
20059 !! test
20060 Bug 15196: localised external link numbers
20061 !! options
20062 language=fa
20063 !! wikitext
20064 [http://en.wikipedia.org/]
20065 !! html/php
20066 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
20067 </p>
20068 !! html/parsoid
20069 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
20070 !! end
20071
20072 !! test
20073 Multibyte character in padleft
20074 !! wikitext
20075 {{padleft:-Hello|7|Æ}}
20076 !! html
20077 <p>Æ-Hello
20078 </p>
20079 !! end
20080
20081 !! test
20082 Multibyte character in padright
20083 !! wikitext
20084 {{padright:Hello-|7|Æ}}
20085 !! html
20086 <p>Hello-Æ
20087 </p>
20088 !! end
20089
20090 !!test
20091 formatdate parser function
20092 !! wikitext
20093 {{#formatdate:2009-03-24}}
20094 !! html
20095 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
20096 </p>
20097 !! end
20098
20099 !!test
20100 formatdate parser function, with default format
20101 !! wikitext
20102 {{#formatdate:2009-03-24|mdy}}
20103 !! html
20104 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
20105 </p>
20106 !! end
20107
20108 !! test
20109 Spacing of numbers in formatted dates
20110 !! wikitext
20111 {{#formatdate:January 15}}
20112 !! html
20113 <p><span class="mw-formatted-date" title="01-15">January 15</span>
20114 </p>
20115 !! end
20116
20117 !! test
20118 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
20119 !! options
20120 language=nl title=[[MediaWiki:Common.css]]
20121 !! wikitext
20122 {{#formatdate:2009-03-24|dmy}}
20123 !! html
20124 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
20125 </p>
20126 !! end
20127
20128 #
20129 #
20130 #
20131
20132 #
20133 # Edit comments
20134 #
20135
20136 !! test
20137 Edit comment with link
20138 !! options
20139 comment
20140 !! wikitext
20141 I like the [[Main Page]] a lot
20142 !! html
20143 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
20144 !!end
20145
20146 !! test
20147 Edit comment with link and link text
20148 !! options
20149 comment
20150 !! wikitext
20151 I like the [[Main Page|best pages]] a lot
20152 !! html
20153 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
20154 !!end
20155
20156 !! test
20157 Edit comment with link and link text with suffix
20158 !! options
20159 comment
20160 !! wikitext
20161 I like the [[Main Page|best page]]s a lot
20162 !! html
20163 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
20164 !!end
20165
20166 !! test
20167 Edit comment with section link (non-local, eg in history list)
20168 !! options
20169 comment title=[[Main Page]]
20170 !! wikitext
20171 /* External links */ removed bogus entries
20172 !! html
20173 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
20174 !!end
20175
20176 !! test
20177 Edit comment with section link and text before it (non-local, eg in history list)
20178 !! options
20179 comment title=[[Main Page]]
20180 !! wikitext
20181 pre-comment text /* External links */ removed bogus entries
20182 !! html
20183 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>
20184 !!end
20185
20186 !! test
20187 Edit comment with section link (local, eg in diff view)
20188 !! options
20189 comment local title=[[Main Page]]
20190 !! wikitext
20191 /* External links */ removed bogus entries
20192 !! html
20193 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
20194 !!end
20195
20196 !! test
20197 Edit comment with subpage link (bug 14080)
20198 !! options
20199 comment
20200 subpage
20201 title=[[Subpage test]]
20202 !! wikitext
20203 Poked at a [[/subpage]] here...
20204 !! html
20205 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
20206 !!end
20207
20208 !! test
20209 Edit comment with subpage link and link text (bug 14080)
20210 !! options
20211 comment
20212 subpage
20213 title=[[Subpage test]]
20214 !! wikitext
20215 Poked at a [[/subpage|neat little page]] here...
20216 !! html
20217 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
20218 !!end
20219
20220 !! test
20221 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
20222 !! options
20223 comment
20224 title=[[Subpage test]]
20225 !! wikitext
20226 Poked at a [[/subpage]] here...
20227 !! html
20228 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...
20229 !!end
20230
20231 !! test
20232 Edit comment with bare anchor link (local, as on diff)
20233 !! options
20234 comment
20235 local
20236 title=[[Main Page]]
20237 !! wikitext
20238 [[#section]]
20239 !! html
20240 <a href="#section">#section</a>
20241 !! end
20242
20243 !! test
20244 Edit comment with bare anchor link (non-local, as on history)
20245 !! options
20246 comment
20247 title=[[Main Page]]
20248 !! wikitext
20249 [[#section]]
20250 !! html
20251 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
20252 !! end
20253
20254 !! test
20255 Anchor starting with underscore
20256 !! wikitext
20257 [[#_ref|One]]
20258 !! html
20259 <p><a href="#_ref">One</a>
20260 </p>
20261 !! end
20262
20263 !! test
20264 Id starting with underscore
20265 !! wikitext
20266 <div id="_ref"></div>
20267 !! html
20268 <div id="_ref"></div>
20269
20270 !! end
20271
20272 !! test
20273 Space normalisation on autocomment (bug 22784)
20274 !! options
20275 comment
20276 title=[[Main Page]]
20277 !! wikitext
20278 /* __hello__world__ */
20279 !! html
20280 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
20281 !! end
20282
20283 !! test
20284 percent-encoding and + signs in comments (Bug 26410)
20285 !! options
20286 comment
20287 !! wikitext
20288 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
20289 !! html/php
20290 <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>
20291 !! end
20292
20293 # Parsoid doesn't support this yet: see bug 73581
20294 # but it *should* omit the 'src' attribute if the image is bad.
20295 # PHP side of tests was disabled in
20296 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
20297 # because of issues in the PHP parserTests infrastructure
20298 # (but the output below is indeed what the PHP side emits)
20299 !! test
20300 Bad images - basic functionality
20301 !! wikitext
20302 [[File:Bad.jpg]]
20303 !! DISABLED/html/php
20304 !! html/parsoid
20305 <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>
20306 !! end
20307
20308 !! test
20309 Bad images - bug 16039: text after bad image disappears
20310 !! wikitext
20311 Foo bar
20312 [[File:Bad.jpg]]
20313 Bar foo
20314 !! DISABLED/html/php
20315 <p>Foo bar
20316 </p><p>Bar foo
20317 </p>
20318 !! html/parsoid
20319 <p>Foo bar
20320 <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>
20321 Bar foo</p>
20322 !! end
20323
20324 !! test
20325 Verify that displaytitle works (bug #22501) no displaytitle
20326 !! options
20327 showtitle
20328 !! config
20329 wgAllowDisplayTitle=true
20330 wgRestrictDisplayTitle=false
20331 !! wikitext
20332 this is not the the title
20333 !! html/php
20334 Parser test
20335 <p>this is not the the title
20336 </p>
20337 !! end
20338
20339 !! test
20340 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
20341 !! options
20342 showtitle
20343 title=[[Screen]]
20344 !! config
20345 wgAllowDisplayTitle=true
20346 wgRestrictDisplayTitle=false
20347 !! wikitext
20348 this is not the the title
20349 {{DISPLAYTITLE:whatever}}
20350 !! html/php
20351 whatever
20352 <p>this is not the the title
20353 </p>
20354 !! end
20355
20356 !! test
20357 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
20358 !! options
20359 showtitle
20360 title=[[Screen]]
20361 !! config
20362 wgAllowDisplayTitle=true
20363 wgRestrictDisplayTitle=true
20364 !! wikitext
20365 this is not the the title
20366 {{DISPLAYTITLE:whatever}}
20367 !! html/php
20368 Screen
20369 <p>this is not the the title
20370 </p>
20371 !! end
20372
20373 !! test
20374 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
20375 !! options
20376 showtitle
20377 title=[[Screen]]
20378 !! config
20379 wgAllowDisplayTitle=true
20380 wgRestrictDisplayTitle=true
20381 !! wikitext
20382 this is not the the title
20383 {{DISPLAYTITLE:screen}}
20384 !! html/php
20385 screen
20386 <p>this is not the the title
20387 </p>
20388 !! end
20389
20390 !! test
20391 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
20392 !! options
20393 showtitle
20394 title=[[Screen]]
20395 !! config
20396 wgAllowDisplayTitle=false
20397 !! wikitext
20398 this is not the the title
20399 {{DISPLAYTITLE:screen}}
20400 !! html/php
20401 Screen
20402 <p>this is not the the title
20403 <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>
20404 </p>
20405 !! end
20406
20407 !! test
20408 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
20409 !! options
20410 showtitle
20411 title=[[Screen]]
20412 !! config
20413 wgAllowDisplayTitle=false
20414 !! wikitext
20415 this is not the the title
20416 !! html/php
20417 Screen
20418 <p>this is not the the title
20419 </p>
20420 !! end
20421
20422 !! test
20423 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
20424 !! options
20425 showtitle
20426 title=[[Screen]]
20427 !! config
20428 wgAllowDisplayTitle=true
20429 wgRestrictDisplayTitle=true
20430 !! wikitext
20431 this is not the the title
20432 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
20433 !! html/php
20434 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
20435 <p>this is not the the title
20436 </p>
20437 !! end
20438
20439 !! test
20440 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
20441 !! options
20442 showtitle
20443 title=[[Screen]]
20444 !! config
20445 wgAllowDisplayTitle=true
20446 wgRestrictDisplayTitle=true
20447 !! wikitext
20448 this is not the the title
20449 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
20450 !! html/php
20451 <span style="color: red;">s</span>creen
20452 <p>this is not the the title
20453 </p>
20454 !! end
20455
20456 !! test
20457 Page status indicators: Empty name is invalid
20458 !! options
20459 showindicators
20460 !! wikitext
20461 <indicator name=" "></indicator>
20462 <indicator></indicator>
20463 !! html
20464 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
20465 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
20466 </p>
20467 !! end
20468
20469 !! test
20470 Page status indicators: Weird syntaxes that are okay
20471 !! options
20472 showindicators
20473 !! wikitext
20474 <indicator name="empty" />
20475 <indicator name="name"></indicator>
20476 !! html
20477 empty=
20478 name=
20479 <p><br />
20480 </p>
20481 !! end
20482
20483 !! test
20484 Page status indicators: Torture test
20485 !! options
20486 showindicators
20487 !! wikitext
20488 <indicator name="01">hello world</indicator>
20489 <indicator name="02">[[Main Page]]</indicator>
20490 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
20491 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
20492 <indicator name="05">* foo
20493 * bar</indicator>
20494 <indicator name="06"><nowiki>foo</nowiki></indicator>
20495 <indicator name="07"> Preformatted</indicator>
20496 <indicator name="08"><div>Broken tag</indicator>
20497 <indicator name="09">{| class=wikitable
20498 | cell
20499 |}</indicator>
20500 <indicator name="10">Two
20501
20502 paragraphs</indicator>
20503 !! html
20504 01=hello world
20505 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20506 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" />
20507 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>
20508 05=<ul><li> foo</li>
20509 <li> bar</li></ul>
20510
20511 06=foo
20512 07=<pre>Preformatted
20513 </pre>
20514 08=<div>Broken tag</div>
20515
20516 09=<table class="wikitable">
20517 <tr>
20518 <td> cell
20519 </td></tr></table>
20520
20521 10=<p>Two
20522 </p><p>paragraphs
20523 </p>
20524 <p><br />
20525 </p><p><br />
20526 </p><p><br />
20527 </p><p><br />
20528 </p><p><br />
20529 </p>
20530 !! end
20531
20532 !! test
20533 preload: check <noinclude> and <includeonly>
20534 !! options
20535 preload
20536 !! wikitext
20537 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
20538 !! html/php
20539 Hello kind world.
20540 !! end
20541
20542 !! test
20543 preload: check <onlyinclude>
20544 !! options
20545 preload
20546 !! wikitext
20547 Goodbye <onlyinclude>Hello world</onlyinclude>
20548 !! html/php
20549 Hello world
20550 !! end
20551
20552 !! test
20553 preload: can pass tags through if we want to
20554 !! options
20555 preload
20556 !! wikitext
20557 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
20558 !! html/php
20559 <includeonly>Hello world</includeonly>
20560 !! end
20561
20562 !! test
20563 preload: check that it doesn't try to do tricks
20564 !! options
20565 preload
20566 !! wikitext
20567 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
20568 !! html/php
20569 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
20570 !! end
20571
20572 !! test
20573 Play a bit with r67090 and bug 3158
20574 !! wikitext
20575 <div style="width:50% !important">&nbsp;</div>
20576 <div style="width:50%&nbsp;!important">&nbsp;</div>
20577 <div style="width:50%&#160;!important">&nbsp;</div>
20578 <div style="border : solid;">&nbsp;</div>
20579 !! html/php
20580 <div style="width:50% !important">&#160;</div>
20581 <div style="width:50% !important">&#160;</div>
20582 <div style="width:50% !important">&#160;</div>
20583 <div style="border&#160;: solid;">&#160;</div>
20584
20585 !! html/parsoid
20586 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
20587 <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>
20588 <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>
20589 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
20590
20591 !! end
20592
20593 !! test
20594 HTML5 data attributes
20595 !! wikitext
20596 <span data-foo="bar">Baz</span>
20597 <p data-abc-def_hij="">Quuz</p>
20598 !! html
20599 <p><span data-foo="bar">Baz</span>
20600 </p>
20601 <p data-abc-def_hij="">Quuz</p>
20602
20603 !! end
20604
20605 !! test
20606 percent-encoding and + signs in internal links (Bug 26410)
20607 !! wikitext
20608 [[User:+%]] [[Page+title%]]
20609 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
20610 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
20611 [[%33%45]] [[%33%45+]]
20612 !! html/php
20613 <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>
20614 <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>
20615 <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>
20616 <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>
20617 </p>
20618 !! html/parsoid
20619 <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>
20620 <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>
20621 <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>
20622 <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>
20623 !! end
20624
20625 !! test
20626 Special characters in embedded file links (bug 27679)
20627 !! wikitext
20628 [[File:Contains & ampersand.jpg]]
20629 [[File:Does not exist.jpg|Title with & ampersand]]
20630 !! html/php
20631 <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>
20632 <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>
20633 </p>
20634 !! html/parsoid
20635 <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>
20636 <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>
20637 !! end
20638
20639 !! test
20640 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
20641 !! wikitext
20642 Text&apos;s been normalized?
20643 !! html
20644 <p>Text&#39;s been normalized?
20645 </p>
20646 !! end
20647
20648 !! test
20649 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
20650 !! wikitext
20651 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
20652 !! html
20653 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
20654 </p>
20655 !! end
20656
20657 !! test
20658 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
20659 !! wikitext
20660 [http://www.example.org/ ideograms]
20661 !! html
20662 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
20663 </p>
20664 !! end
20665
20666 !! test
20667 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
20668 !! wikitext
20669 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
20670 !! html
20671 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
20672 </p>
20673 !! end
20674
20675 !! article
20676 Mediawiki:loop1
20677 !! text
20678 {{Identical|A}}
20679 !! endarticle
20680
20681 !! article
20682 Mediawiki:loop2
20683 !! text
20684 {{Identical|B}}
20685 !! endarticle
20686
20687 !! article
20688 Template:Identical
20689 !! text
20690 {{int:loop1}}
20691 {{int:loop2}}
20692 !! endarticle
20693
20694 !! test
20695 Bug 31098 Template which includes system messages which includes the template
20696 !! wikitext
20697 {{Identical}}
20698 !! html
20699 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
20700 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
20701 </p>
20702 !! end
20703
20704 !! test
20705 Bug31490 Turkish: ucfirst 'blah'
20706 !! options
20707 language=tr
20708 !! wikitext
20709 {{ucfirst:blah}}
20710 !! html
20711 <p>Blah
20712 </p>
20713 !! end
20714
20715 !! test
20716 Bug31490 Turkish: ucfirst 'ix'
20717 !! options
20718 language=tr
20719 !! wikitext
20720 {{ucfirst:ix}}
20721 !! html
20722 <p>İx
20723 </p>
20724 !! end
20725
20726 !! test
20727 Bug31490 Turkish: lcfirst 'BLAH'
20728 !! options
20729 language=tr
20730 !! wikitext
20731 {{lcfirst:BLAH}}
20732 !! html
20733 <p>bLAH
20734 </p>
20735 !! end
20736
20737 !! test
20738 Bug31490 Turkish: ucfırst (with a dotless i)
20739 !! options
20740 language=tr
20741 !! wikitext
20742 {{ucfırst:blah}}
20743 !! html
20744 <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>
20745 </p>
20746 !! end
20747
20748 !! test
20749 Bug31490 ucfırst (with a dotless i) with English language
20750 !! options
20751 language=en
20752 !! wikitext
20753 {{ucfırst:blah}}
20754 !! html
20755 <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>
20756 </p>
20757 !! end
20758
20759 !! test
20760 Bug 26375: TOC with italics
20761 !! options
20762 title=[[Main Page]]
20763 !! wikitext
20764 __TOC__
20765 == ''Lost'' episodes ==
20766 !! html
20767 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20768 <ul>
20769 <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>
20770 </ul>
20771 </div>
20772
20773 <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>
20774
20775 !! end
20776
20777 !! test
20778 Bug 26375: TOC with bold
20779 !! options
20780 title=[[Main Page]]
20781 !! wikitext
20782 __TOC__
20783 == '''should be bold''' then normal text ==
20784 !! html
20785 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20786 <ul>
20787 <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>
20788 </ul>
20789 </div>
20790
20791 <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>
20792
20793 !! end
20794
20795 !! test
20796 Bug 33845: Headings become cursive in TOC when they contain an image
20797 !! options
20798 title=[[Main Page]]
20799 !! wikitext
20800 __TOC__
20801 == Image [[Image:foobar.jpg]] ==
20802 !! html
20803 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20804 <ul>
20805 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
20806 </ul>
20807 </div>
20808
20809 <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>
20810
20811 !! end
20812
20813 !! test
20814 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
20815 !! options
20816 title=[[Main Page]]
20817 !! wikitext
20818 __TOC__
20819 == <blockquote>Quote</blockquote> ==
20820 !! html
20821 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20822 <ul>
20823 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
20824 </ul>
20825 </div>
20826
20827 <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>
20828
20829 !! html+tidy
20830 <p></p>
20831 <div id="toc" class="toc">
20832 <div id="toctitle">
20833 <h2>Contents</h2>
20834 </div>
20835 <ul>
20836 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
20837 </ul>
20838 </div>
20839 <p></p>
20840 <h2><span class="mw-headline" id="Quote"></span></h2>
20841 <blockquote>
20842 <p><span class="mw-headline" id="Quote">Quote</span></p>
20843 </blockquote>
20844 <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>
20845 !! end
20846
20847 !! test
20848 Unclosed tags in TOC
20849 !! options
20850 title=[[Main Page]]
20851 !! wikitext
20852 __TOC__
20853 == Proof: 2 < 3 ==
20854 <small>Hanc marginis exiguitas non caperet.</small>
20855 QED
20856 !! html
20857 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20858 <ul>
20859 <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>
20860 </ul>
20861 </div>
20862
20863 <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>
20864 <p><small>Hanc marginis exiguitas non caperet.</small>
20865 QED
20866 </p>
20867 !! end
20868
20869 !! test
20870 Multiple tags in TOC
20871 !! wikitext
20872 __TOC__
20873 == <i>Foo</i> <b>Bar</b> ==
20874
20875 == <i>Foo</i> <blockquote>Bar</blockquote> ==
20876 !! html
20877 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20878 <ul>
20879 <li class="toclevel-1 tocsection-1"><a href="#Foo_Bar"><span class="tocnumber">1</span> <span class="toctext"><i>Foo</i> <b>Bar</b></span></a></li>
20880 <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>
20881 </ul>
20882 </div>
20883
20884 <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>
20885 <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>
20886
20887 !! html+tidy
20888 <p></p>
20889 <div id="toc" class="toc">
20890 <div id="toctitle">
20891 <h2>Contents</h2>
20892 </div>
20893 <ul>
20894 <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>
20895 <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>
20896 </ul>
20897 </div>
20898 <p></p>
20899 <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>
20900 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
20901 <blockquote>
20902 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
20903 </blockquote>
20904 <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>
20905 !! end
20906
20907 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
20908 # html5 tag parsing.
20909 !! test
20910 Tags with parameters in TOC
20911 !! options
20912 parsoid=wt2html
20913 !! wikitext
20914 __TOC__
20915 == <sup class="in-h2">Hello</sup> ==
20916
20917 == <sup class="a > b">Evilbye</sup> ==
20918 !! html/php
20919 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20920 <ul>
20921 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
20922 <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>
20923 </ul>
20924 </div>
20925
20926 <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>
20927 <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>
20928
20929 !! html/parsoid
20930 <meta property="mw:PageProp/toc" />
20931 <h2> <sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup> </h2>
20932
20933 <h2> <sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup> </h2>
20934 !! end
20935
20936 !! test
20937 span tags with directionality in TOC
20938 !! wikitext
20939 __TOC__
20940 == <span dir="ltr">C++</span> ==
20941
20942 == <span dir="rtl">זבנג!</span> ==
20943
20944 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
20945
20946 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
20947
20948 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
20949 !! html
20950 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20951 <ul>
20952 <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>
20953 <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>
20954 <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>
20955 <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>
20956 <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>
20957 </ul>
20958 </div>
20959
20960 <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>
20961 <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>
20962 <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>
20963 <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>
20964 <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>
20965
20966 !! end
20967
20968 !! test
20969 Bug 72884: bdi element in ToC
20970 !! wikitext
20971 __TOC__
20972 == <bdi>test</bdi> ==
20973 !! html
20974 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20975 <ul>
20976 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
20977 </ul>
20978 </div>
20979
20980 <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>
20981
20982 !! end
20983
20984 # Note that the html output does not have the <p></p>, but the
20985 # html+tidy output *does*. This is because the empty <p></p> is
20986 # removed by the sanitizer, but only when tidy is *not* enabled (!).
20987 !! test
20988 Empty <p> tag in TOC, removed by Sanitizer (T92892)
20989 !! wikitext
20990 __TOC__
20991 == x ==
20992 !! html
20993 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20994 <ul>
20995 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
20996 </ul>
20997 </div>
20998
20999 <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>
21000
21001 !! html+tidy
21002 <p></p>
21003 <div id="toc" class="toc">
21004 <div id="toctitle">
21005 <h2>Contents</h2>
21006 </div>
21007 <ul>
21008 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
21009 </ul>
21010 </div>
21011 <p></p>
21012 <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>
21013 !! end
21014
21015 !! article
21016 MediaWiki:Bug32057
21017 !! text
21018 == {{int:headline_sample}} ==
21019 !! endarticle
21020
21021 !! test
21022 Bug 32057: Title needed when expanding <h> nodes.
21023 !! options
21024 title=[[Main Page]]
21025 !! wikitext
21026 {{int:Bug32057}}
21027 !! html
21028 <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>
21029
21030 !! end
21031
21032 !! test
21033 Strip marker in urlencode
21034 !! wikitext
21035 {{urlencode:x<nowiki/>y}}
21036 {{urlencode:x<nowiki/>y|wiki}}
21037 {{urlencode:x<nowiki/>y|path}}
21038 {{urlencode:x<pre id="one">two</pre>y}}
21039 !! html
21040 <p>xy
21041 xy
21042 xy
21043 xy
21044 </p>
21045 !! end
21046
21047 !! test
21048 Strip marker in lc
21049 !! wikitext
21050 {{lc:x<nowiki/>y}}
21051 !! html
21052 <p>xy
21053 </p>
21054 !! end
21055
21056 !! test
21057 Strip marker in uc
21058 !! wikitext
21059 {{uc:x<nowiki/>y}}
21060 !! html
21061 <p>XY
21062 </p>
21063 !! end
21064
21065 !! test
21066 Strip marker in formatNum
21067 !! wikitext
21068 {{formatnum:1<nowiki/>2}}
21069 {{formatnum:1<nowiki/>2|R}}
21070 !! html
21071 <p>12
21072 12
21073 </p>
21074 !! end
21075
21076 !! test
21077 Check noCommafy in formatNum
21078 !! options
21079 language=be-tarask
21080 !! wikitext
21081 {{formatnum:123456.78}}
21082 {{formatnum:123456.78|NOSEP}}
21083 !! html
21084 <p>123 456,78
21085 123456.78
21086 </p>
21087 !! end
21088
21089 !! test
21090 Wrong option for formatNum (bug 56199)
21091 !! wikitext
21092 {{formatnum:1,234.56|Random}}
21093 {{formatnum:1,234.56|EVERYTHING}}
21094 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
21095 !! html
21096 <p>1,234.56
21097 1,234.56
21098 1,234.56
21099 </p>
21100 !! end
21101
21102 !! test
21103 Strip marker in grammar
21104 !! options
21105 language=fi
21106 !! wikitext
21107 {{grammar:elative|foo<nowiki/>bar}}
21108 !! html
21109 <p>foobarista
21110 </p>
21111 !! end
21112
21113 !! test
21114 Strip marker in padleft
21115 !! wikitext
21116 {{padleft:|2|x<nowiki/>y}}
21117 !! html
21118 <p>xy
21119 </p>
21120 !! end
21121
21122 !! test
21123 Strip marker in padright
21124 !! wikitext
21125 {{padright:|2|x<nowiki/>y}}
21126 !! html
21127 <p>xy
21128 </p>
21129 !! end
21130
21131 !! test
21132 Strip marker in anchorencode
21133 !! wikitext
21134 {{anchorencode:x<nowiki/>y}}
21135 !! html
21136 <p>xy
21137 </p>
21138 !! end
21139
21140 !! test
21141 nowiki inside link inside heading (bug 18295)
21142 !! wikitext
21143 ==[[foo|x<nowiki>y</nowiki>z]]==
21144 !! html
21145 <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>
21146
21147 !! end
21148
21149 !! test
21150 new support for bdi element (bug 31817)
21151 !! wikitext
21152 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
21153 !! html
21154 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
21155
21156 !!end
21157
21158 !! test
21159 Ignore pipe between table row attributes
21160 !! wikitext
21161 {|
21162 | quux
21163 |- id=foo | style='color: red'
21164 | bar
21165 |}
21166 !! html
21167 <table>
21168 <tr>
21169 <td> quux
21170 </td></tr>
21171 <tr id="foo" style="color: red">
21172 <td> bar
21173 </td></tr></table>
21174
21175 !! end
21176
21177 !!test
21178 Gallery override link with WikiLink (bug 34852)
21179 !! wikitext
21180 <gallery>
21181 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
21182 </gallery>
21183 !! html
21184 <ul class="gallery mw-gallery-traditional">
21185 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21186 <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>
21187 <div class="gallerytext">
21188 <p>caption
21189 </p>
21190 </div>
21191 </div></li>
21192 </ul>
21193
21194 !! end
21195
21196 !!test
21197 Gallery override link with absolute external link (bug 34852)
21198 !! wikitext
21199 <gallery>
21200 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
21201 </gallery>
21202 !! html
21203 <ul class="gallery mw-gallery-traditional">
21204 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21205 <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>
21206 <div class="gallerytext">
21207 <p>caption
21208 </p>
21209 </div>
21210 </div></li>
21211 </ul>
21212
21213 !! end
21214
21215 !!test
21216 Gallery override link with malicious javascript (bug 34852)
21217 !! wikitext
21218 <gallery>
21219 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
21220 </gallery>
21221 !! html
21222 <ul class="gallery mw-gallery-traditional">
21223 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21224 <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>
21225 <div class="gallerytext">
21226 <p>caption
21227 </p>
21228 </div>
21229 </div></li>
21230 </ul>
21231
21232 !! end
21233
21234 !!test
21235 Gallery with invalid title as link (bug 43964)
21236 !! wikitext
21237 <gallery>
21238 File:foobar.jpg|link=<
21239 </gallery>
21240 !! html
21241 <ul class="gallery mw-gallery-traditional">
21242 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21243 <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>
21244 <div class="gallerytext">
21245 </div>
21246 </div></li>
21247 </ul>
21248
21249 !! end
21250
21251 !!test
21252 Language parser function
21253 !! wikitext
21254 {{#language:ar}}
21255 !! html
21256 <p>العربية
21257 </p>
21258 !! end
21259
21260 !!test
21261 Padleft and padright as substr
21262 !! wikitext
21263 {{padleft:|3|abcde}}
21264 {{padright:|3|abcde}}
21265 !! html
21266 <p>abc
21267 abc
21268 </p>
21269 !! end
21270
21271 !!test
21272 Special parser function
21273 !! wikitext
21274 {{#special:RandomPage}}
21275 {{#special:BaDtItLe}}
21276 {{#special:Foobar}}
21277 !! html
21278 <p>Special:Random
21279 Special:Badtitle
21280 Special:Foobar
21281 </p>
21282 !! end
21283
21284 !!test
21285 Bug 34939 - Case insensitive link parsing ([HttP://])
21286 !! wikitext
21287 [HttP://MediaWiki.Org/]
21288 !! html/php
21289 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
21290 </p>
21291 !! html/parsoid
21292 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
21293 !! end
21294
21295 !!test
21296 Bug 34939 - Case insensitive link parsing ([HttP:// title])
21297 !! wikitext
21298 [HttP://MediaWiki.Org/ MediaWiki]
21299 !! html
21300 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
21301 </p>
21302 !! end
21303
21304 !!test
21305 Bug 34939 - Case insensitive link parsing (HttP://)
21306 !! wikitext
21307 HttP://MediaWiki.Org/
21308 !! html/php
21309 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
21310 </p>
21311 !! html/parsoid
21312 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
21313 !! end
21314
21315 !!test
21316 Disable TOC
21317 !! options
21318 notoc
21319 !! wikitext
21320 Lead
21321 == Section 1 ==
21322 == Section 2 ==
21323 == Section 3 ==
21324 == Section 4 ==
21325 == Section 5 ==
21326 !! html
21327 <p>Lead
21328 </p>
21329
21330 <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>
21331 <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>
21332 <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>
21333 <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>
21334 <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>
21335
21336 !! end
21337
21338
21339 ###
21340 ### Parsoid-specific tests
21341 ### Parsoid-PHP parser incompatibilities
21342 ###
21343 !!test
21344 1. SOL-sensitive wikitext tokens as template-args
21345 !!options
21346 parsoid=wt2html,wt2wt
21347 !! wikitext
21348 {{echo|*a}}
21349 {{echo|#a}}
21350 {{echo|:a}}
21351 !! html
21352 <span about="#mwt1" typeof="mw:Transclusion">
21353 </span><ul about="#mwt1"><li>a</li>
21354 </ul>
21355 <span about="#mwt2" typeof="mw:Transclusion">
21356 </span><ol about="#mwt2"><li>a</li>
21357 </ol>
21358 <span about="#mwt3" typeof="mw:Transclusion">
21359 </span><dl about="#mwt3"><dd>a</dd>
21360 </dl>
21361 !!end
21362
21363 #### -----------------------------------------------------------------
21364 #### Parsoid-specific functionality tests
21365 #### -----------------------------------------------------------------
21366
21367 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
21368 # We know wt2wt will fail, but we expect selser to pass.
21369 # Due to the nature of our testing, wt2wt and selser tests will enter the
21370 # blacklist and we'll catch selser regressions based on changes to the
21371 # blacklist entries for selser tests.
21372 !! test
21373 1. Bad treebuilder fixup of formatting elt is cleaned up
21374 !! options
21375 parsoid=wt2html,wt2wt
21376 !! wikitext
21377 {|
21378 |
21379 <small>
21380 [[Image:Foobar.jpg|right|Test]]
21381 </small>
21382 |}
21383 !! html/parsoid
21384 <table>
21385 <tbody><tr><td>
21386 <small>
21387 <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>
21388 </small>
21389 </td></tr>
21390 </tbody></table>
21391 !! end
21392
21393 !! test
21394 2. Bad treebuilder fixup of formatting elt is cleaned up
21395 !! options
21396 parsoid=wt2html,wt2wt
21397 !! wikitext
21398 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
21399
21400 <small>[[Image:Foobar.jpg|right|300px]]</small>
21401 !! html/parsoid
21402
21403 <p><b>foo</b></p>
21404 <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>
21405 <p><b>bar</b></p>
21406 <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>
21407 !! end
21408
21409 !! test
21410 3. Bad treebuilder fixup of formatting elt is cleaned up
21411 !! options
21412 parsoid=wt2html,wt2wt
21413 !! wikitext
21414 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
21415 !! html/parsoid
21416 <p><small><b>foo</b></small></p>
21417 <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>
21418 <p><small><b>bar</b></small></p>
21419 !! end
21420
21421 !! test
21422 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
21423 !! options
21424 parsoid=wt2html,wt2wt
21425 !! wikitext
21426 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
21427 !! html/parsoid
21428 <p><b><small></small></b></p>
21429 <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>
21430 <p></p>
21431 !! end
21432
21433 #### ----------------------------------------------------------------
21434 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
21435 #### tags. Parsoid's output for these tags differs from that of the
21436 #### PHP parser.
21437 #### ----------------------------------------------------------------
21438
21439 !!test
21440 Ref: 1. ref-location should be replaced with an index span
21441 !!options
21442 parsoid
21443 !! wikitext
21444 A <ref>foo</ref>
21445 B <ref name="x">foo</ref>
21446 C <ref name="y" />
21447 <references />
21448 !! html
21449 <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>
21450 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>
21451 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>
21452 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21453 <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>
21454 <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>
21455 <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>
21456 </ol>
21457 !!end
21458
21459 !!test
21460 Ref: 2. ref-tags with identical names should all get the same index
21461 !!options
21462 parsoid
21463 !! wikitext
21464 A <ref name="x">foo</ref>
21465 B <ref name="x" />
21466 <references />
21467 !! html
21468 <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>
21469 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>
21470 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21471 <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>
21472 </ol>
21473 !!end
21474
21475 !!test
21476 Ref: 3. spaces in ref-names should be ignored
21477 !!options
21478 parsoid
21479 !! wikitext
21480 A <ref name="x">foo</ref>
21481 B <ref name=" x " />
21482 C <ref name= x />
21483 <references />
21484 !! html
21485 <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>
21486 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>
21487 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>
21488 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21489 <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>
21490 </ol>
21491 !!end
21492
21493 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
21494 !!test
21495 Ref: 4. 'constructor' should be accepted as a valid ref-name
21496 !!options
21497 parsoid
21498 !! wikitext
21499 A <ref name="constructor">foo</ref>
21500 <references />
21501 !! html
21502 <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>
21503 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21504 <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>
21505 </ol>
21506 !!end
21507
21508 !!test
21509 Ref: 5. body should accept generic wikitext
21510 !!options
21511 parsoid
21512 !! wikitext
21513 A <ref>
21514 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
21515 </ref>
21516
21517 <references />
21518 !! html
21519 <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>
21520
21521 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21522 <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>
21523 </span></li>
21524 </ol>
21525 !!end
21526
21527 !!test
21528 Ref: 6. indent-pres should not be output in ref-body
21529 !!options
21530 parsoid
21531 !! wikitext
21532 A <ref>
21533 foo
21534 bar
21535 baz
21536 </ref>
21537
21538 <references />
21539 !! html
21540 <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>
21541
21542 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21543 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo
21544 bar
21545 baz
21546 </span></li>
21547 </ol>
21548 !!end
21549
21550 !!test
21551 Ref: 7. No p-wrapping in ref-body
21552 !!options
21553 parsoid
21554 !! wikitext
21555 A <ref>
21556 foo
21557
21558 bar
21559
21560
21561 baz
21562
21563
21564
21565 booz
21566 </ref>
21567
21568 <references />
21569 !! html
21570 <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>
21571
21572 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21573 <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
21574
21575 bar
21576
21577
21578 baz
21579
21580
21581
21582 booz
21583 </span></li>
21584 </ol>
21585 !!end
21586
21587 !!test
21588 Ref: 8. transclusion wikitext has lower precedence
21589 !!options
21590 parsoid
21591 !! wikitext
21592 A <ref> foo {{echo|</ref> B C}}
21593
21594 <references />
21595 !! html
21596 <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>
21597 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21598 <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 typeof="mw:Nowiki" data-parsoid='{"src":"{{","dsr":[12,14,0,0]}'>{{</span>echo|</span></li>
21599 </ol>
21600 !!end
21601
21602 !!test
21603 Ref: 9. unclosed comments should not leak out of ref-body
21604 !!options
21605 parsoid
21606 !! wikitext
21607 A <ref> foo <!--</ref> B C
21608 <references />
21609 !! html
21610 <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>
21611 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21612 <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>
21613 </ol>
21614 !!end
21615
21616 !!test
21617 Ref: 10. Unclosed HTML tags should not leak out of ref-body
21618 !!options
21619 parsoid
21620 !! wikitext
21621 A <ref> <b> foo </ref> B C
21622
21623 <references />
21624 !! html
21625 <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>
21626
21627
21628 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21629 <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>
21630 </ol>
21631 !!end
21632
21633 !!test
21634 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
21635 !!options
21636 parsoid
21637 !! wikitext
21638 A <ref>foo</ref> B
21639 C <ref>bar</ref> D
21640 <references />
21641 !! html
21642 <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
21643 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>
21644 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21645 <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>
21646 <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>
21647 </ol>
21648 !!end
21649
21650 !!test
21651 Ref: 12. ref-tags act as trailing newline migration barrier
21652 !! wikitext
21653 <!--the newline at the end of this line moves out of the p tag-->a
21654
21655 b<!--the newline at the end of this line stays inside the p tag--> <ref />
21656 <ref />
21657
21658 c
21659 <references />
21660 !! html/parsoid
21661 <!--the newline at the end of this line moves out of the p tag--><p>a</p>
21662
21663
21664 <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>
21665 <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>
21666
21667 <p>c</p>
21668 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21669 <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>
21670 <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>
21671 !!end
21672
21673 !!test
21674 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
21675 !!options
21676 parsoid
21677 !! wikitext
21678 <ref>foo</ref> A
21679 <ref>bar
21680 </ref> B
21681 <references />
21682 !! html
21683 <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
21684 <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>
21685 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21686 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li>
21687 <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
21688 </span></li>
21689 </ol>
21690 !!end
21691
21692 !!test
21693 Ref: 14. A nested ref-tag should be emitted as plain text
21694 !!options
21695 parsoid
21696 !! wikitext
21697 <ref>foo <ref>bar</ref> baz</ref>
21698
21699 <references />
21700 !! html
21701 <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>
21702 </p>
21703 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21704 <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>
21705 </ol>
21706 !!end
21707
21708 !!test
21709 Ref: 15. ref-tags with identical names should get identical indexes
21710 !!options
21711 parsoid
21712 !! wikitext
21713 A1 <ref name="a">foo</ref> A2 <ref name="a" />
21714 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
21715
21716 <references />
21717 !! html
21718 <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>
21719 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>
21720
21721 <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>
21722 </ol>
21723 !!end
21724
21725 ## We don't bother wt2wt-ing non-standard whitespace
21726 !!test
21727 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
21728 !!options
21729 parsoid=wt2html
21730 !! wikitext
21731 A <ref >foo</ref >
21732
21733 <references />
21734 !! html
21735 <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>
21736 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21737 <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>
21738 !!end
21739
21740 !!test
21741 Ref: 17. Generate valid HTML5 id/about attributes
21742 !!options
21743 parsoid
21744 !!wikitext
21745 <ref name="a b">foo</ref>
21746
21747 <references />
21748 !!html
21749 <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>
21750 </p>
21751
21752 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21753 <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>
21754 </ol>
21755 !!end
21756
21757 !!test
21758 Ref: 18. T58916: Extension attributes should be parsed as plain text
21759 !!options
21760 parsoid
21761 !!wikitext
21762 <ref name="{{echo|a}}">foo</ref>
21763
21764 <references />
21765 !!html
21766 <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>
21767 </p>
21768
21769 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21770 <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>
21771 </ol>
21772 !!end
21773
21774 !!test
21775 Ref: 19. ref-tags with identical name encodings should get identical indexes
21776 !!options
21777 parsoid
21778 !! wikitext
21779 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
21780
21781 <references />
21782 !! html
21783 <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>
21784 </p>
21785 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21786 <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>
21787 </ol>
21788 !!end
21789
21790 !!test
21791 Ref: 20. ref-tags with identical names but different content should keep it
21792 !!options
21793 parsoid
21794 !! wikitext
21795 A <ref name="foo">Foo one</ref>
21796 B <ref name="foo">Foo two</ref>
21797 C <ref name="foo" />
21798
21799 <references />
21800 !! html
21801 <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>
21802 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>
21803 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>
21804
21805 <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>
21806 </ol>
21807 !!end
21808
21809 !!test
21810 References: 1. references tag without any refs should be handled properly
21811 !! wikitext
21812 <references />
21813 !! html/parsoid
21814 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
21815 !!end
21816
21817 !!test
21818 References: 2. references tag with group only outputs references from that group
21819 !! wikitext
21820 A <ref group="a">foo</ref>
21821 B <ref group="b">bar</ref>
21822 C <ref>baz</ref>
21823
21824 <references group="a" />
21825 <references />
21826 <references group="b" />
21827 !! html/parsoid
21828 <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>
21829 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>
21830 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>
21831
21832 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="a" data-mw='{"name":"references","attrs":{"group":"a"}}'>
21833 <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>
21834 </ol>
21835 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'>
21836 <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>
21837 </ol>
21838 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt12" data-mw-group="b" data-mw='{"name":"references","attrs":{"group":"b"}}'>
21839 <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>
21840 </ol>
21841 !!end
21842
21843 !!test
21844 References: 3. ref list should be cleared after processing references
21845 !! wikitext
21846 A <ref>foo</ref>
21847
21848 <references />
21849
21850 B <ref>bar</ref>
21851
21852 <references />
21853 !! html/parsoid
21854 <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>
21855
21856 <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>
21857 </ol>
21858
21859 <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>
21860
21861 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21862 <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>
21863 </ol>
21864 !!end
21865
21866 !!test
21867 References: 4. only referenced group should be cleared after processing references
21868 !! wikitext
21869 A <ref group="a">afoo</ref>
21870 B <ref>bfoo</ref>
21871
21872 <references group="a" />
21873
21874 C <ref>cfoo</ref>
21875
21876 <references />
21877 !! html/parsoid
21878 <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>
21879 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>
21880
21881 <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>
21882 </ol>
21883
21884 <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>
21885
21886 <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>
21887 </ol>
21888 !!end
21889
21890 !!test
21891 References: 5. ref tags in references should be processed while ignoring all other content
21892 !! wikitext
21893 A <ref name="a" />
21894 B <ref name="b">bar</ref>
21895
21896 <references>
21897 <ref name="a">foo</ref>
21898 This should just get lost.
21899 </references>
21900 !! html/parsoid
21901 <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>
21902 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>
21903
21904
21905 <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>
21906 </ol>
21907 !!end
21908
21909 !!test
21910 References: 6. <references /> from a transclusion
21911 !! wikitext
21912 <ref>Foo</ref> {{echo|<references />}}
21913 !! html/parsoid
21914 <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>
21915 </ol>
21916 !!end
21917
21918 !! test
21919 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
21920 !! wikitext
21921 A <ref>foo bar for a</ref>
21922 B <ref group="X" name="b" />
21923
21924 <references />
21925
21926 <references group="X">
21927 <ref name="b">foo</ref>
21928 </references>
21929 !! html/parsoid
21930 <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>
21931 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>
21932 </p>
21933
21934 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21935 <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>
21936 </ol>
21937
21938 <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"}}'>
21939 <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>
21940 </ol>
21941 !! end
21942
21943 !! test
21944 References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
21945 !! wikitext
21946 X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
21947 <references />
21948 !! html/parsoid
21949 <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>
21950 <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>
21951 </ol>
21952 !!end
21953
21954 # This test only works in wt2html now as the <references /> are always generated
21955 # unless selser is active. Once T72722 is fixed, we should add a changes test
21956 # here to ensure that unrelated changes don't add the new <references /> in
21957 # wt2wt.
21958 !! test
21959 References: 9. Generate missing references list at the end
21960 !! wikitext
21961 A <ref>foo</ref>
21962 B <ref group="inexistent">bar</ref>
21963 !! html/parsoid
21964 <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>
21965 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21966 <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>
21967 </ol>
21968 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="inexistent" data-mw='{"name":"references","attrs":{"group":"inexistent"}}'>
21969 <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>
21970 </ol>
21971 !! end
21972
21973 !! test
21974 References: 10. New <references/> shouldn't be added for unrelated edits.
21975 !! options
21976 parsoid={
21977 "modes": ["selser"],
21978 "changes": [["#x", "remove"]],
21979 "selser": "noauto"
21980 }
21981 !! wikitext
21982 Unrelated text<span id="x"> that's going to disappear</span>.
21983 A <ref>foo</ref>
21984 !! wikitext/edited
21985 Unrelated text.
21986 A <ref>foo</ref>
21987 !!end
21988
21989 !! test
21990 Entities in ref name
21991 !! wikitext
21992 <ref name="test &amp; me">hi</ref>
21993 <references />
21994 !! html/parsoid
21995 <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>
21996 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21997 <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>
21998 </ol>
21999 !! end
22000
22001 # This test is wt2html only because we're permitting the serializer to produce
22002 # dirty diffs, normalizing the unclosed references to the self-closed version.
22003 !! test
22004 Generate references for unclosed references tag
22005 !! options
22006 parsoid=wt2html
22007 !! wikitext
22008 a<ref>foo</ref>
22009
22010 <references>
22011 !! html/parsoid
22012 <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>
22013 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22014 <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>
22015 !! end
22016
22017 !! test
22018 New reference serializes on its own line
22019 !! options
22020 parsoid=wt2wt,html2wt
22021 !! wikitext
22022 foo
22023 <references />
22024 !! html/parsoid
22025 foo<ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
22026 !! end
22027
22028 #### ----------------------------------------------------------------
22029 #### Parsoid-only testing of Parsoid's impl of LST
22030 #### Not implemented yet, see
22031 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
22032 #### ----------------------------------------------------------------
22033
22034 !!test
22035 LST Sections: 1. Simple section start and end
22036 !! wikitext
22037 <section begin="2011-05-16" />
22038 <section end="2014-04-10 (MW 1.23wmf22)" />
22039 !! html/parsoid
22040 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
22041 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
22042 !! end
22043
22044 #--------- Test stripping of empty nodes in template content ----------
22045 !!test
22046 Empty LI and TR nodes should be stripped from template content
22047 !!wikitext
22048 {{EmptyLITest}}
22049 {{EmptyTRTest}}
22050 !!html/parsoid
22051 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
22052 <li>a</li>
22053 <li>b</li>
22054 </ul>
22055 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
22056 <tbody>
22057 <tr>
22058 <td>foo</td>
22059 </tr>
22060 <tr>
22061 <td>bar</td>
22062 </tr>
22063 </tbody>
22064 </table>
22065 !!end
22066
22067 !!test
22068 Empty LI and TR nodes should not be stripped from top-level content
22069 !!wikitext
22070 * a
22071 *
22072 * b
22073 {|
22074 |-
22075 |-
22076 |foo
22077 |}
22078 !!html/parsoid
22079 <ul>
22080 <li> a</li>
22081 <li></li>
22082 <li> b</li>
22083 </ul>
22084 <table>
22085 <tbody>
22086 <tr></tr>
22087 <tr>
22088 <td>foo</td>
22089 </tr>
22090 </tbody>
22091 </table>
22092 !!end
22093
22094 !!test
22095 Empty TR nodes should not be stripped if they have any attributes set
22096 !!wikitext
22097 {{EmptyTRWithHTMLAttrTest}}
22098 !!html/parsoid
22099 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
22100 <tr align="center"></tr>
22101 <tr><td>foo</td></tr>
22102 <tr align="center"></tr>
22103 <tr><td>bar</td></tr>
22104 </table>
22105 !!end
22106
22107 #### ----------------------------------------------------------------
22108 #### The following section of tests are primarily to test
22109 #### wikitext escaping capabilities of Parsoid. Given that
22110 #### escaping can be done any number of ways, the wikitext (input)
22111 #### is always adjusted to reflect how Parsoid adds nowiki
22112 #### escape tags.
22113 ####
22114 #### We are marking several tests as parsoid-only since the
22115 #### HTML in the result section is different from what the
22116 #### PHP parser generates for it.
22117 #### ----------------------------------------------------------------
22118
22119
22120 #### --------------- Headings ---------------
22121 #### 0. Unnested
22122 #### 1. Nested inside html <h1>=foo=</h1>
22123 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
22124 #### 3. Nested inside html with wikitext split by html tags
22125 #### 4. No escape needed
22126 #### 5. Empty headings <h1></h1>
22127 #### 6. Heading chars in SOL context
22128 #### ----------------------------------------
22129 !! test
22130 Headings: 0. Unnested
22131 !! options
22132 parsoid=html2wt
22133 !! html/parsoid
22134 <p>=foo=</p>
22135
22136 <p> =foo=
22137 <!--cmt-->
22138 =foo=</p>
22139
22140 <p>=foo<i>a</i>=</p>
22141 !! wikitext
22142 <nowiki>=foo=</nowiki>
22143
22144 <nowiki> </nowiki>=foo=
22145 <!--cmt-->
22146 <nowiki>=foo=</nowiki>
22147
22148 =foo''a''<nowiki>=</nowiki>
22149 !!end
22150
22151 # New headings and existing headings are handled differently
22152 !! test
22153 Headings: 1. Nested inside html
22154 !! options
22155 parsoid=html2wt
22156 !! html/parsoid
22157 <h1>=foo=</h1>
22158 <h2>=foo=</h2>
22159 <h3>=foo=</h3>
22160
22161 <h1 data-parsoid=''>=foo=</h1>
22162 <h2 data-parsoid=''>=foo=</h2>
22163 <h3 data-parsoid=''>=foo=</h3>
22164 <h4 data-parsoid=''>=foo=</h4>
22165 <h5 data-parsoid=''>=foo=</h5>
22166 <h6 data-parsoid=''>=foo=</h6>
22167 !! wikitext
22168 = =foo= =
22169
22170 == =foo= ==
22171
22172 === =foo= ===
22173
22174 =<nowiki>=foo=</nowiki>=
22175 ==<nowiki>=foo=</nowiki>==
22176 ===<nowiki>=foo=</nowiki>===
22177 ====<nowiki>=foo=</nowiki>====
22178 =====<nowiki>=foo=</nowiki>=====
22179 ======<nowiki>=foo=</nowiki>======
22180
22181 !!end
22182
22183 !! test
22184 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
22185 !! options
22186 parsoid=html2wt
22187 !! html/parsoid
22188 <h1>foo</h1>*bar
22189 <h1>foo</h1>=bar
22190 <h1>foo</h1>=bar=
22191 !! wikitext
22192 = foo =
22193 <nowiki>*</nowiki>bar
22194
22195 = foo =
22196 =bar
22197
22198 = foo =
22199 <nowiki>=bar=</nowiki>
22200 !!end
22201
22202 !! test
22203 Headings: 3. Nested inside html with wikitext split by html tags
22204 !! options
22205 parsoid=html2wt
22206 !! html/parsoid
22207 <h1>=<b>bold</b>foo=</h1>
22208 !! wikitext
22209 = ='''bold'''<nowiki>foo=</nowiki> =
22210 !!end
22211
22212 !! test
22213 Headings: 4a. No escaping needed (testing just h1 and h2)
22214 !! options
22215 parsoid=html2wt
22216 !! html/parsoid
22217 <h1>=foo</h1>
22218 <h1>foo=</h1>
22219 <h1> =foo= </h1>
22220 <h1>=foo= bar</h1>
22221 <h2>=foo</h2>
22222 <h2>foo=</h2>
22223 <h1>=</h1>
22224 <h1><i>=</i>foo=</h1>
22225 !! wikitext
22226 = =foo =
22227
22228 = foo= =
22229
22230 = =foo= =
22231
22232 = =foo= bar =
22233
22234 == =foo ==
22235
22236 == foo= ==
22237
22238 = = =
22239
22240 = ''=''foo= =
22241 !!end
22242
22243 !! test
22244 Headings: 4b. No escaping needed (inside p-tags)
22245 !! options
22246 parsoid=html2wt
22247 !! html/parsoid
22248 <p>===
22249 =foo= x
22250 =foo= <s></s>
22251 </p>
22252 !! wikitext
22253 ===
22254 =foo= x
22255 =foo= <s></s>
22256 !!end
22257
22258 !! test
22259 Headings: 5. Empty headings
22260 !! options
22261 parsoid=html2wt
22262 !! html/parsoid
22263 <h1 data-parsoid='{}'></h1>
22264
22265 <h2 data-parsoid='{}'></h2>
22266
22267 <h3 data-parsoid='{}'></h3>
22268
22269 <h4 data-parsoid='{}'></h4>
22270
22271 <h5 data-parsoid='{}'></h5>
22272
22273 <h6 data-parsoid='{}'></h6>
22274 !! wikitext
22275 =<nowiki/>=
22276
22277 ==<nowiki/>==
22278
22279 ===<nowiki/>===
22280
22281 ====<nowiki/>====
22282
22283 =====<nowiki/>=====
22284
22285 ======<nowiki/>======
22286 !!end
22287
22288 !! test
22289 Headings: 6a. Heading chars in SOL context (with trailing spaces)
22290 !! options
22291 parsoid=html2wt
22292 !! html/parsoid
22293 <p>=a=</p>
22294
22295 <p>=a=</p>
22296
22297 <p>=a=</p>
22298 !! wikitext
22299 <nowiki>=a=</nowiki>
22300
22301 <nowiki>=a=</nowiki>
22302
22303 <nowiki>=a=</nowiki>
22304 !!end
22305
22306 !! test
22307 Headings: 6b. Heading chars in SOL context (with trailing newlines)
22308 !! options
22309 parsoid=html2wt
22310 !! html/parsoid
22311 <p>=a=
22312 b</p>
22313
22314 <p>=a=
22315 b</p>
22316
22317 <p>=a=
22318 b</p>
22319 !! wikitext
22320 <nowiki>=a=</nowiki>
22321 b
22322
22323 <nowiki>=a=</nowiki>
22324 b
22325
22326 <nowiki>=a=</nowiki>
22327 b
22328 !!end
22329
22330 !! test
22331 Headings: 6c. Heading chars in SOL context (leading newline break)
22332 !! options
22333 parsoid=html2wt
22334 !! html/parsoid
22335 <p>a
22336 =b=</p>
22337 !! wikitext
22338 a
22339 <nowiki>=b=</nowiki>
22340 !!end
22341
22342 !! test
22343 Headings: 6d. Heading chars in SOL context (with interspersed comments)
22344 !! options
22345 parsoid=html2wt
22346 !! html/parsoid
22347 <!--c0--><p>=a=</p>
22348
22349 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
22350 !! wikitext
22351 <!--c0--><nowiki>=a=</nowiki>
22352
22353 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
22354 !!end
22355
22356 !! test
22357 Headings: 6d. Heading chars in SOL context (No escaping needed)
22358 !! options
22359 parsoid=html2wt
22360 !! html/parsoid
22361 =a=<div>b</div>
22362 !! wikitext
22363 =a=<div>b</div>
22364 !!end
22365
22366 !! test
22367 Headings: 7. Insert a newline between new content and headings
22368 !! options
22369 parsoid=html2wt
22370 !! html/parsoid
22371 <h2>NEW</h2>
22372 <p>new</p>
22373 <h2 data-parsoid='{}'>A</h2>
22374 <p data-parsoid='{}'>a</p>
22375 !! wikitext
22376 == NEW ==
22377 new
22378
22379 ==A==
22380 a
22381
22382 !! end
22383
22384 #### --------------- Lists ---------------
22385 #### 0. Outside nests (*foo, etc.)
22386 #### 1. Nested inside html <ul><li>*foo</li></ul>
22387 #### 2. Inside definition lists
22388 #### 3. Only bullets at start should be escaped
22389 #### 4. No escapes needed
22390 #### 5. No unnecessary escapes
22391 #### 6. Escape bullets in SOL position
22392 #### 7. Escape bullets in a multi-line context
22393 #### ----------------------------------------
22394
22395 !! test
22396 Lists: 0. Outside nests
22397 !! options
22398 parsoid=html2wt
22399 !! html/parsoid
22400 <p>*foo</p>
22401
22402 <p>#foo</p>
22403
22404 <p>;Foo:bar</p>
22405 !! wikitext
22406 <nowiki>*</nowiki>foo
22407
22408 <nowiki>#</nowiki>foo
22409
22410 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
22411 !!end
22412
22413 !! test
22414 Lists: 1. Nested inside html
22415 !! options
22416 parsoid=html2wt
22417 !! html/parsoid
22418 <ul><li>*foo</li></ul>
22419 <ul><li>#foo</li></ul>
22420 <ul><li>:foo</li></ul>
22421 <ul><li>;foo</li></ul>
22422 <ol><li>*foo</li></ol>
22423 <ol><li>#foo</li></ol>
22424 <ol><li>:foo</li></ol>
22425 <ol><li>;foo</li></ol>
22426
22427 !! wikitext
22428 *<nowiki>*foo</nowiki>
22429
22430 *<nowiki>#foo</nowiki>
22431
22432 *<nowiki>:foo</nowiki>
22433
22434 *<nowiki>;foo</nowiki>
22435
22436 #<nowiki>*foo</nowiki>
22437
22438 #<nowiki>#foo</nowiki>
22439
22440 #<nowiki>:foo</nowiki>
22441
22442 #<nowiki>;foo</nowiki>
22443 !!end
22444
22445 !! test
22446 Lists: 2. Inside definition lists
22447 !! options
22448 parsoid=html2wt
22449 !! html/parsoid
22450 <dl><dt>;foo</dt></dl>
22451 <dl><dt>:foo</dt></dl>
22452 <dl><dt>:foo</dt>
22453 <dd>bar</dd></dl>
22454 <dl><dd>:foo</dd></dl>
22455
22456 !! wikitext
22457 ;<nowiki>;foo</nowiki>
22458
22459 ;<nowiki>:foo</nowiki>
22460
22461 ;<nowiki>:foo</nowiki>
22462 :bar
22463
22464 :<nowiki>:foo</nowiki>
22465 !!end
22466
22467 !! test
22468 Lists: 3. Only bullets at start of text should be escaped
22469 !! options
22470 parsoid=html2wt
22471 !! html/parsoid
22472 <ul><li>*foo*bar</li></ul>
22473 <ul><li>*foo<i>it</i>*bar</li></ul>
22474
22475 !! wikitext
22476 *<nowiki>*foo*bar</nowiki>
22477
22478 *<nowiki>*foo</nowiki>''it''*bar
22479 !!end
22480
22481 !! test
22482 Lists: 4. No escapes needed
22483 !! options
22484 parsoid=html2wt
22485 !! html/parsoid
22486 <ul>
22487 <li>foo*bar
22488 </li>
22489 </ul>
22490 <ul>
22491 <li><i>foo</i>*bar
22492 </li>
22493 </ul>
22494 <ul>
22495 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
22496 </li>
22497 </ul>
22498 <ul>
22499 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
22500 </li>
22501 </ul>
22502 !! wikitext
22503 *foo*bar
22504
22505 *''foo''*bar
22506
22507 *[[Foo]]: bar
22508
22509 *[[Foo]]*bar
22510 !!end
22511
22512 !! test
22513 Lists: 5. No unnecessary escapes
22514 !! options
22515 parsoid=html2wt
22516 !! html/parsoid
22517 <ul><li> bar <span>[[foo]]</span></li></ul>
22518 <ul><li> =bar <span>[[foo]]</span></li></ul>
22519 <ul><li> [[bar <span>[[foo]]</span></li></ul>
22520 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
22521 <ul><li> =bar <span>foo]]</span>=</li></ul>
22522 <ul><li> <s></s>: a</li></ul>
22523 <ul><li> <i>* foo</i></li></ul>
22524
22525 !! wikitext
22526 * bar <span><nowiki>[[foo]]</nowiki></span>
22527
22528 * =bar <span><nowiki>[[foo]]</nowiki></span>
22529
22530 * [[bar <span><nowiki>[[foo]]</nowiki></span>
22531
22532 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
22533
22534 * =bar <span>foo]]</span>=
22535
22536 * <s></s>: a
22537
22538 * ''* foo''
22539 !!end
22540
22541 !! test
22542 Lists: 6. Escape bullets in SOL position
22543 !! options
22544 parsoid=html2wt
22545 !! html/parsoid
22546 <p><!--cmt-->*foo</p>
22547 !! wikitext
22548 <!--cmt--><nowiki>*</nowiki>foo
22549 !!end
22550
22551 !! test
22552 Lists: 7. Escape bullets in a multi-line context
22553 !! options
22554 parsoid=html2wt
22555 !! html/parsoid
22556 <p>a
22557 *b
22558 </p>
22559 !! wikitext
22560 a
22561 <nowiki>*</nowiki>b
22562 !!end
22563
22564 !! test
22565 Lists: 8. Escape colons only if not present in tags
22566 !! options
22567 parsoid=html2wt
22568 !! html/parsoid
22569 <dl><dt>a:b<i>c:d</i></dt></dl>
22570 !! wikitext
22571 ; <nowiki>a:b</nowiki>''c:d''
22572 !! end
22573
22574 #### --------------- HRs ---------------
22575 #### 1. Single line
22576 #### -----------------------------------
22577
22578 !! test
22579 HRs: 1. Single line
22580 !! options
22581 parsoid=html2wt
22582 !! html/parsoid
22583 <hr />----
22584 <hr />=foo=
22585 <hr />*foo
22586 !! wikitext
22587 ----<nowiki>----</nowiki>
22588 ----=foo=
22589 ----*foo
22590 !! end
22591
22592 #### --------------- Tables ---------------
22593 #### 1a. Simple example
22594 #### 1b. No escaping needed (!foo)
22595 #### 1c. No escaping needed (|foo)
22596 #### 1d. No escaping needed (|}foo)
22597 ####
22598 #### 2a. Nested in td (<td>foo|bar</td>)
22599 #### 2b. Nested in td (<td>foo||bar</td>)
22600 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
22601 ####
22602 #### 3a. Nested in th (<th>foo!bar</th>)
22603 #### 3b. Nested in th (<th>foo!!bar</th>)
22604 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
22605 ####
22606 #### 4a. Escape -
22607 #### 4b. Escape +
22608 #### 4c. No escaping needed
22609 #### --------------------------------------
22610
22611 !! test
22612 Tables: 1a. Simple example
22613 !! options
22614 parsoid=html2wt
22615 !! html/parsoid
22616 <p>{|
22617 |}
22618 </p>
22619 !! wikitext
22620 <nowiki>{|</nowiki>
22621 |}
22622 !! end
22623
22624 !! test
22625 Tables: 1b. No escaping needed
22626 !! options
22627 parsoid=html2wt
22628 !! html/parsoid
22629 <p>!foo
22630 </p>
22631 !! wikitext
22632 !foo
22633 !! end
22634
22635 !! test
22636 Tables: 1c. No escaping needed
22637 !! options
22638 parsoid=html2wt
22639 !! html/parsoid
22640 <p>|foo
22641 </p>
22642 !! wikitext
22643 |foo
22644 !! end
22645
22646 !! test
22647 Tables: 1d. No escaping needed
22648 !! options
22649 parsoid=html2wt
22650 !! html/parsoid
22651 <p>|}foo
22652 </p>
22653 !! wikitext
22654 |}foo
22655 !! end
22656
22657 !! test
22658 Tables: 2a. Nested in td
22659 !! options
22660 parsoid=html2wt
22661 !! html/parsoid
22662 <table><tbody><tr>
22663 <td>foo|bar</td></tr>
22664 <tr><td>x<div>a|b</div></td>
22665 </tbody></table>
22666 !! wikitext
22667 {|
22668 |<nowiki>foo|bar</nowiki>
22669 |-
22670 |x<div><nowiki>a|b</nowiki></div>
22671 |}
22672 !! html/php+tidy
22673 <table>
22674 <tr>
22675 <td>foo|bar</td>
22676 </tr>
22677 <tr>
22678 <td>x
22679 <div>a|b</div>
22680 </td>
22681 </tr>
22682 </table>
22683 !! end
22684
22685 !! test
22686 Tables: 2b. Nested in td
22687 !! options
22688 parsoid=html2wt
22689 !! html/parsoid
22690 <table><tbody><tr>
22691 <td>foo||bar</td>
22692 <td>a<i>b||c</i></td>
22693 <td>a<i><div>b||c</div></i></td>
22694 </tr></tbody></table>
22695 !! wikitext
22696 {|
22697 |<nowiki>foo||bar</nowiki>
22698 |a''<nowiki>b||c</nowiki>''
22699 |a''<div><nowiki>b||c</nowiki></div>''
22700 |}
22701 !! html/php
22702 <table>
22703 <tr>
22704 <td>foo||bar
22705 </td>
22706 <td>a<i>b||c</i>
22707 </td>
22708 <td>a<i><div>b||c</div></i>
22709 </td></tr></table>
22710
22711 !! end
22712
22713 !! test
22714 Tables: 2c. Nested in td -- no escaping needed
22715 !! options
22716 parsoid=html2wt
22717 !! html/*
22718 <table>
22719
22720 <tr>
22721 <td>foo!!bar
22722 </td></tr></table>
22723
22724 !! wikitext
22725 {|
22726
22727 |foo!!bar
22728 |}
22729 !! end
22730
22731 !! test
22732 Tables: 3a. Nested in th
22733 !! options
22734 parsoid=html2wt
22735 !! html/*
22736 <table>
22737
22738 <tr>
22739 <th>foo!bar
22740 </th></tr></table>
22741
22742 !! wikitext
22743 {|
22744
22745 !foo!bar
22746 |}
22747 !! end
22748
22749 !! test
22750 Tables: 3b. Nested in th
22751 !! options
22752 parsoid=html2wt
22753 !! html/parsoid
22754 <table><tbody>
22755 <tr><th>foo!!bar</th>
22756 <th><i>foo|bar</i></th>
22757 <th><i>foo!!bar</i></th>
22758 <th><i><span>foo!!bar</span></i></th>
22759 </tr></tbody></table>
22760 !! wikitext
22761 {|
22762 !<nowiki>foo!!bar</nowiki>
22763 !''<nowiki>foo|bar</nowiki>''
22764 !''<nowiki>foo!!bar</nowiki>''
22765 !''<span><nowiki>foo!!bar</nowiki></span>''
22766 |}
22767 !! html/php
22768 <table>
22769 <tr>
22770 <th>foo!!bar
22771 </th>
22772 <th><i>foo|bar</i>
22773 </th>
22774 <th><i>foo!!bar</i>
22775 </th>
22776 <th><i><span>foo!!bar</span></i>
22777 </th></tr></table>
22778
22779 !! end
22780
22781 !! test
22782 Tables: 3c. Nested in th
22783 !! options
22784 parsoid=html2wt
22785 !! html/parsoid
22786 <table><tbody>
22787 <tr><th>foo||bar</th>
22788 <th><span typeof="mw:Nowiki">foo||bar</span></th>
22789 </tr></tbody></table>
22790 !! wikitext
22791 {|
22792 !<nowiki>foo||bar</nowiki>
22793 !<nowiki>foo||bar</nowiki>
22794 |}
22795 !! html/php
22796 <table>
22797 <tr>
22798 <th>foo||bar
22799 </th>
22800 <th>foo||bar
22801 </th></tr></table>
22802
22803 !! end
22804
22805 !! test
22806 Tables: 4a. Escape -
22807 !! options
22808 parsoid=html2wt
22809 !! html/*
22810 <table>
22811
22812 <tr>
22813 <th>-bar
22814 </th></tr>
22815 <tr>
22816 <td>-bar
22817 </td></tr></table>
22818
22819 !! wikitext
22820 {|
22821
22822 !-bar
22823
22824 |-
22825 |<nowiki>-bar</nowiki>
22826 |}
22827 !! end
22828
22829 !! test
22830 Tables: 4b. Escape +
22831 !! options
22832 parsoid=html2wt
22833 !! html/*
22834 <table>
22835
22836 <tr>
22837 <th>+bar
22838 </th></tr>
22839 <tr>
22840 <td>+bar
22841 </td></tr></table>
22842
22843 !! wikitext
22844 {|
22845
22846 !+bar
22847
22848 |-
22849 |<nowiki>+bar</nowiki>
22850 |}
22851 !! end
22852
22853 !! test
22854 Tables: 4c. No escaping needed
22855 !! options
22856 parsoid=html2wt
22857 !! html/parsoid
22858 <table><tbody>
22859 <tr><td>foo-bar</td><td>foo+bar</td></tr>
22860 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
22861 <tr><td>foo
22862 <p>bar|baz
22863 +bar
22864 -bar</p></td></tr>
22865 <tr><td>x
22866 <div>a|b</div></td>
22867 </tbody></table>
22868 !! wikitext
22869 {|
22870 |foo-bar
22871 |foo+bar
22872 |-
22873 |''foo''-bar
22874 |''foo''+bar
22875 |-
22876 |foo
22877 bar|baz
22878 +bar
22879 -bar
22880 |-
22881 |x
22882 <div>a|b</div>
22883 |}
22884 !! html/php
22885 <table>
22886 <tr>
22887 <td>foo-bar
22888 </td>
22889 <td>foo+bar
22890 </td></tr>
22891 <tr>
22892 <td><i>foo</i>-bar
22893 </td>
22894 <td><i>foo</i>+bar
22895 </td></tr>
22896 <tr>
22897 <td>foo
22898 <p>bar|baz
22899 +bar
22900 -bar
22901 </p>
22902 </td></tr>
22903 <tr>
22904 <td>x
22905 <div>a|b</div>
22906 </td></tr></table>
22907
22908 !! end
22909
22910 !! test
22911 Tables: 4d. No escaping needed
22912 !! options
22913 parsoid=html2wt
22914 !! html/parsoid
22915 <table>
22916 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
22917 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
22918 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
22919 </tbody></table>
22920 !! wikitext
22921 {|
22922 |[[Foo]]-bar
22923 ||+1
22924 ||-2
22925 |}
22926 !! html/php
22927 <table>
22928 <tr>
22929 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
22930 </td>
22931 <td>+1
22932 </td>
22933 <td>-2
22934 </td></tr></table>
22935
22936 !! end
22937
22938 !! test
22939 T97430: Don't emit empty nowiki pairs around marker meta tags
22940 !! options
22941 parsoid=html2wt
22942 !! html/parsoid
22943 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
22944 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
22945 !! wikitext
22946 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
22947 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
22948 !! end
22949
22950 !! test
22951 Unclosed xmlish element in table line shouldn't eat end delimiters
22952 !! options
22953 parsoid=html2wt
22954 !! html/parsoid
22955 <table>
22956 <tbody><tr><td> &lt;foo</td>
22957 <td> bar></td></tr>
22958 </tbody></table>
22959 !! wikitext
22960 {|
22961 | <foo
22962 | bar>
22963 |}
22964 !! html/php
22965 <table>
22966 <tr>
22967 <td> &lt;foo
22968 </td>
22969 <td> bar&gt;
22970 </td></tr></table>
22971
22972 !! end
22973
22974 #### --------------- Links ----------------
22975 #### 1. Quote marks in link text
22976 #### 2. Wikilinks: Escapes needed
22977 #### 3. Wikilinks: No escapes needed
22978 #### 4. Extlinks: Escapes needed
22979 #### 5. Extlinks: No escapes needed
22980 #### --------------------------------------
22981 !! test
22982 Links 1. WikiLinks: No escapes needed
22983 !! options
22984 parsoid=html2wt
22985 !! html/parsoid
22986 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
22987 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
22988 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
22989 !! wikitext
22990 [[Foo|Foo''boo'']]
22991 [[Foo|[Foobar]]]
22992 [[Foo|x [Foobar] x]]
22993 !! html/php
22994 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
22995 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
22996 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
22997 </p>
22998 !! end
22999
23000 !! test
23001 Links 2. WikiLinks: Escapes needed
23002 !! options
23003 parsoid=html2wt
23004 !! html/parsoid
23005 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
23006 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
23007 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
23008 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
23009 <a href="Foo" rel="mw:WikiLink">|Bar</a>
23010 <a href="Foo" rel="mw:WikiLink">]]bar</a>
23011 <a href="Foo" rel="mw:WikiLink">[[bar</a>
23012 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
23013 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
23014 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
23015 !! wikitext
23016 [[Foo|<nowiki>Foobar]</nowiki>]]
23017 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
23018 [[Foo|<nowiki>[[Bar]]</nowiki>]]
23019 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
23020 [[Foo|<nowiki>|Bar</nowiki>]]
23021 [[Foo|<nowiki>]]bar</nowiki>]]
23022 [[Foo|<nowiki>[[bar</nowiki>]]
23023 [[Foo|<nowiki>x [[ y</nowiki>]]
23024 [[Foo|<nowiki>x ]] y</nowiki>]]
23025 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
23026 !! html/php
23027 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
23028 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
23029 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
23030 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
23031 <a href="/wiki/Foo" title="Foo">|Bar</a>
23032 <a href="/wiki/Foo" title="Foo">]]bar</a>
23033 <a href="/wiki/Foo" title="Foo">[[bar</a>
23034 <a href="/wiki/Foo" title="Foo">x [[ y</a>
23035 <a href="/wiki/Foo" title="Foo">x ]] y</a>
23036 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
23037 </p>
23038 !! end
23039
23040 !! test
23041 Links 3. WikiLinks: No escapes needed
23042 !! options
23043 parsoid=html2wt
23044 !! html/parsoid
23045 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
23046 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
23047 !! wikitext
23048 [[Foo|[Foobar]]
23049 [[Foo|foo|bar]]
23050 !! html/php
23051 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
23052 <a href="/wiki/Foo" title="Foo">foo|bar</a>
23053 </p>
23054 !! end
23055
23056 !! test
23057 Links 4. ExtLinks: Escapes needed
23058 !! options
23059 parsoid=html2wt
23060 !! html/parsoid
23061 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
23062 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
23063 <p>[http://google.com]</p>
23064 <p>[http://google.com google]</p>
23065 !! wikitext
23066 [http://google.com <nowiki>[google]</nowiki>]
23067 [http://google.com <nowiki>google]</nowiki>]
23068
23069 <nowiki>[http://google.com]</nowiki>
23070
23071 <nowiki>[http://google.com google]</nowiki>
23072
23073 !! html/php
23074 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
23075 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
23076 </p><p>[http://google.com]
23077 </p><p>[http://google.com google]
23078 </p>
23079 !! end
23080
23081 !! test
23082 Links 5. ExtLinks: No escapes needed
23083 !! options
23084 parsoid=html2wt
23085 !! html/parsoid
23086 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
23087 !! wikitext
23088 [http://google.com [google]
23089 !! html/php
23090 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
23091 </p>
23092 !! end
23093
23094 !! test
23095 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
23096 !! options
23097 parsoid=html2wt
23098 !! html/parsoid
23099 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
23100 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
23101 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
23102 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
23103 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
23104 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
23105 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
23106 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
23107 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
23108 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
23109 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
23110 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
23111 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
23112 </p>
23113 !! wikitext
23114 x<nowiki/>http://example.com<nowiki/>y
23115 http://example.com<nowiki/>?x
23116 http://example.com<nowiki/>&x
23117 http://example.com<nowiki/>'x
23118 http://example.com<nowiki/>,x
23119 http://example.com<nowiki/>.x
23120 http://example.com<nowiki/>;x
23121 http://example.com<nowiki/>:x
23122 http://example.com<nowiki/>;x
23123 http://example.com<nowiki/>!x
23124 http://example.com<nowiki/>=x
23125 http://example.com<nowiki/>(x)
23126 http://example.com(x<nowiki/>)
23127 !! end
23128
23129 !! test
23130 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
23131 !! options
23132 parsoid=html2wt
23133 !! html/parsoid
23134 <p>x
23135 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
23136 y
23137 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
23138 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
23139 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
23140 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
23141 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
23142 </p>
23143 !! wikitext
23144 x
23145 http://example.com
23146 y
23147 "http://example.com"
23148 (http://example.com)
23149 (http://example.com) foo
23150 http://example.com,
23151 http://example.com, foo
23152 !! html/php
23153 <p>x
23154 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
23155 y
23156 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
23157 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
23158 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
23159 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
23160 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
23161 </p>
23162 !! end
23163
23164 !! test
23165 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
23166 !! options
23167 parsoid=html2wt
23168 !! html/parsoid
23169 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
23170 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
23171 !! wikitext
23172 http://example.com.,;:!?\
23173 -http://example.com:
23174 !! html/php
23175 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
23176 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
23177 </p>
23178 !! end
23179
23180 !! test
23181 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
23182 !! options
23183 parsoid=html2wt
23184 !! html/parsoid
23185 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
23186 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
23187 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
23188 !! wikitext
23189 RFC 123<nowiki/>4
23190 RFC 123<nowiki/>y
23191 X<nowiki/>RFC 123<nowiki/>y
23192 !! end
23193
23194 !! test
23195 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
23196 !! options
23197 parsoid=html2wt
23198 !! html/parsoid
23199 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
23200 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
23201 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
23202 </p>
23203 !! wikitext
23204 RFC 123?foo
23205 RFC 123&foo
23206 -RFC 123-
23207 !! html/php
23208 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
23209 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
23210 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
23211 </p>
23212 !! end
23213
23214 !! test
23215 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
23216 !! options
23217 parsoid=html2wt
23218 !! html/parsoid
23219 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
23220 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
23221 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
23222 !! wikitext
23223 PMID 123<nowiki/>4
23224 PMID 123<nowiki/>y
23225 X<nowiki/>PMID 123<nowiki/>y
23226 !! end
23227
23228 !! test
23229 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
23230 !! options
23231 parsoid=html2wt
23232 !! html/parsoid
23233 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
23234 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
23235 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
23236 </p>
23237 !! wikitext
23238 PMID 123?foo
23239 PMID 123&foo
23240 -PMID 123-
23241 !! html/php
23242 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
23243 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
23244 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
23245 </p>
23246 !! end
23247
23248 !! test
23249 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
23250 !! options
23251 parsoid=html2wt
23252 !! html/parsoid
23253 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
23254 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
23255 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
23256 </p>
23257 !! wikitext
23258 ISBN 1234567890<nowiki/>1
23259 ISBN 1234567890<nowiki/>x
23260 a<nowiki/>ISBN 1234567890<nowiki/>b
23261 !! end
23262
23263 !! test
23264 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
23265 !! options
23266 parsoid=html2wt
23267 !! html/parsoid
23268 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
23269 !! wikitext
23270 -ISBN 1234567890's
23271 !! html/php
23272 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
23273 </p>
23274 !! end
23275
23276 !! test
23277 Links 14. Protect link-like plain text. (Parsoid bug T78425)
23278 !! options
23279 parsoid=html2wt
23280 !! html/*
23281 <p>this is not a link: http://example.com
23282 </p>
23283 !! wikitext
23284 <nowiki>this is not a link: http://example.com</nowiki>
23285 !! end
23286
23287 !! test
23288 Links 15. Link trails can't become link prefixes.
23289 !! options
23290 language=is
23291 parsoid=html2wt
23292 !! html/parsoid
23293 <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>
23294 !! wikitext
23295 [[Söfnuður]]-[[00]]
23296 !! html/php
23297 <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>
23298 </p>
23299 !! end
23300
23301 #### --------------- Quotes ---------------
23302 #### 1. Quotes inside <b> and <i>
23303 #### 2. Link fragments separated by <i> and <b> tags
23304 #### 3. Link fragments inside <i> and <b>
23305 #### 4. No escaping needed
23306 #### --------------------------------------
23307 !! test
23308 1a. Quotes inside <b> and <i>
23309 !! options
23310 parsoid=html2wt
23311 !! html/*
23312 <p><i>'foo'</i>
23313 <i>''foo''</i>
23314 <i>'''foo'''</i>
23315 <i>foo</i>'s
23316 <b>'foo'</b>
23317 <b>''foo''</b>
23318 <b>'''foo'''</b>
23319 <b>foo'<i>bar'</i>baz</b>
23320 <b>foo</b>'s
23321 '<i>foo</i>
23322 <i>foo</i>'
23323 <i>foo'</i>'
23324 '<i>foo</i>'
23325 '<b>foo</b>
23326 <b>foo</b>'
23327 '<b>foo</b>'
23328 <i>fools'<span> errand</span></i>
23329 <i><span>fool</span>'s errand</i>
23330 '<i>foo</i> bar '<i>baz</i>
23331 a|!*#-:;+-~[]{}b'<i>x</i>
23332 </p>
23333 !! wikitext
23334 ''<nowiki/>'foo'''
23335 ''<nowiki>''foo''</nowiki>''
23336 ''<nowiki>'''foo'''</nowiki>''
23337 ''foo''<nowiki/>'s
23338 '''<nowiki/>'foo''''
23339 '''<nowiki>''foo''</nowiki>'''
23340 '''<nowiki>'''foo'''</nowiki>'''
23341 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
23342 '''foo'''<nowiki/>'s
23343 '''foo''
23344 ''foo''<nowiki/>'
23345 ''foo'''<nowiki/>'
23346 '''foo''<nowiki/>'
23347 ''''foo'''
23348 '''foo'''<nowiki/>'
23349 ''''foo'''<nowiki/>'
23350 ''fools'<span> errand</span>''
23351 ''<span>fool</span>'s errand''
23352 '<nowiki/>''foo'' bar '''baz''
23353 a|!*#-:;+-~[]{}b'''x''
23354 !! end
23355
23356 !! test
23357 1b. Quotes inside <b> and <i> with other tags on same line
23358 !! options
23359 parsoid=html2wt
23360 !! html/parsoid
23361 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
23362 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
23363 <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>
23364 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
23365 '<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>
23366 '<i>foo</i> <div title="name">test</div>
23367 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
23368 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
23369 <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>
23370 </ol>
23371 !! wikitext
23372 '''a'' foo ''[[bar]]''
23373 ''a''' foo ''[[bar]]''
23374 ''a''' foo '''{{echo|[[bar]]}}'''
23375 [[foo]] x'''[[bar]]''
23376 '''foo'' <ref>test</ref>
23377 '''foo'' <div title="name">test</div>
23378 '''foo'' and <br> bar
23379 <references />
23380 !! end
23381
23382 !! test
23383 2. Link fragments separated by <i> and <b> tags
23384 !! options
23385 parsoid=html2wt
23386 !! html/parsoid
23387 <p>[[<i>foo</i>hello]]</p>
23388 <p>[[<b>foo</b>hello]]</p>
23389 !! wikitext
23390 [[''foo''<nowiki>hello]]</nowiki>
23391
23392 [['''foo'''<nowiki>hello]]</nowiki>
23393 !! end
23394
23395 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
23396 # this is one of the shortcomings of this format
23397 !! test
23398 3. Link fragments inside <i> and <b>
23399 !! options
23400 parsoid=html2wt
23401 !! html/parsoid
23402 <p><i>[[foo</i>]]</p>
23403 <p><b>[[foo</b>]]</p>
23404 !! wikitext
23405 ''[[foo''<nowiki>]]</nowiki>
23406
23407 '''[[foo'''<nowiki>]]</nowiki>
23408 !! end
23409
23410 !! test
23411 4. No escaping needed
23412 !! options
23413 options=html2wt
23414 !! html/parsoid
23415 <p>'<span><i>bar</i></span>'
23416 '<span><b>bar</b></span>'
23417 'a:b'foo
23418 </p>
23419 !! wikitext
23420 '<span>''bar''</span>'
23421 '<span>'''bar'''</span>'
23422 'a:b'foo
23423 !! end
23424
23425 #### ----------- Paragraphs ---------------
23426 #### 1. No unnecessary escapes
23427 #### --------------------------------------
23428
23429 !! test
23430 1. No unnecessary escapes
23431 !! options
23432 parsoid=html2wt
23433 !! html/parsoid
23434 <p>bar <span>[[foo]]</span>
23435 </p><p>=bar <span>[[foo]]</span>
23436 </p><p>[[bar <span>[[foo]]</span>
23437 </p><p>]]bar <span>[[foo]]</span>
23438 </p><p>=bar <span>foo]]</span>=
23439 </p>
23440 !! wikitext
23441 bar <span><nowiki>[[foo]]</nowiki></span>
23442
23443 =bar <span><nowiki>[[foo]]</nowiki></span>
23444
23445 [[bar <span><nowiki>[[foo]]</nowiki></span>
23446
23447 ]]bar <span><nowiki>[[foo]]</nowiki></span>
23448
23449 =bar <span>foo]]</span><nowiki>=</nowiki>
23450 !!end
23451
23452 #### ----------------------- PRE --------------------------
23453 #### 1. Leading whitespace in SOL context should be escaped
23454 #### ------------------------------------------------------
23455 !! test
23456 1. Leading whitespace in SOL context should be escaped
23457 !! options
23458 parsoid=html2wt
23459 !! html/parsoid
23460 <p> a</p>
23461
23462 <p> a</p>
23463
23464 <p> a(tab)</p>
23465
23466 <p> a
23467 <!--cmt-->
23468 a</p>
23469
23470 <p>a
23471 b</p>
23472
23473 <p>a
23474 b</p>
23475
23476 <p>a
23477 b</p>
23478 !! wikitext
23479 <nowiki> </nowiki>a
23480
23481 <nowiki> </nowiki> a
23482
23483 a(tab)
23484
23485 <nowiki> </nowiki> a
23486 <!--cmt-->
23487 <nowiki> </nowiki>a
23488
23489 a
23490 <nowiki> </nowiki>b
23491
23492 a
23493 b
23494
23495 a
23496 b
23497 !! html/php
23498 <p> a
23499 </p><p> a
23500 </p><p> a(tab)
23501 </p><p> a
23502 a
23503 </p><p>a
23504 b
23505 </p><p>a
23506 b
23507 </p><p>a
23508 b
23509 </p>
23510 !! end
23511
23512 !! test
23513 2. Leading whitespace in non-indent-pre contexts should not be escaped
23514 !! options
23515 parsoid=htm2wt
23516 !! html/parsoid
23517 <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>
23518 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
23519 <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>
23520 b</span></li>
23521 </ol>
23522 !! wikitext
23523 foo <ref>''a''
23524 b</ref>
23525 <references />
23526 !! end
23527
23528 !! test
23529 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
23530 !! options
23531 parsoid=html2wt
23532 !! html/parsoid
23533 <blockquote>
23534 <p>
23535 a
23536 <span>b</span>
23537 c</p>
23538 </blockquote>
23539 !! wikitext
23540 <blockquote>
23541 a
23542 <span>b</span>
23543 c
23544 </blockquote>
23545 !! end
23546
23547 !! test
23548 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
23549 !! options
23550 options=html2wt
23551 !! html/parsoid
23552 <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>
23553 !! wikitext
23554 [[File:Foobar.jpg|thumb|caption]]
23555 !! end
23556
23557 !! test
23558 5. Nowiki escaping should account for indent-pres
23559 !! options
23560 parsoid=html2wt
23561 !! html/parsoid
23562 <pre>==foo==</pre>
23563 !! wikitext
23564 ==foo==
23565 !! end
23566
23567 !!test
23568 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
23569 !! options
23570 parsoid=html2wt
23571 !! html/parsoid
23572 <pre>
23573 * foo
23574 * bar
23575 </pre>
23576 !! wikitext
23577 * foo
23578 * bar
23579 !! end
23580
23581 #### --------------- Behavior Switches --------------------
23582
23583 !! test
23584 1. Valid behavior switches should be escaped
23585 !! options
23586 parsoid=html2wt
23587 !! html/parsoid
23588 __TOC__
23589 <i>__TOC__</i>
23590 !! wikitext
23591 <nowiki>__TOC__</nowiki>
23592 ''<nowiki>__TOC__</nowiki>''
23593 !! end
23594
23595 !! test
23596 2. Invalid behavior switches should not be escaped
23597 !! options
23598 parsoid=html2wt
23599 !! html/parsoid
23600 __TOO__
23601 __|__
23602 !! wikitext
23603 __TOO__
23604 __|__
23605 !! end
23606
23607 # We use indent-pre as an indirect way to test for sol-transparent behavior.
23608 !! test
23609 Behavior switches should be SOL-transparent
23610 !! options
23611 parsoid=html2wt
23612 !! html/parsoid
23613 <meta property="mw:PageProp/toc" />
23614
23615 <!-- this one's bogus -->
23616 <pre>__TOO__</pre>
23617
23618 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
23619
23620 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
23621 !! wikitext
23622 __TOC__
23623
23624 <!-- this one's bogus -->
23625 __TOO__
23626
23627 __TOC__ foo
23628
23629 __TOC__
23630 bar
23631 !! end
23632
23633 #### --------------- HTML tags ---------------
23634 #### 1. a tags
23635 #### 2. other tags
23636 #### 3. multi-line html tag
23637 #### 4. extension tags
23638 #### -----------------------------------------
23639 !! test
23640 1. a tags
23641 !! options
23642 parsoid=html2wt
23643 !! html/parsoid
23644 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
23645 !! wikitext
23646 <a href="http://google.com">google</a>
23647 !! end
23648
23649 !! test
23650 2. other tags
23651 !! options
23652 parsoid=html2wt
23653 !! html/parsoid
23654 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
23655 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
23656 <li> &lt;td&gt;</li></ul>
23657
23658 !! wikitext
23659 * <nowiki><div>foo</div></nowiki>
23660 * <nowiki><div style="color:red">foo</div></nowiki>
23661 * <nowiki><td></nowiki>
23662 !! end
23663
23664 !! test
23665 3. multi-line html tag
23666 !! options
23667 parsoid=html2wt
23668 !! html/parsoid
23669 <p>&lt;div
23670 &gt;foo&lt;/div
23671 &gt;
23672 </p>
23673 !! wikitext
23674 <nowiki><div
23675 >foo</div
23676 ></nowiki>
23677 !! end
23678
23679 !! test
23680 4. extension tags
23681 !! options
23682 parsoid=html2wt
23683 !! html/parsoid
23684 <p>&lt;ref&gt;foo&lt;/ref&gt;
23685 </p><p>&lt;ref&gt;bar
23686 </p><p>baz&lt;/ref&gt;
23687 </p>
23688 !! wikitext
23689 <nowiki><ref>foo</ref></nowiki>
23690
23691 <nowiki><ref>bar</nowiki>
23692
23693 baz<nowiki></ref></nowiki>
23694 !! end
23695
23696 #### --------------- Others ---------------
23697 !! test
23698 Escaping nowikis
23699 !! options
23700 parsoid=html2wt
23701 !! html/parsoid
23702 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
23703 </p>
23704 !! wikitext
23705 &lt;nowiki&gt;foo&lt;/nowiki&gt;
23706 !! end
23707
23708 ## The quote-char in the input is necessary for triggering the bug
23709 !! test
23710 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
23711 !! options
23712 parsoid=html2wt
23713 !! html/parsoid
23714 <p>foo's bar :</p>
23715 !! wikitext
23716 foo's bar :
23717 !! end
23718
23719 #----------- End of wikitext escaping tests --------------
23720
23721 !! test
23722
23723 Tag-like HTML structures are passed through as text
23724 !! wikitext
23725 <x y>
23726
23727 <x.y>
23728
23729 <x-y>
23730
23731 1>2
23732
23733 x<y
23734
23735 a>b
23736
23737 1<d e>f
23738 !! html
23739 <p>&lt;x y&gt;
23740 </p><p>&lt;x.y&gt;
23741 </p><p>&lt;x-y&gt;
23742 </p><p>1&gt;2
23743 </p><p>x&lt;y
23744 </p><p>a&gt;b
23745 </p><p>1&lt;d e&gt;f
23746 </p>
23747 !! end
23748
23749 !! test
23750 HTML tag with necessary entities in attributes
23751 !! wikitext
23752 <span title="&amp;amp;">foo</span>
23753 !! html
23754 <p><span title="&amp;amp;">foo</span>
23755 </p>
23756 !! end
23757
23758 !! test
23759 HTML tag with 'unnecessary' entity encoding in attributes
23760 !! wikitext
23761 <span title="&amp;">foo</span>
23762 !! html
23763 <p><span title="&amp;">foo</span>
23764 </p>
23765 !! end
23766
23767 !! test
23768 HTML tag with broken attribute value quoting
23769 !! wikitext
23770 <span title="Hello world>Foo</span>
23771 !! html/php
23772 <p><span title="Hello world">Foo</span>
23773 </p>
23774 !! html/parsoid
23775 <p><span title="Hello world">Foo</span>
23776 </p>
23777 !! end
23778
23779 !! test
23780 Table with broken attribute value quoting
23781 !! wikitext
23782 {|
23783 | title="Hello world|Foo
23784 |}
23785 !! html/php
23786 <table>
23787 <tr>
23788 <td title="Hello world">Foo
23789 </td></tr></table>
23790
23791 !! html/parsoid
23792 <table>
23793 <tr>
23794 <td title="Hello world">Foo
23795 </td></tr></table>
23796
23797 !! end
23798
23799 !! test
23800 Table with broken attribute value quoting on consecutive lines
23801 !! wikitext
23802 {|
23803 | title="Hello world|Foo
23804 | style="color:red|Bar
23805 |}
23806 !! html/php
23807 <table>
23808 <tr>
23809 <td title="Hello world">Foo
23810 </td>
23811 <td style="color:red">Bar
23812 </td></tr></table>
23813
23814 !! html/parsoid
23815 <table><tbody>
23816 <tr>
23817 <td title="Hello world">Foo
23818 </td><td style="color: red">Bar
23819 </td></tr></tbody></table>
23820
23821 !! end
23822
23823 !! test
23824 2. Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
23825 !! options
23826 parsoid
23827 !! wikitext
23828 {{}}
23829 !! html
23830 {{}}
23831 !! end
23832
23833 !! test
23834 1. Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
23835 !! options
23836 parsoid
23837 !! wikitext
23838 }}{{
23839 !! html
23840 }}{{
23841 !! end
23842
23843 !!test
23844 Accept empty td cell attribute
23845 !! wikitext
23846 {|
23847 | align="center" | foo || |
23848 |}
23849 !! html
23850 <table>
23851 <tr>
23852 <td align="center"> foo </td>
23853 <td>
23854 </td></tr></table>
23855
23856 !!end
23857
23858 !!test
23859 Non-empty attributes in th-cells
23860 !! wikitext
23861 {|
23862 ! Foo !! style="color: red" | Bar
23863 |}
23864 !! html
23865 <table>
23866 <tr>
23867 <th> Foo </th>
23868 <th style="color: red"> Bar
23869 </th></tr></table>
23870
23871 !!end
23872
23873 !!test
23874 Accept empty attributes in th-cells
23875 !! wikitext
23876 {|
23877 !| foo !!| bar
23878 |}
23879 !! html
23880 <table>
23881 <tr>
23882 <th> foo </th>
23883 <th> bar
23884 </th></tr></table>
23885
23886 !!end
23887
23888 !!test
23889 Empty table rows go away
23890 !! wikitext
23891 {|
23892 | Hello
23893 | there
23894 |- class="foo"
23895 |-
23896 |}
23897 !! html
23898 <table>
23899 <tr>
23900 <td> Hello
23901 </td>
23902 <td> there
23903 </td></tr>
23904
23905 </table>
23906
23907 !! end
23908
23909 ###
23910 ### Parsoid-centric tests for testing RTing of inter-element separators
23911 ### Edge cases not tested by existing parser tests and specific to
23912 ### Parsoid-specific serialization strategies.
23913 ###
23914
23915 !!test
23916 RT-ed inter-element separators should be valid separators
23917 !! wikitext
23918 {|
23919 |- [[foo]]
23920 |}
23921 !! html/php
23922 <table>
23923
23924 </table>
23925
23926 !! html/parsoid
23927 <table>
23928 <tbody><tr data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
23929 </tbody></table>
23930 !!end
23931
23932 # Parsoid-only since PHP parser relies on Tidy for correct output
23933 !!test
23934 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
23935 !!options
23936 parsoid
23937 !! wikitext
23938 {|
23939 |<small>foo
23940 bar
23941 |}
23942
23943 {|
23944 |<small>foo<small>
23945 |}
23946 !! html
23947 <table>
23948 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
23949 <p>bar</p></small></td></tr>
23950 </tbody></table>
23951
23952 <table>
23953 <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>
23954 </tbody></table>
23955 !!end
23956
23957 # Note that the "style" attribute is really a template parameter here.
23958 # The = would have to be {{=}} if you wanted the literal.
23959 !!test
23960 Empty TD followed by TD with tpl-generated attribute
23961 !! wikitext
23962 {|
23963 |-
23964 |
23965 |{{echo|style='color:red'}}|foo
23966 |}
23967 !! html
23968 <table>
23969
23970 <tr>
23971 <td>
23972 </td>
23973 <td>foo
23974 </td></tr></table>
23975
23976 !!end
23977
23978 !!test
23979 Indented table with an empty td
23980 !! wikitext
23981 {|
23982 |-
23983 |
23984 |foo
23985 |}
23986 !! html
23987 <table>
23988
23989 <tr>
23990 <td>
23991 </td>
23992 <td>foo
23993 </td></tr></table>
23994
23995 !!end
23996
23997 ## We have some newline diffs RT-ing this edge case
23998 ## and it is not important enough -- we seem to be emitting
23999 ## at most 2 newlines after a </tr> and this is unrelated to
24000 ## the issue from T85627 that this is testing.
24001 !!test
24002 Indented table with blank lines in between (T85627)
24003 !! options
24004 parsoid=wt2html
24005 !! wikitext
24006 {|
24007 |foo
24008
24009
24010 |}
24011 !! html
24012 <table>
24013
24014 <tr>
24015 <td>foo
24016 </td></tr></table>
24017
24018 !!end
24019
24020 !!test
24021 Indented block & table
24022 !! wikitext
24023 <div>foo</div>
24024 {|
24025 |foo
24026 |}
24027 !! html/php
24028 <div>foo</div>
24029 <table>
24030 <tr>
24031 <td>foo
24032 </td></tr></table>
24033
24034 !! html/parsoid
24035 <div data-parsoid='{"stx":"html"}'>foo</div>
24036 <table><tbody>
24037 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
24038 </tbody></table>
24039 !!end
24040
24041 !! test
24042 Indent and comment before table row
24043 !! wikitext
24044 {|
24045 <!--hi-->|-
24046 | there
24047 |}
24048 !! html/php
24049 <table>
24050
24051 <tr>
24052 <td> there
24053 </td></tr></table>
24054
24055 !! html/parsoid
24056 <table>
24057 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
24058 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
24059 </tbody></table>
24060 !! end
24061
24062 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
24063 !!test
24064 Empty TR followed by a template-generated TR
24065 !!options
24066 parsoid
24067 !! wikitext
24068 {|
24069 |-
24070 {{echo|<tr><td>foo</td></tr>}}
24071 |}
24072 !! html
24073 <table>
24074 <tbody>
24075 <tr></tr>
24076 <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}}]}'>
24077 <td>foo</td></tr>
24078 </tbody></table>
24079 !!end
24080
24081 ## PHP and parsoid output differ for this, and since this is primarily
24082 ## for testing Parsoid's serializer, marking this Parsoid only
24083 !!test
24084 Empty TR followed by mixed-ws-comment line should RT correctly
24085 !!options
24086 parsoid
24087 !! wikitext
24088 {|
24089 |-
24090 <!--c-->
24091 |-
24092 <!--c--> <!--d-->
24093 |}
24094 !! html
24095 <table>
24096 <tbody>
24097 <tr></tr>
24098 <!--c-->
24099 <tr>
24100 <!--c--> </tr><!--d-->
24101 </tbody></table>
24102
24103 !!end
24104
24105 !!test
24106 Multi-line image caption generated by templates with/without trailing newlines
24107 !! wikitext
24108 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
24109 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
24110 !! html/parsoid
24111 <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>
24112 <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>
24113 !!end
24114
24115 !! test
24116 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
24117 !! options
24118 parsoid=html2wt
24119 !! html/parsoid
24120 <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>
24121
24122 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
24123 !! wikitext
24124 <includeonly>foo</includeonly>
24125 new para
24126
24127 [[Category:Foo]]
24128
24129 = new heading =
24130 !! end
24131
24132 ## PHP emits broken html for this, and since this is primarily
24133 ## a Parsoid serializer test, marking this Parsoid only
24134 !!test
24135 Improperly nested inline or quotes tags with whitespace in between
24136 !! wikitext
24137 <span> <s>x</span> </s>
24138 ''' ''x''' ''
24139 !! html/parsoid
24140 <p><span> <s>x</s></span><s> </s>
24141 <b> <i>x</i></b><i> </i>
24142 </p>
24143 !!end
24144
24145 !!test
24146 Encapsulate protected attributes from wt
24147 !! wikitext
24148 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
24149 !! html/parsoid
24150 <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>
24151 </body>
24152 !!end
24153
24154 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
24155 ## Having nested or stray pre tags results in the attempt to add duplicates,
24156 ## causing an assertion fail. This test tries to prevent that situation.
24157 !!test
24158 Ensure ParagraphWrapper can deal with stray closing pre tags
24159 !!options
24160 parsoid=wt2html
24161 !! wikitext
24162 plain text</pre>
24163 !! html/parsoid
24164 plain text
24165 !!end
24166
24167 !!test
24168 1. Ensure fostered text content is wrapped in element nodes
24169 !!options
24170 parsoid=wt2html
24171 !! wikitext
24172 <table>hi</table><table>ho</table>
24173 !! html/parsoid
24174 <p>hi</p>
24175 <table></table>
24176 <p>ho</p>
24177 <table></table>
24178 !!end
24179
24180 !!test
24181 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
24182 !!options
24183 parsoid=wt2html,wt2wt
24184 !! wikitext
24185 <table>
24186 <tr> || ||
24187 <td> a
24188 </table>
24189 !! html/parsoid
24190 <p> || ||
24191 </p><table>
24192 <tbody><tr><td> a</td></tr>
24193 </tbody></table>
24194 !!end
24195
24196 !!test
24197 Encapsulation properly handles null DSR information from foster box
24198 !!options
24199 parsoid=wt2html,wt2wt
24200 !! wikitext
24201 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
24202 !! html/parsoid
24203 <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>
24204 !!end
24205
24206 !!test
24207 1. Encapsulate foster-parented transclusion content
24208 !!options
24209 parsoid=wt2wt,wt2html
24210 !! wikitext
24211 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
24212 !! html/parsoid
24213 <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>
24214 <tbody>
24215 <tr>
24216 <td>bar</td>
24217 </tr>
24218 </tbody>
24219 </table>
24220 !!end
24221
24222 !!test
24223 2. Encapsulate foster-parented transclusion content
24224 !!options
24225 parsoid=wt2wt,wt2html
24226 !! wikitext
24227 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
24228 !! html/parsoid
24229 <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>
24230 <table>
24231 <tbody>
24232 <tr>
24233 <td>bar</td>
24234 </tr>
24235 </tbody>
24236 </table>
24237 !!end
24238
24239 !!test
24240 3. Encapsulate foster-parented transclusion content
24241 !!options
24242 parsoid=wt2wt,wt2html
24243 !! wikitext
24244 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
24245 !! html/parsoid
24246 <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;]}">
24247 <p>foo</p>
24248 </div>
24249 <table>
24250 <tbody>
24251 <tr>
24252 <td>bar</td>
24253 </tr>
24254 </tbody>
24255 </table>
24256 !!end
24257
24258 !!test
24259 4. Encapsulate foster-parented transclusion content
24260 !!options
24261 parsoid=wt2wt,wt2html
24262 !! wikitext
24263 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
24264 !! html/parsoid
24265 <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;]}">
24266 <p>foo</p>
24267 </div>
24268 <table>
24269 <tbody>
24270 <tr>
24271 <td>bar</td>
24272 </tr>
24273 </tbody>
24274 </table>
24275 !!end
24276
24277 !!test
24278 5. Encapsulate foster-parented transclusion content
24279 !!options
24280 parsoid=wt2wt,wt2html
24281 !! wikitext
24282 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
24283 !! html/parsoid
24284 <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>
24285 <table>
24286 <tbody>
24287 <tr>
24288 <td>
24289 <div>
24290 <p>foo</p>
24291 </div>
24292 </td>
24293 </tr>
24294 </tbody>
24295 </table>
24296 !!end
24297
24298 !!test
24299 6. Encapsulate foster-parented transclusion content
24300 !!options
24301 parsoid=wt2wt,wt2html
24302 !! wikitext
24303 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
24304 !! html/parsoid
24305 <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>
24306 <table>
24307 <tbody>
24308 <tr>
24309 <td>
24310 <div>
24311 <p>foo</p>
24312 </div>
24313 </td>
24314 </tr>
24315 </tbody>
24316 </table>
24317 <p>ok</p>
24318 !!end
24319
24320 !!test
24321 7. Encapsulate foster-parented transclusion content
24322 !!options
24323 parsoid=wt2wt,wt2html
24324 !! wikitext
24325 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
24326 !! html/parsoid
24327 <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>
24328 <table>
24329 <tbody>
24330 <tr>
24331 <td>bar</td>
24332 </tr>
24333 </tbody>
24334 </table>
24335 !!end
24336
24337 # Note that the wt is broken on purpose: the = should be {{=}} if you
24338 # don't want it to be a template parameter key.
24339 !!test
24340 8. Encapsulate foster-parented transclusion content
24341 !!options
24342 parsoid=wt2wt,wt2html
24343 !! wikitext
24344 {{echo|a
24345 }}{|{{echo|style='color:red'}}
24346 |-
24347 |b
24348 |}
24349 !! html/parsoid
24350 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
24351 <span> </span>
24352 <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>
24353 <table>
24354 <tbody>
24355 <tr>
24356 <td>b</td>
24357 </tr>
24358 </tbody>
24359 </table>
24360 !!end
24361
24362 !!test
24363 9. Encapsulate foster-parented transclusion content
24364 !!options
24365 parsoid=wt2wt,wt2html
24366 !! wikitext
24367 <table>{{echo|hi</table>hello}}
24368 !! html/parsoid
24369 <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>
24370 !!end
24371
24372 !!test
24373 Table in fosterable position
24374 !!options
24375 parsoid=wt2html,wt2wt
24376 !! wikitext
24377 {{OpenTable}}
24378 <div>
24379 {|
24380 |}
24381 </div>
24382 |}
24383 !! html/parsoid
24384 <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">
24385 </span>
24386 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
24387
24388 <table>
24389 </table>
24390 !!end
24391
24392 # Parsoid only for bug 64747
24393 !! test
24394 Properly encapsulate empty-content transclusions in fosterable positions
24395 !! wikitext
24396 <table>
24397 {{#if:|
24398 <td>foo</td>
24399 }}
24400 </table>
24401 !! html/parsoid
24402 <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":["","","",""]}]]}'>
24403
24404 </table>
24405 !! end
24406
24407 !!test
24408 Support <object> element with .data attribute
24409 !!options
24410 parsoid=html2wt
24411 !! html/parsoid
24412 <object data="test.swf"></object>
24413 !! wikitext
24414 <object data="test.swf"></object>
24415 !!end
24416
24417 !! test
24418 Don't block XML namespace declaration
24419 !! wikitext
24420 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
24421 !! html/php
24422 <p><span>MediaWiki</span>
24423 </p>
24424 !! html/parsoid
24425 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
24426 !! end
24427
24428 # -----------------------------------------------------------------
24429 # The following section of tests are primarily to spec requirements
24430 # around serialization of new/edited content.
24431 #
24432 # All these tests are marked Parsoid html2wt and html2html only
24433 # ----------------------------------------------------------------
24434
24435 # 'mi' is a localinterwiki prefix as well as a language
24436 !! test
24437 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
24438 !! options
24439 parsoid=html2wt
24440 !! html/parsoid
24441 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
24442 !! wikitext
24443 [[Foo]]
24444 !! end
24445
24446 # See T93839
24447 !! test
24448 New wikilinks should be serialized properly
24449 !! options
24450 parsoid=html2wt
24451 !! html/parsoid
24452 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
24453 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
24454 !! wikitext
24455 [[Foo]]
24456 [[Foo]]
24457 !! end
24458
24459 !! test
24460 New wiki links (href variations)
24461 !! options
24462 parsoid=html2wt
24463 !! html/parsoid
24464 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
24465 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
24466 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
24467 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
24468 !! wikitext
24469 [[Foo_bar]]
24470 [[Foo_bar]]
24471 [[Foo_bar]]
24472 [[Toxine bactérienne]]
24473 !! end
24474
24475 !! test
24476 New wiki links (content string variations)
24477 !! options
24478 parsoid=html2wt
24479 !! html/parsoid
24480 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
24481 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
24482 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
24483 !! wikitext
24484 [[Foo_bar]]
24485 [[Foo bar]]
24486 [[Foo_bar|./Foo_bar]]
24487 !! end
24488
24489 !! test
24490 New category links (href variations)
24491 !! options
24492 parsoid=html2wt
24493 !! html/parsoid
24494 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
24495 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
24496 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
24497 !! wikitext
24498 [[Category:Toxine bactérienne]]
24499 [[Category:Toxine bactérienne]]
24500 [[Category:Toxine bactérienne]]
24501 !! end
24502
24503 !! test
24504 New sol transparent links don't need indent-pre nowiki protection
24505 !! options
24506 parsoid=html2wt
24507 language=de
24508 !! html/parsoid
24509 <link rel="mw:PageProp/redirect" href="./Main_Page">
24510 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
24511 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
24512 !! wikitext
24513 #WEITERLEITUNG [[Main Page]]
24514 <!-- this is good --> [[Category:Good]]
24515 <!-- this is great --> [[Kategorie:Great]]
24516 !! end
24517
24518 !! test
24519 New interlanguage links (href variations)
24520 !! options
24521 parsoid=html2wt
24522 !! html/parsoid
24523 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
24524 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
24525 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
24526 !! wikitext
24527 [[es:Toxine bactérienne]]
24528 [[es:Toxine_bactérienne]]
24529 [[es:Toxine_bactérienne]]
24530 !! end
24531
24532 !! test
24533 Image: Modifying size of an image (1)
24534 !! options
24535 parsoid={
24536 "modes": ["wt2wt"],
24537 "changes": [
24538 ["img[height]", "attr", "height", "22"],
24539 ["img[width]", "attr", "width", "200"]
24540 ]
24541 }
24542 !! wikitext
24543 [[Image:Foobar.jpg|230x230px]]
24544 !! wikitext/edited
24545 [[Image:Foobar.jpg|200x200px]]
24546 !!end
24547
24548 !! test
24549 Image: Modifying size of an image (2)
24550 !! options
24551 parsoid={
24552 "modes": ["wt2wt"],
24553 "changes": [
24554 ["img[height]", "attr", "height", "100"],
24555 ["img[width]", "attr", "width", "500"]
24556 ]
24557 }
24558 !! wikitext
24559 [[Image:Foobar.jpg|230x230px]]
24560 !! wikitext/edited
24561 [[Image:Foobar.jpg|500x500px]]
24562 !!end
24563
24564 # Change in size is ignored so long as class='mw-default-size'
24565 !! test
24566 Image: Modifying size of an image (3)
24567 !! options
24568 parsoid={
24569 "modes": ["wt2wt"],
24570 "changes": [
24571 ["figure[class]", "removeClass", "mw-default-size"],
24572 ["figure img", "attr", "height", "19"],
24573 ["figure img", "attr", "width", "170"]
24574 ]
24575 }
24576 !! wikitext
24577 [[Image:Foobar.jpg|thumb]]
24578 !! wikitext/edited
24579 [[Image:Foobar.jpg|thumb|170x170px]]
24580 !!end
24581
24582 !! test
24583 Image: Modifying alignment of an image (bug 48665)
24584 !! options
24585 parsoid={
24586 "modes": ["wt2wt"],
24587 "changes": [
24588 ["figure[class]", "removeClass", "mw-halign-right"],
24589 ["figure[class]", "addClass", "mw-halign-left"]
24590 ]
24591 }
24592 !! wikitext
24593 [[Image:Foobar.jpg|thumb|caption|right]]
24594 !! wikitext/edited
24595 [[Image:Foobar.jpg|thumb|caption|left]]
24596 !! end
24597
24598 !! test
24599 Image: Modifying mw-default-size of an frameless image (bug 62805)
24600 !! options
24601 parsoid={
24602 "modes": ["wt2wt"],
24603 "changes": [
24604 ["figure.mw-default-size", "removeClass", "mw-default-size"]
24605 ]
24606 }
24607 !! wikitext
24608 [[Image:Foobar.jpg|frameless|right]]
24609 !! wikitext/edited
24610 [[Image:Foobar.jpg|frameless|right|220x220px]]
24611 !! end
24612
24613 !! test
24614 Image: Modifying valign of an image (bug 49221)
24615 !! options
24616 parsoid={
24617 "modes": ["wt2wt"],
24618 "changes": [
24619 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
24620 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
24621 ]
24622 }
24623 !! wikitext
24624 [[File:Foobar.jpg|20px|middle]]
24625 !! wikitext/edited
24626 [[File:Foobar.jpg|20px|text-top]]
24627 !! end
24628
24629 !! test
24630 Image: Modifying alt attribute of an image (bug 56400)
24631 !! options
24632 parsoid={
24633 "modes": ["wt2wt"],
24634 "changes": [
24635 ["img[alt]", "attr", "alt", "some alternate edited text"]
24636 ]
24637 }
24638 !! wikitext
24639 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
24640 !! wikitext/edited
24641 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
24642 !!end
24643
24644 !! test
24645 Image: Modifying caption of an image
24646 !! options
24647 parsoid={
24648 "modes": ["wt2wt"],
24649 "changes": [
24650 ["figcaption", "text", "new caption"]
24651 ]
24652 }
24653 !! wikitext
24654 [[Image:Foobar.jpg|thumb|original caption]]
24655 !! wikitext/edited
24656 [[Image:Foobar.jpg|thumb|new caption]]
24657 !!end
24658
24659 !! test
24660 Image: empty alt attribute (bug 48924)
24661 !! options
24662 parsoid
24663 !! wikitext
24664 [[File:Foobar.jpg|thumb|alt=|bar]]
24665 !! html
24666 <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>
24667 !! end
24668
24669 !! test
24670 Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
24671 !! options
24672 parsoid=html2wt
24673 language=ar
24674 disabled
24675 !! html/parsoid
24676 <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>
24677 !! wikitext
24678 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
24679 !! end
24680
24681 !! test
24682 Image: Block level image should have \n before and after
24683 !! wikitext
24684 123
24685 [[File:Foobar.jpg|right|thumb|150x150px]]
24686 456
24687 !! html/parsoid
24688 <p>123</p>
24689 <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>
24690 <p>456</p>
24691 !!end
24692
24693 !! test
24694 Image: New block level image should have \n before and after (existing content)
24695 !! wikitext
24696 123
24697 [[File:Foobar.jpg|right|thumb|150x150px]]
24698 456
24699 !! html/parsoid
24700 <p>123</p>
24701 <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>
24702 <p>456</p>
24703 !!end
24704
24705 !! test
24706 Image: upright option (parsoid)
24707 !! wikitext
24708 [[File:Foobar.jpg|thumb|upright|caption]]
24709 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
24710 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
24711 !! html/parsoid
24712 <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>
24713 <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>
24714 <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>
24715 !!end
24716
24717 !! test
24718 Image: upright option is ignored on inline and frame images (parsoid)
24719 !! wikitext
24720 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
24721 !! html/parsoid
24722 <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>
24723 !!end
24724
24725 !! test
24726 Image: from basic HTML (1)
24727 !! options
24728 parsoid=html2wt
24729 !! html/parsoid
24730 <span typeof="mw:Image">
24731 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
24732 </span>
24733 !! wikitext
24734 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
24735 !! end
24736
24737 !! test
24738 Image: from basic HTML (2)
24739 !! options
24740 parsoid=html2wt
24741 !! html/parsoid
24742 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
24743 !! wikitext
24744 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
24745 !! end
24746
24747 !! test
24748 Image: from basic HTML (3)
24749 !! options
24750 parsoid=html2wt
24751 !! html/parsoid
24752 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
24753 !! wikitext
24754 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
24755 !! end
24756
24757 !! test
24758 Image: from basic HTML (4)
24759 !! options
24760 parsoid=html2wt
24761 !! html/parsoid
24762 <img src="./File:Foobar.jpg">
24763 !! wikitext
24764 [[File:Foobar.jpg|link=]]
24765 !! end
24766
24767 !! test
24768 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
24769 !! options
24770 parsoid=html2wt
24771 !! html/parsoid
24772 <ul>
24773 <li><p>foo</p></li>
24774 </ul>
24775 !! wikitext
24776 * foo
24777 !! end
24778
24779 !! test
24780 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
24781 !! options
24782 parsoid=html2wt
24783 !! html/parsoid
24784 <ul> <li>foo</li></ul>
24785 !! wikitext
24786 * foo
24787 !! end
24788
24789 !! test
24790 Don't strip leading whitespace when handling indent-pre suppressing tags
24791 !! options
24792 parsoid=html2wt
24793 !! html/parsoid
24794 <table>
24795 <tr><td> indented row</td></tr>
24796 </table>
24797 <blockquote><p>
24798 <b>This is very bold of you!</b>
24799 </p>
24800 <table><tr><td>
24801 indented cell (no pre-wrapping!)
24802 </td></tr></table>
24803 </blockquote>
24804 <p>foo</p>
24805 <div>bar</div>
24806 !! wikitext
24807 {|
24808 | indented row
24809 |}
24810 <blockquote>
24811 '''This is very bold of you!'''
24812
24813 {|
24814 |
24815 indented cell (no pre-wrapping!)
24816 |}
24817 </blockquote>
24818 foo
24819 <div>bar</div>
24820 !! end
24821
24822 !! test
24823 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
24824 !! options
24825 parsoid=html2wt
24826 !! html/parsoid
24827 <p>foo</p>
24828 <span>bar</span>
24829
24830 <span>foo2
24831 </span>bar2
24832
24833 <div>foo</div>
24834 <span>bar</span>
24835
24836 <div>
24837 <span>foo</span>
24838 </div>
24839 !! wikitext
24840 foo
24841 <nowiki> </nowiki><span>bar</span>
24842
24843 <span>foo2
24844 <nowiki> </nowiki></span>bar2
24845
24846 <div>foo</div>
24847 <nowiki> </nowiki><span>bar</span>
24848
24849 <div>
24850 <nowiki> </nowiki><span>foo</span>
24851 </div>
24852 !! end
24853
24854 !! test
24855 Lists: Dont insert newlines in a serialized list item.
24856 !! options
24857 parsoid=html2wt
24858 !! html/parsoid
24859 <ul><li>a<br>b</li><li>c</li></ul>
24860 !! wikitext
24861 * a<br>b
24862 * c
24863 !! end
24864
24865 !! test
24866 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
24867 !! options
24868 parsoid={
24869 "modes": ["html2wt"],
24870 "scrubWikitext": false
24871 }
24872 !! html/parsoid
24873 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
24874 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
24875
24876 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
24877 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
24878
24879 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
24880
24881 <h2><meta property="mw:PageProp/toc" /> ok</h2>
24882 !! wikitext
24883 == hello there [[Category:A1]] ==
24884
24885 == [[Category:A2]] hi pal ==
24886
24887 == <!--foo--> [[Category:A3]] how goes it ==
24888
24889 == it goes well [[Category:A4]] <!--bar--> ==
24890
24891 ==howdy [[Category:A5]] ==
24892
24893 == __TOC__ ok ==
24894 !! end
24895
24896 !! test
24897 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
24898 !! options
24899 parsoid={
24900 "modes": ["html2wt"],
24901 "scrubWikitext": true
24902 }
24903 !! html/parsoid
24904 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
24905 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
24906
24907 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
24908 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
24909
24910 <h2><meta property="mw:PageProp/toc" /> ok</h2>
24911 !! wikitext
24912 == hello there ==
24913 [[Category:A1]]
24914 [[Category:A2]]
24915
24916 == hi pal ==
24917
24918 <!--foo--> [[Category:A3]]
24919
24920 == how goes it ==
24921
24922 == it goes well ==
24923 [[Category:A4]] <!--bar-->
24924
24925 __TOC__
24926
24927 == ok ==
24928 !! end
24929
24930 !! test
24931 Headings: Don't hoist metas that come from templates
24932 !! options
24933 parsoid={
24934 "modes": ["html2wt"],
24935 "scrubWikitext": true
24936 }
24937 !! html/parsoid
24938 <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>
24939 !! wikitext
24940 == {{echo|foo [[Category:Foo]]}} ==
24941 !! end
24942
24943 !! test
24944 Headings: Category in ref isn't hoisted
24945 !! options
24946 parsoid={
24947 "modes": ["html2wt"],
24948 "scrubWikitext": true
24949 }
24950 !! html/parsoid
24951 <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>
24952
24953 <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>
24954 !! wikitext
24955 == foo <ref>bar
24956 [[Category:Baz]] </ref> ==
24957
24958 <references />
24959 !! end
24960
24961 !! test
24962 Parsoid: Serialize positional parameters with = in them as named parameter
24963 !! options
24964 parsoid=html2wt
24965 !! html/parsoid
24966 <p about="#mwt1" typeof="mw:Transclusion"
24967 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
24968
24969 <p about="#mwt1" typeof="mw:Transclusion"
24970 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
24971
24972 <!--Orig params with data-parsoid has heuristics for handling = chars-->
24973 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
24974 <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>
24975 !! wikitext
24976 {{echo|1 = f=oo}}
24977
24978 {{echo|1 = f=oo|2 = bar}}
24979
24980 <!--Orig params with data-parsoid has heuristics for handling = chars-->
24981 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
24982 {{echo|<nowiki>f=oo</nowiki>|bar}}
24983 !! end
24984
24985 !! test
24986 Parsoid: Serialize positional parameters with = in extlink as named parameter
24987 !! options
24988 parsoid=html2wt
24989 !! html/parsoid
24990 <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>
24991 !! wikitext
24992 {{echo|1 = http://stuff?is=ok}}
24993 !! end
24994
24995 !! test
24996 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
24997 !! options
24998 parsoid=html2wt
24999 !! html/parsoid
25000 <div>a<p>b</p></div>
25001 <div>a
25002 <p>b</p></div>
25003 <div>
25004 a
25005 <p>b</p></div>
25006 !! wikitext
25007 <div>a
25008 b
25009 </div>
25010 <div>a
25011 b
25012 </div>
25013 <div>
25014 a
25015
25016 b
25017 </div>
25018 !! end
25019
25020 !! test
25021 Substrings resembling wikitext in hrefs should not get nowiki escapes
25022 !! options
25023 parsoid=html2wt
25024 !! html/parsoid
25025 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
25026 !! wikitext
25027 [[Foo''bar''baz]]
25028 !! end
25029
25030 !! test
25031 Enforce single-line context in the serializer
25032 !! options
25033 parsoid=html2wt
25034 !! html/parsoid
25035 <h2>testing
25036 123</h2>
25037
25038 <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">
25039 </span><span about="#mwt1">you</span> </h2>
25040
25041 <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>
25042
25043 <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
25044 there</span></li></ol>
25045
25046 <ul><li>asd
25047 sdf</li></ul>
25048
25049 <ul><li>foo
25050 bar
25051 baz</li>
25052 <li>foo <b>bar</b>
25053 baz</li></ul>
25054
25055 <dl><dt>hi
25056 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
25057 ho</dd></dl>
25058
25059 <dl><dd> <table>
25060 <tbody><tr><td> ha
25061 ha
25062 ha</td></tr>
25063 </tbody></table></dd></dl>
25064 !! wikitext
25065 == testing 123 ==
25066
25067 == hi {{bogus|there
25068 you}} ==
25069
25070 == foo <ref>hello
25071 there</ref> ==
25072
25073 <references />
25074
25075 * asd sdf
25076
25077 * foo bar baz
25078 * foo '''bar''' baz
25079
25080 ; hi ho : hi ho
25081
25082 : {|
25083 | ha
25084 ha
25085 ha
25086 |}
25087 !! end
25088
25089 !! test
25090 Serialize new placeholder space without spans
25091 !! options
25092 parsoid=html2wt
25093 !! html/parsoid
25094 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
25095
25096 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
25097
25098 <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>
25099 !! wikitext
25100 foo : bar
25101
25102 foo : bar
25103
25104 <ref>foo : bar</ref>ok
25105 !! end
25106
25107
25108 #-----------------------
25109 # Tag minimization tests
25110 #-----------------------
25111
25112 !! test
25113 1. I/B quote minimization: wikitext-only tags should be combined
25114 !! options
25115 parsoid=html2wt
25116 !! html/parsoid
25117 <p><i>A</i><i>B</i></p>
25118 <p><b>A</b><b>B</b></p>
25119 <p><i>A</i><b><i>B</i></b></p>
25120 <p><b>A</b><i><b>B</b></i></p>
25121 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
25122 <p><i><b>A</b></i><i><b>B</b></i></p>
25123 <p><i><b>A</b></i><b><i>B</i></b></p>
25124 <p><b><i>A</i></b><i><b>B</b></i></p>
25125 !! wikitext
25126 ''AB''
25127
25128 '''AB'''
25129
25130 ''A'''B'''''
25131
25132 '''A''B'''''
25133
25134 '''A''BC''D'''
25135
25136 '''''AB'''''
25137
25138 '''''AB'''''
25139
25140 '''''AB'''''
25141 !! end
25142
25143 !! test
25144 2. I/B quote minimization: wikitext and html tags should not be combined
25145 !! options
25146 parsoid=html2wt
25147 !! html/parsoid
25148 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
25149 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
25150 !! wikitext
25151 ''A''<i>B</i>
25152
25153 ''A''<nowiki/>'''<i>B</i>'''
25154 !! end
25155
25156 !! test
25157 3. I/B quote minimization: templated content stops minimization
25158 !! options
25159 parsoid=html2wt
25160 !! html/parsoid
25161 <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>
25162 <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>
25163 !! wikitext
25164 ''A''{{echo|''B''}}
25165
25166 ''A''{{echo|'''''B'''''}}
25167 !! end
25168
25169 !! test
25170 4. I/B quote minimization: new content should be mimimized with adjacent old content
25171 !! options
25172 parsoid=html2wt
25173 !! html/parsoid
25174 <p><i>A</i><i>B</i></p>
25175 <p><b>A</b><b>B</b></p>
25176 <p><i>A</i><b><i>B</i></b></p>
25177 !! wikitext
25178 ''AB''
25179
25180 '''AB'''
25181
25182 ''A'''B'''''
25183 !! end
25184
25185 !! test
25186 5a. Merge adjacent quote nodes if they've been edited
25187 !! options
25188 parsoid={
25189 "modes": ["wt2wt", "selser"],
25190 "changes": [
25191 ["p", "contents", "remove", ":contains('b')"]
25192 ]
25193 }
25194 !! wikitext
25195 ''a''b''c''
25196 !! wikitext/edited
25197 ''ac''
25198 !! end
25199
25200 !! test
25201 5b. Merge adjacent quote nodes if they've been edited
25202 !! options
25203 parsoid={
25204 "modes": ["wt2wt", "selser"],
25205 "changes": [
25206 ["#x", "remove"]
25207 ]
25208 }
25209 !! wikitext
25210 ''a''<span id="x">b</span>''c''
25211 !! wikitext/edited
25212 ''ac''
25213 !! end
25214
25215 !! test
25216 1. Merge adjacent link nodes as long as at least one element is new
25217 !! options
25218 parsoid={
25219 "modes": ["html2wt"],
25220 "scrubWikitext": true
25221 }
25222 !! html/parsoid
25223 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25224 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25225 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
25226 !! wikitext
25227 [[Football]]
25228 [[Football]]
25229 [[Football|Foot]][[Football|ball]]
25230 !! end
25231
25232 !! test
25233 2. Merge adjacent link nodes and enable additional normalizations
25234 !! options
25235 parsoid={
25236 "modes": ["html2wt"],
25237 "scrubWikitext": true
25238 }
25239 !! html/parsoid
25240 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
25241 !! wikitext
25242 [[Football|''Football'']]
25243 !! end
25244
25245 !! test
25246 3. Don't merge adjacent link nodes if scrubWikitext is false
25247 !! options
25248 parsoid={
25249 "modes": ["html2wt"],
25250 "scrubWikitext": false
25251 }
25252 !! html/parsoid
25253 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25254 !! wikitext
25255 [[Football|Foot]][[Football|ball]]
25256 !! end
25257
25258 #------------------------------
25259 # End of tag minimization tests
25260 #------------------------------
25261
25262 !!test
25263 Bug 54262: New entities
25264 !! options
25265 parsoid=html2wt
25266 !! html/parsoid
25267 <span typeof="mw:Entity">&nbsp;</span>
25268 !! wikitext
25269 &nbsp;
25270 !! end
25271
25272 ## Note that there is no wikitext output for 'unknownproperty' ##
25273 ## Unknown magic words are silently dropped ##
25274
25275 !! test
25276 Magic words
25277 !! options
25278 parsoid=html2wt
25279 !! html/parsoid
25280 <meta property='mw:PageProp/toc' />
25281 <meta property='mw:PageProp/notoc' />
25282 <meta property='mw:PageProp/forcetoc' />
25283 <meta property='mw:PageProp/index' />
25284 <meta property='mw:PageProp/noindex' />
25285 <meta property='mw:PageProp/nogallery' />
25286 <meta property='mw:PageProp/noeditsection' />
25287 <meta property='mw:PageProp/notitleconvert' />
25288 <meta property='mw:PageProp/nocontentconvert' />
25289 <meta property='mw:PageProp/unknownproperty' />
25290 !! wikitext
25291 __TOC__
25292 __NOTOC__
25293 __FORCETOC__
25294 __INDEX__
25295 __NOINDEX__
25296 __NOGALLERY__
25297 __NOEDITSECTION__
25298 __NOTITLECONVERT__
25299 __NOCONTENTCONVERT__
25300 !! end
25301
25302 !! test
25303 Consecutive <pre>s should not get merged
25304 !! options
25305 parsoid=html2wt,html2html
25306 !! html/parsoid
25307 <pre>a</pre><pre>b</pre>
25308
25309 <pre>c
25310 </pre><pre>
25311 d</pre>
25312
25313 <pre>e
25314
25315 </pre><pre>
25316
25317 f</pre>
25318 !! wikitext
25319 a
25320
25321 b
25322
25323 c
25324
25325 d
25326
25327 e
25328
25329
25330
25331 f
25332 !! end
25333
25334 !! test
25335 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
25336 !! options
25337 parsoid=html2wt
25338 !! html/parsoid
25339 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
25340 !! wikitext
25341 [[Special:BookSources/1234567890|ISBN 1234567895]]
25342 !! end
25343
25344 !! test
25345 Edited RFC links not serializable as RFC links should serialize as extlinks
25346 !! options
25347 parsoid=html2wt
25348 !! html/parsoid
25349 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
25350 !! wikitext
25351 [//tools.ietf.org/html/rfc123 New RFC]
25352 !! end
25353
25354 !! test
25355 Edited PMID links not serializable as PMID links should serialize as extlinks
25356 !! options
25357 parsoid=html2wt
25358 !! html/parsoid
25359 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
25360 !! wikitext
25361 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
25362 !! end
25363
25364 !! test
25365 WTS of autolinks with trailing/surrounding context
25366 !! options
25367 parsoid=html2wt
25368 !! html/parsoid
25369 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
25370 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
25371 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
25372 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
25373 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
25374 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
25375 !! wikitext
25376 http://cscott.net'''foo'''
25377
25378 http://cscott.net<b>foo</b>
25379
25380 '''http://cscott.net'''
25381
25382 '''http://cscott.net '''
25383
25384 '''http://cscott.net<nowiki/>x'''
25385
25386 http://cscott.net<nowiki/>x
25387 !! end
25388
25389 !! test
25390 WTS of autolinks with nowikis (round-trip)
25391 !! wikitext
25392 x<nowiki/>http://cscott.net<nowiki/>x
25393 !! html/parsoid
25394 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
25395 !! end
25396
25397 # this is the "easy" test because it leaves in place all the
25398 # data-parsoid information indicating this is an autolink
25399 !! test
25400 WTS of autolinks with escapes (editing)
25401 !! options
25402 parsoid={
25403 "modes": ["wt2wt"],
25404 "changes": [
25405 [ "meta", "remove" ]
25406 ]
25407 }
25408 !! wikitext
25409 x<nowiki/>http://cscott.net<nowiki/>x
25410 !! wikitext/edited
25411 x<nowiki/>http://cscott.net<nowiki/>x
25412 !! end
25413
25414 !! test
25415 WTS of edited autolink-like text (T103364)
25416 !! options
25417 parsoid={
25418 "modes": ["wt2wt"],
25419 "changes": [
25420 [ "span[typeof]", "removeAttr", "typeof" ]
25421 ]
25422 }
25423 !! wikitext
25424 Not a link: <nowiki>http://example.com</nowiki>.
25425 !! wikitext/edited
25426 Not a link: <span><nowiki>http://example.com</nowiki></span>.
25427 !! end
25428
25429 !! test
25430 WTS of newly-authored autolink-like text (T103364)
25431 !! options
25432 parsoid=html2wt
25433 !! html/parsoid
25434 <p>http://example.com is not a link.</p>
25435 !! wikitext
25436 <nowiki>http://example.com is not a link.</nowiki>
25437 !! end
25438
25439 !! test
25440 WTS of autolink-like text after an autolink (T108563)
25441 !! options
25442 parsoid=html2wt
25443 !! html/parsoid
25444 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
25445 !! wikitext
25446 http://example.com<nowiki> http://example.com is not a link.</nowiki>
25447 !! end
25448
25449 !! test
25450 Magic links inside links (not autolinked)
25451 !! wikitext
25452 [[Foo|http://example.com]]
25453 [[Foo|RFC 1234]]
25454 [[Foo|PMID 1234]]
25455 [[Foo|ISBN 123456789x]]
25456
25457 [http://foo.com http://example.com]
25458 [http://foo.com RFC 1234]
25459 [http://foo.com PMID 1234]
25460 [http://foo.com ISBN 123456789x]
25461 !! html+tidy
25462 <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>
25463 <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>
25464 !! html/parsoid
25465 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
25466 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
25467 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
25468 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
25469
25470 <p><a rel="mw:ExtLink" href="http://foo.com">http://example.com</a>
25471 <a rel="mw:ExtLink" href="http://foo.com">RFC 1234</a>
25472 <a rel="mw:ExtLink" href="http://foo.com">PMID 1234</a>
25473 <a rel="mw:ExtLink" href="http://foo.com">ISBN 123456789x</a></p>
25474 !! end
25475
25476 !! test
25477 Magic links inside image captions (autolinked)
25478 !! wikitext
25479 [[File:Foobar.jpg|thumb|http://example.com]]
25480 [[File:Foobar.jpg|thumb|RFC 1234]]
25481 [[File:Foobar.jpg|thumb|PMID 1234]]
25482 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
25483 !! html+tidy
25484 <div class="thumb tright">
25485 <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>
25486 <div class="thumbcaption">
25487 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25488 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div>
25489 </div>
25490 </div>
25491 <div class="thumb tright">
25492 <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>
25493 <div class="thumbcaption">
25494 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25495 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a></div>
25496 </div>
25497 </div>
25498 <div class="thumb tright">
25499 <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>
25500 <div class="thumbcaption">
25501 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25502 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a></div>
25503 </div>
25504 </div>
25505 <div class="thumb tright">
25506 <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>
25507 <div class="thumbcaption">
25508 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25509 <a href="/wiki/Special:BookSources/123456789X" class="internal mw-magiclink-isbn">ISBN 123456789x</a></div>
25510 </div>
25511 </div>
25512 !! html/parsoid
25513 <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>
25514 <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>
25515 <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>
25516 <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>
25517 !! end
25518
25519 !! test
25520 WTS of magic word text (T109371)
25521 !! options
25522 parsoid=html2wt
25523 !! html/parsoid
25524 <p>RFC 1234</p>
25525 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
25526 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
25527 !! wikitext
25528 <nowiki>RFC 1234</nowiki>
25529
25530 [http://foo.com RFC 1234]
25531
25532 [[Foo|RFC 1234]]
25533 !! end
25534
25535 !! test
25536 Edited Redirect link should emit a non-piped wikitext link
25537 !! options
25538 parsoid=html2wt
25539 !! html/parsoid
25540 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
25541 !! wikitext
25542 #REDIRECT [[Bar]]
25543 !! end
25544
25545 !! test
25546 T75121: Infer extension name from typeOf if data-mw is not present
25547 !! options
25548 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
25549 !! html/parsoid
25550 <div typeOf="mw:Extension/foo"></div>
25551 !! wikitext
25552 <foo />
25553 !! end
25554
25555 # Note that the <p> wrapping isn't present in PHP parser output
25556 # The important thing for this test is that P-wrapping doesn't
25557 # interfere with the <nowiki> protection for leading - in <td>
25558 # (which isn't necessary for <th>).
25559 !! test
25560 T88318: p-wrapped dash in table.
25561 !! options
25562 parsoid=html2wt,wt2wt
25563 !! html/parsoid
25564 <table><tbody>
25565 <tr><th><p>-</p></th><th><p>- </p></th></tr>
25566 <tr><td><p>-</p></td><td><p>- </p></td></tr>
25567 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
25568 </tbody></table>
25569 !! wikitext
25570 {|
25571 !-
25572 !-
25573 |-
25574 |<nowiki>-</nowiki>
25575 |<nowiki>- </nowiki>
25576 |-
25577 |<small>-</small>
25578 |<br>
25579 -
25580 |<br>
25581 -
25582 |}
25583 !! html/php+tidy
25584 <table>
25585 <tr>
25586 <th>-</th>
25587 <th>-</th>
25588 </tr>
25589 <tr>
25590 <td>-</td>
25591 <td>-</td>
25592 </tr>
25593 <tr>
25594 <td><small>-</small></td>
25595 <td><br />
25596 <p>-</p>
25597 </td>
25598 <td><br />
25599 <p>-</p>
25600 </td>
25601 </tr>
25602 </table>
25603 !! end
25604
25605 !! test
25606 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
25607 !! options
25608 parsoid=html2wt
25609 !! html/parsoid
25610 <table id='mwAb'>
25611 <td id='mwAc'>foo</td>
25612 <td id='serialize-this'>bar</td>
25613 </table>
25614 !! wikitext
25615 {|
25616 |foo
25617 | id="serialize-this" |bar
25618 |}
25619 !! end
25620
25621 !! test
25622 Parsoid-like element ids should not be serialized to wikitext unless shadowed
25623 !! options
25624 parsoid=html2wt
25625 !! html/parsoid
25626 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
25627 !! wikitext
25628 <div id="hello">ok</div>
25629 !! end
25630
25631 !! test
25632 WTS change modes
25633 !! options
25634 parsoid={
25635 "modes": ["wt2wt"],
25636 "changes": [
25637 [ "#xyz", "before", "<b>before</b> stuff " ],
25638 [ "#xyz", "after", " stuff <i>after</i>" ],
25639 [ "#xyz", "html", "x <b>y</b> z" ]
25640 ]
25641 }
25642 !! wikitext
25643 <span id="xyz">hello</span>
25644 !! wikitext/edited
25645 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
25646 !! end
25647
25648 !! test
25649 Never serialize a-tag as html, regardless of what data-parsoid has to say
25650 !! options
25651 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
25652 !! html/parsoid
25653 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
25654 !! wikitext
25655 [[Foo]]
25656 !! end
25657
25658 ## SSS FIXME: This is broken output nevertheless.
25659 ## What might be a reasonable non-broken output for this?
25660 ## This is an edge case unlikely to be seen in production
25661 ## that I am not wasting more time on this right now.
25662 !! test
25663 Never serialize a-tag as html, no matter what attributes it has
25664 !! options
25665 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
25666 !! html/parsoid
25667 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
25668 !! wikitext
25669 [http://boo.org http://boohoo.org]
25670 !! end
25671
25672 # Misnested is an indication that selser can reuse the source but these have
25673 # shown to sneak through on occasion. See T101768.
25674 # The original wikitext here is: [http://test.com [[one]] two three]
25675 !! test
25676 Strip span tags added to mark as misnested
25677 !! options
25678 parsoid=html2wt
25679 !! html/parsoid
25680 <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>
25681 !! wikitext
25682 [http://test.com][[one]] two three
25683 !! end
25684
25685 # --------------------------------------------
25686 # Tests spec'ing wikitext serialization norms |
25687 # --------------------------------------------
25688
25689 !! test
25690 1. Categories should always be serialized on their own line
25691 !! options
25692 parsoid=html2wt
25693 !! html/parsoid
25694 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
25695 !! wikitext
25696 foo
25697 [[Category:Foo]]
25698 bar
25699 !! end
25700
25701 !! test
25702 2. Categories that are part of templates should not introduce a line break
25703 !! wikitext
25704 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
25705 !! html/parsoid
25706 <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>
25707 !! end
25708
25709 !! test
25710 Lists: Add space after bullets
25711 !! options
25712 parsoid=html2wt
25713 !! html/parsoid
25714 <ul>
25715 <li>foo</li>
25716 <li> bar</li>
25717 <li><span> baz</span></li>
25718 </ul>
25719 !! wikitext
25720 * foo
25721 * bar
25722 * <span> baz</span>
25723 !! end
25724
25725 !! test
25726 1. Headings: Add space before/after == (T53744)
25727 !! options
25728 parsoid=html2wt
25729 !! html/parsoid
25730 <h2>foo</h2>
25731 <h2> bar</h2>
25732 <h2>baz </h2>
25733 <h2><span> baz</span></h2>
25734 !! wikitext
25735 == foo ==
25736
25737 == bar ==
25738
25739 == baz ==
25740
25741 == <span> baz</span> ==
25742 !! end
25743
25744 !! test
25745 2. Headings: Add space before/after == even after hoisted content
25746 !! options
25747 parsoid={
25748 "modes": ["html2wt"],
25749 "scrubWikitext": true
25750 }
25751 !! html/parsoid
25752 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
25753 !! wikitext
25754 [[Category:A2]]
25755
25756 == ok ==
25757 !! end
25758
25759 !! test
25760 1. Headings: suppress newly created empty headings
25761 !! options
25762 parsoid={
25763 "modes": ["html2wt"],
25764 "scrubWikitext": true
25765 }
25766 !! html/parsoid
25767 <h2></h2>
25768 !! wikitext
25769 !! end
25770
25771 !! test
25772 2. Headings: don't suppress empty headings if scrubWikitext is false
25773 !! options
25774 parsoid=html2wt
25775 !! html/parsoid
25776 <h2></h2>
25777 !! wikitext
25778 ==<nowiki/>==
25779 !! end
25780
25781 !! test
25782 3. Headings: suppress empty headings on edits
25783 !! options
25784 parsoid={
25785 "modes": ["selser"],
25786 "scrubWikitext": true,
25787 "changes": [
25788 [ "#x", "remove"]
25789 ]
25790 }
25791 !! wikitext
25792 ==<span id="x">foo</span>==
25793 !! wikitext/edited
25794 !! end
25795
25796 !! test
25797 1. WT Quote Tags: suppress newly created empty style tags
25798 !! options
25799 parsoid={
25800 "modes": ["html2wt"],
25801 "scrubWikitext": true
25802 }
25803 !! html/parsoid
25804 <i></i><b></b>
25805 !! wikitext
25806 !! end
25807
25808 !! test
25809 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
25810 !! options
25811 parsoid=html2wt
25812 !! html/parsoid
25813 <i></i><b></b>
25814 !! wikitext
25815 ''<nowiki/>'''''<nowiki/>'''
25816 !! end
25817
25818 !! test
25819 3. WT Quote Tags: suppress empty style tags on edits
25820 !! options
25821 parsoid={
25822 "modes": ["selser"],
25823 "scrubWikitext": true,
25824 "changes": [
25825 [ "#x", "remove"]
25826 ]
25827 }
25828 !! wikitext
25829 '''<span id="x">foo</span>'''
25830 !! wikitext/edited
25831 !! end
25832
25833 !! test
25834 1. Anchors: suppress newly created empty anchors
25835 !! options
25836 parsoid={
25837 "modes": ["html2wt"],
25838 "scrubWikitext": true
25839 }
25840 !! html/parsoid
25841 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
25842 !! wikitext
25843 !! end
25844
25845 !! test
25846 2. Anchors: don't suppress empty anchors if scrubWikitext is false
25847 !! options
25848 parsoid={
25849 "modes": ["html2wt"],
25850 "scrubWikitext": false
25851 }
25852 !! html/parsoid
25853 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
25854 !! wikitext
25855 [[Test|<nowiki/>]]
25856 !! end
25857
25858 !! test
25859 3. Anchors: suppress empty anchors on edits
25860 !! options
25861 parsoid={
25862 "modes": ["selser"],
25863 "scrubWikitext": true,
25864 "changes": [
25865 [ "#x", "remove"]
25866 ]
25867 }
25868 !! wikitext
25869 [[Test|<span id="x">foo</span>]]
25870 !! wikitext/edited
25871 !! end
25872
25873 !! test
25874 3a. Anchors: do not suppress numbered extlinks
25875 !! options
25876 parsoid={
25877 "modes": ["wt2wt"],
25878 "scrubWikitext": true
25879 }
25880 !! wikitext
25881 [http://foo.com]
25882 !! html/parsoid
25883 <a rel="mw:ExtLink" href="http://foo.com"></a>
25884 !! end
25885
25886 !! test
25887 3b. Anchors: do not suppress numbered extlinks
25888 !! options
25889 parsoid={
25890 "modes": ["wt2wt"],
25891 "scrubWikitext": true,
25892 "changes": [
25893 [ "#x", "remove"]
25894 ]
25895 }
25896 !! wikitext
25897 [http://foo.com <span id="x">foo</span>]
25898 !! wikitext/edited
25899 [http://foo.com]
25900 !! end
25901
25902 !!test
25903 Normalizations should be restricted to edited content
25904 !!options
25905 parsoid={
25906 "modes": ["selser"],
25907 "scrubWikitext": true,
25908 "changes": [
25909 [ "h1", "before", "<i></i>"]
25910 ]
25911 }
25912 !!wikitext
25913 a
25914 = =
25915 b
25916 !!wikitext/edited
25917 a
25918 = =
25919 b
25920 !!end
25921
25922 !! test
25923 1. Multiple normalizations (html2wt)
25924 !! options
25925 parsoid={
25926 "modes": ["html2wt"],
25927 "scrubWikitext": true
25928 }
25929 !! html
25930 <h2><i></i></h2>
25931 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
25932 </a><b><i></i></b>x</p>
25933 !! wikitext
25934
25935 [[foo]]
25936 x
25937
25938 !! end
25939
25940 !! test
25941 2. Multiple normalizations (selser)
25942 !! options
25943 parsoid={
25944 "modes": ["selser"],
25945 "scrubWikitext": true,
25946 "changes": [
25947 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
25948 ]
25949 }
25950 !! wikitext
25951 <span id="x">foo</span>
25952 !! wikitext/edited
25953 <span id="x">foo</span>
25954
25955 x
25956 !! end
25957
25958 !! test
25959 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
25960 !! options
25961 parsoid={
25962 "modes": ["html2wt"],
25963 "scrubWikitext": true
25964 }
25965 !! html/parsoid
25966 <p> hi</p>
25967 <p> hello</p>
25968 !! wikitext
25969 hi
25970
25971 hello
25972 !! end
25973
25974 !! test
25975 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
25976 !! options
25977 parsoid=html2wt
25978 !! html/parsoid
25979 <p> hi</p>
25980 <p> hello</p>
25981 !! wikitext
25982 <nowiki> </nowiki>hi
25983
25984 <nowiki> </nowiki> hello
25985 !! end
25986
25987 !! test
25988 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
25989 !! options
25990 parsoid={
25991 "modes": ["html2wt"],
25992 "scrubWikitext": true
25993 }
25994 !! html/parsoid
25995 <p>Foo
25996 bar
25997 baz</p>
25998
25999 <table><tr><td>Foo
26000 bar
26001 baz bang</td></tr></table>
26002
26003 <p><!--boo--> foo
26004 bar</p>
26005
26006 <p> foo
26007 bar<span>boo</span></p>
26008 !! wikitext
26009 Foo
26010 bar
26011 baz
26012
26013 {|
26014 |Foo
26015 bar
26016 baz bang
26017 |}
26018
26019 <!--boo-->foo
26020 bar
26021
26022 foo
26023 bar<span>boo</span>
26024 !! end
26025
26026 !! test
26027 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
26028 !! options
26029 parsoid={
26030 "modes": ["selser"],
26031 "scrubWikitext": true,
26032 "changes": [
26033 [ "p", "html", " a\n b" ]
26034 ]
26035 }
26036 !! wikitext
26037 xyz
26038 !! wikitext/edited
26039 a
26040 b
26041 !! end
26042
26043 !! test
26044 1. New links that end in spaces
26045 !! options
26046 parsoid={
26047 "modes": ["html2wt"],
26048 "scrubWikitext": false
26049 }
26050 !! html/parsoid
26051 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
26052 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
26053 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
26054 !! wikitext
26055 [[Berlin ]]<nowiki/>is the capital of Germany.
26056
26057 [[Foo ]]'''bar'''
26058
26059 [[Boston ]] is a city.
26060 !! end
26061
26062 !! test
26063 2. New links that end in spaces
26064 !! options
26065 parsoid={
26066 "modes": ["html2wt"],
26067 "scrubWikitext": true
26068 }
26069 !! html/parsoid
26070 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
26071 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
26072 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
26073 !! wikitext
26074 [[Berlin]] is the capital of Germany.
26075
26076 [[Foo]] '''bar'''
26077
26078 [[Boston]] is a city.
26079 !! end
26080
26081 !! test
26082 1. Table cells with escapable prefixes
26083 !! options
26084 parsoid={
26085 "modes": ["html2wt"],
26086 "scrubWikitext": false
26087 }
26088 !! html
26089 <table>
26090 <tr><td>a</td></tr>
26091 <tr><td>-</td></tr>
26092 <tr><td>+</td></tr>
26093 </table>
26094 !! wikitext
26095 {|
26096 |a
26097 |-
26098 |<nowiki>-</nowiki>
26099 |-
26100 |<nowiki>+</nowiki>
26101 |}
26102 !! end
26103
26104 !! test
26105 2. Table cells with escapable prefixes
26106 !! options
26107 parsoid={
26108 "modes": ["html2wt"],
26109 "scrubWikitext": true
26110 }
26111 !! html
26112 <table>
26113 <tr><td>a</td></tr>
26114 <tr><td>-</td></tr>
26115 <tr><td>+</td></tr>
26116 </table>
26117 !! wikitext
26118 {|
26119 |a
26120 |-
26121 | -
26122 |-
26123 | +
26124 |}
26125 !! end
26126
26127 !! test
26128 3a. Table cells with escapable prefixes after edits
26129 !! options
26130 parsoid={
26131 "modes": ["selser"],
26132 "scrubWikitext": true,
26133 "changes": [
26134 [ "table tbody tr:first-child td:first-child", "remove"]
26135 ]
26136 }
26137 !! wikitext
26138 {|
26139 |a||-
26140 |}
26141 !! wikitext/edited
26142 {|
26143 | -
26144 |}
26145 !! end
26146
26147 !! test
26148 3b. Table cells with escapable prefixes after edits
26149 !! options
26150 parsoid={
26151 "modes": ["selser"],
26152 "scrubWikitext": true,
26153 "changes": [
26154 [ "table tbody tr:first-child td:first-child", "html", "-" ],
26155 [ "#x", "remove" ]
26156 ]
26157 }
26158 !! wikitext
26159 {|
26160 |pqr
26161 |<span id="x">foo</span>+
26162 |}
26163 !! wikitext/edited
26164 {|
26165 | -
26166 | +
26167 |}
26168 !! end
26169
26170 # FIXME: This test will fail because
26171 # normalization doesn't realize that the id attribute
26172 # will eliminate the escapable scenario
26173 !! test
26174 4a. Table cells without escapable prefixes after edits
26175 !! options
26176 parsoid={
26177 "modes": ["selser"],
26178 "scrubWikitext": true,
26179 "changes": [
26180 [ "#x", "html", "-" ]
26181 ]
26182 }
26183 !! wikitext
26184 {|
26185 | id="x" |abcd
26186 |}
26187 !! wikitext/edited
26188 {|
26189 | id="x" |-
26190 |}
26191 !! end
26192
26193 ## This tests normalizer's ability to discriminate between
26194 ## cells having identical content.
26195 !! test
26196 4b. Table cells without escapable prefixes after edits
26197 !! options
26198 parsoid={
26199 "modes": ["selser"],
26200 "scrubWikitext": true,
26201 "changes": [
26202 [ "td", "html", "-" ]
26203 ]
26204 }
26205 !! wikitext
26206 {|
26207 |a||b
26208 |}
26209 !! wikitext/edited
26210 {|
26211 | -||-
26212 |}
26213 !! end
26214
26215 ## This tests normalizer's ability to not be tripped by
26216 ## comments (and whitespace)
26217 !! test
26218 4c. Table cells without escapable prefixes after edits
26219 !! options
26220 parsoid={
26221 "modes": ["selser"],
26222 "scrubWikitext": true,
26223 "changes": [
26224 [ "table tbody tr td:first-child", "remove" ]
26225 ]
26226 }
26227 !! wikitext
26228 {|
26229 |-
26230 <!--foo--> |a||-
26231 |}
26232 !! wikitext/edited
26233 {|
26234 |-
26235 <!--foo--> | -
26236 |}
26237 !! end
26238
26239 ## This tests normalizer's ability to handle HTML cells
26240 !! test
26241 4d. Table cells without escapable prefixes after edits
26242 !! options
26243 parsoid={
26244 "modes": ["selser"],
26245 "scrubWikitext": true,
26246 "changes": [
26247 [ "td", "html", "-" ]
26248 ]
26249 }
26250 !! wikitext
26251 <table>
26252 <tr><td>a</td></tr>
26253 </table>
26254 !! wikitext/edited
26255 <table>
26256 <tr><td>-</td></tr>
26257 </table>
26258 !! end
26259
26260 ## T111151 Remove font elements without attributes
26261 !! test
26262 5a. font tags without attributes should be dropped in scrubWikitext mode
26263 !! options
26264 parsoid={
26265 "modes": ["html2wt"],
26266 "scrubWikitext": true
26267 }
26268 !! html
26269 <font>foo</font>
26270 <font><font>bar</font></font>
26271 <font class="x">boo</font>
26272 !! wikitext
26273 foo
26274 bar
26275 <font class="x">boo</font>
26276 !! end
26277
26278 !! test
26279 5b. font tags should not be dropped without scrubWikitext being enabled
26280 !! options
26281 parsoid={
26282 "modes": ["html2wt"],
26283 "scrubWikitext": false
26284 }
26285 !! html
26286 <font>foo</font>
26287 !! wikitext
26288 <font>foo</font>
26289 !! end
26290
26291 !! test
26292 Escape nowiki DOM elements
26293 !! options
26294 parsoid=html2wt
26295 !! html/parsoid
26296 <nowiki><i>foo</i></nowiki>
26297 !! wikitext
26298 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
26299 !! end
26300
26301 # ---------------------------------------------------
26302 # End of tests spec'ing wikitext serialization norms |
26303 # ---------------------------------------------------
26304
26305 # -----------------------------------------------------------------
26306 # End of section for Parsoid-only html2wt tests for serialization
26307 # of new content
26308 # -----------------------------------------------------------------
26309
26310 # -----------------------------------------------------------------
26311 # The following section of tests are primarily to spec behavior of
26312 # the selective serializer. All these tests have manual selser
26313 # changes. The automated selser changes for all tests handle the
26314 # wide variation of changes, but these tests here capture specs
26315 # deterministically.
26316 # ----------------------------------------------------------------
26317
26318 ## T90517
26319 !! test
26320 Selser: New comments should not be lost
26321 !! options
26322 parsoid={
26323 "modes": ["selser"],
26324 "changes": [
26325 [ "#a", "after", "<!--c1-->" ],
26326 [ "#b", "before", "<!--c2-->" ]
26327 ]
26328 }
26329 !! wikitext
26330 <span id="a">a</span>
26331
26332 <span id="b">b</span>
26333 !! wikitext/edited
26334 <span id="a">a</span><!--c1-->
26335
26336 <!--c2--><span id="b">b</span>
26337 !! end
26338
26339 ## T89383
26340 !! test
26341 Selser: Check for validity of DSR before using it
26342 !! options
26343 parsoid={
26344 "modes": ["selser"],
26345 "changes": [
26346 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
26347 ]
26348 }
26349 !! wikitext
26350 <span id="a">a</span>
26351 !! wikitext/edited
26352 {{DISPLAYTITLE:foo}}
26353 <span id="a">a</span>
26354 !! end
26355
26356 !! test
26357 1. DOMDiff: Changes to <ref> content should be looked up using id
26358 !! options
26359 parsoid={
26360 "modes": ["selser"],
26361 "changes": [
26362 ["#X", "after", "bar"],
26363 ["#Y", "after", "baz"]
26364 ]
26365 }
26366 !! wikitext
26367 X <ref><span id="X">foo</span></ref>
26368 Y <ref name="a" />
26369 <references>
26370 <ref name="a"><span id="Y">foo</span></ref>
26371 </references>
26372 !! wikitext/edited
26373 X <ref><span id="X">foo</span>bar</ref>
26374 Y <ref name="a" />
26375 <references>
26376 <ref name="a"><span id="Y">foo</span>baz</ref>
26377 </references>
26378 !! end
26379
26380 !! test
26381 2. DOMDiff: Changes to <ref> content should be looked up using id
26382 !! options
26383 parsoid={
26384 "modes": ["selser"],
26385 "changes": [
26386 ["#Z", "after", "bar"]
26387 ]
26388 }
26389 !! wikitext
26390 A <ref>foo bar for a</ref>
26391 B <ref group="X" name="b" />
26392
26393 <references />
26394
26395 <references group="X">
26396 <ref name="b"><span id="Z">foo</span></ref>
26397 </references>
26398 !! wikitext/edited
26399 A <ref>foo bar for a</ref>
26400 B <ref group="X" name="b" />
26401
26402 <references />
26403
26404 <references group="X">
26405 <ref name="b"><span id="Z">foo</span>bar</ref>
26406 </references>
26407 !! end
26408
26409 !! test
26410 Empty LI (T49673)
26411 !! wikitext
26412 * a
26413 *
26414 *
26415 * b
26416 !! html/php+tidy
26417 <ul>
26418 <li>a</li>
26419 <li class="mw-empty-li"></li>
26420 <li class="mw-empty-li"></li>
26421 <li>b</li>
26422 </ul>
26423 !! end