TableDiffFormatter: Don't repeatedly call array_shift()
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
1 # MediaWiki Parser test cases
2 # Some taken from http://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
4 #
5 # The syntax should be fairly self-explanatory.
6 #
7 # Currently supported test options:
8 # One of the following three:
9 #
10 # (default) generate HTML output
11 # pst apply pre-save transform
12 # msg apply message transform
13 #
14 # Plus any combination of these:
15 #
16 # cat add category links
17 # (ignored by Parsoid, since it emits <link>s)
18 # ill add inter-language links
19 # (ignored by Parsoid, since it emits <link>s)
20 # subpage enable subpages (disabled by default)
21 # noxml don't check for XML well-formedness
22 # title=[[XXX]] run test using article title XXX
23 # language=XXX set content language to XXX for this test
24 # variant=XXX set the variant of language for this test (eg zh-tw)
25 # disabled do not run test
26 # parsoid parsoid-specific options (not run by PHP parser unless
27 # the test includes an html/php section)
28 # php php-only test (not run by the parsoid parser unless
29 # the test includes an html/parsoid section)
30 # showtitle make the first line the title
31 # showindicators make the first lines the page status indicators
32 # comment run through Linker::formatComment() instead of main parser
33 # local format section links in edit comment text as local links
34 # notoc disable table of contents
35 # thumbsize=NNN set the default thumb size to NNNpx for this test
36 #
37 # You can also set the following parser properties via test options:
38 # wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
39 # wgLinkHolderBatchSize, wgRawHtml
40 #
41 # For testing purposes, temporary articles can created:
42 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
43 # where '/' denotes a newline.
44
45 # This is the standard article assumed to exist.
46 !! article
47 Main Page
48 !! text
49 blah blah
50 !! endarticle
51
52 !!article
53 Foo
54 !!text
55 FOO
56 !!endarticle
57
58 !!article
59 Template:Foo
60 !!text
61 FOO
62 !!endarticle
63
64 !! article
65 Template:Blank
66 !! text
67 !! endarticle
68
69 !! article
70 Template:pipe
71 !! text
72 |
73 !! endarticle
74
75 !! article
76 Template:=
77 !! text
78 <nowiki>=</nowiki>
79 !! endarticle
80
81 !!article
82 MediaWiki:bad image list
83 !!text
84 * [[File:Bad.jpg]] except [[Nasty page]]
85 !!endarticle
86
87 !! article
88 Template:inner list
89 !! text
90 * item 1
91 !! endarticle
92
93 !! article
94 Template:tbl-start
95 !! text
96 {|
97 !! endarticle
98
99 !! article
100 Template:tbl-end
101 !! text
102 |}
103 !! endarticle
104
105 !! article
106 Template:echo
107 !! text
108 {{{1}}}
109 !! endarticle
110
111 !! article
112 Template:echo_with_span
113 !! text
114 <span>{{{1}}}</span>
115 !! endarticle
116
117 !! article
118 Template:echo_with_div
119 !! text
120 <div>{{{1}}}</div>
121 !! endarticle
122
123 !! article
124 Template:blank_param
125 !! text
126 {{{1}}}
127 {{{}}}
128 !! endarticle
129
130 !! article
131 Template:table_attribs
132 !! text
133 <noinclude>
134 |</noinclude>style="color:red;"|Foo
135 !! endarticle
136
137 !! article
138 Template:table_attribs_2
139 !! text
140 <noinclude>
141 |</noinclude>style="color:red;"|Foo
142 |Bar||Baz
143 !! endarticle
144
145 !! article
146 Template:table_attribs_3
147 !! text
148 <noinclude>
149 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo
150 !! endarticle
151
152 !! article
153 Template:table_attribs_4
154 !! text
155 | style="background-color:#DC241f;" width="10px" |
156 !! endarticle
157
158 !! article
159 Template:table_attribs_5
160 !! text
161 <noinclude>
162 |</noinclude>style="color:red;"||Bar
163 !! endarticle
164
165 !! article
166 Template:table_attribs_6
167 !! text
168 style="background: <nowiki>
169
170
171 red;</nowiki>" |
172 !! endarticle
173
174 !! article
175 Template:table_attribs_7
176 !! text
177 <noinclude>
178 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo<ref>foo</ref>
179 !! endarticle
180
181 !! article
182 Template:table_header_cells
183 !! text
184 {{table_attribs}}!!style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
185 !! endarticle
186
187 !! article
188 Template:table_cells
189 !! text
190 {{table_attribs}}||style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
191 !! endarticle
192
193 !! article
194 Template:PartialTable
195 !! text
196 {|
197 |-
198 !! endarticle
199
200 !! article
201 Template:image_attribs
202 !! text
203 <noinclude>
204 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
205 !! endarticle
206
207 ## See T48811 for details
208 !! article
209 Template:mixed_attr_content_template
210 !! text
211 style="color:red;" title="T48811"
212 |-
213 |foo
214 !! endarticle
215
216 !! article
217 Template:definition_list
218 !! text
219 one
220 ::two
221 !! endarticle
222
223 !! article
224 A?b
225 !! text
226 Weirdo titles!
227 !! endarticle
228
229 !!article
230 Template:Bullet
231 !!text
232 * Bar
233 !!endarticle
234
235 !!article
236 Template:OpenTable
237 !!text
238 {|
239 !!endarticle
240
241 !!article
242 Template:EmptyLITest
243 !!text
244 *a
245 *
246 *
247 *b
248 !!endarticle
249
250 !!article
251 Template:EmptyTRTest
252 !!text
253 {|
254 |-
255 |-
256 |foo
257 |-
258 |-
259 |bar
260 |}
261 !!endarticle
262
263 !!article
264 Template:EmptyTRWithHTMLAttrTest
265 !!text
266 <table>
267 <tr align="center"></tr>
268 <tr><td>foo</td></tr>
269 <tr align="center"></tr>
270 <tr><td>bar</td></tr>
271 </table>
272 !!endarticle
273
274 ###
275 ### Basic tests
276 ###
277 !! test
278 Blank input
279 !! wikitext
280 !! html
281 !! end
282
283
284 !! test
285 Simple paragraph
286 !! wikitext
287 This is a simple paragraph.
288 !! html
289 <p>This is a simple paragraph.
290 </p>
291 !! end
292
293 !! test
294 Paragraphs with extra newline spacing
295 !! wikitext
296 foo
297
298 bar
299
300
301 baz
302
303
304
305 booz
306 !! html
307 <p>foo
308 </p><p>bar
309 </p><p><br />
310 baz
311 </p><p><br />
312 </p><p>booz
313 </p>
314 !! end
315
316 !! test
317 Paragraphs with newline spacing with comment lines in between
318 !! wikitext
319 ----
320 a
321 <!--foo-->
322 b
323 ----
324 a
325 <!--foo--><!--More than 1 comment, still stripped-->
326 b
327 ----
328 a
329 <!--foo--> <!----> <!-- bar -->
330 b
331 ----
332 a
333 <!--foo-->
334
335 b
336 ----
337 a
338
339 <!--foo-->
340 b
341 ----
342 a
343 <!--foo-->
344
345
346 b
347 ----
348 a
349
350
351 <!--foo-->
352 b
353 ----
354 !! html
355 <hr />
356 <p>a
357 b
358 </p>
359 <hr />
360 <p>a
361 b
362 </p>
363 <hr />
364 <p>a
365 b
366 </p>
367 <hr />
368 <p>a
369 </p><p>b
370 </p>
371 <hr />
372 <p>a
373 </p><p>b
374 </p>
375 <hr />
376 <p>a
377 </p><p><br />
378 b
379 </p>
380 <hr />
381 <p>a
382 </p><p><br />
383 b
384 </p>
385 <hr />
386
387 !! end
388
389 !! test
390 Paragraphs with newline spacing with non-empty white-space lines in between
391 !! wikitext
392 ----
393 a
394
395 b
396 ----
397 a
398
399
400 b
401 ----
402 !! html
403 <hr />
404 <p>a
405 </p><p>b
406 </p>
407 <hr />
408 <p>a
409 </p><p><br />
410 b
411 </p>
412 <hr />
413
414 !! end
415
416 !! test
417 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
418 !! wikitext
419 ----
420 a
421 <!--foo-->
422 b
423 ----
424 a
425 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
426 b
427 ----
428 a
429
430 <!--foo-->
431 <!--bar-->
432 b
433 ----
434 a
435
436 <!--foo-->
437 <!--bar-->
438
439 b
440 ----
441 !! html
442 <hr />
443 <p>a
444 b
445 </p>
446 <hr />
447 <p>a
448 b
449 </p>
450 <hr />
451 <p>a
452 </p><p>b
453 </p>
454 <hr />
455 <p>a
456 </p><p><br />
457 b
458 </p>
459 <hr />
460
461 !! end
462
463 !! test
464 Extra newlines: More paragraphs with indented comment
465 !! wikitext
466 a
467
468 <!--boo-->
469
470 b
471 !! html
472 <p>a
473 </p><p><br />
474 b
475 </p>
476 !!end
477
478 !! test
479 Extra newlines followed by heading
480 !! wikitext
481 a
482
483
484
485 =b=
486 [[a]]
487
488
489 =b=
490 !! html
491 <p>a
492 </p><p><br />
493 </p>
494 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
495 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
496 </p><p><br />
497 </p>
498 <h1><span class="mw-headline" id="b_2">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
499
500 !! end
501
502 !! test
503 Extra newlines between heading and content are swallowed
504 !! wikitext
505 =b=
506
507
508
509 [[a]]
510 !! html
511 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
512 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
513 </p>
514 !! end
515
516 !! test
517 Parsing an URL
518 !! wikitext
519 http://fr.wikipedia.org/wiki/🍺
520 <!-- EasterEgg we love beer, better be able be able to link to it -->
521 !! html
522 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
523 </p>
524 !! end
525
526 # Note that the html+tidy output removes the spaces after the <li>,
527 # which is a bug (http://sourceforge.net/p/tidy/bugs/945/, etc).
528 # This is an issue for all tests with lists. We intentionally do
529 # *not* add html+tidy clauses for these, as we don't want to
530 # document/test the broken behavior. (Parsoid matches the non-tidy
531 # output in these cases.)
532
533 !! test
534 Simple list
535 !! wikitext
536 * Item 1
537 * Item 2
538 !! html
539 <ul><li> Item 1</li>
540 <li> Item 2</li></ul>
541
542 !! end
543
544 !! test
545 Italics and bold
546 !! wikitext
547 * plain
548 * plain''italic''plain
549 * plain''italic''plain''italic''plain
550 * plain'''bold'''plain
551 * plain'''bold'''plain'''bold'''plain
552 * plain''italic''plain'''bold'''plain
553 * plain'''bold'''plain''italic''plain
554 * plain''italic'''bold-italic'''italic''plain
555 * plain'''bold''bold-italic''bold'''plain
556 * plain'''''bold-italic'''italic''plain
557 * plain'''''bold-italic''bold'''plain
558 * plain''italic'''bold-italic'''''plain
559 * plain'''bold''bold-italic'''''plain
560 * plain l'''italic''plain
561 * plain l''''bold''' plain
562 !! html
563 <ul><li> plain</li>
564 <li> plain<i>italic</i>plain</li>
565 <li> plain<i>italic</i>plain<i>italic</i>plain</li>
566 <li> plain<b>bold</b>plain</li>
567 <li> plain<b>bold</b>plain<b>bold</b>plain</li>
568 <li> plain<i>italic</i>plain<b>bold</b>plain</li>
569 <li> plain<b>bold</b>plain<i>italic</i>plain</li>
570 <li> plain<i>italic<b>bold-italic</b>italic</i>plain</li>
571 <li> plain<b>bold<i>bold-italic</i>bold</b>plain</li>
572 <li> plain<i><b>bold-italic</b>italic</i>plain</li>
573 <li> plain<b><i>bold-italic</i>bold</b>plain</li>
574 <li> plain<i>italic<b>bold-italic</b></i>plain</li>
575 <li> plain<b>bold<i>bold-italic</i></b>plain</li>
576 <li> plain l'<i>italic</i>plain</li>
577 <li> plain l'<b>bold</b> plain</li></ul>
578
579 !! end
580
581 # this example taken from the [[simple:Moon]] article (bug 47326)
582 !! test
583 Italics and possessives (1)
584 !! wikitext
585 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
586 !! html
587 <p>obtained by <i><a href="/index.php?title=Lunar_Prospector&amp;action=edit&amp;redlink=1" class="new" title="Lunar Prospector (page does not exist)">Lunar Prospector</a>'</i>s gamma-ray spectrometer
588 </p>
589 !! end
590
591 # this example taken from [[en:Flaming Pie]] (bug 49926)
592 !! test
593 Italics and possessives (2)
594 !! wikitext
595 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
596 !! html
597 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
598 </p>
599 !! end
600
601 # this example taken from [[en:Dictionary]] (bug 49926)
602 !! test
603 Italics and possessives (3)
604 !! wikitext
605 The first monolingual dictionary written in a Romance language was ''Sebastián Covarrubias''' ''Tesoro de la lengua castellana o española'', published in 1611 in Madrid. In 1612 the first edition of the ''Vocabolario dell'[[Accademia della Crusca]]'', for Italian, was published. In 1690 in Rotterdam was published, posthumously, the ''Dictionnaire Universel''.
606 !! html
607 <p>The first monolingual dictionary written in a Romance language was <i>Sebastián Covarrubias'</i> <i>Tesoro de la lengua castellana o española</i>, published in 1611 in Madrid. In 1612 the first edition of the <i>Vocabolario dell'<a href="/index.php?title=Accademia_della_Crusca&amp;action=edit&amp;redlink=1" class="new" title="Accademia della Crusca (page does not exist)">Accademia della Crusca</a></i>, for Italian, was published. In 1690 in Rotterdam was published, posthumously, the <i>Dictionnaire Universel</i>.
608 </p>
609 !! end
610
611
612 ###
613 ### 2-quote opening sequence tests
614 ###
615 !! test
616 Italics and bold: 2-quote opening sequence: (2,2)
617 !! wikitext
618 ''foo''
619 !! html
620 <p><i>foo</i>
621 </p>
622 !!end
623
624 !! test
625 Italics and bold: 2-quote opening sequence: (2,3)
626 !! wikitext
627 ''foo'''
628 !! html/*
629 <p><i>foo'</i>
630 </p>
631 !!end
632
633 !! test
634 Italics and bold: 2-quote opening sequence: (2,4)
635 !! options
636 parsoid=wt2html
637 !! wikitext
638 ''foo''''
639 !! html/*
640 <p><i>foo''</i>
641 </p>
642 !!end
643
644 # same html as previous, but wikitext adjusted to match parsoid html2wt
645 !! test
646 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
647 !! wikitext
648 ''foo<nowiki>''</nowiki>''
649 !! html
650 <p><i>foo''</i>
651 </p>
652 !! end
653
654 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
655 !! test
656 Italics and bold: 2-quote opening sequence: (2,5)
657 !! options
658 parsoid=wt2html
659 !! wikitext
660 ''foo'''''
661 !! html/php
662 <p><i>foo</i>
663 </p>
664 !! html/parsoid
665 <p><i>foo</i><b></b>
666 </p>
667 !!end
668
669 # same html as previous, but wikitext adjusted to match parsoid html2wt
670 !! test
671 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
672 !! wikitext
673 ''foo'''''<nowiki/>'''
674 !! html/php
675 <p><i>foo</i>
676 </p>
677 !! html/parsoid
678 <p><i>foo</i><b></b>
679 </p>
680 !! end
681
682
683 ###
684 ### 3-quote opening sequence tests
685 ###
686
687 !! test
688 Italics and bold: 3-quote opening sequence: (3,2)
689 !! wikitext
690 '''foo''
691 !! html/*
692 <p>'<i>foo</i>
693 </p>
694 !!end
695
696 !! test
697 Italics and bold: 3-quote opening sequence: (3,3)
698 !! wikitext
699 '''foo'''
700 !! html
701 <p><b>foo</b>
702 </p>
703 !!end
704
705 !! test
706 Italics and bold: 3-quote opening sequence: (3,4)
707 !! wikitext
708 '''foo''''
709 !! html/*
710 <p><b>foo'</b>
711 </p>
712 !!end
713
714 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
715 !! test
716 Italics and bold: 3-quote opening sequence: (3,5)
717 !! options
718 parsoid=wt2html
719 !! wikitext
720 '''foo'''''
721 !! html/php
722 <p><b>foo</b>
723 </p>
724 !! html/parsoid
725 <p><b>foo</b><i></i>
726 </p>
727 !!end
728
729 # same html as previous, but wikitext adjusted to match parsoid html2wt
730 !! test
731 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
732 !! wikitext
733 '''foo'''''<nowiki/>''
734 !! html/php
735 <p><b>foo</b>
736 </p>
737 !! html/parsoid
738 <p><b>foo</b><i></i>
739 </p>
740 !! end
741
742
743 ###
744 ### 4-quote opening sequence tests
745 ###
746
747 !! test
748 Italics and bold: 4-quote opening sequence: (4,2)
749 !! options
750 parsoid=wt2html
751 !! wikitext
752 ''''foo''
753 !! html/*
754 <p>''<i>foo</i>
755 </p>
756 !!end
757
758 # same html as previous, but wikitext adjusted to match parsoid html2wt
759 !! test
760 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
761 !! wikitext
762 <nowiki>''</nowiki>''foo''
763 !! html
764 <p>''<i>foo</i>
765 </p>
766 !! end
767
768 !! test
769 Italics and bold: 4-quote opening sequence: (4,3)
770 !! wikitext
771 ''''foo'''
772 !! html/*
773 <p>'<b>foo</b>
774 </p>
775 !!end
776
777 !! test
778 Italics and bold: 4-quote opening sequence: (4,4)
779 !! options
780 parsoid=wt2html
781 !! wikitext
782 ''''foo''''
783 !! html/*
784 <p>'<b>foo'</b>
785 </p>
786 !!end
787
788 # same html as previous, but wikitext adjusted to match parsoid html2wt
789 !! test
790 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
791 !! wikitext
792 '<nowiki/>'''foo''''
793 !! html
794 <p>'<b>foo'</b>
795 </p>
796 !! end
797
798 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
799 !! test
800 Italics and bold: 4-quote opening sequence: (4,5)
801 !! options
802 parsoid=wt2html
803 !! wikitext
804 ''''foo'''''
805 !! html/php
806 <p>'<b>foo</b>
807 </p>
808 !! html/parsoid
809 <p>'<b>foo</b><i></i>
810 </p>
811 !!end
812
813 # same html as previous, but wikitext adjusted to match parsoid html2wt
814 !! test
815 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
816 !! wikitext
817 '<nowiki/>'''foo'''''<nowiki/>''
818 !! html/php
819 <p>'<b>foo</b>
820 </p>
821 !! html/parsoid
822 <p>'<b>foo</b><i></i>
823 </p>
824 !! end
825
826
827 ###
828 ### 5-quote opening sequence tests
829 ###
830
831 !! test
832 Italics and bold: 5-quote opening sequence: (5,2)
833 !! options
834 parsoid=wt2html
835 !! wikitext
836 '''''foo''
837 !! html/*
838 <p><b><i>foo</i></b>
839 </p>
840 !!end
841
842 # same html as previous, but wikitext adjusted to match parsoid html2wt
843 !! test
844 Italics and bold: 5-quote opening sequence: (5,2+3)
845 !! wikitext
846 '''''foo'''''
847 !! html/*
848 <p><i><b>foo</b></i>
849 </p>
850 !! end
851
852 !! test
853 Italics and bold: 5-quote opening sequence: (5,3)
854 !! options
855 parsoid=wt2html
856 !! wikitext
857 '''''foo'''
858 !! html/*
859 <p><i><b>foo</b></i>
860 </p>
861 !!end
862
863 # same html as previous, but wikitext adjusted to match parsoid html2wt
864 !! test
865 Italics and bold: 5-quote opening sequence: (5,3+2)
866 !! wikitext
867 '''''foo'''''
868 !! html
869 <p><i><b>foo</b></i>
870 </p>
871 !! end
872
873 !! test
874 Italics and bold: 5-quote opening sequence: (5,4)
875 !! options
876 parsoid=wt2html
877 !! wikitext
878 '''''foo''''
879 !! html/*
880 <p><i><b>foo'</b></i>
881 </p>
882 !!end
883
884 !! test
885 Italics and bold: 5-quote opening sequence: (5,5)
886 !! wikitext
887 '''''foo'''''
888 !! html
889 <p><i><b>foo</b></i>
890 </p>
891 !!end
892
893 !! test
894 Italics and bold: 5-quote opening sequence: (5,6)
895 !! wikitext
896 '''''foo''''''
897 !! html/*
898 <p><i><b>foo'</b></i>
899 </p>
900 !! end
901
902 ###
903 ### multiple quote sequences in a line
904 ###
905 !! test
906 Italics and bold: multiple quote sequences: (2,4,2)
907 !! options
908 parsoid=wt2html
909 !! wikitext
910 ''foo''''bar''
911 !! html/*
912 <p><i>foo'<b>bar</b></i>
913 </p>
914 !!end
915
916
917 # same html as previous, but wikitext adjusted to match parsoid html2wt
918 !! test
919 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
920 !! wikitext
921 ''foo'<nowiki/>'''bar'''''
922 !! html
923 <p><i>foo'<b>bar</b></i>
924 </p>
925 !! end
926
927
928 !! test
929 Italics and bold: multiple quote sequences: (2,4,3)
930 !! options
931 parsoid=wt2html
932 !! wikitext
933 ''foo''''bar'''
934 !! html/*
935 <p><i>foo'<b>bar</b></i>
936 </p>
937 !!end
938
939
940 # same html as previous, but wikitext adjusted to match parsoid html2wt
941 !! test
942 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
943 !! wikitext
944 ''foo'<nowiki/>'''bar'''''
945 !! html
946 <p><i>foo'<b>bar</b></i>
947 </p>
948 !! end
949
950
951 !! test
952 Italics and bold: multiple quote sequences: (2,4,4)
953 !! options
954 parsoid=wt2html
955 !! wikitext
956 ''foo''''bar''''
957 !! html/*
958 <p><i>foo'<b>bar'</b></i>
959 </p>
960 !!end
961
962
963 # same html as previous, but wikitext adjusted to match parsoid html2wt
964 !! test
965 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
966 !! wikitext
967 ''foo'<nowiki/>'''bar'<nowiki/>'''''
968 !! html
969 <p><i>foo'<b>bar'</b></i>
970 </p>
971 !! end
972
973
974 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
975 !! test
976 Italics and bold: multiple quote sequences: (3,4,2)
977 !! options
978 parsoid=wt2html
979 !! wikitext
980 '''foo''''bar''
981 !! html/php
982 <p><b>foo'</b>bar
983 </p>
984 !! html/parsoid
985 <p><b>foo'</b>bar<i></i>
986 </p>
987 !!end
988
989 # same html as previous, but wikitext adjusted to match parsoid html2wt
990 !! test
991 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
992 !! options
993 parsoid
994 !! wikitext
995 '''<nowiki>foo'</nowiki>'''bar''<nowiki/>''
996 !! html/php
997 <p><b>foo'</b>bar
998 </p>
999 !! html/parsoid
1000 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<i></i>
1001 </p>
1002 !! end
1003
1004
1005 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1006 !! test
1007 Italics and bold: multiple quote sequences: (3,4,3)
1008 !! options
1009 parsoid=wt2html
1010 !! wikitext
1011 '''foo''''bar'''
1012 !! html/php
1013 <p><b>foo'</b>bar
1014 </p>
1015 !! html/parsoid
1016 <p><b>foo'</b>bar<b></b>
1017 </p>
1018 !!end
1019
1020 # same html as previous, but wikitext adjusted to match parsoid html2wt
1021 !! test
1022 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
1023 !! wikitext
1024 '''<nowiki>foo'</nowiki>'''bar'''<nowiki/>'''
1025 !! html/php
1026 <p><b>foo'</b>bar
1027 </p>
1028 !! html/parsoid
1029 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<b></b>
1030 </p>
1031 !! end
1032
1033 ###
1034 ### other quote tests
1035 ###
1036 !! test
1037 Italics and bold: other quote tests: (2,3,5)
1038 !! wikitext
1039 ''this is about '''foo's family'''''
1040 !! html
1041 <p><i>this is about <b>foo's family</b></i>
1042 </p>
1043 !!end
1044
1045
1046 !! test
1047 Italics and bold: other quote tests: (2,(3,3),2)
1048 !! wikitext
1049 ''this is about '''foo's''' family''
1050 !! html
1051 <p><i>this is about <b>foo's</b> family</i>
1052 </p>
1053 !!end
1054
1055
1056 !! test
1057 Italics and bold: other quote tests: (3,2,3,2)
1058 !! options
1059 parsoid=wt2html
1060 !! wikitext
1061 '''this is about ''foo'''s family''
1062 !! html/*
1063 <p><b>this is about <i>foo</i></b><i>s family</i>
1064 </p>
1065 !!end
1066
1067
1068 # same html as previous, but wikitext adjusted to match parsoid html2wt
1069 !! test
1070 Italics and bold: other quote tests: (3,2,3+2+2,2)
1071 !! wikitext
1072 '''this is about ''foo'''''<nowiki/>''s family''
1073 !! html
1074 <p><b>this is about <i>foo</i></b><i>s family</i>
1075 </p>
1076 !! end
1077
1078
1079 !! test
1080 Italics and bold: other quote tests: (3,2,3,3)
1081 !! wikitext
1082 '''this is about ''foo'''s family'''
1083 !! html/*
1084 <p>'<i>this is about </i>foo<b>s family</b>
1085 </p>
1086 !!end
1087
1088
1089 !! test
1090 Italics and bold: other quote tests: (3,(2,2),3)
1091 !! wikitext
1092 '''this is about ''foo's'' family'''
1093 !! html
1094 <p><b>this is about <i>foo's</i> family</b>
1095 </p>
1096 !!end
1097
1098
1099 !! test
1100 Italicized possessive
1101 !! wikitext
1102 The ''[[Main Page]]'''s talk page.
1103 !! html/php
1104 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1105 </p>
1106 !! html/parsoid
1107 <p>The <i><a rel="mw:WikiLink" href="Main_Page" title="Main Page">Main Page</a>'</i>s talk page.</p>
1108 !! end
1109
1110 !! test
1111 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
1112 (Requires tidy for PHP parser output to be fixed up)
1113 !! options
1114 parsoid=wt2html,wt2wt
1115 !! wikitext
1116 {|
1117 !''a!!''b
1118 |''a||''b
1119 |}
1120 !! html/php+tidy
1121 <table>
1122 <tr>
1123 <th><i>a</i></th>
1124 <th><i>b</i></th>
1125 <td><i>a</i></td>
1126 <td><i>b</i></td>
1127 </tr>
1128 </table>
1129 !! html/parsoid
1130 <table>
1131 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
1132 <td><i>a</i></td><td><i>b</i></td></tr>
1133 </tbody></table>
1134 !! end
1135
1136 ###
1137 ### Non-html5 tags
1138 ###
1139
1140 !! test
1141 Non-html5 tags should be accepted
1142 !! wikitext
1143 <center>''foo''</center>
1144 <big>''foo''</big>
1145 <font>''foo''</font>
1146 <strike>''foo''</strike>
1147 <tt>''foo''</tt>
1148 !! html
1149 <center><i>foo</i></center>
1150 <p><big><i>foo</i></big>
1151 <font><i>foo</i></font>
1152 <strike><i>foo</i></strike>
1153 <tt><i>foo</i></tt>
1154 </p>
1155 !! end
1156
1157 !! test
1158 <wbr> is valid wikitext (bug 52468)
1159 !! wikitext
1160 <wbr>
1161 !! html
1162 <p><wbr />
1163 </p>
1164 !! end
1165
1166 # <strike> is HTML4, <s> is HTML4/5.
1167 !! test
1168 <s> or <strike> for strikethrough
1169 !! wikitext
1170 <strike>strike</strike>
1171
1172 <s>s</s>
1173 !! html
1174 <p><strike>strike</strike>
1175 </p><p><s>s</s>
1176 </p>
1177 !! end
1178
1179 ## a not permitted
1180 ## i,b,br omitted
1181 !! test
1182 Text-level semantic html elements in wikitext
1183 !! wikitext
1184 <em>text</em>
1185 <strong>text</strong>
1186 <small>text</small>
1187 <s>text</s>
1188 <cite>text</cite>
1189 <q>text</q>
1190 <dfn>text</dfn>
1191 <abbr>text</abbr>
1192 <data>text</data>
1193 <time>text</time>
1194 <code>text</code>
1195 <var>text</var>
1196 <samp>text</samp>
1197 <kbd>text</kbd>
1198 <sub>text</sub>
1199 <u>text</u>
1200 <mark>text</mark>
1201 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1202 <bdi>text</bdi>
1203 <bdo>text</bdo>
1204 <span>text</span>
1205 <wbr />
1206 !! html
1207 <p><em>text</em>
1208 <strong>text</strong>
1209 <small>text</small>
1210 <s>text</s>
1211 <cite>text</cite>
1212 <q>text</q>
1213 <dfn>text</dfn>
1214 <abbr>text</abbr>
1215 <data>text</data>
1216 <time>text</time>
1217 <code>text</code>
1218 <var>text</var>
1219 <samp>text</samp>
1220 <kbd>text</kbd>
1221 <sub>text</sub>
1222 <u>text</u>
1223 <mark>text</mark>
1224 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1225 <bdi>text</bdi>
1226 <bdo>text</bdo>
1227 <span>text</span>
1228 <wbr />
1229 </p>
1230 !! end
1231
1232 # test cases taken from
1233 # http://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
1234 !! test
1235 Ruby markup (W3C-style)
1236 !! wikitext
1237 ; Mono-ruby for individual base characters
1238 : <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
1239 ; Group ruby
1240 : <ruby>今日<rt>きょう</rt></ruby>
1241 ; Jukugo ruby
1242 : <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
1243 ; Inline ruby
1244 : <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
1245 ; Double-sided ruby
1246 : <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
1247 <ruby>
1248 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1249 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1250 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1251 </ruby>
1252 !! html
1253 <dl><dt> Mono-ruby for individual base characters</dt>
1254 <dd> <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1255 <dt> Group ruby</dt>
1256 <dd> <ruby>今日<rt>きょう</rt></ruby></dd>
1257 <dt> Jukugo ruby</dt>
1258 <dd> <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1259 <dt> Inline ruby</dt>
1260 <dd> <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1261 <dt> Double-sided ruby</dt>
1262 <dd> <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby></dd></dl>
1263 <p><ruby>
1264 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1265 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1266 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1267 </ruby>
1268 </p>
1269 !! end
1270
1271 # The next two test different paths in the sanitizer.
1272 !! test
1273 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
1274 !! wikitext
1275 <blockquote|>a</blockquote>
1276
1277 <b→> doesn't terminate </b→>
1278
1279 <bä> doesn't terminate </bä>
1280
1281 <boo> doesn't terminate </boo>
1282
1283 <s.foo> doesn't terminate </s.foo>
1284
1285 <sub-ID#1>
1286 !! html
1287 <p>&lt;blockquote|&gt;a&lt;/blockquote&gt;
1288 </p><p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1289 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1290 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1291 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1292 </p><p>&lt;sub-ID#1&gt;
1293 </p>
1294 !! end
1295
1296 # There is a tidy bug here: http://sourceforge.net/p/tidy/bugs/946/
1297 # If the non-word-character tag made it through the sanitizer, tidy
1298 # would munge it up.
1299 !! test
1300 Non-word characters don't terminate tag names + tidy
1301 !! wikitext
1302 <blockquote|>a</blockquote>
1303
1304 <b→> doesn't terminate </b→>
1305
1306 <bä> doesn't terminate </bä>
1307
1308 <boo> doesn't terminate </boo>
1309
1310 <s.foo> doesn't terminate </s.foo>
1311
1312 <sub-ID#1>
1313 !! html+tidy
1314 <p>&lt;blockquote|&gt;a</p>
1315 <p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;</p>
1316 <p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;</p>
1317 <p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;</p>
1318 <p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;</p>
1319 <p>&lt;sub-ID#1&gt;</p>
1320 !! end
1321
1322 ###
1323 ### See tests/parser/parserTestsParserHook.php for the <tåg> extension)
1324 ### This checks that HTML5 tags (with non-word characters in the tag
1325 ### name) make it safely through the parser -- the Sanitizer will
1326 ### munge them later, as it should.
1327 ###
1328 !! test
1329 Non-word characters are valid in extension tags (T19663)
1330 !! wikitext
1331 <tåg>tåg</tåg>
1332 !! html/php
1333 <pre>
1334 'tåg'
1335 array (
1336 )
1337 </pre>
1338
1339 !! html/parsoid
1340 <pre typeof="mw:Extension/tåg" data-mw='{"name":"tåg","attrs":{},"body":{"extsrc":"tåg"}}' data-parsoid='{}' about="#mwt2"></pre>
1341 !! end
1342
1343 !! test
1344 Isolated close tags should be treated as literal text (bug 52760)
1345 !! options
1346 parsoid=wt2html
1347 !! wikitext
1348 </b>
1349
1350 <s.foo>s</s>
1351 !! html/php+tidy
1352 <p>&lt;s.foo&gt;s</p>
1353 !! html/parsoid
1354 <p>&lt;s.foo&gt;s</p>
1355 !! end
1356
1357 ###
1358 ### Special characters
1359 ###
1360
1361 !! test
1362 Bare pipe character (bug 52363)
1363 !! wikitext
1364 |
1365 !! html
1366 <p>|
1367 </p>
1368 !! end
1369
1370 !! test
1371 Bare pipe character from a template (bug 52363)
1372 !! wikitext
1373 {{pipe}}
1374 !! html
1375 <p>|
1376 </p>
1377 !! end
1378
1379 ###
1380 ### <nowiki> test cases
1381 ###
1382
1383 !! test
1384 <nowiki> unordered list
1385 !! wikitext
1386 <nowiki>* This is not an unordered list item.</nowiki>
1387 !! html/php
1388 <p>* This is not an unordered list item.
1389 </p>
1390 !! html/parsoid
1391 <p><span typeof="mw:Nowiki">* This is not an unordered list item.</span></p>
1392 !! end
1393
1394 !! test
1395 <nowiki> spacing
1396 !! wikitext
1397 <nowiki>Lorem ipsum dolor
1398
1399 sed abit.
1400 sed nullum.
1401
1402 :and a colon
1403 </nowiki>
1404 !! html/php
1405 <p>Lorem ipsum dolor
1406
1407 sed abit.
1408 sed nullum.
1409
1410 :and a colon
1411
1412 </p>
1413 !! html/parsoid
1414 <p><span typeof="mw:Nowiki">Lorem ipsum dolor
1415
1416 sed abit.
1417 sed nullum.
1418
1419 :and a colon
1420 </span></p>
1421 !! end
1422
1423 !! test
1424 nowiki 3
1425 !! wikitext
1426 :There is not nowiki.
1427 :There is <nowiki>nowiki</nowiki>.
1428
1429 #There is not nowiki.
1430 #There is <nowiki>nowiki</nowiki>.
1431
1432 *There is not nowiki.
1433 *There is <nowiki>nowiki</nowiki>.
1434 !! html/php
1435 <dl><dd>There is not nowiki.</dd>
1436 <dd>There is nowiki.</dd></dl>
1437 <ol><li>There is not nowiki.</li>
1438 <li>There is nowiki.</li></ol>
1439 <ul><li>There is not nowiki.</li>
1440 <li>There is nowiki.</li></ul>
1441
1442 !! html/parsoid
1443 <dl><dd data-parsoid='{}'>There is not nowiki.</dd>
1444 <dd data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</dd></dl>
1445
1446 <ol><li data-parsoid='{}'>There is not nowiki.</li>
1447 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ol>
1448
1449 <ul><li data-parsoid='{}'>There is not nowiki.</li>
1450 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ul>
1451 !! end
1452
1453 !! test
1454 Entities inside <nowiki>
1455 !! wikitext
1456 <nowiki>&lt;</nowiki>
1457 !! html
1458 <p>&lt;
1459 </p>
1460 !! end
1461
1462 !! test
1463 Entities inside template parameters
1464 !! wikitext
1465 {{echo|&ndash;}}
1466 !! html/php+tidy
1467 <p>–</p>
1468 !! html/parsoid
1469 <p><span typeof="mw:Transclusion mw:Entity" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&amp;ndash;"}},"i":0}}]}'>&ndash;</span></p>
1470 !! end
1471
1472 !! test
1473 Properly escape nowiki when combined with other wiki markup
1474 !! options
1475 parsoid=html2wt
1476 !! html/parsoid
1477 <p>* &lt;/nowiki&gt; tag</p>
1478 !! wikitext
1479 <nowiki>*</nowiki> <nowiki>&lt;/nowiki&gt;</nowiki> tag
1480 !! end
1481
1482 !! test
1483 T93824: Put escaped HTML tags inside nowiki
1484 !! options
1485 parsoid=html2wt
1486 !! html/parsoid
1487 <p>&lt;h2&gt;foo&lt;/h2&gt;</p>
1488 !! wikitext
1489 <nowiki><h2>foo</h2></nowiki>
1490 !! end
1491
1492 !! test
1493 T71950: 1. Put nowiki as close to cause as possible, even with non-quote escapable chars
1494 !! options
1495 parsoid=html2wt
1496 !! html/parsoid
1497 <p>This text: L'<a rel="mw:WikiLink" href="./Foo">Foo</a>
1498 This text: L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1499 This text: L'''<a rel="mw:WikiLink" href="./Foo">Foo</a>''</p>
1500 !! wikitext
1501 This text: L'[[Foo]]
1502 This text: L<nowiki>''</nowiki>[[Foo]]
1503 This text: L<nowiki>'''</nowiki>[[Foo]]<nowiki>''</nowiki>
1504 !! end
1505
1506 # This test fails because wikitext whitespace is not normalized before comparing.
1507 !! test
1508 T71950: 2. Put nowiki as close to cause as possible, after ' :'
1509 !! options
1510 parsoid=html2wt
1511 !! html/parsoid
1512 <p>This text : L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1513 </p>
1514 !! wikitext
1515 This text : L<nowiki>''</nowiki>[[Foo]]
1516 !! end
1517
1518 # This test and the next one are html2wt only as they test that incorrect wikitext
1519 # passed in template arguments gets escaped or wrapped in nowikis where required.
1520 !! test
1521 T71482: Use {{!}} instead of nowiki for single pipe in template argument
1522 !! options
1523 parsoid=html2wt
1524 !! html/parsoid
1525 <p><span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo|bar&quot;}},&quot;i&quot;:0}}]}" about="#mwt1"></span>
1526 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo|bar |[[&quot;}},&quot;i&quot;:0}}]}" about="#mwt2"></p>
1527 !! wikitext
1528 {{echo|foo{{!}}bar}}
1529 {{echo|<nowiki>foo|bar |[[</nowiki>}}
1530 !! end
1531
1532 !! test
1533 T53961: Output correct nowikis in template arguments
1534 !! options
1535 parsoid=html2wt
1536 !! html/parsoid
1537 <p><span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a [ b&quot;}},&quot;i&quot;:0}}]}" about="#mwt1"></span>
1538 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a }} b&quot;}},&quot;i&quot;:0}}]}" about="#mwt2"></span>
1539 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a [[ b&quot;}},&quot;i&quot;:0}}]}" about="#mwt3"></span>
1540 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a | {{ ]]&quot;}},&quot;i&quot;:0}}]}" about="#mwt4"></span>
1541 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a }&quot;}},&quot;i&quot;:0}}]}" about="#mwt5"></span></p>
1542 !! wikitext
1543 {{echo|a [ b}}
1544 {{echo|a <nowiki>}}</nowiki> b}}
1545 {{echo|<nowiki>a [[ b</nowiki>}}
1546 {{echo|a {{!}} <nowiki>{{ ]]</nowiki>}}
1547 {{echo|a <nowiki>}</nowiki>}}
1548 !! end
1549
1550 !! test
1551 Cases where "!!" needs nowiki protection
1552 !! options
1553 parsoid=html2wt
1554 !! html/parsoid
1555 <table>
1556 <tr><th>this needs protection !! here</th></tr>
1557 </table>
1558
1559 <table>
1560 <tr><th>this does not need
1561 protection !! here</th></tr>
1562 </table>
1563 !! wikitext
1564 {|
1565 !<nowiki>this needs protection !! here</nowiki>
1566 |}
1567
1568 {|
1569 !this does not need
1570 protection !! here
1571 |}
1572 !! end
1573
1574 ###
1575 ### Comments
1576 ###
1577 !! test
1578 Comments and Indent-Pre
1579 !! wikitext
1580 <!-- comment 1 --> asdf
1581
1582 <!-- comment 1 --> asdf
1583 <!-- comment 2 -->
1584
1585 <!-- comment 1 --> asdf
1586 <!-- comment 2 -->xyz
1587
1588 <!-- comment 1 --> asdf
1589 <!-- comment 2 --> xyz
1590 !! html
1591 <pre>asdf
1592 </pre>
1593 <pre>asdf
1594 </pre>
1595 <pre>asdf
1596 </pre>
1597 <p>xyz
1598 </p>
1599 <pre>asdf
1600 xyz
1601 </pre>
1602 !! end
1603
1604 !! test
1605 Comment test 2a
1606 !! wikitext
1607 asdf
1608 <!-- comment 1 -->
1609 jkl
1610 !! html
1611 <p>asdf
1612 jkl
1613 </p>
1614 !! end
1615
1616 !! test
1617 Comment test 2b
1618 !! wikitext
1619 asdf
1620 <!-- comment 1 -->
1621
1622 jkl
1623 !! html
1624 <p>asdf
1625 </p><p>jkl
1626 </p>
1627 !! end
1628
1629 !! test
1630 Comment test 3
1631 !! wikitext
1632 asdf
1633 <!-- comment 1 -->
1634 <!-- comment 2 -->
1635 jkl
1636 !! html
1637 <p>asdf
1638 jkl
1639 </p>
1640 !! end
1641
1642 !! test
1643 Comment test 4
1644 !! wikitext
1645 asdf<!-- comment 1 -->jkl
1646 !! html
1647 <p>asdfjkl
1648 </p>
1649 !! end
1650
1651 !! test
1652 Comment spacing
1653 !! wikitext
1654 a
1655 <!-- foo --> b <!-- bar -->
1656 c
1657 !! html
1658 <p>a
1659 </p>
1660 <pre> b
1661 </pre>
1662 <p>c
1663 </p>
1664 !! end
1665
1666 !! test
1667 Comment whitespace
1668 !! wikitext
1669 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1670 !! html
1671
1672 !! end
1673
1674 !! test
1675 Comment semantics and delimiters
1676 !! wikitext
1677 <!-- --><!----><!-----><!------>
1678 !! html/php
1679
1680 !! html/parsoid
1681 <!-- --><!----><!--&#x2D;--><!--&#x2D;&#x2D;-->
1682 !! end
1683
1684 !! test
1685 Comment semantics and delimiters, redux
1686 !! wikitext
1687 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1688 -- foo -- funky huh? ... -->
1689 !! html/php
1690
1691 !! html/parsoid
1692 <!-- In SGML every "foo" here would actually show up in the text &#x2D;&#x2D; foo &#x2D;&#x2D; bar
1693 &#x2D;&#x2D; foo &#x2D;&#x2D; funky huh? ... -->
1694 !! end
1695
1696 !! test
1697 Comment semantics and delimiters: directors cut
1698 !! wikitext
1699 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1700 everything starting with < followed by !-- until the first -- and > we see,
1701 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1702 -->-->
1703 !! html/php
1704 <p>--&gt;
1705 </p>
1706 !! html/parsoid
1707 <!-- ... However we like to keep things simple and somewhat XML&#x2D;ish so we eat
1708 everything starting with < followed by !&#x2D;&#x2D; until the first &#x2D;&#x2D; and &#x3E; we see,
1709 that wouldn't be valid XML however, since in XML &#x2D;&#x2D; has to terminate a comment
1710 --><p>--></p>
1711 !! end
1712
1713 !! test
1714 Comment semantics: nesting
1715 !! wikitext
1716 <!--<!-- no, we're not going to do anything fancy here -->-->
1717 !! html/php
1718 <p>--&gt;
1719 </p>
1720 !! html/parsoid
1721 <!--<!&#x2D;&#x2D; no, we're not going to do anything fancy here --><p>--></p>
1722 !! end
1723
1724 # Parsoid closes the unclosed comment, even if it means a slight
1725 # round-trip diff.
1726 !! test
1727 Comment semantics: unclosed comment at end
1728 !! options
1729 parsoid=wt2html,html2html
1730 !! wikitext
1731 <!--This comment will run out to the end of the document
1732 !! html/php
1733
1734 !! html/parsoid
1735 <!--This comment will run out to the end of the document-->
1736 !! end
1737
1738 !! test
1739 Comment semantics: normalize comments to play nice with XML and browsers
1740 !! wikitext
1741 <!-- Browsers --!> think this is closed -->
1742 <!--> This would normally be text -->
1743 <!---> As would this -->
1744 <!-- XML doesn't like trailing dashes -------->
1745 <!-- Nor doubled hyphens -- anywhere in the data -->
1746 But this is not a comment.
1747 !! html/php
1748 <p>But this is not a comment.
1749 </p>
1750 !! html/parsoid
1751 <!-- Browsers &#x2D;&#x2D;!&#x3E; think this is closed -->
1752 <!--&#x3E; This would normally be text -->
1753 <!--&#x2D;&#x3E; As would this -->
1754 <!-- XML doesn't like trailing dashes &#x2D;&#x2D;&#x2D;&#x2D;&#x2D;&#x2D;-->
1755 <!-- Nor doubled hyphens &#x2D;&#x2D; anywhere in the data -->
1756 <p>But this is not a comment.</p>
1757 !! end
1758
1759 !! test
1760 Comment semantics: round-trip even text which contains encoded -->
1761 !! wikitext
1762 <!-- hello & goodbye - > --&gt; --&amp;gt; --&xx -->
1763 !! html/parsoid
1764 <!-- hello &#x26; goodbye &#x2D; &#x3E; &#x2D;&#x2D;&#x3E; &#x2D;&#x2D;&#x26;gt; &#x2D;&#x2D;&#x26;xx -->
1765 !! end
1766
1767 !! test
1768 Comment in template title
1769 !! wikitext
1770 {{f<!---->oo}}
1771 !! html
1772 <p>FOO
1773 </p>
1774 !! end
1775
1776 !! test
1777 Comment on its own line post-expand
1778 !! wikitext
1779 a
1780 {{blank}}<!---->
1781 b
1782 !! html
1783 <p>a
1784 </p><p>b
1785 </p>
1786 !! end
1787
1788 !! test
1789 Comment on its own line post-expand with non-significant whitespace
1790 !! wikitext
1791 a
1792 {{blank}} <!---->
1793 b
1794 !! html
1795 <p>a
1796 </p><p>b
1797 </p>
1798 !! end
1799
1800 !! test
1801 Multiple comments should still parse as SOL-transparent
1802 !! options
1803 parsoid=wt2html,wt2wt
1804 !! wikitext
1805 <!--c1-->*a
1806 <!--c2--><!--c3--><!--c4-->*b
1807 !! html/php
1808 <ul><li>a</li>
1809 <li>b</li></ul>
1810
1811 !! html/parsoid
1812 <!--c1--><ul>
1813 <li>a
1814 </li>
1815 <!--c2--><!--c3--><!--c4-->
1816 <li>b
1817 </li>
1818 </ul>
1819 !! end
1820
1821 ###
1822 ### paragraph wrapping tests
1823 ###
1824 !! test
1825 No block tags
1826 !! wikitext
1827 a
1828
1829 b
1830 !! html
1831 <p>a
1832 </p><p>b
1833 </p>
1834 !! end
1835
1836 !! test
1837 Block tag on one line (<div>)
1838 !! wikitext
1839 a <div>foo</div>
1840
1841 b
1842 !! html
1843 a <div>foo</div>
1844 <p>b
1845 </p>
1846 !! html+tidy
1847 <p>a</p>
1848 <div>foo</div>
1849 <p>b</p>
1850 !! end
1851
1852 !! test
1853 Block tag on one line (<blockquote>)
1854 !! wikitext
1855 a <blockquote>foo</blockquote>
1856
1857 b
1858 !! html
1859 a <blockquote>foo</blockquote>
1860 <p>b
1861 </p>
1862 !! html+tidy
1863 <p>a</p>
1864 <blockquote>
1865 <p>foo</p>
1866 </blockquote>
1867 <p>b</p>
1868 !! end
1869
1870 !! test
1871 Block tag on both lines (<div>)
1872 !! wikitext
1873 a <div>foo</div>
1874
1875 b <div>foo</div>
1876 !! html
1877 a <div>foo</div>
1878 b <div>foo</div>
1879
1880 !! html+tidy
1881 <p>a</p>
1882 <div>foo</div>
1883 <p>b</p>
1884 <div>foo</div>
1885 !! end
1886
1887 !! test
1888 Block tag on both lines (<blockquote>)
1889 !! wikitext
1890 a <blockquote>foo</blockquote>
1891
1892 b <blockquote>foo</blockquote>
1893 !! html
1894 a <blockquote>foo</blockquote>
1895 b <blockquote>foo</blockquote>
1896
1897 !! html+tidy
1898 <p>a</p>
1899 <blockquote>
1900 <p>foo</p>
1901 </blockquote>
1902 <p>b</p>
1903 <blockquote>
1904 <p>foo</p>
1905 </blockquote>
1906 !! end
1907
1908 !! test
1909 Multiple lines without block tags
1910 !! wikitext
1911 <div>foo</div> a
1912 b
1913 c
1914 d<!--foo--> e
1915 x <div>foo</div> z
1916 !! html
1917 <div>foo</div> a
1918 <p>b
1919 c
1920 d e
1921 </p>
1922 x <div>foo</div> z
1923
1924 !! html+tidy
1925 <div>foo</div>
1926 <p>a</p>
1927 <p>b c d e</p>
1928 <p>x</p>
1929 <div>foo</div>
1930 <p>z</p>
1931 !! end
1932
1933 # Tidy strips out the empty <div> tags. Parsoid doesn't.
1934 # So, we have a separate section for Parsoid. We don't want
1935 # to mimic this stripping behavior in Parsoid. It affects
1936 # editing experience and also requires us to maintain additional
1937 # info for RT-ing.
1938 !! test
1939 Empty lines between lines with block tags
1940 !! wikitext
1941 <div></div>
1942
1943
1944 <div></div>a
1945
1946 b
1947 <div>a</div>b
1948
1949 <div>b</div>d
1950
1951
1952 <div>e</div>
1953 !! html
1954 <div></div>
1955 <p><br />
1956 </p>
1957 <div></div>a
1958 <p>b
1959 </p>
1960 <div>a</div>b
1961 <div>b</div>d
1962 <p><br />
1963 </p>
1964 <div>e</div>
1965
1966 !! html+tidy
1967 <p><br /></p>
1968 <p>a</p>
1969 <p>b</p>
1970 <div>a</div>
1971 <p>b</p>
1972 <div>b</div>
1973 <p>d</p>
1974 <p><br /></p>
1975 <div>e</div>
1976 !! html/parsoid
1977 <div data-parsoid='{"stx":"html"}'></div>
1978
1979 <p><br /></p>
1980 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
1981
1982 <p>b</p>
1983 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
1984
1985 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
1986
1987 <p><br /></p>
1988 <div data-parsoid='{"stx":"html"}'>e</div>
1989 !! end
1990
1991 ## PHP parser emits output which is broken
1992 !! test
1993 Unclosed HTML p-tags should be handled properly
1994 !! wikitext
1995 <div><p>foo</div>
1996 a
1997
1998 b
1999 !! html/php+tidy
2000 <div>
2001 <p>foo</p>
2002 </div>
2003 <p>a</p>
2004 <p>b</p>
2005 !! html/parsoid
2006 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
2007 <p>a</p>
2008 <p>b</p>
2009 !! end
2010
2011 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
2012 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
2013 ## them for now.
2014 !! test
2015 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
2016 !! options
2017 parsoid=wt2html
2018 !! wikitext
2019 a [[Category:A1]] [[Category:A2]]
2020 [[Category:A3]]
2021 [[Category:A4]]
2022 !! html/parsoid
2023 <p>a</p>
2024 <link rel="mw:PageProp/Category" href="./Category:A1"/> <link rel="mw:PageProp/Category" href="./Category:A2"/> <link rel="mw:PageProp/Category" href="./Category:A3"/> <link rel="mw:PageProp/Category" href="./Category:A4"/>
2025 !! end
2026
2027 !! test
2028 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
2029 !! options
2030 parsoid=wt2html
2031 !! wikitext
2032 [[Category:A1]]a
2033 !! html/parsoid
2034 <link rel="mw:PageProp/Category" href="./Category:A1"/><p>a</p>
2035 !! end
2036
2037 ###
2038 ### Preformatted text
2039 ###
2040 !! test
2041 Preformatted text
2042 !! wikitext
2043 This is some
2044 Preformatted text
2045 With ''italic''
2046 And '''bold'''
2047 And a [[Main Page|link]]
2048 !! html
2049 <pre>This is some
2050 Preformatted text
2051 With <i>italic</i>
2052 And <b>bold</b>
2053 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
2054 </pre>
2055 !! end
2056
2057 !! test
2058 Tabs don't trigger preformatted text
2059 !! wikitext
2060 This is not
2061 preformatted text.
2062 This is preformatted text.
2063 So is this.
2064 !! html/php
2065 <p> This is not
2066 preformatted text.
2067 </p>
2068 <pre>This is preformatted text.
2069 So is this.
2070 </pre>
2071 !! html/parsoid
2072 <p> This is not
2073 preformatted text.</p>
2074 <pre>This is preformatted text.
2075 So is this.</pre>
2076 !! end
2077
2078 !! test
2079 Space before tab needs nowiki pre protection
2080 !! options
2081 parsoid=html2wt
2082 !! html/parsoid
2083 <p> a</p>
2084 !! wikitext
2085 <nowiki> </nowiki> a
2086 !! end
2087
2088 !! test
2089 Ident preformatting with inline content
2090 !! wikitext
2091 a
2092 ''b''
2093 !! html
2094 <pre>a
2095 <i>b</i>
2096 </pre>
2097 !! end
2098
2099 !! test
2100 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
2101 !! wikitext
2102 <pre><nowiki>
2103 <b>
2104 <cite>
2105 <em>
2106 </nowiki></pre>
2107 !! html
2108 <pre>
2109 &lt;b&gt;
2110 &lt;cite&gt;
2111 &lt;em&gt;
2112 </pre>
2113
2114 !! end
2115
2116 !! test
2117 Regression with preformatted in <center>
2118 !! wikitext
2119 <center>
2120 Blah
2121 </center>
2122 !! html
2123 <center>
2124 <pre>Blah
2125 </pre>
2126 </center>
2127
2128 !! end
2129
2130 !! test
2131 Bug 52763: Preformatted in <blockquote>
2132 !! wikitext
2133 <blockquote>
2134 Blah
2135 {|
2136 |
2137 indented cell (no pre-wrapping!)
2138 |}
2139 </blockquote>
2140 !! html
2141 <blockquote>
2142 <p> Blah
2143 </p>
2144 <table>
2145 <tr>
2146 <td>
2147 <p> indented cell (no pre-wrapping!)
2148 </p>
2149 </td></tr></table>
2150 </blockquote>
2151
2152 !! end
2153
2154 !! test
2155 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
2156 !! wikitext
2157 <blockquote>
2158 Foo
2159
2160 Bar
2161 </blockquote>
2162 !! html
2163 <blockquote>
2164 <p>Foo
2165 </p><p>Bar
2166 </p>
2167 </blockquote>
2168
2169 !! end
2170
2171 !! test
2172 Bug 15491: <ins>/<del> in blockquote
2173 !! wikitext
2174 <blockquote>
2175 Foo <del>bar</del> <ins>baz</ins> quux
2176 </blockquote>
2177 !! html
2178 <blockquote>
2179 <p>Foo <del>bar</del> <ins>baz</ins> quux
2180 </p>
2181 </blockquote>
2182
2183 !! end
2184
2185 # Note that the p-wrapping is newline sensitive, which could be
2186 # considered a bug: tidy will wrap only the 'Foo' in the example
2187 # below in a <p> tag. (see comment 23-25 of bug #6200)
2188 !! test
2189 Bug 15491: <ins>/<del> in blockquote (2)
2190 !! wikitext
2191 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2192 </blockquote>
2193 !! html
2194 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2195 </blockquote>
2196
2197 !! html+tidy
2198 <blockquote>
2199 <p>Foo</p>
2200 <del>bar</del> <ins>baz</ins> quux</blockquote>
2201 !! end
2202
2203 !! test
2204 <pre> with attributes (bug 3202)
2205 !! wikitext
2206 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2207 !! html
2208 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2209
2210 !! end
2211
2212 !! test
2213 <pre> with width attribute (bug 3202)
2214 !! wikitext
2215 <pre width="8">Narrow screen goodies</pre>
2216 !! html
2217 <pre width="8">Narrow screen goodies</pre>
2218
2219 !! end
2220
2221 !! test
2222 <pre> with forbidden attribute (bug 3202)
2223 !! wikitext
2224 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
2225 !! html
2226 <pre width="8">Narrow screen goodies</pre>
2227
2228 !! end
2229
2230 !! test
2231 Entities inside <pre>
2232 !! wikitext
2233 <pre>&lt;</pre>
2234 !! html
2235 <pre>&lt;</pre>
2236
2237 !! end
2238
2239 !! test
2240 <pre> with forbidden attribute values (bug 3202)
2241 !! wikitext
2242 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
2243 !! html
2244 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
2245
2246 !! end
2247
2248 !! test
2249 <nowiki> inside <pre> (bug 13238)
2250 !! wikitext
2251 <pre>
2252 <nowiki>
2253 </pre>
2254 <pre>
2255 <nowiki></nowiki>
2256 </pre>
2257 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
2258 !! html
2259 <pre>
2260 &lt;nowiki&gt;
2261 </pre>
2262 <pre>
2263
2264 </pre>
2265 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2266
2267 !! end
2268
2269 !! test
2270 <nowiki> and <pre> preference (first one wins)
2271 !! wikitext
2272 <pre>
2273 <nowiki>
2274 </pre>
2275 </nowiki>
2276 </pre>
2277
2278 <nowiki>
2279 <pre>
2280 <nowiki>
2281 </pre>
2282 </nowiki>
2283 </pre>
2284
2285 !! html/php
2286 <pre>
2287 &lt;nowiki&gt;
2288 </pre>
2289 <p>&lt;/nowiki&gt;
2290 &lt;/pre&gt;
2291 </p><p>
2292 &lt;pre&gt;
2293 &lt;nowiki&gt;
2294 &lt;/pre&gt;
2295
2296 &lt;/pre&gt;
2297 </p>
2298 !! html/parsoid
2299 <pre data-parsoid='{"stx":"html","strippedNL":true}'>&lt;nowiki>
2300 </pre>
2301 <p><span typeof="mw:Placeholder" data-parsoid='{"src":"&lt;/nowiki>"}'>&lt;/nowiki></span>
2302 &lt;/pre></p>
2303
2304 <p><span typeof="mw:Nowiki">
2305 &lt;pre>
2306 &lt;nowiki>
2307 &lt;/pre>
2308 </span>
2309 &lt;/pre></p>
2310 !! end
2311
2312 !! test
2313 </pre> inside nowiki
2314 !! wikitext
2315 <nowiki></pre></nowiki>
2316 !! html
2317 <p>&lt;/pre&gt;
2318 </p>
2319 !! end
2320
2321 # Parsoid doesn't strip empty tags, like Tidy does.
2322 !! test
2323 Empty pre; pre inside other HTML tags (bug 54946)
2324 !! options
2325 parsoid=wt2html,wt2wt
2326 !! wikitext
2327 a
2328
2329 <div><pre>
2330 foo
2331 </pre></div>
2332 <pre></pre>
2333 !! html/php
2334 <p>a
2335 </p>
2336 <div><pre>
2337 foo
2338 </pre></div>
2339 <pre></pre>
2340
2341 !! html/php+tidy
2342 <p>a</p>
2343 <div>
2344 <pre>
2345 foo
2346 </pre></div>
2347 !! html/parsoid
2348 <p>a</p>
2349
2350 <div><pre>foo
2351 </pre></div>
2352 <pre></pre>
2353 !! end
2354
2355 !! test
2356 HTML pre followed by indent-pre
2357 !! wikitext
2358 <pre>foo</pre>
2359 bar
2360 !! html
2361 <pre>foo</pre>
2362 <pre>bar
2363 </pre>
2364 !! end
2365
2366 # Note that tidy removes the empty <p> tags from the start and end.
2367 # Parsoid does not, by design.
2368 !!test
2369 Block tag pre
2370 !! wikitext
2371 <p><pre>foo</pre></p>
2372 !! html/php+tidy
2373 <pre>
2374 foo
2375 </pre>
2376 !! html/parsoid
2377 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2378 !!end
2379
2380 !!test
2381 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2382 !! wikitext
2383 {{echo|}}
2384 !! html
2385
2386 !!end
2387
2388 !!test
2389 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2390 !! wikitext
2391 {{echo|
2392 foo}}
2393 !! html
2394 <p>foo
2395 </p>
2396 !!end
2397
2398 !! test
2399 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2400 !! wikitext
2401 {{echo|a
2402 b}}
2403 !! html
2404 <pre>a
2405 </pre>
2406 <p>b
2407 </p>
2408 !!end
2409
2410 !! test
2411 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2412 !! wikitext
2413 {{echo|a
2414 b
2415 c
2416 d
2417 e
2418 }}
2419 !! html
2420 <pre>a
2421 </pre>
2422 <p>b
2423 c
2424 </p>
2425 <pre>d
2426 </pre>
2427 <p>e
2428 </p>
2429 !!end
2430
2431 !!test
2432 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2433 !! wikitext
2434 {{echo| foo}}
2435
2436 {{echo| foo}}{{echo| bar}}
2437
2438 {{echo| foo}}
2439 {{echo| bar}}
2440
2441 {{echo|<!--cmt--> foo}}
2442
2443 <!--cmt-->{{echo| foo}}
2444
2445 {{echo|{{echo| }}bar}}
2446 !! html
2447 <pre>foo
2448 </pre>
2449 <pre>foo bar
2450 </pre>
2451 <pre>foo
2452 bar
2453 </pre>
2454 <pre>foo
2455 </pre>
2456 <pre>foo
2457 </pre>
2458 <pre>bar
2459 </pre>
2460 !!end
2461
2462 !! test
2463 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2464 !! wikitext
2465 {{echo| }}a
2466
2467 {{echo|
2468 }}a
2469
2470 {{echo|
2471 b}}
2472
2473 {{echo|a
2474 }}b
2475
2476 {{echo|a
2477 }} b
2478 !! html
2479 <pre>a
2480 </pre>
2481 <p><br />
2482 </p>
2483 <pre>a
2484 </pre>
2485 <p><br />
2486 </p>
2487 <pre>b
2488 </pre>
2489 <p>a
2490 </p>
2491 <pre>b
2492 </pre>
2493 <p>a
2494 </p>
2495 <pre>b
2496 </pre>
2497 !!end
2498
2499 !! test
2500 Pres with newline attributes
2501 !! wikitext
2502 <pre class="one
2503 two">hi</pre>
2504 !! html/php
2505 <pre class="one two">hi</pre>
2506
2507 !! html/parsoid
2508 <pre class="one
2509 two" data-parsoid='{"stx":"html"}'>hi</pre>
2510 !! end
2511
2512 !! test
2513 Things that look like <pre> tags aren't treated as such
2514 !! wikitext
2515 Barack Obama <President> of the United States
2516 <President></President>
2517 !! html
2518 <p>Barack Obama &lt;President&gt; of the United States
2519 &lt;President&gt;&lt;/President&gt;
2520 </p>
2521 !! end
2522
2523 ## PHP parser discards the "<pre " string
2524 !! test
2525 Handle broken pre-like tags (bug 64025)
2526 !! options
2527 parsoid=wt2html
2528 !! wikitext
2529 {{echo|<pre <pre>x</pre>}}
2530
2531 <table><pre </table>
2532 !! html/php
2533 <pre>x</pre>
2534 <table><pre></pre></table>
2535
2536 !! html/parsoid
2537 <pre about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"a":{"&lt;pre":null},"sa":{"&lt;pre":""},"stx":"html","pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;pre &lt;pre>x&lt;/pre>"}},"i":0}}]}'>x</pre>
2538
2539
2540 <p>&lt;pre </p>
2541
2542 <table></table>
2543 !! end
2544
2545 !! test
2546 Parsoid: handle pre with space after attribute
2547 !! options
2548 parsoid=wt2html
2549 !! wikitext
2550 <pre style="width:50%;" >{{echo|foo}}</pre>
2551 !! html/php
2552 <pre style="width:50%;">{{echo|foo}}</pre>
2553
2554 !! html/parsoid
2555 <pre style="width:50%;">{{echo|foo}}</pre>
2556 !! end
2557
2558 # TODO / maybe: fix wt2wt for this
2559 !! test
2560 Parsoid: Don't paragraph-wrap fosterable content
2561 !! options
2562 parsoid=wt2html
2563 !! wikitext
2564 {|
2565 <td></td>
2566 <td></td>
2567
2568
2569
2570 |}
2571 !! html
2572 <table>
2573
2574 <tbody>
2575 <tr>
2576 <td></td>
2577
2578 <td></td></tr>
2579
2580
2581
2582 </tbody></table>
2583 !! end
2584
2585 !! test
2586 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2587 !! options
2588 parsoid=wt2html
2589 !! wikitext
2590 {|
2591 <td>
2592 <td>
2593 </td>
2594
2595
2596
2597 |}
2598 !! html
2599 <table>
2600
2601 <tbody>
2602 <tr>
2603 <td></td>
2604
2605 <td>
2606 </td></tr>
2607
2608
2609
2610 </tbody></table>
2611 !! end
2612
2613
2614 #--------------------------------------------------------------------
2615 # Transclusion parameter whitespace stripping tests
2616 # Behavior is different for positional and named parameters
2617 #--------------------------------------------------------------------
2618 !! test
2619 Templates: Strip leading and trailing whitespace from named-param values
2620 !! wikitext
2621 {{echo|1= a }}
2622
2623 {{echo|1= {{echo|b}} }}
2624
2625 {{echo| 1 =
2626 c }}
2627
2628 {{echo| 1 =
2629 * d
2630 }}
2631 !! html
2632 <p>a
2633 </p><p>b
2634 </p><p>c
2635 </p>
2636 <ul><li> d</li></ul>
2637
2638 !! end
2639
2640 !! test
2641 Templates: Don't strip whitespace from positional-param values
2642 !! wikitext
2643 {{echo|a }}
2644
2645 {{echo|{{echo|b}} }}
2646
2647 {{echo| c
2648 }}
2649
2650 {{echo| {{echo|d}}
2651 }}
2652
2653 {{echo|
2654 e}}
2655
2656 {{echo|
2657 * f}}
2658
2659 {{echo|
2660 }}g
2661 !! html
2662 <p>a
2663 </p><p>b
2664 </p>
2665 <pre>c
2666 </pre>
2667 <p><br />
2668 </p>
2669 <pre>d
2670 </pre>
2671 <p><br />
2672 </p>
2673 <pre>e
2674 </pre>
2675 <p><br />
2676 </p>
2677 <ul><li> f</li></ul>
2678 <p><br />
2679 </p>
2680 <pre>g
2681 </pre>
2682 !! end
2683
2684 !! test
2685 Templates: Handle empty comment-and-ws-only lines correctly
2686 !! wikitext
2687 {{echo|foo
2688 <!--should be ignored-->
2689 <!--should be ignored as well-->
2690 bar}}
2691 !! html
2692 <p>foo
2693 bar
2694 </p>
2695 !! end
2696
2697 !! test
2698 Templates: Handle comments in the target
2699 !! wikitext
2700 {{echo
2701 <!-- should be ignored -->
2702 |foo}}
2703
2704 {{echo<!-- should be ignored -->
2705 |foo}}
2706
2707 {{echo<!-- should be ignored -->|foo}}
2708
2709 {{<!-- should be ignored -->echo|foo}}
2710 !!html/parsoid
2711 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n&lt;!-- should be ignored -->\n","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2712
2713 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo&lt;!-- should be ignored -->\n","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2714
2715 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo&lt;!-- should be ignored -->","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2716
2717 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2718 !!end
2719
2720 !! test
2721 Templates: Handle comments in parameter names (bug 67657)
2722 !! wikitext
2723 {{echo|1
2724 <!-- should be ignored -->
2725 =foo}}
2726
2727 {{echo|
2728 <!-- should be ignored -->
2729 1 = foo}}
2730
2731 {{echo|1<!-- should be ignored -->=foo}}
2732
2733 {{echo|<!-- should be ignored -->1=foo}}
2734 !!html/parsoid
2735 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"1\n&lt;!-- should be ignored -->"}}},"i":0}}]}'>foo</p>
2736
2737 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"&lt;!-- should be ignored -->\n1"}}},"i":0}}]}'>foo</p>
2738
2739 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"1&lt;!-- should be ignored -->"}}},"i":0}}]}'>foo</p>
2740
2741 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"&lt;!-- should be ignored -->1"}}},"i":0}}]}'>foo</p>
2742 !!end
2743
2744 !! test
2745 Templates: Other wikitext in parameter names (bug 67657)
2746 !! wikitext
2747 {{echo|''1''=foo}}
2748 !!html/parsoid
2749 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"&#39;&#39;1&#39;&#39;":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2750 !!html/php
2751 <p>{{{1}}}
2752 </p>
2753 !!end
2754
2755 #--------------------------------------------------------------------
2756 # Transclusion parameter escaping tests
2757 #--------------------------------------------------------------------
2758 !! test
2759 Templates: Parsoid parameter escaping test 1
2760 !! wikitext
2761 {{echo|[foo]|{{echo|[bar]}}}}
2762 !! html/php+tidy
2763 <p>[foo]</p>
2764 !! html/parsoid
2765 <p about="#mwt1" typeof="mw:Transclusion"
2766 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2767 !! end
2768
2769 !! test
2770 Parsoid: Pipes in external links in template parameter
2771 !! wikitext
2772 {{echo|[{{echo|http://example.com}} link]}}
2773 !! html/php+tidy
2774 <p><a rel="nofollow" class="external text" href="http://example.com">link</a></p>
2775 !! html/parsoid
2776 <p><a rel="mw:ExtLink" href="http://example.com" about="#mwt31" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{echo|http://example.com}} link]"}},"i":0}}]}'>link</a></p>
2777 !! end
2778
2779 !! test
2780 Parsoid: pipe in transclusion parameter
2781 !! wikitext
2782 {{echo|http://foo.com/a&#124;b}}
2783 !! html/php+tidy
2784 <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</a></p>
2785 !! html/parsoid
2786 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2787 typeof="mw:Transclusion"
2788 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"http://foo.com/a&amp;#124;b"}},"i":0}}]}'>http://foo.com/a|b</a></p>
2789 !! end
2790
2791 !! test
2792 Parsoid: Pipe in external link target and content in template parameter
2793 !! options
2794 parsoid=html2wt,wt2wt
2795 !! wikitext
2796 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2797 !! html/php+tidy
2798 <p><a rel="nofollow" class="external text" href="http://foo.com/a%7Cb">a|b</a></p>
2799 !! html/parsoid
2800 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2801 typeof="mw:Transclusion"
2802 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2803 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2804 !! end
2805
2806 !! test
2807 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2808 !! options
2809 parsoid
2810 !! wikitext
2811 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2812 !! html
2813 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]"}},"i":0}}]}'>[Main Page bar]</p>
2814 !! end
2815
2816 !! test
2817 Templates: Don't escape already nowiki-escaped text in template parameters
2818 !! options
2819 parsoid=html2wt,wt2wt
2820 !! wikitext
2821 {{echo|foo<nowiki>|</nowiki>bar}}
2822 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2823 {{echo|<nowiki></nowiki>}}
2824 !! html/php+tidy
2825 <p>foo|bar &lt;div&gt;</p>
2826 !! html/parsoid
2827 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo<nowiki>|</nowiki>bar"}},"i":0}}]}'}'>foo</span><span typeof="mw:Nowiki" about="#mwt1">|</span><span about="#mwt1">bar</span>
2828 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt2" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki>&amp;lt;div&amp;gt;</nowiki>"}},"i":0}}]}'><span typeof="mw:Entity">&lt;</span>div<span typeof="mw:Entity">&gt;</span></span>
2829 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt3" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki></nowiki>"}},"i":0}}]}'></span>
2830 </p>
2831 !! end
2832
2833 ## Bug 52824
2834 !! test
2835 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2836 !! options
2837 parsoid=html2wt,wt2wt
2838 !! wikitext
2839 {{echo|{{echo|1=bar}}}}
2840 !! html/php+tidy
2841 <p>bar</p>
2842 !! html/parsoid
2843 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{echo|1=bar}}"}},"i":0}}]}'>bar</p>
2844 !! end
2845
2846 ## Bug 56733
2847 !! test
2848 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2849 !! wikitext
2850 {{echo|a : b}}
2851 !! html/php+tidy
2852 <p>a&#160;: b</p>
2853 !! html/parsoid
2854 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a : b"}},"i":0}}]}'>a<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"isDisplayHack":true}'> </span>: b</p>
2855 !! end
2856
2857 ## Bug T73412
2858 !! test
2859 Templates: Preserve blank parameter names
2860 !! wikitext
2861 {{echo|=foo}}
2862 !! html/php+tidy
2863 <p>{{{1}}}</p>
2864 !! html/parsoid
2865 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2866 !! end
2867
2868 !! test
2869 Templates: Preserve blank parameter names in other positions
2870 !! wikitext
2871 {{blank_param|bar|=foo}}
2872 !! html/php+tidy
2873 <p>bar foo</p>
2874 !! html/parsoid
2875 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"},{"k":"","named":true}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"blank_param","href":"./Template:Blank_param"},"params":{"1":{"wt":"bar"},"":{"wt":"foo"}},"i":0}}]}'>bar
2876 foo</p>
2877 !! end
2878
2879 ###
2880 ### Parsoid-centric tests for testing RT edge cases for pre
2881 ###
2882
2883 !!test
2884 1a. Indent-Pre and Comments
2885 !! wikitext
2886 a
2887 <!--a-->
2888 c
2889 !! html
2890 <pre>a
2891 </pre>
2892 <p>c
2893 </p>
2894 !!end
2895
2896 !!test
2897 1b. Indent-Pre and Comments
2898 !! wikitext
2899 a
2900 <!--a-->
2901 c
2902 !! html
2903 <pre>a
2904 </pre>
2905 <p>c
2906 </p>
2907 !!end
2908
2909 !!test
2910 1c. Indent-Pre and Comments
2911 !! wikitext
2912 <!--a--> a
2913
2914 <!--a--> a
2915 !! html
2916 <pre> a
2917 </pre>
2918 <pre> a
2919 </pre>
2920 !!end
2921
2922 !!test
2923 1d. Indent-Pre and Comments
2924 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2925 !! wikitext
2926 <!--a--> a
2927
2928 <!--b-->b
2929 !! html
2930 <pre>a
2931 </pre>
2932 <pre>b
2933 </pre>
2934 !!end
2935
2936 !!test
2937 2a. Indent-Pre and tables
2938 !! wikitext
2939 {|
2940 |-
2941 !h1!!h2
2942 |foo||bar
2943 |}
2944 !! html
2945 <table>
2946
2947 <tr>
2948 <th>h1</th>
2949 <th>h2
2950 </th>
2951 <td>foo</td>
2952 <td>bar
2953 </td></tr></table>
2954
2955 !!end
2956
2957 !!test
2958 2b. Indent-Pre and tables
2959 !! wikitext
2960 {|
2961 |-
2962 |foo
2963 |}
2964 !! html
2965 <table>
2966
2967 <tr>
2968 <td>foo
2969 </td></tr></table>
2970
2971 !!end
2972
2973 !!test
2974 2c. Indent-Pre and tables (bug 42252)
2975 !! wikitext
2976 {|
2977 |+ foo
2978 ! | bar
2979 |}
2980 !! html
2981 <table>
2982 <caption> foo
2983 </caption>
2984 <tr>
2985 <th> bar
2986 </th></tr></table>
2987
2988 !!end
2989
2990 !!test
2991 2d. Indent-Pre and tables
2992 !! wikitext
2993 a
2994 {|
2995 | b
2996 |}
2997 !! html/php
2998 <pre>a
2999 </pre>
3000 <table>
3001 <tr>
3002 <td> b
3003 </td></tr></table>
3004
3005 !! html/parsoid
3006 <pre>a</pre>
3007 <table>
3008 <tbody><tr><td> b</td></tr>
3009 </tbody></table>
3010 !!end
3011
3012 !!test
3013 2e. Indent-Pre and table-line syntax
3014 !! wikitext
3015 a
3016 | b
3017 | c
3018 !! html/php
3019 <pre>a
3020 | b
3021 | c
3022 </pre>
3023 !!end
3024
3025 !!test
3026 2f. Indent-pre started by table-line syntax
3027 !! wikitext
3028 a
3029 | b
3030 | c
3031 !! html/php
3032 <p>a
3033 </p>
3034 <pre>| b
3035 | c
3036 </pre>
3037 !! html/parsoid
3038 <p>a</p>
3039 <pre>
3040 | b
3041 | c</pre>
3042 !!end
3043
3044 !!test
3045 3a. Indent-Pre and block tags (single-line html)
3046 !! wikitext
3047 a <p> foo </p>
3048 b <div> foo </div>
3049 c <blockquote> foo </blockquote>
3050 <span> foo </span>
3051 !! html
3052 a <p> foo </p>
3053 b <div> foo </div>
3054 c <blockquote> foo </blockquote>
3055 <pre><span> foo </span>
3056 </pre>
3057 !! html/parsoid
3058 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
3059 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3060 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
3061 <pre><span> foo </span>
3062 </pre>
3063 !! html+tidy
3064 <p>a</p>
3065 <p>foo</p>
3066 <p>b</p>
3067 <div>foo</div>
3068 <p>c</p>
3069 <blockquote>
3070 <p>foo</p>
3071 </blockquote>
3072 <pre>
3073 <span> foo </span>
3074 </pre>
3075 !! end
3076
3077 !!test
3078 3b. Indent-Pre and block tags (multi-line html)
3079 !! wikitext
3080 a <span>foo</span>
3081 b <div> foo </div>
3082 !! html
3083 <pre>a <span>foo</span>
3084 </pre>
3085 b <div> foo </div>
3086
3087 !! html/parsoid
3088 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3089 b <div data-parsoid='{"stx":"html"}'> foo </div>
3090 !! html+tidy
3091 <pre>
3092 a <span>foo</span>
3093 </pre>
3094 <p>b</p>
3095 <div>foo</div>
3096 !!end
3097
3098 !!test
3099 3c. Indent-Pre and block tags (pre-content on separate line)
3100 !! wikitext
3101 <p>
3102 foo
3103 </p>
3104
3105 <div>
3106 foo
3107 </div>
3108
3109 <center>
3110 foo
3111 </center>
3112
3113 <blockquote>
3114 foo
3115 </blockquote>
3116
3117 <blockquote>
3118 <pre>
3119 foo
3120 </pre>
3121 </blockquote>
3122
3123 <table><tr><td>
3124 foo
3125 </td></tr></table>
3126
3127 <ul><li>
3128 foo
3129 </li></ul>
3130
3131 !! html
3132 <p>
3133 foo
3134 </p>
3135 <div>
3136 <pre>foo
3137 </pre>
3138 </div>
3139 <center>
3140 <pre>foo
3141 </pre>
3142 </center>
3143 <blockquote>
3144 <p> foo
3145 </p>
3146 </blockquote>
3147 <blockquote>
3148 <pre>
3149 foo
3150 </pre>
3151 </blockquote>
3152 <table><tr><td>
3153 <pre>foo
3154 </pre>
3155 </td></tr></table>
3156 <ul><li>
3157 foo
3158 </li></ul>
3159
3160 !!end
3161
3162 !!test
3163 4. Indent-Pre and extension tags
3164 !! wikitext
3165 a <gallery>
3166 File:foobar.jpg
3167 </gallery>
3168 !! html
3169 a <ul class="gallery mw-gallery-traditional">
3170 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
3171 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
3172 <div class="gallerytext">
3173 </div>
3174 </div></li>
3175 </ul>
3176
3177 !! html+tidy
3178 <p>a</p>
3179 <ul class="gallery mw-gallery-traditional">
3180 <li class="gallerybox" style="width: 155px">
3181 <div style="width: 155px">
3182 <div class="thumb" style="width: 150px;">
3183 <div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div>
3184 </div>
3185 <div class="gallerytext"></div>
3186 </div>
3187 </li>
3188 </ul>
3189 !!end
3190
3191 !! test
3192 Table wikitext syntax outside wiki-tables
3193 !! wikitext
3194 a
3195 ! not a table heading
3196 |- not a table row
3197 | not a table cell
3198 | class="foo bar" | baz
3199 b
3200 |}
3201 |-
3202 c
3203 !! html
3204 <p>a
3205 ! not a table heading
3206 |- not a table row
3207 | not a table cell
3208 | class="foo bar" | baz
3209 b
3210 |}
3211 |-
3212 c
3213 </p>
3214 !! end
3215
3216 !!test
3217 Render paragraphs when indent-pre is suppressed in blocklevels
3218 !! wikitext
3219 <blockquote>
3220 foo
3221
3222 bar
3223 </blockquote>
3224 !! html
3225 <blockquote>
3226 <p> foo
3227 </p><p> bar
3228 </p>
3229 </blockquote>
3230
3231 !!end
3232
3233 !!test
3234 4. Multiple spaces at start-of-line
3235 !! wikitext
3236 <p> foo </p>
3237 foo
3238 {|
3239 |foo
3240 |}
3241 !! html
3242 <p> foo </p>
3243 <pre> foo
3244 </pre>
3245 <table>
3246 <tr>
3247 <td>foo
3248 </td></tr></table>
3249
3250 !!end
3251
3252 ## NOTE: the leading white-space chars on empty line are significant
3253 !! test
3254 5a. White-space in indent-pre
3255 !! wikitext
3256 a<br />
3257
3258 b
3259 !! html
3260 <pre>a<br />
3261
3262 b
3263 </pre>
3264 !! end
3265
3266 ## NOTE: the leading white-space chars on empty line are significant
3267 !! test
3268 5b. White-space in indent-pre
3269 !! wikitext
3270 a
3271
3272 b
3273
3274
3275 c
3276 !! html
3277 <pre>a
3278
3279 b
3280
3281
3282 c
3283 </pre>
3284 !! end
3285
3286 !! test
3287 5c. White-space in indent-pre
3288 !! wikitext
3289 ''a''
3290 ''b''
3291 ''c''
3292 !! html
3293 <pre><i>a</i>
3294 <i>b</i>
3295 <i>c</i>
3296 </pre>
3297 !! end
3298
3299 !! test
3300 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3301 !! wikitext
3302 a
3303
3304 <!-- continue -->
3305 b
3306
3307 c
3308
3309 d
3310 !! html
3311 <pre>a
3312
3313 b
3314 </pre>
3315 <pre>c
3316
3317 </pre>
3318 <p>d
3319 </p>
3320 !! end
3321
3322 !! test
3323 7a. Indent-pre and category links
3324 !! options
3325 parsoid=wt2html,wt2wt
3326 !! wikitext
3327 [[Category:foo]] <!-- No pre-wrapping -->
3328 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3329 !! html/php+tidy
3330 !! html/parsoid
3331 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3332 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":" [[Category:foo]]"}},"i":0}}]}'> </span><link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1"> <!-- No pre&#x2D;wrapping -->
3333 !! end
3334
3335 ## We used to, but no longer wt2wt this test since the default serializer
3336 ## will normalize all categories to serialize on their own line.
3337 ## This wikitext usage is going to be fairly uncommon in production and
3338 ## selser will take care of preserving formatting in those scenarios.
3339 !! test
3340 7b. Indent-pre and category links
3341 !! options
3342 parsoid=wt2html
3343 !! wikitext
3344 [[Category:foo]] a
3345 [[Category:foo]] {{echo|b}}
3346 !! html/parsoid
3347 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3348 <link rel="mw:PageProp/Category" href="./Category:Foo"> <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b"}},"i":0}}]}'>b</span></pre>
3349 !! end
3350
3351 !! test
3352 Indent-Pre: Newlines in comments shouldn't affect sol state
3353 !! wikitext
3354 a <!--
3355 foo
3356 --> b
3357 !! html/php+tidy
3358 <p>a b</p>
3359 !! html/parsoid
3360 <p>a <!--
3361 foo
3362 --> b</p>
3363 !! end
3364
3365 ###
3366 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3367 ###
3368
3369 !!test
3370 HTML-pre: 1. embedded newlines
3371 !! wikitext
3372 <pre>foo</pre>
3373
3374 <pre>
3375 foo
3376 </pre>
3377
3378 <pre>
3379
3380 foo
3381 </pre>
3382
3383 <pre>
3384
3385
3386 foo
3387 </pre>
3388 !! html/php+tidy
3389 <pre>
3390 foo
3391 </pre>
3392 <pre>
3393 foo
3394 </pre>
3395 <pre>
3396
3397 foo
3398 </pre>
3399 <pre>
3400
3401
3402 foo
3403 </pre>
3404 !! html/parsoid
3405 <pre data-parsoid='{"stx":"html"}'>foo</pre>
3406
3407 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
3408 foo
3409 </pre>
3410
3411 <pre data-parsoid='{"stx":"html"}'>
3412
3413 foo
3414 </pre>
3415
3416 <pre data-parsoid='{"stx":"html"}'>
3417
3418
3419 foo
3420 </pre>
3421 !!end
3422
3423 !! test
3424 HTML-pre: big spaces
3425 !! wikitext
3426 <pre>
3427
3428
3429
3430
3431 haha
3432
3433
3434
3435
3436 haha
3437
3438
3439
3440
3441 </pre>
3442 !! html/php+tidy
3443 <pre>
3444
3445
3446
3447
3448 haha
3449
3450
3451
3452
3453 haha
3454
3455
3456
3457
3458 </pre>
3459 !! html/parsoid
3460 <pre data-parsoid='{"stx":"html"}'>
3461
3462
3463
3464
3465 haha
3466
3467
3468
3469
3470 haha
3471
3472
3473
3474
3475 </pre>
3476 !! end
3477
3478 !!test
3479 HTML-pre: 2: indented text
3480 !! wikitext
3481 <pre>
3482 foo
3483 </pre>
3484 !! html
3485 <pre>
3486 foo
3487 </pre>
3488
3489 !!end
3490
3491 !!test
3492 HTML-pre: 3: other wikitext
3493 !! wikitext
3494 <pre>
3495 * foo
3496 # bar
3497 = no-h =
3498 '' no-italic ''
3499 [[ NoLink ]]
3500 </pre>
3501 !! html/php
3502 <pre>
3503 * foo
3504 # bar
3505 = no-h =
3506 '' no-italic ''
3507 [[ NoLink ]]
3508 </pre>
3509
3510 !! html/parsoid
3511 <pre data-parsoid='{"stx":"html","strippedNL":true}'>* foo
3512 # bar
3513 = no-h =
3514 '' no-italic ''
3515 [[ NoLink ]]
3516 </pre>
3517 !!end
3518
3519 ###
3520 ### Definition lists
3521 ###
3522 !! test
3523 Simple definition
3524 !! wikitext
3525 ; name : Definition
3526 !! html
3527 <dl><dt> name&#160;</dt>
3528 <dd> Definition</dd></dl>
3529
3530 !! end
3531
3532 !! test
3533 Definition list for indentation only
3534 !! wikitext
3535 : Indented text
3536 !! html
3537 <dl><dd> Indented text</dd></dl>
3538
3539 !! end
3540
3541 !! test
3542 Definition list with no space
3543 !! wikitext
3544 ;name:Definition
3545 !! html
3546 <dl><dt>name</dt>
3547 <dd>Definition</dd></dl>
3548
3549 !!end
3550
3551 !! test
3552 Definition list with URL link
3553 !! wikitext
3554 ; http://example.com/ : definition
3555 !! html
3556 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3557 <dd> definition</dd></dl>
3558
3559 !! end
3560
3561 !! test
3562 Definition list with bracketed URL link
3563 !! wikitext
3564 ;[http://www.example.com/ Example]:Something about it
3565 !! html
3566 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3567 <dd>Something about it</dd></dl>
3568
3569 !! end
3570
3571 !! test
3572 Definition list with wikilink containing colon
3573 !! wikitext
3574 ; [[Help:FAQ]]: The least-read page on Wikipedia
3575 !! html
3576 <dl><dt> <a href="/index.php?title=Help:FAQ&amp;action=edit&amp;redlink=1" class="new" title="Help:FAQ (page does not exist)">Help:FAQ</a></dt>
3577 <dd> The least-read page on Wikipedia</dd></dl>
3578
3579 !! end
3580
3581 # At Brion's and JeLuF's insistence... :)
3582 !! test
3583 Definition list with news link containing colon
3584 !! wikitext
3585 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
3586 !! html/php
3587 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3588 <dd> This isn't even a real newsgroup!</dd></dl>
3589
3590 !! html/parsoid
3591 <dl><dt> <a rel="mw:ExtLink" href="news:alt.wikipedia.rox" data-parsoid='{"stx":"url"}'>news:alt.wikipedia.rox</a></dt><dd data-parsoid='{"stx":"row"}'> This isn't even a real newsgroup!</dd></dl>
3592 !! end
3593
3594 !! test
3595 Malformed definition list with colon
3596 !! wikitext
3597 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3598 !! html
3599 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a> -- don't crash or enter an infinite loop</dt></dl>
3600
3601 !! end
3602
3603 !! test
3604 Definition lists: colon in external link text
3605 !! wikitext
3606 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3607 !! html
3608 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3609 <dd> OK, I made that up</dd></dl>
3610
3611 !! end
3612
3613 !! test
3614 Definition lists: colon in HTML attribute
3615 !! wikitext
3616 ;<b style="display: inline">bold</b>
3617 !! html
3618 <dl><dt><b style="display: inline">bold</b></dt></dl>
3619
3620 !! end
3621
3622 !! test
3623 Definition lists: self-closed tag
3624 !! wikitext
3625 ;one<br/>two : two-line fun
3626 !! html
3627 <dl><dt>one<br />two&#160;</dt>
3628 <dd> two-line fun</dd></dl>
3629
3630 !! end
3631
3632 !! test
3633 Bug 11748: Literal closing tags
3634 !! wikitext
3635 <dl>
3636 <dt>test 1</dt>
3637 <dd>test test test test test</dd>
3638 <dt>test 2</dt>
3639 <dd>test test test test test</dd>
3640 </dl>
3641 !! html
3642 <dl>
3643 <dt>test 1</dt>
3644 <dd>test test test test test</dd>
3645 <dt>test 2</dt>
3646 <dd>test test test test test</dd>
3647 </dl>
3648
3649 !! end
3650
3651 !! test
3652 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3653 !! wikitext
3654 <ul><li>
3655 ; term : description
3656 * unordered
3657 </li></ul>
3658 !! html
3659 <ul><li>
3660 <dl><dt> term&#160;</dt>
3661 <dd> description</dd></dl>
3662 <ul><li> unordered</li></ul>
3663 </li></ul>
3664
3665 !! end
3666
3667 !! test
3668
3669 Definition list with empty definition and following paragraph
3670 !! wikitext
3671 ; term:
3672 Paragraph text
3673 !! html
3674 <dl><dt> term</dt>
3675 <dd></dd></dl>
3676 <p>Paragraph text
3677 </p>
3678 !! end
3679
3680 !! test
3681 Nested definition lists using html syntax
3682 !! wikitext
3683 <dl><dt>x</dt>
3684 <dd>a</dd>
3685 <dd>b</dd></dl>
3686
3687 !! end
3688
3689 !! test
3690 Definition Lists: No nesting: Multiple dd's
3691 !! wikitext
3692 ;x
3693 :a
3694 :b
3695 !! html
3696 <dl><dt>x</dt>
3697 <dd>a</dd>
3698 <dd>b</dd></dl>
3699
3700 !! end
3701
3702 !! test
3703 Definition Lists: Indentation: Regular
3704 !! wikitext
3705 :i1
3706 ::i2
3707 :::i3
3708 !! html
3709 <dl><dd>i1
3710 <dl><dd>i2
3711 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3712
3713 !! end
3714
3715 !! test
3716 Definition Lists: Indentation: Missing 1st level
3717 !! wikitext
3718 ::i2
3719 :::i3
3720 !! html
3721 <dl><dd><dl><dd>i2
3722 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3723
3724 !! end
3725
3726 !! test
3727 Definition Lists: Indentation: Multi-level indent
3728 !! wikitext
3729 :::i3
3730 !! html
3731 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3732
3733 !! end
3734
3735 !! test
3736 Definition Lists: Hacky use to indent tables
3737 !! wikitext
3738 ::{|
3739 |foo
3740 |bar
3741 |}
3742 this text
3743 should be left alone
3744 !! html
3745 <dl><dd><dl><dd><table>
3746 <tr>
3747 <td>foo
3748 </td>
3749 <td>bar
3750 </td></tr></table></dd></dl></dd></dl>
3751 <p>this text
3752 should be left alone
3753 </p>
3754 !! end
3755
3756 !! test
3757 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3758 !! wikitext
3759 <!-- foo -->
3760 ::{|
3761 |foo
3762 |bar
3763 |}<!-- bar -->
3764 this text
3765 should be left alone
3766 !! html/parsoid
3767 <!-- foo -->
3768 <dl><dd><dl><dd><table><tr>
3769 <td>foo</td>
3770 <td>bar</td>
3771 </tr></table><!-- bar --></dd></dl></dd></dl>
3772 <p>this text
3773 should be left alone</p>
3774 !! end
3775
3776 !! test
3777 Definition Lists: Hacky use to indent tables, with comment before table
3778 !! wikitext
3779 ::<!-- foo -->{|
3780 |foo
3781 |}
3782 !! html/parsoid
3783 <dl><dd><dl><dd><!-- foo --><table><tr>
3784 <td>foo</td>
3785 </tr></table></dd></dl></dd></dl>
3786 !! end
3787
3788 # The trailing whitespace in this test is to catch a regression in
3789 # Parsoid after T54473.
3790 !! test
3791 Definition Lists: Hacky use to indent tables (WS-insensitive)
3792 !! wikitext
3793 : {|
3794 |a
3795 |}
3796 !! html/php
3797 <dl><dd><table>
3798 <tr>
3799 <td>a
3800 </td></tr></table></dd></dl>
3801
3802 !! html/parsoid
3803 <dl><dd> <table>
3804 <tbody><tr><td>a</td></tr>
3805 </tbody></table> </dd></dl>
3806 !! end
3807
3808 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3809 ## as an empty dt item. It also ignores all but the last ";" when followed
3810 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3811 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3812 ## ";"s.
3813 ##
3814 ## Ex: ";;t2 ::d2" is transformed into:
3815 ##
3816 ## <dl>
3817 ## <dt>t2 </dt>
3818 ## <dd>
3819 ## <dl>
3820 ## <dt></dt>
3821 ## <dd>d2</dd>
3822 ## </dl>
3823 ## </dd>
3824 ## </dl>
3825 ##
3826 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3827 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3828 ##
3829 ## <dl>
3830 ## <dt>
3831 ## <dl>
3832 ## <dt>t2 </dt>
3833 ## <dd>:d2</dd>
3834 ## </dl>
3835 ## </dt>
3836 ## </dl>
3837 ##
3838 ## All Parsoid only definition list tests have this difference.
3839 ##
3840 ## See also: https://phabricator.wikimedia.org/T8569
3841 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3842
3843 !! test
3844 Table / list interaction: indented table with lists in table contents
3845 !! wikitext
3846 :{|
3847 |-
3848 | a
3849 * b
3850 |-
3851 | c
3852 * d
3853 |}
3854 !! html
3855 <dl><dd><table>
3856
3857 <tr>
3858 <td> a
3859 <ul><li> b</li></ul>
3860 </td></tr>
3861 <tr>
3862 <td> c
3863 <ul><li> d</li></ul>
3864 </td></tr></table></dd></dl>
3865
3866 !! end
3867
3868 !!test
3869 Table / list interaction: lists nested in tables nested in indented lists
3870 !! wikitext
3871 :{|
3872 |
3873 :a
3874 :b
3875 |
3876 *c
3877 *d
3878 |}
3879
3880 *e
3881 *f
3882 !! html
3883 <dl><dd><table>
3884 <tr>
3885 <td>
3886 <dl><dd>a</dd>
3887 <dd>b</dd></dl>
3888 </td>
3889 <td>
3890 <ul><li>c</li>
3891 <li>d</li></ul>
3892 </td></tr></table></dd></dl>
3893 <ul><li>e</li>
3894 <li>f</li></ul>
3895
3896 !!end
3897
3898 !! test
3899 Definition Lists: Nesting: Multi-level (Parsoid only)
3900 !! options
3901 parsoid
3902 !! wikitext
3903 ;t1 :d1
3904 ;;t2 ::d2
3905 ;;;t3 :::d3
3906 !! html
3907 <dl>
3908 <dt>t1 </dt>
3909 <dd>d1</dd>
3910 <dt>
3911 <dl>
3912 <dt>t2 </dt>
3913 <dd>:d2</dd>
3914 <dt>
3915 <dl>
3916 <dt>t3 </dt>
3917 <dd>::d3</dd>
3918 </dl>
3919 </dt>
3920 </dl>
3921 </dt>
3922 </dl>
3923
3924
3925 !! end
3926
3927
3928 !! test
3929 Definition Lists: Nesting: Test 2 (Parsoid only)
3930 !! wikitext
3931 ;t1
3932 ::d2
3933 !! html/php+tidy
3934 <dl>
3935 <dt>t1</dt>
3936 <dd>
3937 <dl>
3938 <dd>d2</dd>
3939 </dl>
3940 </dd>
3941 </dl>
3942 !! html/parsoid
3943 <dl>
3944 <dt>t1</dt>
3945 <dd>
3946 <dl>
3947 <dd>d2</dd>
3948 </dl>
3949 </dd>
3950 </dl>
3951
3952 !! end
3953
3954
3955 !! test
3956 Definition Lists: Nesting: Test 3 (Parsoid only)
3957 !! wikitext
3958 :;t1
3959 ::::d2
3960 !! html/php+tidy
3961 <dl>
3962 <dd>
3963 <dl>
3964 <dt>t1</dt>
3965 <dd>
3966 <dl>
3967 <dd>
3968 <dl>
3969 <dd>d2</dd>
3970 </dl>
3971 </dd>
3972 </dl>
3973 </dd>
3974 </dl>
3975 </dd>
3976 </dl>
3977 !! html/parsoid
3978 <dl>
3979 <dd>
3980 <dl>
3981 <dt>t1</dt>
3982 <dd>
3983 <dl>
3984 <dd>
3985 <dl>
3986 <dd>d2</dd>
3987 </dl>
3988 </dd>
3989 </dl>
3990 </dd>
3991 </dl>
3992 </dd>
3993 </dl>
3994
3995 !! end
3996
3997
3998 !! test
3999 Definition Lists: Nesting: Test 4
4000 !! wikitext
4001 ::;t3
4002 :::d3
4003 !! html
4004 <dl><dd><dl><dd><dl><dt>t3</dt>
4005 <dd>d3</dd></dl></dd></dl></dd></dl>
4006
4007 !! end
4008
4009
4010 ## The Parsoid team believes the following three test exposes a
4011 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
4012 ## wrong to close the <dl> after the <dt> containing the <ul>.)
4013 ## It also exposes a "misfeature" in tidy, which doesn't like
4014 ## <dl> tags with a single <dt> child; it converts the <dt> into
4015 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
4016 !! test
4017 Definition Lists: Mixed Lists: Test 1
4018 !! wikitext
4019 :;* foo
4020 ::* bar
4021 :; baz
4022 !! html/php
4023 <dl><dd><dl><dt><ul><li> foo</li>
4024 <li> bar</li></ul></dt></dl>
4025 <dl><dt> baz</dt></dl></dd></dl>
4026
4027 !! html/php+tidy
4028 <dl>
4029 <dd>
4030 <dl>
4031 <dd>
4032 <ul>
4033 <li>foo</li>
4034 <li>bar</li>
4035 </ul>
4036 </dd>
4037 </dl>
4038 <dl>
4039 <dt>baz</dt>
4040 </dl>
4041 </dd>
4042 </dl>
4043 !! html/parsoid
4044 <dl>
4045 <dd><dl>
4046 <dt><ul>
4047 <li> foo
4048 </li>
4049 </ul></dt>
4050 <dd><ul>
4051 <li> bar
4052 </li>
4053 </ul></dd>
4054 <dt> baz</dt>
4055 </dl></dd>
4056 </dl>
4057 !! end
4058
4059 !! test
4060 Definition Lists: Mixed Lists: Test 2
4061 !! wikitext
4062 *: d1
4063 *: d2
4064 !! html
4065 <ul><li><dl><dd> d1</dd>
4066 <dd> d2</dd></dl></li></ul>
4067
4068 !! end
4069
4070
4071 !! test
4072 Definition Lists: Mixed Lists: Test 3
4073 !! wikitext
4074 *::: d1
4075 *::: d2
4076 !! html
4077 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
4078 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
4079
4080 !! end
4081
4082
4083 !! test
4084 Definition Lists: Mixed Lists: Test 4
4085 !! wikitext
4086 *;d1 :d2
4087 *;d3 :d4
4088 !! html
4089 <ul><li><dl><dt>d1&#160;</dt>
4090 <dd>d2</dd>
4091 <dt>d3&#160;</dt>
4092 <dd>d4</dd></dl></li></ul>
4093
4094 !! end
4095
4096
4097 !! test
4098 Definition Lists: Mixed Lists: Test 5
4099 !! wikitext
4100 *:d1
4101 *:: d2
4102 !! html
4103 <ul><li><dl><dd>d1
4104 <dl><dd> d2</dd></dl></dd></dl></li></ul>
4105
4106 !! end
4107
4108
4109 !! test
4110 Definition Lists: Mixed Lists: Test 6
4111 !! wikitext
4112 #*:d1
4113 #*::: d3
4114 !! html
4115 <ol><li><ul><li><dl><dd>d1
4116 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4117
4118 !! end
4119
4120
4121 !! test
4122 Definition Lists: Mixed Lists: Test 7
4123 !! wikitext
4124 :* d1
4125 :* d2
4126 !! html
4127 <dl><dd><ul><li> d1</li>
4128 <li> d2</li></ul></dd></dl>
4129
4130 !! end
4131
4132
4133 !! test
4134 Definition Lists: Mixed Lists: Test 8
4135 !! wikitext
4136 :* d1
4137 ::* d2
4138 !! html
4139 <dl><dd><ul><li> d1</li></ul>
4140 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
4141
4142 !! end
4143
4144
4145 !! test
4146 Definition Lists: Mixed Lists: Test 9
4147 !! wikitext
4148 *;foo :bar
4149 !! html
4150 <ul><li><dl><dt>foo&#160;</dt>
4151 <dd>bar</dd></dl></li></ul>
4152
4153 !! end
4154
4155
4156 !! test
4157 Definition Lists: Mixed Lists: Test 10
4158 !! wikitext
4159 *#;foo :bar
4160 !! html
4161 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4162 <dd>bar</dd></dl></li></ol></li></ul>
4163
4164 !! end
4165
4166 # The Parsoid team disagrees with the PHP parser's seemingly-random
4167 # rules regarding dd/dt on the next two tests. Parsoid is more
4168 # consistent, and recognizes the shared nesting and keeps the
4169 # still-open tags around until the nesting is complete.
4170 # (And tidy again converts <dt> to <dd> before 'bar'.)
4171
4172 !! test
4173 Definition Lists: Mixed Lists: Test 11
4174 !! wikitext
4175 *#*#;*;;foo :bar
4176 *#*#;boo :baz
4177 !! html/php
4178 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4179 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4180 <dl><dt>boo&#160;</dt>
4181 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4182
4183 !! html/php+tidy
4184 <ul>
4185 <li>
4186 <ol>
4187 <li>
4188 <ul>
4189 <li>
4190 <ol>
4191 <li>
4192 <dl>
4193 <dt>foo&#160;</dt>
4194 <dd>
4195 <ul>
4196 <li>
4197 <dl>
4198 <dd>
4199 <dl>
4200 <dt>bar</dt>
4201 </dl>
4202 </dd>
4203 </dl>
4204 </li>
4205 </ul>
4206 </dd>
4207 </dl>
4208 <dl>
4209 <dt>boo&#160;</dt>
4210 <dd>baz</dd>
4211 </dl>
4212 </li>
4213 </ol>
4214 </li>
4215 </ul>
4216 </li>
4217 </ol>
4218 </li>
4219 </ul>
4220 !! html/parsoid
4221 <ul>
4222 <li>
4223 <ol>
4224 <li>
4225 <ul>
4226 <li>
4227 <ol>
4228 <li>
4229 <dl>
4230 <dt>
4231 <ul>
4232 <li>
4233 <dl>
4234 <dt>
4235 <dl>
4236 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4237 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4238 </dl></dt>
4239 </dl></li>
4240 </ul></dt>
4241 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4242 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4243 </dl></li>
4244 </ol></li>
4245 </ul></li>
4246 </ol></li>
4247 </ul>
4248 !! end
4249
4250
4251 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
4252 # From whitelist:
4253 # * The test is wrong, there are two colons where there should be :;
4254 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4255 !! test
4256 Definition Lists: Weird Ones: Test 1
4257 !! wikitext
4258 *#;*::;; foo : bar (who uses this?)
4259 !! html/php
4260 <ul><li><ol><li><dl><dt> foo&#160;</dt>
4261 <dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> bar (who uses this?)</dt></dl></dd></dl></dd></dl></dd></dl></li></ul></dd></dl></li></ol></li></ul>
4262
4263 !! html/php+tidy
4264 <ul>
4265 <li>
4266 <ol>
4267 <li>
4268 <dl>
4269 <dt>foo&#160;</dt>
4270 <dd>
4271 <ul>
4272 <li>
4273 <dl>
4274 <dd>
4275 <dl>
4276 <dd>
4277 <dl>
4278 <dd>
4279 <dl>
4280 <dt>bar (who uses this?)</dt>
4281 </dl>
4282 </dd>
4283 </dl>
4284 </dd>
4285 </dl>
4286 </dd>
4287 </dl>
4288 </li>
4289 </ul>
4290 </dd>
4291 </dl>
4292 </li>
4293 </ol>
4294 </li>
4295 </ul>
4296 !! html/parsoid
4297 <ul>
4298 <li>
4299 <ol>
4300 <li>
4301 <dl>
4302 <dt>
4303 <ul>
4304 <li>
4305 <dl>
4306 <dd>
4307 <dl>
4308 <dd>
4309 <dl>
4310 <dt>
4311 <dl>
4312 <dt> foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span></dt>
4313 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
4314 </dl></dt>
4315 </dl></dd>
4316 </dl></dd>
4317 </dl></li>
4318 </ul></dt>
4319 </dl></li>
4320 </ol></li>
4321 </ul>
4322 !! end
4323
4324 !! test
4325 Definition Lists: colons occurring in tags
4326 !! wikitext
4327 ;a:b
4328 ;'''a:b'''
4329 ;<i>a:b</i>
4330 ;<span>a:b</span>
4331 ;<div>a:b</div>
4332 ;<div>a
4333 :b</div>
4334 ;{{echo|a:b}}
4335 ;{{echo|''a:b''}}
4336 ;;;''a:b''
4337 !! html+tidy
4338 <dl>
4339 <dt>a</dt>
4340 <dd>b</dd>
4341 <dt><b>a:b</b></dt>
4342 <dt><i>a:b</i></dt>
4343 <dt><span>a:b</span></dt>
4344 <dd>
4345 <div>a:b</div>
4346 </dd>
4347 <dd>
4348 <div>a
4349 <dl>
4350 <dd>b</dd>
4351 </dl>
4352 </div>
4353 </dd>
4354 <dt>a</dt>
4355 <dd>b</dd>
4356 <dt><i>a:b</i></dt>
4357 </dl>
4358 <dl>
4359 <dd>
4360 <dl>
4361 <dd>
4362 <dl>
4363 <dt><i>a:b</i></dt>
4364 </dl>
4365 </dd>
4366 </dl>
4367 </dd>
4368 </dl>
4369 !! html/parsoid
4370 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4371 <dt><b>a:b</b></dt>
4372 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4373 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4374 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4375 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4376 <dd>b</dd>
4377 <dt><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a:b"}},"i":0}}]}'>a:b</span></dt>
4378 <dt><i about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&#39;&#39;a:b&#39;&#39;"}},"i":0}}]}'>a:b</i>
4379 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4380 !! end
4381
4382 !! test
4383 Definition Lists: colons and tables 1
4384 !! wikitext
4385 :{|
4386 | x
4387 |}
4388 :{|
4389 | y
4390 |}
4391 !! html
4392 <dl><dd><table>
4393 <tr>
4394 <td> x
4395 </td></tr></table></dd></dl>
4396 <dl><dd><table>
4397 <tr>
4398 <td> y
4399 </td></tr></table></dd></dl>
4400
4401 !! end
4402
4403 # Parsoid's output (as documented below) differs from php's in this case.
4404 # This is probably a bug. If we fixup parsoid to match php's output, the
4405 # above test should pass and the below test case can be removed. It is
4406 # unclear which output is more desirable.
4407
4408 !! test
4409 Definition Lists: colons and tables 2
4410 !! wikitext
4411 :{|
4412 | x
4413 |}
4414 :{|
4415 | y
4416 |}
4417 !! html/parsoid
4418 <dl><dd><table>
4419 <tr>
4420 <td> x
4421 </td></tr></table></dd>
4422 <dd><table>
4423 <tr>
4424 <td> y
4425 </td></tr></table></dd></dl>
4426 !! end
4427
4428 !! test
4429 Definition Lists: template interaction
4430 !! wikitext
4431 ::{{definition_list}}
4432
4433 :one
4434 ::{{definition_list}}
4435 :::two
4436 :::three
4437 ::four
4438 !! html/parsoid
4439 <dl><dd><dl data-parsoid='{}'><dd about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[":",{"template":{"target":{"wt":"definition_list","href":"./Template:Definition_list"},"params":{},"i":0}}]}'>one</dd><span about="#mwt1">
4440 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4441
4442 <dl><dd data-parsoid='{}'>one
4443 <dl><dd about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":["::",{"template":{"target":{"wt":"definition_list","href":"./Template:Definition_list"},"params":{},"i":0}},"\n:::two\n:::three"]}'>one</dd><span about="#mwt2">
4444 </span><dd about="#mwt2">two
4445 <dl><dd>two</dd>
4446 <dd>three</dd></dl></dd>
4447 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4448 !! end
4449
4450
4451 ###
4452 ### External links
4453 ###
4454 !! test
4455 External links: non-bracketed
4456 !! wikitext
4457 Non-bracketed: http://example.com
4458 !! html
4459 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4460 </p>
4461 !! end
4462
4463 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4464 !! test
4465 External links: numbered
4466 !! wikitext
4467 Numbered: [http://example.com]
4468 Numbered: [http://example.net]
4469 Numbered: [http://example.com]
4470 !! html/php
4471 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4472 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4473 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4474 </p>
4475 !! html/parsoid
4476 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
4477 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
4478 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
4479 !!end
4480
4481 !! test
4482 External links: specified text
4483 !! wikitext
4484 Specified text: [http://example.com link]
4485 !! html
4486 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4487 </p>
4488 !!end
4489
4490 !! test
4491 External links: trail
4492 !! wikitext
4493 Linktrails should not work for external links: [http://example.com link]s
4494 !! html
4495 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4496 </p>
4497 !! end
4498
4499 !! test
4500 External links: dollar sign in URL
4501 !! wikitext
4502 http://example.com/1$2345
4503 !! html
4504 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4505 </p>
4506 !! end
4507
4508 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4509 !! test
4510 External links: dollar sign in URL (autonumber)
4511 !! wikitext
4512 [http://example.com/1$2345]
4513 !! html/php
4514 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4515 </p>
4516 !! html/parsoid
4517 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4518 !!end
4519
4520 !! test
4521 External links: open square bracket forbidden in URL (bug 4377)
4522 !! options
4523 parsoid=wt2html,wt2wt,html2html
4524 !! wikitext
4525 http://example.com/1[2345
4526 !! html/php
4527 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4528 </p>
4529 !! html/parsoid
4530 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4531 !! end
4532
4533 !! test
4534 External links: open square bracket forbidden in URL (named) (bug 4377)
4535 !! options
4536 parsoid=wt2html,html2html
4537 !! wikitext
4538 [http://example.com/1[2345]
4539 !! html/php
4540 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4541 </p>
4542 !! html/parsoid
4543 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4544 !!end
4545
4546 # parsoid adds a space before the link name
4547 !! test
4548 External links: open square bracket forbidden in URL (named) (bug 4377)
4549 Parsoid variant.
4550 !! wikitext
4551 [http://example.com/1 [2345]
4552 !! html
4553 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4554 </p>
4555 !!end
4556
4557 !! test
4558 External links: nowiki in URL link text (bug 6230)
4559 !! wikitext
4560 [http://example.com/ <nowiki>''example site''</nowiki>]
4561 !! html
4562 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4563 </p>
4564 !! end
4565
4566 !! test
4567 External links: newline forbidden in text (bug 6230 regression check)
4568 !! wikitext
4569 [http://example.com/ first
4570 second]
4571 !! html
4572 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4573 second]
4574 </p>
4575 !!end
4576
4577 !! test
4578 External links: Pipe char between url and text
4579 !! wikitext
4580 [http://example.com | link]
4581 !! html
4582 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4583 </p>
4584 !!end
4585
4586 !! test
4587 External links: protocol-relative URL in brackets
4588 !! wikitext
4589 [//example.com/ Test]
4590 !! html
4591 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4592 </p>
4593 !! end
4594
4595 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4596 !! test
4597 External links: protocol-relative URL in brackets without text
4598 !! wikitext
4599 [//example.com]
4600 !! html/php
4601 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4602 </p>
4603 !! html/parsoid
4604 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4605 !! end
4606
4607 !! test
4608 External links: protocol-relative URL in free text is left alone
4609 !! wikitext
4610 //example.com/Foo
4611 !! html
4612 <p>//example.com/Foo
4613 </p>
4614 !!end
4615
4616 !! test
4617 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
4618 !! wikitext
4619 foo//example.com/Foo
4620 !! html
4621 <p>foo//example.com/Foo
4622 </p>
4623 !! end
4624
4625 !! test
4626 External links: with no contents
4627 !! wikitext
4628 [http://en.wikipedia.org/wiki/Foo]
4629
4630 [[wikipedia:Foo|Bar]]
4631
4632 [[wikipedia:Foo|<span>Bar</span>]]
4633 !! html/php
4634 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4635 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4636 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4637 </p>
4638 !! html/parsoid
4639 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4640 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4641 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4642 !! end
4643
4644 !! test
4645 External links: Free with trailing punctuation
4646 !! wikitext
4647 http://example.com,
4648 http://example.com;
4649 http://example.com\
4650 http://example.com.
4651 http://example.com:
4652 http://example.com!
4653 http://example.com?
4654 http://example.com)
4655 http://example.com/url_with_(brackets)
4656 (http://example.com/url_without_brackets)
4657 http://example.com/url_with_entity&amp;
4658 http://example.com/url_with_entity&#x26;
4659 http://example.com/url_with_entity&#038;
4660 http://example.com/url_with_entity&nbsp;
4661 http://example.com/url_with_entity&#xA0;
4662 http://example.com/url_with_entity&#160;
4663 http://example.com/url_with_entity&lt;
4664 http://example.com/url_with_entity&#x3C;
4665 http://example.com/url_with_entity&#60;
4666 !! html/php
4667 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4668 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4669 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4670 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4671 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4672 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4673 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4674 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4675 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4676 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4677 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4678 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4679 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4680 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4681 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#xa0;
4682 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4683 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4684 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#x3c;
4685 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#60;
4686 </p>
4687 !! html/parsoid
4688 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>,
4689 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>;
4690 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>\
4691 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>.
4692 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:
4693 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>!
4694 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>?
4695 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)
4696 <a rel="mw:ExtLink" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4697 (<a rel="mw:ExtLink" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4698 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4699 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4700 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4701 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>
4702 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span>
4703 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span>
4704 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span>
4705 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#x3C;","srcContent":"&lt;"}'>&lt;</span>
4706 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#60;","srcContent":"&lt;"}'>&lt;</span></p>
4707 !! end
4708
4709 !! test
4710 External links: tricky Parsoid html2html case
4711 !! options
4712 parsoid=wt2html,wt2wt,html2html
4713 !! wikitext
4714 http://example.com/url_with_entity&amp;amp;
4715 !! html/php
4716 <p><a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;amp">http://example.com/url_with_entity&amp;amp</a>;
4717 </p>
4718 !! html/parsoid
4719 <p><a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;amp">http://example.com/url_with_entity&amp;amp</a>;</p>
4720 !! end
4721
4722 !! test
4723 External links: Free with trailing quotes (T113666)
4724 !! wikitext
4725 '''News:''' Stuff here
4726
4727 news:'a'b''c''d e
4728 !! html/php
4729 <p><b>News:</b> Stuff here
4730 </p><p><a rel="nofollow" class="external free" href="news:'a'b">news:'a'b</a><i>c</i>d e
4731 </p>
4732 !! html/parsoid
4733 <p><b>News:</b> Stuff here</p>
4734 <p><a rel="mw:ExtLink" href="news:'a'b">news:'a'b</a><i>c</i>d e</p>
4735 !! end
4736
4737 !! test
4738 External links: Lone protocols are never linked (T105697)
4739 !! wikitext
4740 http://
4741 http://;
4742 (http://)
4743 bitcoin:
4744 bitcoin:;
4745 (bitcoin:)
4746 !! html
4747 <p>http://
4748 http://;
4749 (http://)
4750 bitcoin:
4751 bitcoin:;
4752 (bitcoin:)
4753 </p>
4754 !! end
4755
4756 !! test
4757 External links: No preceding word characters allowed (bug 65278)
4758 !! wikitext
4759 NOPEhttp://example.com
4760 N0http://example.com
4761 ok:http://example.com
4762 ok-http://example.com
4763 !! html
4764 <p>NOPEhttp://example.com
4765 N0http://example.com
4766 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4767 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4768 </p>
4769 !! end
4770
4771 !! test
4772 External image
4773 !! wikitext
4774 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4775 !! html
4776 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4777 </p>
4778 !! end
4779
4780 !! test
4781 External image from https
4782 !! wikitext
4783 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4784 !! html
4785 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4786 </p>
4787 !! end
4788
4789 !! test
4790 External image (when not allowed)
4791 !! options
4792 wgAllowExternalImages=0
4793 !! wikitext
4794 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4795 !! html
4796 <p>External image: <a rel="nofollow" class="external free" href="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png">http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png</a>
4797 </p>
4798 !! end
4799
4800 !! test
4801 Link to non-http image, no img tag
4802 !! wikitext
4803 Link to non-http image, no img tag: ftp://example.com/test.jpg
4804 !! html
4805 <p>Link to non-http image, no img tag: <a rel="nofollow" class="external free" href="ftp://example.com/test.jpg">ftp://example.com/test.jpg</a>
4806 </p>
4807 !! end
4808
4809 !! test
4810 External links: terminating separator
4811 !! wikitext
4812 Terminating separator: http://example.com/thing,
4813 !! html
4814 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4815 </p>
4816 !! end
4817
4818 !! test
4819 External links: intervening separator
4820 !! wikitext
4821 Intervening separator: http://example.com/1,2,3
4822 !! html
4823 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4824 </p>
4825 !! end
4826
4827 !! test
4828 External links: old bug with URL in query
4829 !! wikitext
4830 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4831 !! html
4832 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4833 </p>
4834 !! end
4835
4836 !! test
4837 External links: old URL-in-URL bug, mixed protocols
4838 !! wikitext
4839 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4840 !! html
4841 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4842 </p>
4843 !!end
4844
4845 !! test
4846 External links: URL in text
4847 !! wikitext
4848 URL in text: [http://example.com http://example.com]
4849 !! html
4850 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4851 </p>
4852 !! end
4853
4854 !! test
4855 External links: Clickable images
4856 !! wikitext
4857 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4858 !! html/php
4859 <p>ja-style clickable images: <a rel="nofollow" class="external text" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" /></a>
4860 </p>
4861 !! html/parsoid
4862 <p>ja-style clickable images: <a rel="mw:ExtLink" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" data-parsoid='{"type":"extlink"}'/></a></p>
4863 !! end
4864
4865 !! test
4866 External links: raw ampersand
4867 !! wikitext
4868 Old &amp; use: http://x&y
4869 !! html
4870 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4871 </p>
4872 !! end
4873
4874 !! test
4875 External links: encoded ampersand
4876 !! wikitext
4877 Old &amp; use: http://x&amp;y
4878 !! html/php
4879 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4880 </p>
4881 !! html/parsoid
4882 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4883 !! end
4884
4885 !! test
4886 External links: encoded equals (bug 6102)
4887 !! wikitext
4888 http://example.com/?foo&#61;bar
4889 !! html/php
4890 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4891 </p>
4892 !! html/parsoid
4893 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4894 !! end
4895
4896 ##
4897 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4898 ## does it number them. As discussed in bug 53505, we can identify
4899 ## autonumbered links via CSS.
4900 ##
4901
4902 !! test
4903 External links: [raw ampersand]
4904 !! wikitext
4905 Old &amp; use: [http://x&y]
4906 !! html/php
4907 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4908 </p>
4909 !! html/parsoid
4910 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4911 !! end
4912
4913 # note that parsoid html is identical to [raw ampersand] case; so html2wt
4914 # mode will return the [raw ampersand] wikitext
4915 !! test
4916 External links: [encoded ampersand]
4917 !! options
4918 parsoid=wt2html,wt2wt,html2html
4919 !! wikitext
4920 Old &amp; use: [http://x&amp;y]
4921 !! html/php
4922 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4923 </p>
4924 !! html/parsoid
4925 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4926 !! end
4927
4928 !! test
4929 External links: [raw equals]
4930 !! wikitext
4931 [http://example.com/?foo=bar]
4932 !! html/php
4933 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4934 </p>
4935 !! html/parsoid
4936 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4937 !! end
4938
4939 # note that parsoid html is identical to [raw equals] case; so html2wt
4940 # mode will return the [raw equals] wikitext
4941 !! test
4942 External links: [encoded equals] (bug 6102)
4943 !! options
4944 parsoid=wt2html,wt2wt,html2html
4945 !! wikitext
4946 [http://example.com/?foo&#61;bar]
4947 !! html/php
4948 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4949 </p>
4950 !! html/parsoid
4951 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4952 !! end
4953
4954 # xxx parsoid strips the IDN character, so the round-trip tests will
4955 # obviously fail and are disabled. --cscott
4956 !! test
4957 External links: [IDN ignored character reference in hostname; strip it right off]
4958 !! options
4959 parsoid=wt2html,wt2wt,html2html
4960 !! wikitext
4961 [http://e&zwnj;xample.com/]
4962 !! html/php
4963 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
4964 </p>
4965 !! html/parsoid
4966 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
4967 !! end
4968
4969 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
4970 # Where an external link could easily circumvent the sanitization of the text of
4971 # a link like this (where an IDN-ignore character is in the URL somewhere), this
4972 # test demands a higher standard. That's a bit strange.
4973 #
4974 # Example:
4975 #
4976 # http://e‌xample.com -> [http://example.com|http://example.com]
4977 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
4978 #
4979 # The first example is sanitized, but the second is not. Any security benefits
4980 # from this production are trivial to circumvent. Either remove this test and
4981 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
4982 # the test accordingly.
4983 #
4984 # All our love,
4985 # The Parsoid team.
4986 # xxx parsoid strips the IDN character, so the round-trip tests will
4987 # obviously fail and are disabled. --cscott
4988 !! test
4989 External links: IDN ignored character reference in hostname; strip it right off
4990 !! options
4991 parsoid=wt2html,html2html
4992 !! wikitext
4993 http://e&zwnj;xample.com/
4994 !! html/php
4995 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
4996 </p>
4997 !! html/parsoid
4998 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
4999 !! end
5000
5001 !! test
5002 External links: www.jpeg.org (bug 554)
5003 !! wikitext
5004 http://www.jpeg.org
5005 !! html
5006 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
5007 </p>
5008 !! end
5009
5010 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
5011 !! test
5012 External links: URL within URL (original bug 2)
5013 !! wikitext
5014 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
5015 !! html/php
5016 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
5017 </p>
5018 !! html/parsoid
5019 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
5020 !! end
5021
5022 !! test
5023 BUG 361: URL inside bracketed URL
5024 !! wikitext
5025 [http://www.example.com/foo http://www.example.com/bar]
5026 !! html
5027 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
5028 </p>
5029 !! end
5030
5031 !! test
5032 BUG 361: URL within URL, not bracketed
5033 !! wikitext
5034 http://www.example.com/foo?=http://www.example.com/bar
5035 !! html
5036 <p><a rel="nofollow" class="external free" href="http://www.example.com/foo?=http://www.example.com/bar">http://www.example.com/foo?=http://www.example.com/bar</a>
5037 </p>
5038 !! end
5039
5040 !! test
5041 BUG 289: ">"-token in URL-tail
5042 !! wikitext
5043 http://www.example.com/<hello>
5044 !! html
5045 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
5046 </p>
5047 !!end
5048
5049 !! test
5050 BUG 289: literal ">"-token in URL-tail
5051 !! wikitext
5052 http://www.example.com/<b>html</b>
5053 !! html/php
5054 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
5055 </p>
5056 !! html/parsoid
5057 <p><a rel="mw:ExtLink" href="http://www.example.com/" data-parsoid='{"stx":"url"}'>http://www.example.com/</a><b data-parsoid='{"stx":"html"}'>html</b></p>
5058 !! end
5059
5060 !! test
5061 BUG 289: ">"-token in bracketed URL
5062 !! wikitext
5063 [http://www.example.com/<hello> stuff]
5064 !! html
5065 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
5066 </p>
5067 !!end
5068
5069 !! test
5070 BUG 289: literal ">"-token in bracketed URL
5071 !! wikitext
5072 [http://www.example.com/<b>html</b> stuff]
5073 !! html
5074 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
5075 </p>
5076 !!end
5077
5078 !! test
5079 BUG 289: literal double quote at end of URL
5080 !! wikitext
5081 http://www.example.com/"hello"
5082 !! html
5083 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
5084 </p>
5085 !!end
5086
5087 !! test
5088 BUG 289: literal double quote in bracketed URL
5089 !! wikitext
5090 [http://www.example.com/"hello" stuff]
5091 !! html
5092 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
5093 </p>
5094 !!end
5095
5096 !! test
5097 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
5098 !! wikitext
5099 [http://www.example.com test]
5100 !! html
5101 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
5102 </p>
5103 !! end
5104
5105 !! test
5106 External links: link text with spaces
5107 !! wikitext
5108 [http://www.example.com a b c]
5109 [http://www.example.com ''a'' ''b'']
5110 !! html
5111 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5112 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5113 </p>
5114 !! end
5115
5116 !! test
5117 External links: wiki links within external link (Bug 3695)
5118 !! options
5119 parsoid=wt2html,html2html
5120 !! wikitext
5121 [http://example.com [[wikilink]] embedded in ext link]
5122 !! html/php
5123 <p><a rel="nofollow" class="external text" href="http://example.com"></a><a href="/index.php?title=Wikilink&amp;action=edit&amp;redlink=1" class="new" title="Wikilink (page does not exist)">wikilink</a><a rel="nofollow" class="external text" href="http://example.com"> embedded in ext link</a>
5124 </p>
5125 !! html/parsoid
5126 <p><a rel="mw:ExtLink" href="http://example.com"></a><a rel="mw:WikiLink" href="./Wikilink" title="Wikilink">wikilink</a><span> embedded in ext link</span></p>
5127 !! end
5128
5129 !! test
5130 BUG 787: Links with one slash after the url protocol are invalid
5131 !! wikitext
5132 http:/example.com
5133
5134 [http:/example.com title]
5135 !! html
5136 <p>http:/example.com
5137 </p><p>[http:/example.com title]
5138 </p>
5139 !! end
5140
5141 !! test
5142 Bracketed external links with template-generated invalid target
5143 !! wikitext
5144 [{{echo|http:/example.com}} title]
5145 !! html
5146 <p>[http:/example.com title]
5147 </p>
5148 !! end
5149
5150 !! test
5151 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
5152 !! wikitext
5153 ''[http://example.com text'']
5154 [http://example.com '''text]'''
5155 ''Something [http://example.com in italic'']
5156 ''Something [http://example.com mixed''''', even bold]'''
5157 '''''Now [http://example.com both''''']
5158 !! html
5159 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5160 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5161 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5162 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5163 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5164 </p>
5165 !! end
5166
5167
5168 !! test
5169 Bug 4781: %26 in URL
5170 !! wikitext
5171 http://www.example.com/?title=AT%26T
5172 !! html/php
5173 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5174 </p>
5175 !! html/parsoid
5176 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
5177 !! end
5178
5179 # According to http://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5180 # % is actually legal in HTML5. Any change in output would need testing though.
5181 !! test
5182 Bug 4781, 5267: %25 in URL
5183 !! wikitext
5184 http://www.example.com/?title=100%25_Bran
5185 !! html/php
5186 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a>
5187 </p>
5188 !! html/parsoid
5189 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
5190 !! end
5191
5192 !! test
5193 Bug 4781, 5267: %28, %29 in URL
5194 !! wikitext
5195 http://www.example.com/?title=Ben-Hur_%281959_film%29
5196 !! html/php
5197 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">http://www.example.com/?title=Ben-Hur_%281959_film%29</a>
5198 </p>
5199 !! html/parsoid
5200 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">http://www.example.com/?title=Ben-Hur_%281959_film%29</a></p>
5201 !! end
5202
5203
5204 !! test
5205 Bug 4781: %26 in autonumber URL
5206 !! wikitext
5207 [http://www.example.com/?title=AT%26T]
5208 !! html/php
5209 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5210 </p>
5211 !! html/parsoid
5212 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
5213 !! end
5214
5215 !! test
5216 Bug 4781, 5267: %26 in autonumber URL
5217 !! wikitext
5218 [http://www.example.com/?title=100%25_Bran]
5219 !! html/php
5220 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5221 </p>
5222 !! html/parsoid
5223 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
5224 !! end
5225
5226 !! test
5227 Bug 4781, 5267: %28, %29 in autonumber URL
5228 !! wikitext
5229 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5230 !! html/php
5231 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5232 </p>
5233 !! html/parsoid
5234 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5235 !! end
5236
5237
5238 !! test
5239 Bug 4781: %26 in bracketed URL
5240 !! wikitext
5241 [http://www.example.com/?title=AT%26T link]
5242 !! html/php
5243 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5244 </p>
5245 !! html/parsoid
5246 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
5247 !! end
5248
5249 !! test
5250 Bug 4781, 5267: %25 in bracketed URL
5251 !! wikitext
5252 [http://www.example.com/?title=100%25_Bran link]
5253 !! html
5254 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5255 </p>
5256 !! end
5257
5258 !! test
5259 Bug 4781, 5267: %28, %29 in bracketed URL
5260 !! wikitext
5261 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5262 !! html/php
5263 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5264 </p>
5265 !! html/parsoid
5266 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5267 !! end
5268
5269 !! test
5270 External link containing a period in the anchor. (bug 63947)
5271 !! wikitext
5272 [//foo.org/bar#baz. bang]
5273
5274 [//foo.org/bar. bang]
5275 !! html/php
5276 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5277 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5278 </p>
5279 !! html/parsoid
5280 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
5281 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
5282 !! end
5283
5284 !! test
5285 External link containing a single quote. (bug 63947)
5286 !! wikitext
5287 [//foo.org/bar'baz]
5288
5289 [//foo.org/bar'baz bang]
5290 !! html/php
5291 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
5292 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
5293 </p>
5294 !! html/parsoid
5295 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
5296 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
5297 !! end
5298
5299 !! test
5300 External link containing double-single-quotes in text '' (bug 4598 sanity check)
5301 !! wikitext
5302 Some [http://example.com/ pretty ''italics'' and stuff]!
5303 !! html
5304 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5305 </p>
5306 !! end
5307
5308 !! test
5309 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
5310 !! wikitext
5311 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5312 !! html
5313 <p><i>Some </i><a rel="nofollow" class="external text" href="http://example.com/"><i>pretty </i>italics<i> and stuff</i></a><i>!</i>
5314 </p>
5315 !! end
5316
5317 !! test
5318 External link containing double-single-quotes with no space separating the url from text in italics
5319 !! wikitext
5320 [http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm''La muerte de Casagemas'' (1901) en el sitio de [[Museo Picasso (París)|Museo Picasso]].]
5321 !! html/php
5322 <p><a rel="nofollow" class="external text" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de <a href="/index.php?title=Museo_Picasso_(Par%C3%ADs)&amp;action=edit&amp;redlink=1" class="new" title="Museo Picasso (París) (page does not exist)">Museo Picasso</a>.</a>
5323 </p>
5324 !! html/php+tidy
5325 <p><a rel="nofollow" class="external text" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de</a> <a href="/index.php?title=Museo_Picasso_(Par%C3%ADs)&amp;action=edit&amp;redlink=1" class="new" title="Museo Picasso (París) (page does not exist)">Museo Picasso</a>.</p>
5326 !! html/parsoid
5327 <p><a rel="mw:ExtLink" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de </a><a rel="mw:WikiLink" href="./Museo_Picasso_(París)" title="Museo Picasso (París)">Museo Picasso</a><span>.</span></p>
5328 !! end
5329
5330 !! test
5331 External link with comments in link text
5332 !! wikitext
5333 [http://www.google.com Google <!-- comment -->]
5334 !! html/php
5335 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5336 </p>
5337 !! html/parsoid
5338 <p><a rel="mw:ExtLink" href="http://www.google.com">Google <!-- comment --></a></p>
5339 !! end
5340
5341 !! test
5342 External link to bare IPv4 address
5343 !! wikitext
5344 [http://192.168.0.1 Link]
5345 !! html/php
5346 <p><a rel="nofollow" class="external text" href="http://192.168.0.1">Link</a>
5347 </p>
5348 !! html/parsoid
5349 <p><a rel="mw:ExtLink" href="http://192.168.0.1">Link</a></p>
5350 !! end
5351
5352 !! test
5353 URL-encoding in URL functions (single parameter)
5354 !! wikitext
5355 {{localurl:Some page|amp=&}}
5356 !! html
5357 <p>/index.php?title=Some_page&amp;amp=&amp;
5358 </p>
5359 !! end
5360
5361 !! test
5362 URL-encoding in URL functions (multiple parameters)
5363 !! wikitext
5364 {{localurl:Some page|q=?&amp=&}}
5365 !! html
5366 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5367 </p>
5368 !! end
5369
5370 !! test
5371 Brackets in urls
5372 !! wikitext
5373 http://example.com/index.php?foozoid%5B%5D=bar
5374
5375 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5376 !! html/php
5377 <p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
5378 </p><p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
5379 </p>
5380 !! html/parsoid
5381 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a></p>
5382
5383 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
5384 !! end
5385
5386 !! test
5387 IPv6 urls, autolink format (T23261)
5388 !! wikitext
5389 http://[2404:130:0:1000::187:2]/index.php
5390
5391 Examples from RFC 2373, section 2.2:
5392 * http://[1080::8:800:200C:417A]/unicast
5393 * http://[FF01::101]/multicast
5394 * http://[::1]/loopback
5395 * http://[::]/unspecified
5396 * http://[::13.1.68.3]/ipv4compat
5397 * http://[::FFFF:129.144.52.38]/ipv4compat
5398
5399 Examples from RFC 2732, section 2:
5400 * http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5401 * http://[1080:0:0:0:8:800:200C:417A]/index.html
5402 * http://[3ffe:2a00:100:7031::1]
5403 * http://[1080::8:800:200C:417A]/foo
5404 * http://[::192.9.5.5]/ipng
5405 * http://[::FFFF:129.144.52.38]:80/index.html
5406 * http://[2010:836B:4179::836B:4179]
5407
5408 !! html/php
5409 <p><a rel="nofollow" class="external free" href="http://[2404:130:0:1000::187:2]/index.php">http://[2404:130:0:1000::187:2]/index.php</a>
5410 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5411 </p>
5412 <ul><li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5413 <li> <a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5414 <li> <a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5415 <li> <a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5416 <li> <a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5417 <li> <a rel="nofollow" class="external free" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5418 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5419 </p>
5420 <ul><li> <a rel="nofollow" class="external free" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html</a></li>
5421 <li> <a rel="nofollow" class="external free" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">http://[1080:0:0:0:8:800:200C:417A]/index.html</a></li>
5422 <li> <a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5423 <li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5424 <li> <a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5425 <li> <a rel="nofollow" class="external free" href="http://[::FFFF:129.144.52.38]:80/index.html">http://[::FFFF:129.144.52.38]:80/index.html</a></li>
5426 <li> <a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5427
5428 !! html/parsoid
5429 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php">http://[2404:130:0:1000::187:2]/index.php</a></p>
5430
5431 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5432 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5433 <li> <a rel="mw:ExtLink" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5434 <li> <a rel="mw:ExtLink" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5435 <li> <a rel="mw:ExtLink" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5436 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5437 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5438
5439 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5440 <ul><li> <a rel="mw:ExtLink" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html</a></li>
5441 <li> <a rel="mw:ExtLink" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">http://[1080:0:0:0:8:800:200C:417A]/index.html</a></li>
5442 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5443 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5444 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5445 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]:80/index.html">http://[::FFFF:129.144.52.38]:80/index.html</a></li>
5446 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5447 !! end
5448
5449 !! test
5450 IPv6 urls, bracketed format (T23261)
5451 !! wikitext
5452 [http://[2404:130:0:1000::187:2]/index.php test]
5453
5454 Examples from RFC 2373, section 2.2:
5455 * [http://[1080::8:800:200C:417A] unicast]
5456 * [http://[FF01::101] multicast]
5457 * [http://[::1]/ loopback]
5458 * [http://[::] unspecified]
5459 * [http://[::13.1.68.3] ipv4compat]
5460 * [http://[::FFFF:129.144.52.38] ipv4compat]
5461
5462 Examples from RFC 2732, section 2:
5463 * [http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5464 * [http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5465 * [http://[3ffe:2a00:100:7031::1] 3]
5466 * [http://[1080::8:800:200C:417A]/foo 4]
5467 * [http://[::192.9.5.5]/ipng 5]
5468 * [http://[::FFFF:129.144.52.38]:80/index.html 6]
5469 * [http://[2010:836B:4179::836B:4179] 7]
5470
5471 !! html/php
5472 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5473 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5474 </p>
5475 <ul><li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5476 <li> <a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5477 <li> <a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5478 <li> <a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5479 <li> <a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5480 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5481 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5482 </p>
5483 <ul><li> <a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5484 <li> <a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5485 <li> <a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5486 <li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5487 <li> <a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5488 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5489 <li> <a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5490
5491 !! html/parsoid
5492 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php">test</a></p>
5493
5494 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5495 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5496 <li> <a rel="mw:ExtLink" href="http://[FF01::101]">multicast</a></li>
5497 <li> <a rel="mw:ExtLink" href="http://[::1]/">loopback</a></li>
5498 <li> <a rel="mw:ExtLink" href="http://[::]">unspecified</a></li>
5499 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]">ipv4compat</a></li>
5500 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5501
5502 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5503 <ul><li> <a rel="mw:ExtLink" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5504 <li> <a rel="mw:ExtLink" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5505 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5506 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5507 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">5</a></li>
5508 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5509 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5510 !! end
5511
5512 !! test
5513 Non-extlinks in brackets
5514 !! wikitext
5515 [foo]
5516 [foo bar]
5517 [foo ''bar'']
5518 [fool's] errand
5519 [fool's errand]
5520 [{{echo|foo}}]
5521 [{{echo|foo}} bar]
5522 [{{echo|foo}} ''bar'']
5523 [{{echo|foo}}l's] errand
5524 [{{echo|foo}}l's errand]
5525 [url={{echo|foo}}]
5526 [url=http://example.com]
5527 [http:// bare protocols don't count]
5528 !! html/php
5529 <p>[foo]
5530 [foo bar]
5531 [foo <i>bar</i>]
5532 [fool's] errand
5533 [fool's errand]
5534 [foo]
5535 [foo bar]
5536 [foo <i>bar</i>]
5537 [fool's] errand
5538 [fool's errand]
5539 [url=foo]
5540 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5541 [http:// bare protocols don't count]
5542 </p>
5543 !! html/parsoid
5544 <p>[foo]
5545 [foo bar]
5546 [foo <i>bar</i>]
5547 [fool's] errand
5548 [fool's errand]
5549 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span>]
5550 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> bar]
5551 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> <i>bar</i>]
5552 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span>] errand
5553 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span> errand]
5554 [<span typeof="mw:Placeholder" data-parsoid='{"src":"url={{echo|foo}}"}'>url=foo</span>]
5555 [url=<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>]
5556 [http:// bare protocols don't count]</p>
5557 !! end
5558
5559 !! test
5560 Percent encoding in external links
5561 !! wikitext
5562 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
5563 !! html/php
5564 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
5565 </p>
5566 !! html/parsoid
5567 <p><a rel="mw:ExtLink"
5568 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
5569 !! end
5570
5571 !! test
5572 Use url link syntax for links where the content is equal the link target
5573 !! wikitext
5574 http://example.com
5575 !! html/php
5576 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5577 </p>
5578 !! html/parsoid
5579 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5580 !! end
5581
5582 !! test
5583 Parenthesis in external links, especially URL links
5584 !! wikitext
5585 http://example.com)
5586
5587 http://example.com/test)
5588
5589 http://example.com/(test)
5590
5591 http://example.com/((test)
5592
5593 (http://example.com/(test))
5594
5595 (http://example.com/(test)))))
5596
5597 http://example.com/a)b
5598
5599 [http://example.com) foo]
5600 !! html/php
5601 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5602 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
5603 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
5604 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
5605 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
5606 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
5607 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
5608 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5609 </p>
5610 !! html/parsoid
5611 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
5612 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
5613 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
5614 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
5615 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
5616 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
5617 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
5618 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
5619 !! end
5620
5621 !! test
5622 Parenthesis in external links, w/ transclusion or comment
5623 !! wikitext
5624 (http://example.com/{{echo|hi}})
5625
5626 (http://example.com<!-- hi -->)
5627 !! html/php
5628 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5629 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5630 </p>
5631 !! html/parsoid
5632 <p>(<a typeof="mw:ExpandedAttrs" about="#mwt2" rel="mw:ExtLink" href="http://example.com/hi" data-parsoid='{"stx":"url","a":{"href":"http://example.com/hi"},"sa":{"href":"http://example.com/{{echo|hi}}"}}' data-mw='{"attribs":[[{"txt":"href"},{"html":"http://example.com/&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;}]],&amp;quot;dsr&amp;quot;:[20,31,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;hi&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">hi&lt;/span>"}]]}'>http://example.com/hi</a>)</p>
5633
5634 <p>(<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url","a":{"href":"http://example.com"},"sa":{"href":"http://example.com&lt;!-- hi -->"}}'>http://example.com</a>)</p>
5635 !! end
5636
5637 !! test
5638 Serialize <a> tags with invalid link targets as plain text
5639 !! options
5640 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
5641 !! html/parsoid
5642 <a rel="mw:WikiLink" href="[[foo]]">text</a>
5643 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
5644 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
5645 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
5646 !! wikitext
5647 text
5648 <nowiki>*</nowiki>text
5649 <nowiki>[[foo]]</nowiki>
5650 <nowiki>*a [[foo]]</nowiki>
5651 !! end
5652
5653 !! test
5654 mw:ExtLink -vs- mw:WikiLink (T94723)
5655 !! options
5656 parsoid=html2wt
5657 !! html/parsoid
5658 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"},"dsr":[0,11,6,2]}'>Bar</a>
5659 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
5660 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5661 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5662 <p>
5663 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5664 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5665 </p>
5666 !! wikitext
5667 [[Foo|Bar]]
5668 [[Foo|Bar]]
5669 [[wikipedia:Foo|Bar]]
5670 [[wikipedia:Foo|Bar]]
5671
5672 [[wikipedia:European_Robin|European Robin]]
5673 [[wikipedia:European_Robin|European Robin]]
5674 !! end
5675
5676 !! test
5677 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
5678 !! options
5679 parsoid=wt2wt
5680 !! wikitext
5681 [http://en.wikipedia.org/wiki/European_Robin European Robin]
5682 !! html/parsoid
5683 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
5684 !! end
5685
5686
5687 ###
5688 ### Quotes
5689 ###
5690
5691 !! test
5692 Quotes
5693 !! wikitext
5694 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5695
5696 Normal text. '''''Bold italic text.''''' Normal text.
5697 !! html
5698 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5699 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5700 </p>
5701 !! end
5702
5703
5704 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5705 # parser strips. The wikitext contains just the first half of the bold
5706 # quote pair.
5707 !! test
5708 Unclosed and unmatched quotes
5709 !! wikitext
5710 '''''Bold italic text '''with bold deactivated''' in between.'''''
5711
5712 '''''Bold italic text ''with italic deactivated'' in between.'''''
5713
5714 '''Bold text..
5715
5716 ..spanning two paragraphs (should not work).'''
5717
5718 '''Bold tag left open
5719
5720 ''Italic tag left open
5721
5722 Normal text.
5723
5724 <!-- Unmatching number of opening, closing tags: -->
5725 '''This year''''s election ''should'' beat '''last year''''s.
5726
5727 ''Tom'''s car is bigger than ''Susan'''s.
5728
5729 Plain ''italic'''s plain
5730 !! html/php
5731 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5732 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5733 </p><p><b>Bold text..</b>
5734 </p><p>..spanning two paragraphs (should not work).
5735 </p><p><b>Bold tag left open</b>
5736 </p><p><i>Italic tag left open</i>
5737 </p><p>Normal text.
5738 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5739 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5740 </p><p>Plain <i>italic'</i>s plain
5741 </p>
5742 !! html/parsoid
5743 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5744 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5745 </p><p><b>Bold text..</b>
5746 </p><p>..spanning two paragraphs (should not work).<b></b>
5747 </p><p><b>Bold tag left open</b>
5748 </p><p><i>Italic tag left open</i>
5749 </p><p>Normal text.
5750 </p>
5751 <!-- Unmatching number of opening, closing tags: -->
5752 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5753 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5754 </p><p>Plain <i>italic'</i>s plain
5755 </p>
5756 !! end
5757
5758 ###
5759 ### Tables
5760 ###
5761 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5762 ###
5763
5764 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5765 # is the bare minimum required by the spec, see:
5766 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5767 # Parsoid team replies: empty table tags are legal in HTML5
5768 !! test
5769 A table with no data.
5770 !! options
5771 parsoid=wt2html
5772 !! wikitext
5773 {||}
5774 !! html/php
5775
5776 !! html/parsoid
5777 <table></table>
5778
5779 !! end
5780
5781 !! test
5782 A table with stray table end tags on start tag line (wt2html)
5783 !! options
5784 parsoid=wt2html
5785 !! wikitext
5786 {|style="color: red;"|}
5787
5788 {|style="color: red;" |}
5789 |foo
5790 |}
5791
5792 {|style="color: red;"|} id="foo"
5793 |foo
5794 |}
5795
5796 {|style="color: red;" |} id="foo"
5797 |foo
5798 |}
5799 !! html
5800 <table style="color: red;"></table>
5801
5802 <table style="color: red;">
5803 <tbody><tr>
5804 <td>foo</td>
5805 </tr></tbody>
5806 </table>
5807
5808 <table style="color: red;" id="foo">
5809 <tbody><tr>
5810 <td>foo</td>
5811 </tr></tbody>
5812 </table>
5813
5814 <table style="color: red;" id="foo">
5815 <tbody><tr>
5816 <td>foo</td>
5817 </tr></tbody>
5818 </table>
5819
5820 !! end
5821
5822 !! test
5823 A table with no data (take 2)
5824 !! wikitext
5825 {|
5826 |}
5827 !! html/parsoid
5828 <table></table>
5829 !! end
5830
5831 # A table with nothing but a caption is invalid XHTML, we might want to render
5832 # this as <p>caption</p>
5833 # Parsoid team replies: table with only a caption is legal in HTML5
5834 !! test
5835 A table with nothing but a caption
5836 !! wikitext
5837 {|
5838 |+ caption
5839 |}
5840 !! html/php
5841 <table>
5842 <caption> caption
5843 </caption><tr><td></td></tr></table>
5844
5845 !! html/parsoid
5846 <table><caption> caption</caption></table>
5847 !! end
5848
5849 !! test
5850 A table with caption with default-spaced attributes and a table row
5851 !! wikitext
5852 {|
5853 |+ style="color: red;" | caption1
5854 |-
5855 | foo
5856 |}
5857 !! html
5858 <table>
5859 <caption style="color: red;"> caption1
5860 </caption>
5861 <tr>
5862 <td> foo
5863 </td></tr></table>
5864
5865 !! end
5866
5867 !! test
5868 A table with captions with non-default spaced attributes and a table row
5869 !! wikitext
5870 {|
5871 |+style="color: red;"|caption2
5872 |+ style="color: red;"| caption3
5873 |-
5874 | foo
5875 |}
5876 !! html
5877 <table>
5878 <caption style="color: red;">caption2
5879 </caption>
5880 <caption style="color: red;"> caption3
5881 </caption>
5882 <tr>
5883 <td> foo
5884 </td></tr></table>
5885
5886 !! end
5887
5888 !! test
5889 Table td-cell syntax variations
5890 !! wikitext
5891 {|
5892 | foo bar foo | baz
5893 | foo bar foo || baz
5894 | style='color:red;' | baz
5895 | style='color:red;' || baz
5896 |}
5897 !! html
5898 <table>
5899 <tr>
5900 <td> baz
5901 </td>
5902 <td> foo bar foo </td>
5903 <td> baz
5904 </td>
5905 <td style="color:red;"> baz
5906 </td>
5907 <td> style='color:red;' </td>
5908 <td> baz
5909 </td></tr></table>
5910
5911 !! end
5912
5913 !! test
5914 Simple table
5915 !! wikitext
5916 {|
5917 | 1 || 2
5918 |-
5919 | 3 || 4
5920 |}
5921 !! html
5922 <table>
5923 <tr>
5924 <td> 1 </td>
5925 <td> 2
5926 </td></tr>
5927 <tr>
5928 <td> 3 </td>
5929 <td> 4
5930 </td></tr></table>
5931
5932 !! end
5933
5934 !! test
5935 Simple table but with multiple dashes for row wikitext
5936 !! wikitext
5937 {|
5938 | foo
5939 |-----
5940 | bar
5941 |}
5942 !! html
5943 <table>
5944 <tr>
5945 <td> foo
5946 </td></tr>
5947 <tr>
5948 <td> bar
5949 </td></tr></table>
5950
5951 !! end
5952
5953 !! test
5954 Multiplication table
5955 !! wikitext
5956 {| border="1" cellpadding="2"
5957 |+Multiplication table
5958 |-
5959 ! &times; !! 1 !! 2 !! 3
5960 |-
5961 ! 1
5962 | 1 || 2 || 3
5963 |-
5964 ! 2
5965 | 2 || 4 || 6
5966 |-
5967 ! 3
5968 | 3 || 6 || 9
5969 |-
5970 ! 4
5971 | 4 || 8 || 12
5972 |-
5973 ! 5
5974 | 5 || 10 || 15
5975 |}
5976 !! html
5977 <table border="1" cellpadding="2">
5978 <caption>Multiplication table
5979 </caption>
5980 <tr>
5981 <th> &#215; </th>
5982 <th> 1 </th>
5983 <th> 2 </th>
5984 <th> 3
5985 </th></tr>
5986 <tr>
5987 <th> 1
5988 </th>
5989 <td> 1 </td>
5990 <td> 2 </td>
5991 <td> 3
5992 </td></tr>
5993 <tr>
5994 <th> 2
5995 </th>
5996 <td> 2 </td>
5997 <td> 4 </td>
5998 <td> 6
5999 </td></tr>
6000 <tr>
6001 <th> 3
6002 </th>
6003 <td> 3 </td>
6004 <td> 6 </td>
6005 <td> 9
6006 </td></tr>
6007 <tr>
6008 <th> 4
6009 </th>
6010 <td> 4 </td>
6011 <td> 8 </td>
6012 <td> 12
6013 </td></tr>
6014 <tr>
6015 <th> 5
6016 </th>
6017 <td> 5 </td>
6018 <td> 10 </td>
6019 <td> 15
6020 </td></tr></table>
6021
6022 !! end
6023
6024 !! test
6025 Accept "||" in table headings
6026 !! wikitext
6027 {|
6028 !h1 || h2
6029 |}
6030 !! html
6031 <table>
6032 <tr>
6033 <th>h1 </th>
6034 <th> h2
6035 </th></tr></table>
6036
6037 !! end
6038
6039 !! test
6040 Accept "!!" in table data
6041 !! wikitext
6042 {|
6043 | Foo!! ||
6044 |}
6045 !! html
6046 <table>
6047 <tr>
6048 <td> Foo!! </td>
6049 <td>
6050 </td></tr></table>
6051
6052 !! html/parsoid
6053 <table>
6054 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'> Foo!! </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'></td></tr>
6055 </tbody></table>
6056 !! end
6057
6058 !! test
6059 Accept "||" in indented table headings
6060 !! wikitext
6061 :{|
6062 !h1 || h2
6063 |}
6064 !! html
6065 <dl><dd><table>
6066 <tr>
6067 <th>h1 </th>
6068 <th> h2
6069 </th></tr></table></dd></dl>
6070
6071 !! end
6072
6073 !! test
6074 Accept "!!" in templates
6075 !! wikitext
6076 {|
6077 !a {{echo|b!!c}}
6078 |}
6079 !! html/php
6080 <table>
6081 <tr>
6082 <th>a b</th>
6083 <th>c
6084 </th></tr></table>
6085
6086 !! html/parsoid
6087 <table>
6088 <tbody><tr><th typeof="mw:Transclusion" about="#mwt1" data-parsoid='{"autoInsertedEnd":true,"pi":[[{"k":"1"}]]}' data-mw='{"parts":["!a ",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b!!c"}},"i":0}}]}'>a b</th><th about="#mwt1">c</th></tr>
6089 !! end
6090
6091 !! test
6092 Accept "!!" in table headings after newline
6093 !! wikitext
6094 {|
6095 !a
6096 b!!c
6097 |}
6098 !! html/php
6099 <table>
6100 <tr>
6101 <th>a
6102 <p>b!!c
6103 </p>
6104 </th></tr></table>
6105
6106 !! html/parsoid
6107 <table>
6108 <tbody><tr><th>a
6109 <p>b!!c</p></th></tr>
6110 </tbody></table>
6111 !! end
6112
6113 !! test
6114 Accept "!!" in table data of mixed wikitext / html syntax
6115 !! wikitext
6116 {|
6117 !a
6118 <tr><td>b!!c</td></tr>
6119 |}
6120 !! html+tidy
6121 <table>
6122 <tr>
6123 <th>a</th>
6124 </tr>
6125 <tr>
6126 <td>b!!c</td>
6127 </tr>
6128 </table>
6129 !! html/parsoid
6130 <table>
6131 <tbody><tr><th>a</th></tr>
6132 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6133 </tbody></table>
6134 !! end
6135
6136 !! test
6137 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6138 !! wikitext
6139 {|
6140 !| h1
6141 || a
6142 |}
6143 !! html
6144 <table>
6145 <tr>
6146 <th> h1
6147 </th>
6148 <td> a
6149 </td></tr></table>
6150
6151 !! end
6152
6153 !!test
6154 Accept "| !" at start of line in tables (ignore !-attribute)
6155 !! wikitext
6156 {|
6157 |-
6158 | !style="color:red" | bar
6159 |}
6160 !! html
6161 <table>
6162
6163 <tr>
6164 <td> bar
6165 </td></tr></table>
6166
6167 !!end
6168
6169 !!test
6170 Allow +/- in 2nd and later cells in a row, in 1st cell when td-attrs are present, or in 1st cell when there is a space between "|" and +/-
6171 !! wikitext
6172 {|
6173 |-
6174 |style='color:red;'|+1
6175 |style='color:blue;'|-1
6176 |-
6177 | 1 || 2 || 3
6178 | 1 ||+2 ||-3
6179 |-
6180 | +1
6181 | -1
6182 |}
6183 !! html
6184 <table>
6185
6186 <tr>
6187 <td style="color:red;">+1
6188 </td>
6189 <td style="color:blue;">-1
6190 </td></tr>
6191 <tr>
6192 <td> 1 </td>
6193 <td> 2 </td>
6194 <td> 3
6195 </td>
6196 <td> 1 </td>
6197 <td>+2 </td>
6198 <td>-3
6199 </td></tr>
6200 <tr>
6201 <td> +1
6202 </td>
6203 <td> -1
6204 </td></tr></table>
6205
6206 !!end
6207
6208 !! test
6209 Table rowspan
6210 !! wikitext
6211 {| border=1
6212 | Cell 1, row 1
6213 |rowspan=2| Cell 2, row 1 (and 2)
6214 | Cell 3, row 1
6215 |-
6216 | Cell 1, row 2
6217 | Cell 3, row 2
6218 |}
6219 !! html
6220 <table border="1">
6221 <tr>
6222 <td> Cell 1, row 1
6223 </td>
6224 <td rowspan="2"> Cell 2, row 1 (and 2)
6225 </td>
6226 <td> Cell 3, row 1
6227 </td></tr>
6228 <tr>
6229 <td> Cell 1, row 2
6230 </td>
6231 <td> Cell 3, row 2
6232 </td></tr></table>
6233
6234 !! end
6235
6236 !! test
6237 Nested table
6238 !! wikitext
6239 {| border=1
6240 | &alpha;
6241 |
6242 {| bgcolor=#ABCDEF border=2
6243 |nested
6244 |-
6245 |table
6246 |}
6247 |the original table again
6248 |}
6249 !! html
6250 <table border="1">
6251 <tr>
6252 <td> &#945;
6253 </td>
6254 <td>
6255 <table bgcolor="#ABCDEF" border="2">
6256 <tr>
6257 <td>nested
6258 </td></tr>
6259 <tr>
6260 <td>table
6261 </td></tr></table>
6262 </td>
6263 <td>the original table again
6264 </td></tr></table>
6265
6266 !! end
6267
6268 !! test
6269 Invalid attributes in table cell (bug 1830)
6270 !! wikitext
6271 {|
6272 |Cell:|broken
6273 |}
6274 !! html
6275 <table>
6276 <tr>
6277 <td>broken
6278 </td></tr></table>
6279
6280 !! end
6281
6282 !! test
6283 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6284 !! wikitext
6285 {|
6286 | title="foo" |bar
6287 | title="foo<nowiki>|</nowiki>" |bar
6288 | title="foo<nowiki>|</nowiki>" bar
6289 |}
6290 !! html/php
6291 <table>
6292 <tr>
6293 <td title="foo">bar
6294 </td>
6295 <td title="foo&#124;">bar
6296 </td>
6297 <td> title="foo|" bar
6298 </td></tr></table>
6299
6300 !! html/parsoid
6301 <table>
6302 <tbody><tr><td title="foo">bar</td>
6303 <td title="foo|" data-parsoid='{"a":{"title":"foo|"},"sa":{"title":"foo&lt;nowiki>|&lt;/nowiki>"},"autoInsertedEnd":true}'>bar</td>
6304 <td> title="foo<span typeof="mw:Nowiki">|</span>" bar</td></tr>
6305 </tbody></table>
6306 !! end
6307
6308 # See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
6309 # N.B. The "|}" to close the table is missing from the input, so parsoid's
6310 # *2wt modes will fail.
6311 !! test
6312 Table security: embedded pipes
6313 !! options
6314 parsoid=wt2html,html2html
6315 !! wikitext
6316 {|
6317 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6318 !! html/php
6319 <table>
6320 <tr>
6321 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6322 <td>]" onmouseover="alert(document.cookie)"&gt;test
6323 </td>
6324 </tr>
6325 </table>
6326
6327 !! html/parsoid
6328 <table><tbody>
6329 <tr>
6330 <td data-parsoid='{"startTagSrc":"| ","attrSepSrc":"|","autoInsertedEnd":true}'><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
6331 !! end
6332
6333 !! test
6334 ! and || in element attributes should not be parsed as <th>/<td>
6335 !! wikitext
6336 {|
6337 | <div style="color: red !important;" data-contrived="put this here ||">hi</div>
6338 |}
6339 !! html/php
6340 <table>
6341 <tr>
6342 <td> <div style="color: red !important;" data-contrived="put this here &#124;&#124;">hi</div>
6343 </td></tr></table>
6344
6345 !! html/parsoid
6346 <table>
6347 <tbody><tr><td> <div style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"stx":"html"}'>hi</div></td></tr>
6348 </tbody></table>
6349 !! end
6350
6351 # FIXME: The output seems broken. Filed as T110268.
6352 !! test
6353 ! and || in td attributes should not be parsed as <th>/<td>
6354 !! options
6355 parsoid=wt2html
6356 !! wikitext
6357 {|
6358 | style="color: red !important;" data-contrived="put this here ||" | foo
6359 |}
6360 !! html/php
6361 <table>
6362 <tr>
6363 <td> style="color: red !important;" data-contrived="put this here </td>
6364 <td> foo
6365 </td></tr></table>
6366
6367 !! html/parsoid
6368 <table>
6369 <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>
6370 </tbody></table>
6371 !! end
6372
6373 !! test
6374 Break on | in element attribute in template
6375 !! options
6376 parsoid=wt2html,html2html
6377 !! wikitext
6378 {{echo|1=<div class="hi|ho">ha</div>}}
6379 !! html/php
6380 <p>ho"&gt;ha&lt;/div&gt;
6381 </p>
6382 !! html/parsoid
6383 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"ho\">ha&lt;/div>"}},"i":0}}]}'>ho">ha</span>
6384 !! end
6385
6386 !! test
6387 Indented table markup mixed with indented pre content (proposed in bug 6200)
6388 !! wikitext
6389 <table>
6390 <tr>
6391 <td>
6392 Text that should be rendered preformatted
6393 </td>
6394 </tr>
6395 </table>
6396 !! html
6397 <table>
6398 <tr>
6399 <td>
6400 <pre>Text that should be rendered preformatted
6401 </pre>
6402 </td>
6403 </tr>
6404 </table>
6405
6406 !! end
6407
6408 !! test
6409 1. Template-generated table cell attributes and cell content
6410 !! wikitext
6411 {|
6412 |{{table_attribs}}
6413 | {{table_attribs}}
6414 || {{table_attribs_5}}
6415 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6416 |align=center {{table_attribs}}
6417 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6418 |}
6419 !! html
6420 <table>
6421 <tr>
6422 <td style="color:red;">Foo
6423 </td>
6424 <td style="color:red;">Foo
6425 </td>
6426 <td> style="color:red;"</td>
6427 <td>Bar
6428 </td>
6429 <td style="color:red;">Foo
6430 </td>
6431 <td align="center" style="color:red;">Foo
6432 </td>
6433 <td align="center" style="color:red;">Foo
6434 </td></tr></table>
6435
6436 !! end
6437
6438 !! test
6439 2. Template-generated table cell attributes and cell content
6440 !! wikitext
6441 {|
6442 |{{table_attribs_2}}
6443 |}
6444 !! html/php
6445 <table>
6446 <tr>
6447 <td style="color:red;">Foo
6448 </td>
6449 <td>Bar</td>
6450 <td>Baz
6451 </td></tr></table>
6452
6453 !! html/parsoid
6454 <table>
6455 <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>
6456 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6457 </tbody></table>
6458 !! end
6459
6460 !! test
6461 3. Template-generated table cell attributes and cell content
6462 !! wikitext
6463 {|
6464 !align=center {{table_header_cells}}
6465 |-
6466 |align=center {{table_cells}}
6467 |}
6468 !! html/php
6469 <table>
6470 <tr>
6471 <th align="center" style="color:red;">Foo</th>
6472 <th style="color:red;"><i>Bar</i></th>
6473 <th style="color:brown;"><i>Foo</i> and Baz
6474 </th></tr>
6475 <tr>
6476 <td align="center" style="color:red;">Foo</td>
6477 <td style="color:red;"><i>Bar</i></td>
6478 <td style="color:brown;"><i>Foo</i> and Baz
6479 </td></tr></table>
6480
6481 !! html/parsoid
6482 <table>
6483 <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>
6484 <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>
6485 </tbody></table>
6486 !! end
6487
6488 !! test
6489 4. Template-generated table cell attributes and cell content inside a templated table
6490 !! wikitext
6491 {{tbl-start}}
6492 !align=center {{table_header_cells}}
6493 |-
6494 |align=center {{table_cells}}
6495 {{tbl-end}}
6496 !! html/php
6497 <table>
6498 <tr>
6499 <th align="center" style="color:red;">Foo</th>
6500 <th style="color:red;"><i>Bar</i></th>
6501 <th style="color:brown;"><i>Foo</i> and Baz
6502 </th></tr>
6503 <tr>
6504 <td align="center" style="color:red;">Foo</td>
6505 <td style="color:red;"><i>Bar</i></td>
6506 <td style="color:brown;"><i>Foo</i> and Baz
6507 </td></tr></table>
6508
6509 !! html/parsoid
6510 <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}}]}'>
6511 <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>
6512 <tr>
6513 <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>
6514 </tbody></table>
6515 !! end
6516
6517 ## Edge case fix to prevent future regressions
6518 !! test
6519 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
6520 !! wikitext
6521 {|
6522 |{{table_attribs_7}}
6523 |}
6524 <references />
6525 !! html/parsoid
6526 <table>
6527 <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>
6528 </tbody></table>
6529 <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>
6530 !! end
6531
6532 !! test
6533 Table with row followed by newlines and table heading
6534 !! wikitext
6535 {|
6536 |-
6537
6538 ! foo
6539 |}
6540 !! html
6541 <table>
6542
6543
6544 <tr>
6545 <th> foo
6546 </th></tr></table>
6547
6548 !! end
6549
6550 !! test
6551 Table with empty line following the start tag
6552 !! wikitext
6553 {|
6554
6555 |-
6556 | foo
6557 |}
6558 !! html
6559 <table>
6560
6561
6562 <tr>
6563 <td> foo
6564 </td></tr></table>
6565
6566 !! end
6567
6568 !! test
6569 Table attributes with empty value
6570 !! wikitext
6571 {|
6572 | style=| hello
6573 |}
6574 !! html/php
6575 <table>
6576 <tr>
6577 <td style=""> hello
6578 </td></tr></table>
6579
6580 !! html/parsoid
6581 <table>
6582 <tbody>
6583 <tr>
6584 <td style=""> hello
6585 </td></tr></tbody></table>
6586
6587 !! end
6588
6589 !! test
6590 Wikitext table with a lot of comments
6591 !! wikitext
6592 {|
6593 <!-- c0 -->
6594 | foo
6595 <!-- c1 -->
6596 |-<!-- c2 -->
6597 <!-- c3 -->
6598 |<!-- c4 -->
6599 <!-- c5 -->
6600 |}
6601 !! html
6602 <table>
6603 <tr>
6604 <td> foo
6605 </td></tr>
6606 <tr>
6607 <td>
6608 </td></tr></table>
6609
6610 !! end
6611
6612 !! test
6613 Wikitext table comments represented in parsoid dom
6614 !! wikitext
6615 {|<!--c1--><!--c2-->
6616 |-<!--c3-->
6617 | x
6618 |}
6619 !! html/php+tidy
6620 <table>
6621 <tr>
6622 <td>x</td>
6623 </tr>
6624 </table>
6625 !! html/parsoid
6626 <table><!--c1--><!--c2-->
6627 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
6628 <td data-parsoid='{"autoInsertedEnd":true}'> x</td></tr>
6629 </tbody></table>
6630 !! end
6631
6632 !! test
6633 Wikitext table with double-line table cell
6634 !! wikitext
6635 {|
6636 |a
6637 b
6638 |}
6639 !! html
6640 <table>
6641 <tr>
6642 <td>a
6643 <p>b
6644 </p>
6645 </td></tr></table>
6646
6647 !! end
6648
6649 !! test
6650 Table cell with a single comment
6651 !! wikitext
6652 {|
6653 | <!-- c1 -->
6654 | a
6655 |}
6656 !! html
6657 <table>
6658 <tr>
6659 <td>
6660 </td>
6661 <td> a
6662 </td></tr></table>
6663
6664 !! end
6665
6666 !! test
6667 Table-cell after a comment-only-empty-line
6668 !! wikitext
6669 {|
6670 |a
6671 <!--c1-->
6672 <!--c2-->| b
6673 |}
6674 !! html
6675 <table>
6676 <tr>
6677 <td>a
6678 </td>
6679 <td> b
6680 </td></tr></table>
6681
6682 !! html/parsoid
6683 <table>
6684 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
6685 <!--c1-->
6686 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
6687 </tbody></table>
6688
6689 !! end
6690
6691 !! test
6692 Build table with {{!}}
6693 !! wikitext
6694 {{{!}} class="wikitable"
6695 ! header
6696 ! second header
6697 {{!}}- style="color:red;"
6698 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
6699 {{!}}}
6700 !! html
6701 <table class="wikitable">
6702 <tr>
6703 <th> header
6704 </th>
6705 <th> second header
6706 </th></tr>
6707 <tr style="color:red;">
6708 <td> data </td>
6709 <td style="color:red;"> second data
6710 </td></tr></table>
6711
6712 !! end
6713
6714 !! test
6715 Build table with pipe as data
6716 !! wikitext
6717 {| class="wikitable"
6718 ! header
6719 ! second header
6720 |- style="color:red;"
6721 | data || style="color:red;" | second data
6722 |-
6723 | style="color:red;" | data with | || style="color:red;" | second data with |
6724 |-
6725 || data with | ||| second data with |
6726 |}
6727 !! html
6728 <table class="wikitable">
6729 <tr>
6730 <th> header
6731 </th>
6732 <th> second header
6733 </th></tr>
6734 <tr style="color:red;">
6735 <td> data </td>
6736 <td style="color:red;"> second data
6737 </td></tr>
6738 <tr>
6739 <td style="color:red;"> data with | </td>
6740 <td style="color:red;"> second data with |
6741 </td></tr>
6742 <tr>
6743 <td> data with | </td>
6744 <td> second data with |
6745 </td></tr></table>
6746
6747 !! end
6748
6749 !! test
6750 Build table with wikilink
6751 !! wikitext
6752 {| class="wikitable"
6753 ! header || second header
6754 |- style="color:red;"
6755 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
6756 |-
6757 | data || second data [[Main Page|link|text with pipe]]
6758 |}
6759 !! html
6760 <table class="wikitable">
6761 <tr>
6762 <th> header </th>
6763 <th> second header
6764 </th></tr>
6765 <tr style="color:red;">
6766 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
6767 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
6768 </td></tr>
6769 <tr>
6770 <td> data </td>
6771 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
6772 </td></tr></table>
6773
6774 !! end
6775
6776 # The expected HTML structure in this test is debatable. The PHP parser does
6777 # not parse this kind of table at all. The main focus for Parsoid is on
6778 # round-tripping, so this output is ok for now. TODO: revisit!
6779 !! test
6780 Wikitext table with html-syntax row
6781 !! wikitext
6782 {|
6783 |-
6784 <td>foo</td>
6785 |}
6786 !! html/parsoid
6787 <table>
6788 <tbody>
6789 <tr>
6790 <td>foo</td></tr></tbody></table>
6791 !! end
6792
6793 ## Note that Parsoid output differs from PHP and PHP+tidy here.
6794 ## The lack of <tr> tags in the PHP output is arguably a bug in the
6795 ## PHP parser, which tidy then compounds by fostering the content
6796 ## entirely out of the table. Parsoid recognizes the table context
6797 ## and generates <tr> and <td> wrappers as needed. Hopefully nobody
6798 ## depends on PHP's treatment of broken table markup!
6799 !! test
6800 Implicit <td> after a |-
6801 !! options
6802 parsoid=wt2html,html2html
6803 !! wikitext
6804 {|
6805 |-
6806 a
6807 |}
6808 !! html/php
6809 <table>
6810
6811 a
6812 </table>
6813
6814 !! html/php+tidy
6815 <p>a</p>
6816 !! html/parsoid
6817 <table>
6818 <tr><td>a</td></tr>
6819 </table>
6820 !! end
6821
6822 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
6823 !! test
6824 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
6825 !! options
6826 parsoid=wt2html,html2html
6827 !! wikitext
6828 {|
6829 |-
6830 |
6831 a
6832 |-
6833 b
6834 |}
6835 !! html/php
6836 <table>
6837
6838 <tr>
6839 <td>
6840 <pre>a
6841 </pre>
6842 </td></tr>
6843 b
6844 </table>
6845
6846 !! html/php+tidy
6847 <p>b</p>
6848 <table>
6849 <tr>
6850 <td>
6851 <pre>
6852 a
6853 </pre></td>
6854 </tr>
6855 </table>
6856 !! html/parsoid
6857 <table>
6858 <tbody>
6859 <tr><td><pre>a</pre></td></tr>
6860 <tr><td> b</td></tr>
6861 </tbody>
6862 </table>
6863 !! end
6864
6865 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
6866 # Parsoid generates the missing <td>, so wt2wt won't succeed.
6867 !! test
6868 Lists should be recognized in an implicit <td> context
6869 !! options
6870 parsoid=wt2html,html2html
6871 !! wikitext
6872 {|
6873 |-
6874 *a
6875 |}
6876 !! html/php
6877 <table>
6878
6879 <ul><li>a</li></ul>
6880 </table>
6881
6882 !! html/php+tidy
6883 <ul>
6884 <li>a</li>
6885 </ul>
6886 !! html/parsoid
6887 <table>
6888 <tr>
6889 <td><ul>
6890 <li>a</li>
6891 </ul></td>
6892 </tr>
6893 </table>
6894 !! end
6895
6896 !! test
6897 Table cells not properly parsed in an implicit-td context
6898 !! wikitext
6899 {|
6900 |-
6901 {{table_attribs_4}} || a || b
6902 |}
6903 !! html/php+tidy
6904 <table>
6905 <tr>
6906 <td style="background-color:#DC241f;" width="10px"></td>
6907 <td>a</td>
6908 <td>b</td>
6909 </tr>
6910 </table>
6911 !! html/parsoid
6912 <table>
6913 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
6914 <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>
6915 </tbody></table>
6916 !! end
6917
6918 !! test
6919 Parsoid: Round-trip tables directly followed by content (bug 51219)
6920 !! options
6921 parsoid=wt2html,wt2wt
6922 !! wikitext
6923 {|
6924 |foo
6925 |} bar
6926
6927 {|
6928 |baz
6929 |}<b>quux</b>
6930 !! html+tidy
6931 <table>
6932 <tr>
6933 <td>foo</td>
6934 </tr>
6935 </table>
6936 <p>bar</p>
6937 <table>
6938 <tr>
6939 <td>baz</td>
6940 </tr>
6941 </table>
6942 <p><b>quux</b></p>
6943 !! end
6944
6945 !! test
6946 Parsoid: Default to a newline after tables in new content (bug 51219)
6947 !! options
6948 parsoid=html2wt
6949 !! html/parsoid
6950 <table><tbody>
6951 <tr><td>foo</td></tr></tbody></table> bar
6952 <table><tbody>
6953 <tr><td>baz</td></tr></tbody></table><b>quux</b>
6954 !! wikitext
6955 {|
6956 |foo
6957 |}
6958 <nowiki> </nowiki>bar
6959 {|
6960 |baz
6961 |}
6962 '''quux'''
6963 !! end
6964
6965 !! test
6966 Parsoid: newline inducing block nodes don't suppress <nowiki>
6967 !! options
6968 parsoid=html2wt
6969 !! html/parsoid
6970 a<h1>foo</h1>
6971 !! wikitext
6972 <nowiki> </nowiki>a
6973
6974 = foo =
6975 !! end
6976
6977 !! test
6978 Parsoid: Row-syntax table headings followed by comment & table cells
6979 !! options
6980 parsoid=wt2html,wt2wt
6981 !! wikitext
6982 {|
6983 ! foo || bar
6984 <!-- foo --> || baz || quux
6985 |}
6986 !! html/php
6987 <table>
6988 <tr>
6989 <th> foo </th>
6990 <th> bar
6991 </th>
6992 <td> baz </td>
6993 <td> quux
6994 </td></tr></table>
6995
6996 !! html/parsoid
6997 <table>
6998 <tbody><tr><th> foo </th><th> bar
6999 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
7000 </tbody></table>
7001 !! end
7002
7003 !!test
7004 Parsoid: Recover better from broken table attributes
7005 !!options
7006 parsoid=wt2html
7007 !!wikitext
7008 {| class="foo
7009 | class="bar" |
7010 foo
7011 |}
7012 !!html/php+tidy
7013 <table class="foo">
7014 <tr>
7015 <td class="bar">
7016 <p>foo</p>
7017 </td>
7018 </tr>
7019 </table>
7020 !!html/parsoid
7021 <table class="foo">
7022 <tr>
7023 <td class="bar">
7024 <p>foo</p></td></tr>
7025 </tbody></table>
7026 !!end
7027
7028 !! test
7029 Tables: Digest broken attributes on table and tr tag
7030 !! options
7031 parsoid=wt2html
7032 !! wikitext
7033 {| || |} ++
7034 |- || || ++ --
7035 |- > [
7036 |}
7037 !! html
7038 <table>
7039 <tbody>
7040 <tr></tr>
7041 <tr></tr>
7042 </tbody></table>
7043 !! end
7044
7045 !! test
7046 Strip unsupported table tags
7047 !! options
7048 parsoid=html2wt
7049 !! html/parsoid
7050 <table>
7051 <thead>
7052 <tr>
7053 <th>Month</th>
7054 <th>Savings</th>
7055 </tr>
7056 </thead>
7057 <tbody>
7058 <tr>
7059 <td>January</td>
7060 <td>$100</td>
7061 </tr>
7062 <tr>
7063 <td>February</td>
7064 <td>$80</td>
7065 </tr>
7066 </tbody>
7067 <tfoot>
7068 <tr>
7069 <td>Sum</td>
7070 <td>$180</td>
7071 </tr>
7072 </tfoot>
7073 </table>
7074 !! wikitext
7075 {|
7076
7077 !Month
7078 !Savings
7079
7080 |January
7081 |$100
7082
7083 |-
7084 |February
7085 |$80
7086
7087 |Sum
7088 |$180
7089
7090 |}
7091 !! end
7092
7093 !!test
7094 Testing serialization after deletion of table cells
7095 !!options
7096 parsoid={
7097 "modes": ["wt2wt", "selser"],
7098 "changes": [
7099 ["#x", "remove"]
7100 ]
7101 }
7102 !!wikitext
7103 {|
7104 !h1 !!h2 !!h3
7105 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
7106 |}
7107 !! wikitext/edited
7108 {|
7109 !h1 !!h2 !!h3
7110 |c2 |||c3
7111 |}
7112 !!end
7113
7114 ###
7115 ### Internal links
7116 ###
7117 !! test
7118 Plain link, capitalized
7119 !! wikitext
7120 [[Main Page]]
7121 !! html
7122 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7123 </p>
7124 !! end
7125
7126 !! test
7127 Plain link, uncapitalized
7128 !! wikitext
7129 [[main Page]]
7130 !! html
7131 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
7132 </p>
7133 !! end
7134
7135 !! test
7136 Piped link
7137 !! wikitext
7138 [[Main Page|The Main Page]]
7139 !! html
7140 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7141 </p>
7142 !! end
7143
7144 !! test
7145 Piped link with comment in link text
7146 !! wikitext
7147 [[Main Page|The Main<!--front--> Page]]
7148 !! html
7149 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7150 </p>
7151 !! end
7152
7153 !! test
7154 Piped link with multiple pipe characters in link text
7155 !! wikitext
7156 [[Main Page||The|Main|Page|]]
7157 !! html/php
7158 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7159 </p>
7160 !! html/parsoid
7161 <p><a rel="mw:WikiLink" href="Main_Page" title="Main Page">|The|Main|Page|</a></p>
7162 !! end
7163
7164 !! test
7165 Piped link with no link text
7166 !! wikitext
7167 [[Thomas Bek (bishop of St David's)|]]
7168 !! html/php
7169 <p>[[Thomas Bek (bishop of St David's)|]]
7170 </p>
7171 !! html/parsoid
7172 <p>[[Thomas Bek (bishop of St David's)|]]</p>
7173 !! end
7174
7175 !! test
7176 Broken link
7177 !! wikitext
7178 [[Zigzagzogzagzig]]
7179 !! html
7180 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7181 </p>
7182 !! end
7183
7184 !! test
7185 Broken link with fragment
7186 !! wikitext
7187 [[Zigzagzogzagzig#zug]]
7188 !! html
7189 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7190 </p>
7191 !! end
7192
7193 !! test
7194 Special page link with fragment
7195 !! wikitext
7196 [[Special:Version#anchor]]
7197 !! html
7198 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7199 </p>
7200 !! end
7201
7202 !! test
7203 Nonexistent special page link with fragment
7204 !! wikitext
7205 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7206 !! html
7207 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7208 </p>
7209 !! end
7210
7211 !! test
7212 Link with prefix
7213 !! wikitext
7214 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7215 !! html
7216 <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>
7217 </p>
7218 !! end
7219
7220 !! test
7221 Link with suffix
7222 !! wikitext
7223 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7224 !! html
7225 <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>!!!
7226 </p>
7227 !! end
7228
7229 !! article
7230 prefixed article
7231 !! text
7232 Some text
7233 !! endarticle
7234
7235 !! test
7236 Bug 43661: Piped links with identical prefixes
7237 !! wikitext
7238 [[prefixed article|prefixed articles with spaces]]
7239
7240 [[prefixed article|prefixed articlesaoeu]]
7241
7242 [[Main Page|Main Page test]]
7243 !! html
7244 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7245 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7246 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7247 </p>
7248 !! end
7249
7250
7251 !! test
7252 Link with HTML entity in suffix / tail
7253 !! wikitext
7254 [[Main Page]]&quot;, [[Main Page]]&#97;
7255 !! html/php
7256 <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;
7257 </p>
7258 !! html/parsoid
7259 <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>
7260 !! end
7261
7262 !! test
7263 Link with 3 brackets
7264 !! wikitext
7265 [[[Main Page]]]
7266 Foo [[[Main Page]]]
7267 !! html
7268 <p>[[[Main Page]]]
7269 Foo [[[Main Page]]]
7270 </p>
7271 !! end
7272
7273 !! test
7274 Link with 4 brackets
7275 !! wikitext
7276 [[[[Main Page]]]]
7277 !! html
7278 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7279 </p>
7280 !! end
7281
7282 !! test
7283 Piped link with 3 brackets
7284 !! wikitext
7285 [[[main page|the main page]]]
7286 !! html
7287 <p>[[[main page|the main page]]]
7288 </p>
7289 !! end
7290
7291 !! test
7292 Piped link with extlink-like text
7293 !! wikitext
7294 [[Main Page|[bar]]]
7295 [[Main Page|This is a [bar]]]
7296 !! html/php
7297 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7298 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7299 </p>
7300 !! html/parsoid
7301 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7302 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a></p>
7303 !! end
7304
7305 !! test
7306 Link with multiple pipes
7307 !! wikitext
7308 [[Main Page|The|Main|Page]]
7309 !! html
7310 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7311 </p>
7312 !! end
7313
7314 # Note that parsoid does not munge anchor text; all non-space
7315 # characters are valid in HTML5 ids.
7316 !! test
7317 Anchor containing a #. (bug 63430)
7318 !! wikitext
7319 [[Main Page#And#Link]]
7320 !! html/php
7321 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
7322 </p>
7323 !! html/parsoid
7324 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link" title="Main Page">Main Page#And#Link</a></p>
7325 !! end
7326
7327 !! test
7328 Link to namespaces
7329 !! wikitext
7330 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7331 !! html
7332 <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>
7333 </p>
7334 !! end
7335
7336 !! test
7337 Link with space in namespace
7338 !! wikitext
7339 [[User talk:Foo bar]]
7340 !! html
7341 <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>
7342 </p>
7343 !! end
7344
7345 !! article
7346 MemoryAlpha:AlphaTest
7347 !! text
7348 This is an article in the MemoryAlpha namespace
7349 (which shadows the memoryalpha interwiki link).
7350 !! endarticle
7351
7352 !! test
7353 Namespace takes precedence over interwiki link (bug 51680)
7354 !! wikitext
7355 [[MemoryAlpha:AlphaTest]]
7356 !! html
7357 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7358 </p>
7359 !! end
7360
7361 # The previous test doesn't work correctly in html2*, due to not recognizing the
7362 # link as an internal one. This one checks for the correct behavior.
7363 !! test
7364 Link to namespace preferred over interwiki with correct rel attribute
7365 !! options
7366 parsoid=html2wt,html2html
7367 !! html/parsoid
7368 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7369 !! wikitext
7370 [[MemoryAlpha:AlphaTest]]
7371 !! end
7372
7373 !! test
7374 Piped link to namespace
7375 !! wikitext
7376 [[Meta:Disclaimers|The disclaimers]]
7377 !! html
7378 <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>
7379 </p>
7380 !! end
7381
7382 !! test
7383 Link containing }
7384 !! wikitext
7385 [[Usually caused by a typo (oops}]]
7386 !! html
7387 <p>[[Usually caused by a typo (oops}]]
7388 </p>
7389 !! end
7390
7391 !! article
7392 7% Solution
7393 !! text
7394 Just a test of an article title containing a percent.
7395 !! endarticle
7396
7397 !! test
7398 Link containing % (not as a hex sequence)
7399 !! wikitext
7400 [[7% Solution]]
7401 !! html/php
7402 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7403 </p>
7404 !! html/parsoid
7405 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
7406 !! end
7407
7408 # note that the parsoid HTML is identical to the previous test output,
7409 # so the previous test ensures that the html2wt mode will generate the
7410 # "not as a hex sequence" wikitext.
7411 !! test
7412 Link containing % as a single hex sequence interpreted to char
7413 !! options
7414 parsoid=wt2wt,wt2html,html2html
7415 !! wikitext
7416 [[7%25 Solution]]
7417 !! html/php
7418 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7419 </p>
7420 !! html/parsoid
7421 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
7422 !!end
7423
7424 !! test
7425 Link containing % as a double hex sequence interpreted to hex sequence
7426 !! wikitext
7427 [[7%2525 Solution]]
7428 !! html
7429 <p>[[7%2525 Solution]]
7430 </p>
7431 !!end
7432
7433 # note that parsoid does not munge anchor text; all non-space
7434 # characters are valid in HTML5 anchors.
7435 !! test
7436 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7437 Example for such a section: == < ==
7438 !! wikitext
7439 [[%23%3c]][[%23%3e]]
7440 !! html/php
7441 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7442 </p>
7443 !! html/parsoid
7444 <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>
7445 !! end
7446
7447 !! test
7448 Link containing "<#" and ">#" as a hex sequences
7449 !! wikitext
7450 [[%3c%23]][[%3e%23]]
7451 !! html
7452 <p>[[%3c%23]][[%3e%23]]
7453 </p>
7454 !! end
7455
7456 !! test
7457 Link containing an equals sign
7458 !! wikitext
7459 [[Special:BookSources/isbn=4-00-026157-6]]
7460 !! html/php
7461 <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>
7462 </p>
7463 !! html/parsoid
7464 <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>
7465 !! end
7466
7467 !! article
7468 Foo~bar
7469 !! text
7470 Just a test of an article title containing a tilde.
7471 !! endarticle
7472
7473 # note that links containing signatures, like [[Foo~~~~]], are
7474 # massaged by the pre-save transform (PST) and so the tildes are never
7475 # seen by the parser.
7476 !! test
7477 Link containing a tilde
7478 !! wikitext
7479 [[Foo~bar]]
7480 !! html/php
7481 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
7482 </p>
7483 !! html/parsoid
7484 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
7485 !! end
7486
7487 !! test
7488 Link containing double-single-quotes '' (bug 4598)
7489 !! wikitext
7490 [[Lista d''e paise d''o munno]]
7491 !! html/php
7492 <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>
7493 </p>
7494 !! html/parsoid
7495 <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>
7496 !! end
7497
7498 !! test
7499 Link containing double-single-quotes '' in text (bug 4598 sanity check)
7500 !! wikitext
7501 Some [[Link|pretty ''italics'' and stuff]]!
7502 !! html/php
7503 <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>!
7504 </p>
7505 !! html/parsoid
7506 <p>Some <a rel="mw:WikiLink" href="Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
7507 !! end
7508
7509 !! test
7510 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
7511 !! wikitext
7512 ''Some [[Link|pretty ''italics'' and stuff]]!''
7513 !! html
7514 <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>
7515 </p>
7516 !! end
7517
7518 !! test
7519 Link with double quotes in title part (literal) and alternate part (interpreted)
7520 !! wikitext
7521 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
7522
7523 [[''Pentecoste'']]
7524
7525 [[''Pentecoste''|Pentecoste]]
7526
7527 [[''Pentecoste''|''Pentecoste'']]
7528 !! html/php
7529 <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>
7530 </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>
7531 </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>
7532 </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>
7533 </p>
7534 !! html/parsoid
7535 <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>
7536 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
7537 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
7538 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
7539 !! end
7540
7541 !! test
7542 Broken image links with HTML captions (bug 39700)
7543 !! wikitext
7544 [[File:Nonexistent|<script></script>]]
7545 [[File:Nonexistent|100x100px|<script></script>]]
7546 [[File:Nonexistent|&lt;]]
7547 [[File:Nonexistent|a<i>b</i>c]]
7548 !! html/php
7549 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7550 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7551 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
7552 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
7553 </p>
7554 !! html/parsoid
7555 <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>
7556 <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>
7557 <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>
7558 <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>
7559 !! end
7560
7561 !! test
7562 Plain link to URL
7563 !! wikitext
7564 [[http://www.example.com]]
7565 !! html/php
7566 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
7567 </p>
7568 !! html/parsoid
7569 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
7570 !! end
7571
7572 !! test
7573 Plain link to URL with link text
7574 !! wikitext
7575 [[http://www.example.com Link text]]
7576 !! html
7577 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
7578 </p>
7579 !! end
7580
7581 !! test
7582 Plain link to protocol-relative URL
7583 !! wikitext
7584 [[//www.example.com]]
7585 !! html/php
7586 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
7587 </p>
7588 !! html/parsoid
7589 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
7590 !! end
7591
7592 !! test
7593 Plain link to protocol-relative URL with link text
7594 !! wikitext
7595 [[//www.example.com Link text]]
7596 !! html
7597 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
7598 </p>
7599 !! end
7600
7601 !! test
7602 Plain link to page with question mark in title
7603 !! wikitext
7604 [[A?b]]
7605
7606 [[A?b|Baz]]
7607 !! html
7608 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
7609 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
7610 </p>
7611 !! end
7612
7613
7614 # I'm fairly sure the expected result here is wrong.
7615 # We want these to be URL links, not pseudo-pages with URLs for titles....
7616 # However the current output is also pretty screwy.
7617 #
7618 # ----
7619 # I'm changing it to match the current output--it arguably makes more
7620 # sense in the light of the test above. Old expected result was:
7621 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
7622 #</p>
7623 # But I think this test is bordering on "garbage in, garbage out" anyway.
7624 # -- wtm
7625 !! test
7626 Piped link to URL
7627 !! wikitext
7628 Piped link to URL: [[http://www.example.com|an example URL]]
7629 !! html/php
7630 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
7631 </p>
7632 !! html/parsoid
7633 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
7634 !! end
7635
7636 !! test
7637 BUG 2: [[page|http://url/]] should link to page, not http://url/
7638 !! wikitext
7639 [[Main Page|http://url/]]
7640 !! html/php
7641 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
7642 </p>
7643 !! html/parsoid
7644 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
7645 !! end
7646
7647 # Parsoid does not mark self-links, by design.
7648 !! test
7649 BUG 337: Escaped self-links should be bold
7650 !! options
7651 title=[[Bug462]]
7652 !! wikitext
7653 [[Bu&#103;462]] [[Bug462]]
7654 !! html/php
7655 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
7656 </p>
7657 !! html/php+tidy
7658 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
7659 !! html/parsoid
7660 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
7661 !! end
7662
7663 !! test
7664 Self-link to section should not be bold
7665 !! options
7666 title=[[Main Page]]
7667 !! wikitext
7668 [[Main Page#section]]
7669 !! html
7670 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
7671 </p>
7672 !! end
7673
7674 !! article
7675 00
7676 !! text
7677 This is 00.
7678 !! endarticle
7679
7680 !!test
7681 Self-link to numeric title
7682 !!options
7683 title=[[0]]
7684 !! wikitext
7685 [[0]]
7686 !! html
7687 <p><strong class="selflink">0</strong>
7688 </p>
7689 !!end
7690
7691 !!test
7692 Link to numeric-equivalent title
7693 !!options
7694 title=[[0]]
7695 !! wikitext
7696 [[00]]
7697 !! html
7698 <p><a href="/wiki/00" title="00">00</a>
7699 </p>
7700 !!end
7701
7702 !! test
7703 <nowiki> inside a link
7704 !! wikitext
7705 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
7706 !! html
7707 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
7708 </p>
7709 !! end
7710
7711 !! test
7712 Non-breaking spaces in title
7713 !! wikitext
7714 [[&nbsp; Main &nbsp; Page &nbsp;]]
7715 !! html
7716 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
7717 </p>
7718 !!end
7719
7720 !! test
7721 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
7722 !! options
7723 language=ca
7724 !! wikitext
7725 '''[[Main Page]]'''
7726 !! html
7727 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
7728 </p>
7729 !! end
7730
7731 !! test
7732 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
7733 !! options
7734 language=ca
7735 !! wikitext
7736 ''[[Main Page]]''
7737 !! html
7738 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
7739 </p>
7740 !! end
7741
7742 !! test
7743 Internal link with en linktrail: no apostrophes (bug 27473)
7744 !! options
7745 language=en
7746 !! wikitext
7747 [[Something]]'nice
7748 !! html
7749 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
7750 </p>
7751 !! end
7752
7753 !! test
7754 Internal link with ca linktrail with apostrophes (bug 27473)
7755 !! options
7756 language=ca
7757 !! wikitext
7758 [[Something]]'nice
7759 !! html
7760 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
7761 </p>
7762 !! end
7763
7764 !! test
7765 Internal link with kaa linktrail with apostrophes (bug 27473)
7766 !! options
7767 language=kaa
7768 !! wikitext
7769 [[Something]]'nice
7770 !! html
7771 <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>
7772 </p>
7773 !! end
7774
7775 !! test
7776 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
7777 !! wikitext
7778 [[User:Foo/Test/63636:Bar|Test]]
7779 !! html/php
7780 <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>
7781 </p>
7782 !! html/parsoid
7783 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
7784 !! end
7785
7786 !! test
7787 Purely hash wikilink
7788 !! options
7789 title=[[User:test/123]]
7790 !! wikitext
7791 [[#a|b]]
7792 !! html/php
7793 <p><a href="#a">b</a>
7794 </p>
7795 !! html/parsoid
7796 <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>
7797 !! end
7798
7799 !! test
7800 1. Interaction of linktrail and template encapsulation
7801 !! options
7802 parsoid
7803 !! wikitext
7804 {{echo|[[Foo]]}}l
7805 !! html
7806 <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>
7807 !! end
7808
7809 !! test
7810 2. Interaction of linktrail and template encapsulation
7811 !! options
7812 parsoid
7813 !! wikitext
7814 {{echo|Some [[Fool]]}}s
7815 !! html
7816 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Some [[Fool]]"}},"i":0}},"s"]}' data-parsoid='{"pi":[[{"k":"1"}]]}'>Some </span><a rel="mw:WikiLink" href="./Fool" title="Fool" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Fool"},"sa":{"href":"Fool"},"tail":"s"}'>Fools</a></p>
7817 !! end
7818
7819 !! test
7820 3. Interaction of linktrail and template encapsulation
7821 !! options
7822 parsoid
7823 !! wikitext
7824 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
7825 !! html
7826 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Some [[Fool]]s are &#39;&#39;&#39;bold and foolish&#39;&#39;&#39;"}},"i":0}}]}' data-parsoid='{"pi":[[{"k":"1"}]]}'>Some <a rel="mw:WikiLink" href="./Fool" title="Fool" data-parsoid='{"stx":"simple","a":{"href":"./Fool"},"sa":{"href":"Fool"},"tail":"s"}'>Fools</a> are <b>bold and foolish</b></p>
7827 !! end
7828
7829 !! article
7830 Söfnuður
7831 !! text
7832 Test.
7833 !! endarticle
7834
7835 !! test
7836 Internal link with is link prefix
7837 !! options
7838 language=is
7839 !! wikitext
7840 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
7841 !! html
7842 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
7843 </p>
7844 !! end
7845
7846 !! article
7847 Mótmælendatrú
7848 !! text
7849 Test.
7850 !! endarticle
7851
7852 !! test
7853 Internal link with is link trail and link prefix
7854 !! options
7855 language=is
7856 !! wikitext
7857 [[mótmælendatrú|xxx]]ar
7858 [[mótmælendatrú]]ar
7859 mótmælenda[[söfnuður]]
7860 mótmælenda[[söfnuður|söfnuðir]]
7861 mótmælenda[[söfnuður|söfnuðir]]xxx
7862 !! html
7863 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
7864 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
7865 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
7866 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
7867 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
7868 </p>
7869 !! end
7870
7871 !! test
7872 Parsoid link trail escaping
7873 !! options
7874 parsoid=html2wt,html2html
7875 !! html/parsoid
7876 <p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p>
7877 !! wikitext
7878 [[apple]]<nowiki/>s
7879 !! end
7880
7881 !! test
7882 Parsoid link prefix escaping
7883 !! options
7884 language=is
7885 parsoid=html2wt,html2html
7886 !! html/parsoid
7887 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p>
7888 !! wikitext
7889 Aðrir mótmælenda<nowiki/>[[söfnuður]]
7890 !! end
7891
7892 !! test
7893 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
7894 !! wikitext
7895 [[Foo| bar]]
7896
7897 [[Foo| ''bar'']]
7898
7899 [http://wp.org foo]
7900
7901 [http://wp.org ''foo'']
7902 !! html
7903 <p><a href="/wiki/Foo" title="Foo"> bar</a>
7904 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
7905 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
7906 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
7907 </p>
7908 !! end
7909
7910 !! test
7911 Parsoid: Scoped parsing should handle mixed transclusions and plain text
7912 !! options
7913 parsoid
7914 !! wikitext
7915 [[Foo|{{echo|a}} b {{echo|c}}]]
7916 !! html
7917 <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>
7918 !! end
7919
7920 !! test
7921 Link with angle bracket after anchor
7922 !! wikitext
7923 [[Foo#<bar>]]
7924 !! html/php
7925 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
7926 </p>
7927 !! html/parsoid
7928 <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>
7929 !! end
7930
7931 ###
7932 ### Interwiki links (see maintenance/interwiki.sql)
7933 ###
7934
7935 !! test
7936 Inline interwiki link
7937 !! options
7938 parsoid=wt2html,wt2wt,html2html
7939 !! wikitext
7940 [[MeatBall:SoftSecurity]]
7941 !! html/php
7942 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
7943 </p>
7944 !! html/parsoid
7945 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
7946 !! end
7947
7948 !! test
7949 Inline interwiki link with empty title (bug 2372)
7950 !! options
7951 parsoid=wt2html,wt2wt,html2html
7952 !! wikitext
7953 [[MeatBall:]]
7954 !! html/php
7955 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
7956 </p>
7957 !! html/parsoid
7958 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
7959 !! end
7960
7961 !! test
7962 Interwiki link encoding conversion (bug 1636)
7963 !! wikitext
7964 *[[Wikipedia:ro:Olteni&#0355;a]]
7965 *[[Wikipedia:ro:Olteni&#355;a]]
7966 !! html
7967 <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>
7968 <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>
7969
7970 !! html+tidy
7971 <ul>
7972 <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>
7973 <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>
7974 </ul>
7975 !! end
7976
7977 !! test
7978 Interwiki link with fragment (bug 2130)
7979 !! wikitext
7980 [[MeatBall:SoftSecurity#foo]]
7981 !! html
7982 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
7983 </p>
7984 !! end
7985
7986 # Ideally the wikipedia: prefix here should be proto-relative too
7987 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
7988 # define the 'en' prefix, and originally the test used 'wikipedia',
7989 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
7990 # article.
7991 !! test
7992 Different interwiki prefixes mapping to the same URL
7993 !! wikitext
7994 [[:en:Foo]]
7995
7996 [[:en:Foo|Foo]]
7997
7998 [[wikipedia:Foo]]
7999
8000 [[:wikipedia:Foo|Foo]]
8001
8002 [[wikipedia:en:Foo]]
8003
8004 [[:wikipedia:en:Foo]]
8005
8006 [[ wikiPEdia :Foo]]
8007 !! html/parsoid
8008 <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>
8009
8010 <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>
8011
8012 <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>
8013
8014 <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>
8015
8016 <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>
8017
8018 <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>
8019
8020 <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>
8021 !! end
8022
8023 !! test
8024 Interwiki links that cannot be represented in wiki syntax
8025 !! wikitext
8026 [[meatball:ok]]
8027 [[meatball:ok#foo|ok with fragment]]
8028 [[meatball:ok_as_well?|ok ending with ? mark]]
8029 [http://de.wikipedia.org/wiki/Foo?action=history has query]
8030 [http://de.wikipedia.org/wiki/#foo is just fragment]
8031
8032 !! html/php
8033 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
8034 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
8035 <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>
8036 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8037 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
8038 </p>
8039 !! html/parsoid
8040 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
8041 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
8042 <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>
8043 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8044 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
8045 !! end
8046
8047 !! test
8048 Interwiki links: trail
8049 !! wikitext
8050 [[wikipedia:Foo|Ba]]r
8051 !! html/php
8052 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
8053 </p>
8054 !! html/parsoid
8055 <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>
8056 !! end
8057
8058 !! test
8059 Local interwiki link
8060 !! options
8061 parsoid=wt2html,wt2wt,html2html
8062 !! wikitext
8063 [[local:Template:Foo]]
8064 !! html/php
8065 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
8066 </p>
8067 !! html/parsoid
8068 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
8069 !! end
8070
8071 # Parsoid does not mark self-links, by design.
8072 !! test
8073 Local interwiki link: self-link to current page
8074 !! options
8075 title=[[Main Page]]
8076 parsoid=wt2html,wt2wt,html2html
8077 !! wikitext
8078 [[local:Main Page]]
8079 !! html/php
8080 <p><strong class="selflink">local:Main Page</strong>
8081 </p>
8082 !! html/parsoid
8083 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
8084 !! end
8085
8086 !! test
8087 Local interwiki link: prefix only (bug 64167)
8088 !! options
8089 parsoid=wt2html,wt2wt,html2html
8090 !! wikitext
8091 [[local:]]
8092 !! html/php
8093 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
8094 </p>
8095 !! html/parsoid
8096 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
8097 !! end
8098
8099 !! test
8100 Local interwiki link: with additional interwiki prefix (bug 61357)
8101 !! options
8102 parsoid=wt2html,wt2wt,html2html
8103 !! wikitext
8104 [[local:meatball:Hello]]
8105 !! html/php
8106 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8107 </p>
8108 !! html/parsoid
8109 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8110 !! end
8111
8112 !! test
8113 Multiple local interwiki link prefixes
8114 !! wikitext
8115 [[local:local:local:local:mi:local:Foo]]
8116 !! options
8117 parsoid=wt2html,wt2wt,html2html
8118 !! html/php
8119 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8120 </p>
8121 !! html/parsoid
8122 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8123 !! end
8124
8125 ###
8126 ### Interlanguage links
8127 ### Language links (so that searching for '### language' matches..)
8128 ###
8129
8130 !! test
8131 Interlanguage link
8132 !! options
8133 parsoid=wt2html,wt2wt,html2html
8134 !! wikitext
8135 Blah blah blah
8136 [[zh:Chinese]]
8137 !! html/php
8138 <p>Blah blah blah
8139 </p>
8140 !! html/parsoid
8141 <p>Blah blah blah</p>
8142 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8143 !! end
8144
8145 !! test
8146 Interlanguage link with spacing
8147 !! options
8148 parsoid=wt2html,wt2wt,html2html
8149 !! wikitext
8150 Blah blah blah
8151 [[ zh : Chinese ]]
8152 !! html/php
8153 <p>Blah blah blah
8154 </p>
8155 !! html/parsoid
8156 <p>Blah blah blah</p>
8157 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8158 !! end
8159
8160 !! test
8161 Double interlanguage link
8162 !! options
8163 parsoid=wt2html,wt2wt,html2html
8164 !! wikitext
8165 Blah blah blah
8166 [[es:Spanish]]
8167 [[zh:Chinese]]
8168 !! html/php
8169 <p>Blah blah blah
8170 </p>
8171 !! html/parsoid
8172 <p>Blah blah blah</p>
8173 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8174 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8175 !! end
8176
8177 !! test
8178 Interlanguage link variations
8179 !! options
8180 parsoid=wt2html,wt2wt,html2html
8181 !! wikitext
8182 Blah blah blah
8183 [[ es :Spanish]]
8184 [[ ZH :Chinese]]
8185 [[es:Foo_bar]]
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 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
8194 !! end
8195
8196 !! test
8197 Space and question mark encoding in interlanguage links (T95473)
8198 !! options
8199 parsoid=wt2html,wt2wt,html2html
8200 !! wikitext
8201 Blah blah blah
8202 [[es:Foo bar?]]
8203 !! html/php
8204 <p>Blah blah blah
8205 </p>
8206 !! html/parsoid
8207 <p>Blah blah blah</p>
8208 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
8209 !! end
8210
8211 !! test
8212 Interlanguage link, with prefix links
8213 !! options
8214 language=ln
8215 !! wikitext
8216 Blah blah blah
8217 [[zh:Chinese]]
8218 !! html/php
8219 <p>Blah blah blah
8220 </p>
8221 !! html/parsoid
8222 <p>Blah blah blah</p>
8223 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8224 !! end
8225
8226 !! test
8227 Double interlanguage link, with prefix links (bug 8897)
8228 !! options
8229 language=ln
8230 !! wikitext
8231 Blah blah blah
8232 [[es:Spanish]]
8233 [[zh:Chinese]]
8234 !! html/php
8235 <p>Blah blah blah
8236 </p>
8237 !! html/parsoid
8238 <p>Blah blah blah</p>
8239 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8240 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8241 !! end
8242
8243 !! test
8244 "Extra" interlanguage links (bug 32189 / gerrit 111390)
8245 !! wikitext
8246 Blah blah blah
8247 [[mul:Article]]
8248 !! html/php
8249 <p>Blah blah blah
8250 </p>
8251 !! html/parsoid
8252 <p>Blah blah blah</p>
8253 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
8254 !! end
8255
8256 !! test
8257 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
8258 !! options
8259 language=ln
8260 !! wikitext
8261 [[WW&nbsp;II]]
8262 !! html
8263 <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>
8264 </p>
8265 !! end
8266
8267 !! test
8268 Parsoid bug 53221: Wikilinks should be properly entity-escaped
8269 !! options
8270 parsoid=html2wt
8271 !! html/parsoid
8272 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8273 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8274 !! wikitext
8275 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
8276
8277 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
8278 !! end
8279
8280 !! test
8281 Parsoid: handle constructor well
8282 !! wikitext
8283 [[constructor]]
8284
8285 [[constructor:foo]]
8286 !! html/php
8287 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
8288 </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>
8289 </p>
8290 !! html/parsoid
8291 <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>
8292
8293 <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>
8294 !! end
8295
8296 !! article
8297 ko:
8298 !! text
8299 Test.
8300 !! endarticle
8301
8302 # Note that `ko` isn't a known interlanguage prefix
8303 !! test
8304 Parsoid: recognize interlanguage links without a target page
8305 !! options
8306 ill
8307 !! wikitext
8308 [[es:]]
8309
8310 [[ko:]]
8311 !! html/php
8312 es:
8313 !! html/parsoid
8314 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
8315
8316 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8317 !! end
8318
8319 # Note that `ko` isn't a known interwiki prefix
8320 !! test
8321 Parsoid: recognize interwiki links without a target page
8322 !! options
8323 parsoid=wt2html,wt2wt,html2html
8324 !! wikitext
8325 [[:es:]]
8326
8327 [[:ko:]]
8328 !! html/php
8329 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
8330 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
8331 </p>
8332 !! html/parsoid
8333 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
8334 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8335 !! end
8336
8337 !! test
8338 Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
8339 !! wikitext
8340 [[mi:Foo]]
8341 !! html/php
8342 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
8343 </p>
8344 !! html/parsoid
8345 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
8346 !! end
8347
8348 !! test
8349 Interlanguage link with preceding local interwiki link (bug 68085)
8350 !! options
8351 parsoid=wt2html,wt2wt,html2html
8352 !! wikitext
8353 Blah blah blah
8354 [[local:es:Spanish]]
8355 !! html/php
8356 <p>Blah blah blah
8357 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
8358 </p>
8359 !! html/parsoid
8360 <p>Blah blah blah
8361 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
8362 !! end
8363
8364 !! test
8365 Looks like an interlanguage link, but is actually a local interwiki
8366 !! options
8367 parsoid=wt2html,wt2wt,html2html
8368 !! wikitext
8369 Blah blah blah
8370 [[mi:Template:Foo]]
8371 !! html/php
8372 <p>Blah blah blah
8373 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
8374 </p>
8375 !! html/parsoid
8376 <p>Blah blah blah
8377 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
8378 !! end
8379
8380 ###
8381 ### Redirects, Parsoid-only
8382 ###
8383
8384 !! test
8385 1. Simple redirect to page
8386 !! wikitext
8387 #REDIRECT [[Main Page]]
8388 !! html/parsoid
8389 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8390 !! end
8391
8392 !! test
8393 2. Other redirect variants
8394 !! wikitext
8395 #REDIRECT [[Main_Page]]
8396 !! html/parsoid
8397 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
8398 !! end
8399
8400 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
8401 # This tests the Parsoid bail-out code.
8402 !! test
8403 3. Other redirect variants
8404 !! wikitext
8405 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
8406 !! html/parsoid
8407 <ol><li data-parsoid>REDIRECT [[[[Bar]]]]</li></ol>
8408 !! end
8409
8410 !! test
8411 4. Redirect to a templated destination
8412 !! wikitext
8413 #REDIRECT [[{{echo|Foo}}bar]]
8414 !! html/parsoid
8415 <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;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"}]]}'/>
8416 !! end
8417
8418 !! test
8419 Empty redirect
8420 !! options
8421 parsoid=wt2html,wt2wt
8422 !! wikitext
8423 #REDIRECT [[]]
8424 !! html/parsoid
8425 <ol>
8426 <li>REDIRECT [[]]</li></ol>
8427 !! end
8428
8429 !! test
8430 Optional colon in #REDIRECT
8431 !! options
8432 # the colon is archaic syntax. we support it for wt2html, but we
8433 # don't care that it roundtrips back to the modern syntax.
8434 parsoid=wt2html,html2html
8435 !! wikitext
8436 #REDIRECT:[[Main Page]]
8437 !! html/parsoid
8438 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8439 !! end
8440
8441 !! test
8442 Whitespace in #REDIRECT with optional colon
8443 !! options
8444 # the colon and gratuitous whitespace is archaic syntax. we support
8445 # it for wt2html, but we don't care that it roundtrips back to the
8446 # modern syntax (without extra whitespace)
8447 parsoid=wt2html,html2html
8448 !! wikitext
8449
8450 #REDIRECT
8451 :
8452 [[Main Page]]
8453 !! html/parsoid
8454 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8455 !! end
8456
8457 !! test
8458 Piped link in #REDIRECT
8459 !! options
8460 # content after piped link is ignored. we support this syntax,
8461 # but don't care that the piped link is lost when we roundtrip this.
8462 parsoid=wt2html
8463 !! wikitext
8464 #REDIRECT [[Main Page|bar]]
8465 !! html/parsoid
8466 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8467 !! end
8468
8469 !! test
8470 Redirect to category (T104502)
8471 !! options
8472 parsoid=wt2html,wt2wt
8473 !! wikitext
8474 #REDIRECT [[Category:Foo]]
8475 !! html/parsoid
8476 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8477 !! end
8478
8479 !! test
8480 Redirect to category with URL encoding (T104502)
8481 !! options
8482 parsoid=wt2html
8483 !! wikitext
8484 #REDIRECT [[Category%3AFoo]]
8485 !! html/parsoid
8486 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8487 !! end
8488
8489 !! test
8490 Redirect to category page
8491 !! wikitext
8492 #REDIRECT [[:Category:Foo]]
8493 !! html/parsoid
8494 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8495 !! end
8496
8497 !! test
8498 Redirect to image page (1)
8499 !! wikitext
8500 #REDIRECT [[File:Wiki.png]]
8501 !! html/parsoid
8502 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
8503 !! end
8504
8505 !! test
8506 Redirect to image page (2)
8507 !! wikitext
8508 #REDIRECT [[Image:Wiki.png]]
8509 !! html/parsoid
8510 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
8511 !! end
8512
8513 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
8514 # Next test confirms this.
8515 !! test
8516 Redirect to language (1) (T104918)
8517 !! options
8518 parsoid=wt2html,wt2wt,html2html
8519 !! wikitext
8520 #REDIRECT [[en:File:Wiki.png]]
8521 !! html/parsoid
8522 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8523 !! end
8524
8525 !! test
8526 Redirect to language (2) (T104918)
8527 !! wikitext
8528 #REDIRECT [[:en:File:Wiki.png]]
8529 !! html/parsoid
8530 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8531 !! end
8532
8533 !! test
8534 Redirect to interwiki (T104918)
8535 !! wikitext
8536 #REDIRECT [[meatball:File:Wiki.png]]
8537 !! html/parsoid
8538 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
8539 !! end
8540
8541 !! test
8542 Non-English #REDIRECT
8543 !! options
8544 language=is
8545 !! wikitext
8546 #TILVÍSUN [[Main Page]]
8547 !! html/parsoid
8548 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
8549 !! end
8550
8551 !! test
8552 Redirect syntax under text isn't considered a redirect
8553 !! wikitext
8554 some text
8555 #redirect [[Main Page]]
8556 !! html/parsoid
8557 <p>some text</p>
8558 <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>
8559 !! end
8560
8561 # FIXME: Should hoist the redirect to the top of the page and ensure there
8562 # is only one.
8563 !! test
8564 New redirect
8565 !! options
8566 parsoid=html2wt
8567 !! html/parsoid
8568 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
8569 !! wikitext
8570 Foo
8571 #REDIRECT [[Foo]]
8572 !! end
8573
8574 ##
8575 ## XHTML tidiness
8576 ###
8577
8578 !! test
8579 <br> to <br />
8580 !! wikitext
8581 1<br>2<br />3
8582 !! html
8583 <p>1<br />2<br />3
8584 </p>
8585 !! end
8586
8587 !! test
8588 Broken br tag sanitization
8589 !! wikitext
8590 </br>
8591 !! html/php
8592 <p>&lt;/br&gt;
8593 </p>
8594 !! end
8595
8596 # TODO: Fix html2html mode (bug 51055)!
8597 !! test
8598 Parsoid: Broken br tag recognition
8599 !! options
8600 parsoid=wt2html
8601 !! wikitext
8602 </br>
8603
8604 <br/ >
8605 !! html+tidy
8606 <p><br /></p>
8607 <p><br /></p>
8608 !! end
8609
8610 !! test
8611 Incorrecly removing closing slashes from correctly formed XHTML
8612 !! wikitext
8613 <br style="clear:both;" />
8614 !! html
8615 <p><br style="clear:both;" />
8616 </p>
8617 !! end
8618
8619 !! test
8620 Failing to transform badly formed HTML into correct XHTML
8621 !! wikitext
8622 <br style="clear: left;">
8623 <br style="clear: right;">
8624 <br style="clear: both;">
8625 !! html
8626 <p><br style="clear: left;" />
8627 <br style="clear: right;" />
8628 <br style="clear: both;" />
8629 </p>
8630 !!end
8631
8632 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
8633 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
8634 !! test
8635 Handling html with a div self-closing tag
8636 !! wikitext
8637 <div title />
8638 <div title/>
8639 <div title/ >
8640 <div title=bar />
8641 <div title=bar/>
8642 <div title=bar/ >
8643 !! html/php
8644 <p>&lt;div title /&gt;
8645 &lt;div title/&gt;
8646 </p>
8647 <div>
8648 <p>&lt;div title=bar /&gt;
8649 &lt;div title=bar/&gt;
8650 </p>
8651 <div title="bar/"></div>
8652 </div>
8653
8654 !! html/parsoid
8655 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8656 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8657 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
8658 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8659 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8660 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
8661 !! end
8662
8663 !! test
8664 Handling html with a br self-closing tag
8665 !! wikitext
8666 <br title />
8667 <br title/>
8668 <br title/ >
8669 <br title=bar />
8670 <br title=bar/>
8671 <br title=bar/ >
8672 !! html/php
8673 <p><br title="" />
8674 <br title="" />
8675 <br />
8676 <br title="bar" />
8677 <br title="bar" />
8678 <br title="bar/" />
8679 </p>
8680 !! html/parsoid
8681 <p><br title="" />
8682 <br title="" />
8683 <br title="" />
8684 <br title="bar" />
8685 <br title="bar" />
8686 <br title="bar/" />
8687 </p>
8688 !! end
8689
8690 !! test
8691 Horizontal ruler (should it add that extra space?)
8692 !! wikitext
8693 <hr>
8694 <hr >
8695 foo <hr
8696 > bar
8697 !! html+tidy
8698 <hr />
8699 <hr />
8700 <p>foo</p>
8701 <hr />
8702 <p>bar</p>
8703 !! end
8704
8705 !! test
8706 Horizontal ruler -- 4+ dashes render hr
8707 !! wikitext
8708 ----
8709 !! html
8710 <hr />
8711
8712 !! end
8713
8714 !! test
8715 Horizontal ruler -- eats additional dashes on the same line
8716 !! wikitext
8717 ---------
8718 !! html
8719 <hr />
8720
8721 !! end
8722
8723 !! test
8724 Horizontal ruler -- does not collapse dashes on consecutive lines
8725 !! wikitext
8726 ----
8727 ----
8728 !! html
8729 <hr />
8730 <hr />
8731
8732 !! end
8733
8734 !! test
8735 Horizontal ruler -- <4 dashes render as plain text
8736 !! wikitext
8737 ---
8738 !! html
8739 <p>---
8740 </p>
8741 !! end
8742
8743 !! test
8744 Horizontal ruler -- Supports content following dashes on same line
8745 !! wikitext
8746 ---- Foo
8747 !! html
8748 <hr /> Foo
8749
8750 !! html+tidy
8751 <hr />
8752 <p>Foo</p>
8753 !! end
8754
8755 ###
8756 ### Block-level elements
8757 ###
8758 !! test
8759 Common list
8760 !! wikitext
8761 *Common list
8762 * item 2
8763 *item 3
8764 !! html
8765 <ul><li>Common list</li>
8766 <li> item 2</li>
8767 <li>item 3</li></ul>
8768
8769 !! end
8770
8771 !! test
8772 Numbered list
8773 !! wikitext
8774 #Numbered list
8775 #item 2
8776 # item 3
8777 !! html
8778 <ol><li>Numbered list</li>
8779 <li>item 2</li>
8780 <li> item 3</li></ol>
8781
8782 !! end
8783
8784 !! test
8785 Mixed list
8786 !! wikitext
8787 *Mixed list
8788 *# with numbers
8789 ** and bullets
8790 *# and numbers
8791 *bullets again
8792 **bullet level 2
8793 ***bullet level 3
8794 ***#Number on level 4
8795 **bullet level 2
8796 **#Number on level 3
8797 **#Number on level 3
8798 *#number level 2
8799 *Level 1
8800 *** Level 3
8801 #** Level 3, but ordered
8802 !! html
8803 <ul><li>Mixed list
8804 <ol><li> with numbers</li></ol>
8805 <ul><li> and bullets</li></ul>
8806 <ol><li> and numbers</li></ol></li>
8807 <li>bullets again
8808 <ul><li>bullet level 2
8809 <ul><li>bullet level 3
8810 <ol><li>Number on level 4</li></ol></li></ul></li>
8811 <li>bullet level 2
8812 <ol><li>Number on level 3</li>
8813 <li>Number on level 3</li></ol></li></ul>
8814 <ol><li>number level 2</li></ol></li>
8815 <li>Level 1
8816 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
8817 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
8818
8819 !! end
8820
8821 !! test
8822 1. Nested mixed wikitext and html list
8823 !! wikitext
8824 * hi
8825 * <ul><li>ho</li></ul>
8826 * hi
8827 ** ho
8828 !! html/php
8829 <ul><li> hi</li>
8830 <li> <ul><li>ho</li></ul></li>
8831 <li> hi
8832 <ul><li> ho</li></ul></li></ul>
8833
8834 !! html/parsoid
8835 <ul><li> hi</li>
8836 <li> <ul data-parsoid='{"stx":"html"}'><li data-parsoid='{"stx":"html"}'>ho</li></ul></li>
8837 <li> hi
8838 <ul><li> ho</li></ul></li></ul>
8839 !! end
8840
8841 !! test
8842 2. Nested mixed wikitext and html list (incompatible)
8843 !! wikitext
8844 ; hi
8845 : {{echo|<li>ho</li>}}
8846 !! html/php
8847 <dl><dt> hi</dt>
8848 <dd> <li>ho</li></dd></dl>
8849
8850 !! html/parsoid
8851 <dl><dt> hi</dt>
8852 <dd> <li about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;li>ho&lt;/li>"}},"i":0}}]}'>ho</li></dd></dl>
8853 !! end
8854
8855 !! test
8856 Nested lists 1
8857 !! wikitext
8858 *foo
8859 **bar
8860 !! html
8861 <ul><li>foo
8862 <ul><li>bar</li></ul></li></ul>
8863
8864 !! end
8865
8866 !! test
8867 Nested lists 2
8868 !! wikitext
8869 **foo
8870 *bar
8871 !! html
8872 <ul><li><ul><li>foo</li></ul></li>
8873 <li>bar</li></ul>
8874
8875 !! end
8876
8877 !! test
8878 Nested lists 3 (first element empty)
8879 !! wikitext
8880 *
8881 **bar
8882 !! html
8883 <ul><li>
8884 <ul><li>bar</li></ul></li></ul>
8885
8886 !! end
8887
8888 !! test
8889 Nested lists 4 (first element empty)
8890 !! wikitext
8891 **
8892 *bar
8893 !! html
8894 <ul><li><ul><li></li></ul></li>
8895 <li>bar</li></ul>
8896
8897 !! end
8898
8899 !! test
8900 Nested lists 5 (both elements empty)
8901 !! wikitext
8902 **
8903 *
8904 !! html
8905 <ul><li><ul><li></li></ul></li>
8906 <li></li></ul>
8907
8908 !! end
8909
8910 !! test
8911 Nested lists 6 (both elements empty)
8912 !! wikitext
8913 *
8914 **
8915 !! html
8916 <ul><li>
8917 <ul><li></li></ul></li></ul>
8918
8919 !! end
8920
8921 !! test
8922 Nested lists 7 (skip initial nesting levels)
8923 !! wikitext
8924 *** foo
8925 !! html
8926 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
8927
8928 !! end
8929
8930 !! test
8931 Nested lists 8 (multiple nesting transitions)
8932 !! wikitext
8933 * foo
8934 *** bar
8935 ** baz
8936 * boo
8937 !! html
8938 <ul><li> foo
8939 <ul><li><ul><li> bar</li></ul></li>
8940 <li> baz</li></ul></li>
8941 <li> boo</li></ul>
8942
8943 !! end
8944
8945 !! test
8946 Nested lists 9 (extension interaction)
8947 !! options
8948 parsoid
8949 !! wikitext
8950 *<references />
8951 !! html/parsoid
8952 <ul><li data-parsoid='{}'><ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
8953 !! end
8954
8955 !! test
8956 1. Lists with start-of-line-transparent tokens before bullets: Comments
8957 !! wikitext
8958 *foo
8959 *<!--cmt-->bar
8960 <!--cmt-->*baz
8961 !! html
8962 <ul><li>foo</li>
8963 <li>bar</li>
8964 <li>baz</li></ul>
8965
8966 !! end
8967
8968 !! test
8969 2. Lists with start-of-line-transparent tokens before bullets: Template close
8970 !! wikitext
8971 *foo {{echo|bar
8972 }}*baz
8973 !! html
8974 <ul><li>foo bar</li>
8975 <li>baz</li></ul>
8976
8977 !! end
8978
8979 !! test
8980 List items are not parsed correctly following a <pre> block (bug 785)
8981 !! wikitext
8982 * <pre>foo</pre>
8983 * <pre>bar</pre>
8984 * zar
8985 !! html/php
8986 <ul><li> <pre>foo</pre></li>
8987 <li> <pre>bar</pre></li>
8988 <li> zar</li></ul>
8989
8990 !! html/parsoid
8991 <ul><li> <pre data-parsoid='{"stx":"html"}'>foo</pre></li>
8992 <li> <pre data-parsoid='{"stx":"html"}'>bar</pre></li>
8993 <li> zar</li></ul>
8994 !! end
8995
8996 !! test
8997 List items from template
8998 !! wikitext
8999
9000 {{inner list}}
9001 * item 2
9002
9003 * item 0
9004 {{inner list}}
9005 * item 2
9006
9007 * item 0
9008 * notSOL{{inner list}}
9009 * item 2
9010 !! html
9011 <ul><li> item 1</li>
9012 <li> item 2</li></ul>
9013 <ul><li> item 0</li>
9014 <li> item 1</li>
9015 <li> item 2</li></ul>
9016 <ul><li> item 0</li>
9017 <li> notSOL</li>
9018 <li> item 1</li>
9019 <li> item 2</li></ul>
9020
9021 !! end
9022
9023 !! test
9024 List interrupted by empty line or heading
9025 !! wikitext
9026 * foo
9027
9028 ** bar
9029 == A heading ==
9030 * Another list item
9031 !! html
9032 <ul><li> foo</li></ul>
9033 <ul><li><ul><li> bar</li></ul></li></ul>
9034 <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>
9035 <ul><li> Another list item</li></ul>
9036
9037 !!end
9038
9039 !!test
9040 Multiple list tags generated by templates
9041 !! wikitext
9042 {{echo|<li>}}a
9043 {{echo|<li>}}b
9044 {{echo|<li>}}c
9045 !! html
9046 <li>a
9047 <li>b
9048 <li>c</li>
9049 </li>
9050 </li>
9051
9052 !! html+tidy
9053 <ul>
9054 <li>a</li>
9055 <li>b</li>
9056 <li>c</li>
9057 </ul>
9058 !!end
9059
9060 !!test
9061 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
9062 !! wikitext
9063 *a
9064 <!--This line will NOT split the list-->
9065 *b
9066 <!--This line will NOT split the list either-->
9067 *c
9068 <!--foo--> <!----> <!--This line NOT split the list either-->
9069 *d
9070 !! html
9071 <ul><li>a</li>
9072 <li>b</li>
9073 <li>c</li>
9074 <li>d</li></ul>
9075
9076 !!end
9077
9078 !!test
9079 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
9080 !! wikitext
9081 *a
9082 <!--This line will NOT split the list-->
9083 *b
9084 <!--This line will NOT split the list either-->
9085 *c
9086 <!--foo--> <!----> <!--This line NOT split the list
9087 either-->
9088 *d
9089 !! html
9090 <ul><li>a</li>
9091 <li>b</li>
9092 <li>c</li>
9093 <li>d</li></ul>
9094
9095 !!end
9096
9097 !!test
9098 Test the li-hack
9099 (The PHP parser relies on Tidy for the hack)
9100 !!options
9101 parsoid=wt2html,wt2wt
9102 !! wikitext
9103 * foo
9104 * <li>li-hack
9105 * {{echo|<li>templated li-hack}}
9106 * <!--foo--> <li> unsupported li-hack with preceding comments
9107
9108 <ul>
9109 <li><li>not a li-hack
9110 </li>
9111 </ul>
9112 !! html+tidy
9113 <ul>
9114 <li>foo</li>
9115 <li>li-hack</li>
9116 <li>templated li-hack</li>
9117 <li>unsupported li-hack with preceding comments</li>
9118 </ul>
9119 <ul>
9120 <li>not a li-hack</li>
9121 </ul>
9122 !!end
9123
9124 !! test
9125 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
9126 !! options
9127 parsoid
9128 !! wikitext
9129 # foo
9130 ## bar
9131 * foo
9132 ** bar
9133 : foo
9134 :: bar
9135 !! html
9136 <ol>
9137 <li> foo<ol>
9138 <li> bar</li>
9139 </ol></li>
9140 </ol><ul>
9141 <li> foo<ul>
9142 <li> bar</li>
9143 </ul></li>
9144 </ul><dl>
9145 <dd> foo<dl>
9146 <dd> bar</dd>
9147 </dl></dd>
9148 </dl>
9149 !! end
9150
9151 !! test
9152 Parsoid: Test of whitespace serialization with Templated bullets
9153 !! options
9154 parsoid
9155 !! wikitext
9156 * {{bullet}}
9157 !! html
9158 <ul>
9159 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
9160 </ul>
9161 !! end
9162
9163 # ------------------------------------------------------------------------
9164 # The next set of tests are about Parsoid's ability to handle badly nested
9165 # tags (parse, minimize scope of fixup, and roundtrip back)
9166 # ------------------------------------------------------------------------
9167
9168 !! test
9169 Unbalanced closing block tags break a list
9170 (php parser relies on Tidy to fix up)
9171 !! wikitext
9172 <div>
9173 *a</div><div>
9174 *b</div>
9175 !! html+tidy
9176 <div>
9177 <ul>
9178 <li>a</li>
9179 </ul>
9180 </div>
9181 <div>
9182 <ul>
9183 <li>b</li>
9184 </ul>
9185 </div>
9186 !! end
9187
9188 # Parsoid fails this test, but it might be tricky to support properly.
9189 # See bug 68395.
9190 !! test
9191 Unbalanced closing non-block tags don't break a list
9192 (php parser relies on Tidy to fix up)
9193 !! wikitext
9194 <span>
9195 *a</span><span>
9196 *b</span>
9197 !! html/php+tidy
9198 <ul>
9199 <li><span>a</span></li>
9200 <li><span>b</span></li>
9201 </ul>
9202 !! html/parsoid
9203 <span>
9204 <ul>
9205 <li>a<span></span>
9206 </li>
9207 <li>b
9208 </li>
9209 </ul>
9210 </span>
9211 !! end
9212
9213 !! test
9214 Unclosed formatting tags that straddle lists are closed and reopened
9215 (php parser relies on Tidy to fix up)
9216 !! options
9217 parsoid=wt2html,wt2wt,html2html
9218 !! wikitext
9219 # <s> a
9220 # b </s>
9221 !! html/php+tidy
9222 <ol>
9223 <li><s>a</s></li>
9224 <li><s>b</s></li>
9225 </ol>
9226 !! html/parsoid
9227 <ol><li> <s> a</s></li>
9228 <li><s> b </s></li></ol>
9229 !! end
9230
9231 # See bug 68395.
9232 !!test
9233 1. List embedded in a formatting tag
9234 !! wikitext
9235 <small>
9236 * foo
9237 </small>
9238 !! html/php+tidy
9239 <ul>
9240 <li><small>foo</small></li>
9241 </ul>
9242 !! html/parsoid
9243 <small>
9244 <ul>
9245 <li> foo</li>
9246 </ul>
9247 </small>
9248 !!end
9249
9250 ## Ugly Parsoid output here
9251 ## Not sure what the right output is.
9252 !!test
9253 2. List embedded in a formatting tag
9254 !! wikitext
9255 <small>
9256 *a
9257 *b</small>
9258 !! html/php+tidy
9259 <ul>
9260 <li><small>a</small></li>
9261 <li><small>b</small></li>
9262 </ul>
9263 !! html/parsoid
9264 <small></small>
9265 <ul><small>
9266 <li>a</li>
9267 </small>
9268 <li><small>b</small></li>
9269 </ul>
9270 !!end
9271
9272 # Ugly Parsoid and PHP parser output here
9273 # Not sure if we want to make this a test!
9274 #
9275 ## !!test
9276 ## 3. Unclosed formatting tags in list elements
9277 ## !! wikitext
9278 ## *<small>a
9279 ## *<small>b
9280 ## !! html/php+tidy
9281 ## <ul>
9282 ## <li><small>a</small></li>
9283 ## <li><small><small>b</small></small></li>
9284 ## </ul>
9285 ## !! html/parsoid
9286 ## <ul>
9287 ## <li><small>a</small></li>
9288 ## <small>
9289 ## <li><small>b</small></li>
9290 ## </small></ul>
9291 ## !!end
9292
9293 # This is a bug in the PHP parser + tidy combination.
9294 # (The </tr> tag gets parsed as text and html-escaped by PHP,
9295 # and then fostered out of the table by tidy.)
9296 # We believe the Parsoid output to be correct.
9297 !! test
9298 Table with missing opening <tr> tag
9299 !! options
9300 parsoid=wt2html,wt2wt
9301 !! wikitext
9302 <table>
9303 <td>foo</td>
9304 </tr>
9305 </table>
9306 !! html+tidy
9307 <table>
9308 <tr>
9309 <td>foo</td>
9310 </tr>
9311 </table>
9312 !! end
9313
9314 ###
9315 ### Magic Words
9316 ###
9317
9318 # Note that the current date is hard-coded as
9319 # 1970-01-01T00:02:03Z (a Thursday)
9320 # when running parser tests. The timezone is also fixed to GMT, so
9321 # local date will be identical to current date.
9322
9323 !! test
9324 Magic Word: {{CURRENTDAY}}
9325 !! wikitext
9326 {{CURRENTDAY}}
9327 !! html
9328 <p>1
9329 </p>
9330 !! end
9331
9332 !! test
9333 Magic Word: {{CURRENTDAY2}}
9334 !! wikitext
9335 {{CURRENTDAY2}}
9336 !! html
9337 <p>01
9338 </p>
9339 !! end
9340
9341 !! test
9342 Magic Word: {{CURRENTDAYNAME}}
9343 !! wikitext
9344 {{CURRENTDAYNAME}}
9345 !! html
9346 <p>Thursday
9347 </p>
9348 !! end
9349
9350 !! test
9351 Magic Word: {{CURRENTDOW}}
9352 !! wikitext
9353 {{CURRENTDOW}}
9354 !! html
9355 <p>4
9356 </p>
9357 !! end
9358
9359 !! test
9360 Magic Word: {{CURRENTMONTH}}
9361 !! wikitext
9362 {{CURRENTMONTH}}
9363 !! html
9364 <p>01
9365 </p>
9366 !! end
9367
9368 !! test
9369 Magic Word: {{CURRENTMONTH1}}
9370 !! wikitext
9371 {{CURRENTMONTH1}}
9372 !! html
9373 <p>1
9374 </p>
9375 !! end
9376
9377 !! test
9378 Magic Word: {{CURRENTMONTHABBREV}}
9379 !! wikitext
9380 {{CURRENTMONTHABBREV}}
9381 !! html
9382 <p>Jan
9383 </p>
9384 !! end
9385
9386 !! test
9387 Magic Word: {{CURRENTMONTHNAME}}
9388 !! wikitext
9389 {{CURRENTMONTHNAME}}
9390 !! html
9391 <p>January
9392 </p>
9393 !! end
9394
9395 !! test
9396 Magic Word: {{CURRENTMONTHNAMEGEN}}
9397 !! wikitext
9398 {{CURRENTMONTHNAMEGEN}}
9399 !! html
9400 <p>January
9401 </p>
9402 !! end
9403
9404 !! test
9405 Magic Word: {{CURRENTTIME}}
9406 !! wikitext
9407 {{CURRENTTIME}}
9408 !! html
9409 <p>00:02
9410 </p>
9411 !! end
9412
9413 !! test
9414 Magic Word: {{CURRENTHOUR}}
9415 !! wikitext
9416 {{CURRENTHOUR}}
9417 !! html
9418 <p>00
9419 </p>
9420 !! end
9421
9422 !! test
9423 Magic Word: {{CURRENTWEEK}} (@bug 4594)
9424 !! wikitext
9425 {{CURRENTWEEK}}
9426 !! html
9427 <p>1
9428 </p>
9429 !! end
9430
9431 !! test
9432 Magic Word: {{CURRENTYEAR}}
9433 !! wikitext
9434 {{CURRENTYEAR}}
9435 !! html
9436 <p>1970
9437 </p>
9438 !! end
9439
9440 !! test
9441 Magic Word: {{CURRENTTIMESTAMP}}
9442 !! wikitext
9443 {{CURRENTTIMESTAMP}}
9444 !! html
9445 <p>19700101000203
9446 </p>
9447 !! end
9448
9449 !! test
9450 Magic Words LOCAL (UTC)
9451 !! wikitext
9452 * {{LOCALMONTH}}
9453 * {{LOCALMONTH1}}
9454 * {{LOCALMONTHNAME}}
9455 * {{LOCALMONTHNAMEGEN}}
9456 * {{LOCALMONTHABBREV}}
9457 * {{LOCALDAY}}
9458 * {{LOCALDAY2}}
9459 * {{LOCALDAYNAME}}
9460 * {{LOCALYEAR}}
9461 * {{LOCALTIME}}
9462 * {{LOCALHOUR}}
9463 * {{LOCALWEEK}}
9464 * {{LOCALDOW}}
9465 * {{LOCALTIMESTAMP}}
9466 !! html
9467 <ul><li> 01</li>
9468 <li> 1</li>
9469 <li> January</li>
9470 <li> January</li>
9471 <li> Jan</li>
9472 <li> 1</li>
9473 <li> 01</li>
9474 <li> Thursday</li>
9475 <li> 1970</li>
9476 <li> 00:02</li>
9477 <li> 00</li>
9478 <li> 1</li>
9479 <li> 4</li>
9480 <li> 19700101000203</li></ul>
9481
9482 !! end
9483
9484 !! test
9485 Magic Word: {{FULLPAGENAME}}
9486 !! options
9487 title=[[User:Ævar Arnfjörð Bjarmason]]
9488 !! wikitext
9489 {{FULLPAGENAME}}
9490 !! html
9491 <p>User:Ævar Arnfjörð Bjarmason
9492 </p>
9493 !! end
9494
9495 !! test
9496 Magic Word: {{FULLPAGENAMEE}}
9497 !! options
9498 title=[[User:Ævar Arnfjörð Bjarmason]]
9499 !! wikitext
9500 {{FULLPAGENAMEE}}
9501 !! html
9502 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9503 </p>
9504 !! end
9505
9506 !! test
9507 Magic Word: {{TALKSPACE}}
9508 !! options
9509 title=[[User:Ævar Arnfjörð Bjarmason]]
9510 !! wikitext
9511 {{TALKSPACE}}
9512 !! html
9513 <p>User talk
9514 </p>
9515 !! end
9516
9517 !! test
9518 Magic Word: {{TALKSPACE}}, same namespace
9519 !! options
9520 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9521 !! wikitext
9522 {{TALKSPACE}}
9523 !! html
9524 <p>User talk
9525 </p>
9526 !! end
9527
9528 !! test
9529 Magic Word: {{TALKSPACE}}, main namespace
9530 !! options
9531 title=[[Parser Test]]
9532 !! wikitext
9533 {{TALKSPACE}}
9534 !! html
9535 <p>Talk
9536 </p>
9537 !! end
9538
9539 !! test
9540 Magic Word: {{TALKSPACEE}}
9541 !! options
9542 title=[[User:Ævar Arnfjörð Bjarmason]]
9543 !! wikitext
9544 {{TALKSPACEE}}
9545 !! html
9546 <p>User_talk
9547 </p>
9548 !! end
9549
9550 !! test
9551 Magic Word: {{SUBJECTSPACE}}
9552 !! options
9553 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9554 !! wikitext
9555 {{SUBJECTSPACE}}
9556 !! html
9557 <p>User
9558 </p>
9559 !! end
9560
9561 !! test
9562 Magic Word: {{SUBJECTSPACE}}, same namespace
9563 !! options
9564 title=[[User:Ævar Arnfjörð Bjarmason]]
9565 !! wikitext
9566 {{SUBJECTSPACE}}
9567 !! html
9568 <p>User
9569 </p>
9570 !! end
9571
9572 !! test
9573 Magic Word: {{SUBJECTSPACE}}, main namespace
9574 !! options
9575 title=[[Parser Test]]
9576 !! wikitext
9577 {{SUBJECTSPACE}}
9578 !! html
9579
9580 !! end
9581
9582 !! test
9583 Magic Word: {{SUBJECTSPACEE}}
9584 !! options
9585 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9586 !! wikitext
9587 {{SUBJECTSPACEE}}
9588 !! html
9589 <p>User
9590 </p>
9591 !! end
9592
9593 !! test
9594 Magic Word: {{NAMESPACE}}
9595 !! options
9596 title=[[User:Ævar Arnfjörð Bjarmason]]
9597 !! wikitext
9598 {{NAMESPACE}}
9599 !! html
9600 <p>User
9601 </p>
9602 !! end
9603
9604 !! test
9605 Magic Word: {{NAMESPACEE}}
9606 !! options
9607 title=[[User:Ævar Arnfjörð Bjarmason]]
9608 !! wikitext
9609 {{NAMESPACEE}}
9610 !! html
9611 <p>User
9612 </p>
9613 !! end
9614
9615 !! test
9616 Magic Word: {{NAMESPACENUMBER}}
9617 !! options
9618 title=[[User:Ævar Arnfjörð Bjarmason]]
9619 !! wikitext
9620 {{NAMESPACENUMBER}}
9621 !! html
9622 <p>2
9623 </p>
9624 !! end
9625
9626 !! test
9627 Magic Word: {{SUBPAGENAME}}
9628 !! options
9629 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9630 !! wikitext
9631 {{SUBPAGENAME}}
9632 !! html
9633 <p>sub ö
9634 </p>
9635 !! end
9636
9637 !! test
9638 Magic Word: {{SUBPAGENAMEE}}
9639 !! options
9640 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9641 !! wikitext
9642 {{SUBPAGENAMEE}}
9643 !! html
9644 <p>sub_%C3%B6
9645 </p>
9646 !! end
9647
9648 !! test
9649 Magic Word: {{ROOTPAGENAME}}
9650 !! options
9651 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9652 !! wikitext
9653 {{ROOTPAGENAME}}
9654 !! html
9655 <p>Ævar Arnfjörð Bjarmason
9656 </p>
9657 !! end
9658
9659 !! test
9660 Magic Word: {{ROOTPAGENAMEE}}
9661 !! options
9662 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9663 !! wikitext
9664 {{ROOTPAGENAMEE}}
9665 !! html
9666 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9667 </p>
9668 !! end
9669
9670 !! test
9671 Magic Word: {{BASEPAGENAME}}
9672 !! options
9673 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9674 !! wikitext
9675 {{BASEPAGENAME}}
9676 !! html
9677 <p>Ævar Arnfjörð Bjarmason
9678 </p>
9679 !! end
9680
9681 !! test
9682 Magic Word: {{BASEPAGENAMEE}}
9683 !! options
9684 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9685 !! wikitext
9686 {{BASEPAGENAMEE}}
9687 !! html
9688 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9689 </p>
9690 !! end
9691
9692 !! test
9693 Magic Word: {{TALKPAGENAME}}
9694 !! options
9695 title=[[User:Ævar Arnfjörð Bjarmason]]
9696 !! wikitext
9697 {{TALKPAGENAME}}
9698 !! html
9699 <p>User talk:Ævar Arnfjörð Bjarmason
9700 </p>
9701 !! end
9702
9703 !! test
9704 Magic Word: {{TALKPAGENAMEE}}
9705 !! options
9706 title=[[User:Ævar Arnfjörð Bjarmason]]
9707 !! wikitext
9708 {{TALKPAGENAMEE}}
9709 !! html
9710 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9711 </p>
9712 !! end
9713
9714 !! test
9715 Magic Word: {{SUBJECTPAGENAME}}
9716 !! options
9717 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9718 !! wikitext
9719 {{SUBJECTPAGENAME}}
9720 !! html
9721 <p>User:Ævar Arnfjörð Bjarmason
9722 </p>
9723 !! end
9724
9725 !! test
9726 Magic Word: {{SUBJECTPAGENAMEE}}
9727 !! options
9728 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9729 !! wikitext
9730 {{SUBJECTPAGENAMEE}}
9731 !! html
9732 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9733 </p>
9734 !! end
9735
9736 !! test
9737 Magic Word: {{NUMBEROFFILES}}
9738 !! wikitext
9739 {{NUMBEROFFILES}}
9740 !! html
9741 <p>6
9742 </p>
9743 !! end
9744
9745 !! test
9746 Magic Word: {{PAGENAME}}
9747 !! options
9748 title=[[User:Ævar Arnfjörð Bjarmason]]
9749 !! wikitext
9750 {{PAGENAME}}
9751 !! html
9752 <p>Ævar Arnfjörð Bjarmason
9753 </p>
9754 !! end
9755
9756 !! test
9757 Magic Word: {{PAGENAME}} with metacharacters
9758 !! options
9759 title=[['foo & bar = baz']]
9760 !! wikitext
9761 ''{{PAGENAME}}''
9762 !! html/php
9763 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
9764 </p>
9765 !! html+tidy
9766 <p><i>'foo &amp; bar = baz'</i></p>
9767 !! end
9768
9769 !! test
9770 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
9771 !! options
9772 title=[[*RFC 1234 http://example.com/]]
9773 !! wikitext
9774 {{PAGENAME}}
9775 !! html/php
9776 <p>&#42;RFC&#32;1234 http&#58;//example.com/
9777 </p>
9778 !! html+tidy
9779 <p>*RFC 1234 http://example.com/</p>
9780 !! end
9781
9782 !! test
9783 Magic Word: {{PAGENAMEE}}
9784 !! options
9785 title=[[User:Ævar Arnfjörð Bjarmason]]
9786 !! wikitext
9787 {{PAGENAMEE}}
9788 !! html
9789 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9790 </p>
9791 !! end
9792
9793 !! test
9794 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
9795 !! options
9796 title=[[*RFC 1234 http://example.com/]]
9797 !! wikitext
9798 {{PAGENAMEE}}
9799 !! html/php
9800 <p>&#42;RFC_1234_http&#58;//example.com/
9801 </p>
9802 !! html+tidy
9803 <p>*RFC_1234_http://example.com/</p>
9804 !! end
9805
9806 !! test
9807 Magic Word: {{REVISIONID}}
9808 !! wikitext
9809 {{REVISIONID}}
9810 !! html
9811 <p>1337
9812 </p>
9813 !! end
9814
9815 !! test
9816 Magic Word: {{SCRIPTPATH}}
9817 !! wikitext
9818 {{SCRIPTPATH}}
9819 !! html
9820
9821 !! end
9822
9823 !! test
9824 Magic Word: {{STYLEPATH}}
9825 !! wikitext
9826 {{STYLEPATH}}
9827 !! html
9828 <p>/skins
9829 </p>
9830 !! end
9831
9832 !! test
9833 Magic Word: {{SERVER}}
9834 !! wikitext
9835 {{SERVER}}
9836 !! html
9837 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9838 </p>
9839 !! end
9840
9841 !! test
9842 Magic Word: {{SERVERNAME}}
9843 !! wikitext
9844 {{SERVERNAME}}
9845 !! html
9846 <p>example.org
9847 </p>
9848 !! end
9849
9850 !! test
9851 Magic Word: {{SITENAME}}
9852 !! wikitext
9853 {{SITENAME}}
9854 !! html
9855 <p>MediaWiki
9856 </p>
9857 !! end
9858
9859 !! test
9860 Case-sensitive magic words, when cased differently, should just be template transclusions
9861 !! wikitext
9862 {{CurrentMonth}}
9863 {{currentday}}
9864 {{cURreNTweEK}}
9865 {{currentHour}}
9866 !! html
9867 <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>
9868 <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>
9869 <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>
9870 <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>
9871 </p>
9872 !! end
9873
9874 !! test
9875 Case-insensitive magic words should still work with weird casing.
9876 !! wikitext
9877 {{sErVeRNaMe}}
9878 {{LCFirst:AOEU}}
9879 {{ucFIRST:aoeu}}
9880 {{SERver}}
9881 !! html
9882 <p>example.org
9883 aOEU
9884 Aoeu
9885 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9886 </p>
9887 !! end
9888
9889 # From plwiki:PLOS_ONE
9890 !! test
9891 Parsoid: Page property magic word with magic word contents
9892 !! wikitext
9893 {{DISPLAYTITLE:''{{PAGENAME}}''}}
9894 !! html/parsoid
9895 <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>"}]]}'/>
9896 !! end
9897
9898 !! test
9899 Parsoid: Template-generated DISPLAYTITLE
9900 !! wikitext
9901 {{{{echo|DISPLAYTITLE}}:Foo}}
9902 !! html/parsoid
9903 <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}}]}'/>
9904 !! end
9905
9906 !! test
9907 Namespace 1 {{ns:1}}
9908 !! wikitext
9909 {{ns:1}}
9910 !! html
9911 <p>Talk
9912 </p>
9913 !! end
9914
9915 !! test
9916 Namespace 1 {{ns:01}}
9917 !! wikitext
9918 {{ns:01}}
9919 !! html
9920 <p>Talk
9921 </p>
9922 !! end
9923
9924 !! test
9925 Namespace 0 {{ns:0}} (bug 4783)
9926 !! wikitext
9927 {{ns:0}}
9928 !! html
9929
9930 !! end
9931
9932 !! test
9933 Namespace 0 {{ns:00}} (bug 4783)
9934 !! wikitext
9935 {{ns:00}}
9936 !! html
9937
9938 !! end
9939
9940 !! test
9941 Namespace -1 {{ns:-1}}
9942 !! wikitext
9943 {{ns:-1}}
9944 !! html
9945 <p>Special
9946 </p>
9947 !! end
9948
9949 !! test
9950 Namespace User {{ns:User}}
9951 !! wikitext
9952 {{ns:User}}
9953 !! html
9954 <p>User
9955 </p>
9956 !! end
9957
9958 !! test
9959 Namespace User talk {{ns:User_talk}}
9960 !! wikitext
9961 {{ns:User_talk}}
9962 !! html
9963 <p>User talk
9964 </p>
9965 !! end
9966
9967 !! test
9968 Namespace User talk {{ns:uSeR tAlK}}
9969 !! wikitext
9970 {{ns:uSeR tAlK}}
9971 !! html
9972 <p>User talk
9973 </p>
9974 !! end
9975
9976 !! test
9977 Namespace File {{ns:File}}
9978 !! wikitext
9979 {{ns:File}}
9980 !! html
9981 <p>File
9982 </p>
9983 !! end
9984
9985 !! test
9986 Namespace File {{ns:Image}}
9987 !! wikitext
9988 {{ns:Image}}
9989 !! html
9990 <p>File
9991 </p>
9992 !! end
9993
9994 !! test
9995 Namespace (lang=de) Benutzer {{ns:User}}
9996 !! options
9997 language=de
9998 !! wikitext
9999 {{ns:User}}
10000 !! html
10001 <p>Benutzer
10002 </p>
10003 !! end
10004
10005 !! test
10006 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
10007 !! options
10008 language=de
10009 !! wikitext
10010 {{ns:3}}
10011 !! html
10012 <p>Benutzer Diskussion
10013 </p>
10014 !! end
10015
10016
10017 !! test
10018 Urlencode
10019 !! wikitext
10020 {{urlencode:hi world?!}}
10021 {{urlencode:hi world?!|WIKI}}
10022 {{urlencode:hi world?!|PATH}}
10023 {{urlencode:hi world?!|QUERY}}
10024 !! html
10025 <p>hi+world%3F%21
10026 hi_world%3F!
10027 hi%20world%3F%21
10028 hi+world%3F%21
10029 </p>
10030 !! end
10031
10032 !! test
10033 Magic Word: prioritize type info over data-parsoid
10034 !! options
10035 parsoid=html2wt
10036 !! html/parsoid
10037 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
10038 !! wikitext
10039 __FORCETOC__
10040 !! end
10041
10042 !! test
10043 Magic Word: serialize on separate line (parsoid)
10044 !! options
10045 parsoid=wt2wt,html2wt
10046 !! wikitext
10047 foo
10048 __NOTOC__
10049 bar
10050 !! html/parsoid
10051 foo<meta property="mw:PageProp/notoc"/>bar
10052 !! end
10053
10054 !! test
10055 Magic Word: rt non-english wikis
10056 !! options
10057 parsoid=wt2wt
10058 language=de
10059 !! wikitext
10060 __NOEDITSECTION__
10061 !! html/parsoid
10062 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
10063 !! end
10064
10065 !!test
10066 __proto__ is treated as normal wikitext (T105997)
10067 !!wikitext
10068 __proto__
10069 !!html
10070 <p>__proto__
10071 </p>
10072 !!end
10073
10074 ###
10075 ### Magic links
10076 ###
10077 !! test
10078 Magic links: internal link to RFC (bug 479)
10079 !! wikitext
10080 [[RFC 123]]
10081 !! html/php
10082 <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>
10083 </p>
10084 !! html/parsoid
10085 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
10086 !! end
10087
10088 !! test
10089 Magic links: RFC (bug 479)
10090 !! wikitext
10091 RFC 822
10092 !! html/php
10093 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10094 </p>
10095 !! html/parsoid
10096 <p><a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a></p>
10097 !! end
10098
10099 !! test
10100 Magic links: RFC (bug 65278)
10101 !! wikitext
10102 This is RFC 822 but thisRFC 822 is not RFC 822linked.
10103 !! html/php
10104 <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.
10105 </p>
10106 !! html/parsoid
10107 <p>This is <a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a> but thisRFC 822 is not RFC 822linked.</p>
10108 !! end
10109
10110 !! test
10111 Magic links: RFC (w/ non-newline whitespace, bug 28950/29025)
10112 !! wikitext
10113 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
10114 RFC
10115 822
10116 !! html/php
10117 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10118 RFC
10119 822
10120 </p>
10121 !! html/parsoid
10122 <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>
10123 RFC
10124 822</p>
10125 !! end
10126
10127 !! test
10128 Magic links: ISBN (bug 1937)
10129 !! wikitext
10130 ISBN 0-306-40615-2
10131 !! html/php
10132 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
10133 </p>
10134 !! html/parsoid
10135 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
10136 !! end
10137
10138 !! test
10139 Magic links: ISBN (bug 65278)
10140 !! wikitext
10141 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
10142 !! html/php
10143 <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.
10144 </p>
10145 !! html/parsoid
10146 <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>
10147 !! end
10148
10149 !! test
10150 Magic links: ISBN (w/ non-newline whitespace, bug 28950/29025)
10151 !! wikitext
10152 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
10153 ISBN
10154 9780316098113
10155 ISBN 978
10156 0316098113
10157 !! html/php
10158 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
10159 ISBN
10160 9780316098113
10161 ISBN 978
10162 0316098113
10163 </p>
10164 !! html/parsoid
10165 <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>
10166 ISBN
10167 9780316098113
10168 ISBN 978
10169 0316098113</p>
10170 !! end
10171
10172 !! test
10173 Magic links: PMID incorrectly converts space to underscore
10174 !! wikitext
10175 PMID 1234
10176 !! html/php
10177 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10178 </p>
10179 !! html/parsoid
10180 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a></p>
10181 !! end
10182
10183 !! test
10184 Magic links: PMID (bug 65278)
10185 !! wikitext
10186 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
10187 !! html/php
10188 <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.
10189 </p>
10190 !! html/parsoid
10191 <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>
10192 !! end
10193
10194 !! test
10195 Magic links: PMID (w/ non-newline whitespace, bug 28950/29025)
10196 !! wikitext
10197 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
10198 PMID
10199 1234
10200 !! html/php
10201 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10202 PMID
10203 1234
10204 </p>
10205 !! html/parsoid
10206 <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>
10207 PMID
10208 1234</p>
10209 !! end
10210
10211 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
10212 # since these are ExtLinkText, not MagicLinkText
10213 !! test
10214 Magic links: use appropriate serialization for "almost" magic links.
10215 !! wikitext
10216 X[[Special:BookSources/0978739256|foo]]
10217
10218 X[//tools.ietf.org/html/rfc1234 foo]
10219 !! html/php
10220 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
10221 </p><p>X<a rel="nofollow" class="external text" href="//tools.ietf.org/html/rfc1234">foo</a>
10222 </p>
10223 !! html/parsoid
10224 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
10225 <p>X<a rel="mw:ExtLink" href="//tools.ietf.org/html/rfc1234">foo</a></p>
10226 !! end
10227
10228 ###
10229 ### Templates
10230 ####
10231
10232 !! test
10233 Nonexistent template
10234 !! wikitext
10235 {{thistemplatedoesnotexist}}
10236 !! html
10237 <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>
10238 </p>
10239 !! end
10240
10241 !! test
10242 Template with invalid target containing tags
10243 !! wikitext
10244 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10245 !! html
10246 <p>{{a<b>b</b>|foo|a=b|a = b}}
10247 </p>
10248 !! end
10249
10250 !! test
10251 Template with invalid target containing unclosed tag
10252 !! wikitext
10253 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10254 !! html
10255 <p>{{a<b>|foo|a=b|a = b}}</b>
10256 </p>
10257 !! end
10258
10259 !! test
10260 Template with invalid target containing wikilink
10261 !! wikitext
10262 {{[[Main Page]]}}
10263 !! html/php
10264 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
10265 </p>
10266 !! html/parsoid
10267 <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>
10268 !! end
10269
10270 !! test
10271 Template with just whitespace in it, bug #68421
10272 !! wikitext
10273 {{echo|{{ }}}}
10274 !! html/parsoid
10275 <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>
10276 !! end
10277
10278 !! article
10279 Template:test
10280 !! text
10281 This is a test template
10282 !! endarticle
10283
10284 !! test
10285 Simple template
10286 !! wikitext
10287 {{test}}
10288 !! html
10289 <p>This is a test template
10290 </p>
10291 !! end
10292
10293 !! test
10294 Template with explicit namespace
10295 !! wikitext
10296 {{Template:test}}
10297 !! html
10298 <p>This is a test template
10299 </p>
10300 !! end
10301
10302
10303 !! article
10304 Template:paramtest
10305 !! text
10306 This is a test template with parameter {{{param}}}
10307 !! endarticle
10308
10309 !! test
10310 Template parameter
10311 !! wikitext
10312 {{paramtest|param=foo}}
10313 !! html
10314 <p>This is a test template with parameter foo
10315 </p>
10316 !! end
10317
10318 !! article
10319 Template:paramtestnum
10320 !! text
10321 [[{{{1}}}|{{{2}}}]]
10322 !! endarticle
10323
10324 !! test
10325 Template unnamed parameter
10326 !! wikitext
10327 {{paramtestnum|Main Page|the main page}}
10328 !! html
10329 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
10330 </p>
10331 !! end
10332
10333 !! article
10334 Template:templatesimple
10335 !! text
10336 (test)
10337 !! endarticle
10338
10339 !! article
10340 Template:templateredirect
10341 !! text
10342 #redirect [[Template:templatesimple]]
10343 !! endarticle
10344
10345 !! article
10346 Template:templateasargtestnum
10347 !! text
10348 {{{{{1}}}}}
10349 !! endarticle
10350
10351 !! article
10352 Template:templateasargtest
10353 !! text
10354 {{template{{{templ}}}}}
10355 !! endarticle
10356
10357 !! article
10358 Template:templateasargtest2
10359 !! text
10360 {{{{{templ}}}}}
10361 !! endarticle
10362
10363 !! test
10364 Template with template name as unnamed argument
10365 !! wikitext
10366 {{templateasargtestnum|templatesimple}}
10367 !! html
10368 <p>(test)
10369 </p>
10370 !! end
10371
10372 !! test
10373 Template with template name as argument
10374 !! wikitext
10375 {{templateasargtest|templ=simple}}
10376 !! html
10377 <p>(test)
10378 </p>
10379 !! end
10380
10381 !! test
10382 Template with template name as argument (2)
10383 !! wikitext
10384 {{templateasargtest2|templ=templatesimple}}
10385 !! html
10386 <p>(test)
10387 </p>
10388 !! end
10389
10390 !! article
10391 Template:templateasargtestdefault
10392 !! text
10393 {{{{{templ|templatesimple}}}}}
10394 !! endarticle
10395
10396 !! article
10397 Template:templa
10398 !! text
10399 '''templ'''
10400 !! endarticle
10401
10402 !! test
10403 Template with default value
10404 !! wikitext
10405 {{templateasargtestdefault}}
10406 !! html
10407 <p>(test)
10408 </p>
10409 !! end
10410
10411 !! test
10412 Template with default value (value set)
10413 !! wikitext
10414 {{templateasargtestdefault|templ=templa}}
10415 !! html
10416 <p><b>templ</b>
10417 </p>
10418 !! end
10419
10420 !! test
10421 Template redirect
10422 !! wikitext
10423 {{templateredirect}}
10424 !! html/php
10425 <p>(test)
10426 </p>
10427 !! html/parsoid
10428 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
10429 !! end
10430
10431 !! test
10432 Template with argument in separate line
10433 !! wikitext
10434 {{ templateasargtest |
10435 templ = simple }}
10436 !! html
10437 <p>(test)
10438 </p>
10439 !! end
10440
10441 !! test
10442 Template with complex template as argument
10443 !! wikitext
10444 {{paramtest|
10445 param ={{ templateasargtest |
10446 templ = simple }}}}
10447 !! html
10448 <p>This is a test template with parameter (test)
10449 </p>
10450 !! end
10451
10452 !! test
10453 Template with thumb image (with link in description)
10454 !! wikitext
10455 {{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
10456 !! html/php
10457 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>
10458
10459 !! html+tidy
10460 <p>This is a test template with parameter</p>
10461 <div class="thumb tright">
10462 <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>
10463 <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>
10464 </div>
10465 </div>
10466 !! html/parsoid
10467 <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>
10468 !! end
10469
10470 !! article
10471 Template:complextemplate
10472 !! text
10473 {{{1}}} {{paramtest|
10474 param ={{{param}}}}}
10475 !! endarticle
10476
10477 !! test
10478 Template with complex arguments
10479 !! wikitext
10480 {{complextemplate|
10481 param ={{ templateasargtest |
10482 templ = simple }}|[[Template:complextemplate|link]]}}
10483 !! html
10484 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
10485 </p>
10486 !! end
10487
10488 !! test
10489 BUG 553: link with two variables in a piped link
10490 !! wikitext
10491 {|
10492 |[[{{{1}}}|{{{2}}}]]
10493 |}
10494 !! html/php
10495 <table>
10496 <tr>
10497 <td>[[{{{1}}}|{{{2}}}]]
10498 </td></tr></table>
10499
10500 !! html/parsoid
10501 <table>
10502 <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>
10503 !! end
10504
10505 # See: T2553
10506 !! test
10507 Abort table cell attribute parsing on wikilink
10508 !! wikitext
10509 {|
10510 | testing [[one|two]] | three || four
10511 | testing one two | three || four
10512 |}
10513 !! html/php
10514 <table>
10515 <tr>
10516 <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>
10517 <td> four
10518 </td>
10519 <td> three </td>
10520 <td> four
10521 </td></tr></table>
10522
10523 !! html/parsoid
10524 <table>
10525 <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>
10526 <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>
10527 </tbody></table>
10528 !! end
10529
10530 !! test
10531 Don't abort table cell attribute parsing if wikilink is found in template arg
10532 !! wikitext
10533 {|
10534 | Test {{#tag:ref|One two "[[three]]" four}}
10535 |}
10536 !! html/parsoid
10537 <table>
10538 <tbody><tr><td> Test <ref about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"#tag:ref","function":"#tag"},"params":{"1":{"wt":"One two \"[[three]]\" four"}},"i":0}}]}'>One two "<a rel="mw:WikiLink" href="./Three" title="Three">three</a>" four</ref></td></tr>
10539 </tbody></table>
10540 !! end
10541
10542 !! test
10543 Magic variable as template parameter
10544 !! wikitext
10545 {{paramtest|param={{SITENAME}}}}
10546 !! html
10547 <p>This is a test template with parameter MediaWiki
10548 </p>
10549 !! end
10550
10551 !! article
10552 Template:linktest
10553 !! text
10554 [[{{{param}}}|link]]
10555 !! endarticle
10556
10557 !! test
10558 Template parameter as link source
10559 !! wikitext
10560 {{linktest|param=Main Page}}
10561 !! html
10562 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
10563 </p>
10564 !! end
10565
10566 !!article
10567 Template:paramtest2
10568 !! text
10569 including another template, {{paramtest|param={{{arg}}}}}
10570 !! endarticle
10571
10572 !! test
10573 Template passing argument to another template
10574 !! wikitext
10575 {{paramtest2|arg='hmm'}}
10576 !! html
10577 <p>including another template, This is a test template with parameter 'hmm'
10578 </p>
10579 !! end
10580
10581 !! article
10582 Template:Linktest2
10583 !! text
10584 Main Page
10585 !! endarticle
10586
10587 !! test
10588 Template as link source
10589 !! wikitext
10590 [[{{linktest2}}]]
10591
10592 [[{{linktest2}}|Main Page]]
10593
10594 [[{{linktest2}}]]Page
10595 !! html
10596 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10597 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10598 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
10599 </p>
10600 !! end
10601
10602
10603 !! article
10604 Template:loop1
10605 !! text
10606 {{loop2}}
10607 !! endarticle
10608
10609 !! article
10610 Template:loop2
10611 !! text
10612 {{loop1}}
10613 !! endarticle
10614
10615 !! test
10616 Template infinite loop
10617 !! wikitext
10618 {{loop1}}
10619 !! html
10620 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
10621 </p>
10622 !! end
10623
10624 !! test
10625 Template from main namespace
10626 !! wikitext
10627 {{:Main Page}}
10628 !! html
10629 <p>blah blah
10630 </p>
10631 !! end
10632
10633 !! article
10634 Template:table
10635 !! text
10636 {|
10637 | 1 || 2
10638 |-
10639 | 3 || 4
10640 |}
10641 !! endarticle
10642
10643 !! test
10644 BUG 529: Template with table, not included at beginning of line
10645 !! wikitext
10646 foo {{table}}
10647 !! html
10648 <p>foo
10649 </p>
10650 <table>
10651 <tr>
10652 <td> 1 </td>
10653 <td> 2
10654 </td></tr>
10655 <tr>
10656 <td> 3 </td>
10657 <td> 4
10658 </td></tr></table>
10659
10660 !! end
10661
10662 !! test
10663 BUG 523: Template shouldn't eat newline (or add an extra one before table)
10664 !! wikitext
10665 foo
10666 {{table}}
10667 !! html
10668 <p>foo
10669 </p>
10670 <table>
10671 <tr>
10672 <td> 1 </td>
10673 <td> 2
10674 </td></tr>
10675 <tr>
10676 <td> 3 </td>
10677 <td> 4
10678 </td></tr></table>
10679
10680 !! end
10681
10682 !! test
10683 BUG 41: Template parameters shown as broken links
10684 !! wikitext
10685 {{{parameter}}}
10686 !! html
10687 <p>{{{parameter}}}
10688 </p>
10689 !! end
10690
10691 !! test
10692 Template with targets containing wikilinks
10693 !! wikitext
10694 {{[[foo]]}}
10695
10696 {{[[{{echo|foo}}]]}}
10697
10698 {{{{echo|[[foo}}]]}}
10699 !! html
10700 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10701 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10702 </p><p>{{[[foo}}]]
10703 </p>
10704 !! end
10705
10706 !! article
10707 Template:''
10708 !! text
10709 bar
10710 !! endarticle
10711
10712 !! test
10713 Templates: Double quotes as template target
10714 !! wikitext
10715 foo {{''}} baz
10716 !! html/php
10717 <p>foo bar baz
10718 </p>
10719 !! html/parsoid
10720 <p>foo <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"&#39;&#39;"},"params":{},"i":0}}]}'>bar</span> baz
10721 </p>
10722 !! end
10723
10724 ## This test is about making sure Parsoid's data-mw is well formed in the
10725 ## face of multiple templates with intersecting and overlapping ranges. The
10726 ## wikitext itself is wretched.
10727 !! test
10728 Templates with intersecting and overlapping ranges
10729 !! wikitext
10730 {|{{echo|
10731 <p>ha</p>}}
10732 {|{{echo|
10733 <p>ho</p>}}
10734 {{echo|{{!}}hi}}
10735 |}
10736 !! html/php+tidy
10737 <p>ha</p>
10738 <p>ho</p>
10739 <table>
10740 <tr>
10741 <td></td>
10742 </tr>
10743 <tr>
10744 <td>hi</td>
10745 </tr>
10746 </table>
10747 <table>
10748 <tr>
10749 <td></td>
10750 </tr>
10751 </table>
10752 !! html/parsoid
10753 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[{"k":"1"}],[{"k":"1"}],[{"k":"1"}]],"firstWikitextNode":"table"}' data-mw='{"parts":["{|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"\n&lt;p>ha&lt;/p>"}},"i":0}},"\n","{|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"\n&lt;p>ho&lt;/p>"}},"i":1}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{!}}hi"}},"i":2}},"\n|}"]}'>ha</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
10754
10755 </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
10756
10757 <tbody><tr><td>hi</td></tr>
10758 </tbody></table>
10759 !! end
10760
10761 !! article
10762 Template:MSGNW test
10763 !! text
10764 ''None'' of '''this''' should be
10765 * interpreted
10766 but rather passed unmodified
10767 {{test}}
10768 <gallery>
10769 File:Foobar.jpg
10770 </gallery>
10771 <!-- comment -->
10772 !! endarticle
10773
10774 # hmm, fix this or just deprecate msgnw and document its behavior?
10775 !! test
10776 msgnw keyword
10777 !! wikitext
10778 {{msgnw:MSGNW test}}
10779 !! html/php
10780 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
10781 &#42; interpreted
10782 &#32;but rather passed unmodified
10783 &#123;&#123;test&#125;&#125;
10784 &#60;gallery&#62;
10785 File:Foobar.jpg
10786 &#60;/gallery&#62;
10787 &#60;!-- comment --&#62;
10788 </p>
10789 !! end
10790
10791 !! test
10792 int keyword
10793 !! wikitext
10794 {{int:youhavenewmessages|lots of money|not!}}
10795 !! html
10796 <p>You have lots of money (not!).
10797 </p>
10798 !! end
10799
10800 !! test
10801 int keyword - non-existing message
10802 !! wikitext
10803 {{int:var}}
10804 !! html
10805 <p>&lt;var&gt;
10806 </p>
10807 !! end
10808
10809 !! article
10810 Template:Includes
10811 !! text
10812 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
10813 !! endarticle
10814
10815 !! test
10816 <includeonly> and <noinclude> being included
10817 !! wikitext
10818 {{Includes}}
10819 !! html
10820 <p>Foobar
10821 </p>
10822 !! end
10823
10824 !! article
10825 Template:Includes2
10826 !! text
10827 <onlyinclude>Foo</onlyinclude>bar
10828 !! endarticle
10829
10830 !! test
10831 <onlyinclude> being included
10832 !! wikitext
10833 {{Includes2}}
10834 !! html
10835 <p>Foo
10836 </p>
10837 !! end
10838
10839
10840 !! article
10841 Template:Includes3
10842 !! text
10843 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
10844 !! endarticle
10845
10846 !! test
10847 <onlyinclude> and <includeonly> being included
10848 !! wikitext
10849 {{Includes3}}
10850 !! html
10851 <p>Foo
10852 </p>
10853 !! end
10854
10855 !! test
10856 <includeonly> and <noinclude> on a page
10857 !! wikitext
10858 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
10859 !! html
10860 <p>Foozar
10861 </p>
10862 !! end
10863
10864 !! test
10865 Un-closed <noinclude>
10866 !! wikitext
10867 <noinclude>
10868 !! html
10869 !! end
10870
10871 !! test
10872 <onlyinclude> on a page
10873 !! wikitext
10874 <onlyinclude>Foo</onlyinclude>bar
10875 !! html
10876 <p>Foobar
10877 </p>
10878 !! end
10879
10880 !! test
10881 Un-closed <onlyinclude>
10882 !! wikitext
10883 <onlyinclude>
10884 !! html
10885 !! end
10886
10887 !!test
10888 Self-closed noinclude, includeonly, onlyinclude tags
10889 !! wikitext
10890 <noinclude />
10891 <includeonly />
10892 <onlyinclude />
10893 !! html
10894 <p><br />
10895 </p>
10896 !!end
10897
10898 !!test
10899 Unbalanced includeonly and noinclude tags
10900 !! wikitext
10901 {|
10902 |a</noinclude>
10903 |b</noinclude></noinclude>
10904 |c</noinclude></includeonly>
10905 |d</includeonly></includeonly>
10906 |}
10907 !! html
10908 <table>
10909 <tr>
10910 <td>a
10911 </td>
10912 <td>b
10913 </td>
10914 <td>c&lt;/includeonly&gt;
10915 </td>
10916 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
10917 </td></tr></table>
10918
10919 !!end
10920
10921 !! article
10922 Template:Includeonly section
10923 !! text
10924 <includeonly>
10925 ==Includeonly section==
10926 </includeonly>
10927 ==Section T-1==
10928 !!endarticle
10929
10930 !! test
10931 Bug 6563: Edit link generation for section shown by <includeonly>
10932 !! wikitext
10933 {{includeonly section}}
10934 !! html
10935 <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>
10936 <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>
10937
10938 !! end
10939
10940 # Uses same input as the contents of [[Template:Includeonly section]]
10941 !! test
10942 Bug 6563: Section extraction for section shown by <includeonly>
10943 !! options
10944 section=T-2
10945 !! wikitext
10946 <includeonly>
10947 ==Includeonly section==
10948 </includeonly>
10949 ==Section T-2==
10950 !! html
10951 ==Section T-2==
10952 !! end
10953
10954 !! test
10955 Bug 6563: Edit link generation for section suppressed by <includeonly>
10956 !! wikitext
10957 <includeonly>
10958 ==Includeonly section==
10959 </includeonly>
10960 ==Section 1==
10961 !! html
10962 <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>
10963
10964 !! end
10965
10966 !! test
10967 Bug 6563: Section extraction for section suppressed by <includeonly>
10968 !! options
10969 section=1
10970 !! wikitext
10971 <includeonly>
10972 ==Includeonly section==
10973 </includeonly>
10974 ==Section 1==
10975 !! html
10976 ==Section 1==
10977 !! end
10978
10979 !! test
10980 Un-closed <includeonly>
10981 !! wikitext
10982 <includeonly>
10983 !! html/php
10984 !! html/parsoid
10985 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>"}'/>
10986 !! end
10987
10988 ## We used to, but no longer wt2wt this test since the default serializer
10989 ## will normalize the include directives to serialize on their own line.
10990 ## Selser will take care of preserving formatting in scenarios where they
10991 ## intermingled with other wikitext.
10992 !! test
10993 Includes and comments at SOL
10994 !! options
10995 parsoid=wt2html,html2html
10996 !! wikitext
10997 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
10998
10999 <noinclude>
11000 some
11001 </noinclude>* stuff
11002 * here
11003
11004 <includeonly>can have stuff</includeonly>=== here ===
11005
11006 !! html/php
11007 <h2><span class="mw-headline" id="hu">hu</span></h2>
11008 <p>some
11009 </p>
11010 <ul><li> stuff</li>
11011 <li> here</li></ul>
11012 <h3><span class="mw-headline" id="here">here</span></h3>
11013
11014 !! html/parsoid
11015 <!-- 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>
11016
11017 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
11018 <p>some</p>
11019 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
11020 <li> here</li></ul>
11021
11022 <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>
11023
11024 !! end
11025
11026 # TODO: test with DOM fragment reuse!
11027 !! test
11028 Parsoid: DOM fragment reuse
11029 !! options
11030 parsoid=wt2wt,wt2html
11031 !! wikitext
11032 a{{echo|b<table></table>c}}d
11033
11034 a{{echo|b
11035 <table></table>
11036 c}}d
11037
11038 {{echo|a
11039
11040 <table></table>
11041
11042 b}}
11043 !! html
11044 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":["a",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b&lt;table>&lt;/table>c"}},"i":0}},"d"]}' data-parsoid='{"pi":[[{"k":"1"}]]}'>ab</p><table about="#mwt1" data-parsoid='{"stx":"html"}'></table><p about="#mwt1">cd</p>
11045
11046 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":["a",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b\n&lt;table>&lt;/table>\nc"}},"i":0}},"d"]}' data-parsoid='{"pi":[[{"k":"1"}]]}'>ab</p><span about="#mwt2">
11047 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
11048 </span><p about="#mwt2">cd</p>
11049
11050 <p about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n\n&lt;table>&lt;/table>\n\nb"}},"i":0}}]}' data-parsoid='{"pi":[[{"k":"1"}]]}'>a</p><span about="#mwt3">
11051
11052 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
11053
11054 </span><p about="#mwt3">b</p>
11055 !! end
11056
11057 !! test
11058 Parsoid: Merge double tds (T52603)
11059 !! options
11060 parsoid
11061 !! wikitext
11062 {|
11063 |{{echo|{{!}} foo}}
11064 |}
11065 !! html
11066 <table><tbody>
11067 <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>
11068 </tbody></table>
11069 !! end
11070
11071 !! test
11072 Parsoid: Merge double tds in nested transclusion content (T52603)
11073 !! options
11074 parsoid
11075 !! wikitext
11076 {{echo|<div>}}
11077 {|
11078 |{{echo|{{!}} foo}}
11079 |}
11080 {{echo|</div>}}
11081 !! html
11082 <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}}]}'>
11083 <table><tbody>
11084 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
11085 </tbody></table>
11086 </div>
11087 !! end
11088
11089 ###
11090 ### <includeonly> and <noinclude> in attributes
11091 ###
11092 !!test
11093 0. includeonly around the entire attribute
11094 !! wikitext
11095 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
11096 !! html
11097 <p><span id="v2">bar</span>
11098 </p>
11099 !!end
11100
11101 !!test
11102 1. includeonly in html attr key
11103 !! wikitext
11104 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
11105 !! html
11106 <p><span id="foo">bar</span>
11107 </p>
11108 !!end
11109
11110 !!test
11111 2. includeonly in html attr value
11112 !! wikitext
11113 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
11114 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
11115 !! html
11116 <p><span id="v1">bar</span>
11117 <span id="v1">bar</span>
11118 </p>
11119 !!end
11120
11121 !!test
11122 3. includeonly in part of an attr value
11123 !! wikitext
11124 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
11125 !! html
11126 <p><span style="color:red;">bar</span>
11127 </p>
11128 !!end
11129
11130 !!test
11131 4. includeonly in table attributes
11132 !! wikitext
11133 {|
11134 |- <noinclude>
11135 |-
11136 |a
11137 </noinclude>
11138 |- <includeonly>
11139 |-
11140 |b
11141 </includeonly>
11142 |}
11143 !! html
11144 <table>
11145
11146
11147 <tr>
11148 <td>a
11149 </td></tr>
11150 </table>
11151
11152 !!end
11153
11154 ###
11155 ### Token Stream Patcher tests
11156 ###
11157 ### These tests won't always pass wt2wt and other modes because
11158 ### on serialization, the table will be output on a new line.
11159 ### For now, we are blacklisting them, and using this to test selser.
11160 ###
11161
11162 !!test
11163 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
11164 !!options
11165 parsoid=wt2html,wt2wt
11166 !!wikitext
11167 {{echo|}}{| width = '100%'
11168 |foo
11169 |}
11170 !!html/parsoid
11171 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
11172 <tbody><tr><td>foo</td></tr>
11173 </tbody></table>
11174 !!end
11175
11176 ## We used to, but no longer wt2wt this test since the default serializer
11177 ## will normalize the include directives to serialize on their own line.
11178 ## Selser will take care of preserving formatting in scenarios where they
11179 ## intermingled with other wikitext.
11180 !!test
11181 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
11182 !!options
11183 parsoid=wt2html
11184 !!wikitext
11185 <includeonly>a</includeonly>{| {{{b}}}
11186 |c
11187 |}
11188 !!html/parsoid
11189 <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}}}":""}}'>
11190 <tbody><tr><td>c</td></tr>
11191 </tbody></table>
11192
11193 !!end
11194
11195 ###
11196 ### Testing parsing of templates where a template arg
11197 ### has the same name as the template itself.
11198 ###
11199
11200 !! article
11201 Template:quote
11202 !! text
11203 {{{quote|{{{1}}}}}}
11204 !! endarticle
11205
11206 !!test
11207 Templates: Template Name/Arg clash: 1. Use of positional param
11208 !! wikitext
11209 {{quote|foo}}
11210 !! html
11211 <p>foo
11212 </p>
11213 !!end
11214
11215 !!test
11216 Templates: Template Name/Arg clash: 2. Use of named param
11217 !! wikitext
11218 {{quote|quote=foo}}
11219 !! html
11220 <p>foo
11221 </p>
11222 !!end
11223
11224 !!test
11225 Templates: Template Name/Arg clash: 3. Use of named param with empty input
11226 !! wikitext
11227 {{quote|quote}}
11228 !! html
11229 <p>quote
11230 </p>
11231 !!end
11232
11233 ###
11234 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
11235 ###
11236
11237 !!test
11238 Templates: 1. Simple use
11239 !! wikitext
11240 {{echo|Foo}}
11241 !! html
11242 <p>Foo
11243 </p>
11244 !!end
11245
11246 !!test
11247 Templates: 2. Inside a block tag
11248 !! wikitext
11249 <div>{{echo|Foo}}</div>
11250 <blockquote>{{echo|Foo}}</blockquote>
11251 !! html
11252 <div>Foo</div>
11253 <blockquote>Foo</blockquote>
11254
11255 !! html+tidy
11256 <div>Foo</div>
11257 <blockquote>
11258 <p>Foo</p>
11259 </blockquote>
11260 !!end
11261
11262 !!test
11263 Templates: P-wrapping: 1a. Templates on consecutive lines
11264 !! wikitext
11265 {{echo|Foo}}
11266 {{echo|bar}}
11267 !! html
11268 <p>Foo
11269 bar
11270 </p>
11271 !!end
11272
11273 !!test
11274 Templates: P-wrapping: 1b. Templates on consecutive lines
11275 !! wikitext
11276 Foo
11277
11278 {{echo|bar}}
11279 {{echo|baz}}
11280 !! html
11281 <p>Foo
11282 </p><p>bar
11283 baz
11284 </p>
11285 !!end
11286
11287 !!test
11288 Templates: P-wrapping: 1c. Templates on consecutive lines
11289 !! wikitext
11290 {{echo|Foo}}
11291 {{echo|bar}} <div>baz</div>
11292 !! html
11293 <p>Foo
11294 </p>
11295 bar <div>baz</div>
11296
11297 !! html+tidy
11298 <p>Foo</p>
11299 <p>bar</p>
11300 <div>baz</div>
11301 !! end
11302
11303 !!test
11304 Templates: P-wrapping: 1d. Template preceded by comment-only line
11305 !!options
11306 parsoid
11307 !! wikitext
11308 <!-- foo -->
11309 {{echo|Bar}}
11310 !! html
11311 <!-- foo -->
11312
11313 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
11314 !!end
11315
11316 !!test
11317 Templates: Inline Text: 1. Multiple template uses
11318 !! wikitext
11319 {{echo|Foo}}bar{{echo|baz}}
11320 !! html
11321 <p>Foobarbaz
11322 </p>
11323 !!end
11324
11325 !!test
11326 Templates: Inline Text: 2. Back-to-back template uses
11327 !! wikitext
11328 {{echo|Foo}}{{echo|bar}}
11329 !! html
11330 <p>Foobar
11331 </p>
11332 !!end
11333
11334 !!test
11335 Templates: Block Tags: 1. Multiple template uses
11336 !! wikitext
11337 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
11338 !! html
11339 <div>Foo</div><div>bar</div><div>baz</div>
11340
11341 !!end
11342
11343 !!test
11344 Templates: Block Tags: 2. Back-to-back template uses
11345 !! wikitext
11346 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
11347 !! html
11348 <div>Foo</div><div>bar</div>
11349
11350 !!end
11351
11352 # This is an edge case relating to paragraph wrapping.
11353 !!test
11354 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
11355 !! wikitext
11356 {{echo|a
11357 b</p>}}
11358 !! html/parsoid
11359 <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
11360 b</p>
11361 !!end
11362
11363 !!test
11364 Templates: Links: 1. Simple example
11365 !! wikitext
11366 {{echo|[[Foo|bar]]}}
11367 !! html
11368 <p><a href="/wiki/Foo" title="Foo">bar</a>
11369 </p>
11370 !!end
11371
11372 !!test
11373 Templates: Links: 2. Generation of link href
11374 !! wikitext
11375 [[{{echo|Foo}}|bar]]
11376 !! html
11377 <p><a href="/wiki/Foo" title="Foo">bar</a>
11378 </p>
11379 !!end
11380
11381 !!test
11382 Templates: Links: 3. Generation of part of a link href
11383 !! wikitext
11384 [[Fo{{echo|o}}|bar]]
11385
11386 [[Foo{{echo|bar}}]]
11387
11388 [[Foo{{echo|bar}}baz]]
11389
11390 [[Foo{{echo|bar}}|bar]]
11391
11392 [[:Foo{{echo|bar}}]]
11393
11394 [[:Foo{{echo|bar}}|bar]]
11395 !! html
11396 <p><a href="/wiki/Foo" title="Foo">bar</a>
11397 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11398 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
11399 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11400 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11401 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11402 </p>
11403 !!end
11404
11405 !!test
11406 Templates: Links: 4. Multiple templates generating link href
11407 !! wikitext
11408 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
11409 !! html
11410 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11411 </p>
11412 !!end
11413
11414 !!test
11415 Templates: Links: 5. Generation of link text
11416 !! wikitext
11417 [[Foo|{{echo|bar}}]]
11418 !! html
11419 <p><a href="/wiki/Foo" title="Foo">bar</a>
11420 </p>
11421 !!end
11422
11423 !!test
11424 Templates: Links: 5. Nested templates (only outermost template should be marked)
11425 !! wikitext
11426 {{echo|[[{{echo|Foo}}|bar]]}}
11427 !! html
11428 <p><a href="/wiki/Foo" title="Foo">bar</a>
11429 </p>
11430 !!end
11431
11432 !!test
11433 Templates: HTML Tag: 1. Generation of HTML attr. key
11434 !! wikitext
11435 <div {{echo|style}}="color:red;">foo</div>
11436 !! html
11437 <div style="color:red;">foo</div>
11438
11439 !!end
11440
11441 !!test
11442 Templates: HTML Tag: 2. Generation of HTML attr. value
11443 !! wikitext
11444 <div style={{echo|'color:red;'}}>foo</div>
11445 !! html
11446 <div style="color:red;">foo</div>
11447
11448 !!end
11449
11450 !!test
11451 Templates: HTML Tag: 3. Generation of HTML attr key and value
11452 !! wikitext
11453 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
11454 !! html
11455 <div style="color:red;">foo</div>
11456
11457 !!end
11458
11459 !!test
11460 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
11461 !! wikitext
11462 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
11463 !! html
11464 <div title="This is a long title with just one piece templated">foo</div>
11465
11466 !!end
11467
11468 !!test
11469 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
11470 !! wikitext
11471 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
11472 !! html
11473 <div title="This is a long title with just one piece templated">foo</div>
11474
11475 !!end
11476
11477 !!test
11478 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
11479 !! wikitext
11480 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
11481 !! html
11482 <div title="This is a long title with just one piece templated">foo</div>
11483
11484 !!end
11485
11486 # SSS FIXME: While it is great we added support for all this,
11487 # do we want to make this part of the spec? Maybe we want to
11488 # deprecate this kind of usage in the future?
11489 !!test
11490 Templates: HTML Tag: 7. Generation of partial attribute key string
11491 !! wikitext
11492 <div st{{echo|yle}}="color:red;">foo</div>
11493 !! html
11494 <div style="color:red;">foo</div>
11495
11496 !!end
11497
11498 !! test
11499 Templates: HTML Tag: 8. Template-generated attribute (k=v)
11500 !! wikitext
11501 <div {{echo|1=id="v1"}}>bar</div>
11502 !! html
11503 <div id="v1">bar</div>
11504
11505 !!end
11506
11507 !! test
11508 Templates: HTML Tag: 9. Multiple template-generated attributes
11509 !! wikitext
11510 <div {{echo|1=id="v1" title="foo"}}>bar</div>
11511 !! html
11512 <div id="v1" title="foo">bar</div>
11513
11514 !!end
11515
11516 !! test
11517 Templates: Support for templates generating attributes and content
11518 !! wikitext
11519 {| {{mixed_attr_content_template}}
11520 |-
11521 |bar
11522 |}
11523 !! html/php
11524 <table style="color:red;" title="T48811">
11525
11526 <tr>
11527 <td>foo
11528 </td></tr>
11529 <tr>
11530 <td>bar
11531 </td></tr></table>
11532
11533 !! html/parsoid
11534 <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|}"]}'>
11535 <tbody><tr>
11536 <td>foo</td></tr>
11537 <tr>
11538 <td>bar</td></tr>
11539 </tbody></table>
11540 !!end
11541
11542 !! test
11543 1. Entities and nowikis inside templated attributes should be handled correctly
11544 !! wikitext
11545 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
11546 !! html/php
11547 <div style="background:#f9f9f9;">foo</div>
11548
11549 !! html/parsoid
11550 <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;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>
11551 !! end
11552
11553 !! test
11554 2. Entities and nowikis inside templated attributes should be handled correctly
11555 !! wikitext
11556 {|
11557 |{{table_attribs_3}}
11558 |}
11559 !! html/php
11560 <table>
11561 <tr>
11562 <td style="background:#f9f9f9;">Foo
11563 </td></tr></table>
11564
11565 !! html/parsoid
11566 <table>
11567 <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>
11568 </tbody></table>
11569 !! end
11570
11571 !! test
11572 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11573 !! wikitext
11574 {{tbl-start}}
11575 |{{table_attribs_3}}
11576 {{tbl-end}}
11577 !! html/php
11578 <table>
11579 <tr>
11580 <td style="background:#f9f9f9;">Foo
11581 </td></tr></table>
11582
11583 !! html/parsoid
11584 <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}}]}'>
11585 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
11586 </tbody></table>
11587 !! end
11588
11589 # T107622
11590 !! test
11591 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11592 !! wikitext
11593 {|
11594 | {{table_attribs_6}} hi
11595 |}
11596 !! html/php
11597 <table>
11598 <tr>
11599 <td style="background: red;"> hi
11600 </td></tr></table>
11601
11602 !! html/parsoid
11603 <table>
11604 <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>
11605 </tbody></table>
11606 !! end
11607
11608 !!test
11609 Templates: HTML Tables: 1. Generating start of a HTML table
11610 !! wikitext
11611 {{echo|<table><tr><td>foo</td>}}</tr></table>
11612 !! html
11613 <table><tr><td>foo</td></tr></table>
11614
11615 !!end
11616
11617 !!test
11618 Templates: HTML Tables: 2a. Generating middle of a HTML table
11619 !! wikitext
11620 <table><tr>{{echo|<td>foo</td>}}</tr></table>
11621 !! html
11622 <table><tr><td>foo</td></tr></table>
11623
11624 !!end
11625
11626 !!test
11627 Templates: HTML Tables: 2b. Generating middle of a HTML table
11628 !! wikitext
11629 <table>{{echo|<tr><td>foo</td></tr>}}</table>
11630 !! html
11631 <table><tr><td>foo</td></tr></table>
11632
11633 !!end
11634
11635 !!test
11636 Templates: HTML Tables: 3. Generating end of a HTML table
11637 !! wikitext
11638 <table><tr>{{echo|<td>foo</td></tr></table>}}
11639 !! html
11640 <table><tr><td>foo</td></tr></table>
11641
11642 !!end
11643
11644 !!test
11645 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
11646 !! wikitext
11647 {{echo|<table>}}<tr><td>foo</td></tr></table>
11648 !! html
11649 <table><tr><td>foo</td></tr></table>
11650
11651 !!end
11652
11653 !!test
11654 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
11655 !! wikitext
11656 <table>{{echo|<tr>}}<td>foo</td></tr></table>
11657 !! html
11658 <table><tr><td>foo</td></tr></table>
11659
11660 !!end
11661
11662 !!test
11663 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
11664 !! wikitext
11665 <table><tr>{{echo|<td>}}foo</td></tr></table>
11666 !! html
11667 <table><tr><td>foo</td></tr></table>
11668
11669 !!end
11670
11671 !!test
11672 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
11673 !! wikitext
11674 <table><tr><td>foo{{echo|</td>}}</tr></table>
11675 !! html
11676 <table><tr><td>foo</td></tr></table>
11677
11678 !!end
11679
11680 !!test
11681 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
11682 !! wikitext
11683 <table><tr><td>foo</td>{{echo|</tr>}}</table>
11684 !! html
11685 <table><tr><td>foo</td></tr></table>
11686
11687 !!end
11688
11689 !!test
11690 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
11691 !! wikitext
11692 <table><tr><td>foo</td></tr>{{echo|</table>}}
11693 !! html
11694 <table><tr><td>foo</td></tr></table>
11695
11696 !!end
11697
11698 !!test
11699 Templates: HTML Tables: 5. Proper fostering of categories from inside
11700 !!options
11701 parsoid=wt2html,wt2wt
11702 !! wikitext
11703 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
11704 <!--Two categories (Bug 50330)-->
11705 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
11706 !! html
11707 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
11708 <!--Two categories (Bug 50330)-->
11709 <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>
11710 !!end
11711
11712 !!test
11713 Templates: Wiki Tables: 1a. Fostering of entire template content
11714 !! wikitext
11715 {|
11716 {{echo|a}}
11717 |}
11718 !! html
11719 <table>
11720 a
11721 <tr><td></td></tr></table>
11722
11723 !! html+tidy
11724 <p>a</p>
11725 <table>
11726 <tr>
11727 <td></td>
11728 </tr>
11729 </table>
11730 !! end
11731
11732 !!test
11733 Templates: Wiki Tables: 1b. Fostering of entire template content
11734 !! wikitext
11735 {|
11736 {{echo|<div>}}
11737 foo
11738 {{echo|</div>}}
11739 |}
11740 !! html
11741 <table>
11742 <div>
11743 <p>foo
11744 </p>
11745 </div>
11746 <tr><td></td></tr></table>
11747
11748 !! html+tidy
11749 <div>
11750 <p>foo</p>
11751 </div>
11752 <table>
11753 <tr>
11754 <td></td>
11755 </tr>
11756 </table>
11757 !! end
11758
11759 !!test
11760 Templates: Wiki Tables: 2. Fostering of partial template content
11761 !! wikitext
11762 {|
11763 {{echo|a
11764 <div>b</div>}}
11765 |}
11766 !! html
11767 <table>
11768 a
11769 <div>b</div>
11770 <tr><td></td></tr></table>
11771
11772 !! html+tidy
11773 <p>a</p>
11774 <div>b</div>
11775 <table>
11776 <tr>
11777 <td></td>
11778 </tr>
11779 </table>
11780 !! end
11781
11782 !!test
11783 Templates: Wiki Tables: 3. td-content via multiple templates
11784 !! wikitext
11785 {|
11786 {{echo|{{pipe}}a}}{{echo|b}}
11787 |}
11788 !! html
11789 <table>
11790 <tr>
11791 <td>ab
11792 </td></tr></table>
11793
11794 !!end
11795
11796 !!test
11797 Templates: Wiki Tables: 4. Templated tags, no content
11798 !! wikitext
11799 {{tbl-start}}
11800 {{tbl-end}}
11801 !! html
11802 <table>
11803 <tr><td></td></tr></table>
11804
11805 !!end
11806
11807 !!test
11808 Templates: Wiki Tables: 5. Templated tags, regular td-tags
11809 !! wikitext
11810 {{tbl-start}}
11811 |foo
11812 {{tbl-end}}
11813 !! html
11814 <table>
11815 <tr>
11816 <td>foo
11817 </td></tr></table>
11818
11819 !!end
11820
11821 !!test
11822 Templates: Wiki Tables: 6. Templated tags, templated td-tags
11823 !! wikitext
11824 {{tbl-start}}
11825 {{!}}foo
11826 {{tbl-end}}
11827 !! html
11828 <table>
11829 <tr>
11830 <td>foo
11831 </td></tr></table>
11832
11833 !!end
11834
11835 ## This test case is very specific to Parsoid's internals
11836 ## and is hence only tested for Parsoid's code. Parsoid uses
11837 ## a <meta> marker tag for <ref> tags and they are expanded
11838 ## much later. We are verifying that this <meta> tag usage
11839 ## doesn't prevent foster parenting.
11840 !!test
11841 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
11842 !!wikitext
11843 {{PartialTable}}<ref>foo</ref>
11844 |}
11845
11846 <references />
11847 !!html/parsoid
11848 <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">
11849 <tbody>
11850 </tbody></table>
11851
11852 <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>
11853 !!end
11854
11855 !! test
11856 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
11857 !! wikitext
11858 {{echo|
11859 {{{!}}
11860 {{!}}-}}
11861 <onlyinclude>
11862 |foo
11863 </onlyinclude>
11864 {{!}}}
11865 !! html/parsoid
11866 <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{{!}}}"]}'>
11867 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
11868 <tbody><tr>
11869
11870 <td>foo
11871 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
11872 </tbody></table>
11873 !! end
11874
11875 !!test
11876 Templates: Lists: Multi-line list-items via templates
11877 !! wikitext
11878 *{{echo|a {{nonexistent|
11879 unused}}}}
11880 *{{echo|b {{nonexistent|
11881 unused}}}}
11882 !! html
11883 <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>
11884 <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>
11885
11886 !!end
11887
11888 !!test
11889 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
11890 !! wikitext
11891 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
11892 !! html
11893 <p><i>ab</i>c<i>d</i>e
11894 </p>
11895 !!end
11896
11897 !!test
11898 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
11899 (PHP parser generates misnested html)
11900 !! wikitext
11901 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
11902 !! html/parsoid
11903 <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>
11904 !!end
11905
11906 !!test
11907 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
11908 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
11909 !! options
11910 parsoid=wt2html,wt2wt
11911 !! wikitext
11912 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
11913 !! html
11914 <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>
11915 <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>
11916 <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>
11917 !!end
11918
11919 !!test
11920 Templates: Ugly nesting: 4. Divs opened/closed across templates
11921 !! wikitext
11922 a<div>b{{echo|c</div>d}}e
11923 !! html
11924 a<div>bc</div>de
11925
11926 !! html+tidy
11927 <p>a</p>
11928 <div>bc</div>
11929 <p>de</p>
11930 !! end
11931
11932 !!test
11933 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
11934 (Parsoid-centric)
11935 !! options
11936 parsoid
11937 !! wikitext
11938 {|
11939 |{{echo|foo</table>}}
11940 |bar
11941 |}
11942 !! html
11943 <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|}"]}'>
11944
11945 <tbody>
11946 <tr>
11947 <td>foo</td></tr></tbody></table><span about="#mwt1">
11948 </span><span about="#mwt1">|bar</span><span about="#mwt1">
11949 |}</span>
11950 !!end
11951
11952 !!test
11953 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
11954 (Parsoid-centric)
11955 !! options
11956 parsoid
11957 !! wikitext
11958 <table>
11959 <tr>
11960 <td>
11961 <table>
11962 <tr>
11963 <td>1. {{echo|foo </table>}}</td>
11964 <td> bar </td>
11965 <td>2. {{echo|baz </table>}}</td>
11966 </tr>
11967 <tr>
11968 <td>abc</td>
11969 </tr>
11970 </table>
11971 </td>
11972 </tr>
11973 <tr>
11974 <td>xyz</td>
11975 </tr>
11976 </table>
11977 !! html
11978 <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>"]}'>
11979 <tbody><tr>
11980 <td>
11981 <table>
11982 <tbody><tr>
11983 <td>1. foo </td></tr></tbody></table></td>
11984 <td> bar </td>
11985 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
11986 </span><span about="#mwt2">
11987 </span><span about="#mwt2">
11988 </span><span about="#mwt2">abc</span><span about="#mwt2">
11989 </span><span about="#mwt2">
11990 </span><span about="#mwt2">
11991 </span><span about="#mwt2">
11992 </span><span about="#mwt2">
11993 </span><span about="#mwt2">
11994 </span><span about="#mwt2">xyz</span><span about="#mwt2">
11995 </span><span about="#mwt2">
11996 </span>
11997 !!end
11998
11999 !! test
12000 Templates: Ugly templates: 3. newline-only template parameter
12001 !! wikitext
12002 foo {{echo|
12003 }}
12004 !! html
12005 <p>foo
12006 </p>
12007 !! end
12008
12009 # This looks like a bug: a single newline triggers p/br for some reason.
12010 !! test
12011 Templates: Ugly templates: 4. newline-only template parameter inconsistency
12012 !! wikitext
12013 {{echo|
12014 }}
12015 !! html
12016 <p><br />
12017 </p>
12018 !! end
12019
12020 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
12021 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
12022 !! test
12023 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
12024 !! wikitext
12025 {{echo|<table>}}
12026 {{echo|<div>foo}}
12027 {{echo|</table>}}
12028 !! html/parsoid
12029 <div about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;table>"}},"i":0}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;div>foo"}},"i":1}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;/table>"}},"i":2}}]}' data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[{"k":"1"}],[{"k":"1"}],[{"k":"1"}]]}'>foo
12030 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12031 </table>
12032 !! end
12033
12034 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
12035 # that are "identical" and generate nesting cycles in the algorithm
12036 !! test
12037 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
12038 !! wikitext
12039 {{echo|<table><tr><td><table>}}
12040 {{echo|<div>}}
12041 {{echo|</div>}}
12042 !! html/parsoid
12043 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;table>&lt;tr>&lt;td>&lt;table>"}},"i":0}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;div>"}},"i":1}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;/div>"}},"i":2}}]}' data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[{"k":"1"}],[{"k":"1"}],[{"k":"1"}]]}'><tbody><tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'><div data-parsoid='{"stx":"html"}'>
12044 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12045 </table></td></tr></tbody></table>
12046 !! end
12047
12048 !! test
12049 Templates: Parameters substituted at the top-level
12050 !! wikitext
12051 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
12052 !! html/php
12053 <p><i>who</i> me? <b>never!</b>
12054 </p>
12055 !! html/parsoid
12056 <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>
12057 !! end
12058
12059 !!test
12060 Parser Functions: 1. Simple example
12061 !! wikitext
12062 {{uc:foo}}
12063 !! html
12064 <p>FOO
12065 </p>
12066 !!end
12067
12068 !!test
12069 Parser Functions: 2. Nested use (only outermost should be marked up)
12070 !! wikitext
12071 {{uc:{{lc:FOO}}}}
12072 !! html
12073 <p>FOO
12074 </p>
12075 !!end
12076
12077 ###
12078 ### Pre-save transform tests
12079 ###
12080 !! test
12081 pre-save transform: subst:
12082 !! options
12083 pst
12084 !! wikitext
12085 {{subst:test}}
12086 !! html/php
12087 This is a test template
12088 !! end
12089
12090 !! test
12091 pre-save transform: normal template
12092 !! options
12093 pst
12094 !! wikitext
12095 {{test}}
12096 !! html/php
12097 {{test}}
12098 !! end
12099
12100 !! test
12101 pre-save transform: nonexistent template
12102 !! options
12103 pst
12104 !! wikitext
12105 {{thistemplatedoesnotexist}}
12106 !! html/php
12107 {{thistemplatedoesnotexist}}
12108 !! end
12109
12110 !! test
12111 pre-save transform: subst magic variables
12112 !! options
12113 pst
12114 !! wikitext
12115 {{subst:SITENAME}}
12116 !! html/php
12117 MediaWiki
12118 !! end
12119
12120 # This is bug 89, which I fixed. -- wtm
12121 !! test
12122 pre-save transform: subst: templates with parameters
12123 !! options
12124 pst
12125 !! wikitext
12126 {{subst:paramtest|param="something else"}}
12127 !! html/php
12128 This is a test template with parameter "something else"
12129 !! end
12130
12131 !! article
12132 Template:nowikitest
12133 !! text
12134 <nowiki>'''not wiki'''</nowiki>
12135 !! endarticle
12136
12137 !! test
12138 pre-save transform: nowiki in subst (bug 1188)
12139 !! options
12140 pst
12141 !! wikitext
12142 {{subst:nowikitest}}
12143 !! html/php
12144 <nowiki>'''not wiki'''</nowiki>
12145 !! end
12146
12147 !! article
12148 Template:commenttest
12149 !! text
12150 This template has <!-- a comment --> in it.
12151 !! endarticle
12152
12153 !! test
12154 pre-save transform: comment in subst (bug 1936)
12155 !! options
12156 pst
12157 !! wikitext
12158 {{subst:commenttest}}
12159 !! html/php
12160 This template has <!-- a comment --> in it.
12161 !! end
12162
12163 !! test
12164 pre-save transform: unclosed tag
12165 !! options
12166 pst noxml
12167 !! wikitext
12168 <nowiki>'''not wiki'''
12169 !! html/php
12170 <nowiki>'''not wiki'''
12171 !! end
12172
12173 !! test
12174 pre-save transform: mixed tag case
12175 !! options
12176 pst noxml
12177 !! wikitext
12178 <NOwiki>'''not wiki'''</noWIKI>
12179 !! html/php
12180 <NOwiki>'''not wiki'''</noWIKI>
12181 !! end
12182
12183 !! test
12184 pre-save transform: unclosed comment in <nowiki>
12185 !! options
12186 pst noxml
12187 !! wikitext
12188 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12189 !! html/php
12190 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12191 !!end
12192
12193 # Leading @ in this template definition works around a limitation
12194 # in parsoid's parserTests which otherwise strips the <span> from the
12195 # result (confusing it for a template wrapper)
12196 !! article
12197 Template:dangerous
12198 !!text
12199 @<span onmouseover="alert('crap')">Oh no</span>
12200 !!endarticle
12201
12202 !!test
12203 (confirming safety of fix for subst bug 1936)
12204 !! wikitext
12205 {{Template:dangerous}}
12206 !! html
12207 <p>@<span>Oh no</span>
12208 </p>
12209 !! end
12210
12211 !! test
12212 pre-save transform: comment containing gallery (bug 5024)
12213 !! options
12214 pst
12215 !! wikitext
12216 <!-- <gallery>data</gallery> -->
12217 !! html/php
12218 <!-- <gallery>data</gallery> -->
12219 !!end
12220
12221 !! test
12222 pre-save transform: comment containing extension
12223 !! options
12224 pst
12225 !! wikitext
12226 <!-- <tag>data</tag> -->
12227 !! html/php
12228 <!-- <tag>data</tag> -->
12229 !!end
12230
12231 !! test
12232 pre-save transform: comment containing nowiki
12233 !! options
12234 pst
12235 !! wikitext
12236 <!-- <nowiki>data</nowiki> -->
12237 !! html/php
12238 <!-- <nowiki>data</nowiki> -->
12239 !!end
12240
12241 !! test
12242 pre-save transform: <noinclude> in subst (bug 3298)
12243 !! options
12244 pst
12245 !! wikitext
12246 {{subst:Includes}}
12247 !! html/php
12248 Foobar
12249 !! end
12250
12251 !! test
12252 pre-save transform: <onlyinclude> in subst (bug 3298)
12253 !! options
12254 pst
12255 !! wikitext
12256 {{subst:Includes2}}
12257 !! html/php
12258 Foo
12259 !! end
12260
12261 !! article
12262 Template:SubstTest
12263 !!text
12264 {{<includeonly>subst:</includeonly>Includes}}
12265 !! endarticle
12266
12267 !! article
12268 Template:SafeSubstTest
12269 !! text
12270 {{<includeonly>safesubst:</includeonly>Includes}}
12271 !! endarticle
12272
12273 !! test
12274 bug 22297: safesubst: works during PST
12275 !! options
12276 pst
12277 !! wikitext
12278 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
12279 !! html/php
12280 FoobarFoobar
12281 !! end
12282
12283 !! test
12284 bug 22297: safesubst: works during normal parse
12285 !! wikitext
12286 {{SafeSubstTest}}
12287 !! html
12288 <p>Foobar
12289 </p>
12290 !! end
12291
12292 !! test
12293 subst: does not work during normal parse
12294 !! wikitext
12295 {{SubstTest}}
12296 !! html
12297 <p>{{subst:Includes}}
12298 </p>
12299 !! end
12300
12301 !! test
12302 pre-save transform: context links ("pipe trick")
12303 !! options
12304 pst
12305 !! wikitext
12306 [[Article (context)|]]
12307 [[Bar:Article|]]
12308 [[:Bar:Article|]]
12309 [[Bar:Article (context)|]]
12310 [[:Bar:Article (context)|]]
12311 [[|Article]]
12312 [[|Article (context)]]
12313 [[Bar:X (Y) Z|]]
12314 [[:Bar:X (Y) Z|]]
12315 !! html/php
12316 [[Article (context)|Article]]
12317 [[Bar:Article|Article]]
12318 [[:Bar:Article|Article]]
12319 [[Bar:Article (context)|Article]]
12320 [[:Bar:Article (context)|Article]]
12321 [[Article]]
12322 [[Article (context)]]
12323 [[Bar:X (Y) Z|X (Y) Z]]
12324 [[:Bar:X (Y) Z|X (Y) Z]]
12325 !! end
12326
12327 !! test
12328 pre-save transform: context links ("pipe trick") with interwiki prefix
12329 !! options
12330 pst
12331 !! wikitext
12332 [[interwiki:Article|]]
12333 [[:interwiki:Article|]]
12334 [[interwiki:Bar:Article|]]
12335 [[:interwiki:Bar:Article|]]
12336 !! html/php
12337 [[interwiki:Article|Article]]
12338 [[:interwiki:Article|Article]]
12339 [[interwiki:Bar:Article|Bar:Article]]
12340 [[:interwiki:Bar:Article|Bar:Article]]
12341 !! end
12342
12343 !! test
12344 pre-save transform: context links ("pipe trick") with parens in title
12345 !! options
12346 pst title=[[Somearticle (context)]]
12347 !! wikitext
12348 [[|Article]]
12349 !! html/php
12350 [[Article (context)|Article]]
12351 !! end
12352
12353 !! test
12354 pre-save transform: context links ("pipe trick") with comma in title
12355 !! options
12356 pst title=[[Someplace, Somewhere]]
12357 !! wikitext
12358 [[|Otherplace]]
12359 [[Otherplace, Elsewhere|]]
12360 [[Otherplace, Elsewhere, Anywhere|]]
12361 !! html/php
12362 [[Otherplace, Somewhere|Otherplace]]
12363 [[Otherplace, Elsewhere|Otherplace]]
12364 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
12365 !! end
12366
12367 !! test
12368 pre-save transform: context links ("pipe trick") with parens and comma
12369 !! options
12370 pst title=[[Someplace (IGNORED), Somewhere]]
12371 !! wikitext
12372 [[|Otherplace]]
12373 [[Otherplace (place), Elsewhere|]]
12374 !! html/php
12375 [[Otherplace, Somewhere|Otherplace]]
12376 [[Otherplace (place), Elsewhere|Otherplace]]
12377 !! end
12378
12379 !! test
12380 pre-save transform: context links ("pipe trick") with comma and parens
12381 !! options
12382 pst title=[[Who, me? (context)]]
12383 !! wikitext
12384 [[|Yes, you.]]
12385 [[Me, Myself, and I (1937 song)|]]
12386 !! html/php
12387 [[Yes, you. (context)|Yes, you.]]
12388 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
12389 !! end
12390
12391 !! test
12392 pre-save transform: context links ("pipe trick") with namespace
12393 !! options
12394 pst title=[[Ns:Somearticle]]
12395 !! wikitext
12396 [[|Article]]
12397 !! html/php
12398 [[Ns:Article|Article]]
12399 !! end
12400
12401 !! test
12402 pre-save transform: context links ("pipe trick") with namespace and parens
12403 !! options
12404 pst title=[[Ns:Somearticle (context)]]
12405 !! wikitext
12406 [[|Article]]
12407 !! html/php
12408 [[Ns:Article (context)|Article]]
12409 !! end
12410
12411 !! test
12412 pre-save transform: context links ("pipe trick") with namespace and comma
12413 !! options
12414 pst title=[[Ns:Somearticle, Context, Whatever]]
12415 !! wikitext
12416 [[|Article]]
12417 !! html/php
12418 [[Ns:Article, Context, Whatever|Article]]
12419 !! end
12420
12421 !! test
12422 pre-save transform: context links ("pipe trick") with namespace, comma and parens
12423 !! options
12424 pst title=[[Ns:Somearticle, Context (context)]]
12425 !! wikitext
12426 [[|Article]]
12427 !! html/php
12428 [[Ns:Article (context)|Article]]
12429 !! end
12430
12431 !! test
12432 pre-save transform: context links ("pipe trick") with namespace, parens and comma
12433 !! options
12434 pst title=[[Ns:Somearticle (IGNORED), Context]]
12435 !! wikitext
12436 [[|Article]]
12437 !! html/php
12438 [[Ns:Article, Context|Article]]
12439 !! end
12440
12441 !! test
12442 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
12443 !! options
12444 pst
12445 !! wikitext
12446 [[Article(context)|]]
12447 [[Bar:Article(context)|]]
12448 [[:Bar:Article(context)|]]
12449 [[|Article(context)]]
12450 [[Bar:X(Y)Z|]]
12451 [[:Bar:X(Y)Z|]]
12452 !! html/php
12453 [[Article(context)|Article]]
12454 [[Bar:Article(context)|Article]]
12455 [[:Bar:Article(context)|Article]]
12456 [[Article(context)]]
12457 [[Bar:X(Y)Z|X(Y)Z]]
12458 [[:Bar:X(Y)Z|X(Y)Z]]
12459 !! end
12460
12461 !! test
12462 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
12463 !! options
12464 pst
12465 !! wikitext
12466 [[Article (context)|]]
12467 [[Bar:Article (context)|]]
12468 [[:Bar:Article (context)|]]
12469 [[|Article (context)]]
12470 [[Bar:X (Y) Z|]]
12471 [[:Bar:X (Y) Z|]]
12472 !! html/php
12473 [[Article (context)|Article]]
12474 [[Bar:Article (context)|Article]]
12475 [[:Bar:Article (context)|Article]]
12476 [[Article (context)]]
12477 [[Bar:X (Y) Z|X (Y) Z]]
12478 [[:Bar:X (Y) Z|X (Y) Z]]
12479 !! end
12480
12481 !! test
12482 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
12483 !! options
12484 pst
12485 !! wikitext
12486 [[Article(context)|]]
12487 [[Bar:Article(context)|]]
12488 [[:Bar:Article(context)|]]
12489 [[|Article(context)]]
12490 [[Bar:X(Y)Z|]]
12491 [[:Bar:X(Y)Z|]]
12492 !! html/php
12493 [[Article(context)|Article]]
12494 [[Bar:Article(context)|Article]]
12495 [[:Bar:Article(context)|Article]]
12496 [[Article(context)]]
12497 [[Bar:X(Y)Z|X(Y)Z]]
12498 [[:Bar:X(Y)Z|X(Y)Z]]
12499 !! end
12500
12501 !! test
12502 pre-save transform: context links ("pipe trick") with commas (bug 21660)
12503 !! options
12504 pst
12505 !! wikitext
12506 [[Article (context), context|]]
12507 [[Article (context),context|]]
12508 [[Bar:Article (context), context|]]
12509 [[Bar:Article (context),context|]]
12510 [[:Bar:Article (context), context|]]
12511 [[:Bar:Article (context),context|]]
12512 !! html/php
12513 [[Article (context), context|Article]]
12514 [[Article (context),context|Article]]
12515 [[Bar:Article (context), context|Article]]
12516 [[Bar:Article (context),context|Article]]
12517 [[:Bar:Article (context), context|Article]]
12518 [[:Bar:Article (context),context|Article]]
12519 !! end
12520
12521 !! test
12522 pre-save transform: trim trailing empty lines
12523 !! options
12524 pst
12525 !! wikitext
12526 Empty lines are trimmed
12527
12528
12529
12530
12531 !! html/php
12532 Empty lines are trimmed
12533 !! end
12534
12535 !! test
12536 pre-save transform: Signature expansion
12537 !! options
12538 pst
12539 !! wikitext
12540 * ~~~
12541 * <noinclude>~~~</noinclude>
12542 * <includeonly>~~~</includeonly>
12543 * <onlyinclude>~~~</onlyinclude>
12544 !! html/php
12545 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
12546 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
12547 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
12548 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
12549 !! end
12550
12551
12552 !! test
12553 pre-save transform: Signature expansion in nowiki tags (bug 93)
12554 !! options
12555 pst disabled
12556 !! wikitext
12557 Shall not expand:
12558
12559 <nowiki>~~~~</nowiki>
12560
12561 <includeonly><nowiki>~~~~</nowiki></includeonly>
12562
12563 <noinclude><nowiki>~~~~</nowiki></noinclude>
12564
12565 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12566
12567 {{subst:Foo}} shall be converted to FOO
12568
12569 As well as inside noinclude/onlyinclude
12570 <noinclude>{{subst:Foo}}</noinclude>
12571 <onlyinclude>{{subst:Foo}}</onlyinclude>
12572
12573 But not inside includeonly
12574 <includeonly>{{subst:Foo}}</includeonly>
12575 !! html/php
12576 Shall not expand:
12577
12578 <nowiki>~~~~</nowiki>
12579
12580 <includeonly><nowiki>~~~~</nowiki></includeonly>
12581
12582 <noinclude><nowiki>~~~~</nowiki></noinclude>
12583
12584 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12585
12586 FOO shall be converted to FOO
12587
12588 As well as inside noinclude/onlyinclude
12589 <noinclude>FOO</noinclude>
12590 <onlyinclude>FOO</onlyinclude>
12591
12592 But not inside includeonly
12593 <includeonly>{{subst:Foo}}</includeonly>
12594 !! end
12595
12596 !! test
12597 Parsoid: Recognize nowiki with trailing space in tags
12598 !! options
12599 parsoid=wt2html
12600 !! wikitext
12601 <nowiki ><div>[[foo]]</nowiki >
12602
12603 a<nowiki / >b
12604
12605 c<nowiki />d
12606
12607 e<nowiki/ >f
12608 !! html
12609 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12610 <p>ab</p>
12611 <p>cd</p>
12612 <p>ef</p>
12613 !! end
12614
12615 !! test
12616 Parsoid: Recognize nowiki with odd capitalization
12617 !! options
12618 parsoid=wt2html
12619 !! wikitext
12620 <noWikI ><div>[[foo]]</Nowiki >
12621 !! html
12622 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12623 !! end
12624
12625
12626 !! test
12627 Parsoid: Escape nowiki with trailing space in tags
12628 !! options
12629 parsoid=html2wt
12630 !! html/parsoid
12631 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
12632 <p>a&lt;nowiki /&gt;b</p>
12633 <p>c&lt;nowiki/ &gt;d</p>
12634 !! wikitext
12635 &lt;nowiki &gt; foo &lt;/nowiki &gt;
12636
12637 a&lt;nowiki /&gt;b
12638
12639 c&lt;nowiki/ &gt;d
12640 !! end
12641
12642 !! test
12643 Parsoid: Escape weird noWikI capitalizations
12644 !! options
12645 parsoid=html2wt
12646 !! html/parsoid
12647 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
12648 !! wikitext
12649 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
12650 !! end
12651
12652 ###
12653 ### Message transform tests
12654 ###
12655 !! test
12656 message transform: magic variables
12657 !! options
12658 msg
12659 !! wikitext
12660 {{SITENAME}}
12661 !! html
12662 MediaWiki
12663 !! end
12664
12665 !! test
12666 message transform: should not transform wiki markup
12667 !! options
12668 msg
12669 !! wikitext
12670 ''test''
12671 !! html
12672 ''test''
12673 !! end
12674
12675 !! test
12676 message transform: <noinclude> in transcluded template (bug 4926)
12677 !! options
12678 msg
12679 !! wikitext
12680 {{Includes}}
12681 !! html
12682 Foobar
12683 !! end
12684
12685 !! test
12686 message transform: <onlyinclude> in transcluded template (bug 4926)
12687 !! options
12688 msg
12689 !! wikitext
12690 {{Includes2}}
12691 !! html
12692 Foo
12693 !! end
12694
12695 !! test
12696 {{#special:}} page name, known
12697 !! options
12698 msg
12699 !! wikitext
12700 {{#special:Recentchanges}}
12701 !! html
12702 Special:RecentChanges
12703 !! end
12704
12705 !! test
12706 {{#special:}} page name with subpage, known
12707 !! options
12708 msg
12709 !! wikitext
12710 {{#special:Recentchanges/param}}
12711 !! html
12712 Special:RecentChanges/param
12713 !! end
12714
12715 !! test
12716 {{#special:}} page name, unknown
12717 !! options
12718 msg
12719 !! wikitext
12720 {{#special:foobar nonexistent}}
12721 !! html
12722 Special:Foobar nonexistent
12723 !! end
12724
12725 !! test
12726 {{#speciale:}} page name, known
12727 !! options
12728 msg
12729 !! wikitext
12730 {{#speciale:Recentchanges}}
12731 !! html
12732 Special:RecentChanges
12733 !! end
12734
12735 !! test
12736 {{#speciale:}} page name with subpage, known
12737 !! options
12738 msg
12739 !! wikitext
12740 {{#speciale:Recentchanges/param}}
12741 !! html
12742 Special:RecentChanges/param
12743 !! end
12744
12745 !! test
12746 {{#speciale:}} page name, unknown
12747 !! options
12748 msg
12749 !! wikitext
12750 {{#speciale:foobar nonexistent}}
12751 !! html
12752 Special:Foobar_nonexistent
12753 !! end
12754
12755 ###
12756 ### Images
12757 ###
12758 ### For Parsoid-specific tests, see
12759 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
12760
12761 !! test
12762 Simple image
12763 !! options
12764 parsoid=wt2html,wt2wt,html2html
12765 !! wikitext
12766 [[Image:foobar.jpg]]
12767 !! html/php
12768 <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>
12769 </p>
12770 !! html/parsoid
12771 <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>
12772 !! end
12773
12774 !! test
12775 Simple image (using File: namespace, now canonical)
12776 !! wikitext
12777 [[File:Foobar.jpg]]
12778 !! html/php
12779 <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>
12780 </p>
12781 !! html/parsoid
12782 <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>
12783 !! end
12784
12785 !! test
12786 Right-aligned image
12787 !! wikitext
12788 [[File:Foobar.jpg|right]]
12789 !! html/php
12790 <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>
12791
12792 !! html/parsoid
12793 <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>
12794 !! end
12795
12796 !! test
12797 Image with caption
12798 !! wikitext
12799 [[File:Foobar.jpg|right|Caption text]]
12800 !! html/php
12801 <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>
12802
12803 !! html/parsoid
12804 <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>
12805 !! end
12806
12807 !! test
12808 Image with caption, bug 53312 #1
12809 !! wikitext
12810 [[File:Foobar.jpg|right|Caption page stuff]]
12811 !! html/php
12812 <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>
12813
12814 !! html/parsoid
12815 <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>
12816 !! end
12817
12818 !! test
12819 Image with caption, bug 53312 #2
12820 !! wikitext
12821 [[File:Foobar.jpg|right|Caption page=]]
12822 !! html/php
12823 <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>
12824
12825 !! html/parsoid
12826 <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>
12827 !! end
12828
12829 !! test
12830 Image with caption, bug 53312 #3
12831 !! wikitext
12832 [[File:Foobar.jpg|right|Caption page=stuff]]
12833 !! html/php
12834 <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>
12835
12836 !! html/parsoid
12837 <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>
12838 !! end
12839
12840 !! test
12841 Allow empty links in image captions (Bug 60753)
12842 !! options
12843 thumbsize=220
12844 !! wikitext
12845 [[File:Foobar.jpg|thumb|Caption [[Link1]]
12846 [[]]
12847 [[Link2]]
12848 ]]
12849 !! html/php
12850 <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>
12851
12852 !! html/parsoid
12853 <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>
12854 [[]]
12855 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
12856 </figcaption></figure>
12857 !! end
12858
12859 !! test
12860 Titles in unlinked images (T23454)
12861 !! wikitext
12862 [[File:Foobar.jpg|link=|stuff]]
12863 !! html/php
12864 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
12865 </p>
12866 !! end
12867
12868 !! test
12869 Link with empty target
12870 !! wikitext
12871 [[]]
12872 !! html
12873 <p>[[]]
12874 </p>
12875 !! end
12876
12877 !! test
12878 Image with link trail
12879 !! wikitext
12880 Linktrails should not work for images: [[File:Foobar.jpg]]s
12881 !! html/php
12882 <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
12883 </p>
12884 !! html/parsoid
12885 <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>
12886 !! end
12887
12888 !! test
12889 Image with empty attribute
12890 !! options
12891 parsoid=wt2html,wt2wt,html2html
12892 !! wikitext
12893 [[File:Foobar.jpg|right||Caption text]]
12894 !! html/php
12895 <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>
12896
12897 !! html/parsoid
12898 <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>
12899 !! end
12900
12901 !! test
12902 1. Block image with individual attributes from templates
12903 !! wikitext
12904 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
12905 !! html/php
12906 <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>
12907
12908 !! html/parsoid
12909 <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;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>
12910 !! end
12911
12912 !! test
12913 2. Block Image with individual attributes from templates
12914 !! wikitext
12915 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
12916 !! html/php
12917 <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>
12918
12919 !! html/parsoid
12920 <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;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;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>
12921 !! end
12922
12923 !! test
12924 3. Inline image with individual attributes from templates
12925 !! wikitext
12926 [[File:Foobar.jpg|{{echo|50px}}]]
12927 !! html/php
12928 <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>
12929 </p>
12930 !! html/parsoid
12931 <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;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>
12932 !! end
12933
12934 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
12935 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
12936 !! test
12937 Image with multiple attributes from the same template
12938 !! wikitext
12939 [[File:Foobar.jpg|{{image_attribs}}]]
12940 !! html/php
12941 <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>
12942
12943 !! html/parsoid
12944 <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>
12945 !! end
12946
12947 !! test
12948 Image with link tails
12949 !! options
12950 thumbsize=220
12951 !! wikitext
12952 123[[File:Foobar.jpg]]456
12953 123[[File:Foobar.jpg|right]]456
12954 123[[File:Foobar.jpg|thumb]]456
12955 !! html/php
12956 <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
12957 </p>
12958 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
12959 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
12960
12961 !! html/php+tidy
12962 <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>
12963 <p>123</p>
12964 <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>
12965 <p>456 123</p>
12966 <div class="thumb tright">
12967 <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>
12968 <div class="thumbcaption">
12969 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
12970 </div>
12971 </div>
12972 </div>
12973 <p>456</p>
12974 !! html/parsoid
12975 <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>
12976 <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>
12977 <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>
12978 !! end
12979
12980 !! test
12981 Image with multiple captions -- only last one is accepted
12982 !! wikitext
12983 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
12984 !! html/php
12985 <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>
12986
12987 !! html/parsoid
12988 <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>
12989 !! end
12990
12991 !! test
12992 Image with multiple widths -- use last
12993 !! wikitext
12994 [[File:Foobar.jpg|200px|300px|caption]]
12995 !! html/php
12996 <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>
12997 </p>
12998 !! html/parsoid
12999 <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>
13000 !! end
13001
13002 !! test
13003 Image with multiple alignments -- use first (bug 48664)
13004 !! options
13005 thumbsize=220
13006 !! wikitext
13007 [[File:Foobar.jpg|thumb|left|right|center|caption]]
13008
13009 [[File:Foobar.jpg|middle|text-top|caption]]
13010 !! html/php
13011 <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>
13012 <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>
13013 </p>
13014 !! html/parsoid
13015 <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>
13016 <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>
13017 !! end
13018
13019 !! test
13020 Image with width attribute at different positions
13021 !! wikitext
13022 [[File:Foobar.jpg|200px|right|Caption]]
13023 [[File:Foobar.jpg|right|200px|Caption]]
13024 [[File:Foobar.jpg|right|Caption|200px]]
13025 !! html/php
13026 <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>
13027 <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>
13028 <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>
13029
13030 !! html/parsoid
13031 <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>
13032 <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>
13033 <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>
13034 !! end
13035
13036 # a sad bit of backward-compatibility
13037 !! test
13038 Image with size specified with pxpx (bug 13500, 51628)
13039 !! options
13040 parsoid=wt2html,wt2wt,html2html
13041 !! wikitext
13042 [[File:Foobar.jpg|20pxpx]]
13043 [[File:Foobar.jpg|200x20pxpx]]
13044 !! html/php
13045 <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>
13046 <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>
13047 </p>
13048 !! html/parsoid
13049 <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>
13050 !! end
13051
13052 !! test
13053 Image with link parameter, wiki target
13054 !! wikitext
13055 [[File:Foobar.jpg|link=Main Page]]
13056 !! html/php
13057 <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>
13058 </p>
13059 !! html/parsoid
13060 <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>
13061 !! end
13062
13063 # parsoid bug 49293 (part 1)
13064 !! test
13065 Image with link parameter, URL target
13066 !! wikitext
13067 [[File:Foobar.jpg|link=http://example.com/]]
13068 !! html/php
13069 <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>
13070 </p>
13071 !! html/parsoid
13072 <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>
13073 !! end
13074
13075 # parsoid bug 49293 (part 2)
13076 !! test
13077 Image with link parameter, protocol-less URL target
13078 !! wikitext
13079 [[File:Foobar.jpg|link=//example.com/]]
13080 !! html/php
13081 <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>
13082 </p>
13083 !! html/parsoid
13084 <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>
13085 !! end
13086
13087 !! test
13088 Escaping non-block captions (T107435)
13089 !! options
13090 parsoid={
13091 "modes": ["wt2wt"],
13092 "changes": [
13093 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
13094 ]
13095 }
13096 !! wikitext
13097 [[Image:Foobar.jpg|caption]]
13098 !! wikitext/edited
13099 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
13100 !! end
13101
13102 # wgExternalLinkTarget not supported by Parsoid
13103 !! test
13104 Image with link parameter, wgExternalLinkTarget
13105 !! wikitext
13106 [[Image:foobar.jpg|link=http://example.com/]]
13107 !! config
13108 wgExternalLinkTarget='foobar'
13109 !! html/php
13110 <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>
13111 </p>
13112 !! end
13113
13114 !! test
13115 Image with link parameter, wgNoFollowLinks set to false
13116 !! wikitext
13117 [[Image:foobar.jpg|link=http://example.com/]]
13118 !! config
13119 wgNoFollowLinks=false
13120 !! html
13121 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13122 </p>
13123 !! end
13124
13125 !! test
13126 Image with link parameter, wgNoFollowDomainExceptions
13127 !! wikitext
13128 [[Image:foobar.jpg|link=http://example.com/]]
13129 !! config
13130 wgNoFollowDomainExceptions='example.com'
13131 !! html
13132 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13133 </p>
13134 !! end
13135
13136 # wgExternalLinkTarget not supported by Parsoid
13137 !! test
13138 Image with link parameter, wgExternalLinkTarget, unnamed parameter
13139 !! wikitext
13140 [[Image:foobar.jpg|link=http://example.com/|Title]]
13141 !! config
13142 wgExternalLinkTarget='foobar'
13143 !! html/php
13144 <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>
13145 </p>
13146 !! end
13147
13148 !! test
13149 Image with empty link parameter
13150 !! wikitext
13151 [[File:Foobar.jpg|link=]]
13152 !! html/php
13153 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
13154 </p>
13155 !! html/parsoid
13156 <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>
13157 !! end
13158
13159 !! test
13160 Image with link parameter (wiki target) and unnamed parameter
13161 !! wikitext
13162 [[File:Foobar.jpg|link=Main_Page|Title]]
13163 !! html/php
13164 <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>
13165 </p>
13166 !! html/parsoid
13167 <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>
13168 !! end
13169
13170 !! test
13171 Image with link parameter (URL target) and unnamed parameter
13172 !! wikitext
13173 [[File:Foobar.jpg|link=http://example.com/|Title]]
13174 !! html/php
13175 <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>
13176 </p>
13177 !! html/parsoid
13178 <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>
13179 !! end
13180
13181 !! test
13182 Thumbnail image with link parameter
13183 !! options
13184 thumbsize=220
13185 parsoid=wt2html,wt2wt,html2html
13186 !! wikitext
13187 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
13188 !! html/php
13189 <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>
13190
13191 !! html/parsoid
13192 <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>
13193 !! end
13194
13195 !! test
13196 Manually-specified thumbnail image
13197 !! options
13198 thumbsize=220
13199 !! wikitext
13200 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
13201 !! html/php
13202 <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>
13203
13204 !! html/parsoid
13205 <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>
13206 !! end
13207
13208 !! test
13209 Manually-specified thumbnail image with explicit link to wiki page
13210 !! options
13211 thumbsize=220
13212 parsoid=wt2html,wt2wt,html2html
13213 !! wikitext
13214 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
13215 !! html/php
13216 <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>
13217
13218 !! html/parsoid
13219 <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>
13220 !! end
13221
13222 !! test
13223 Manually-specified thumbnail image with explicit link to url
13224 !! options
13225 thumbsize=220
13226 parsoid=wt2html,wt2wt,html2html
13227 !! wikitext
13228 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
13229 !! html/php
13230 <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>
13231
13232 !! html/parsoid
13233 <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>
13234 !! end
13235
13236 !! test
13237 Manually-specified thumbnail image with explicit no link
13238 !! options
13239 thumbsize=220
13240 parsoid=wt2html,wt2wt,html2html
13241 !! wikitext
13242 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
13243 !! html/php
13244 <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>
13245
13246 !! html/parsoid
13247 <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>
13248 !! end
13249
13250 !! test
13251 Manually-specified thumbnail image with explicit link and alt text
13252 !! options
13253 thumbsize=220
13254 parsoid=wt2html,wt2wt,html2html
13255 !! wikitext
13256 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
13257 !! html/php
13258 <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>
13259
13260 !! html/parsoid
13261 <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>
13262 !! end
13263
13264 !! test
13265 Image with frame and link
13266 !! options
13267 parsoid=wt2html,wt2wt,html2html
13268 !! wikitext
13269 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
13270 !! html/php
13271 <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>
13272
13273 !! html/parsoid
13274 <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>
13275 !! end
13276
13277 !! test
13278 Image with frame and link and explicit alt
13279 !! options
13280 parsoid=wt2html,wt2wt,html2html
13281 !! wikitext
13282 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
13283 !! html/php
13284 <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>
13285
13286 !! html/parsoid
13287 <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>
13288 !! end
13289
13290 !! test
13291 Image with wiki markup in implicit alt
13292 !! wikitext
13293 [[Image:Foobar.jpg|testing '''bold''' in alt]]
13294
13295 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
13296 !! html/php
13297 <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>
13298 </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>
13299 </p>
13300 !! html/parsoid
13301 <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>
13302 <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>
13303 !! end
13304
13305 !! test
13306 Alt image option should handle most kinds of wikitext without barfing
13307 !! wikitext
13308 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
13309 !! html/php
13310 <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>
13311
13312 !! html/parsoid
13313 <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;}]]}\" 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>
13314 !! end
13315
13316 ###################
13317 # Conflicting image format options.
13318 # First option specified should 'win'.
13319 # All three cases in each test should be identical.
13320
13321 !! test
13322 Image with 'frameless' first.
13323 !! options
13324 parsoid=wt2html,wt2wt,html2html
13325 !! wikitext
13326 [[File:Foobar.jpg|frameless|caption]]
13327
13328 [[File:Foobar.jpg|frameless|frame|caption]]
13329
13330 [[File:Foobar.jpg|frameless|thumb|caption]]
13331 !! html/php
13332 <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>
13333 </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>
13334 </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>
13335 </p>
13336 !! html/parsoid
13337 <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>
13338 <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>
13339 <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>
13340 !! end
13341
13342 !! test
13343 Image with 'frame' first.
13344 !! options
13345 parsoid=wt2html,wt2wt,html2html
13346 !! wikitext
13347 [[File:Foobar.jpg|frame|caption]]
13348 [[File:Foobar.jpg|frame|frameless|caption]]
13349 [[File:Foobar.jpg|frame|thumb|caption]]
13350 !! html/php
13351 <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>
13352 <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>
13353 <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>
13354
13355 !! html/parsoid
13356 <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>
13357 <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>
13358 <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>
13359 !! end
13360
13361 !! test
13362 Image with 'thumb' first.
13363 !! options
13364 parsoid=wt2html,wt2wt,html2html
13365 !! wikitext
13366 [[File:Foobar.jpg|thumb|caption]]
13367 [[File:Foobar.jpg|thumb|frameless|caption]]
13368 [[File:Foobar.jpg|thumb|frame|caption]]
13369 !! html/php
13370 <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>
13371 <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>
13372 <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>
13373
13374 !! html/parsoid
13375 <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>
13376 <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>
13377 <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>
13378 !! end
13379
13380 ###################
13381 # Image sizing.
13382 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
13383 # and https://phabricator.wikimedia.org/T64258
13384 # Foobar has actual size of 1941x220
13385 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
13386 # a scalable format.
13387 # 2. Framed images always ignore size options; always render at default size.
13388 # 3. "Unspecified format" and border are the only types which can be
13389 # enlarged.
13390
13391 !! test
13392 Image: "unspecified format" and border enlarge
13393 !! options
13394 parsoid=wt2html,wt2wt,html2html
13395 !! wikitext
13396 [[File:Foobar.jpg|2000px]]
13397
13398 [[File:Foobar.jpg|border|2000px]]
13399 !! html/php
13400 <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>
13401 </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>
13402 </p>
13403 !! html/parsoid
13404 <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>
13405 <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>
13406 !! end
13407
13408 !! test
13409 Image: "unspecified format" and border reduce
13410 !! options
13411 parsoid=wt2html,wt2wt,html2html
13412 !! wikitext
13413 [[File:Foobar.jpg|1000px]]
13414
13415 [[File:Foobar.jpg|border|1000px]]
13416 !! html/php
13417 <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>
13418 </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>
13419 </p>
13420 !! html/parsoid
13421 <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>
13422 <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>
13423 !! end
13424
13425 !! test
13426 Image: thumbs reduce
13427 !! options
13428 parsoid=wt2html,wt2wt,html2html
13429 !! wikitext
13430 [[File:Foobar.jpg|thumb|50px]]
13431 !! html/php
13432 <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>
13433
13434 !! html/parsoid
13435 <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>
13436 !! end
13437
13438 !! test
13439 Image: bitmap thumbs can't be enlarged past original size, but vector can.
13440 !! options
13441 parsoid=wt2html,wt2wt,html2html
13442 !! wikitext
13443 [[File:Foobar.jpg|thumb|2000px]]
13444
13445 [[File:Foobar.svg|thumb|2000px]]
13446 !! html/php
13447 <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>
13448 <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>
13449
13450 !! html/parsoid
13451 <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>
13452 <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>
13453 !! end
13454
13455 !! test
13456 Image: frameless can reduce in size
13457 !! options
13458 parsoid=wt2html,wt2wt,html2html
13459 !! wikitext
13460 [[File:Foobar.jpg|frameless|50px]]
13461 !! html/php
13462 <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>
13463 </p>
13464 !! html/parsoid
13465 <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>
13466 !! end
13467
13468 !! test
13469 Image: bitmap frameless can't be enlarged past original size, but vector can
13470 !! options
13471 parsoid=wt2html,wt2wt,html2html
13472 !! wikitext
13473 [[File:Foobar.jpg|frameless|2000px]]
13474
13475 [[File:Foobar.svg|frameless|2000px]]
13476 !! html/php
13477 <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>
13478 </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>
13479 </p>
13480 !! html/parsoid
13481 <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>
13482 <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>
13483 !! end
13484
13485 !! test
13486 Image: framed images are always unscaled.
13487 !! options
13488 parsoid=wt2html,wt2wt,html2html
13489 !! wikitext
13490 [[File:Foobar.jpg|frame]]
13491
13492 [[File:Foobar.jpg|frame|50px]]
13493
13494 [[File:Foobar.jpg|frame|50x50px]]
13495
13496 [[File:Foobar.jpg|frame|2000px]]
13497 !! html/php
13498 <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>
13499 <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>
13500 <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>
13501 <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>
13502
13503 !! html/parsoid
13504 <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>
13505 <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>
13506 <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>
13507 <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>
13508 !! end
13509
13510 ###################
13511
13512 !! test
13513 Link to image page- image page normally doesn't exists, hence edit link
13514 Add test with existing image page
13515 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
13516 !! wikitext
13517 [[:Image:test]]
13518 !! html
13519 <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>
13520 </p>
13521 !! end
13522
13523 !! test
13524 bug 18784 Link to non-existent image page with caption should use caption as link text
13525 !! wikitext
13526 [[:Image:test|caption]]
13527 !! html
13528 <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>
13529 </p>
13530 !! end
13531
13532 !! test
13533 Frameless image caption with a free URL
13534 !! wikitext
13535 [[File:Foobar.jpg|http://example.com]]
13536 !! html/php
13537 <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>
13538 </p>
13539 !! html/parsoid
13540 <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>
13541 !! end
13542
13543 !! test
13544 Thumbnail image caption with a free URL
13545 !! options
13546 thumbsize=220
13547 !! wikitext
13548 [[File:Foobar.jpg|thumb|http://example.com]]
13549 !! html/php
13550 <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>
13551
13552 !! html/parsoid
13553 <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>
13554 !! end
13555
13556 !! test
13557 Thumbnail image caption with a free URL and explicit alt
13558 !! options
13559 thumbsize=220
13560 parsoid=wt2html,wt2wt,html2html
13561 !! wikitext
13562 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
13563 !! html/php
13564 <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>
13565
13566 !! html/parsoid
13567 <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>
13568 !! end
13569
13570 !! test
13571 SVG thumbnails with no language set
13572 !! options
13573 !! wikitext
13574 [[File:Foobar.svg|thumb|caption]]
13575 !! html/php
13576 <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>
13577
13578 !! html/parsoid
13579 <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>
13580 !! end
13581
13582 !! test
13583 SVG thumbnails with language de
13584 !! options
13585 parsoid=wt2html,wt2wt,html2html
13586 !! wikitext
13587 [[File:Foobar.svg|thumb|caption|lang=de]]
13588 !! html/php
13589 <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>
13590
13591 !! html/parsoid
13592 <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>
13593 !! end
13594
13595 !! test
13596 SVG thumbnails with invalid language code
13597 !! options
13598 parsoid=wt2html,wt2wt,html2html
13599 !! wikitext
13600 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
13601 !! html/php
13602 <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>
13603
13604 !! html/parsoid
13605 <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>
13606 !! end
13607
13608 !! test
13609 BUG 1887: A ISBN with a thumbnail
13610 !! wikitext
13611 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
13612 !! html/php
13613 <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>
13614
13615 !! html/parsoid
13616 <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>
13617 !! end
13618
13619 !! test
13620 BUG 1887: A RFC with a thumbnail
13621 !! wikitext
13622 [[File:Foobar.jpg|thumb|This is RFC 12354]]
13623 !! html/php
13624 <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>
13625
13626 !! html/parsoid
13627 <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>
13628 !! end
13629
13630 !! test
13631 BUG 1887: A mailto link with a thumbnail
13632 !! wikitext
13633 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
13634 !! html/php
13635 <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>
13636
13637 !! html/parsoid
13638 <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>
13639 !! end
13640
13641 # Pending resolution to bug 368
13642 !! test
13643 BUG 648: Frameless image caption with a link
13644 !! wikitext
13645 [[File:Foobar.jpg|text with a [[link]] in it]]
13646 !! html/php
13647 <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>
13648 </p>
13649 !! html/parsoid
13650 <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>
13651 !! end
13652
13653 !! test
13654 BUG 648: Frameless image caption with a link (suffix)
13655 !! wikitext
13656 [[File:Foobar.jpg|text with a [[link]]foo in it]]
13657 !! html/php
13658 <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>
13659 </p>
13660 !! html/parsoid
13661 <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>
13662 !! end
13663
13664 !! test
13665 BUG 648: Frameless image caption with an interwiki link
13666 !! wikitext
13667 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
13668 !! html/php
13669 <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>
13670 </p>
13671 !! html/parsoid
13672 <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>
13673 !! end
13674
13675 !! test
13676 BUG 648: Frameless image caption with a piped interwiki link
13677 !! wikitext
13678 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
13679 !! html/php
13680 <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>
13681 </p>
13682 !! html/parsoid
13683 <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>
13684 !! end
13685
13686 !! test
13687 T107474: Frameless image caption with <nowiki>
13688 !! wikitext
13689 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
13690 !! html/parsoid
13691 <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>
13692 !! end
13693
13694 !! test
13695 Escape HTML special chars in image alt text
13696 !! wikitext
13697 [[File:Foobar.jpg|& < > "]]
13698 !! html/php
13699 <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>
13700 </p>
13701 !! html/parsoid
13702 <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>
13703 !! end
13704
13705 !! test
13706 BUG 499: Alt text should have &#1234;, not &amp;1234;
13707 !! wikitext
13708 [[File:Foobar.jpg|&#9792;]]
13709 !! html/php
13710 <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>
13711 </p>
13712 !! html/parsoid
13713 <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>
13714 !! end
13715
13716 !! test
13717 Broken image caption with link
13718 !! options
13719 parsoid=wt2html,wt2wt,html2html
13720 !! wikitext
13721 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
13722 !! html/php
13723 <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.
13724 </p>
13725 !! html/parsoid
13726 <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>
13727 !! end
13728
13729 !! test
13730 Image caption containing another image
13731 !! wikitext
13732 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
13733 !! html/php
13734 <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>
13735
13736 !! html/parsoid
13737 <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>
13738 !! end
13739
13740 !! test
13741 Image: caption containing a newline
13742 !! wikitext
13743 [[File:Foobar.jpg|This
13744 *is some text]]
13745 !! html/php
13746 <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>
13747 </p>
13748 !! html/parsoid
13749 <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>
13750 !!end
13751
13752 !!test
13753 Image: caption containing leading space
13754 (The leading space should not trigger nowiki escaping in wt2wt mode)
13755 !! wikitext
13756 [[File:Foobar.jpg|thumb| bar]]
13757 !! html/php
13758 <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>
13759
13760 !! html/parsoid
13761 <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>
13762 !!end
13763
13764 !! test
13765 Image: caption containing a table
13766 !! options
13767 parsoid=wt2html,wt2wt,html2html
13768 !! wikitext
13769 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
13770 {|
13771 ! Foo !! Bar
13772 |-
13773 | Foo1 || Bar1
13774 |}
13775 and some more text.]]
13776 !! html/php
13777 <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>
13778
13779 !! html/parsoid
13780 <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
13781 <table>
13782 <tbody>
13783 <tr><th>Foo </th><th>Bar</th></tr>
13784 <tr>
13785 <td>Foo1 </td>
13786 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
13787 !! end
13788
13789 !! test
13790 Bug 3090: External links other than http: in image captions
13791 !! wikitext
13792 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
13793 !! html/php
13794 <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>
13795
13796 !! html/parsoid
13797 <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>
13798 !! end
13799
13800 !! test
13801 Custom class
13802 !! options
13803 parsoid=wt2html,wt2wt,html2html
13804 !! wikitext
13805 [[Image:foobar.jpg|a|class=b]]
13806 !! html/php
13807 <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>
13808 </p>
13809 !! html/parsoid
13810 <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>
13811 !! end
13812
13813 !! test
13814 Localized image handling (1).
13815 !! options
13816 parsoid=wt2html,wt2wt,html2html
13817 language=es
13818 !! wikitext
13819 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
13820 !! html/php
13821 <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>
13822
13823 !! html/parsoid
13824 <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>
13825 !! end
13826
13827 !! test
13828 Localized image handling (2).
13829 !! options
13830 thumbsize=220
13831 parsoid=wt2html,wt2wt,html2html
13832 language=es
13833 !! wikitext
13834 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
13835 !! html/php
13836 <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>
13837
13838 !! html/parsoid
13839 <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>
13840 !! end
13841
13842 !! test
13843 "border", "frameless" and "class" attributes on an image.
13844 !! options
13845 thumbsize=220
13846 parsoid=wt2html,wt2wt,html2html
13847 !! wikitext
13848 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
13849 !! html/php
13850 <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>
13851 </p>
13852 !! html/parsoid
13853 <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>
13854 !! end
13855
13856 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
13857 !! test
13858 Invalid image attributes (bug 62500)
13859 !! options
13860 thumbsize=220
13861 parsoid=wt2html,wt2wt,html2html
13862 !! wikitext
13863 [[File:Foobar.jpg|thumb|float|left|caption]]
13864
13865 [[File:Foobar.jpg|thumb|righ|caption]]
13866
13867 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
13868 !! html/php
13869 <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>
13870 <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>
13871 <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>
13872
13873 !! html/parsoid
13874 <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>
13875 <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>
13876 <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>
13877 !! end
13878
13879 !! article
13880 File:Barfoo.jpg
13881 !! text
13882 #REDIRECT [[File:Barfoo.jpg]]
13883 !! endarticle
13884
13885 # FIXME: Parsoid should run this test -- but we'd need to teach the
13886 # mockAPI about the redirected Barfoo.jpg image.
13887 !! test
13888 Redirected image
13889 !! wikitext
13890 [[Image:Barfoo.jpg]]
13891 !! html/php
13892 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
13893 </p>
13894 !! end
13895
13896 !! test
13897 Missing image with uploads disabled
13898 !! options
13899 wgEnableUploads=0
13900 !! wikitext
13901 [[File:Foobaz.jpg]]
13902 !! html/php
13903 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
13904 </p>
13905 !! html/parsoid
13906 <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>
13907 !! end
13908
13909 # Parsoid-specific testing for images
13910 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
13911 # Currently imperfect due to a flaw in the Parsoid testrunner
13912 # Work in progress
13913 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
13914 # image tests.
13915
13916 !! test
13917 Parsoid-specific image handling - simple image with size and middle alignment
13918 !! wikitext
13919 [[File:Foobar.jpg|middle|50px]]
13920 !! html/parsoid
13921 <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>
13922 !! end
13923
13924 !! test
13925 Parsoid-specific image handling - simple image with size, middle alignment,
13926 non-standard namespace alias
13927 !! options
13928 parsoid=wt2wt,wt2html,html2html
13929 !! wikitext
13930 [[Image:Foobar.jpg|middle|50px]]
13931 !! html/parsoid
13932 <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>
13933 !! end
13934
13935 !! test
13936 Parsoid-specific image handling - simple image with size and middle alignment
13937 (existing content)
13938 !! wikitext
13939 [[File:Foobar.jpg|50px|middle]]
13940 !! html/parsoid
13941 <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>
13942 !! end
13943
13944 !! test
13945 Parsoid-specific image handling - simple image with size and middle alignment
13946 and non-standard namespace name
13947 !! options
13948 parsoid=wt2html,wt2wt,html2html
13949 !! wikitext
13950 [[Image:Foobar.jpg|50px|middle]]
13951 !! html/parsoid
13952 <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>
13953 !! end
13954
13955 !! test
13956 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
13957 !! wikitext
13958 [[File:Foobar.jpg|500x10px|baseline|caption]]
13959 !! html/parsoid
13960 <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>
13961 !! end
13962
13963 !! test
13964 Parsoid-specific image handling - simple image with border and size spec
13965 !! wikitext
13966 [[File:Foobar.jpg|50px|border|caption]]
13967 !! html/parsoid
13968 <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>
13969 !! end
13970
13971 !! test
13972 Parsoid-specific image handling - thumbnail with halign, valign, and caption
13973 !! wikitext
13974 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
13975 !! html/parsoid
13976 <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>
13977 !! end
13978
13979 !! test
13980 Parsoid-specific image handling - thumbnail with halign, valign, and caption
13981 (existing content)
13982 !! wikitext
13983 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
13984 !! html/parsoid
13985 <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>
13986 !! end
13987
13988 !! test
13989 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
13990 !! wikitext
13991 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
13992 !! html/parsoid
13993 <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>
13994 !! end
13995
13996 !! test
13997 Parsoid-specific image handling - thumbnail with specific size, halign,
13998 valign, and caption (existing content)
13999 !! wikitext
14000 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
14001 !! html/parsoid
14002 <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>
14003 !! end
14004
14005 !! test
14006 Parsoid-specific image handling - framed image with specific size and caption
14007 (size is ignored)
14008 !! options
14009 parsoid=wt2html,wt2wt,html2html
14010 !! wikitext
14011 [[File:Foobar.jpg|frame|500x50px|caption]]
14012 !! html/parsoid
14013 <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>
14014 !! end
14015
14016 !! test
14017 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
14018 (size is ignored)
14019 !! options
14020 parsoid=wt2html,wt2wt,html2html
14021 !! wikitext
14022 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
14023 !! html/parsoid
14024 <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>
14025 !! end
14026
14027 !! test
14028 Parsoid-specific image handling - frameless image with specific size, border, and caption
14029 !! wikitext
14030 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
14031 !! html/parsoid
14032 <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>
14033 !! end
14034
14035 !! test
14036 Parsoid-specific image handling - simple image with a formatted caption
14037 !! wikitext
14038 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
14039 !! html/parsoid
14040 <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>
14041 !! end
14042
14043 !! test
14044 Parsoid-specific image handling - caption with a template in it
14045 !! wikitext
14046 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
14047 !! html/parsoid
14048 <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>
14049 !! end
14050
14051 !! test
14052 Parsoid-specific image handling - caption with unbalanced tags in it
14053 !! options
14054 parsoid=wt2html,wt2wt,html2html
14055 !! wikitext
14056 foo
14057 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
14058 bar
14059 !! html/parsoid
14060 <p>foo</p>
14061 <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>
14062 <p>bar</p>
14063 !! end
14064
14065 !! test
14066 Parsoid-specific image handling - empty caption (1)
14067 !! options
14068 parsoid=wt2html,wt2wt
14069 !! wikitext
14070 [[File:Foobar.jpg|thumb|]]
14071 !! html/parsoid
14072 <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>
14073 !! end
14074
14075 # empty captions don't get serialized unless we're in the "round trip" case
14076 !! test
14077 Parsoid-specific image handling - empty caption (2)
14078 !! options
14079 parsoid=html2wt
14080 !! html/parsoid
14081 <figure class="mw-default-size" typeof="mw:Image/Thumb">
14082 <a href="./File:Foobar.jpg">
14083 <img resource="./File:Foobar.jpg"
14084 src="//example.com/images/3/3a/Foobar.jpg"
14085 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
14086 height="25" width="220"/>
14087 </a>
14088 <figcaption></figcaption>
14089 </figure>
14090 !! wikitext
14091 [[File:Foobar.jpg|thumb]]
14092 !! end
14093
14094 !! test
14095 Parsoid-specific image handling - whitespace caption
14096 !! wikitext
14097 [[File:Foobar.jpg|thumb| ]]
14098 !! html/parsoid
14099 <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>
14100 !! end
14101
14102 !! test
14103 Parsoid-specific image handling - lang option
14104 !! wikitext
14105 foo
14106 [[File:Foobar.svg|lang=de|caption]]
14107 bar
14108 !! html/parsoid
14109 <p>foo
14110 <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>
14111 bar</p>
14112 !! end
14113
14114 ## Edge case bugs in Parsoid from T93580
14115 !! test
14116 T93580: 1. Templated <ref> inside block images
14117 !! wikitext
14118 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
14119
14120 <references />
14121 !! html/parsoid
14122 <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>
14123
14124 <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>
14125 !! end
14126
14127 !! test
14128 T93580: 2. <ref> inside inline images
14129 !! wikitext
14130 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
14131
14132 <references />
14133 !! html/parsoid
14134 <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>
14135
14136 <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>
14137 !! end
14138
14139 !! test
14140 T93580: 3. Templated <ref> inside inline images
14141 !! wikitext
14142 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
14143
14144 <references />
14145 !! html/parsoid
14146 <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;}]]}\" 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;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>
14147
14148 <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>
14149 !! end
14150
14151 ###
14152 ### Subpages
14153 ###
14154 !! article
14155 Subpage test/subpage
14156 !! text
14157 foo
14158 !! endarticle
14159
14160 !! test
14161 Subpage link
14162 !! options
14163 subpage title=[[Subpage test]]
14164 !! wikitext
14165 [[/subpage]]
14166 !! html
14167 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
14168 </p>
14169 !! end
14170
14171 !! test
14172 Subpage noslash link
14173 !! options
14174 subpage title=[[Subpage test]]
14175 !! wikitext
14176 [[/subpage/]]
14177 !! html
14178 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
14179 </p>
14180 !! end
14181
14182 !! article
14183 Subpage test/1/2/subpage
14184 !! text
14185 blah
14186 !! endarticle
14187
14188 !! test
14189 Relative subpage noslash link
14190 !! options
14191 parsoid=wt2wt,wt2html,html2html
14192 subpage title=[[Subpage test/1/2/3/4]]
14193 !! wikitext
14194 [[../../subpage/]]
14195
14196 [[../../subpage]]
14197 !! html/php
14198 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
14199 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
14200 </p>
14201 !! html/parsoid
14202 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
14203 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
14204 !! end
14205
14206 !! test
14207 Parsoid: dot-slash prefixed wikilinks
14208 !! wikitext
14209 [[./foo]]
14210
14211 [[././bar]]
14212
14213 [[././baz/]]
14214 !! html/php
14215 <p>[[./foo]]
14216 </p><p>[[././bar]]
14217 </p><p>[[././baz/]]
14218 </p>
14219 !! html/parsoid
14220 <p>[[./foo]]
14221 </p><p>[[././bar]]
14222 </p><p>[[././baz/]]
14223 </p>
14224 !! end
14225
14226 !! test
14227 Render invalid page names as plain text (bug 51090)
14228 !! wikitext
14229 [[./../foo|bar]]
14230 [[foo�|bar]]
14231 [[foo/.|bar]]
14232 [[foo/..|bar]]
14233 [[foo~~~bar]]
14234 [[foo>bar]]
14235 [[foo[bar]]
14236 [[.]]
14237 [[..]]
14238 [[foo././bar]]
14239
14240 [[{{echo|./../foo}}|bar]]
14241 [[{{echo|foo/.}}|bar]]
14242 [[{{echo|foo/..}}|bar]]
14243 [[{{echo|foo~~~~bar}}]]
14244 [[{{echo|foo>bar}}]]
14245 [[{{echo|foo././bar}}]]
14246 [[{{echo|foo{bar}}]]
14247 [[{{echo|foo}bar}}]]
14248 [[{{echo|foo[bar}}]]
14249 [[{{echo|foo]bar}}]]
14250 [[{{echo|foo<bar}}]]
14251 !!html/php
14252 <p>[[./../foo|bar]]
14253 [[foo�|bar]]
14254 [[foo/.|bar]]
14255 [[foo/..|bar]]
14256 [[foo~~~bar]]
14257 [[foo&gt;bar]]
14258 [[foo[bar]]
14259 [[.]]
14260 [[..]]
14261 [[foo././bar]]
14262 </p><p>[[./../foo|bar]]
14263 [[foo/.|bar]]
14264 [[foo/..|bar]]
14265 [[foo~~~~bar]]
14266 [[foo&gt;bar]]
14267 [[foo././bar]]
14268 [[foo{bar]]
14269 [[foo}bar]]
14270 [[foo[bar]]
14271 [[foo]bar]]
14272 [[foo&lt;bar]]
14273 </p>
14274 !!html/parsoid
14275 <p>[[./../foo|bar]]
14276 [[foo�|bar]]
14277 [[foo/.|bar]]
14278 [[foo/..|bar]]
14279 [[foo~~~bar]]
14280 [[foo>bar]]
14281 [[foo[bar]]
14282 [[.]]
14283 [[..]]
14284 [[foo././bar]]</p>
14285
14286 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
14287 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
14288 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
14289 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
14290 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
14291 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
14292 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
14293 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
14294 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
14295 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
14296 [[<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>
14297 !!end
14298
14299 !! test
14300 Disabled subpages
14301 !! wikitext
14302 [[/subpage]]
14303 !! html
14304 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
14305 </p>
14306 !! end
14307
14308 !! test
14309 BUG 561: {{/Subpage}}
14310 !! options
14311 subpage title=[[Page]]
14312 !! wikitext
14313 {{/Subpage}}
14314 !! html
14315 <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>
14316 </p>
14317 !! end
14318
14319 ###
14320 ### Categories
14321 ###
14322 !! article
14323 Category:MediaWiki User's Guide
14324 !! text
14325 blah
14326 !! endarticle
14327
14328 !! test
14329 Link to category
14330 !! wikitext
14331 [[:Category:MediaWiki User's Guide]]
14332 !! html
14333 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
14334 </p>
14335 !! end
14336
14337 !! test
14338 Simple category
14339 !! options
14340 cat
14341 !! wikitext
14342 [[Category:MediaWiki User's Guide]]
14343 !! html
14344 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14345 !! end
14346
14347 !! test
14348 PAGESINCATEGORY invalid title fatal (r33546 fix)
14349 !! wikitext
14350 {{PAGESINCATEGORY:<bogus>}}
14351 !! html
14352 <p>0
14353 </p>
14354 !! end
14355
14356 !! test
14357 Category with different sort key
14358 !! options
14359 cat
14360 !! wikitext
14361 [[Category:MediaWiki User's Guide|Foo]]
14362 !! html
14363 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14364 !! end
14365
14366 !! test
14367 Category with identical sort key
14368 !! options
14369 cat
14370 !! wikitext
14371 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14372 !! html
14373 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14374 !! end
14375
14376 !! test
14377 Category with empty sort key
14378 !! options
14379 cat
14380 pst
14381 !! wikitext
14382 [[Category:MediaWiki User's Guide|]]
14383 !! html/php
14384 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14385 !! end
14386
14387 !! test
14388 Category with empty sort key and parentheses
14389 !! options
14390 cat
14391 pst
14392 !! wikitext
14393 [[Category:Foo (bar)|]]
14394 !! html/php
14395 [[Category:Foo (bar)|Foo]]
14396 !! end
14397
14398 ## We used to, but no longer wt2wt this test since the default serializer
14399 ## will normalize all categories to serialize on their own line.
14400 ## This wikitext usage is going to be fairly uncommon in production and
14401 ## selser will take care of preserving formatting in those scenarios.
14402 !! test
14403 Category with link tail
14404 !! options
14405 cat
14406 pst
14407 parsoid=wt2html
14408 !! wikitext
14409 123[[Category:Foo]]456
14410 !! html/php
14411 123[[Category:Foo]]456
14412 !! html/parsoid
14413 <p>123<link rel="mw:PageProp/Category" href="Category:Foo"/>456</p>
14414 !! end
14415
14416 !! test
14417 Category with template
14418 !! options
14419 cat
14420 pst
14421 !! wikitext
14422 [[Category:{{echo|Foo}}]]
14423 !! html/php
14424 [[Category:{{echo|Foo}}]]
14425 !! end
14426
14427 !! test
14428 Category with template in sort key
14429 !! options
14430 cat
14431 pst
14432 !! wikitext
14433 [[Category:Foo|{{echo|Bar}}]]
14434 !! html/php
14435 [[Category:Foo|{{echo|Bar}}]]
14436 !! end
14437
14438 !! test
14439 Category with template in sort key and title
14440 !! options
14441 cat
14442 pst
14443 !! wikitext
14444 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14445 !! html/php
14446 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14447 !! end
14448
14449 ## We used to, but no longer wt2wt this test since the default serializer
14450 ## will normalize all categories to serialize on their own line.
14451 ## This wikitext usage is going to be fairly uncommon in production and
14452 ## selser will take care of preserving formatting in those scenarios.
14453 !! test
14454 Category / paragraph interactions
14455 !! options
14456 parsoid=wt2html
14457 !! wikitext
14458 Foo [[Category:Baz]] Bar
14459
14460 Foo [[Category:Baz]]
14461 Bar
14462
14463 Foo
14464 [[Category:Baz]]
14465 Bar
14466
14467 Foo
14468 [[Category:Baz]] Bar
14469
14470 Foo
14471 [[Category:Baz]]
14472 [[Category:Baz]]
14473 [[Category:Baz]]
14474 Bar
14475
14476 [[Category:Baz]]
14477 [[Category:Baz]]
14478 [[Category:Baz]]
14479
14480 [[Category:Baz]]
14481 {{echo|[[Category:Baz]]}}
14482 [[Category:Baz]]
14483 !! html/php
14484 <p>Foo Bar
14485 </p><p>Foo
14486 Bar
14487 </p><p>Foo
14488 Bar
14489 </p><p>Foo Bar
14490 </p><p>Foo
14491 Bar
14492 </p>
14493 !! html/parsoid
14494 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14495 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14496 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14497 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14498 <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>
14499 <link rel="mw:PageProp/Category" href="Category:Baz"/>
14500 !! end
14501
14502 ## We used to, but no longer wt2wt this test since the default serializer
14503 ## will normalize all categories to serialize on their own line.
14504 ## This wikitext usage is going to be fairly uncommon in production and
14505 ## selser will take care of preserving formatting in those scenarios.
14506 ##
14507 ## The whitespace on the empty line is part of the test. Please do not delete
14508 !! test
14509 1. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14510 !! options
14511 parsoid=wt2html
14512 !! wikitext
14513 This
14514
14515 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
14516
14517 {{echo|[[Category:Foo]] and so should this!}}
14518 !! html/php
14519 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
14520 </p>
14521 !! html/parsoid
14522 <p>This
14523
14524 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
14525
14526 <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>
14527 !! end
14528
14529 ## Parsoid will not try to wt2wt this while preserving newlines because
14530 ## it suppresses excess newlines within list items -- and we don't want to
14531 ## introduce a special case just for categories, which is, in reality somewhat
14532 ## odd behavior -- categories are unlikely to be used in list items like this
14533 ## in top-level pages and are only likely to show up in template-generated
14534 ## list items where this RT-ing is a non-issue.
14535 ##
14536 ## The whitespace on the empty line is part of the test. Please do not delete
14537 !! test
14538 2. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14539 !! options
14540 parsoid=wt2html
14541 !! wikitext
14542 * This
14543
14544 [[Category:Foo]] and this should be part of the same list item
14545 * So should this
14546
14547 {{echo|[[Category:Foo]] and this should be part of the same list item}}
14548 !! html
14549 <ul><li>This and this should be part of the same list item</li>
14550 <li>So should this and this should be part of the same list item</li></ul>
14551 !! html/parsoid
14552 <ul>
14553 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
14554 <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>
14555 </ul>
14556 !! end
14557
14558 ## Newlines and categories that follow the last item of a list
14559 ## are treated differently because this (list followed by categories)
14560 ## is an extremely common pattern on wikis.
14561 !! test
14562 3. Categories and newlines: newline suppression for last list item should RT properly
14563 !! wikitext
14564 * a
14565 * b
14566
14567 [[Category:Foo]]
14568
14569 [[Category:Bar]]
14570 [[Category:Baz]]
14571 !! html/parsoid
14572 <ul><li> a</li>
14573 <li> b</li></ul>
14574
14575 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14576
14577 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14578 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14579 !! end
14580
14581 !! test
14582 4. Categories and newlines: newline suppression for last list item should RT properly
14583 !! wikitext
14584 * a
14585 **** b
14586
14587 [[Category:Foo]]
14588 !! html/parsoid
14589 <ul><li> a
14590 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
14591
14592 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14593 !! end
14594
14595 ## only wt2html for this to make sure the algo only applies to the rightmost path
14596 !! test
14597 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
14598 !! options
14599 parsoid=wt2html
14600 !! wikitext
14601 * a
14602 ** b
14603 [[Category:Foo]]
14604 * c
14605 ** d
14606 [[Category:Foo]]
14607 !! html/parsoid
14608 <ul><li> a
14609 <ul><li> b
14610 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
14611 <li> c
14612 <ul><li> d</li></ul></li></ul>
14613 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14614 !! end
14615
14616 ## We used to, but no longer wt2wt this test since the default serializer
14617 ## will normalize all categories to serialize on their own line.
14618 ## This wikitext usage is going to be fairly uncommon in production and
14619 ## selser will take care of preserving formatting in those scenarios.
14620 !! test
14621 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
14622 !! options
14623 parsoid=wt2html
14624 !! wikitext
14625 * a [[Category:Foo]]
14626 !! html/parsoid
14627 <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>
14628 !! end
14629
14630 # This test also demonstrates because of newline+category tunneling
14631 # through the list hander, template wrapping doesn't expand to the
14632 # containing list when the list item swallows the category.
14633 !! test
14634 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
14635 !! wikitext
14636 * {{echo|a
14637 [[Category:Foo]]}}
14638 !! html/parsoid
14639 <ul><li> <span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n[[Category:Foo]]"}},"i":0}}]}'>a
14640 </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>
14641 !! end
14642
14643 !! test
14644 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
14645 !! wikitext
14646 * a
14647
14648 {{echo|[[Category:Foo]]
14649 [[Category:Bar]]}}
14650 [[Category:Baz]]
14651 !! html/parsoid
14652 <ul><li> a</li></ul>
14653
14654 <link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"},"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Category:Foo]]\n[[Category:Bar]]"}},"i":0}}]}'/><span about="#mwt1">
14655 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14656 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14657 !! end
14658
14659 !! test
14660 Parsoid: Serialize link to category page with colon escape
14661 !! options
14662 parsoid
14663 !! wikitext
14664
14665 [[:Category:Foo]]
14666 [[:Category:Foo|Bar]]
14667 !! html
14668 <p>
14669 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
14670 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
14671 </p>
14672 !! end
14673
14674 # We used to, but no longer wt2wt this test since the default serializer
14675 # will normalize all categories to serialize on their own line.
14676 # This wikitext usage is going to be fairly uncommon in production and
14677 # selser will take care of preventing whitespace insertion if this
14678 # occurs in an article.
14679 #
14680 # html2html disabled for the same reason (whitespace insertion between
14681 # x and y).
14682 #
14683 # html2wt disabled because it localizes the "Category" namespace.
14684 !! test
14685 Link prefix/suffixes aren't applied to category links
14686 !! options
14687 parsoid=wt2html
14688 language=is
14689 !! wikitext
14690 x[[Category:Foo]]y
14691 !! html/php
14692 <p>xy
14693 </p>
14694 !! html/parsoid
14695 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
14696 !! end
14697
14698 !! test
14699 Parsoid: Serialize link to file page with colon escape
14700 !! options
14701 parsoid
14702 !! wikitext
14703
14704 [[:File:Foo.png]]
14705 [[:File:Foo.png|Bar]]
14706 !! html
14707 <p>
14708 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
14709 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
14710 </p>
14711 !! end
14712
14713 !! test
14714 Parsoid: Serialize a genuine category link without colon escape
14715 !! options
14716 parsoid
14717 !! wikitext
14718 [[Category:Foo]]
14719 [[Category:Foo|Bar]]
14720 !! html
14721 <link rel="mw:PageProp/Category" href="./Category:Foo">
14722 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
14723 !! end
14724
14725 !! test
14726 Normalize hrefs properly before testing for invalid link targets (bug 70894)
14727 !! options
14728 parsoid=html2wt
14729 !! html/parsoid
14730 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
14731 !! wikitext
14732 [[Category:Toxine bactérienne]]
14733 !! end
14734
14735 !! test
14736 Parsoid: Defaultsort
14737 !! wikitext
14738 {{DEFAULTSORT:Foo}}
14739 !! html/parsoid
14740 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
14741 !! end
14742
14743 !! test
14744 Parsoid: Defaultsort (template-generated)
14745 !! wikitext
14746 {{{{echo|DEFAULTSORT}}:Foo}}
14747 !! html/parsoid
14748 <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}}]}'/>
14749 !! end
14750
14751 ###
14752 ### Inter-language links
14753 ###
14754 !! test
14755 Interlanguage links
14756 !! options
14757 ill
14758 !! wikitext
14759 [[es:Alimento]]
14760 [[fr:Nourriture]]
14761 [[zh:食品]]
14762 !! html/php
14763 es:Alimento fr:Nourriture zh:食品
14764 !! html/parsoid
14765 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
14766 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
14767 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
14768 !! end
14769
14770 !! test
14771 Duplicate interlanguage links (bug 24502)
14772 !! options
14773 ill
14774 !! wikitext
14775 [[es:1]]
14776 [[es:2]]
14777 [[fr:1]]
14778 [[fr:2]]
14779 !! html/php
14780 es:1 fr:1
14781 !! html/parsoid
14782 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
14783 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
14784 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
14785 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
14786 !! end
14787
14788 ###
14789 ### Sections
14790 ###
14791 !! test
14792 Basic section headings
14793 !! wikitext
14794 == Headline 1 ==
14795 Some text
14796
14797 ==Headline 2==
14798 More
14799 ===Smaller headline===
14800 Blah blah
14801 !! html
14802 <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>
14803 <p>Some text
14804 </p>
14805 <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>
14806 <p>More
14807 </p>
14808 <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>
14809 <p>Blah blah
14810 </p>
14811 !! end
14812
14813 !! test
14814 Section headings with TOC
14815 !! wikitext
14816 == Headline 1 ==
14817 === Subheadline 1 ===
14818 ===== Skipping a level =====
14819 ====== Skipping a level ======
14820
14821 == Headline 2 ==
14822 Some text
14823 ===Another headline===
14824 !! html
14825 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14826 <ul>
14827 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
14828 <ul>
14829 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
14830 <ul>
14831 <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>
14832 <ul>
14833 <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>
14834 </ul>
14835 </li>
14836 </ul>
14837 </li>
14838 </ul>
14839 </li>
14840 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
14841 <ul>
14842 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
14843 </ul>
14844 </li>
14845 </ul>
14846 </div>
14847
14848 <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>
14849 <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>
14850 <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>
14851 <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>
14852 <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>
14853 <p>Some text
14854 </p>
14855 <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>
14856
14857 !! end
14858
14859 !! test
14860 TOC anchors don't collide
14861 !! wikitext
14862 __FORCETOC__
14863 == Headline 2 ==
14864 == Headline ==
14865 == Headline 2 ==
14866 == Headline ==
14867 !! html/php
14868 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14869 <ul>
14870 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
14871 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
14872 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
14873 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
14874 </ul>
14875 </div>
14876
14877 <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>
14878 <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>
14879 <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>
14880 <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>
14881
14882 !! end
14883
14884 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
14885 !! test
14886 Handling of sections up to level 6 and beyond
14887 !! wikitext
14888 = Level 1 Heading=
14889 == Level 2 Heading==
14890 === Level 3 Heading===
14891 ==== Level 4 Heading====
14892 ===== Level 5 Heading=====
14893 ====== Level 6 Heading======
14894 ======= Level 7 Heading=======
14895 ======== Level 8 Heading========
14896 ========= Level 9 Heading=========
14897 ========== Level 10 Heading==========
14898 !! html
14899 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14900 <ul>
14901 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
14902 <ul>
14903 <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>
14904 <ul>
14905 <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>
14906 <ul>
14907 <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>
14908 <ul>
14909 <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>
14910 <ul>
14911 <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>
14912 <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>
14913 <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>
14914 <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>
14915 <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>
14916 </ul>
14917 </li>
14918 </ul>
14919 </li>
14920 </ul>
14921 </li>
14922 </ul>
14923 </li>
14924 </ul>
14925 </li>
14926 </ul>
14927 </div>
14928
14929 <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>
14930 <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>
14931 <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>
14932 <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>
14933 <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>
14934 <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>
14935 <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>
14936 <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>
14937 <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>
14938 <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>
14939
14940 !! end
14941
14942 !! test
14943 TOC regression (T11764)
14944 !! wikitext
14945 == title 1 ==
14946 === title 1.1 ===
14947 ==== title 1.1.1 ====
14948 === title 1.2 ===
14949 == title 2 ==
14950 === title 2.1 ===
14951 !! html
14952 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14953 <ul>
14954 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14955 <ul>
14956 <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>
14957 <ul>
14958 <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>
14959 </ul>
14960 </li>
14961 <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>
14962 </ul>
14963 </li>
14964 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
14965 <ul>
14966 <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>
14967 </ul>
14968 </li>
14969 </ul>
14970 </div>
14971
14972 <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>
14973 <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>
14974 <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>
14975 <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>
14976 <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>
14977 <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>
14978
14979 !! end
14980
14981 !! test
14982 TOC for heading containing <span id="..."></span> (T96153)
14983 !! wikitext
14984 __FORCETOC__
14985 ==<span id="old-anchor"></span>New title==
14986 !! html/php
14987 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14988 <ul>
14989 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
14990 </ul>
14991 </div>
14992
14993 <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>
14994
14995 !! end
14996
14997 !! test
14998 TOC with wgMaxTocLevel=3 (bug 6204)
14999 !! options
15000 wgMaxTocLevel=3
15001 !! wikitext
15002 == title 1 ==
15003 === title 1.1 ===
15004 ==== title 1.1.1 ====
15005 === title 1.2 ===
15006 == title 2 ==
15007 === title 2.1 ===
15008 !! html
15009 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15010 <ul>
15011 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15012 <ul>
15013 <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>
15014 <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>
15015 </ul>
15016 </li>
15017 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15018 <ul>
15019 <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>
15020 </ul>
15021 </li>
15022 </ul>
15023 </div>
15024
15025 <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>
15026 <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>
15027 <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>
15028 <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>
15029 <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>
15030 <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>
15031
15032 !! end
15033
15034 !! test
15035 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
15036 !! options
15037 wgMaxTocLevel=3
15038 !! wikitext
15039 ==Section 1==
15040 ===Section 1.1===
15041 ====Section 1.1.1====
15042 ====Section 1.1.1.1====
15043 ==Section 2==
15044 !! html
15045 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15046 <ul>
15047 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
15048 <ul>
15049 <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>
15050 </ul>
15051 </li>
15052 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
15053 </ul>
15054 </div>
15055
15056 <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>
15057 <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>
15058 <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>
15059 <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>
15060 <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>
15061
15062 !! end
15063
15064
15065 !! test
15066 Resolving duplicate section names
15067 !! wikitext
15068 == Foo bar ==
15069 == Foo bar ==
15070 !! html
15071 <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>
15072 <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>
15073
15074 !! end
15075
15076 !! test
15077 Resolving duplicate section names with differing case (bug 10721)
15078 !! wikitext
15079 == Foo bar ==
15080 == Foo Bar ==
15081 !! html
15082 <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>
15083 <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>
15084
15085 !! end
15086
15087 !! article
15088 Template:sections
15089 !! text
15090 ===Section 1===
15091 ==Section 2==
15092 !! endarticle
15093
15094 !! test
15095 Template with sections, __NOTOC__
15096 !! wikitext
15097 __NOTOC__
15098 ==Section 0==
15099 {{sections}}
15100 ==Section 4==
15101 !! html
15102 <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>
15103 <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>
15104 <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>
15105 <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>
15106
15107 !! end
15108
15109 !! test
15110 __NOEDITSECTION__ keyword
15111 !! wikitext
15112 __NOEDITSECTION__
15113 ==Section 1==
15114 ==Section 2==
15115 !! html
15116 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
15117 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
15118
15119 !! end
15120
15121 !! test
15122 Link inside a section heading
15123 !! wikitext
15124 ==Section with a [[Main Page|link]] in it==
15125 !! html
15126 <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>
15127
15128 !! end
15129
15130 !! test
15131 TOC regression (T14077)
15132 !! wikitext
15133 __TOC__
15134 == title 1 ==
15135 === title 1.1 ===
15136 == title 2 ==
15137 !! html
15138 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15139 <ul>
15140 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15141 <ul>
15142 <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>
15143 </ul>
15144 </li>
15145 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
15146 </ul>
15147 </div>
15148
15149 <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>
15150 <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>
15151 <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>
15152
15153 !! end
15154
15155 !! test
15156 BUG 1219 URL next to image (good)
15157 !! wikitext
15158 http://example.com [[File:Foobar.jpg]]
15159 !! html/php
15160 <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>
15161 </p>
15162 !! html/parsoid
15163 <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>
15164 !!end
15165
15166 !! test
15167 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
15168 !! wikitext
15169 ===
15170 The line above must have a trailing space!
15171 === <!--
15172 --> <!-- -->
15173 But just in case it doesn't...
15174 !! html
15175 <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>
15176 <p>The line above must have a trailing space!
15177 </p>
15178 <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>
15179 <p>But just in case it doesn't...
15180 </p>
15181 !! end
15182
15183 !! test
15184 Header with special characters (bug 25462)
15185 !! wikitext
15186 The tooltips shall not show entities to the user (ie. be double escaped)
15187
15188 == text > text ==
15189 section 1
15190
15191 == text < text ==
15192 section 2
15193
15194 == text & text ==
15195 section 3
15196
15197 == text ' text ==
15198 section 4
15199
15200 == text " text ==
15201 section 5
15202 !! html
15203 <p>The tooltips shall not show entities to the user (ie. be double escaped)
15204 </p>
15205 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15206 <ul>
15207 <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>
15208 <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>
15209 <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>
15210 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
15211 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
15212 </ul>
15213 </div>
15214
15215 <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>
15216 <p>section 1
15217 </p>
15218 <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>
15219 <p>section 2
15220 </p>
15221 <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>
15222 <p>section 3
15223 </p>
15224 <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>
15225 <p>section 4
15226 </p>
15227 <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>
15228 <p>section 5
15229 </p>
15230 !! end
15231
15232 !! test
15233 Header with space, plus and underscore as entity
15234 !! wikitext
15235 Id should not contain + for spaces
15236
15237 == Space between Text ==
15238 section 1
15239
15240 == Space-Entity&#32;between&#32;Text ==
15241 section 2
15242
15243 == Plus+between+Text ==
15244 section 3
15245
15246 == Plus-Entity&#43;between&#43;Text ==
15247 section 4
15248
15249 == Underscore_between_Text ==
15250 section 5
15251
15252 == Underscore-Entity&#95;between&#95;Text ==
15253 section 6
15254
15255 [[#Space between Text]]
15256 [[#Space-Entity&#32;between&#32;Text]]
15257 [[#Plus+between+Text]]
15258 [[#Plus-Entity&#43;between&#43;Text]]
15259 [[#Underscore_between_Text]]
15260 [[#Underscore-Entity&#95;between&#95;Text]]
15261 !! html
15262 <p>Id should not contain + for spaces
15263 </p>
15264 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15265 <ul>
15266 <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>
15267 <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>
15268 <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>
15269 <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>
15270 <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>
15271 <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>
15272 </ul>
15273 </div>
15274
15275 <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>
15276 <p>section 1
15277 </p>
15278 <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>
15279 <p>section 2
15280 </p>
15281 <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>
15282 <p>section 3
15283 </p>
15284 <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>
15285 <p>section 4
15286 </p>
15287 <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>
15288 <p>section 5
15289 </p>
15290 <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>
15291 <p>section 6
15292 </p><p><a href="#Space_between_Text">#Space between Text</a>
15293 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
15294 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
15295 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
15296 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
15297 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
15298 </p>
15299 !! end
15300
15301 !! test
15302 Headers with excess '=' characters
15303 (Are similar tests necessary beyond the 1st level?)
15304 !! wikitext
15305 =foo==
15306 ==foo=
15307 =''italic'' heading==
15308 ==''italic'' heading=
15309 !! html
15310 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15311 <ul>
15312 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
15313 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
15314 <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>
15315 <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>
15316 </ul>
15317 </div>
15318
15319 <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>
15320 <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>
15321 <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>
15322 <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>
15323
15324 !! end
15325
15326 !! test
15327 HTML headers vs TOC (bug 23393)
15328 (__NOEDITSECTION__ for clearer output, doesn't matter here)
15329 !! wikitext
15330 <h1>Header 1</h1>
15331 == Header 1.1 ==
15332 == Header 1.2 ==
15333
15334 <h1>Header 2
15335 </h1>
15336 == Header 2.1 ==
15337 == Header 2.2 ==
15338 __NOEDITSECTION__
15339 !! html
15340 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15341 <ul>
15342 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
15343 <ul>
15344 <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>
15345 <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>
15346 </ul>
15347 </li>
15348 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
15349 <ul>
15350 <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>
15351 <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>
15352 </ul>
15353 </li>
15354 </ul>
15355 </div>
15356
15357 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
15358 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
15359 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
15360 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
15361 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
15362 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
15363
15364 !! end
15365
15366 !! test
15367 Single-line or multiline-comments can follow headings
15368 !! options
15369 parsoid=wt2html,wt2wt
15370 !! wikitext
15371 ==foo==<!---->
15372 ==bar==<!--c1-->
15373 ==baz==<!--
15374 c2
15375 c3-->
15376 !! html
15377 <h2><span class="mw-headline" id="foo">foo</span></h2>
15378 <h2><span class="mw-headline" id="bar">bar</span></h2>
15379 <h2><span class="mw-headline" id="baz">baz</span></h2>
15380
15381 !! end
15382
15383 !! test
15384 BUG 1219 URL next to image (broken)
15385 !! wikitext
15386 http://example.com[[File:Foobar.jpg]]
15387 !! html/php
15388 <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>
15389 </p>
15390 !! html/parsoid
15391 <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>
15392 !!end
15393
15394 !! test
15395 Bug 1186 news: in the middle of text
15396 !! wikitext
15397 http://en.wikinews.org/wiki/Wikinews:Workplace
15398 !! html
15399 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
15400 </p>
15401 !!end
15402
15403
15404 !! test
15405 Namespaced link must have a title
15406 !! wikitext
15407 [[Project:]]
15408 !! html
15409 <p>[[Project:]]
15410 </p>
15411 !!end
15412
15413 !! test
15414 Namespaced link must have a title (bad fragment version)
15415 !! wikitext
15416 [[Project:#fragment]]
15417 !! html
15418 <p>[[Project:#fragment]]
15419 </p>
15420 !!end
15421
15422
15423 ###
15424 ### HTML tags and HTML attributes
15425 ###
15426
15427 !! test
15428 div with no attributes
15429 !! wikitext
15430 <div>HTML rocks</div>
15431 !! html
15432 <div>HTML rocks</div>
15433
15434 !! end
15435
15436 !! test
15437 div with double-quoted attribute
15438 !! wikitext
15439 <div id="rock">HTML rocks</div>
15440 !! html
15441 <div id="rock">HTML rocks</div>
15442
15443 !! end
15444
15445 !! test
15446 div with single-quoted attribute
15447 !! wikitext
15448 <div id='rock'>HTML rocks</div>
15449 !! html
15450 <div id="rock">HTML rocks</div>
15451
15452 !! end
15453
15454 !! test
15455 div with unquoted attribute
15456 !! wikitext
15457 <div id=rock>HTML rocks</div>
15458 !! html
15459 <div id="rock">HTML rocks</div>
15460
15461 !! end
15462
15463 !! test
15464 div with illegal double attributes
15465 !! wikitext
15466 <div id="a" id="b">HTML rocks</div>
15467 !! html
15468 <div id="b">HTML rocks</div>
15469
15470 !!end
15471
15472 !! test
15473 div with empty attribute value, space before equals
15474 !! wikitext
15475 <div class =>HTML rocks</div>
15476 !! html
15477 <div class="">HTML rocks</div>
15478
15479 !! end
15480
15481 # FIXME: Parsoid doesn't match the html5 spec
15482 !! test
15483 div with multiple empty attribute values
15484 !! options
15485 parsoid=wt2html,html2html
15486 !! wikitext
15487 <div id= title=>HTML rocks</div>
15488 !! html/php
15489 <div id="title.3D">HTML rocks</div>
15490
15491 !! html/parsoid
15492 <div id="" title="">HTML rocks</div>
15493 !! end
15494
15495 # FIXME: Parsoid doesn't match the html5 spec
15496 !! test
15497 table with multiple empty attribute values
15498 !! options
15499 parsoid=wt2html,html2html
15500 !! wikitext
15501 {| title= id=
15502 | hi
15503 |}
15504 !! html/php
15505 <table title="id=">
15506 <tr>
15507 <td> hi
15508 </td></tr></table>
15509
15510 !! html/parsoid
15511 <table title="" id="">
15512 <tbody><tr><td> hi</td></tr>
15513 </tbody></table>
15514 !! end
15515
15516 !! test
15517 div with braces in attribute value
15518 !! wikitext
15519 <div title="{}">Foo</div>
15520 !! html/php
15521 <div title="&#123;}">Foo</div>
15522
15523 !! html/parsoid
15524 <div title="{}">Foo</div>
15525 !! end
15526
15527 !! test
15528 div with empty attribute value, no space before equals
15529 !! options
15530 parsoid=wt2html,html2html
15531 !! wikitext
15532 <div class=>HTML rocks</div>
15533 !! html/php
15534 <div class="">HTML rocks</div>
15535
15536 !! html/parsoid
15537 <div class="">HTML rocks</div>
15538 !! end
15539
15540 !! test
15541 HTML multiple attributes correction
15542 !! wikitext
15543 <p class="error" class="awesome">Awesome!</p>
15544 !! html
15545 <p class="awesome">Awesome!</p>
15546
15547 !!end
15548
15549 !! test
15550 Table multiple attributes correction
15551 !! wikitext
15552 {|
15553 !+ class="error" class="awesome"| status
15554 |}
15555 !! html
15556 <table>
15557 <tr>
15558 <th class="awesome"> status
15559 </th></tr></table>
15560
15561 !!end
15562
15563 !! test
15564 DIV IN UPPERCASE
15565 !! wikitext
15566 <DIV ID="x">HTML ROCKS</DIV>
15567 !! html
15568 <div id="x">HTML ROCKS</div>
15569
15570 !!end
15571
15572 !! test
15573 Non-ASCII pseudo-tags are rendered as text
15574 !! wikitext
15575 <khyô>
15576 !! html
15577 <p>&lt;khyô&gt;
15578 </p>
15579 !! end
15580
15581 !! test
15582 Pseudo-tag with URL 'name' renders as url link
15583 !! wikitext
15584 <http://example.com/>
15585 !! html
15586 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
15587 </p>
15588 !! end
15589
15590 !! test
15591 text with amp in the middle of nowhere
15592 !! wikitext
15593 Remember AT&T?
15594 !! html
15595 <p>Remember AT&amp;T?
15596 </p>
15597 !! end
15598
15599 !! test
15600 text with character entity: eacute
15601 !! wikitext
15602 I always thought &eacute; was a cute letter.
15603 !! html
15604 <p>I always thought &#233; was a cute letter.
15605 </p>
15606 !! html+tidy
15607 <p>I always thought é was a cute letter.</p>
15608 !! end
15609
15610 !! test
15611 text with entity-escaped character entity-like string: eacute
15612 !! wikitext
15613 I always thought &amp;eacute; was a cute letter.
15614 !! html
15615 <p>I always thought &amp;eacute; was a cute letter.
15616 </p>
15617 !! end
15618
15619 !! test
15620 text with undefined character entity: xacute
15621 !! wikitext
15622 I always thought &xacute; was a cute letter.
15623 !! html
15624 <p>I always thought &amp;xacute; was a cute letter.
15625 </p>
15626 !! end
15627
15628 !! test
15629 HTML5 tags
15630 !! wikitext
15631 <data value="5">five</data>
15632 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
15633 <mark>This highlighted text</mark>
15634 !! html
15635 <p><data value="5">five</data>
15636 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
15637 <mark>This highlighted text</mark>
15638 </p>
15639 !! end
15640
15641 !! test
15642 HTML tag with leading space is parsed as text
15643 !! wikitext
15644 < div>foo< /div>
15645 !! html
15646 <p>&lt; div&gt;foo&lt; /div&gt;
15647 </p>
15648 !! end
15649
15650 ###
15651 ### Nesting tests (see bug 41545, 50604, 51081)
15652 ###
15653
15654 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
15655 # Note that html2wt is considerably more difficult if we use <b> in
15656 # the test case, instead of <big>
15657 !! test
15658 Ensure that HTML adoption agency algorithm is properly implemented.
15659 !! wikitext
15660 <big>X<big>Y</big>Z</big>
15661 !! html
15662 <p><big>X<big>Y</big>Z</big>
15663 </p>
15664 !! end
15665
15666 # This was bug 41545 in the PHP parser.
15667 # Note that tidy doesn't handle this correctly.
15668 !! test
15669 Nesting of <kbd>
15670 !! wikitext
15671 <kbd>X<kbd>Y</kbd>Z</kbd>
15672 !! html
15673 <p><kbd>X<kbd>Y</kbd>Z</kbd>
15674 </p>
15675 !! end
15676
15677 # The following cases were bug 51081 in the PHP parser.
15678 # Note that there are some other nestable tags (b, i, etc) which are
15679 # not covered; see bug 51081 for discussion.
15680
15681 # Note that tidy doesn't handle this correctly.
15682 !! test
15683 Nesting of <em>
15684 !! wikitext
15685 <em>X<em>Y</em>Z</em>
15686 !! html
15687 <p><em>X<em>Y</em>Z</em>
15688 </p>
15689 !! end
15690
15691 # Note that tidy doesn't handle this correctly.
15692 !! test
15693 Nesting of <strong>
15694 !! wikitext
15695 <strong>X<strong>Y</strong>Z</strong>
15696 !! html
15697 <p><strong>X<strong>Y</strong>Z</strong>
15698 </p>
15699 !! end
15700
15701 !! test
15702 Nesting of <q>
15703 !! wikitext
15704 <q>X<q>Y</q>Z</q>
15705 !! html+tidy
15706 <p><q>X<q>Y</q>Z</q></p>
15707 !! end
15708
15709 # Note that tidy doesn't handle this correctly.
15710 !! test
15711 Nesting of <ruby>
15712 !! wikitext
15713 <ruby>X<ruby>Y</ruby>Z</ruby>
15714 !! html
15715 <p><ruby>X<ruby>Y</ruby>Z</ruby>
15716 </p>
15717 !! end
15718
15719 # Note that tidy doesn't handle this correctly.
15720 !! test
15721 Nesting of <bdo>
15722 !! wikitext
15723 <bdo>X<bdo>Y</bdo>Z</bdo>
15724 !! html
15725 <p><bdo>X<bdo>Y</bdo>Z</bdo>
15726 </p>
15727 !! end
15728
15729
15730 ###
15731 ### Media links
15732 ###
15733
15734 !! test
15735 Media link
15736 !! wikitext
15737 [[Media:Foobar.jpg]]
15738 !! html
15739 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
15740 </p>
15741 !! end
15742
15743 !! test
15744 Media link with text
15745 !! wikitext
15746 [[Media:Foobar.jpg|A neat file to look at]]
15747 !! html
15748 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
15749 </p>
15750 !! end
15751
15752 # FIXME: this is still bad HTML tag nesting
15753 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
15754 !! test
15755 Media link with nasty text
15756 !! wikitext
15757 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
15758 !! html
15759 <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>
15760
15761 !! html+tidy
15762 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
15763 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
15764 !! end
15765
15766 !! test
15767 Media link to nonexistent file (bug 1702)
15768 !! wikitext
15769 [[Media:No such.jpg]]
15770 !! html
15771 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
15772 </p>
15773 !! end
15774
15775 !! test
15776 Image link to nonexistent file (bug 1850 - good)
15777 !! wikitext
15778 [[File:No_such.jpg]]
15779 !! html/php
15780 <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>
15781 </p>
15782 !! html/parsoid
15783 <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>
15784 !! end
15785
15786 !! test
15787 :Image link to nonexistent file (bug 1850 - bad)
15788 !! wikitext
15789 [[:Image:No such.jpg]]
15790 !! html/php
15791 <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>
15792 </p>
15793 !! html/parsoid
15794 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
15795 !! end
15796
15797
15798
15799 !! test
15800 Character reference normalization in link text (bug 1938)
15801 !! wikitext
15802 [[Main Page|this&that]]
15803 !! html
15804 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
15805 </p>
15806 !!end
15807
15808 !! article
15809 אַ
15810 !! text
15811 Test for unicode normalization
15812
15813 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
15814 !! endarticle
15815
15816 !! test
15817 (bug 19451) Links should refer to the normalized form.
15818 !! wikitext
15819 [[&#xFB2E;]]
15820 [[&#x5d0;&#x5b7;]]
15821 [[&#x5d0;ַ]]
15822 [[א&#x5b7;]]
15823 [[אַ]]
15824 !! html
15825 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
15826 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
15827 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
15828 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
15829 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
15830 </p>
15831 !! end
15832
15833 !! test
15834 Empty attribute crash test (bug 2067)
15835 !! wikitext
15836 <font color="">foo</font>
15837 !! html
15838 <p><font color="">foo</font>
15839 </p>
15840 !! end
15841
15842 !! test
15843 Empty attribute crash test single-quotes (bug 2067)
15844 !! wikitext
15845 <font color=''>foo</font>
15846 !! html
15847 <p><font color="">foo</font>
15848 </p>
15849 !! end
15850
15851 !! test
15852 Attribute test: equals, then nothing
15853 !! wikitext
15854 <font color=>foo</font>
15855 !! html
15856 <p><font color="">foo</font>
15857 </p>
15858 !! end
15859
15860 !! test
15861 Attribute test: unquoted value
15862 !! wikitext
15863 <font color=x>foo</font>
15864 !! html
15865 <p><font color="x">foo</font>
15866 </p>
15867 !! end
15868
15869 !! test
15870 Attribute test: unquoted but illegal value (hash)
15871 !! wikitext
15872 <font color=#x>foo</font>
15873 !! html
15874 <p><font color="#x">foo</font>
15875 </p>
15876 !! end
15877
15878 # Parsoid does not serialize to empty attribute syntax,
15879 # so wt2wt and html2wt cases are skipped
15880 !! test
15881 Attribute test: no value (T54330)
15882 !! options
15883 parsoid=wt2html,html2html
15884 !! wikitext
15885 <font color>foo</font>
15886 !! html/php
15887 <p><font color="">foo</font>
15888 </p>
15889 !! html/parsoid
15890 <p><font color="">foo</font></p>
15891 !! end
15892
15893 !! test
15894 Bug 2095: link with three closing brackets
15895 !! wikitext
15896 [[Main Page]]]
15897 !! html/php
15898 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
15899 </p>
15900 !! html/parsoid
15901 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
15902 !! end
15903
15904 !! test
15905 Bug 2095: link with pipe and three closing brackets
15906 !! wikitext
15907 [[Main Page|link]]]
15908 !! html/php
15909 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
15910 </p>
15911 !! html/parsoid
15912 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
15913 !! end
15914
15915 !! test
15916 Bug 2095: link with pipe and three closing brackets, version 2
15917 !! wikitext
15918 [[Main Page|[http://example.com/]]]
15919 !! html/php
15920 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
15921 </p>
15922 !! html/parsoid
15923 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
15924 !! end
15925
15926
15927 ###
15928 ### Safety
15929 ###
15930
15931 !! article
15932 Template:Dangerous attribute
15933 !! text
15934 " onmouseover="alert(document.cookie)
15935 !! endarticle
15936
15937 !! article
15938 Template:Dangerous style attribute
15939 !! text
15940 border-size: expression(alert(document.cookie))
15941 !! endarticle
15942
15943 !! article
15944 Template:Div style
15945 !! text
15946 <div style="float: right; {{{1}}}">Magic div</div>
15947 !! endarticle
15948
15949 !! test
15950 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
15951 !! wikitext
15952 <div title="{{test}}"></div>
15953 !! html
15954 <div title="This is a test template"></div>
15955
15956 !! end
15957
15958 # Parsoid has enough context to handle this case
15959 !! test
15960 Bug 2304: HTML attribute safety (dangerous template; 2309)
15961 !! wikitext
15962 <div title="{{dangerous attribute}}"></div>
15963 !! html/php
15964 <div title=""></div>
15965
15966 !! html/parsoid
15967 <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>
15968 !! end
15969
15970 !! test
15971 Bug 2304: HTML attribute safety (dangerous style template; 2309)
15972 !! wikitext
15973 <div style="{{dangerous style attribute}}"></div>
15974 !! html
15975 <div style="/* insecure input */"></div>
15976
15977 !! end
15978
15979 !! test
15980 Bug 2304: HTML attribute safety (safe parameter; 2309)
15981 !! wikitext
15982 {{div style|width: 200px}}
15983 !! html
15984 <div style="float: right; width: 200px">Magic div</div>
15985
15986 !! end
15987
15988 !! test
15989 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
15990 !! wikitext
15991 {{div style|width: expression(alert(document.cookie))}}
15992 !! html
15993 <div style="/* insecure input */">Magic div</div>
15994
15995 !! end
15996
15997 !! test
15998 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
15999 !! wikitext
16000 {{div style|"><script>alert(document.cookie)</script>}}
16001 !! html
16002 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16003
16004 !! end
16005
16006 !! test
16007 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
16008 !! wikitext
16009 {{div style|" ><script>alert(document.cookie)</script>}}
16010 !! html
16011 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16012
16013 !! end
16014
16015 !! test
16016 Bug 2304: HTML attribute safety (link)
16017 !! wikitext
16018 <div title="[[Main Page]]"></div>
16019 !! html
16020 <div title="&#91;&#91;Main Page]]"></div>
16021
16022 !! end
16023
16024 !! test
16025 Bug 2304: HTML attribute safety (italics)
16026 !! wikitext
16027 <div title="''foobar''"></div>
16028 !! html
16029 <div title="&#39;&#39;foobar&#39;&#39;"></div>
16030
16031 !! end
16032
16033 !! test
16034 Bug 2304: HTML attribute safety (bold)
16035 !! wikitext
16036 <div title="'''foobar'''"></div>
16037 !! html
16038 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
16039
16040 !! end
16041
16042
16043 !! test
16044 Bug 2304: HTML attribute safety (ISBN)
16045 !! wikitext
16046 <div title="ISBN 1234567890"></div>
16047 !! html
16048 <div title="&#73;SBN 1234567890"></div>
16049
16050 !! end
16051
16052 !! test
16053 Bug 2304: HTML attribute safety (RFC)
16054 !! wikitext
16055 <div title="RFC 1234"></div>
16056 !! html
16057 <div title="&#82;FC 1234"></div>
16058
16059 !! end
16060
16061 !! test
16062 Bug 2304: HTML attribute safety (PMID)
16063 !! wikitext
16064 <div title="PMID 1234567890"></div>
16065 !! html
16066 <div title="&#80;MID 1234567890"></div>
16067
16068 !! end
16069
16070 !! test
16071 Bug 2304: HTML attribute safety (web link)
16072 !! wikitext
16073 <div title="http://example.com/"></div>
16074 !! html
16075 <div title="http&#58;//example.com/"></div>
16076
16077 !! end
16078
16079 !! test
16080 Bug 2304: HTML attribute safety (named web link)
16081 !! wikitext
16082 <div title="[http://example.com/ link]"></div>
16083 !! html
16084 <div title="&#91;http&#58;//example.com/ link]"></div>
16085
16086 !! end
16087
16088 !! test
16089 Bug 3244: HTML attribute safety (extension; safe)
16090 !! wikitext
16091 <div style="<nowiki>background:blue</nowiki>"></div>
16092 !! html
16093 <div style="background:blue"></div>
16094
16095 !! end
16096
16097 !! test
16098 Bug 3244: HTML attribute safety (extension; unsafe)
16099 !! wikitext
16100 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
16101 !! html
16102 <div style="/* insecure input */"></div>
16103
16104 !! end
16105
16106 # More MSIE fun discovered by Tom Gilder
16107
16108 !! test
16109 MSIE CSS safety test: spurious slash
16110 !! wikitext
16111 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
16112 !! html
16113 <div style="/* insecure input */">evil</div>
16114
16115 !! end
16116
16117 !! test
16118 MSIE CSS safety test: hex code
16119 !! wikitext
16120 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
16121 !! html
16122 <div style="/* insecure input */">evil</div>
16123
16124 !! end
16125
16126 !! test
16127 MSIE CSS safety test: comment in url
16128 !! wikitext
16129 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
16130 !! html
16131 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
16132
16133 !! end
16134
16135 !! test
16136 MSIE CSS safety test: comment in expression
16137 !! wikitext
16138 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
16139 !! html
16140 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
16141
16142 !! end
16143
16144 !! test
16145 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
16146 !! wikitext
16147 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
16148 !! html
16149 <p style="/* invalid control char */">A</p>
16150
16151 !! end
16152
16153 !! test
16154 MSIE 6 CSS safety test: Fullwidth (bug 55332)
16155 !! wikitext
16156 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
16157 <div style="top:EXPRESSION(alert())">B</div>
16158 !! html
16159 <p style="/* insecure input */">A</p>
16160 <div style="/* insecure input */">B</div>
16161
16162 !! end
16163
16164 !! test
16165 MSIE 6 CSS safety test: IPA extensions (bug 55332)
16166 !! wikitext
16167 <div style="background-image:uʀʟ(javascript:alert())">A</div>
16168 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
16169 !! html
16170 <div style="/* insecure input */">A</div>
16171 <p style="/* insecure input */">B</p>
16172
16173 !! end
16174
16175 !! test
16176 MSIE 6 CSS safety test: sup/sub script (bug 55332)
16177 !! wikitext
16178 <div style="background-image:url⁽javascript:alert())">A</div>
16179 <div style="background-image:url₍javascript:alert())">B</div>
16180 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
16181 !! html
16182 <div style="/* insecure input */">A</div>
16183 <div style="/* insecure input */">B</div>
16184 <p style="/* insecure input */">C</p>
16185
16186 !! end
16187
16188 # FIXME: Parsoid fails to sanitize this! See T58846.
16189 !! test
16190 Opera -o-link CSS
16191 !! wikitext
16192 <div
16193 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;"
16194 style="-o-link:attr(title);-o-link-source:current">X</div>
16195 !! html
16196 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
16197
16198 !! end
16199
16200 !! test
16201 MSIE 6 CSS safety test: Repetition markers (bug 55332)
16202 !! wikitext
16203 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
16204 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
16205 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
16206 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
16207 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
16208 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
16209 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
16210 !! html
16211 <p style="/* insecure input */">A</p>
16212 <p style="/* insecure input */">B</p>
16213 <p style="/* insecure input */">C</p>
16214 <p style="/* insecure input */">D</p>
16215 <p style="/* insecure input */">E</p>
16216 <p style="/* insecure input */">F</p>
16217 <p style="/* insecure input */">G</p>
16218
16219 !! end
16220
16221 !! test
16222 Table attribute legitimate extension
16223 !! wikitext
16224 {|
16225 !+ style="<nowiki>color:blue</nowiki>"| status
16226 |}
16227 !! html
16228 <table>
16229 <tr>
16230 <th style="color:blue"> status
16231 </th></tr></table>
16232
16233 !!end
16234
16235 !! test
16236 Table attribute safety
16237 !! wikitext
16238 {|
16239 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
16240 |}
16241 !! html
16242 <table>
16243 <tr>
16244 <th style="/* insecure input */"> status
16245 </th></tr></table>
16246
16247 !! end
16248
16249 !! test
16250 CSS line continuation 1
16251 !! wikitext
16252 <div style="background-image: u\&#10;rl(test.jpg);"></div>
16253 !! html
16254 <div style="/* insecure input */"></div>
16255
16256 !! end
16257
16258 !! test
16259 CSS line continuation 2
16260 !! wikitext
16261 <div style="background-image: u\&#13;rl(test.jpg); "></div>
16262 !! html
16263 <div style="/* invalid control char */"></div>
16264
16265 !! end
16266
16267 !! article
16268 Template:Identity
16269 !! text
16270 {{{1}}}
16271 !! endarticle
16272
16273 !! test
16274 Expansion of multi-line templates in attribute values (bug 6255)
16275 !! wikitext
16276 <div style="background: {{identity|#00FF00}}">-</div>
16277 !! html
16278 <div style="background: #00FF00">-</div>
16279
16280 !! end
16281
16282
16283 !! test
16284 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
16285 !! wikitext
16286 <div style="background:
16287 #00FF00">-</div>
16288 !! html/php
16289 <div style="background: #00FF00">-</div>
16290
16291 !! html/parsoid
16292 <div style="background:
16293 #00FF00">-</div>
16294 !! end
16295
16296 !! test
16297 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
16298 !! wikitext
16299 <div style="background: &#10;#00FF00">-</div>
16300 !! html
16301 <div style="background: &#10;#00FF00">-</div>
16302
16303 !! end
16304
16305 !! test
16306 evil <math>-wiki-tags without Extension:Math enabled
16307 !! wikitext
16308 <math><img src="some evil external link"><script>some_evil_javascript();</script></math>
16309 !! html+tidy
16310 <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>
16311 !! end
16312
16313 ###
16314 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
16315 ###
16316 !! test
16317 Parser hook: empty input
16318 !! wikitext
16319 <tag></tag>
16320 !! html/php
16321 <pre>
16322 ''
16323 array (
16324 )
16325 </pre>
16326
16327 !! html/parsoid
16328 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16329 !! end
16330
16331 ## Don't expect parsoid to rt this form.
16332 !! test
16333 Parser hook: empty input using terminated empty elements
16334 !! options
16335 parsoid=wt2html,html2html
16336 !! wikitext
16337 <tag/>
16338 !! html/php
16339 <pre>
16340 NULL
16341 array (
16342 )
16343 </pre>
16344
16345 !! html/parsoid
16346 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16347 !! end
16348
16349 !! test
16350 Parser hook: empty input using terminated empty elements (space before)
16351 !! wikitext
16352 <tag />
16353 !! html/php
16354 <pre>
16355 NULL
16356 array (
16357 )
16358 </pre>
16359
16360 !! html/parsoid
16361 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16362 !! end
16363
16364 !! test
16365 Parser hook: basic input
16366 !! wikitext
16367 <tag>input</tag>
16368 !! html/php
16369 <pre>
16370 'input'
16371 array (
16372 )
16373 </pre>
16374
16375 !! html/parsoid
16376 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16377 !! end
16378
16379 ## Don't expect parsoid to rt this form.
16380 !! test
16381 Parser hook: case insensitive
16382 !! options
16383 parsoid=wt2html,html2html
16384 !! wikitext
16385 <TAG>input</TAG>
16386 !! html/php
16387 <pre>
16388 'input'
16389 array (
16390 )
16391 </pre>
16392
16393 !! html/parsoid
16394 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16395 !! end
16396
16397 ## Don't expect parsoid to rt this form.
16398 !! test
16399 Parser hook: case insensitive, redux
16400 !! options
16401 parsoid=wt2html,html2html
16402 !! wikitext
16403 <TaG>input</TAg>
16404 !! html/php
16405 <pre>
16406 'input'
16407 array (
16408 )
16409 </pre>
16410
16411 !! html/parsoid
16412 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16413 !! end
16414
16415 !! test
16416 Parser hook: nested tags
16417 !! options
16418 noxml
16419 !! wikitext
16420 <tag><tag></tag></tag>
16421 !! html/php
16422 <pre>
16423 '<tag>'
16424 array (
16425 )
16426 </pre>&lt;/tag&gt;
16427
16428 !! html/parsoid
16429 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}' data-parsoid='{}' about="#mwt2"></pre>&lt;/tag>
16430 !! end
16431
16432 !! test
16433 Parser hook: basic arguments
16434 !! wikitext
16435 <tag width="200" height="100" depth="50" square=""></tag>
16436 !! html/php
16437 <pre>
16438 ''
16439 array (
16440 'width' => '200',
16441 'height' => '100',
16442 'depth' => '50',
16443 'square' => '',
16444 )
16445 </pre>
16446
16447 !! html/parsoid
16448 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16449 !! end
16450
16451 ## Don't expect parsoid to rt this form.
16452 !! test
16453 Parser hook: basic arguments, variations
16454 !! options
16455 parsoid=wt2html,html2html
16456 !! wikitext
16457 <tag width=200 height = "100" depth = '50' square></tag>
16458 !! html/php
16459 <pre>
16460 ''
16461 array (
16462 'width' => '200',
16463 'height' => '100',
16464 'depth' => '50',
16465 'square' => '',
16466 )
16467 </pre>
16468
16469 !! html/parsoid
16470 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16471 !! end
16472
16473 !! test
16474 Parser hook: argument containing a forward slash (bug 5344)
16475 !! wikitext
16476 <tag filename="/tmp/bla"></tag>
16477 !! html/php
16478 <pre>
16479 ''
16480 array (
16481 'filename' => '/tmp/bla',
16482 )
16483 </pre>
16484
16485 !! html/parsoid
16486 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16487 !! end
16488
16489 ## Don't expect parsoid to rt this form.
16490 !! test
16491 Parser hook: empty input using terminated empty elements (bug 2374)
16492 !! options
16493 parsoid=wt2html,html2html
16494 !! wikitext
16495 <tag foo=bar/>text
16496 !! html/php
16497 <pre>
16498 NULL
16499 array (
16500 'foo' => 'bar',
16501 )
16502 </pre>text
16503
16504 !! html/parsoid
16505 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"foo":"bar"},"body":null}' data-parsoid='{}' about="#mwt2"></pre>text
16506 !! end
16507
16508 # </tag> should be output literally since there is no matching tag that begins it
16509 !! test
16510 Parser hook: basic arguments using terminated empty elements (bug 2374)
16511 !! wikitext
16512 <tag width=200 height = "100" depth = '50' square/>
16513 other stuff
16514 </tag>
16515 !! html/php
16516 <pre>
16517 NULL
16518 array (
16519 'width' => '200',
16520 'height' => '100',
16521 'depth' => '50',
16522 'square' => '',
16523 )
16524 </pre>
16525 <p>other stuff
16526 &lt;/tag&gt;
16527 </p>
16528 !! end
16529
16530 ###
16531 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
16532 ###
16533
16534 !! test
16535 Parser hook: static parser hook not inside a comment
16536 !! wikitext
16537 <statictag>hello, world</statictag>
16538
16539 <statictag action="flush" />
16540 !! html/php
16541 <p><br />
16542 hello, world
16543 </p>
16544 !! html/parsoid
16545 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
16546 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt4">hello, world</p>
16547 !! end
16548
16549 !! test
16550 Parser hook: static parser hook inside a comment
16551 !! wikitext
16552 <!-- <statictag>hello, world</statictag> -->
16553 <statictag action="flush" />
16554 !! html/php
16555 <p><br />
16556 </p>
16557 !! html/parsoid
16558 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
16559 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt2"></p>
16560 !! end
16561
16562 # Nested template calls; this case was broken by Parser.php rev 1.506,
16563 # since reverted.
16564
16565 !! article
16566 Template:One-parameter
16567 !! text
16568 (My parameter is: {{{1}}})
16569 !! endarticle
16570
16571 !! article
16572 Template:Map-one-parameter
16573 !! text
16574 {{{{{1}}}|{{{2}}}}}
16575 !! endarticle
16576
16577 !! test
16578 Nested template calls
16579 !! wikitext
16580 {{Map-one-parameter|One-parameter|param}}
16581 !! html
16582 <p>(My parameter is: param)
16583 </p>
16584 !! end
16585
16586
16587 ###
16588 ### Sanitizer
16589 ###
16590
16591 # HTML+Tidy effectively strips out the empty tags completely
16592 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
16593 # which Tidy would have done for the PHP parser had there been content inside it.
16594 !! test
16595 Sanitizer: Closing of open tags
16596 !! wikitext
16597 <s></s><table></table>
16598 !! html
16599 <s></s><table></table>
16600
16601 !! html/parsoid
16602 <p><s></s></p><table></table>
16603 !! end
16604
16605 !! test
16606 Sanitizer: Closing of open but not closed tags
16607 !! wikitext
16608 <s>foo
16609 !! html
16610 <p><s>foo</s>
16611 </p>
16612 !! end
16613
16614 !! test
16615 Sanitizer: Closing of closed but not open tags
16616 !! options
16617 parsoid=wt2html
16618 !! wikitext
16619 </s>
16620 !! html/php+tidy
16621 !! html/parsoid
16622 !! end
16623
16624 !! test
16625 Sanitizer: Closing of closed but not open table tags
16626 !! options
16627 parsoid=wt2html
16628 !! wikitext
16629 Table not started</td></tr></table>
16630 !! html/php+tidy
16631 <p>Table not started</p>
16632 !! html/parsoid
16633 <p>Table not started</p>
16634 !! end
16635
16636 !! test
16637 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
16638 !! wikitext
16639 <span id="æ: v">byte</span>[[#æ: v|backlink]]
16640 !! html
16641 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
16642 </p>
16643 !! end
16644
16645 # In HTML5, the restrictions are that id must contain at least one character,
16646 # and must not contain any space characters.
16647 !! test
16648 Sanitizer: Validating the contents of the id attribute (bug 4515)
16649 !! options
16650 disabled
16651 !! wikitext
16652 <br id="" /><br id="a space" />
16653 !! html
16654 Something ...
16655 !! end
16656
16657 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
16658 !! test
16659 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
16660 !! options
16661 disabled
16662 !! wikitext
16663 <br id="foo" /><br id="foo" />
16664 !! html
16665 Something need to be done. foo-2 ?
16666 !! end
16667
16668 !! test
16669 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
16670 !! wikitext
16671 <div itemscope>
16672 <meta itemprop="hello" content="world">
16673 <meta http-equiv="refresh" content="5">
16674 <meta itemprop="hello" http-equiv="refresh" content="5">
16675 <link itemprop="hello" href="{{SERVER}}">
16676 <link rel="stylesheet" href="{{SERVER}}">
16677 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
16678 </div>
16679 !! html
16680 <div itemscope="">
16681 <p> <meta itemprop="hello" content="world" />
16682 &lt;meta http-equiv="refresh" content="5"&gt;
16683 <meta itemprop="hello" content="5" />
16684 </p>
16685 <link itemprop="hello" href="http&#58;//example.org" />
16686 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
16687 <link itemprop="hello" href="http&#58;//example.org" />
16688 </div>
16689
16690 !! end
16691
16692 !! test
16693 Language converter: output gets cut off unexpectedly (bug 5757)
16694 !! options
16695 language=zh
16696 !! wikitext
16697 this bit is safe: }-
16698
16699 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
16700
16701 then we get cut off here: }-
16702
16703 all additional text is vanished
16704 !! html
16705 <p>this bit is safe: }-
16706 </p><p>but if we add a conversion instance: xxx
16707 </p><p>then we get cut off here: }-
16708 </p><p>all additional text is vanished
16709 </p>
16710 !! end
16711
16712 !! test
16713 Self closed html pairs (bug 5487)
16714 !! options
16715 !! wikitext
16716 <center><font id="bug" />Centered text</center>
16717 <div><font id="bug2" />In div text</div>
16718 !! html
16719 <center>&lt;font id="bug" /&gt;Centered text</center>
16720 <div>&lt;font id="bug2" /&gt;In div text</div>
16721
16722 !! end
16723
16724 #
16725 #
16726 #
16727
16728 !! test
16729 Punctuation: nbsp before exclamation
16730 !! wikitext
16731 C'est grave !
16732 !! html
16733 <p>C'est grave&#160;!
16734 </p>
16735 !! end
16736
16737 !! test
16738 Punctuation: CSS !important (bug 11874)
16739 !! wikitext
16740 <div style="width:50% !important">important</div>
16741 !! html
16742 <div style="width:50% !important">important</div>
16743
16744 !!end
16745
16746 !! test
16747 Punctuation: CSS ! important (bug 11874; with space after)
16748 !! wikitext
16749 <div style="width:50% ! important">important</div>
16750 !! html
16751 <div style="width:50% ! important">important</div>
16752
16753 !!end
16754
16755 !! test
16756 HTML bullet list, closed tags (bug 5497)
16757 !! wikitext
16758 <ul>
16759 <li>One</li>
16760 <li>Two</li>
16761 </ul>
16762 !! html/php
16763 <ul>
16764 <li>One</li>
16765 <li>Two</li>
16766 </ul>
16767
16768 !! html/parsoid
16769 <ul data-parsoid='{"stx":"html"}'>
16770 <li data-parsoid='{"stx":"html"}'>One</li>
16771 <li data-parsoid='{"stx":"html"}'>Two</li>
16772 </ul>
16773
16774 !! end
16775
16776 !! test
16777 HTML bullet list, unclosed tags (bug 5497)
16778 !! wikitext
16779 <ul>
16780 <li>One
16781 <li>Two
16782 </ul>
16783 !! html/php+tidy
16784 <ul>
16785 <li>One</li>
16786 <li>Two</li>
16787 </ul>
16788 !! html/parsoid
16789 <ul data-parsoid='{"stx":"html"}'>
16790 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
16791 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
16792 </ul>
16793
16794 !! end
16795
16796 !! test
16797 HTML ordered list, closed tags (bug 5497)
16798 !! wikitext
16799 <ol>
16800 <li>One</li>
16801 <li>Two</li>
16802 </ol>
16803 !! html/php
16804 <ol>
16805 <li>One</li>
16806 <li>Two</li>
16807 </ol>
16808
16809 !! html/parsoid
16810 <ol data-parsoid='{"stx":"html"}'>
16811 <li data-parsoid='{"stx":"html"}'>One</li>
16812 <li data-parsoid='{"stx":"html"}'>Two</li>
16813 </ol>
16814
16815 !! end
16816
16817 !! test
16818 HTML ordered list, unclosed tags (bug 5497)
16819 !! options
16820 !! wikitext
16821 <ol>
16822 <li>One
16823 <li>Two
16824 </ol>
16825 !! html/php+tidy
16826 <ol>
16827 <li>One</li>
16828 <li>Two</li>
16829 </ol>
16830 !! html/parsoid
16831 <ol data-parsoid='{"stx":"html"}'>
16832 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
16833 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
16834 </ol>
16835
16836 !! end
16837
16838 !! test
16839 HTML nested bullet list, closed tags (bug 5497)
16840 !! wikitext
16841 <ul>
16842 <li>One</li>
16843 <li>Two:
16844 <ul>
16845 <li>Sub-one</li>
16846 <li>Sub-two</li>
16847 </ul>
16848 </li>
16849 </ul>
16850 !! html
16851 <ul>
16852 <li>One</li>
16853 <li>Two:
16854 <ul>
16855 <li>Sub-one</li>
16856 <li>Sub-two</li>
16857 </ul>
16858 </li>
16859 </ul>
16860
16861 !! end
16862
16863 !! test
16864 HTML nested bullet list, open tags (bug 5497)
16865 !! wikitext
16866 <ul>
16867 <li>One
16868 <li>Two:
16869 <ul>
16870 <li>Sub-one
16871 <li>Sub-two
16872 </ul>
16873 </ul>
16874 !! html/php+tidy
16875 <ul>
16876 <li>One</li>
16877 <li>Two:
16878 <ul>
16879 <li>Sub-one</li>
16880 <li>Sub-two</li>
16881 </ul>
16882 </li>
16883 </ul>
16884 !! html/parsoid
16885 <ul>
16886 <li>One
16887 </li>
16888 <li>Two:
16889 <ul>
16890 <li>Sub-one
16891 </li>
16892 <li>Sub-two
16893 </li>
16894 </ul>
16895 </li>
16896 </ul>
16897
16898 !! end
16899
16900 !! test
16901 HTML nested ordered list, closed tags (bug 5497)
16902 !! wikitext
16903 <ol>
16904 <li>One</li>
16905 <li>Two:
16906 <ol>
16907 <li>Sub-one</li>
16908 <li>Sub-two</li>
16909 </ol>
16910 </li>
16911 </ol>
16912 !! html
16913 <ol>
16914 <li>One</li>
16915 <li>Two:
16916 <ol>
16917 <li>Sub-one</li>
16918 <li>Sub-two</li>
16919 </ol>
16920 </li>
16921 </ol>
16922
16923 !! end
16924
16925 !! test
16926 HTML nested ordered list, open tags (bug 5497)
16927 !! wikitext
16928 <ol>
16929 <li>One
16930 <li>Two:
16931 <ol>
16932 <li>Sub-one
16933 <li>Sub-two
16934 </ol>
16935 </ol>
16936 !! html/php
16937 <ol>
16938 <li>One
16939 <li>Two:
16940 <ol>
16941 <li>Sub-one
16942 <li>Sub-two
16943 </ol>
16944 </ol>
16945
16946 !! html/parsoid
16947 <ol>
16948 <li>One
16949 </li>
16950 <li>Two:
16951 <ol>
16952 <li>Sub-one
16953 </li>
16954 <li>Sub-two
16955 </li>
16956 </ol>
16957 </li>
16958 </ol>
16959
16960 !! end
16961
16962 !! test
16963 HTML ordered list item with parameters oddity
16964 !! wikitext
16965 <ol><li id="fragment">One</li>
16966 </ol>
16967 !! html
16968 <ol><li id="fragment">One</li>
16969 </ol>
16970
16971 !! end
16972
16973 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
16974 !!test
16975 bug 5918: autonumbering
16976 !! wikitext
16977 [http://first/] [http://second] [ftp://ftp]
16978
16979 ftp://inlineftp
16980
16981 [mailto:enclosed@mail.tld With target]
16982
16983 [mailto:enclosed@mail.tld]
16984
16985 mailto:inline@mail.tld
16986 !! html/php
16987 <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>
16988 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
16989 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
16990 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
16991 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
16992 </p>
16993 !! html/parsoid
16994 <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>
16995 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
16996 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
16997 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
16998 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
16999 !! end
17000
17001
17002 #
17003 # Security and HTML correctness
17004 # From Nick Jenkins' fuzz testing
17005 #
17006
17007 !! test
17008 Fuzz testing: Parser13
17009 !! wikitext
17010 {|
17011 | http://a|
17012 !! html
17013 <table>
17014 <tr>
17015 <td>
17016 </td>
17017 </tr>
17018 </table>
17019
17020 !! end
17021
17022 !! test
17023 Fuzz testing: Parser14
17024 !! wikitext
17025 == onmouseover= ==
17026 http://__TOC__
17027 !! html
17028 <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>
17029 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17030 <ul>
17031 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17032 </ul>
17033 </div>
17034
17035
17036 !! html+tidy
17037 <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>
17038 <p>http://</p>
17039 <div id="toc" class="toc">
17040 <div id="toctitle">
17041 <h2>Contents</h2>
17042 </div>
17043 <ul>
17044 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17045 </ul>
17046 </div>
17047 <p></p>
17048 !! end
17049
17050 !! test
17051 Fuzz testing: Parser14-table
17052 !! wikitext
17053 ==a==
17054 {| STYLE=__TOC__
17055 !! html
17056 <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>
17057 <table style="&#95;_TOC&#95;_">
17058 <tr><td></td></tr>
17059 </table>
17060
17061 !! html+tidy
17062 <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>
17063 <table style="__TOC__">
17064 <tr>
17065 <td></td>
17066 </tr>
17067 </table>
17068 !! end
17069
17070 # Known to produce bogus xml (extra </td>)
17071 !! test
17072 Fuzz testing: Parser16
17073 !! options
17074 noxml
17075 !! wikitext
17076 {|
17077 !https://||||||
17078 !! html
17079 <table>
17080 <tr>
17081 <th>https://</th>
17082 <th></th>
17083 <th></th>
17084 <th>
17085 </td>
17086 </tr>
17087 </table>
17088
17089 !! html+tidy
17090 <table>
17091 <tr>
17092 <th>https://</th>
17093 <th></th>
17094 <th></th>
17095 <th></th>
17096 </tr>
17097 </table>
17098 !! end
17099
17100 !! test
17101 Fuzz testing: Parser21
17102 !! wikitext
17103 {|
17104 ! irc://{{ftp://a" onmouseover="alert('hello world');"
17105 |
17106 !! html
17107 <table>
17108 <tr>
17109 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
17110 </th>
17111 <td>
17112 </td>
17113 </tr>
17114 </table>
17115
17116 !! end
17117
17118 !! test
17119 Fuzz testing: Parser22
17120 !! wikitext
17121 http://===r:::https://b
17122
17123 {|
17124 !! html
17125 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
17126 </p>
17127 <table>
17128 <tr><td></td></tr>
17129 </table>
17130
17131 !! end
17132
17133 # Known to produce bad XML for now
17134 !! test
17135 Fuzz testing: Parser24
17136 !! options
17137 noxml
17138 !! wikitext
17139 {|
17140 {{{|
17141 <u CLASS=
17142 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
17143 <br style="onmouseover='alert(document.cookie);' " />
17144
17145 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17146 |
17147 !! html
17148 <table>
17149 {{{|
17150 <u class="&#124;">}}}} &gt;
17151 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
17152
17153 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17154 <tr>
17155 <td></u>
17156 </td>
17157 </tr>
17158 </table>
17159
17160 !! end
17161
17162 # Note: the current result listed for this is not what the original one was,
17163 # but the original bug was JavaScript injection, which is fixed in any case.
17164 # It's not clear that the original result listed was any more correct than the
17165 # current one. Original result:
17166 # <p>{{{|
17167 # </p>
17168 # <li class="&#124;&#124;">
17169 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17170 !!test
17171 Fuzz testing: Parser25 (bug 6055)
17172 !! wikitext
17173 {{{
17174 |
17175 <LI CLASS=||
17176 >
17177 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
17178 !! html
17179 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17180 </p>
17181 !! end
17182
17183 !!test
17184 Fuzz testing: URL adjacent extension (with space, clean)
17185 !! wikitext
17186 http://example.com <nowiki>junk</nowiki>
17187 !! html/php
17188 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
17189 </p>
17190 !! html/parsoid
17191 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
17192 !! end
17193
17194 !!test
17195 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
17196 !! wikitext
17197 http://example.com<nowiki>junk</nowiki>
17198 !! html/php
17199 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
17200 </p>
17201 !! html/parsoid
17202 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
17203 !! end
17204
17205 !!test
17206 Fuzz testing: URL adjacent extension (no space, dirty; pre)
17207 !! wikitext
17208 http://example.com<pre>junk</pre>
17209 !! html/php
17210 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
17211
17212 !! html/php+tidy
17213 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
17214 <pre>
17215 junk
17216 </pre>
17217 !! html/parsoid
17218 <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>
17219 !!end
17220
17221 !!test
17222 Fuzz testing: image with bogus manual thumbnail
17223 !! wikitext
17224 [[Image:foobar.jpg|thumbnail= ]]
17225 !! html/php
17226 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
17227
17228 !! html/parsoid
17229 <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>
17230 !!end
17231
17232 !! test
17233 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
17234 !! wikitext
17235 <pre dir="&#10;"></pre>
17236 !! html
17237 <pre dir="&#10;"></pre>
17238
17239 !! end
17240
17241 !! test
17242 Parsing optional HTML elements (Bug 6171)
17243 !! options
17244 !! wikitext
17245 <table>
17246 <tr>
17247 <td> Some tabular data</td>
17248 <td> More tabular data ...
17249 <td> And yet som tabular data</td>
17250 </tr>
17251 </table>
17252 !! html
17253 <table>
17254 <tr>
17255 <td> Some tabular data</td>
17256 <td> More tabular data ...
17257 </td><td> And yet som tabular data</td>
17258 </tr>
17259 </table>
17260
17261 !! end
17262
17263 !! test
17264 Correct handling of <td>, <tr> (Bug 6171)
17265 !! options
17266 !! wikitext
17267 <table>
17268 <tr>
17269 <td> Some tabular data</td>
17270 <td> More tabular data ...</td>
17271 <td> And yet som tabular data</td>
17272 </tr>
17273 </table>
17274 !! html
17275 <table>
17276 <tr>
17277 <td> Some tabular data</td>
17278 <td> More tabular data ...</td>
17279 <td> And yet som tabular data</td>
17280 </tr>
17281 </table>
17282
17283 !! end
17284
17285
17286 !! test
17287 Parsing crashing regression (fr:JavaScript)
17288 !! wikitext
17289 </body></x>
17290 !! html
17291 <p>&lt;/body&gt;&lt;/x&gt;
17292 </p>
17293 !! end
17294
17295 !! test
17296 Inline wiki vs wiki block nesting
17297 !! wikitext
17298 '''Bold paragraph
17299
17300 New wiki paragraph
17301 !! html
17302 <p><b>Bold paragraph</b>
17303 </p><p>New wiki paragraph
17304 </p>
17305 !! end
17306
17307 # FIXME: The current php output is documented
17308 # and desired output is the parsoid target.
17309 !! test
17310 Inline HTML vs wiki block nesting
17311 !! wikitext
17312 <b>Bold paragraph
17313
17314 New wiki paragraph
17315 !! html/php
17316 <p><b>Bold paragraph
17317 </p><p>New wiki paragraph</b>
17318 </p>
17319 !! html/parsoid
17320 <p><b>Bold paragraph</b>
17321 </p><p>New wiki paragraph
17322 </p>
17323 !! end
17324
17325 # Original result was this:
17326 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
17327 # </p>
17328 # While that might be marginally more intuitive, maybe, the six-apostrophe
17329 # construct is clearly pathological and the result stated here (which is what
17330 # the parser actually does) is about as reasonable as anything.
17331 !!test
17332 Mixing markup for italics and bold
17333 !! options
17334 !! wikitext
17335 '''bold''''''bold''bolditalics'''''
17336 !! html
17337 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
17338 </p>
17339 !! end
17340
17341
17342 !! article
17343 Xyzzyx
17344 !! text
17345 Article for special page transclusion test
17346 !! endarticle
17347
17348 !! test
17349 Special page transclusion
17350 !! options
17351 !! wikitext
17352 {{Special:Prefixindex/Xyzzyx}}
17353 !! html
17354 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17355 </ul>
17356
17357 !! end
17358
17359 !! test
17360 Special page transclusion twice (bug 5021)
17361 !! options
17362 !! wikitext
17363 {{Special:Prefixindex/Xyzzyx}}
17364 {{Special:Prefixindex/Xyzzyx}}
17365 !! html
17366 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17367 </ul>
17368 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17369 </ul>
17370
17371 !! end
17372
17373 !! test
17374 Transclusion of default MediaWiki message
17375 !! wikitext
17376 {{MediaWiki:Mainpage}}
17377 !! html
17378 <p>Main Page
17379 </p>
17380 !! end
17381
17382 !! test
17383 Transclusion of nonexistent MediaWiki message
17384 !! wikitext
17385 {{MediaWiki:Mainpagexxx}}
17386 !! html
17387 <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>
17388 </p>
17389 !! end
17390
17391 !! test
17392 Transclusion of MediaWiki message with underscore
17393 !! wikitext
17394 {{MediaWiki:history_short}}
17395 !! html
17396 <p>History
17397 </p>
17398 !! end
17399
17400 !! test
17401 Transclusion of MediaWiki message with space
17402 !! wikitext
17403 {{MediaWiki:history short}}
17404 !! html
17405 <p>History
17406 </p>
17407 !! end
17408
17409 !! test
17410 Invalid header with following text
17411 !! wikitext
17412 = x = y
17413 !! html
17414 <p>= x = y
17415 </p>
17416 !! end
17417
17418
17419 !! test
17420 Section extraction test (section 0)
17421 !! options
17422 section=0
17423 !! wikitext
17424 start
17425 ==a==
17426 ===aa===
17427 ====aaa====
17428 ==b==
17429 ===ba===
17430 ===bb===
17431 ====bba====
17432 ===bc===
17433 ==c==
17434 ===ca===
17435 !! html/php
17436 start
17437 !! end
17438
17439 !! test
17440 Section extraction test (section 1)
17441 !! options
17442 section=1
17443 !! wikitext
17444 start
17445 ==a==
17446 ===aa===
17447 ====aaa====
17448 ==b==
17449 ===ba===
17450 ===bb===
17451 ====bba====
17452 ===bc===
17453 ==c==
17454 ===ca===
17455 !! html/php
17456 ==a==
17457 ===aa===
17458 ====aaa====
17459 !! end
17460
17461 !! test
17462 Section extraction test (section 2)
17463 !! options
17464 section=2
17465 !! wikitext
17466 start
17467 ==a==
17468 ===aa===
17469 ====aaa====
17470 ==b==
17471 ===ba===
17472 ===bb===
17473 ====bba====
17474 ===bc===
17475 ==c==
17476 ===ca===
17477 !! html/php
17478 ===aa===
17479 ====aaa====
17480 !! end
17481
17482 !! test
17483 Section extraction test (section 3)
17484 !! options
17485 section=3
17486 !! wikitext
17487 start
17488 ==a==
17489 ===aa===
17490 ====aaa====
17491 ==b==
17492 ===ba===
17493 ===bb===
17494 ====bba====
17495 ===bc===
17496 ==c==
17497 ===ca===
17498 !! html/php
17499 ====aaa====
17500 !! end
17501
17502 !! test
17503 Section extraction test (section 4)
17504 !! options
17505 section=4
17506 !! wikitext
17507 start
17508 ==a==
17509 ===aa===
17510 ====aaa====
17511 ==b==
17512 ===ba===
17513 ===bb===
17514 ====bba====
17515 ===bc===
17516 ==c==
17517 ===ca===
17518 !! html/php
17519 ==b==
17520 ===ba===
17521 ===bb===
17522 ====bba====
17523 ===bc===
17524 !! end
17525
17526 !! test
17527 Section extraction test (section 5)
17528 !! options
17529 section=5
17530 !! wikitext
17531 start
17532 ==a==
17533 ===aa===
17534 ====aaa====
17535 ==b==
17536 ===ba===
17537 ===bb===
17538 ====bba====
17539 ===bc===
17540 ==c==
17541 ===ca===
17542 !! html/php
17543 ===ba===
17544 !! end
17545
17546 !! test
17547 Section extraction test (section 6)
17548 !! options
17549 section=6
17550 !! wikitext
17551 start
17552 ==a==
17553 ===aa===
17554 ====aaa====
17555 ==b==
17556 ===ba===
17557 ===bb===
17558 ====bba====
17559 ===bc===
17560 ==c==
17561 ===ca===
17562 !! html/php
17563 ===bb===
17564 ====bba====
17565 !! end
17566
17567 !! test
17568 Section extraction test (section 7)
17569 !! options
17570 section=7
17571 !! wikitext
17572 start
17573 ==a==
17574 ===aa===
17575 ====aaa====
17576 ==b==
17577 ===ba===
17578 ===bb===
17579 ====bba====
17580 ===bc===
17581 ==c==
17582 ===ca===
17583 !! html/php
17584 ====bba====
17585 !! end
17586
17587 !! test
17588 Section extraction test (section 8)
17589 !! options
17590 section=8
17591 !! wikitext
17592 start
17593 ==a==
17594 ===aa===
17595 ====aaa====
17596 ==b==
17597 ===ba===
17598 ===bb===
17599 ====bba====
17600 ===bc===
17601 ==c==
17602 ===ca===
17603 !! html/php
17604 ===bc===
17605 !! end
17606
17607 !! test
17608 Section extraction test (section 9)
17609 !! options
17610 section=9
17611 !! wikitext
17612 start
17613 ==a==
17614 ===aa===
17615 ====aaa====
17616 ==b==
17617 ===ba===
17618 ===bb===
17619 ====bba====
17620 ===bc===
17621 ==c==
17622 ===ca===
17623 !! html/php
17624 ==c==
17625 ===ca===
17626 !! end
17627
17628 !! test
17629 Section extraction test (section 10)
17630 !! options
17631 section=10
17632 !! wikitext
17633 start
17634 ==a==
17635 ===aa===
17636 ====aaa====
17637 ==b==
17638 ===ba===
17639 ===bb===
17640 ====bba====
17641 ===bc===
17642 ==c==
17643 ===ca===
17644 !! html/php
17645 ===ca===
17646 !! end
17647
17648 !! test
17649 Section extraction test (nonexistent section 11)
17650 !! options
17651 section=11
17652 !! wikitext
17653 start
17654 ==a==
17655 ===aa===
17656 ====aaa====
17657 ==b==
17658 ===ba===
17659 ===bb===
17660 ====bba====
17661 ===bc===
17662 ==c==
17663 ===ca===
17664 !! html/php
17665 !! end
17666
17667 !! test
17668 Section extraction test with bogus heading (section 1)
17669 !! options
17670 section=1
17671 !! wikitext
17672 ==a==
17673 ==bogus== not a legal section
17674 ==b==
17675 !! html/php
17676 ==a==
17677 ==bogus== not a legal section
17678 !! end
17679
17680 !! test
17681 Section extraction test with bogus heading (section 2)
17682 !! options
17683 section=2
17684 !! wikitext
17685 ==a==
17686 ==bogus== not a legal section
17687 ==b==
17688 !! html/php
17689 ==b==
17690 !! end
17691
17692 !! test
17693 Section extraction test with comment after heading (section 1)
17694 !! options
17695 section=1
17696 !! wikitext
17697 ==a==
17698 ==b== <!-- -->
17699 ==c==
17700 !! html/php
17701 ==a==
17702 !! end
17703
17704 !! test
17705 Section extraction test with comment after heading (section 2)
17706 !! options
17707 section=2
17708 !! wikitext
17709 ==a==
17710 ==b== <!-- -->
17711 ==c==
17712 !! html/php
17713 ==b== <!-- -->
17714 !! end
17715
17716 !! test
17717 Section extraction test with bogus <nowiki> heading (section 1)
17718 !! options
17719 section=1
17720 !! wikitext
17721 ==a==
17722 ==bogus== <nowiki>not a legal section</nowiki>
17723 ==b==
17724 !! html/php
17725 ==a==
17726 ==bogus== <nowiki>not a legal section</nowiki>
17727 !! end
17728
17729 !! test
17730 Section extraction test with bogus <nowiki> heading (section 2)
17731 !! options
17732 section=2
17733 !! wikitext
17734 ==a==
17735 ==bogus== <nowiki>not a legal section</nowiki>
17736 ==b==
17737 !! html/php
17738 ==b==
17739 !! end
17740
17741 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
17742 # instead of respecting commented sections
17743 !! test
17744 Section extraction prefixed by comment (section 1)
17745 !! options
17746 section=1
17747 !! wikitext
17748 <!-- -->==sec1==
17749 ==sec2==
17750 !! html/php
17751 ==sec2==
17752 !!end
17753
17754 !! test
17755 Section extraction prefixed by comment (section 2)
17756 !! options
17757 section=2
17758 !! wikitext
17759 <!-- -->==sec1==
17760 ==sec2==
17761 !! html/php
17762
17763 !!end
17764
17765 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
17766 # instead of respecting HTML-style headings
17767 !! test
17768 Section extraction, mixed wiki and html (section 1)
17769 !! options
17770 section=1
17771 !! wikitext
17772 <h2>unmarked</h2>
17773 unmarked
17774 ==1==
17775 one
17776 ==2==
17777 two
17778 !! html/php
17779 ==1==
17780 one
17781 !! end
17782
17783 !! test
17784 Section extraction, mixed wiki and html (section 2)
17785 !! options
17786 section=2
17787 !! wikitext
17788 <h2>unmarked</h2>
17789 unmarked
17790 ==1==
17791 one
17792 ==2==
17793 two
17794 !! html/php
17795 ==2==
17796 two
17797 !! end
17798
17799
17800 # Formerly testing for bug 3342
17801 !! test
17802 Section extraction, heading surrounded by <noinclude>
17803 !! options
17804 section=1
17805 !! wikitext
17806 <noinclude>==unmarked==</noinclude>
17807 ==marked==
17808 !! html/php
17809 ==marked==
17810 !!end
17811
17812 # Test behavior of bug 19910
17813 !! test
17814 Sectiion with all-equals
17815 !! options
17816 section=2
17817 !! wikitext
17818 ===
17819 The line above must have a trailing space
17820 === <!--
17821 --> <!-- -->
17822 But just in case it doesn't...
17823 !! html/php
17824 === <!--
17825 --> <!-- -->
17826 But just in case it doesn't...
17827 !! end
17828
17829 !! test
17830 Section replacement test (section 0)
17831 !! options
17832 replace=0,"xxx"
17833 !! wikitext
17834 start
17835 ==a==
17836 ===aa===
17837 ====aaa====
17838 ==b==
17839 ===ba===
17840 ===bb===
17841 ====bba====
17842 ===bc===
17843 ==c==
17844 ===ca===
17845 !! html/php
17846 xxx
17847
17848 ==a==
17849 ===aa===
17850 ====aaa====
17851 ==b==
17852 ===ba===
17853 ===bb===
17854 ====bba====
17855 ===bc===
17856 ==c==
17857 ===ca===
17858 !! end
17859
17860 !! test
17861 Section replacement test (section 1)
17862 !! options
17863 replace=1,"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 xxx
17879
17880 ==b==
17881 ===ba===
17882 ===bb===
17883 ====bba====
17884 ===bc===
17885 ==c==
17886 ===ca===
17887 !! end
17888
17889 !! test
17890 Section replacement test (section 2)
17891 !! options
17892 replace=2,"xxx"
17893 !! wikitext
17894 start
17895 ==a==
17896 ===aa===
17897 ====aaa====
17898 ==b==
17899 ===ba===
17900 ===bb===
17901 ====bba====
17902 ===bc===
17903 ==c==
17904 ===ca===
17905 !! html/php
17906 start
17907 ==a==
17908 xxx
17909
17910 ==b==
17911 ===ba===
17912 ===bb===
17913 ====bba====
17914 ===bc===
17915 ==c==
17916 ===ca===
17917 !! end
17918
17919 !! test
17920 Section replacement test (section 3)
17921 !! options
17922 replace=3,"xxx"
17923 !! wikitext
17924 start
17925 ==a==
17926 ===aa===
17927 ====aaa====
17928 ==b==
17929 ===ba===
17930 ===bb===
17931 ====bba====
17932 ===bc===
17933 ==c==
17934 ===ca===
17935 !! html/php
17936 start
17937 ==a==
17938 ===aa===
17939 xxx
17940
17941 ==b==
17942 ===ba===
17943 ===bb===
17944 ====bba====
17945 ===bc===
17946 ==c==
17947 ===ca===
17948 !! end
17949
17950 !! test
17951 Section replacement test (section 4)
17952 !! options
17953 replace=4,"xxx"
17954 !! wikitext
17955 start
17956 ==a==
17957 ===aa===
17958 ====aaa====
17959 ==b==
17960 ===ba===
17961 ===bb===
17962 ====bba====
17963 ===bc===
17964 ==c==
17965 ===ca===
17966 !! html/php
17967 start
17968 ==a==
17969 ===aa===
17970 ====aaa====
17971 xxx
17972
17973 ==c==
17974 ===ca===
17975 !! end
17976
17977 !! test
17978 Section replacement test (section 5)
17979 !! options
17980 replace=5,"xxx"
17981 !! wikitext
17982 start
17983 ==a==
17984 ===aa===
17985 ====aaa====
17986 ==b==
17987 ===ba===
17988 ===bb===
17989 ====bba====
17990 ===bc===
17991 ==c==
17992 ===ca===
17993 !! html/php
17994 start
17995 ==a==
17996 ===aa===
17997 ====aaa====
17998 ==b==
17999 xxx
18000
18001 ===bb===
18002 ====bba====
18003 ===bc===
18004 ==c==
18005 ===ca===
18006 !! end
18007
18008 !! test
18009 Section replacement test (section 6)
18010 !! options
18011 replace=6,"xxx"
18012 !! wikitext
18013 start
18014 ==a==
18015 ===aa===
18016 ====aaa====
18017 ==b==
18018 ===ba===
18019 ===bb===
18020 ====bba====
18021 ===bc===
18022 ==c==
18023 ===ca===
18024 !! html/php
18025 start
18026 ==a==
18027 ===aa===
18028 ====aaa====
18029 ==b==
18030 ===ba===
18031 xxx
18032
18033 ===bc===
18034 ==c==
18035 ===ca===
18036 !! end
18037
18038 !! test
18039 Section replacement test (section 7)
18040 !! options
18041 replace=7,"xxx"
18042 !! wikitext
18043 start
18044 ==a==
18045 ===aa===
18046 ====aaa====
18047 ==b==
18048 ===ba===
18049 ===bb===
18050 ====bba====
18051 ===bc===
18052 ==c==
18053 ===ca===
18054 !! html/php
18055 start
18056 ==a==
18057 ===aa===
18058 ====aaa====
18059 ==b==
18060 ===ba===
18061 ===bb===
18062 xxx
18063
18064 ===bc===
18065 ==c==
18066 ===ca===
18067 !! end
18068
18069 !! test
18070 Section replacement test (section 8)
18071 !! options
18072 replace=8,"xxx"
18073 !! wikitext
18074 start
18075 ==a==
18076 ===aa===
18077 ====aaa====
18078 ==b==
18079 ===ba===
18080 ===bb===
18081 ====bba====
18082 ===bc===
18083 ==c==
18084 ===ca===
18085 !! html/php
18086 start
18087 ==a==
18088 ===aa===
18089 ====aaa====
18090 ==b==
18091 ===ba===
18092 ===bb===
18093 ====bba====
18094 xxx
18095
18096 ==c==
18097 ===ca===
18098 !!end
18099
18100 !! test
18101 Section replacement test (section 9)
18102 !! options
18103 replace=9,"xxx"
18104 !! wikitext
18105 start
18106 ==a==
18107 ===aa===
18108 ====aaa====
18109 ==b==
18110 ===ba===
18111 ===bb===
18112 ====bba====
18113 ===bc===
18114 ==c==
18115 ===ca===
18116 !! html/php
18117 start
18118 ==a==
18119 ===aa===
18120 ====aaa====
18121 ==b==
18122 ===ba===
18123 ===bb===
18124 ====bba====
18125 ===bc===
18126 xxx
18127 !! end
18128
18129 !! test
18130 Section replacement test (section 10)
18131 !! options
18132 replace=10,"xxx"
18133 !! wikitext
18134 start
18135 ==a==
18136 ===aa===
18137 ====aaa====
18138 ==b==
18139 ===ba===
18140 ===bb===
18141 ====bba====
18142 ===bc===
18143 ==c==
18144 ===ca===
18145 !! html/php
18146 start
18147 ==a==
18148 ===aa===
18149 ====aaa====
18150 ==b==
18151 ===ba===
18152 ===bb===
18153 ====bba====
18154 ===bc===
18155 ==c==
18156 xxx
18157 !! end
18158
18159 !! test
18160 Section replacement test with initial whitespace (bug 13728)
18161 !! options
18162 replace=2,"xxx"
18163 !! wikitext
18164 Preformatted initial line
18165 ==a==
18166 ===a===
18167 !! html/php
18168 Preformatted initial line
18169 ==a==
18170 xxx
18171 !! end
18172
18173
18174 !! test
18175 Section extraction, heading followed by pre with 20 spaces (bug 6398)
18176 !! options
18177 section=1
18178 !! wikitext
18179 ==a==
18180 a
18181 !! html/php
18182 ==a==
18183 a
18184 !! end
18185
18186 !! test
18187 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
18188 !! options
18189 section=1
18190 !! wikitext
18191 ==a==
18192 a
18193 !! html/php
18194 ==a==
18195 a
18196 !! end
18197
18198
18199 !! test
18200 Section extraction, <pre> around bogus header (bug 10309)
18201 !! options
18202 noxml section=2
18203 !! wikitext
18204 == Section One ==
18205 <pre>
18206 =======
18207 </pre>
18208
18209 == Section Two ==
18210 stuff
18211 !! html/php
18212 == Section Two ==
18213 stuff
18214 !! end
18215
18216 !! test
18217 Section replacement, <pre> around bogus header (bug 10309)
18218 !! options
18219 noxml replace=2,"xxx"
18220 !! wikitext
18221 == Section One ==
18222 <pre>
18223 =======
18224 </pre>
18225
18226 == Section Two ==
18227 stuff
18228 !! html/php
18229 == Section One ==
18230 <pre>
18231 =======
18232 </pre>
18233
18234 xxx
18235 !! end
18236
18237
18238 !! test
18239 Handling of &#x0A; in URLs
18240 !! wikitext
18241 ** irc://&#x0A;a
18242 !! html/php
18243 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18244
18245 !! html/parsoid
18246 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
18247 a">irc://
18248 a</a></li></ul></li></ul>
18249 !! end
18250
18251 !! test
18252 Handling of %0A in URLs
18253 !! wikitext
18254 ** irc://%0Aa
18255 !! html/php
18256 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18257
18258 !! html/parsoid
18259 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18260 !! end
18261
18262
18263 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
18264 !! test
18265 5 quotes, code coverage +1 line
18266 !! options
18267 parsoid=wt2html
18268 !! wikitext
18269 '''''
18270 !! html/php
18271 !! html/parsoid
18272 <p><b><i></i></b></p>
18273 !! end
18274
18275 # same html as previous, but wikitext adjusted to match parsoid html2wt
18276 # note that wt2html and html2html will put the <i> before the <b>
18277 !! test
18278 5 quotes, code coverage +1 line w/ nowiki (1)
18279 !! options
18280 parsoid=wt2wt,html2wt
18281 !! wikitext
18282 '''''<nowiki/>'''''
18283 !! html/php
18284 <p><i></i>
18285 </p>
18286 !! html/parsoid
18287 <p><b><i></i></b></p>
18288 !! end
18289
18290 # same as previous, just swapping the <i> and <b>
18291 !! test
18292 5 quotes, code coverage +1 line w/ nowiki (2)
18293 !! wikitext
18294 '''''<nowiki/>'''''
18295 !! html/php
18296 <p><i></i>
18297 </p>
18298 !! html/parsoid
18299 <p><i><b></b></i></p>
18300 !! end
18301
18302 !! test
18303 Special:Search page linking.
18304 !! wikitext
18305 {{Special:search}}
18306 !! html
18307 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
18308 </p>
18309 !! end
18310
18311 !! test
18312 {{!}} is a magic word
18313 !! wikitext
18314 {{!}} is a magic word there and {{!}} is still a magic word here
18315 | is not a magic word here but {{!}} is still a magic word here
18316 !! html/php
18317 <p>| is a magic word there and | is still a magic word here
18318 | is not a magic word here but | is still a magic word here
18319 </p>
18320 !! html/parsoid
18321 <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
18322 | 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>
18323
18324 !! end
18325
18326 !! test
18327 Say the magic word
18328 !! options
18329 title=[[Parser test]]
18330 !! wikitext
18331 * {{PAGENAME}}
18332 * {{PAGENAMEE}}
18333 * {{FULLPAGENAME}}
18334 * {{FULLPAGENAMEE}}
18335 * {{BASEPAGENAME}}
18336 * {{BASEPAGENAMEE}}
18337 * {{SUBPAGENAME}}
18338 * {{SUBPAGENAMEE}}
18339 * {{ROOTPAGENAME}}
18340 * {{ROOTPAGENAMEE}}
18341 * {{TALKPAGENAME}}
18342 * {{TALKPAGENAMEE}}
18343 * {{SUBJECTPAGENAME}}
18344 * {{SUBJECTPAGENAMEE}}
18345 * {{NAMESPACEE}}
18346 * {{NAMESPACE}}
18347 * {{NAMESPACENUMBER}}
18348 * {{TALKSPACE}}
18349 * {{TALKSPACEE}}
18350 * {{SUBJECTSPACE}}
18351 * {{SUBJECTSPACEE}}
18352 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
18353 !! html
18354 <ul><li> Parser test</li>
18355 <li> Parser_test</li>
18356 <li> Parser test</li>
18357 <li> Parser_test</li>
18358 <li> Parser test</li>
18359 <li> Parser_test</li>
18360 <li> Parser test</li>
18361 <li> Parser_test</li>
18362 <li> Parser test</li>
18363 <li> Parser_test</li>
18364 <li> Talk:Parser test</li>
18365 <li> Talk:Parser_test</li>
18366 <li> Parser test</li>
18367 <li> Parser_test</li>
18368 <li> </li>
18369 <li> </li>
18370 <li> 0</li>
18371 <li> Talk</li>
18372 <li> Talk</li>
18373 <li> </li>
18374 <li> </li>
18375 <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>
18376
18377 !! end
18378 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
18379
18380 !! test
18381 Gallery
18382 !! wikitext
18383 <gallery>
18384 image1.png |
18385 image2.gif|||||
18386
18387 image3|
18388 image4 |300px| centre
18389 image5.svg| http://///////
18390 [[x|xx]]]]
18391 * image6
18392 </gallery>
18393 !! html
18394 <ul class="gallery mw-gallery-traditional">
18395 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18396 <div class="thumb" style="height: 150px;">Image1.png</div>
18397 <div class="gallerytext">
18398 </div>
18399 </div></li>
18400 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18401 <div class="thumb" style="height: 150px;">Image2.gif</div>
18402 <div class="gallerytext">
18403 </div>
18404 </div></li>
18405 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18406 <div class="thumb" style="height: 150px;">Image3</div>
18407 <div class="gallerytext">
18408 </div>
18409 </div></li>
18410 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18411 <div class="thumb" style="height: 150px;">Image4</div>
18412 <div class="gallerytext">
18413 <pre>centre
18414 </pre>
18415 </div>
18416 </div></li>
18417 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18418 <div class="thumb" style="height: 150px;">Image5.svg</div>
18419 <div class="gallerytext">
18420 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
18421 </p>
18422 </div>
18423 </div></li>
18424 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18425 <div class="thumb" style="height: 150px;">* image6</div>
18426 <div class="gallerytext">
18427 </div>
18428 </div></li>
18429 </ul>
18430
18431 !! end
18432
18433 !! test
18434 Gallery (with options)
18435 !! wikitext
18436 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
18437 File:Nonexistent.jpg|caption
18438 File:Nonexistent.jpg
18439 image:foobar.jpg|some '''caption''' [[Main Page]]
18440 image:foobar.jpg
18441 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
18442 </gallery>
18443 !! html
18444 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
18445 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
18446 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18447 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18448 <div class="gallerytext">
18449 <p>caption
18450 </p>
18451 </div>
18452 </div></li>
18453 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18454 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18455 <div class="gallerytext">
18456 </div>
18457 </div></li>
18458 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18459 <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>
18460 <div class="gallerytext">
18461 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18462 </p>
18463 </div>
18464 </div></li>
18465 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18466 <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>
18467 <div class="gallerytext">
18468 </div>
18469 </div></li>
18470 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18471 <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>
18472 <div class="gallerytext">
18473 <p>blabla.
18474 </p>
18475 </div>
18476 </div></li>
18477 </ul>
18478
18479 !! end
18480
18481 !! test
18482 Gallery with link that has fragment
18483 !! wikitext
18484 <gallery>
18485 image:foobar.jpg|link=Main_Page
18486 image:foobar.jpg|link=Main_Page#section
18487 image:foobar.jpg|link=Main Page#section|caption
18488 </gallery>
18489 !! html
18490 <ul class="gallery mw-gallery-traditional">
18491 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18492 <div class="thumb" style="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>
18493 <div class="gallerytext">
18494 </div>
18495 </div></li>
18496 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18497 <div class="thumb" style="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>
18498 <div class="gallerytext">
18499 </div>
18500 </div></li>
18501 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18502 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/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>
18503 <div class="gallerytext">
18504 <p>caption
18505 </p>
18506 </div>
18507 </div></li>
18508 </ul>
18509
18510 !! end
18511
18512 !! test
18513 Gallery with wikitext inside caption
18514 !! wikitext
18515 <gallery>
18516 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
18517 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
18518 </gallery>
18519 !! html
18520 <ul class="gallery mw-gallery-traditional">
18521 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18522 <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>
18523 <div class="gallerytext">
18524 <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>
18525 </p>
18526 </div>
18527 </div></li>
18528 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18529 <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>
18530 <div class="gallerytext">
18531 <p>This is a test template
18532 </p>
18533 </div>
18534 </div></li>
18535 </ul>
18536
18537 !! end
18538
18539 !! test
18540 gallery (with showfilename option)
18541 !! wikitext
18542 <gallery showfilename>
18543 File:Nonexistent.jpg|caption
18544 File:Nonexistent.jpg
18545 image:foobar.jpg|some '''caption''' [[Main Page]]
18546 File:Foobar.jpg
18547 </gallery>
18548 !! html
18549 <ul class="gallery mw-gallery-traditional">
18550 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18551 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18552 <div class="gallerytext">
18553 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
18554 caption
18555 </p>
18556 </div>
18557 </div></li>
18558 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18559 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18560 <div class="gallerytext">
18561 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
18562 </p>
18563 </div>
18564 </div></li>
18565 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18566 <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>
18567 <div class="gallerytext">
18568 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
18569 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18570 </p>
18571 </div>
18572 </div></li>
18573 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18574 <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>
18575 <div class="gallerytext">
18576 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
18577 </p>
18578 </div>
18579 </div></li>
18580 </ul>
18581
18582 !! end
18583
18584 !! test
18585 Gallery (with namespace-less filenames)
18586 !! wikitext
18587 <gallery>
18588 File:Nonexistent.jpg
18589 Nonexistent.jpg
18590 image:foobar.jpg
18591 foobar.jpg
18592 </gallery>
18593 !! html
18594 <ul class="gallery mw-gallery-traditional">
18595 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18596 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18597 <div class="gallerytext">
18598 </div>
18599 </div></li>
18600 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18601 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18602 <div class="gallerytext">
18603 </div>
18604 </div></li>
18605 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18606 <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>
18607 <div class="gallerytext">
18608 </div>
18609 </div></li>
18610 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18611 <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>
18612 <div class="gallerytext">
18613 </div>
18614 </div></li>
18615 </ul>
18616
18617 !! end
18618
18619 !! test
18620 HTML Hex character encoding (spells the word "JavaScript")
18621 !! options
18622 parsoid=wt2html,wt2wt,html2html
18623 !! wikitext
18624 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
18625 !! html/php
18626 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
18627 </p>
18628 !! html/php+tidy
18629 <p>JavaScript</p>
18630 !! html/parsoid
18631 <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>
18632 !! end
18633
18634 !! test
18635 HTML Hex character encoding bogus encoding (bug 26437 regression check)
18636 !! wikitext
18637 &#xsee;&#XSEE;
18638 !! html/php
18639 <p>&amp;#xsee;&amp;#XSEE;
18640 </p>
18641 !! html/parsoid
18642 <p>&amp;#xsee;&amp;#XSEE;</p>
18643 !! end
18644
18645 !! test
18646 HTML Hex character encoding mixed case
18647 !! options
18648 parsoid=wt2html,wt2wt,html2html
18649 !! wikitext
18650 &#xEE;&#Xee;
18651 !! html/php
18652 <p>&#xee;&#xee;
18653 </p>
18654 !! html/php+tidy
18655 <p>îî</p>
18656 !! html/parsoid
18657 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
18658 !! end
18659
18660 # See: http://www.w3.org/TR/html5/syntax.html#character-references
18661 # Note that U+000C (form feed) is not a valid XML character, so
18662 # it is banned even though allowed in HTML5.
18663 !! test
18664 Illegal character references (T106578)
18665 !! wikitext
18666 ; Null: &#00;
18667 ; FF: &#xC;
18668 ; CR: &#xD;
18669 ; Control (low): &#8;
18670 ; Control (high): &#x7F; &#x9F;
18671 ; Surrogate: &#xD83D;&#xDCA9;
18672 ; This is an okay astral character: &#x1F4A9;
18673 !! html+tidy
18674 <dl>
18675 <dt>Null</dt>
18676 <dd>&amp;#00;</dd>
18677 <dt>FF</dt>
18678 <dd>&amp;#xC;</dd>
18679 <dt>CR</dt>
18680 <dd>&amp;#xD;</dd>
18681 <dt>Control (low)</dt>
18682 <dd>&amp;#8;</dd>
18683 <dt>Control (high)</dt>
18684 <dd>&amp;#x7F; &amp;#x9F;</dd>
18685 <dt>Surrogate</dt>
18686 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
18687 <dt>This is an okay astral character</dt>
18688 <dd>💩</dd>
18689 </dl>
18690 !! end
18691
18692 !! test
18693 __FORCETOC__ override
18694 !! wikitext
18695 __NEWSECTIONLINK__
18696 __FORCETOC__
18697 !! html/php
18698 <p><br />
18699 </p>
18700 !! end
18701
18702 !! test
18703 ISBN code coverage
18704 !! wikitext
18705 ISBN 978-0-1234-56&#x20;789
18706 !! html
18707 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
18708 </p>
18709 !! html+tidy
18710 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
18711 !! html/parsoid
18712 <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>
18713 !! end
18714
18715 !! test
18716 ISBN followed by 5 spaces
18717 !! wikitext
18718 ISBN
18719 !! html
18720 <p>ISBN
18721 </p>
18722 !! end
18723
18724 !! test
18725 Double ISBN
18726 !! wikitext
18727 ISBN ISBN 1234567890
18728 !! html/php
18729 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18730 </p>
18731 !! html/parsoid
18732 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
18733 !! end
18734
18735 # Uppercase X and lowercase x as well
18736 !! test
18737 ISBN with an X
18738 !! wikitext
18739 ISBN 3-462-04561-X
18740 ISBN 3-462-04561-x
18741 ISBN 080442957X
18742 ISBN 080442957x
18743 ISBN 978080442957X
18744 ISBN 978080442957x
18745 !! html/php
18746 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
18747 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
18748 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
18749 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
18750 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
18751 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
18752 </p>
18753 !! html/parsoid
18754 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
18755 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
18756 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
18757 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
18758 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
18759 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
18760 !! end
18761
18762 !! test
18763 ISBN with empty prefix (parsoid test)
18764 !! wikitext
18765 ISBN 1234567890
18766 !! html/php
18767 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18768 </p>
18769 !! html/parsoid
18770 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
18771 !! end
18772
18773 !! test
18774 Bug 22905: <abbr> followed by ISBN followed by </a>
18775 !! wikitext
18776 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
18777 !! html/php
18778 <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>
18779 </p>
18780 !! html/parsoid
18781 <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>
18782 !! end
18783
18784 !! test
18785 Double RFC
18786 !! wikitext
18787 RFC RFC 1234
18788 !! html
18789 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
18790 </p>
18791 !! end
18792
18793 !! test
18794 Double RFC with a wiki link
18795 !! wikitext
18796 RFC [[RFC 1234]]
18797 !! html
18798 <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>
18799 </p>
18800 !! end
18801
18802 !! test
18803 RFC code coverage
18804 !! wikitext
18805 RFC 983&#x20;987
18806 !! html
18807 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
18808 </p>
18809 !! html+tidy
18810 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
18811 !! end
18812
18813 !! test
18814 Centre-aligned image
18815 !! wikitext
18816 [[Image:foobar.jpg|centre]]
18817 !! html
18818 <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>
18819
18820 !!end
18821
18822 !! test
18823 None-aligned image
18824 !! wikitext
18825 [[Image:foobar.jpg|none]]
18826 !! html
18827 <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>
18828
18829 !!end
18830
18831 !! test
18832 Width + Height sized image (using px) (height is ignored)
18833 !! wikitext
18834 [[Image:foobar.jpg|640x480px]]
18835 !! html
18836 <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>
18837 </p>
18838 !!end
18839
18840 !! test
18841 Width-sized image (using px, no following whitespace)
18842 !! wikitext
18843 [[Image:foobar.jpg|640px]]
18844 !! html
18845 <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>
18846 </p>
18847 !!end
18848
18849 !! test
18850 Width-sized image (using px, with following whitespace - test regression from r39467)
18851 !! wikitext
18852 [[Image:foobar.jpg|640px ]]
18853 !! html
18854 <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>
18855 </p>
18856 !!end
18857
18858 !! test
18859 Width-sized image (using px, with preceding whitespace - test regression from r39467)
18860 !! wikitext
18861 [[Image:foobar.jpg| 640px]]
18862 !! html
18863 <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>
18864 </p>
18865 !!end
18866
18867 !! test
18868 Image with page parameter
18869 !! options
18870 djvu
18871 !! wikitext
18872 [[File:LoremIpsum.djvu|page=2]]
18873 !! html/php
18874 <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>
18875 </p>
18876 !! html/parsoid
18877 <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>
18878 !! end
18879
18880 !! test
18881 Another italics / bold test
18882 !! wikitext
18883 ''' ''x'
18884 !! html
18885 <pre>'<i> </i>x'
18886 </pre>
18887 !!end
18888
18889 # FIXME: The php output seems broken. It's interleaving some open/close tags.
18890 !! test
18891 dt/dd/dl test
18892 !! wikitext
18893 :;;;::
18894 !! html/php
18895 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
18896
18897 !! html/parsoid
18898 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
18899
18900 !!end
18901
18902
18903 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
18904 !! test
18905 Images with the "|" character in the comment
18906 !! wikitext
18907 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
18908 !! html/php
18909 <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>
18910
18911 !! html/parsoid
18912 <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>
18913 !! end
18914
18915 !! test
18916 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
18917 !! wikitext
18918 <html><script>alert(1);</script></html>
18919 !! html
18920 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
18921 </p>
18922 !! end
18923
18924 !! test
18925 HTML with raw HTML ($wgRawHtml==true)
18926 !! options
18927 wgRawHtml=1
18928 !! wikitext
18929 <html><script>alert(1);</script></html>
18930 !! html
18931 <p><script>alert(1);</script>
18932 </p>
18933 !! end
18934
18935 !! test
18936 Parents of subpages, one level up
18937 !! options
18938 subpage title=[[Subpage test/L1/L2/L3]]
18939 !! wikitext
18940 [[../|L2]]
18941 !! html
18942 <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>
18943 </p>
18944 !! end
18945
18946
18947 !! test
18948 Parents of subpages, one level up, not named
18949 !! options
18950 subpage title=[[Subpage test/L1/L2/L3]]
18951 !! wikitext
18952 [[../]]
18953 !! html
18954 <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>
18955 </p>
18956 !! end
18957
18958
18959
18960 !! test
18961 Parents of subpages, two levels up
18962 !! options
18963 subpage title=[[Subpage test/L1/L2/L3]]
18964 !! wikitext
18965 [[../../|L1]]2
18966
18967 [[../../|L1]]l
18968 !! html
18969 <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
18970 </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>
18971 </p>
18972 !! end
18973
18974 !! test
18975 Parents of subpages, two levels up, without trailing slash or name.
18976 !! options
18977 subpage title=[[Subpage test/L1/L2/L3]]
18978 !! wikitext
18979 [[../..]]
18980 !! html
18981 <p>[[../..]]
18982 </p>
18983 !! end
18984
18985 !! test
18986 Parents of subpages, two levels up, with lots of extra trailing slashes.
18987 !! options
18988 subpage title=[[Subpage test/L1/L2/L3]]
18989 !! wikitext
18990 [[../../////]]
18991 !! html
18992 <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>
18993 </p>
18994 !! end
18995
18996 !! article
18997 Subpage test/L1/L2/L3Sibling
18998 !! text
18999 Sibling article
19000 !! endarticle
19001
19002 !! test
19003 Transclusion of a sibling page (one level up)
19004 !! options
19005 subpage title=[[Subpage test/L1/L2/L3]]
19006 !! wikitext
19007 {{../L3Sibling}}
19008 !! html
19009 <p>Sibling article
19010 </p>
19011 !! end
19012
19013 !! test
19014 Transclusion of a child page
19015 !! options
19016 subpage title=[[Subpage test/L1/L2]]
19017 !! wikitext
19018 {{/L3Sibling}}
19019 !! html
19020 <p>Sibling article
19021 </p>
19022 !! end
19023
19024 !! test
19025 Non-transclusion because of too many up levels
19026 !! options
19027 subpage title=[[Subpage test/L1/L2/L3]]
19028 !! wikitext
19029 {{../../../../More than parent}}
19030 !! html
19031 <p>{{../../../../More than parent}}
19032 </p>
19033 !! end
19034
19035 !! test
19036 Definition list code coverage
19037 !! wikitext
19038 ; title : def
19039 ; title : def
19040 ;title: def
19041 !! html/php
19042 <dl><dt> title &#160;</dt>
19043 <dd> def</dd>
19044 <dt> title&#160;</dt>
19045 <dd> def</dd>
19046 <dt>title</dt>
19047 <dd> def</dd></dl>
19048
19049 !! html/parsoid
19050 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
19051 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
19052 <dt>title</dt><dd> def</dd></dl>
19053 !! end
19054
19055 !! test
19056 Don't fall for the self-closing div
19057 !! wikitext
19058 <div>hello world</div/>
19059 !! html
19060 <div>hello world</div>
19061
19062 !! end
19063
19064 !! test
19065 MSGNW magic word
19066 !! wikitext
19067 {{MSGNW:msg}}
19068 !! html/php
19069 <p>&#91;&#91;:Template:Msg&#93;&#93;
19070 </p>
19071 !! end
19072
19073 !! test
19074 RAW magic word
19075 !! wikitext
19076 {{RAW:QUERTY}}
19077 !! html
19078 <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>
19079 </p>
19080 !! end
19081
19082 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
19083 !! test
19084 Always escape literal '>' in output, not just after '<'
19085 !! wikitext
19086 ><>
19087 !! html
19088 <p>&gt;&lt;&gt;
19089 </p>
19090 !! end
19091
19092 !! test
19093 Template caching
19094 !! wikitext
19095 {{Test}}
19096 {{Test}}
19097 !! html
19098 <p>This is a test template
19099 This is a test template
19100 </p>
19101 !! end
19102
19103
19104 !! article
19105 MediaWiki:Fake
19106 !! text
19107 ==header==
19108 !! endarticle
19109
19110 !! test
19111 Inclusion of !userCanEdit() content
19112 !! wikitext
19113 {{MediaWiki:Fake}}
19114 !! html
19115 <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>
19116
19117 !! end
19118
19119
19120 !! test
19121 Out-of-order TOC heading levels
19122 !! wikitext
19123 ==2==
19124 ======6======
19125 ===3===
19126 =1=
19127 =====5=====
19128 ==2==
19129 !! html
19130 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19131 <ul>
19132 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
19133 <ul>
19134 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
19135 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
19136 </ul>
19137 </li>
19138 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
19139 <ul>
19140 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
19141 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
19142 </ul>
19143 </li>
19144 </ul>
19145 </div>
19146
19147 <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>
19148 <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>
19149 <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>
19150 <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>
19151 <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>
19152 <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>
19153
19154 !! end
19155
19156
19157 !! test
19158 ISBN with a dummy number
19159 !! wikitext
19160 ISBN ---
19161 !! html
19162 <p>ISBN ---
19163 </p>
19164 !! end
19165
19166
19167 !! test
19168 ISBN with space-delimited number
19169 !! wikitext
19170 ISBN 92 9017 032 8
19171 !! html
19172 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
19173 </p>
19174 !! end
19175
19176
19177 !! test
19178 ISBN with multiple spaces, no number
19179 !! wikitext
19180 ISBN foo
19181 !! html
19182 <p>ISBN foo
19183 </p>
19184 !! end
19185
19186
19187 !! test
19188 ISBN length
19189 !! wikitext
19190 ISBN 123456789
19191
19192 ISBN 1234567890
19193
19194 ISBN 12345678901
19195 !! html
19196 <p>ISBN 123456789
19197 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19198 </p><p>ISBN 12345678901
19199 </p>
19200 !! end
19201
19202
19203 !! test
19204 ISBN with trailing year (bug 8110)
19205 !! wikitext
19206 ISBN 1-234-56789-0 - 2006
19207
19208 ISBN 1 234 56789 0 - 2006
19209 !! html
19210 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
19211 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
19212 </p>
19213 !! end
19214
19215
19216 !! test
19217 anchorencode
19218 !! wikitext
19219 {{anchorencode:foo bar©#%n}}
19220 !! html
19221 <p>foo_bar.C2.A9.23.25n
19222 </p>
19223 !! end
19224
19225 !! test
19226 anchorencode trims spaces
19227 !! wikitext
19228 {{anchorencode: __pretty__please__}}
19229 !! html
19230 <p>pretty_please
19231 </p>
19232 !! end
19233
19234 !! test
19235 anchorencode deals with links
19236 !! wikitext
19237 {{anchorencode: [[hello|world]] [[hi]]}}
19238 !! html
19239 <p>world_hi
19240 </p>
19241 !! end
19242
19243 !! test
19244 anchorencode deals with templates
19245 !! wikitext
19246 {{anchorencode: {{Foo}} }}
19247 !! html
19248 <p>FOO
19249 </p>
19250 !! end
19251
19252 !! test
19253 anchorencode encodes like the TOC generator: (bug 18431)
19254 !! wikitext
19255 === _ +:.3A%3A&&amp;]] ===
19256 {{anchorencode: _ +:.3A%3A&&amp;]] }}
19257 __NOEDITSECTION__
19258 !! html
19259 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
19260 <p>.2B:.3A.253A.26.26.5D.5D
19261 </p>
19262 !! end
19263
19264 !! test
19265 Bug 6200: blockquotes and paragraph formatting
19266 !! wikitext
19267 <blockquote>
19268 foo
19269 </blockquote>
19270
19271 bar
19272
19273 baz
19274 !! html
19275 <blockquote>
19276 <p>foo
19277 </p>
19278 </blockquote>
19279 <p>bar
19280 </p>
19281 <pre>baz
19282 </pre>
19283 !! end
19284
19285 !! test
19286 Bug 8293: Use of center tag ruins paragraph formatting
19287 !! wikitext
19288 <center>
19289 foo
19290 </center>
19291
19292 bar
19293
19294 baz
19295 !! html
19296 <center>
19297 <p>foo
19298 </p>
19299 </center>
19300 <p>bar
19301 </p>
19302 <pre>baz
19303 </pre>
19304 !! end
19305
19306 !!test
19307 Parsing of overlapping (improperly nested) inline html tags
19308 !! wikitext
19309 <span><s>x</span></s>
19310 !! html/php
19311 <p><span><s>x&lt;/span&gt;</s></span>
19312 </p>
19313 !! html/parsoid
19314 <p><span><s>x</s></span>
19315 </p>
19316 !!end
19317
19318 ###
19319 ### Language variants related tests
19320 ###
19321 !! test
19322 Self-link in language variants
19323 !! options
19324 title=[[Dunav]] language=sr
19325 !! wikitext
19326 Both [[Dunav]] and [[Дунав]] are names for this river.
19327 !! html
19328 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
19329 </p>
19330 !!end
19331
19332 !! article
19333 Дуна
19334 !! text
19335 content
19336 !! endarticle
19337
19338 !! test
19339 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
19340 !! options
19341 title=[[Duna]] language=sr
19342 !! wikitext
19343 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
19344 !! html
19345 <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.
19346 </p>
19347 !! end
19348
19349 !! test
19350 Link to a section of a variant of this title shouldn't be parsed as self-link
19351 !! options
19352 title=[[Duna]] language=sr
19353 !! wikitext
19354 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
19355 !! html
19356 <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.
19357 </p>
19358 !! end
19359
19360 !! test
19361 Link to pages in language variants
19362 !! options
19363 language=sr
19364 !! wikitext
19365 Main Page can be written as [[Маин Паге]]
19366 !! html
19367 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
19368 </p>
19369 !!end
19370
19371
19372 !! test
19373 Multiple links to pages in language variants
19374 !! options
19375 language=sr
19376 !! wikitext
19377 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
19378 !! html
19379 <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>.
19380 </p>
19381 !!end
19382
19383
19384 !! test
19385 Simple template in language variants
19386 !! options
19387 language=sr
19388 !! wikitext
19389 {{тест}}
19390 !! html
19391 <p>This is a test template
19392 </p>
19393 !! end
19394
19395
19396 !! test
19397 Template with explicit namespace in language variants
19398 !! options
19399 language=sr
19400 !! wikitext
19401 {{Template:тест}}
19402 !! html
19403 <p>This is a test template
19404 </p>
19405 !! end
19406
19407
19408 !! test
19409 Basic test for template parameter in language variants
19410 !! options
19411 language=sr
19412 !! wikitext
19413 {{парамтест|param=foo}}
19414 !! html
19415 <p>This is a test template with parameter foo
19416 </p>
19417 !! end
19418
19419
19420 !! test
19421 Simple category in language variants
19422 !! options
19423 language=sr cat
19424 !! wikitext
19425 [[Category:МедиаWики Усер'с Гуиде]]
19426 !! html
19427 <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>
19428 !! end
19429
19430
19431 !! article
19432 Category:分类
19433 !! text
19434 blah
19435 !! endarticle
19436
19437 !! article
19438 Category:分類
19439 !! text
19440 blah
19441 !! endarticle
19442
19443 ## We used to, but no longer wt2wt this test since the default serializer
19444 ## will normalize all categories to serialize on their own line.
19445 ## This wikitext usage is going to be fairly uncommon in production and
19446 ## selser will take care of preserving formatting in those scenarios.
19447 !! test
19448 Don't convert blue categorylinks to another variant (bug 33210)
19449 !! options
19450 cat
19451 language=zh
19452 parsoid=wt2html
19453 !! wikitext
19454 [[A]][[Category:分类]]
19455 !! html/php
19456 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
19457 !! html/parsoid
19458 <p><a rel="mw:WikiLink" href="A" title="A">A</a></p>
19459 <link rel="mw:PageProp/Category" href="Category:分类"/>
19460 !! end
19461
19462 !! test
19463 Stripping -{}- tags (language variants)
19464 !! options
19465 language=sr
19466 !! wikitext
19467 Latin proverb: -{Ne nuntium necare}-
19468 !! html
19469 <p>Latin proverb: Ne nuntium necare
19470 </p>
19471 !! end
19472
19473
19474 !! test
19475 Prevent conversion with -{}- tags (language variants)
19476 !! options
19477 language=sr variant=sr-ec
19478 !! wikitext
19479 Latinski: -{Ne nuntium necare}-
19480 !! html
19481 <p>Латински: Ne nuntium necare
19482 </p>
19483 !! end
19484
19485
19486 !! test
19487 Prevent conversion of text with -{}- tags (language variants)
19488 !! options
19489 language=sr variant=sr-ec
19490 !! wikitext
19491 Latinski: -{Ne nuntium necare}-
19492 !! html
19493 <p>Латински: Ne nuntium necare
19494 </p>
19495 !! end
19496
19497
19498 !! test
19499 Prevent conversion of links with -{}- tags (language variants)
19500 !! options
19501 language=sr variant=sr-ec
19502 !! wikitext
19503 -{[[Main Page]]}-
19504 !! html
19505 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19506 </p>
19507 !! end
19508
19509
19510 !! test
19511 -{}- tags within headlines (within html for parserConvert())
19512 !! options
19513 language=sr variant=sr-ec
19514 !! wikitext
19515 == -{Naslov}- ==
19516 !! html
19517 <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>
19518
19519 !! end
19520
19521
19522 !! test
19523 Explicit definition of language variant alternatives
19524 !! options
19525 language=zh variant=zh-tw
19526 !! wikitext
19527 -{zh:China;zh-tw:Taiwan}-, not China
19528 !! html
19529 <p>Taiwan, not China
19530 </p>
19531 !! end
19532
19533
19534 !! test
19535 Conversion around HTML tags
19536 !! options
19537 language=sr variant=sr-ec
19538 !! wikitext
19539 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
19540 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
19541 !! html
19542 <p>
19543 <span title="ЛаCтин">ски</span>
19544 </p>
19545 !! end
19546
19547
19548 !! test
19549 Explicit session-wise language variant mapping (A flag and - flag)
19550 !! options
19551 language=zh variant=zh-tw
19552 !! wikitext
19553 Taiwan is not China.
19554 But -{A|zh:China;zh-tw:Taiwan}- is China,
19555 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
19556 and -{China}- is China.
19557 !! html
19558 <p>Taiwan is not China.
19559 But Taiwan is Taiwan,
19560 (This should be stripped!)
19561 and China is China.
19562 </p>
19563 !! end
19564
19565 !! test
19566 Explicit session-wise language variant mapping (H flag for hide)
19567 !! options
19568 language=zh variant=zh-tw
19569 !! wikitext
19570 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
19571 Taiwan is China.
19572 !! html
19573 <p>(This should be stripped!)
19574 Taiwan is Taiwan.
19575 </p>
19576 !! end
19577
19578 !! test
19579 Adding explicit conversion rule for title (T flag)
19580 !! options
19581 language=zh variant=zh-tw showtitle
19582 !! wikitext
19583 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19584 !! html
19585 Taiwan
19586 <p>Should be stripped!
19587 </p>
19588 !! end
19589
19590 !! test
19591 Testing that changing the language variant here in the tests actually works
19592 !! options
19593 language=zh variant=zh showtitle
19594 !! wikitext
19595 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19596 !! html
19597 China
19598 <p>Should be stripped!
19599 </p>
19600 !! end
19601
19602 !! test
19603 Recursive conversion of alt and title attrs shouldn't clear converter state
19604 !! options
19605 language=zh variant=zh-cn showtitle
19606 !! wikitext
19607 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
19608 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
19609 !! html
19610 China
19611 <p>
19612 Should be stripped<span title="Exclamation">!</span>
19613 </p>
19614 !! end
19615
19616 !! test
19617 Bug 24072: more test on conversion rule for title
19618 !! options
19619 language=zh variant=zh-tw showtitle
19620 !! wikitext
19621 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19622 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
19623 !! html
19624 Taiwan
19625 <p>This should be stripped!
19626 This won't take interferes with the title rule.
19627 </p>
19628 !! end
19629
19630 !! test
19631 Partly disable title conversion if variant == main language code
19632 !! options
19633 language=zh variant=zh title=[[ZH]] showtitle
19634 !! wikitext
19635 -{T|zh-cn:CN;zh-tw:TW}-
19636 !! html
19637 ZH
19638 <p>
19639 </p>
19640 !! end
19641
19642 !! test
19643 Partly disable title conversion if variant == main language code, more
19644 !! options
19645 language=zh variant=zh title=[[ZH]] showtitle
19646 !! wikitext
19647 -{T|TW}-
19648 !! html
19649 ZH
19650 <p>
19651 </p>
19652 !! end
19653
19654 !! test
19655 Raw output of variant escape tags (R flag)
19656 !! options
19657 language=zh variant=zh-tw
19658 !! wikitext
19659 Raw: -{R|zh:China;zh-tw:Taiwan}-
19660 !! html
19661 <p>Raw: zh:China;zh-tw:Taiwan
19662 </p>
19663 !! end
19664
19665 !! test
19666 Strings evaluating false shouldn't be ignored by Language converter (T51072)
19667 !! options
19668 language=zh variant=zh-cn
19669 !! input
19670 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
19671 !! result
19672 <p>0
19673 </p>
19674 !! end
19675
19676 !! test
19677 Conversion rules from [numeric-only string] to [something else] (T48634)
19678 !! options
19679 language=zh variant=zh-cn
19680 !! input
19681 -{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
19682 !! result
19683 <p>D12345EE12345
19684 </p>
19685 !! end
19686
19687 !! test
19688 Bidirectional converter rule entries with an empty value should be ignored (T53551)
19689 !! options
19690 language=zh variant=zh-cn
19691 !! input
19692 -{H|zh-cn:foo;zh-tw:;}-foobar
19693 !! result
19694 <p>foobar
19695 </p>
19696 !! end
19697
19698 !! test
19699 Unidirectional converter rule entries with an empty "from" string should be ignored (T53551)
19700 !! options
19701 language=zh variant=zh-cn
19702 !! input
19703 -{H|=>zh-cn:foo;}-foobar
19704 !! result
19705 <p>foobar
19706 </p>
19707 !! end
19708
19709 !! test
19710 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
19711 !! options
19712 language=zh variant=zh-cn
19713 !! input
19714 -{H|}-foobar
19715 !! result
19716 <p>foobar
19717 </p>
19718 !! end
19719
19720 !! test
19721 Nested using of manual convert syntax
19722 !! options
19723 language=zh variant=zh-hk
19724 !! wikitext
19725 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
19726 !! html
19727 <p>Nested: Hello Hong Kong!
19728 </p>
19729 !! end
19730
19731 !! test
19732 Proper conversion of text in external links
19733 !! options
19734 language=sr variant=sr-ec
19735 !! wikitext
19736 http://www.google.com
19737 gopher://www.google.com
19738 [http://www.google.com http://www.google.com]
19739 [gopher://www.google.com gopher://www.google.com]
19740 [https://www.google.com irc://www.google.com]
19741 [ftp://www.google.com www.google.com/ftp://dir]
19742 [//www.google.com www.google.com]
19743 !! html
19744 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
19745 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
19746 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
19747 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
19748 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
19749 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
19750 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
19751 </p>
19752 !! end
19753
19754 !! test
19755 Do not convert roman numbers to language variants
19756 !! options
19757 language=sr variant=sr-ec
19758 !! wikitext
19759 Fridrih IV je car.
19760 !! html
19761 <p>Фридрих IV је цар.
19762 </p>
19763 !! end
19764
19765 !! test
19766 Unclosed language converter markup "-{"
19767 !! options
19768 language=sr
19769 !! wikitext
19770 -{T|hello
19771 !! html
19772 <p>-{T|hello
19773 </p>
19774 !! end
19775
19776 !! test
19777 Don't convert raw rule "-{R|=&gt;}-" to "=>"
19778 !! options
19779 language=sr
19780 !! wikitext
19781 -{R|=&gt;}-
19782 !! html
19783 <p>=&gt;
19784 </p>
19785 !!end
19786
19787 !! test
19788 Don't break link parsing if language converter markup is in the caption.
19789 !! options
19790 language=sr variant=sr-ec
19791 !! wikitext
19792 [[Main Page|-{R|main page}-]]
19793 !! html
19794 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
19795 </p>
19796 !! end
19797
19798 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19799 !! test
19800 Don't break image parsing if language converter markup is in the caption.
19801 !! options
19802 language=sr
19803 !! wikitext
19804 [[File:Foobar.jpg|-{R|caption}-]]
19805 !! html/parsoid
19806 <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>
19807 </p>
19808 !! end
19809
19810 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19811 !! test
19812 Don't break list handling if language converter markup is in the item.
19813 !! options
19814 language=zh variant=zh-cn
19815 !! wikitext
19816 ;-{zh-cn:AAA;zh-tw:BBB}-
19817 !! html/php
19818 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
19819
19820 !! html/parsoid
19821 <dl><dt>AAA
19822 </dt></dl>
19823 !! end
19824
19825 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19826 !! test
19827 Don't break table handling if language converter markup is in the cell.
19828 !! options
19829 language=sr variant=sr-ec
19830 !! wikitext
19831 {|
19832 |-
19833 | -{R|B}-
19834 |}
19835 !! html/php
19836 <table>
19837
19838 <tr>
19839 <td>Б}-
19840 </td></tr></table>
19841
19842 !! html/parsoid
19843 <table>
19844
19845 <tr>
19846 <td> B
19847 </td></tr></table>
19848
19849 !! end
19850
19851 !! test
19852 Bug 529: Uncovered bullet
19853 !! wikitext
19854 * Foo {{bullet}}
19855 !! html
19856 <ul><li> Foo </li>
19857 <li> Bar</li></ul>
19858
19859 !! end
19860
19861 # Plain MediaWiki does not remove empty lists, but tidy actually does.
19862 # Templates in Wikipedia rely on this behavior, as tidy has always been
19863 # enabled there. These tests are normally run *without* tidy, so specify the
19864 # full output here.
19865 # To test realistic parsing behavior, apply a tidy-like transformation to both
19866 # the expected output and your parser's output.
19867 !! test
19868 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
19869 !! wikitext
19870 ******* Foo {{bullet}}
19871 !! html
19872 <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>
19873 <li> Bar</li></ul>
19874
19875 !! end
19876
19877 !! test
19878 Bug 529: Uncovered table already at line-start
19879 !! wikitext
19880 x
19881
19882 {{table}}
19883 y
19884 !! html
19885 <p>x
19886 </p>
19887 <table>
19888 <tr>
19889 <td> 1 </td>
19890 <td> 2
19891 </td></tr>
19892 <tr>
19893 <td> 3 </td>
19894 <td> 4
19895 </td></tr></table>
19896 <p>y
19897 </p>
19898 !! end
19899
19900 !! test
19901 Bug 529: Uncovered bullet in parser function result
19902 !! wikitext
19903 * Foo {{lc:{{bullet}} }}
19904 !! html
19905 <ul><li> Foo </li>
19906 <li> bar</li></ul>
19907
19908 !! end
19909
19910 !! test
19911 Bug 5678: Double-parsed template argument
19912 !! wikitext
19913 {{lc:{{{1}}}|hello}}
19914 !! html
19915 <p>{{{1}}}
19916 </p>
19917 !! end
19918
19919 !! test
19920 Bug 5678: Double-parsed template invocation
19921 !! wikitext
19922 {{lc:{{paramtest {{!}} param = hello }} }}
19923 !! html
19924 <p>{{paramtest | param = hello }}
19925 </p>
19926 !! end
19927
19928 !! test
19929 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
19930 !! options
19931 language=cs
19932 title=[[Main Page]]
19933 !! wikitext
19934 {{PRVNÍVELKÉ:ěščř}}
19935 {{prvnívelké:ěščř}}
19936 {{PRVNÍMALÉ:ěščř}}
19937 {{prvnímalé:ěščř}}
19938 {{MALÁ:ěščř}}
19939 {{malá:ěščř}}
19940 {{VELKÁ:ěščř}}
19941 {{velká:ěščř}}
19942 !! html
19943 <p>Ěščř
19944 Ěščř
19945 ěščř
19946 ěščř
19947 ěščř
19948 ěščř
19949 ĚŠČŘ
19950 ĚŠČŘ
19951 </p>
19952 !! end
19953
19954 !! test
19955 Morwen/13: Unclosed link followed by heading
19956 !! wikitext
19957 [[link
19958 ==heading==
19959 !! html
19960 <p>[[link
19961 </p>
19962 <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>
19963
19964 !! end
19965
19966 !! test
19967 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
19968 !! wikitext
19969 {{foo|
19970 =heading=
19971 !! html
19972 <p>{{foo|
19973 </p>
19974 <h1><span class="mw-headline" id="heading">heading</span></h1>
19975
19976 !! end
19977
19978 !! test
19979 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
19980 !! wikitext
19981 {{foo|
19982 ==heading==
19983 !! html
19984 <p>{{foo|
19985 </p>
19986 <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>
19987
19988 !! end
19989
19990 !! test
19991 Tildes in comments
19992 !! options
19993 pst
19994 !! wikitext
19995 <!-- ~~~~ -->
19996 !! html/php
19997 <!-- ~~~~ -->
19998 !! end
19999
20000 !! test
20001 Paragraphs inside divs (no extra line breaks)
20002 !! wikitext
20003 <div>Line one
20004
20005 Line two</div>
20006 !! html
20007 <div>Line one
20008 Line two</div>
20009
20010 !! end
20011
20012 !! test
20013 Paragraphs inside divs (extra line break on open)
20014 !! wikitext
20015 <div>
20016 Line one
20017
20018 Line two</div>
20019 !! html
20020 <div>
20021 <p>Line one
20022 </p>
20023 Line two</div>
20024
20025 !! end
20026
20027 !! test
20028 Paragraphs inside divs (extra line break on close)
20029 !! wikitext
20030 <div>Line one
20031
20032 Line two
20033 </div>
20034 !! html
20035 <div>Line one
20036 <p>Line two
20037 </p>
20038 </div>
20039
20040 !! end
20041
20042 !! test
20043 Paragraphs inside divs (extra line break on open and close)
20044 !! wikitext
20045 <div>
20046 Line one
20047
20048 Line two
20049 </div>
20050 !! html
20051 <div>
20052 <p>Line one
20053 </p><p>Line two
20054 </p>
20055 </div>
20056
20057 !! end
20058
20059 !! test
20060 Nesting tags, paragraphs on lines which begin with <div>
20061 !! wikitext
20062 <div></div><strong>A
20063 B</strong>
20064 !! html/php+tidy
20065 <p><strong>A</strong></p>
20066 <p><strong>B</strong></p>
20067 !! html/parsoid
20068 <div></div>
20069 <p><strong>A
20070 B</strong>
20071 </p>
20072 !! end
20073
20074 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
20075 !! test
20076 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
20077 !! wikitext
20078 <blockquote>Line one
20079
20080 Line two</blockquote>
20081 !! html
20082 <blockquote>Line one
20083 Line two</blockquote>
20084
20085 !! html+tidy
20086 <blockquote>
20087 <p>Line one Line two</p>
20088 </blockquote>
20089 !! end
20090
20091 !! test
20092 Bug 6200: paragraphs inside blockquotes (extra line break on open)
20093 !! wikitext
20094 <blockquote>
20095 Line one
20096
20097 Line two</blockquote>
20098 !! html
20099 <blockquote>
20100 <p>Line one
20101 </p>
20102 Line two</blockquote>
20103
20104 !! html+tidy
20105 <blockquote>
20106 <p>Line one</p>
20107 Line two</blockquote>
20108 !! end
20109
20110 !! test
20111 Bug 6200: paragraphs inside blockquotes (extra line break on close)
20112 !! wikitext
20113 <blockquote>Line one
20114
20115 Line two
20116 </blockquote>
20117 !! html
20118 <blockquote>Line one
20119 <p>Line two
20120 </p>
20121 </blockquote>
20122
20123 !! html+tidy
20124 <blockquote>
20125 <p>Line one</p>
20126 <p>Line two</p>
20127 </blockquote>
20128 !! end
20129
20130 !! test
20131 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
20132 !! wikitext
20133 <blockquote>
20134 Line one
20135
20136 Line two
20137 </blockquote>
20138 !! html
20139 <blockquote>
20140 <p>Line one
20141 </p><p>Line two
20142 </p>
20143 </blockquote>
20144
20145 !! html+tidy
20146 <blockquote>
20147 <p>Line one</p>
20148 <p>Line two</p>
20149 </blockquote>
20150 !! end
20151
20152 !! test
20153 Paragraphs inside blockquotes/divs (no extra line breaks)
20154 !! wikitext
20155 <blockquote><div>Line one
20156
20157 Line two</div></blockquote>
20158 !! html
20159 <blockquote><div>Line one
20160 Line two</div></blockquote>
20161
20162 !! end
20163
20164 !! test
20165 Paragraphs inside blockquotes/divs (extra line break on open)
20166 !! wikitext
20167 <blockquote><div>
20168 Line one
20169
20170 Line two</div></blockquote>
20171 !! html
20172 <blockquote><div>
20173 <p>Line one
20174 </p>
20175 Line two</div></blockquote>
20176
20177 !! end
20178
20179 !! test
20180 Paragraphs inside blockquotes/divs (extra line break on close)
20181 !! wikitext
20182 <blockquote><div>Line one
20183
20184 Line two
20185 </div></blockquote>
20186 !! html
20187 <blockquote><div>Line one
20188 <p>Line two
20189 </p>
20190 </div></blockquote>
20191
20192 !! end
20193
20194 !! test
20195 Paragraphs inside blockquotes/divs (extra line break on open and close)
20196 !! wikitext
20197 <blockquote><div>
20198 Line one
20199
20200 Line two
20201 </div></blockquote>
20202 !! html
20203 <blockquote><div>
20204 <p>Line one
20205 </p><p>Line two
20206 </p>
20207 </div></blockquote>
20208
20209 !! end
20210
20211 !! test
20212 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
20213 !! options
20214 wgLinkHolderBatchSize=0
20215 !! wikitext
20216 [[meatball:1]]
20217 [[meatball:2]]
20218 [[meatball:3]]
20219 !! html
20220 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
20221 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
20222 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
20223 </p>
20224 !! end
20225
20226 !! test
20227 Free external link invading image caption
20228 !! wikitext
20229 [[Image:Foobar.jpg|thumb|http://x|hello]]
20230 !! html
20231 <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>
20232
20233 !! end
20234
20235 !! test
20236 Bug 15196: localised external link numbers
20237 !! options
20238 language=fa
20239 !! wikitext
20240 [http://en.wikipedia.org/]
20241 !! html/php
20242 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
20243 </p>
20244 !! html/parsoid
20245 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
20246 !! end
20247
20248 !! test
20249 Multibyte character in padleft
20250 !! wikitext
20251 {{padleft:-Hello|7|Æ}}
20252 !! html
20253 <p>Æ-Hello
20254 </p>
20255 !! end
20256
20257 !! test
20258 Multibyte character in padright
20259 !! wikitext
20260 {{padright:Hello-|7|Æ}}
20261 !! html
20262 <p>Hello-Æ
20263 </p>
20264 !! end
20265
20266 !!test
20267 formatdate parser function
20268 !! wikitext
20269 {{#formatdate:2009-03-24}}
20270 !! html
20271 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
20272 </p>
20273 !! end
20274
20275 !!test
20276 formatdate parser function, with default format
20277 !! wikitext
20278 {{#formatdate:2009-03-24|mdy}}
20279 !! html
20280 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
20281 </p>
20282 !! end
20283
20284 !! test
20285 Spacing of numbers in formatted dates
20286 !! wikitext
20287 {{#formatdate:January 15}}
20288 !! html
20289 <p><span class="mw-formatted-date" title="01-15">January 15</span>
20290 </p>
20291 !! end
20292
20293 !! test
20294 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
20295 !! options
20296 language=nl title=[[MediaWiki:Common.css]]
20297 !! wikitext
20298 {{#formatdate:2009-03-24|dmy}}
20299 !! html
20300 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
20301 </p>
20302 !! end
20303
20304 #
20305 #
20306 #
20307
20308 #
20309 # Edit comments
20310 #
20311
20312 !! test
20313 Edit comment with link
20314 !! options
20315 comment
20316 !! wikitext
20317 I like the [[Main Page]] a lot
20318 !! html/php
20319 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
20320 !!end
20321
20322 !! test
20323 Edit comment with link and link text
20324 !! options
20325 comment
20326 !! wikitext
20327 I like the [[Main Page|best pages]] a lot
20328 !! html/php
20329 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
20330 !!end
20331
20332 !! test
20333 Edit comment with link and link text with suffix
20334 !! options
20335 comment
20336 !! wikitext
20337 I like the [[Main Page|best page]]s a lot
20338 !! html/php
20339 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
20340 !!end
20341
20342 !! test
20343 Edit comment with section link (non-local, eg in history list)
20344 !! options
20345 comment title=[[Main Page]]
20346 !! wikitext
20347 /* External links */ removed bogus entries
20348 !! html/php
20349 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
20350 !!end
20351
20352 !! test
20353 Edit comment with section link and text before it (non-local, eg in history list)
20354 !! options
20355 comment title=[[Main Page]]
20356 !! wikitext
20357 pre-comment text /* External links */ removed bogus entries
20358 !! html/php
20359 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>
20360 !!end
20361
20362 !! test
20363 Edit comment with section link (local, eg in diff view)
20364 !! options
20365 comment local title=[[Main Page]]
20366 !! wikitext
20367 /* External links */ removed bogus entries
20368 !! html/php
20369 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
20370 !!end
20371
20372 !! test
20373 Edit comment with subpage link (bug 14080)
20374 !! options
20375 comment
20376 subpage
20377 title=[[Subpage test]]
20378 !! wikitext
20379 Poked at a [[/subpage]] here...
20380 !! html/php
20381 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
20382 !!end
20383
20384 !! test
20385 Edit comment with subpage link and link text (bug 14080)
20386 !! options
20387 comment
20388 subpage
20389 title=[[Subpage test]]
20390 !! wikitext
20391 Poked at a [[/subpage|neat little page]] here...
20392 !! html/php
20393 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
20394 !!end
20395
20396 !! test
20397 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
20398 !! options
20399 comment
20400 title=[[Subpage test]]
20401 !! wikitext
20402 Poked at a [[/subpage]] here...
20403 !! html/php
20404 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...
20405 !!end
20406
20407 !! test
20408 Edit comment with bare anchor link (local, as on diff)
20409 !! options
20410 comment
20411 local
20412 title=[[Main Page]]
20413 !! wikitext
20414 [[#section]]
20415 !! html/php
20416 <a href="#section">#section</a>
20417 !! end
20418
20419 !! test
20420 Edit comment with bare anchor link (non-local, as on history)
20421 !! options
20422 comment
20423 title=[[Main Page]]
20424 !! wikitext
20425 [[#section]]
20426 !! html/php
20427 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
20428 !! end
20429
20430 !! test
20431 Anchor starting with underscore
20432 !! options
20433 title=[[Foo]]
20434 !! wikitext
20435 [[#_ref|One]]
20436 !! html/php
20437 <p><a href="#_ref">One</a>
20438 </p>
20439 !! html/parsoid
20440 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
20441 !! end
20442
20443 !! test
20444 Id starting with underscore
20445 !! wikitext
20446 <div id="_ref"></div>
20447 !! html/*
20448 <div id="_ref"></div>
20449
20450 !! end
20451
20452 !! test
20453 Space normalisation on autocomment (bug 22784)
20454 !! options
20455 comment
20456 title=[[Main Page]]
20457 !! wikitext
20458 /* __hello__world__ */
20459 !! html/php
20460 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
20461 !! end
20462
20463 !! test
20464 percent-encoding and + signs in comments (Bug 26410)
20465 !! options
20466 comment
20467 !! wikitext
20468 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
20469 !! html/php
20470 <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>
20471 !! end
20472
20473 # Parsoid doesn't support this yet: see bug 73581
20474 # but it *should* omit the 'src' attribute if the image is bad.
20475 # PHP side of tests was disabled in
20476 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
20477 # because of issues in the PHP parserTests infrastructure
20478 # (but the output below is indeed what the PHP side emits)
20479 !! test
20480 Bad images - basic functionality
20481 !! wikitext
20482 [[File:Bad.jpg]]
20483 !! DISABLED/html/php
20484 !! html/parsoid
20485 <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>
20486 !! end
20487
20488 !! test
20489 Bad images - bug 16039: text after bad image disappears
20490 !! wikitext
20491 Foo bar
20492 [[File:Bad.jpg]]
20493 Bar foo
20494 !! DISABLED/html/php
20495 <p>Foo bar
20496 </p><p>Bar foo
20497 </p>
20498 !! html/parsoid
20499 <p>Foo bar
20500 <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>
20501 Bar foo</p>
20502 !! end
20503
20504 !! test
20505 Verify that displaytitle works (bug #22501) no displaytitle
20506 !! options
20507 showtitle
20508 !! config
20509 wgAllowDisplayTitle=true
20510 wgRestrictDisplayTitle=false
20511 !! wikitext
20512 this is not the the title
20513 !! html/php
20514 Parser test
20515 <p>this is not the the title
20516 </p>
20517 !! end
20518
20519 !! test
20520 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
20521 !! options
20522 showtitle
20523 title=[[Screen]]
20524 !! config
20525 wgAllowDisplayTitle=true
20526 wgRestrictDisplayTitle=false
20527 !! wikitext
20528 this is not the the title
20529 {{DISPLAYTITLE:whatever}}
20530 !! html/php
20531 whatever
20532 <p>this is not the the title
20533 </p>
20534 !! end
20535
20536 !! test
20537 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
20538 !! options
20539 showtitle
20540 title=[[Screen]]
20541 !! config
20542 wgAllowDisplayTitle=true
20543 wgRestrictDisplayTitle=true
20544 !! wikitext
20545 this is not the the title
20546 {{DISPLAYTITLE:whatever}}
20547 !! html/php
20548 Screen
20549 <p>this is not the the title
20550 </p>
20551 !! end
20552
20553 !! test
20554 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
20555 !! options
20556 showtitle
20557 title=[[Screen]]
20558 !! config
20559 wgAllowDisplayTitle=true
20560 wgRestrictDisplayTitle=true
20561 !! wikitext
20562 this is not the the title
20563 {{DISPLAYTITLE:screen}}
20564 !! html/php
20565 screen
20566 <p>this is not the the title
20567 </p>
20568 !! end
20569
20570 !! test
20571 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
20572 !! options
20573 showtitle
20574 title=[[Screen]]
20575 !! config
20576 wgAllowDisplayTitle=false
20577 !! wikitext
20578 this is not the the title
20579 {{DISPLAYTITLE:screen}}
20580 !! html/php
20581 Screen
20582 <p>this is not the the title
20583 <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>
20584 </p>
20585 !! end
20586
20587 !! test
20588 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
20589 !! options
20590 showtitle
20591 title=[[Screen]]
20592 !! config
20593 wgAllowDisplayTitle=false
20594 !! wikitext
20595 this is not the the title
20596 !! html/php
20597 Screen
20598 <p>this is not the the title
20599 </p>
20600 !! end
20601
20602 !! test
20603 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
20604 !! options
20605 showtitle
20606 title=[[Screen]]
20607 !! config
20608 wgAllowDisplayTitle=true
20609 wgRestrictDisplayTitle=true
20610 !! wikitext
20611 this is not the the title
20612 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
20613 !! html/php
20614 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
20615 <p>this is not the the title
20616 </p>
20617 !! end
20618
20619 !! test
20620 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
20621 !! options
20622 showtitle
20623 title=[[Screen]]
20624 !! config
20625 wgAllowDisplayTitle=true
20626 wgRestrictDisplayTitle=true
20627 !! wikitext
20628 this is not the the title
20629 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
20630 !! html/php
20631 <span style="color: red;">s</span>creen
20632 <p>this is not the the title
20633 </p>
20634 !! end
20635
20636 !! test
20637 Page status indicators: Empty name is invalid
20638 !! options
20639 showindicators
20640 !! wikitext
20641 <indicator name=" "></indicator>
20642 <indicator></indicator>
20643 !! html
20644 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
20645 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
20646 </p>
20647 !! end
20648
20649 !! test
20650 Page status indicators: Weird syntaxes that are okay
20651 !! options
20652 showindicators
20653 !! wikitext
20654 <indicator name="empty" />
20655 <indicator name="name"></indicator>
20656 !! html
20657 empty=
20658 name=
20659 <p><br />
20660 </p>
20661 !! end
20662
20663 !! test
20664 Page status indicators: Torture test
20665 !! options
20666 showindicators
20667 !! wikitext
20668 <indicator name="01">hello world</indicator>
20669 <indicator name="02">[[Main Page]]</indicator>
20670 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
20671 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
20672 <indicator name="05">* foo
20673 * bar</indicator>
20674 <indicator name="06"><nowiki>foo</nowiki></indicator>
20675 <indicator name="07"> Preformatted</indicator>
20676 <indicator name="08"><div>Broken tag</indicator>
20677 <indicator name="09">{| class=wikitable
20678 | cell
20679 |}</indicator>
20680 <indicator name="10">Two
20681
20682 paragraphs</indicator>
20683 !! html
20684 01=hello world
20685 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20686 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" />
20687 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>
20688 05=<ul><li> foo</li>
20689 <li> bar</li></ul>
20690
20691 06=foo
20692 07=<pre>Preformatted
20693 </pre>
20694 08=<div>Broken tag</div>
20695
20696 09=<table class="wikitable">
20697 <tr>
20698 <td> cell
20699 </td></tr></table>
20700
20701 10=<p>Two
20702 </p><p>paragraphs
20703 </p>
20704 <p><br />
20705 </p><p><br />
20706 </p><p><br />
20707 </p><p><br />
20708 </p><p><br />
20709 </p>
20710 !! end
20711
20712 !! test
20713 preload: check <noinclude> and <includeonly>
20714 !! options
20715 preload
20716 !! wikitext
20717 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
20718 !! html/php
20719 Hello kind world.
20720 !! end
20721
20722 !! test
20723 preload: check <onlyinclude>
20724 !! options
20725 preload
20726 !! wikitext
20727 Goodbye <onlyinclude>Hello world</onlyinclude>
20728 !! html/php
20729 Hello world
20730 !! end
20731
20732 !! test
20733 preload: can pass tags through if we want to
20734 !! options
20735 preload
20736 !! wikitext
20737 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
20738 !! html/php
20739 <includeonly>Hello world</includeonly>
20740 !! end
20741
20742 !! test
20743 preload: check that it doesn't try to do tricks
20744 !! options
20745 preload
20746 !! wikitext
20747 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
20748 !! html/php
20749 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
20750 !! end
20751
20752 !! test
20753 Play a bit with r67090 and bug 3158
20754 !! wikitext
20755 <div style="width:50% !important">&nbsp;</div>
20756 <div style="width:50%&nbsp;!important">&nbsp;</div>
20757 <div style="width:50%&#160;!important">&nbsp;</div>
20758 <div style="border : solid;">&nbsp;</div>
20759 !! html/php
20760 <div style="width:50% !important">&#160;</div>
20761 <div style="width:50% !important">&#160;</div>
20762 <div style="width:50% !important">&#160;</div>
20763 <div style="border&#160;: solid;">&#160;</div>
20764
20765 !! html/parsoid
20766 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
20767 <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>
20768 <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>
20769 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
20770
20771 !! end
20772
20773 !! test
20774 HTML5 data attributes
20775 !! wikitext
20776 <span data-foo="bar">Baz</span>
20777 <p data-abc-def_hij="">Quuz</p>
20778 !! html/php
20779 <p><span data-foo="bar">Baz</span>
20780 </p>
20781 <p data-abc-def_hij="">Quuz</p>
20782
20783 !! html/parsoid
20784 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
20785 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
20786 !! end
20787
20788 !! test
20789 Strip reserved data attributes
20790 !! wikitext
20791 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
20792 !! html/php
20793 <div data-ok="fred">d</div>
20794
20795 !! html/parsoid
20796 <div data-x-data-mw="foo" data-x-data-parsoid="bar" data-x-data-mw-someext="baz" data-ok="fred" data-parsoid='{"stx":"html","a":{"data-ooui":null,"data-bad:ns":null},"sa":{"data-ooui":"xyzzy","data-bad:ns":"ns"}}'>d</div>
20797 !! end
20798
20799 !! test
20800 percent-encoding and + signs in internal links (Bug 26410)
20801 !! wikitext
20802 [[User:+%]] [[Page+title%]]
20803 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
20804 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
20805 [[%33%45]] [[%33%45+]]
20806 !! html/php
20807 <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>
20808 <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>
20809 <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>
20810 <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>
20811 </p>
20812 !! html/parsoid
20813 <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>
20814 <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>
20815 <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>
20816 <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>
20817 !! end
20818
20819 !! test
20820 Special characters in embedded file links (bug 27679)
20821 !! wikitext
20822 [[File:Contains & ampersand.jpg]]
20823 [[File:Does not exist.jpg|Title with & ampersand]]
20824 !! html/php
20825 <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>
20826 <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>
20827 </p>
20828 !! html/parsoid
20829 <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>
20830 <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>
20831 !! end
20832
20833 !! test
20834 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
20835 !! wikitext
20836 Text&apos;s been normalized?
20837 !! html
20838 <p>Text&#39;s been normalized?
20839 </p>
20840 !! end
20841
20842 !! test
20843 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
20844 !! wikitext
20845 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
20846 !! html
20847 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
20848 </p>
20849 !! end
20850
20851 !! test
20852 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
20853 !! wikitext
20854 [http://www.example.org/ ideograms]
20855 !! html
20856 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
20857 </p>
20858 !! end
20859
20860 !! test
20861 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
20862 !! wikitext
20863 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
20864 !! html
20865 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
20866 </p>
20867 !! end
20868
20869 !! article
20870 Mediawiki:loop1
20871 !! text
20872 {{Identical|A}}
20873 !! endarticle
20874
20875 !! article
20876 Mediawiki:loop2
20877 !! text
20878 {{Identical|B}}
20879 !! endarticle
20880
20881 !! article
20882 Template:Identical
20883 !! text
20884 {{int:loop1}}
20885 {{int:loop2}}
20886 !! endarticle
20887
20888 !! test
20889 Bug 31098 Template which includes system messages which includes the template
20890 !! wikitext
20891 {{Identical}}
20892 !! html
20893 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
20894 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
20895 </p>
20896 !! end
20897
20898 !! test
20899 Bug31490 Turkish: ucfirst 'blah'
20900 !! options
20901 language=tr
20902 !! wikitext
20903 {{ucfirst:blah}}
20904 !! html
20905 <p>Blah
20906 </p>
20907 !! end
20908
20909 !! test
20910 Bug31490 Turkish: ucfirst 'ix'
20911 !! options
20912 language=tr
20913 !! wikitext
20914 {{ucfirst:ix}}
20915 !! html
20916 <p>İx
20917 </p>
20918 !! end
20919
20920 !! test
20921 Bug31490 Turkish: lcfirst 'BLAH'
20922 !! options
20923 language=tr
20924 !! wikitext
20925 {{lcfirst:BLAH}}
20926 !! html
20927 <p>bLAH
20928 </p>
20929 !! end
20930
20931 !! test
20932 Bug31490 Turkish: ucfırst (with a dotless i)
20933 !! options
20934 language=tr
20935 !! wikitext
20936 {{ucfırst:blah}}
20937 !! html
20938 <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>
20939 </p>
20940 !! end
20941
20942 !! test
20943 Bug31490 ucfırst (with a dotless i) with English language
20944 !! options
20945 language=en
20946 !! wikitext
20947 {{ucfırst:blah}}
20948 !! html
20949 <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>
20950 </p>
20951 !! end
20952
20953 !! test
20954 Bug 26375: TOC with italics
20955 !! options
20956 title=[[Main Page]]
20957 !! wikitext
20958 __TOC__
20959 == ''Lost'' episodes ==
20960 !! html
20961 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20962 <ul>
20963 <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>
20964 </ul>
20965 </div>
20966
20967 <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>
20968
20969 !! end
20970
20971 !! test
20972 Bug 26375: TOC with bold
20973 !! options
20974 title=[[Main Page]]
20975 !! wikitext
20976 __TOC__
20977 == '''should be bold''' then normal text ==
20978 !! html
20979 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20980 <ul>
20981 <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>
20982 </ul>
20983 </div>
20984
20985 <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>
20986
20987 !! end
20988
20989 !! test
20990 Bug 33845: Headings become cursive in TOC when they contain an image
20991 !! options
20992 title=[[Main Page]]
20993 !! wikitext
20994 __TOC__
20995 == Image [[Image:foobar.jpg]] ==
20996 !! html
20997 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20998 <ul>
20999 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
21000 </ul>
21001 </div>
21002
21003 <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>
21004
21005 !! end
21006
21007 !! test
21008 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
21009 !! options
21010 title=[[Main Page]]
21011 !! wikitext
21012 __TOC__
21013 == <blockquote>Quote</blockquote> ==
21014 !! html
21015 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21016 <ul>
21017 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
21018 </ul>
21019 </div>
21020
21021 <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>
21022
21023 !! html+tidy
21024 <p></p>
21025 <div id="toc" class="toc">
21026 <div id="toctitle">
21027 <h2>Contents</h2>
21028 </div>
21029 <ul>
21030 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
21031 </ul>
21032 </div>
21033 <p></p>
21034 <h2><span class="mw-headline" id="Quote"></span></h2>
21035 <blockquote>
21036 <p><span class="mw-headline" id="Quote">Quote</span></p>
21037 </blockquote>
21038 <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>
21039 !! end
21040
21041 !! test
21042 Unclosed tags in TOC
21043 !! options
21044 title=[[Main Page]]
21045 !! wikitext
21046 __TOC__
21047 == Proof: 2 < 3 ==
21048 <small>Hanc marginis exiguitas non caperet.</small>
21049 QED
21050 !! html
21051 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21052 <ul>
21053 <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>
21054 </ul>
21055 </div>
21056
21057 <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>
21058 <p><small>Hanc marginis exiguitas non caperet.</small>
21059 QED
21060 </p>
21061 !! end
21062
21063 !! test
21064 Multiple tags in TOC
21065 !! wikitext
21066 __TOC__
21067 == <i>Foo</i> <b>Bar</b> ==
21068
21069 == <i>Foo</i> <blockquote>Bar</blockquote> ==
21070 !! html
21071 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21072 <ul>
21073 <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>
21074 <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>
21075 </ul>
21076 </div>
21077
21078 <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>
21079 <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>
21080
21081 !! html+tidy
21082 <p></p>
21083 <div id="toc" class="toc">
21084 <div id="toctitle">
21085 <h2>Contents</h2>
21086 </div>
21087 <ul>
21088 <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>
21089 <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>
21090 </ul>
21091 </div>
21092 <p></p>
21093 <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>
21094 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
21095 <blockquote>
21096 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
21097 </blockquote>
21098 <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>
21099 !! end
21100
21101 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
21102 # html5 tag parsing.
21103 !! test
21104 Tags with parameters in TOC
21105 !! options
21106 parsoid=wt2html
21107 !! wikitext
21108 __TOC__
21109 == <sup class="in-h2">Hello</sup> ==
21110
21111 == <sup class="a > b">Evilbye</sup> ==
21112 !! html/php
21113 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21114 <ul>
21115 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
21116 <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>
21117 </ul>
21118 </div>
21119
21120 <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>
21121 <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>
21122
21123 !! html/parsoid
21124 <meta property="mw:PageProp/toc" />
21125 <h2> <sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup> </h2>
21126
21127 <h2> <sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup> </h2>
21128 !! end
21129
21130 !! test
21131 span tags with directionality in TOC
21132 !! wikitext
21133 __TOC__
21134 == <span dir="ltr">C++</span> ==
21135
21136 == <span dir="rtl">זבנג!</span> ==
21137
21138 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
21139
21140 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
21141
21142 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
21143 !! html
21144 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21145 <ul>
21146 <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>
21147 <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>
21148 <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>
21149 <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>
21150 <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>
21151 </ul>
21152 </div>
21153
21154 <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>
21155 <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>
21156 <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>
21157 <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>
21158 <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>
21159
21160 !! end
21161
21162 !! test
21163 Bug 72884: bdi element in ToC
21164 !! wikitext
21165 __TOC__
21166 == <bdi>test</bdi> ==
21167 !! html
21168 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21169 <ul>
21170 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
21171 </ul>
21172 </div>
21173
21174 <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>
21175
21176 !! end
21177
21178 # Note that the html output does not have the <p></p>, but the
21179 # html+tidy output *does*. This is because the empty <p></p> is
21180 # removed by the sanitizer, but only when tidy is *not* enabled (!).
21181 !! test
21182 Empty <p> tag in TOC, removed by Sanitizer (T92892)
21183 !! wikitext
21184 __TOC__
21185 == x ==
21186 !! html
21187 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21188 <ul>
21189 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
21190 </ul>
21191 </div>
21192
21193 <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>
21194
21195 !! html+tidy
21196 <p></p>
21197 <div id="toc" class="toc">
21198 <div id="toctitle">
21199 <h2>Contents</h2>
21200 </div>
21201 <ul>
21202 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
21203 </ul>
21204 </div>
21205 <p></p>
21206 <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>
21207 !! end
21208
21209 !! article
21210 MediaWiki:Bug32057
21211 !! text
21212 == {{int:headline_sample}} ==
21213 !! endarticle
21214
21215 !! test
21216 Bug 32057: Title needed when expanding <h> nodes.
21217 !! options
21218 title=[[Main Page]]
21219 !! wikitext
21220 {{int:Bug32057}}
21221 !! html
21222 <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>
21223
21224 !! end
21225
21226 !! test
21227 Strip marker in urlencode
21228 !! wikitext
21229 {{urlencode:x<nowiki/>y}}
21230 {{urlencode:x<nowiki/>y|wiki}}
21231 {{urlencode:x<nowiki/>y|path}}
21232 {{urlencode:x<pre id="one">two</pre>y}}
21233 !! html
21234 <p>xy
21235 xy
21236 xy
21237 xy
21238 </p>
21239 !! end
21240
21241 !! test
21242 Strip marker in lc
21243 !! wikitext
21244 {{lc:x<nowiki/>y}}
21245 !! html
21246 <p>xy
21247 </p>
21248 !! end
21249
21250 !! test
21251 Strip marker in uc
21252 !! wikitext
21253 {{uc:x<nowiki/>y}}
21254 !! html
21255 <p>XY
21256 </p>
21257 !! end
21258
21259 !! test
21260 Strip marker in formatNum
21261 !! wikitext
21262 {{formatnum:1<nowiki/>2}}
21263 {{formatnum:1<nowiki/>2|R}}
21264 !! html
21265 <p>12
21266 12
21267 </p>
21268 !! end
21269
21270 !! test
21271 Check noCommafy in formatNum
21272 !! options
21273 language=be-tarask
21274 !! wikitext
21275 {{formatnum:123456.78}}
21276 {{formatnum:123456.78|NOSEP}}
21277 !! html
21278 <p>123 456,78
21279 123456.78
21280 </p>
21281 !! end
21282
21283 !! test
21284 Wrong option for formatNum (bug 56199)
21285 !! wikitext
21286 {{formatnum:1,234.56|Random}}
21287 {{formatnum:1,234.56|EVERYTHING}}
21288 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
21289 !! html
21290 <p>1,234.56
21291 1,234.56
21292 1,234.56
21293 </p>
21294 !! end
21295
21296 !! test
21297 Strip marker in grammar
21298 !! options
21299 language=fi
21300 !! wikitext
21301 {{grammar:elative|foo<nowiki/>bar}}
21302 !! html
21303 <p>foobarista
21304 </p>
21305 !! end
21306
21307 !! test
21308 Strip marker in padleft
21309 !! wikitext
21310 {{padleft:|2|x<nowiki/>y}}
21311 !! html
21312 <p>xy
21313 </p>
21314 !! end
21315
21316 !! test
21317 Strip marker in padright
21318 !! wikitext
21319 {{padright:|2|x<nowiki/>y}}
21320 !! html
21321 <p>xy
21322 </p>
21323 !! end
21324
21325 !! test
21326 Strip marker in anchorencode
21327 !! wikitext
21328 {{anchorencode:x<nowiki/>y}}
21329 !! html
21330 <p>xy
21331 </p>
21332 !! end
21333
21334 !! test
21335 nowiki inside link inside heading (bug 18295)
21336 !! wikitext
21337 ==[[foo|x<nowiki>y</nowiki>z]]==
21338 !! html
21339 <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>
21340
21341 !! end
21342
21343 !! test
21344 new support for bdi element (bug 31817)
21345 !! wikitext
21346 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
21347 !! html
21348 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
21349
21350 !!end
21351
21352 !! test
21353 Ignore pipe between table row attributes
21354 !! wikitext
21355 {|
21356 | quux
21357 |- id=foo | style='color: red'
21358 | bar
21359 |}
21360 !! html
21361 <table>
21362 <tr>
21363 <td> quux
21364 </td></tr>
21365 <tr id="foo" style="color: red">
21366 <td> bar
21367 </td></tr></table>
21368
21369 !! end
21370
21371 !!test
21372 Gallery override link with WikiLink (bug 34852)
21373 !! wikitext
21374 <gallery>
21375 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
21376 </gallery>
21377 !! html
21378 <ul class="gallery mw-gallery-traditional">
21379 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21380 <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>
21381 <div class="gallerytext">
21382 <p>caption
21383 </p>
21384 </div>
21385 </div></li>
21386 </ul>
21387
21388 !! end
21389
21390 !!test
21391 Gallery override link with absolute external link (bug 34852)
21392 !! wikitext
21393 <gallery>
21394 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
21395 </gallery>
21396 !! html
21397 <ul class="gallery mw-gallery-traditional">
21398 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21399 <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>
21400 <div class="gallerytext">
21401 <p>caption
21402 </p>
21403 </div>
21404 </div></li>
21405 </ul>
21406
21407 !! end
21408
21409 !!test
21410 Gallery override link with malicious javascript (bug 34852)
21411 !! wikitext
21412 <gallery>
21413 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
21414 </gallery>
21415 !! html
21416 <ul class="gallery mw-gallery-traditional">
21417 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21418 <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>
21419 <div class="gallerytext">
21420 <p>caption
21421 </p>
21422 </div>
21423 </div></li>
21424 </ul>
21425
21426 !! end
21427
21428 !!test
21429 Gallery with invalid title as link (bug 43964)
21430 !! wikitext
21431 <gallery>
21432 File:foobar.jpg|link=<
21433 </gallery>
21434 !! html
21435 <ul class="gallery mw-gallery-traditional">
21436 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21437 <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>
21438 <div class="gallerytext">
21439 </div>
21440 </div></li>
21441 </ul>
21442
21443 !! end
21444
21445 !!test
21446 Language parser function
21447 !! wikitext
21448 {{#language:ar}}
21449 !! html
21450 <p>العربية
21451 </p>
21452 !! end
21453
21454 !!test
21455 Padleft and padright as substr
21456 !! wikitext
21457 {{padleft:|3|abcde}}
21458 {{padright:|3|abcde}}
21459 !! html
21460 <p>abc
21461 abc
21462 </p>
21463 !! end
21464
21465 !!test
21466 Special parser function
21467 !! wikitext
21468 {{#special:RandomPage}}
21469 {{#special:BaDtItLe}}
21470 {{#special:Foobar}}
21471 !! html
21472 <p>Special:Random
21473 Special:Badtitle
21474 Special:Foobar
21475 </p>
21476 !! end
21477
21478 !!test
21479 Bug 34939 - Case insensitive link parsing ([HttP://])
21480 !! wikitext
21481 [HttP://MediaWiki.Org/]
21482 !! html/php
21483 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
21484 </p>
21485 !! html/parsoid
21486 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
21487 !! end
21488
21489 !!test
21490 Bug 34939 - Case insensitive link parsing ([HttP:// title])
21491 !! wikitext
21492 [HttP://MediaWiki.Org/ MediaWiki]
21493 !! html
21494 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
21495 </p>
21496 !! end
21497
21498 !!test
21499 Bug 34939 - Case insensitive link parsing (HttP://)
21500 !! wikitext
21501 HttP://MediaWiki.Org/
21502 !! html/php
21503 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
21504 </p>
21505 !! html/parsoid
21506 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
21507 !! end
21508
21509 !!test
21510 Disable TOC
21511 !! options
21512 notoc
21513 !! wikitext
21514 Lead
21515 == Section 1 ==
21516 == Section 2 ==
21517 == Section 3 ==
21518 == Section 4 ==
21519 == Section 5 ==
21520 !! html
21521 <p>Lead
21522 </p>
21523
21524 <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>
21525 <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>
21526 <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>
21527 <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>
21528 <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>
21529
21530 !! end
21531
21532
21533 ###
21534 ### Parsoid-specific tests
21535 ### Parsoid-PHP parser incompatibilities
21536 ###
21537 !!test
21538 1. SOL-sensitive wikitext tokens as template-args
21539 !!options
21540 parsoid=wt2html,wt2wt
21541 !! wikitext
21542 {{echo|*a}}
21543 {{echo|#a}}
21544 {{echo|:a}}
21545 !! html
21546 <span about="#mwt1" typeof="mw:Transclusion">
21547 </span><ul about="#mwt1"><li>a</li>
21548 </ul>
21549 <span about="#mwt2" typeof="mw:Transclusion">
21550 </span><ol about="#mwt2"><li>a</li>
21551 </ol>
21552 <span about="#mwt3" typeof="mw:Transclusion">
21553 </span><dl about="#mwt3"><dd>a</dd>
21554 </dl>
21555 !!end
21556
21557 #### -----------------------------------------------------------------
21558 #### Parsoid-specific functionality tests
21559 #### -----------------------------------------------------------------
21560
21561 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
21562 # We know wt2wt will fail, but we expect selser to pass.
21563 # Due to the nature of our testing, wt2wt and selser tests will enter the
21564 # blacklist and we'll catch selser regressions based on changes to the
21565 # blacklist entries for selser tests.
21566 !! test
21567 1. Bad treebuilder fixup of formatting elt is cleaned up
21568 !! options
21569 parsoid=wt2html,wt2wt
21570 !! wikitext
21571 {|
21572 |
21573 <small>
21574 [[Image:Foobar.jpg|right|Test]]
21575 </small>
21576 |}
21577 !! html/parsoid
21578 <table>
21579 <tbody><tr><td>
21580 <small>
21581 <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>
21582 </small>
21583 </td></tr>
21584 </tbody></table>
21585 !! end
21586
21587 !! test
21588 2. Bad treebuilder fixup of formatting elt is cleaned up
21589 !! options
21590 parsoid=wt2html,wt2wt
21591 !! wikitext
21592 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
21593
21594 <small>[[Image:Foobar.jpg|right|300px]]</small>
21595 !! html/parsoid
21596
21597 <p><b>foo</b></p>
21598 <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>
21599 <p><b>bar</b></p>
21600 <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>
21601 !! end
21602
21603 !! test
21604 3. Bad treebuilder fixup of formatting elt is cleaned up
21605 !! options
21606 parsoid=wt2html,wt2wt
21607 !! wikitext
21608 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
21609 !! html/parsoid
21610 <p><small><b>foo</b></small></p>
21611 <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>
21612 <p><small><b>bar</b></small></p>
21613 !! end
21614
21615 !! test
21616 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
21617 !! options
21618 parsoid=wt2html,wt2wt
21619 !! wikitext
21620 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
21621 !! html/parsoid
21622 <p><b><small></small></b></p>
21623 <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>
21624 <p></p>
21625 !! end
21626
21627 #### ----------------------------------------------------------------
21628 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
21629 #### tags. Parsoid's output for these tags differs from that of the
21630 #### PHP parser.
21631 #### ----------------------------------------------------------------
21632
21633 !!test
21634 Ref: 1. ref-location should be replaced with an index span
21635 !! wikitext
21636 A <ref>foo</ref>
21637 B <ref name="x">foo</ref>
21638 C <ref name="y" />
21639 <references />
21640 !! html/parsoid
21641 <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>
21642 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>
21643 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>
21644 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" 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-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>
21647 <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>
21648 </ol>
21649 !!end
21650
21651 !!test
21652 Ref: 2. ref-tags with identical names should all get the same index
21653 !! wikitext
21654 A <ref name="x">foo</ref>
21655 B <ref name="x" />
21656 <references />
21657 !! html/parsoid
21658 <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>
21659 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>
21660 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21661 <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>
21662 </ol>
21663 !!end
21664
21665 !!test
21666 Ref: 3. spaces in ref-names should be ignored
21667 !! wikitext
21668 A <ref name="x">foo</ref>
21669 B <ref name=" x " />
21670 C <ref name= x />
21671 <references />
21672 !! html/parsoid
21673 <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>
21674 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>
21675 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>
21676 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21677 <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>
21678 </ol>
21679 !!end
21680
21681 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
21682 !!test
21683 Ref: 4. 'constructor' should be accepted as a valid ref-name
21684 !! wikitext
21685 A <ref name="constructor">foo</ref>
21686 <references />
21687 !! html/parsoid
21688 <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>
21689 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21690 <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>
21691 </ol>
21692 !!end
21693
21694 !!test
21695 Ref: 5. body should accept generic wikitext
21696 !! wikitext
21697 A <ref>
21698 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
21699 </ref>
21700
21701 <references />
21702 !! html/parsoid
21703 <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>
21704
21705 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21706 <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>
21707 </span></li>
21708 </ol>
21709 !!end
21710
21711 !!test
21712 Ref: 6. indent-pres should not be output in ref-body
21713 !! wikitext
21714 A <ref>
21715 foo
21716 bar
21717 baz
21718 </ref>
21719
21720 <references />
21721 !! html/parsoid
21722 <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>
21723
21724 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21725 <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
21726 bar
21727 baz
21728 </span></li>
21729 </ol>
21730 !!end
21731
21732 !!test
21733 Ref: 7. No p-wrapping in ref-body
21734 !! wikitext
21735 A <ref>
21736 foo
21737
21738 bar
21739
21740
21741 baz
21742
21743
21744
21745 booz
21746 </ref>
21747
21748 <references />
21749 !! html/parsoid
21750 <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>
21751
21752 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21753 <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
21754
21755 bar
21756
21757
21758 baz
21759
21760
21761
21762 booz
21763 </span></li>
21764 </ol>
21765 !!end
21766
21767 !!test
21768 Ref: 8. transclusion wikitext has lower precedence
21769 !! wikitext
21770 A <ref> foo {{echo|</ref> B C}}
21771
21772 <references />
21773 !! html/parsoid
21774 <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>
21775 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21776 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo {{echo|</span></li>
21777 </ol>
21778 !!end
21779
21780 !!test
21781 Ref: 9. unclosed comments should not leak out of ref-body
21782 !! wikitext
21783 A <ref> foo <!--</ref> B C
21784 <references />
21785 !! html/parsoid
21786 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> B C</p>
21787 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21788 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo <!----></span></li>
21789 </ol>
21790 !!end
21791
21792 !!test
21793 Ref: 10. Unclosed HTML tags should not leak out of ref-body
21794 !! wikitext
21795 A <ref> <b> foo </ref> B C
21796
21797 <references />
21798 !! html/parsoid
21799 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> B C</p>
21800
21801
21802 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21803 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text"><b data-parsoid='{"stx":"html","autoInsertedEnd":true}'> foo </b></span></li>
21804 </ol>
21805 !!end
21806
21807 !!test
21808 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
21809 !! wikitext
21810 A <ref>foo</ref> B
21811 C <ref>bar</ref> D
21812 <references />
21813 !! html/parsoid
21814 <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
21815 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>
21816 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21817 <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>
21818 <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>
21819 </ol>
21820 !!end
21821
21822 !!test
21823 Ref: 12. ref-tags act as trailing newline migration barrier
21824 !! wikitext
21825 <!--the newline at the end of this line moves out of the p tag-->a
21826
21827 b<!--the newline at the end of this line stays inside the p tag--> <ref />
21828 <ref />
21829
21830 c
21831 <references />
21832 !! html/parsoid
21833 <!--the newline at the end of this line moves out of the p tag--><p>a</p>
21834
21835
21836 <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>
21837 <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>
21838
21839 <p>c</p>
21840 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21841 <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>
21842 <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>
21843 !!end
21844
21845 !!test
21846 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
21847 !! wikitext
21848 <ref>foo</ref> A
21849 <ref>bar
21850 </ref> B
21851 <references />
21852 !! html/parsoid
21853 <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
21854 <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>
21855 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21856 <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 <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
21858 </span></li>
21859 </ol>
21860 !!end
21861
21862 !!test
21863 Ref: 14. A nested ref-tag should be emitted as plain text
21864 !! wikitext
21865 <ref>foo <ref>bar</ref> baz</ref>
21866
21867 <references />
21868 !! html/parsoid
21869 <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>
21870 </p>
21871 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21872 <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>
21873 </ol>
21874 !!end
21875
21876 !!test
21877 Ref: 15. ref-tags with identical names should get identical indexes
21878 !! wikitext
21879 A1 <ref name="a">foo</ref> A2 <ref name="a" />
21880 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
21881
21882 <references />
21883 !! html/parsoid
21884 <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>
21885 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>
21886
21887 <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>
21888 </ol>
21889 !!end
21890
21891 ## We don't bother wt2wt-ing non-standard whitespace
21892 !!test
21893 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
21894 !!options
21895 parsoid=wt2html
21896 !! wikitext
21897 A <ref >foo</ref >
21898
21899 <references />
21900 !! html/parsoid
21901 <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>
21902 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21903 <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>
21904 !!end
21905
21906 !!test
21907 Ref: 17. Generate valid HTML5 id/about attributes
21908 !!wikitext
21909 <ref name="a b">foo</ref>
21910
21911 <references />
21912 !!html/parsoid
21913 <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>
21914 </p>
21915
21916 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21917 <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>
21918 </ol>
21919 !!end
21920
21921 !!test
21922 Ref: 18. T58916: Extension attributes should be parsed as plain text
21923 !!wikitext
21924 <ref name="{{echo|a}}">foo</ref>
21925
21926 <references />
21927 !!html/parsoid
21928 <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>
21929 </p>
21930
21931 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21932 <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>
21933 </ol>
21934 !!end
21935
21936 !!test
21937 Ref: 19. ref-tags with identical name encodings should get identical indexes
21938 !! wikitext
21939 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
21940
21941 <references />
21942 !! html/parsoid
21943 <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>
21944 </p>
21945 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21946 <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>
21947 </ol>
21948 !!end
21949
21950 !!test
21951 Ref: 20. ref-tags with identical names but different content should keep it
21952 !! wikitext
21953 A <ref name="foo">Foo one</ref>
21954 B <ref name="foo">Foo two</ref>
21955 C <ref name="foo" />
21956
21957 <references />
21958 !! html/parsoid
21959 <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>
21960 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>
21961 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>
21962
21963 <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>
21964 </ol>
21965 !!end
21966
21967 !!test
21968 References: 1. references tag without any refs should be handled properly
21969 !! wikitext
21970 <references />
21971 !! html/parsoid
21972 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
21973 !!end
21974
21975 !!test
21976 References: 2. references tag with group only outputs references from that group
21977 !! wikitext
21978 A <ref group="a">foo</ref>
21979 B <ref group="b">bar</ref>
21980 C <ref>baz</ref>
21981
21982 <references group="a" />
21983 <references />
21984 <references group="b" />
21985 !! html/parsoid
21986 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{"group":"a"}}'><a href="#cite_note-1" data-mw-group="a"><span class="mw-reflink-text">[a 1]</span></a></span>
21987 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>
21988 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>
21989
21990 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="a" data-mw='{"name":"references","attrs":{"group":"a"}}'>
21991 <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>
21992 </ol>
21993 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'>
21994 <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>
21995 </ol>
21996 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt12" data-mw-group="b" data-mw='{"name":"references","attrs":{"group":"b"}}'>
21997 <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>
21998 </ol>
21999 !!end
22000
22001 !!test
22002 References: 3. ref list should be cleared after processing references
22003 !! wikitext
22004 A <ref>foo</ref>
22005
22006 <references />
22007
22008 B <ref>bar</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
22014 <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>
22015 </ol>
22016
22017 <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>
22018
22019 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22020 <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>
22021 </ol>
22022 !!end
22023
22024 !!test
22025 References: 4. only referenced group should be cleared after processing references
22026 !! wikitext
22027 A <ref group="a">afoo</ref>
22028 B <ref>bfoo</ref>
22029
22030 <references group="a" />
22031
22032 C <ref>cfoo</ref>
22033
22034 <references />
22035 !! html/parsoid
22036 <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>
22037 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>
22038
22039 <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>
22040 </ol>
22041
22042 <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>
22043
22044 <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>
22045 </ol>
22046 !!end
22047
22048 ## Don't expect this to rt since we're dropping content
22049 !! test
22050 References: 5. ref tags in references should be processed while ignoring all other content
22051 !! options
22052 parsoid=wt2html,html2html
22053 !! wikitext
22054 A <ref name="a" />
22055 B <ref name="b">bar</ref>
22056
22057 <references>
22058 <ref name="a">foo</ref>
22059 This should just get lost.
22060 </references>
22061 !! html/parsoid
22062 <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>
22063 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>
22064
22065
22066 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{},"body":{"html":"\n&lt;span about=\"#mwt8\" class=\"mw-ref\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid=&#39;{\"dsr\":[59,82,14,6]}&#39; data-mw=&#39;{\"name\":\"ref\",\"body\":{\"id\":\"mw-reference-text-cite_note-a-1\"},\"attrs\":{\"name\":\"a\"}}&#39;>&lt;a href=\"#cite_note-a-1\" style=\"counter-reset: mw-Ref 1;\">&lt;span class=\"mw-reflink-text\">[1]&lt;/span>&lt;/a>&lt;/span>\n"}}'><li about="#cite_note-a-1" id="cite_note-a-1"><a href="#cite_ref-a_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-a-1" class="mw-reference-text">foo</span></li><li about="#cite_note-b-2" id="cite_note-b-2"><a href="#cite_ref-b_2-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-b-2" class="mw-reference-text">bar</span></li>
22067 </ol>
22068 !! end
22069
22070 !! test
22071 References: 6. <references /> from a transclusion
22072 !! wikitext
22073 <ref>Foo</ref> {{echo|<references />}}
22074 !! html/parsoid
22075 <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>
22076 </ol>
22077 !! end
22078
22079 !! test
22080 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
22081 !! wikitext
22082 A <ref>foo bar for a</ref>
22083 B <ref group="X" name="b" />
22084
22085 <references />
22086
22087 <references group="X">
22088 <ref name="b">foo</ref>
22089 </references>
22090 !! html/parsoid
22091 <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>
22092 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>
22093 </p>
22094
22095 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22096 <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>
22097 </ol>
22098
22099 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="X" data-mw='{"name":"references","attrs":{"group":"X"},"body":{"html":"\n&lt;span about=\"#mwt10\" class=\"mw-ref\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid=&#39;{\"dsr\":[96,119,14,6]}&#39; data-mw=&#39;{\"name\":\"ref\",\"body\":{\"id\":\"mw-reference-text-cite_note-b-2\"},\"attrs\":{\"name\":\"b\"}}&#39;>&lt;a href=\"#cite_note-b-2\" style=\"counter-reset: mw-Ref 1;\" data-mw-group=\"X\">&lt;span class=\"mw-reflink-text\">[X 1]&lt;/span>&lt;/a>&lt;/span>\n"}}'>
22100 <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>
22101 </ol>
22102 !! end
22103
22104 !! test
22105 References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
22106 !! wikitext
22107 X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
22108 <references />
22109 !! html/parsoid
22110 <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>
22111 <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>
22112 </ol>
22113 !!end
22114
22115 # This test only works in wt2html now as the <references /> are always generated
22116 # unless selser is active. Once T72722 is fixed, we should add a changes test
22117 # here to ensure that unrelated changes don't add the new <references /> in
22118 # wt2wt.
22119 !! test
22120 References: 9. Generate missing references list at the end
22121 !! wikitext
22122 A <ref>foo</ref>
22123 B <ref group="inexistent">bar</ref>
22124 !! html/parsoid
22125 <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>
22126 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
22127 <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>
22128 </ol>
22129 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="inexistent" data-mw='{"name":"references","attrs":{"group":"inexistent"}}'>
22130 <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>
22131 </ol>
22132 !! end
22133
22134 !! test
22135 References: 10. New <references/> shouldn't be added for unrelated edits.
22136 !! options
22137 parsoid={
22138 "modes": ["selser"],
22139 "changes": [["#x", "remove"]],
22140 "selser": "noauto"
22141 }
22142 !! wikitext
22143 Unrelated text<span id="x"> that's going to disappear</span>.
22144 A <ref>foo</ref>
22145 !! wikitext/edited
22146 Unrelated text.
22147 A <ref>foo</ref>
22148 !!end
22149
22150 !! test
22151 Entities in ref name
22152 !! wikitext
22153 <ref name="test &amp; me">hi</ref>
22154 <references />
22155 !! html/parsoid
22156 <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>
22157 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22158 <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>
22159 </ol>
22160 !! end
22161
22162 # This test is wt2html only because we're permitting the serializer to produce
22163 # dirty diffs, normalizing the unclosed references to the self-closed version.
22164 !! test
22165 Generate references for unclosed references tag
22166 !! options
22167 parsoid=wt2html
22168 !! wikitext
22169 a<ref>foo</ref>
22170
22171 <references>
22172 !! html/parsoid
22173 <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>
22174 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22175 <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>
22176 !! end
22177
22178 !! test
22179 New reference serializes on its own line
22180 !! options
22181 parsoid=wt2wt,html2wt
22182 !! wikitext
22183 foo
22184 <references />
22185 !! html/parsoid
22186 foo<ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
22187 !! end
22188
22189 #### ----------------------------------------------------------------
22190 #### Parsoid-only testing of Parsoid's impl of LST
22191 #### Not implemented yet, see
22192 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
22193 #### ----------------------------------------------------------------
22194
22195 !! test
22196 LST Sections: 1. Simple section start and end
22197 !! options
22198 parsoid={ "suppressErrors": true }
22199 !! wikitext
22200 <section begin="2011-05-16" />
22201 <section end="2014-04-10 (MW 1.23wmf22)" />
22202 !! html/parsoid
22203 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
22204 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
22205 !! end
22206
22207 #--------- Test stripping of empty nodes in template content ----------
22208 !!test
22209 Empty LI and TR nodes should be stripped from template content
22210 !!wikitext
22211 {{EmptyLITest}}
22212 {{EmptyTRTest}}
22213 !!html/parsoid
22214 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
22215 <li>a</li>
22216 <li>b</li>
22217 </ul>
22218 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
22219 <tbody>
22220 <tr>
22221 <td>foo</td>
22222 </tr>
22223 <tr>
22224 <td>bar</td>
22225 </tr>
22226 </tbody>
22227 </table>
22228 !!end
22229
22230 !!test
22231 Empty LI and TR nodes should not be stripped from top-level content
22232 !!wikitext
22233 * a
22234 *
22235 * b
22236 {|
22237 |-
22238 |-
22239 |foo
22240 |}
22241 !!html/parsoid
22242 <ul>
22243 <li> a</li>
22244 <li></li>
22245 <li> b</li>
22246 </ul>
22247 <table>
22248 <tbody>
22249 <tr></tr>
22250 <tr>
22251 <td>foo</td>
22252 </tr>
22253 </tbody>
22254 </table>
22255 !!end
22256
22257 !!test
22258 Empty TR nodes should not be stripped if they have any attributes set
22259 !!wikitext
22260 {{EmptyTRWithHTMLAttrTest}}
22261 !!html/parsoid
22262 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
22263 <tr align="center"></tr>
22264 <tr><td>foo</td></tr>
22265 <tr align="center"></tr>
22266 <tr><td>bar</td></tr>
22267 </table>
22268 !!end
22269
22270 #### ----------------------------------------------------------------
22271 #### The following section of tests are primarily to test
22272 #### wikitext escaping capabilities of Parsoid. Given that
22273 #### escaping can be done any number of ways, the wikitext (input)
22274 #### is always adjusted to reflect how Parsoid adds nowiki
22275 #### escape tags.
22276 ####
22277 #### We are marking several tests as parsoid-only since the
22278 #### HTML in the result section is different from what the
22279 #### PHP parser generates for it.
22280 #### ----------------------------------------------------------------
22281
22282
22283 #### --------------- Headings ---------------
22284 #### 0. Unnested
22285 #### 1. Nested inside html <h1>=foo=</h1>
22286 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
22287 #### 3. Nested inside html with wikitext split by html tags
22288 #### 4. No escape needed
22289 #### 5. Empty headings <h1></h1>
22290 #### 6. Heading chars in SOL context
22291 #### ----------------------------------------
22292 !! test
22293 Headings: 0. Unnested
22294 !! options
22295 parsoid=html2wt
22296 !! html/parsoid
22297 <p>=foo=</p>
22298
22299 <p> =foo=
22300 <!--cmt-->
22301 =foo=</p>
22302
22303 <p>=foo<i>a</i>=</p>
22304 !! wikitext
22305 <nowiki>=foo=</nowiki>
22306
22307 <nowiki> </nowiki>=foo=
22308 <!--cmt-->
22309 <nowiki>=foo=</nowiki>
22310
22311 =foo''a''<nowiki>=</nowiki>
22312 !!end
22313
22314 # New headings and existing headings are handled differently
22315 !! test
22316 Headings: 1. Nested inside html
22317 !! options
22318 parsoid=html2wt
22319 !! html/parsoid
22320 <h1>=foo=</h1>
22321 <h2>=foo=</h2>
22322 <h3>=foo=</h3>
22323
22324 <h1 data-parsoid=''>=foo=</h1>
22325 <h2 data-parsoid=''>=foo=</h2>
22326 <h3 data-parsoid=''>=foo=</h3>
22327 <h4 data-parsoid=''>=foo=</h4>
22328 <h5 data-parsoid=''>=foo=</h5>
22329 <h6 data-parsoid=''>=foo=</h6>
22330 !! wikitext
22331 = =foo= =
22332
22333 == =foo= ==
22334
22335 === =foo= ===
22336
22337 =<nowiki>=foo=</nowiki>=
22338 ==<nowiki>=foo=</nowiki>==
22339 ===<nowiki>=foo=</nowiki>===
22340 ====<nowiki>=foo=</nowiki>====
22341 =====<nowiki>=foo=</nowiki>=====
22342 ======<nowiki>=foo=</nowiki>======
22343
22344 !!end
22345
22346 !! test
22347 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
22348 !! options
22349 parsoid=html2wt
22350 !! html/parsoid
22351 <h1>foo</h1>*bar
22352 <h1>foo</h1>=bar
22353 <h1>foo</h1>=bar=
22354 !! wikitext
22355 = foo =
22356 <nowiki>*</nowiki>bar
22357
22358 = foo =
22359 =bar
22360
22361 = foo =
22362 <nowiki>=bar=</nowiki>
22363 !!end
22364
22365 !! test
22366 Headings: 3. Nested inside html with wikitext split by html tags
22367 !! options
22368 parsoid=html2wt
22369 !! html/parsoid
22370 <h1>=<b>bold</b>foo=</h1>
22371 !! wikitext
22372 = ='''bold'''foo= =
22373 !!end
22374
22375 !! test
22376 Headings: 4a. No escaping needed (testing just h1 and h2)
22377 !! options
22378 parsoid=html2wt
22379 !! html/parsoid
22380 <h1>=foo</h1>
22381 <h1>foo=</h1>
22382 <h1> =foo= </h1>
22383 <h1>=foo= bar</h1>
22384 <h2>=foo</h2>
22385 <h2>foo=</h2>
22386 <h1>=</h1>
22387 <h1><i>=</i>foo=</h1>
22388 !! wikitext
22389 = =foo =
22390
22391 = foo= =
22392
22393 = =foo= =
22394
22395 = =foo= bar =
22396
22397 == =foo ==
22398
22399 == foo= ==
22400
22401 = = =
22402
22403 = ''=''foo= =
22404 !!end
22405
22406 !! test
22407 Headings: 4b. No escaping needed (inside p-tags)
22408 !! options
22409 parsoid=html2wt
22410 !! html/parsoid
22411 <p>===
22412 =foo= x
22413 =foo= <s></s>
22414 </p>
22415 !! wikitext
22416 ===
22417 =foo= x
22418 =foo= <s></s>
22419 !!end
22420
22421 !! test
22422 Headings: 5. Empty headings
22423 !! options
22424 parsoid=html2wt
22425 !! html/parsoid
22426 <h1 data-parsoid='{}'></h1>
22427
22428 <h2 data-parsoid='{}'></h2>
22429
22430 <h3 data-parsoid='{}'></h3>
22431
22432 <h4 data-parsoid='{}'></h4>
22433
22434 <h5 data-parsoid='{}'></h5>
22435
22436 <h6 data-parsoid='{}'></h6>
22437 !! wikitext
22438 =<nowiki/>=
22439
22440 ==<nowiki/>==
22441
22442 ===<nowiki/>===
22443
22444 ====<nowiki/>====
22445
22446 =====<nowiki/>=====
22447
22448 ======<nowiki/>======
22449 !!end
22450
22451 !! test
22452 Headings: 6a. Heading chars in SOL context (with trailing spaces)
22453 !! options
22454 parsoid=html2wt
22455 !! html/parsoid
22456 <p>=a=</p>
22457
22458 <p>=a=</p>
22459
22460 <p>=a=</p>
22461 !! wikitext
22462 <nowiki>=a=</nowiki>
22463
22464 <nowiki>=a=</nowiki>
22465
22466 <nowiki>=a=</nowiki>
22467 !!end
22468
22469 !! test
22470 Headings: 6b. Heading chars in SOL context (with trailing newlines)
22471 !! options
22472 parsoid=html2wt
22473 !! html/parsoid
22474 <p>=a=
22475 b</p>
22476
22477 <p>=a=
22478 b</p>
22479
22480 <p>=a=
22481 b</p>
22482 !! wikitext
22483 <nowiki>=a=</nowiki>
22484 b
22485
22486 <nowiki>=a=</nowiki>
22487 b
22488
22489 <nowiki>=a=</nowiki>
22490 b
22491 !!end
22492
22493 !! test
22494 Headings: 6c. Heading chars in SOL context (leading newline break)
22495 !! options
22496 parsoid=html2wt
22497 !! html/parsoid
22498 <p>a
22499 =b=</p>
22500 !! wikitext
22501 a
22502 <nowiki>=b=</nowiki>
22503 !!end
22504
22505 !! test
22506 Headings: 6d. Heading chars in SOL context (with interspersed comments)
22507 !! options
22508 parsoid=html2wt
22509 !! html/parsoid
22510 <!--c0--><p>=a=</p>
22511
22512 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
22513 !! wikitext
22514 <!--c0--><nowiki>=a=</nowiki>
22515
22516 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
22517 !!end
22518
22519 !! test
22520 Headings: 6d. Heading chars in SOL context (No escaping needed)
22521 !! options
22522 parsoid=html2wt
22523 !! html/parsoid
22524 =a=<div>b</div>
22525 !! wikitext
22526 =a=<div>b</div>
22527 !!end
22528
22529 !! test
22530 Headings: 7. Insert a newline between new content and headings
22531 !! options
22532 parsoid=html2wt
22533 !! html/parsoid
22534 <h2>NEW</h2>
22535 <p>new</p>
22536 <h2 data-parsoid='{}'>A</h2>
22537 <p data-parsoid='{}'>a</p>
22538 !! wikitext
22539 == NEW ==
22540 new
22541
22542 ==A==
22543 a
22544
22545 !! end
22546
22547 #### --------------- Lists ---------------
22548 #### 0. Outside nests (*foo, etc.)
22549 #### 1. Nested inside html <ul><li>*foo</li></ul>
22550 #### 2. Inside definition lists
22551 #### 3. Only bullets at start should be escaped
22552 #### 4. No escapes needed
22553 #### 5. No unnecessary escapes
22554 #### 6. Escape bullets in SOL position
22555 #### 7. Escape bullets in a multi-line context
22556 #### ----------------------------------------
22557
22558 !! test
22559 Lists: 0. Outside nests
22560 !! options
22561 parsoid=html2wt
22562 !! html/parsoid
22563 <p>*foo</p>
22564
22565 <p>#foo</p>
22566
22567 <p>;Foo:bar</p>
22568 !! wikitext
22569 <nowiki>*</nowiki>foo
22570
22571 <nowiki>#</nowiki>foo
22572
22573 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
22574 !!end
22575
22576 ## Making these next 3 tests Parsoid-only since they are html2wt tests
22577 ## to test wikitext escaping, and insignificant whitespace diffs
22578 ## cause PHP parser tests to barf
22579 !! test
22580 Lists: 1. Nested inside html (No unnecessary escapes)
22581 !! options
22582 parsoid=html2wt
22583 !! html/parsoid
22584 <ul>
22585 <li>*foo</li>
22586 <li>#foo</li>
22587 <li>:foo</li>
22588 <li>;foo</li>
22589 <li data-parsoid='{}'>*foo</li>
22590 <li data-parsoid='{}'>#foo</li>
22591 <li data-parsoid='{}'>:foo</li>
22592 <li data-parsoid='{}'>;foo</li>
22593 </ul>
22594
22595 <ol>
22596 <li>*foo</li>
22597 <li>#foo</li>
22598 <li>:foo</li>
22599 <li>;foo</li>
22600 <li data-parsoid='{}'>*foo</li>
22601 <li data-parsoid='{}'>#foo</li>
22602 <li data-parsoid='{}'>:foo</li>
22603 <li data-parsoid='{}'>;foo</li>
22604 </ol>
22605 !! wikitext
22606 * *foo
22607 * #foo
22608 * :foo
22609 * ;foo
22610 *<nowiki>*foo</nowiki>
22611 *<nowiki>#foo</nowiki>
22612 *<nowiki>:foo</nowiki>
22613 *<nowiki>;foo</nowiki>
22614
22615 # *foo
22616 # #foo
22617 # :foo
22618 # ;foo
22619 #<nowiki>*foo</nowiki>
22620 #<nowiki>#foo</nowiki>
22621 #<nowiki>:foo</nowiki>
22622 #<nowiki>;foo</nowiki>
22623 !!end
22624
22625 !! test
22626 Lists: 2. Inside definition lists
22627 !! options
22628 parsoid=html2wt
22629 !! html/parsoid
22630 <dl><dt>;foo</dt></dl>
22631 <dl><dt>:foo</dt></dl>
22632 <dl><dt>:foo</dt>
22633 <dd>bar</dd></dl>
22634 <dl><dd>:foo</dd></dl>
22635 !! wikitext
22636 ; ;foo
22637
22638 ; <nowiki>:foo</nowiki>
22639
22640 ; <nowiki>:foo</nowiki>
22641 : bar
22642
22643 : :foo
22644 !!end
22645
22646 !! test
22647 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
22648 !! options
22649 parsoid=html2wt
22650 !! html/parsoid
22651 <ul>
22652 <li>*foo*bar</li>
22653 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
22654 </ul>
22655 !! wikitext
22656 * *foo*bar
22657 *<nowiki>*foo</nowiki>''it''*bar
22658 !!end
22659
22660 !! test
22661 Lists: 4. No escapes needed
22662 !! options
22663 parsoid=html2wt
22664 !! html/parsoid
22665 <ul>
22666 <li>foo*bar
22667 </li>
22668 </ul>
22669 <ul>
22670 <li><i>foo</i>*bar
22671 </li>
22672 </ul>
22673 <ul>
22674 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
22675 </li>
22676 </ul>
22677 <ul>
22678 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
22679 </li>
22680 </ul>
22681 !! wikitext
22682 *foo*bar
22683
22684 *''foo''*bar
22685
22686 *[[Foo]]: bar
22687
22688 *[[Foo]]*bar
22689 !!end
22690
22691 !! test
22692 Lists: 5. No unnecessary escapes
22693 !! options
22694 parsoid=html2wt
22695 !! html/parsoid
22696 <ul><li> bar <span>[[foo]]</span></li></ul>
22697 <ul><li> =bar <span>[[foo]]</span></li></ul>
22698 <ul><li> [[bar <span>[[foo]]</span></li></ul>
22699 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
22700 <ul><li> =bar <span>foo]]</span>=</li></ul>
22701 <ul><li> <s></s>: a</li></ul>
22702 <ul><li> <i>* foo</i></li></ul>
22703
22704 !! wikitext
22705 * bar <span><nowiki>[[foo]]</nowiki></span>
22706
22707 * =bar <span><nowiki>[[foo]]</nowiki></span>
22708
22709 * [[bar <span><nowiki>[[foo]]</nowiki></span>
22710
22711 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
22712
22713 * =bar <span>foo]]</span>=
22714
22715 * <s></s>: a
22716
22717 * ''* foo''
22718 !!end
22719
22720 !! test
22721 Lists: 6. Escape bullets in SOL position
22722 !! options
22723 parsoid=html2wt
22724 !! html/parsoid
22725 <p><!--cmt-->*foo</p>
22726 !! wikitext
22727 <!--cmt--><nowiki>*</nowiki>foo
22728 !!end
22729
22730 !! test
22731 Lists: 7. Escape bullets in a multi-line context
22732 !! options
22733 parsoid=html2wt
22734 !! html/parsoid
22735 <p>a
22736 *b
22737 </p>
22738 !! wikitext
22739 a
22740 <nowiki>*</nowiki>b
22741 !!end
22742
22743 !! test
22744 Lists: 8. Escape colons only if not present in tags
22745 !! options
22746 parsoid=html2wt
22747 !! html/parsoid
22748 <dl><dt>a:b<i>c:d</i></dt></dl>
22749 !! wikitext
22750 ; <nowiki>a:b</nowiki>''c:d''
22751 !! end
22752
22753 #### --------------- HRs ---------------
22754 #### 1. Single line
22755 #### -----------------------------------
22756
22757 !! test
22758 HRs: 1. Single line
22759 !! options
22760 parsoid=html2wt
22761 !! html/parsoid
22762 <hr />----
22763 <hr />=foo=
22764 <hr />*foo
22765 !! wikitext
22766 ----<nowiki>----</nowiki>
22767 ----=foo=
22768 ----*foo
22769 !! end
22770
22771 #### --------------- Tables ---------------
22772 #### 1a. Simple example
22773 #### 1b. No escaping needed (!foo)
22774 #### 1c. No escaping needed (|foo)
22775 #### 1d. No escaping needed (|}foo)
22776 ####
22777 #### 2a. Nested in td (<td>foo|bar</td>)
22778 #### 2b. Nested in td (<td>foo||bar</td>)
22779 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
22780 ####
22781 #### 3a. Nested in th (<th>foo!bar</th>)
22782 #### 3b. Nested in th (<th>foo!!bar</th>)
22783 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
22784 ####
22785 #### 4a. Escape -
22786 #### 4b. Escape +
22787 #### 4c. No escaping needed
22788 #### --------------------------------------
22789
22790 !! test
22791 Tables: 1a. Simple example
22792 !! options
22793 parsoid=html2wt
22794 !! html/parsoid
22795 <p>{|
22796 |}
22797 </p>
22798 !! wikitext
22799 <nowiki>{|</nowiki>
22800 |}
22801 !! end
22802
22803 !! test
22804 Tables: 1b. No escaping needed
22805 !! options
22806 parsoid=html2wt
22807 !! html/parsoid
22808 <p>!foo
22809 </p>
22810 !! wikitext
22811 !foo
22812 !! end
22813
22814 !! test
22815 Tables: 1c. No escaping needed
22816 !! options
22817 parsoid=html2wt
22818 !! html/parsoid
22819 <p>|foo
22820 </p>
22821 !! wikitext
22822 |foo
22823 !! end
22824
22825 !! test
22826 Tables: 1d. No escaping needed
22827 !! options
22828 parsoid=html2wt
22829 !! html/parsoid
22830 <p>|}foo
22831 </p>
22832 !! wikitext
22833 |}foo
22834 !! end
22835
22836 !! test
22837 Tables: 2a. Nested in td
22838 !! options
22839 parsoid=html2wt
22840 !! html/parsoid
22841 <table><tbody><tr>
22842 <td>foo|bar</td></tr>
22843 <tr><td>x<div>a|b</div></td>
22844 </tbody></table>
22845 !! wikitext
22846 {|
22847 |<nowiki>foo|bar</nowiki>
22848 |-
22849 |x<div><nowiki>a|b</nowiki></div>
22850 |}
22851 !! html/php+tidy
22852 <table>
22853 <tr>
22854 <td>foo|bar</td>
22855 </tr>
22856 <tr>
22857 <td>x
22858 <div>a|b</div>
22859 </td>
22860 </tr>
22861 </table>
22862 !! end
22863
22864 !! test
22865 Tables: 2b. Nested in td
22866 !! options
22867 parsoid=html2wt
22868 !! html/parsoid
22869 <table><tbody><tr>
22870 <td>foo||bar</td>
22871 <td>a<i>b||c</i></td>
22872 <td>a<i><div>b||c</div></i></td>
22873 </tr></tbody></table>
22874 !! wikitext
22875 {|
22876 |<nowiki>foo||bar</nowiki>
22877 |a''<nowiki>b||c</nowiki>''
22878 |a''<div><nowiki>b||c</nowiki></div>''
22879 |}
22880 !! html/php
22881 <table>
22882 <tr>
22883 <td>foo||bar
22884 </td>
22885 <td>a<i>b||c</i>
22886 </td>
22887 <td>a<i><div>b||c</div></i>
22888 </td></tr></table>
22889
22890 !! end
22891
22892 !! test
22893 Tables: 2c. Nested in td -- no escaping needed
22894 !! options
22895 parsoid=html2wt
22896 !! html/*
22897 <table>
22898
22899 <tr>
22900 <td>foo!!bar
22901 </td></tr></table>
22902
22903 !! wikitext
22904 {|
22905
22906 |foo!!bar
22907 |}
22908 !! end
22909
22910 !! test
22911 Tables: 3a. Nested in th
22912 !! options
22913 parsoid=html2wt
22914 !! html/*
22915 <table>
22916
22917 <tr>
22918 <th>foo!bar
22919 </th></tr></table>
22920
22921 !! wikitext
22922 {|
22923
22924 !foo!bar
22925 |}
22926 !! end
22927
22928 !! test
22929 Tables: 3b. Nested in th
22930 !! options
22931 parsoid=html2wt
22932 !! html/parsoid
22933 <table><tbody>
22934 <tr><th>foo!!bar</th>
22935 <th><i>foo|bar</i></th>
22936 <th><i>foo!!bar</i></th>
22937 <th><i><span>foo!!bar</span></i></th>
22938 </tr></tbody></table>
22939 !! wikitext
22940 {|
22941 !<nowiki>foo!!bar</nowiki>
22942 !''<nowiki>foo|bar</nowiki>''
22943 !''<nowiki>foo!!bar</nowiki>''
22944 !''<span><nowiki>foo!!bar</nowiki></span>''
22945 |}
22946 !! html/php
22947 <table>
22948 <tr>
22949 <th>foo!!bar
22950 </th>
22951 <th><i>foo|bar</i>
22952 </th>
22953 <th><i>foo!!bar</i>
22954 </th>
22955 <th><i><span>foo!!bar</span></i>
22956 </th></tr></table>
22957
22958 !! end
22959
22960 !! test
22961 Tables: 3c. Nested in th
22962 !! options
22963 parsoid=html2wt
22964 !! html/parsoid
22965 <table><tbody>
22966 <tr><th>foo||bar</th>
22967 <th><span typeof="mw:Nowiki">foo||bar</span></th>
22968 </tr></tbody></table>
22969 !! wikitext
22970 {|
22971 !<nowiki>foo||bar</nowiki>
22972 !<nowiki>foo||bar</nowiki>
22973 |}
22974 !! html/php
22975 <table>
22976 <tr>
22977 <th>foo||bar
22978 </th>
22979 <th>foo||bar
22980 </th></tr></table>
22981
22982 !! end
22983
22984 !! test
22985 Tables: 4a. Escape -
22986 !! options
22987 parsoid=html2wt
22988 !! html/*
22989 <table>
22990
22991 <tr>
22992 <th>-bar
22993 </th></tr>
22994 <tr>
22995 <td>-bar
22996 </td></tr></table>
22997
22998 !! wikitext
22999 {|
23000
23001 !-bar
23002
23003 |-
23004 |<nowiki>-bar</nowiki>
23005 |}
23006 !! end
23007
23008 !! test
23009 Tables: 4b. Escape +
23010 !! options
23011 parsoid=html2wt
23012 !! html/*
23013 <table>
23014
23015 <tr>
23016 <th>+bar
23017 </th></tr>
23018 <tr>
23019 <td>+bar
23020 </td></tr></table>
23021
23022 !! wikitext
23023 {|
23024
23025 !+bar
23026
23027 |-
23028 |<nowiki>+bar</nowiki>
23029 |}
23030 !! end
23031
23032 !! test
23033 Tables: 4c. No escaping needed
23034 !! options
23035 parsoid=html2wt
23036 !! html/parsoid
23037 <table><tbody>
23038 <tr><td>foo-bar</td><td>foo+bar</td></tr>
23039 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
23040 <tr><td>foo
23041 <p>bar|baz
23042 +bar
23043 -bar</p></td></tr>
23044 <tr><td>x
23045 <div>a|b</div></td>
23046 </tbody></table>
23047 !! wikitext
23048 {|
23049 |foo-bar
23050 |foo+bar
23051 |-
23052 |''foo''-bar
23053 |''foo''+bar
23054 |-
23055 |foo
23056 bar|baz
23057 +bar
23058 -bar
23059 |-
23060 |x
23061 <div>a|b</div>
23062 |}
23063 !! html/php
23064 <table>
23065 <tr>
23066 <td>foo-bar
23067 </td>
23068 <td>foo+bar
23069 </td></tr>
23070 <tr>
23071 <td><i>foo</i>-bar
23072 </td>
23073 <td><i>foo</i>+bar
23074 </td></tr>
23075 <tr>
23076 <td>foo
23077 <p>bar|baz
23078 +bar
23079 -bar
23080 </p>
23081 </td></tr>
23082 <tr>
23083 <td>x
23084 <div>a|b</div>
23085 </td></tr></table>
23086
23087 !! end
23088
23089 !! test
23090 Tables: 4d. No escaping needed
23091 !! options
23092 parsoid=html2wt
23093 !! html/parsoid
23094 <table>
23095 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
23096 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
23097 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
23098 </tbody></table>
23099 !! wikitext
23100 {|
23101 |[[Foo]]-bar
23102 ||+1
23103 ||-2
23104 |}
23105 !! html/php
23106 <table>
23107 <tr>
23108 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
23109 </td>
23110 <td>+1
23111 </td>
23112 <td>-2
23113 </td></tr></table>
23114
23115 !! end
23116
23117 !! test
23118 T97430: Don't emit empty nowiki pairs around marker meta tags
23119 !! options
23120 parsoid=html2wt
23121 !! html/parsoid
23122 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
23123 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
23124 !! wikitext
23125 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
23126 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
23127 !! end
23128
23129 !! test
23130 Unclosed xmlish element in table line shouldn't eat end delimiters
23131 !! options
23132 parsoid=html2wt
23133 !! html/parsoid
23134 <table>
23135 <tbody><tr><td> &lt;foo</td>
23136 <td> bar></td></tr>
23137 </tbody></table>
23138 !! wikitext
23139 {|
23140 | <foo
23141 | bar>
23142 |}
23143 !! html/php
23144 <table>
23145 <tr>
23146 <td> &lt;foo
23147 </td>
23148 <td> bar&gt;
23149 </td></tr></table>
23150
23151 !! end
23152
23153 #### --------------- Links ----------------
23154 #### 1. Quote marks in link text
23155 #### 2. Wikilinks: Escapes needed
23156 #### 3. Wikilinks: No escapes needed
23157 #### 4. Extlinks: Escapes needed
23158 #### 5. Extlinks: No escapes needed
23159 #### --------------------------------------
23160 !! test
23161 Links 1. WikiLinks: No escapes needed
23162 !! options
23163 parsoid=html2wt
23164 !! html/parsoid
23165 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
23166 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
23167 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
23168 !! wikitext
23169 [[Foo|Foo''boo'']]
23170 [[Foo|[Foobar]]]
23171 [[Foo|x [Foobar] x]]
23172 !! html/php
23173 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
23174 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
23175 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
23176 </p>
23177 !! end
23178
23179 !! test
23180 Links 2. WikiLinks: Escapes needed
23181 !! options
23182 parsoid=html2wt
23183 !! html/parsoid
23184 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
23185 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
23186 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
23187 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
23188 <a href="Foo" rel="mw:WikiLink">|Bar</a>
23189 <a href="Foo" rel="mw:WikiLink">]]bar</a>
23190 <a href="Foo" rel="mw:WikiLink">[[bar</a>
23191 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
23192 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
23193 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
23194 !! wikitext
23195 [[Foo|<nowiki>Foobar]</nowiki>]]
23196 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
23197 [[Foo|<nowiki>[[Bar]]</nowiki>]]
23198 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
23199 [[Foo|<nowiki>|Bar</nowiki>]]
23200 [[Foo|<nowiki>]]bar</nowiki>]]
23201 [[Foo|<nowiki>[[bar</nowiki>]]
23202 [[Foo|<nowiki>x [[ y</nowiki>]]
23203 [[Foo|<nowiki>x ]] y</nowiki>]]
23204 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
23205 !! html/php
23206 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
23207 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
23208 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
23209 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
23210 <a href="/wiki/Foo" title="Foo">|Bar</a>
23211 <a href="/wiki/Foo" title="Foo">]]bar</a>
23212 <a href="/wiki/Foo" title="Foo">[[bar</a>
23213 <a href="/wiki/Foo" title="Foo">x [[ y</a>
23214 <a href="/wiki/Foo" title="Foo">x ]] y</a>
23215 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
23216 </p>
23217 !! end
23218
23219 !! test
23220 Links 3. WikiLinks: No escapes needed
23221 !! options
23222 parsoid=html2wt
23223 !! html/parsoid
23224 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
23225 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
23226 !! wikitext
23227 [[Foo|[Foobar]]
23228 [[Foo|foo|bar]]
23229 !! html/php
23230 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
23231 <a href="/wiki/Foo" title="Foo">foo|bar</a>
23232 </p>
23233 !! end
23234
23235 !! test
23236 Links 4. ExtLinks: Escapes needed
23237 !! options
23238 parsoid=html2wt
23239 !! html/parsoid
23240 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
23241 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
23242 <p>[http://google.com]</p>
23243 <p>[http://google.com google]</p>
23244 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
23245 <p>[<a rel="mw:ExtLink" href="http://google.com" about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"http://google.com"}},"i":0}}]}'>http://google.com</a>]</p>
23246 !! wikitext
23247 [http://google.com <nowiki>[google]</nowiki>]
23248 [http://google.com <nowiki>google]</nowiki>]
23249
23250 <nowiki>[http://google.com]</nowiki>
23251
23252 <nowiki>[http://google.com google]</nowiki>
23253
23254 [http://google.com<nowiki>]</nowiki>
23255
23256 [{{echo|http://google.com}}<nowiki>]</nowiki>
23257 !! html/php
23258 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
23259 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
23260 </p><p>[http://google.com]
23261 </p><p>[http://google.com google]
23262 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
23263 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
23264 </p>
23265 !! end
23266
23267 !! test
23268 Links 5. ExtLinks: No escapes needed
23269 !! options
23270 parsoid=html2wt
23271 !! html/parsoid
23272 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
23273 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
23274 !! wikitext
23275 [http://google.com [google]
23276
23277 [[http://google.com]]
23278 !! html/php
23279 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
23280 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
23281 </p>
23282 !! end
23283
23284 !! test
23285 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
23286 !! options
23287 parsoid=html2wt
23288 !! html/parsoid
23289 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
23290 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
23291 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
23292 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
23293 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
23294 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
23295 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
23296 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
23297 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
23298 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
23299 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
23300 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
23301 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
23302 </p>
23303 !! wikitext
23304 x<nowiki/>http://example.com<nowiki/>y
23305 http://example.com<nowiki/>?x
23306 http://example.com<nowiki/>&x
23307 http://example.com<nowiki/>'x
23308 http://example.com<nowiki/>,x
23309 http://example.com<nowiki/>.x
23310 http://example.com<nowiki/>;x
23311 http://example.com<nowiki/>:x
23312 http://example.com<nowiki/>;x
23313 http://example.com<nowiki/>!x
23314 http://example.com<nowiki/>=x
23315 http://example.com<nowiki/>(x)
23316 http://example.com(x<nowiki/>)
23317 !! end
23318
23319 !! test
23320 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
23321 !! options
23322 parsoid=html2wt
23323 !! html/parsoid
23324 <p>x
23325 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
23326 y
23327 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
23328 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
23329 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
23330 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
23331 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
23332 </p>
23333 !! wikitext
23334 x
23335 http://example.com
23336 y
23337 "http://example.com"
23338 (http://example.com)
23339 (http://example.com) foo
23340 http://example.com,
23341 http://example.com, foo
23342 !! html/php
23343 <p>x
23344 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
23345 y
23346 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
23347 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
23348 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
23349 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
23350 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
23351 </p>
23352 !! end
23353
23354 !! test
23355 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
23356 !! options
23357 parsoid=html2wt
23358 !! html/parsoid
23359 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
23360 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
23361 !! wikitext
23362 http://example.com.,;:!?\
23363 -http://example.com:
23364 !! html/php
23365 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
23366 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
23367 </p>
23368 !! end
23369
23370 !! test
23371 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
23372 !! options
23373 parsoid=html2wt
23374 !! html/parsoid
23375 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
23376 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
23377 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
23378 !! wikitext
23379 RFC 123<nowiki/>4
23380 RFC 123<nowiki/>y
23381 X<nowiki/>RFC 123<nowiki/>y
23382 !! end
23383
23384 !! test
23385 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
23386 !! options
23387 parsoid=html2wt
23388 !! html/parsoid
23389 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
23390 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
23391 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
23392 </p>
23393 !! wikitext
23394 RFC 123?foo
23395 RFC 123&foo
23396 -RFC 123-
23397 !! html/php
23398 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
23399 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
23400 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
23401 </p>
23402 !! end
23403
23404 !! test
23405 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
23406 !! options
23407 parsoid=html2wt
23408 !! html/parsoid
23409 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
23410 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
23411 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
23412 !! wikitext
23413 PMID 123<nowiki/>4
23414 PMID 123<nowiki/>y
23415 X<nowiki/>PMID 123<nowiki/>y
23416 !! end
23417
23418 !! test
23419 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
23420 !! options
23421 parsoid=html2wt
23422 !! html/parsoid
23423 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
23424 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
23425 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
23426 </p>
23427 !! wikitext
23428 PMID 123?foo
23429 PMID 123&foo
23430 -PMID 123-
23431 !! html/php
23432 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
23433 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
23434 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
23435 </p>
23436 !! end
23437
23438 !! test
23439 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
23440 !! options
23441 parsoid=html2wt
23442 !! html/parsoid
23443 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
23444 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
23445 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
23446 </p>
23447 !! wikitext
23448 ISBN 1234567890<nowiki/>1
23449 ISBN 1234567890<nowiki/>x
23450 a<nowiki/>ISBN 1234567890<nowiki/>b
23451 !! end
23452
23453 !! test
23454 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
23455 !! options
23456 parsoid=html2wt
23457 !! html/parsoid
23458 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
23459 !! wikitext
23460 -ISBN 1234567890's
23461 !! html/php
23462 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
23463 </p>
23464 !! end
23465
23466 !! test
23467 Links 14. Protect link-like plain text. (Parsoid bug T78425)
23468 !! options
23469 parsoid=html2wt
23470 !! html/*
23471 <p>this is not a link: http://example.com
23472 </p>
23473 !! wikitext
23474 this is not a link: <nowiki>http://example.com</nowiki>
23475 !! end
23476
23477 !! test
23478 Links 15. Link trails can't become link prefixes.
23479 !! options
23480 language=is
23481 parsoid=html2wt
23482 !! html/parsoid
23483 <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>
23484 !! wikitext
23485 [[Söfnuður]]-[[00]]
23486 !! html/php
23487 <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>
23488 </p>
23489 !! end
23490
23491 #### --------------- Quotes ---------------
23492 #### 1. Quotes inside <b> and <i>
23493 #### 2. Link fragments separated by <i> and <b> tags
23494 #### 3. Link fragments inside <i> and <b>
23495 #### 4. No escaping needed
23496 #### --------------------------------------
23497 !! test
23498 1a. Quotes inside <b> and <i>
23499 !! options
23500 parsoid=html2wt
23501 !! html/*
23502 <p><i>'foo'</i>
23503 <i>''foo''</i>
23504 <i>'''foo'''</i>
23505 <i>foo</i>'s
23506 <b>'foo'</b>
23507 <b>''foo''</b>
23508 <b>'''foo'''</b>
23509 <b>foo'<i>bar'</i>baz</b>
23510 <b>foo</b>'s
23511 '<i>foo</i>
23512 <i>foo</i>'
23513 <i>foo'</i>'
23514 '<i>foo</i>'
23515 '<b>foo</b>
23516 <b>foo</b>'
23517 '<b>foo</b>'
23518 <i>fools'<span> errand</span></i>
23519 <i><span>fool</span>'s errand</i>
23520 '<i>foo</i> bar '<i>baz</i>
23521 a|!*#-:;+-~[]{}b'<i>x</i>
23522 </p>
23523 !! wikitext
23524 ''<nowiki/>'foo'''
23525 ''<nowiki>''foo''</nowiki>''
23526 ''<nowiki>'''foo'''</nowiki>''
23527 ''foo''<nowiki/>'s
23528 '''<nowiki/>'foo''''
23529 '''<nowiki>''foo''</nowiki>'''
23530 '''<nowiki>'''foo'''</nowiki>'''
23531 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
23532 '''foo'''<nowiki/>'s
23533 '''foo''
23534 ''foo''<nowiki/>'
23535 ''foo'''<nowiki/>'
23536 '''foo''<nowiki/>'
23537 ''''foo'''
23538 '''foo'''<nowiki/>'
23539 ''''foo'''<nowiki/>'
23540 ''fools'<span> errand</span>''
23541 ''<span>fool</span>'s errand''
23542 '<nowiki/>''foo'' bar '''baz''
23543 a|!*#-:;+-~[]{}b'''x''
23544 !! end
23545
23546 !! test
23547 1b. Quotes inside <b> and <i> with other tags on same line
23548 !! options
23549 parsoid=html2wt
23550 !! html/parsoid
23551 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
23552 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
23553 <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>
23554 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
23555 '<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>
23556 '<i>foo</i> <div title="name">test</div>
23557 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
23558 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
23559 <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>
23560 </ol>
23561 !! wikitext
23562 '''a'' foo ''[[bar]]''
23563 ''a''' foo ''[[bar]]''
23564 ''a''' foo '''{{echo|[[bar]]}}'''
23565 [[foo]] x'''[[bar]]''
23566 '''foo'' <ref>test</ref>
23567 '''foo'' <div title="name">test</div>
23568 '''foo'' and <br> bar
23569 <references />
23570 !! end
23571
23572 !! test
23573 2. Link fragments separated by <i> and <b> tags
23574 !! options
23575 parsoid=html2wt
23576 !! html/parsoid
23577 <p>[[<i>foo</i>hello]]</p>
23578 <p>[[<b>foo</b>hello]]</p>
23579 !! wikitext
23580 [[''foo''<nowiki>hello]]</nowiki>
23581
23582 [['''foo'''<nowiki>hello]]</nowiki>
23583 !! end
23584
23585 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
23586 # this is one of the shortcomings of this format
23587 !! test
23588 3. Link fragments inside <i> and <b>
23589 !! options
23590 parsoid=html2wt
23591 !! html/parsoid
23592 <p><i>[[foo</i>]]</p>
23593 <p><b>[[foo</b>]]</p>
23594 !! wikitext
23595 ''[[foo''<nowiki>]]</nowiki>
23596
23597 '''[[foo'''<nowiki>]]</nowiki>
23598 !! end
23599
23600 !! test
23601 4. No escaping needed
23602 !! options
23603 options=html2wt
23604 !! html/parsoid
23605 <p>'<span><i>bar</i></span>'
23606 '<span><b>bar</b></span>'
23607 'a:b'foo
23608 </p>
23609 !! wikitext
23610 '<span>''bar''</span>'
23611 '<span>'''bar'''</span>'
23612 'a:b'foo
23613 !! end
23614
23615 #### ----------- Paragraphs ---------------
23616 #### 1. No unnecessary escapes
23617 #### --------------------------------------
23618
23619 !! test
23620 1. No unnecessary escapes
23621 !! options
23622 parsoid=html2wt
23623 !! html/parsoid
23624 <p>bar <span>[[foo]]</span>
23625 </p><p>=bar <span>[[foo]]</span>
23626 </p><p>[[bar <span>[[foo]]</span>
23627 </p><p>]]bar <span>[[foo]]</span>
23628 </p><p>=bar <span>foo]]</span>=
23629 </p>
23630 !! wikitext
23631 bar <span><nowiki>[[foo]]</nowiki></span>
23632
23633 =bar <span><nowiki>[[foo]]</nowiki></span>
23634
23635 [[bar <span><nowiki>[[foo]]</nowiki></span>
23636
23637 ]]bar <span><nowiki>[[foo]]</nowiki></span>
23638
23639 =bar <span>foo]]</span><nowiki>=</nowiki>
23640 !!end
23641
23642 #### ----------------------- PRE --------------------------
23643 #### 1. Leading whitespace in SOL context should be escaped
23644 #### ------------------------------------------------------
23645 !! test
23646 1. Leading whitespace in SOL context should be escaped
23647 !! options
23648 parsoid=html2wt
23649 !! html/parsoid
23650 <p> a</p>
23651
23652 <p> a</p>
23653
23654 <p> a(tab)</p>
23655
23656 <p> a
23657 <!--cmt-->
23658 a</p>
23659
23660 <p>a
23661 b</p>
23662
23663 <p>a
23664 b</p>
23665
23666 <p>a
23667 b</p>
23668 !! wikitext
23669 <nowiki> </nowiki>a
23670
23671 <nowiki> </nowiki> a
23672
23673 a(tab)
23674
23675 <nowiki> </nowiki> a
23676 <!--cmt-->
23677 <nowiki> </nowiki>a
23678
23679 a
23680 <nowiki> </nowiki>b
23681
23682 a
23683 b
23684
23685 a
23686 b
23687 !! html/php
23688 <p> a
23689 </p><p> a
23690 </p><p> a(tab)
23691 </p><p> a
23692 a
23693 </p><p>a
23694 b
23695 </p><p>a
23696 b
23697 </p><p>a
23698 b
23699 </p>
23700 !! end
23701
23702 !! test
23703 2. Leading whitespace in non-indent-pre contexts should not be escaped
23704 !! options
23705 parsoid=htm2wt
23706 !! html/parsoid
23707 <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>
23708 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
23709 <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>
23710 b</span></li>
23711 </ol>
23712 !! wikitext
23713 foo <ref>''a''
23714 b</ref>
23715 <references />
23716 !! end
23717
23718 !! test
23719 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
23720 !! options
23721 parsoid=html2wt
23722 !! html/parsoid
23723 <blockquote>
23724 <p>
23725 a
23726 <span>b</span>
23727 c</p>
23728 </blockquote>
23729 !! wikitext
23730 <blockquote>
23731 a
23732 <span>b</span>
23733 c
23734 </blockquote>
23735 !! end
23736
23737 !! test
23738 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
23739 !! options
23740 options=html2wt
23741 !! html/parsoid
23742 <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>
23743 !! wikitext
23744 [[File:Foobar.jpg|thumb|caption]]
23745 !! end
23746
23747 !! test
23748 5. Nowiki escaping should account for indent-pres
23749 !! options
23750 parsoid=html2wt
23751 !! html/parsoid
23752 <pre>==foo==</pre>
23753 !! wikitext
23754 ==foo==
23755 !! end
23756
23757 !!test
23758 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
23759 !! options
23760 parsoid=html2wt
23761 !! html/parsoid
23762 <pre>
23763 * foo
23764 * bar
23765 </pre>
23766 !! wikitext
23767 * foo
23768 * bar
23769 !! end
23770
23771 #### --------------- Behavior Switches --------------------
23772
23773 !! test
23774 1. Valid behavior switches should be escaped
23775 !! options
23776 parsoid=html2wt
23777 !! html/parsoid
23778 __TOC__
23779 <i>__TOC__</i>
23780 !! wikitext
23781 <nowiki>__TOC__</nowiki>
23782 ''<nowiki>__TOC__</nowiki>''
23783 !! end
23784
23785 !! test
23786 2. Invalid behavior switches should not be escaped
23787 !! options
23788 parsoid=html2wt
23789 !! html/parsoid
23790 __TOO__
23791 __|__
23792 !! wikitext
23793 __TOO__
23794 __|__
23795 !! end
23796
23797 # We use indent-pre as an indirect way to test for sol-transparent behavior.
23798 !! test
23799 Behavior switches should be SOL-transparent
23800 !! options
23801 parsoid=html2wt
23802 !! html/parsoid
23803 <meta property="mw:PageProp/toc" />
23804
23805 <!-- this one's bogus -->
23806 <pre>__TOO__</pre>
23807
23808 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
23809
23810 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
23811 !! wikitext
23812 __TOC__
23813
23814 <!-- this one's bogus -->
23815 __TOO__
23816
23817 __TOC__ foo
23818
23819 __TOC__
23820 bar
23821 !! end
23822
23823 #### --------------- HTML tags ---------------
23824 #### 1. a tags
23825 #### 2. other tags
23826 #### 3. multi-line html tag
23827 #### 4. extension tags
23828 #### -----------------------------------------
23829 !! test
23830 1. a tags
23831 !! options
23832 parsoid=html2wt
23833 !! html/parsoid
23834 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
23835 !! wikitext
23836 <a href="http://google.com">google</a>
23837 !! end
23838
23839 !! test
23840 2. other tags
23841 !! options
23842 parsoid=html2wt
23843 !! html/parsoid
23844 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
23845 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
23846 <li> &lt;td&gt;</li></ul>
23847
23848 !! wikitext
23849 * <nowiki><div>foo</div></nowiki>
23850 * <nowiki><div style="color:red">foo</div></nowiki>
23851 * <nowiki><td></nowiki>
23852 !! end
23853
23854 !! test
23855 3. multi-line html tag
23856 !! options
23857 parsoid=html2wt
23858 !! html/parsoid
23859 <p>&lt;div
23860 &gt;foo&lt;/div
23861 &gt;
23862 </p>
23863 !! wikitext
23864 <nowiki><div
23865 >foo</div
23866 ></nowiki>
23867 !! end
23868
23869 !! test
23870 4. extension tags
23871 !! options
23872 parsoid=html2wt
23873 !! html/parsoid
23874 <p>&lt;ref&gt;foo&lt;/ref&gt;
23875 </p><p>&lt;ref&gt;bar
23876 </p><p>baz&lt;/ref&gt;
23877 </p>
23878 !! wikitext
23879 <nowiki><ref>foo</ref></nowiki>
23880
23881 <nowiki><ref>bar</nowiki>
23882
23883 baz<nowiki></ref></nowiki>
23884 !! end
23885
23886 #### --------------- Others ---------------
23887 !! test
23888 Escaping nowikis
23889 !! options
23890 parsoid=html2wt
23891 !! html/parsoid
23892 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
23893 </p>
23894 !! wikitext
23895 &lt;nowiki&gt;foo&lt;/nowiki&gt;
23896 !! end
23897
23898 ## The quote-char in the input is necessary for triggering the bug
23899 !! test
23900 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
23901 !! options
23902 parsoid=html2wt
23903 !! html/parsoid
23904 <p>foo's bar :</p>
23905 !! wikitext
23906 foo's bar :
23907 !! end
23908
23909 #----------- End of wikitext escaping tests --------------
23910
23911 !! test
23912
23913 Tag-like HTML structures are passed through as text
23914 !! wikitext
23915 <x y>
23916
23917 <x.y>
23918
23919 <x-y>
23920
23921 1>2
23922
23923 x<y
23924
23925 a>b
23926
23927 1<d e>f
23928 !! html
23929 <p>&lt;x y&gt;
23930 </p><p>&lt;x.y&gt;
23931 </p><p>&lt;x-y&gt;
23932 </p><p>1&gt;2
23933 </p><p>x&lt;y
23934 </p><p>a&gt;b
23935 </p><p>1&lt;d e&gt;f
23936 </p>
23937 !! end
23938
23939 !! test
23940 HTML tag with necessary entities in attributes
23941 !! wikitext
23942 <span title="&amp;amp;">foo</span>
23943 !! html
23944 <p><span title="&amp;amp;">foo</span>
23945 </p>
23946 !! end
23947
23948 !! test
23949 HTML tag with 'unnecessary' entity encoding in attributes
23950 !! wikitext
23951 <span title="&amp;">foo</span>
23952 !! html
23953 <p><span title="&amp;">foo</span>
23954 </p>
23955 !! end
23956
23957 !! test
23958 HTML tag with broken attribute value quoting
23959 !! options
23960 parsoid=wt2html,html2html
23961 !! wikitext
23962 <span title="Hello world>Foo</span>
23963 !! html/php
23964 <p><span title="Hello world">Foo</span>
23965 </p>
23966 !! html/parsoid
23967 <p><span title="Hello world">Foo</span></p>
23968 !! end
23969
23970 !! test
23971 Self-closed tag with broken attribute value quoting
23972 !! options
23973 parsoid=wt2html,html2html
23974 !! wikitext
23975 <div title="Hello world />Foo
23976 !! html/php+tidy
23977 <div title="Hello world"></div>
23978 <p>Foo</p>
23979 !! html/parsoid
23980 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
23981 !! end
23982
23983 !! test
23984 Table with broken attribute value quoting
23985 !! options
23986 parsoid=wt2html,html2html
23987 !! wikitext
23988 {|
23989 | title="Hello world|Foo
23990 |}
23991 !! html/php
23992 <table>
23993 <tr>
23994 <td title="Hello world">Foo
23995 </td></tr></table>
23996
23997 !! html/parsoid
23998 <table>
23999 <tr>
24000 <td title="Hello world">Foo
24001 </td></tr></table>
24002
24003 !! end
24004
24005 !! test
24006 Table with broken attribute value quoting on consecutive lines
24007 !! options
24008 parsoid=wt2html,html2html
24009 !! wikitext
24010 {|
24011 | title="Hello world|Foo
24012 | style="color:red|Bar
24013 |}
24014 !! html/php
24015 <table>
24016 <tr>
24017 <td title="Hello world">Foo
24018 </td>
24019 <td style="color:red">Bar
24020 </td></tr></table>
24021
24022 !! html/parsoid
24023 <table><tbody>
24024 <tr>
24025 <td title="Hello world">Foo
24026 </td><td style="color: red">Bar
24027 </td></tr></tbody></table>
24028
24029 !! end
24030
24031 !! test
24032 2. Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
24033 !! options
24034 parsoid
24035 !! wikitext
24036 {{}}
24037 !! html
24038 {{}}
24039 !! end
24040
24041 !! test
24042 1. Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
24043 !! options
24044 parsoid
24045 !! wikitext
24046 }}{{
24047 !! html
24048 }}{{
24049 !! end
24050
24051 !!test
24052 Accept empty td cell attribute
24053 !! wikitext
24054 {|
24055 | align="center" | foo || |
24056 |}
24057 !! html
24058 <table>
24059 <tr>
24060 <td align="center"> foo </td>
24061 <td>
24062 </td></tr></table>
24063
24064 !!end
24065
24066 !!test
24067 Non-empty attributes in th-cells
24068 !! wikitext
24069 {|
24070 ! Foo !! style="color: red" | Bar
24071 |}
24072 !! html
24073 <table>
24074 <tr>
24075 <th> Foo </th>
24076 <th style="color: red"> Bar
24077 </th></tr></table>
24078
24079 !!end
24080
24081 !!test
24082 Accept empty attributes in th-cells
24083 !! wikitext
24084 {|
24085 !| foo !!| bar
24086 |}
24087 !! html
24088 <table>
24089 <tr>
24090 <th> foo </th>
24091 <th> bar
24092 </th></tr></table>
24093
24094 !!end
24095
24096 !!test
24097 Empty table rows go away
24098 !! wikitext
24099 {|
24100 | Hello
24101 | there
24102 |- class="foo"
24103 |-
24104 |}
24105 !! html
24106 <table>
24107 <tr>
24108 <td> Hello
24109 </td>
24110 <td> there
24111 </td></tr>
24112
24113 </table>
24114
24115 !! end
24116
24117 ###
24118 ### Parsoid-centric tests for testing RTing of inter-element separators
24119 ### Edge cases not tested by existing parser tests and specific to
24120 ### Parsoid-specific serialization strategies.
24121 ###
24122
24123 !!test
24124 RT-ed inter-element separators should be valid separators
24125 !! wikitext
24126 {|
24127 |- [[foo]]
24128 |}
24129 !! html/php
24130 <table>
24131
24132 </table>
24133
24134 !! html/parsoid
24135 <table>
24136 <tbody><tr data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
24137 </tbody></table>
24138 !!end
24139
24140 # Parsoid-only since PHP parser relies on Tidy for correct output
24141 !!test
24142 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
24143 !!options
24144 parsoid
24145 !! wikitext
24146 {|
24147 |<small>foo
24148 bar
24149 |}
24150
24151 {|
24152 |<small>foo<small>
24153 |}
24154 !! html
24155 <table>
24156 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
24157 <p>bar</p></small></td></tr>
24158 </tbody></table>
24159
24160 <table>
24161 <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>
24162 </tbody></table>
24163 !!end
24164
24165 # Note that the "style" attribute is really a template parameter here.
24166 # The = would have to be {{=}} if you wanted the literal.
24167 !!test
24168 Empty TD followed by TD with tpl-generated attribute
24169 !! wikitext
24170 {|
24171 |-
24172 |
24173 |{{echo|style='color:red'}}|foo
24174 |}
24175 !! html
24176 <table>
24177
24178 <tr>
24179 <td>
24180 </td>
24181 <td>foo
24182 </td></tr></table>
24183
24184 !!end
24185
24186 !!test
24187 Indented table with an empty td
24188 !! wikitext
24189 {|
24190 |-
24191 |
24192 |foo
24193 |}
24194 !! html
24195 <table>
24196
24197 <tr>
24198 <td>
24199 </td>
24200 <td>foo
24201 </td></tr></table>
24202
24203 !!end
24204
24205 ## We have some newline diffs RT-ing this edge case
24206 ## and it is not important enough -- we seem to be emitting
24207 ## at most 2 newlines after a </tr> and this is unrelated to
24208 ## the issue from T85627 that this is testing.
24209 !!test
24210 Indented table with blank lines in between (T85627)
24211 !! options
24212 parsoid=wt2html
24213 !! wikitext
24214 {|
24215 |foo
24216
24217
24218 |}
24219 !! html
24220 <table>
24221
24222 <tr>
24223 <td>foo
24224 </td></tr></table>
24225
24226 !!end
24227
24228 !!test
24229 Indented block & table
24230 !! wikitext
24231 <div>foo</div>
24232 {|
24233 |foo
24234 |}
24235 !! html/php
24236 <div>foo</div>
24237 <table>
24238 <tr>
24239 <td>foo
24240 </td></tr></table>
24241
24242 !! html/parsoid
24243 <div data-parsoid='{"stx":"html"}'>foo</div>
24244 <table><tbody>
24245 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
24246 </tbody></table>
24247 !!end
24248
24249 !! test
24250 Indent and comment before table row
24251 !! wikitext
24252 {|
24253 <!--hi-->|-
24254 | there
24255 |}
24256 !! html/php
24257 <table>
24258
24259 <tr>
24260 <td> there
24261 </td></tr></table>
24262
24263 !! html/parsoid
24264 <table>
24265 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
24266 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
24267 </tbody></table>
24268 !! end
24269
24270 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
24271 !!test
24272 Empty TR followed by a template-generated TR
24273 !!options
24274 parsoid
24275 !! wikitext
24276 {|
24277 |-
24278 {{echo|<tr><td>foo</td></tr>}}
24279 |}
24280 !! html
24281 <table>
24282 <tbody>
24283 <tr></tr>
24284 <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}}]}'>
24285 <td>foo</td></tr>
24286 </tbody></table>
24287 !!end
24288
24289 ## PHP and parsoid output differ for this, and since this is primarily
24290 ## for testing Parsoid's serializer, marking this Parsoid only
24291 !!test
24292 Empty TR followed by mixed-ws-comment line should RT correctly
24293 !!options
24294 parsoid
24295 !! wikitext
24296 {|
24297 |-
24298 <!--c-->
24299 |-
24300 <!--c--> <!--d-->
24301 |}
24302 !! html
24303 <table>
24304 <tbody>
24305 <tr></tr>
24306 <!--c-->
24307 <tr>
24308 <!--c--> </tr><!--d-->
24309 </tbody></table>
24310
24311 !!end
24312
24313 !!test
24314 Multi-line image caption generated by templates with/without trailing newlines
24315 !! wikitext
24316 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
24317 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
24318 !! html/parsoid
24319 <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>
24320 <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>
24321 !!end
24322
24323 !! test
24324 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
24325 !! options
24326 parsoid=html2wt
24327 !! html/parsoid
24328 <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>
24329
24330 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
24331 !! wikitext
24332 <includeonly>foo</includeonly>
24333 new para
24334
24335 [[Category:Foo]]
24336
24337 = new heading =
24338 !! end
24339
24340 ## PHP emits broken html for this, and since this is primarily
24341 ## a Parsoid serializer test, marking this Parsoid only
24342 !!test
24343 Improperly nested inline or quotes tags with whitespace in between
24344 !! wikitext
24345 <span> <s>x</span> </s>
24346 ''' ''x''' ''
24347 !! html/parsoid
24348 <p><span> <s>x</s></span><s> </s>
24349 <b> <i>x</i></b><i> </i>
24350 </p>
24351 !!end
24352
24353 !!test
24354 Encapsulate protected attributes from wt
24355 !! wikitext
24356 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
24357 !! html/parsoid
24358 <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>
24359 </body>
24360 !!end
24361
24362 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
24363 ## Having nested or stray pre tags results in the attempt to add duplicates,
24364 ## causing an assertion fail. This test tries to prevent that situation.
24365 !!test
24366 Ensure ParagraphWrapper can deal with stray closing pre tags
24367 !!options
24368 parsoid=wt2html
24369 !! wikitext
24370 plain text</pre>
24371 !! html/parsoid
24372 plain text
24373 !!end
24374
24375 !!test
24376 1. Ensure fostered text content is wrapped in element nodes
24377 !!options
24378 parsoid=wt2html
24379 !! wikitext
24380 <table>hi</table><table>ho</table>
24381 !! html/parsoid
24382 <p>hi</p>
24383 <table></table>
24384 <p>ho</p>
24385 <table></table>
24386 !!end
24387
24388 !!test
24389 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
24390 !!options
24391 parsoid=wt2html,wt2wt
24392 !! wikitext
24393 <table>
24394 <tr> || ||
24395 <td> a
24396 </table>
24397 !! html/parsoid
24398 <p> || ||
24399 </p><table>
24400 <tbody><tr><td> a</td></tr>
24401 </tbody></table>
24402 !!end
24403
24404 !!test
24405 Encapsulation properly handles null DSR information from foster box
24406 !!options
24407 parsoid=wt2html,wt2wt
24408 !! wikitext
24409 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
24410 !! html/parsoid
24411 <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>
24412 !!end
24413
24414 !!test
24415 1. Encapsulate foster-parented transclusion content
24416 !!options
24417 parsoid=wt2wt,wt2html
24418 !! wikitext
24419 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
24420 !! html/parsoid
24421 <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>
24422 <tbody>
24423 <tr>
24424 <td>bar</td>
24425 </tr>
24426 </tbody>
24427 </table>
24428 !!end
24429
24430 !!test
24431 2. Encapsulate foster-parented transclusion content
24432 !!options
24433 parsoid=wt2wt,wt2html
24434 !! wikitext
24435 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
24436 !! html/parsoid
24437 <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>
24438 <table>
24439 <tbody>
24440 <tr>
24441 <td>bar</td>
24442 </tr>
24443 </tbody>
24444 </table>
24445 !!end
24446
24447 !!test
24448 3. Encapsulate foster-parented transclusion content
24449 !!options
24450 parsoid=wt2wt,wt2html
24451 !! wikitext
24452 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
24453 !! html/parsoid
24454 <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;]}">
24455 <p>foo</p>
24456 </div>
24457 <table>
24458 <tbody>
24459 <tr>
24460 <td>bar</td>
24461 </tr>
24462 </tbody>
24463 </table>
24464 !!end
24465
24466 !!test
24467 4. Encapsulate foster-parented transclusion content
24468 !!options
24469 parsoid=wt2wt,wt2html
24470 !! wikitext
24471 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
24472 !! html/parsoid
24473 <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;]}">
24474 <p>foo</p>
24475 </div>
24476 <table>
24477 <tbody>
24478 <tr>
24479 <td>bar</td>
24480 </tr>
24481 </tbody>
24482 </table>
24483 !!end
24484
24485 !!test
24486 5. Encapsulate foster-parented transclusion content
24487 !!options
24488 parsoid=wt2wt,wt2html
24489 !! wikitext
24490 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
24491 !! html/parsoid
24492 <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>
24493 <table>
24494 <tbody>
24495 <tr>
24496 <td>
24497 <div>
24498 <p>foo</p>
24499 </div>
24500 </td>
24501 </tr>
24502 </tbody>
24503 </table>
24504 !!end
24505
24506 !!test
24507 6. Encapsulate foster-parented transclusion content
24508 !!options
24509 parsoid=wt2wt,wt2html
24510 !! wikitext
24511 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
24512 !! html/parsoid
24513 <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>
24514 <table>
24515 <tbody>
24516 <tr>
24517 <td>
24518 <div>
24519 <p>foo</p>
24520 </div>
24521 </td>
24522 </tr>
24523 </tbody>
24524 </table>
24525 <p>ok</p>
24526 !!end
24527
24528 !!test
24529 7. Encapsulate foster-parented transclusion content
24530 !!options
24531 parsoid=wt2wt,wt2html
24532 !! wikitext
24533 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
24534 !! html/parsoid
24535 <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>
24536 <table>
24537 <tbody>
24538 <tr>
24539 <td>bar</td>
24540 </tr>
24541 </tbody>
24542 </table>
24543 !!end
24544
24545 # Note that the wt is broken on purpose: the = should be {{=}} if you
24546 # don't want it to be a template parameter key.
24547 !!test
24548 8. Encapsulate foster-parented transclusion content
24549 !!options
24550 parsoid=wt2wt,wt2html
24551 !! wikitext
24552 {{echo|a
24553 }}{|{{echo|style='color:red'}}
24554 |-
24555 |b
24556 |}
24557 !! html/parsoid
24558 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
24559 <span> </span>
24560 <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>
24561 <table>
24562 <tbody>
24563 <tr>
24564 <td>b</td>
24565 </tr>
24566 </tbody>
24567 </table>
24568 !!end
24569
24570 !!test
24571 9. Encapsulate foster-parented transclusion content
24572 !!options
24573 parsoid=wt2wt,wt2html
24574 !! wikitext
24575 <table>{{echo|hi</table>hello}}
24576 !! html/parsoid
24577 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":["&lt;table>",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi&lt;/table>hello"}},"i":0}}]}' data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true,"pi":[[{"k":"1"}]]}'>hi</p><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><p about="#mwt2">hello</p>
24578 !!end
24579
24580 !!test
24581 Table in fosterable position
24582 !!options
24583 parsoid=wt2html
24584 !! wikitext
24585 {{OpenTable}}
24586 <div>
24587 {|
24588 |}
24589 </div>
24590 |}
24591 !! html/parsoid
24592 <div about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"OpenTable","href":"./Template:OpenTable"},"params":{},"i":0}},"\n&lt;div>\n"]}' data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[]]}'></div><span about="#mwt1">
24593 </span>
24594 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
24595
24596 <table>
24597 </table>
24598 !!end
24599
24600 # Parsoid only for bug 64747
24601 !! test
24602 Properly encapsulate empty-content transclusions in fosterable positions
24603 !! wikitext
24604 <table>
24605 {{#if:|
24606 <td>foo</td>
24607 }}
24608 </table>
24609 !! html/parsoid
24610 <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"}]]}'>
24611
24612 </table>
24613 !! end
24614
24615 !! test
24616 Always encapsulate foster box when template range is expanded to table
24617 !! options
24618 parsoid=wt2wt
24619 !! wikitext
24620 {|
24621 hello
24622 {{OpenTable}}
24623 |}
24624 !! html/parsoid
24625
24626 !! end
24627
24628 !! test
24629 T115289: Unclosed table
24630 !! wikitext
24631 {{echo|<table>}}<!--c-->[[Category:Two]]
24632 !! html/parsoid
24633 <link rel="mw:PageProp/Category" href="./Category:Two" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"simple","a":{"href":"./Category:Two"},"sa":{"href":"Category:Two"},"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;table>"}},"i":0}},"&lt;!--c-->[[Category:Two]]"]}'/><table about="#mwt1" data-parsoid='{"stx":"html","autoInsertedEnd":true}'><!--c--></table>
24634 !! end
24635
24636 !! test
24637 T115289: Don't migrate newlines out of tables with fostered content
24638 !! wikitext
24639 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
24640 !! html/parsoid
24641 <link rel="mw:PageProp/Category" href="./Category:One" about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"stx":"simple","a":{"href":"./Category:One"},"sa":{"href":"Category:One"},"fostered":true,"pi":[[{"k":"1"}]]}' data-mw='{"parts":["&lt;table>&lt;td>&lt;/td>",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;tr>[[Category:One]]"}},"i":0}},"&lt;!--c-->[[Category:Two]]"]}'/><link rel="mw:PageProp/Category" href="./Category:Two" about="#mwt2"/><table about="#mwt2" data-parsoid='{"stx":"html","autoInsertedEnd":true,"dsr":[0,53,7,0]}'><tbody><tr><td></td></tr><tr><!--c--></tr></tbody></table>
24642 !! end
24643
24644 !! test
24645 T73074: More fostering fun
24646 !! wikitext
24647 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
24648 !! html/parsoid
24649 <link rel="mw:PageProp/Category" href="./Category:Two" data-parsoid='{"stx":"simple","a":{"href":"./Category:Two"},"sa":{"href":"Category:Two"},"fostered":true}'/><table data-parsoid='{"stx":"html","autoInsertedEnd":true}'><tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"stx":"html"}'></td></tr><tr about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;tr>"}},"i":0}},"&lt;!--c-->[[Category:Two]]"]}'><!--c--></tr></tbody></table>
24650 !! end
24651
24652 !!test
24653 Support <object> element with .data attribute
24654 !!options
24655 parsoid=html2wt
24656 !! html/parsoid
24657 <object data="test.swf"></object>
24658 !! wikitext
24659 <object data="test.swf"></object>
24660 !!end
24661
24662 !! test
24663 Don't block XML namespace declaration
24664 !! wikitext
24665 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
24666 !! html/php
24667 <p><span>MediaWiki</span>
24668 </p>
24669 !! html/parsoid
24670 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
24671 !! end
24672
24673 # -----------------------------------------------------------------
24674 # The following section of tests are primarily to spec requirements
24675 # around serialization of new/edited content.
24676 #
24677 # All these tests are marked Parsoid html2wt and html2html only
24678 # ----------------------------------------------------------------
24679
24680 # 'mi' is a localinterwiki prefix as well as a language
24681 !! test
24682 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
24683 !! options
24684 parsoid=html2wt
24685 !! html/parsoid
24686 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
24687 !! wikitext
24688 [[Foo]]
24689 !! end
24690
24691 # See T93839
24692 !! test
24693 New wikilinks should be serialized properly
24694 !! options
24695 parsoid=html2wt
24696 !! html/parsoid
24697 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
24698 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
24699 !! wikitext
24700 [[Foo]]
24701 [[Foo]]
24702 !! end
24703
24704 !! test
24705 New wiki links (href variations)
24706 !! options
24707 parsoid=html2wt
24708 !! html/parsoid
24709 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
24710 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
24711 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
24712 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
24713 !! wikitext
24714 [[Foo_bar]]
24715 [[Foo_bar]]
24716 [[Foo_bar]]
24717 [[Toxine bactérienne]]
24718 !! end
24719
24720 !! test
24721 New wiki links (content string variations)
24722 !! options
24723 parsoid=html2wt
24724 !! html/parsoid
24725 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
24726 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
24727 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
24728 !! wikitext
24729 [[Foo_bar]]
24730 [[Foo bar]]
24731 [[Foo_bar|./Foo_bar]]
24732 !! end
24733
24734 !! test
24735 New category links (href variations)
24736 !! options
24737 parsoid=html2wt
24738 !! html/parsoid
24739 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
24740 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
24741 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
24742 !! wikitext
24743 [[Category:Toxine bactérienne]]
24744 [[Category:Toxine bactérienne]]
24745 [[Category:Toxine bactérienne]]
24746 !! end
24747
24748 !! test
24749 New sol transparent links don't need indent-pre nowiki protection
24750 !! options
24751 parsoid=html2wt
24752 language=de
24753 !! html/parsoid
24754 <link rel="mw:PageProp/redirect" href="./Main_Page">
24755 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
24756 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
24757 !! wikitext
24758 #WEITERLEITUNG [[Main Page]]
24759 <!-- this is good --> [[Category:Good]]
24760 <!-- this is great --> [[Kategorie:Great]]
24761 !! end
24762
24763 !! test
24764 New interlanguage links (href variations)
24765 !! options
24766 parsoid=html2wt
24767 !! html/parsoid
24768 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
24769 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
24770 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
24771 !! wikitext
24772 [[es:Toxine bactérienne]]
24773 [[es:Toxine_bactérienne]]
24774 [[es:Toxine_bactérienne]]
24775 !! end
24776
24777 !! test
24778 Image: Modifying size of an image (1)
24779 !! options
24780 parsoid={
24781 "modes": ["wt2wt"],
24782 "changes": [
24783 ["img[height]", "attr", "height", "22"],
24784 ["img[width]", "attr", "width", "200"]
24785 ]
24786 }
24787 !! wikitext
24788 [[Image:Foobar.jpg|230x230px]]
24789 !! wikitext/edited
24790 [[Image:Foobar.jpg|200x200px]]
24791 !!end
24792
24793 !! test
24794 Image: Modifying size of an image (2)
24795 !! options
24796 parsoid={
24797 "modes": ["wt2wt"],
24798 "changes": [
24799 ["img[height]", "attr", "height", "100"],
24800 ["img[width]", "attr", "width", "500"]
24801 ]
24802 }
24803 !! wikitext
24804 [[Image:Foobar.jpg|230x230px]]
24805 !! wikitext/edited
24806 [[Image:Foobar.jpg|500x500px]]
24807 !!end
24808
24809 # Change in size is ignored so long as class='mw-default-size'
24810 !! test
24811 Image: Modifying size of an image (3)
24812 !! options
24813 parsoid={
24814 "modes": ["wt2wt"],
24815 "changes": [
24816 ["figure[class]", "removeClass", "mw-default-size"],
24817 ["figure img", "attr", "height", "19"],
24818 ["figure img", "attr", "width", "170"]
24819 ]
24820 }
24821 !! wikitext
24822 [[Image:Foobar.jpg|thumb]]
24823 !! wikitext/edited
24824 [[Image:Foobar.jpg|thumb|170x170px]]
24825 !!end
24826
24827 !! test
24828 Image: Modifying alignment of an image (bug 48665)
24829 !! options
24830 parsoid={
24831 "modes": ["wt2wt"],
24832 "changes": [
24833 ["figure[class]", "removeClass", "mw-halign-right"],
24834 ["figure[class]", "addClass", "mw-halign-left"]
24835 ]
24836 }
24837 !! wikitext
24838 [[Image:Foobar.jpg|thumb|caption|right]]
24839 !! wikitext/edited
24840 [[Image:Foobar.jpg|thumb|caption|left]]
24841 !! end
24842
24843 !! test
24844 Image: Modifying mw-default-size of an frameless image (bug 62805)
24845 !! options
24846 parsoid={
24847 "modes": ["wt2wt"],
24848 "changes": [
24849 ["figure.mw-default-size", "removeClass", "mw-default-size"]
24850 ]
24851 }
24852 !! wikitext
24853 [[Image:Foobar.jpg|frameless|right]]
24854 !! wikitext/edited
24855 [[Image:Foobar.jpg|frameless|right|220x220px]]
24856 !! end
24857
24858 !! test
24859 Image: Modifying valign of an image (bug 49221)
24860 !! options
24861 parsoid={
24862 "modes": ["wt2wt"],
24863 "changes": [
24864 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
24865 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
24866 ]
24867 }
24868 !! wikitext
24869 [[File:Foobar.jpg|20px|middle]]
24870 !! wikitext/edited
24871 [[File:Foobar.jpg|20px|text-top]]
24872 !! end
24873
24874 !! test
24875 Image: Modifying alt attribute of an image (bug 56400)
24876 !! options
24877 parsoid={
24878 "modes": ["wt2wt"],
24879 "changes": [
24880 ["img[alt]", "attr", "alt", "some alternate edited text"]
24881 ]
24882 }
24883 !! wikitext
24884 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
24885 !! wikitext/edited
24886 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
24887 !!end
24888
24889 !! test
24890 Image: Modifying caption of an image
24891 !! options
24892 parsoid={
24893 "modes": ["wt2wt"],
24894 "changes": [
24895 ["figcaption", "text", "new caption"]
24896 ]
24897 }
24898 !! wikitext
24899 [[Image:Foobar.jpg|thumb|original caption]]
24900 !! wikitext/edited
24901 [[Image:Foobar.jpg|thumb|new caption]]
24902 !!end
24903
24904 !! test
24905 Image: empty alt attribute (bug 48924)
24906 !! options
24907 parsoid
24908 !! wikitext
24909 [[File:Foobar.jpg|thumb|alt=|bar]]
24910 !! html
24911 <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>
24912 !! end
24913
24914 !! test
24915 Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
24916 !! options
24917 parsoid=html2wt
24918 language=ar
24919 disabled
24920 !! html/parsoid
24921 <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>
24922 !! wikitext
24923 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
24924 !! end
24925
24926 !! test
24927 Image: Block level image should have \n before and after
24928 !! wikitext
24929 123
24930 [[File:Foobar.jpg|right|thumb|150x150px]]
24931 456
24932 !! html/parsoid
24933 <p>123</p>
24934 <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>
24935 <p>456</p>
24936 !!end
24937
24938 !! test
24939 Image: New block level image should have \n before and after (existing content)
24940 !! wikitext
24941 123
24942 [[File:Foobar.jpg|right|thumb|150x150px]]
24943 456
24944 !! html/parsoid
24945 <p>123</p>
24946 <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>
24947 <p>456</p>
24948 !!end
24949
24950 !! test
24951 Image: upright option (parsoid)
24952 !! wikitext
24953 [[File:Foobar.jpg|thumb|upright|caption]]
24954 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
24955 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
24956 !! html/parsoid
24957 <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>
24958 <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>
24959 <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>
24960 !!end
24961
24962 !! test
24963 Image: upright option is ignored on inline and frame images (parsoid)
24964 !! wikitext
24965 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
24966 !! html/parsoid
24967 <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>
24968 !!end
24969
24970 !! test
24971 Image: from basic HTML (1)
24972 !! options
24973 parsoid=html2wt
24974 !! html/parsoid
24975 <span typeof="mw:Image">
24976 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
24977 </span>
24978 !! wikitext
24979 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
24980 !! end
24981
24982 !! test
24983 Image: from basic HTML (2)
24984 !! options
24985 parsoid=html2wt
24986 !! html/parsoid
24987 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
24988 !! wikitext
24989 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
24990 !! end
24991
24992 !! test
24993 Image: from basic HTML (3)
24994 !! options
24995 parsoid=html2wt
24996 !! html/parsoid
24997 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
24998 !! wikitext
24999 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
25000 !! end
25001
25002 !! test
25003 Image: from basic HTML (4)
25004 !! options
25005 parsoid=html2wt
25006 !! html/parsoid
25007 <img src="./File:Foobar.jpg">
25008 !! wikitext
25009 [[File:Foobar.jpg|link=]]
25010 !! end
25011
25012 !! test
25013 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
25014 !! options
25015 parsoid=html2wt
25016 !! html/parsoid
25017 <ul>
25018 <li><p>foo</p></li>
25019 </ul>
25020 !! wikitext
25021 * foo
25022 !! end
25023
25024 !! test
25025 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
25026 !! options
25027 parsoid=html2wt
25028 !! html/parsoid
25029 <ul> <li>foo</li></ul>
25030 !! wikitext
25031 * foo
25032 !! end
25033
25034 !! test
25035 Don't strip leading whitespace when handling indent-pre suppressing tags
25036 !! options
25037 parsoid=html2wt
25038 !! html/parsoid
25039 <table>
25040 <tr><td> indented row</td></tr>
25041 </table>
25042 <blockquote><p>
25043 <b>This is very bold of you!</b>
25044 </p>
25045 <table><tr><td>
25046 indented cell (no pre-wrapping!)
25047 </td></tr></table>
25048 </blockquote>
25049 <p>foo</p>
25050 <div>bar</div>
25051 !! wikitext
25052 {|
25053 | indented row
25054 |}
25055 <blockquote>
25056 '''This is very bold of you!'''
25057
25058 {|
25059 |
25060 indented cell (no pre-wrapping!)
25061 |}
25062 </blockquote>
25063 foo
25064 <div>bar</div>
25065 !! end
25066
25067 !! test
25068 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
25069 !! options
25070 parsoid=html2wt
25071 !! html/parsoid
25072 <p>foo</p>
25073 <span>bar</span>
25074
25075 <span>foo2
25076 </span>bar2
25077
25078 <div>foo</div>
25079 <span>bar</span>
25080
25081 <div>
25082 <span>foo</span>
25083 </div>
25084 !! wikitext
25085 foo
25086
25087 <span>bar</span>
25088
25089 <span>foo2
25090 <nowiki> </nowiki></span>bar2
25091
25092 <div>foo</div>
25093 <nowiki> </nowiki><span>bar</span>
25094
25095 <div>
25096 <nowiki> </nowiki><span>foo</span>
25097 </div>
25098 !! end
25099
25100 !! test
25101 Lists: Dont insert newlines in a serialized list item.
25102 !! options
25103 parsoid=html2wt
25104 !! html/parsoid
25105 <ul><li>a<br>b</li><li>c</li></ul>
25106 !! wikitext
25107 * a<br>b
25108 * c
25109 !! end
25110
25111 !! test
25112 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
25113 !! options
25114 parsoid={
25115 "modes": ["html2wt"],
25116 "scrubWikitext": false
25117 }
25118 !! html/parsoid
25119 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
25120 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
25121
25122 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
25123 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
25124
25125 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
25126
25127 <h2><meta property="mw:PageProp/toc" /> ok</h2>
25128 !! wikitext
25129 == hello there [[Category:A1]] ==
25130
25131 == [[Category:A2]] hi pal ==
25132
25133 == <!--foo--> [[Category:A3]] how goes it ==
25134
25135 == it goes well [[Category:A4]] <!--bar--> ==
25136
25137 ==howdy [[Category:A5]]==
25138
25139 == __TOC__ ok ==
25140 !! end
25141
25142 !! test
25143 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
25144 !! options
25145 parsoid={
25146 "modes": ["html2wt"],
25147 "scrubWikitext": true
25148 }
25149 !! html/parsoid
25150 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
25151 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
25152
25153 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
25154 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
25155
25156 <h2><meta property="mw:PageProp/toc" /> ok</h2>
25157 !! wikitext
25158 == hello there ==
25159 [[Category:A1]]
25160 [[Category:A2]]
25161
25162 == hi pal ==
25163
25164 <!--foo--> [[Category:A3]]
25165
25166 == how goes it ==
25167
25168 == it goes well ==
25169 [[Category:A4]] <!--bar-->
25170
25171 __TOC__
25172
25173 == ok ==
25174 !! end
25175
25176 !! test
25177 Headings: Don't hoist metas that come from templates
25178 !! options
25179 parsoid={
25180 "modes": ["html2wt"],
25181 "scrubWikitext": true
25182 }
25183 !! html/parsoid
25184 <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>
25185 !! wikitext
25186 == {{echo|foo [[Category:Foo]]}} ==
25187 !! end
25188
25189 !! test
25190 Headings: Category in ref isn't hoisted
25191 !! options
25192 parsoid={
25193 "modes": ["html2wt"],
25194 "scrubWikitext": true
25195 }
25196 !! html/parsoid
25197 <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>
25198
25199 <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>
25200 !! wikitext
25201 == foo <ref>bar
25202 [[Category:Baz]] </ref> ==
25203
25204 <references />
25205 !! end
25206
25207 !! test
25208 Parsoid: Serialize positional parameters with = in them as named parameter
25209 !! options
25210 parsoid=html2wt
25211 !! html/parsoid
25212 <p about="#mwt1" typeof="mw:Transclusion"
25213 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
25214
25215 <p about="#mwt1" typeof="mw:Transclusion"
25216 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
25217
25218 <!--Orig params with data-parsoid has heuristics for handling = chars-->
25219 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
25220 <p data-parsoid='{"pi":[[{"k":"1"},{"k":"2"}]]}' about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"},"2":{"wt":"bar"}},"i":0}}]}'>foo</p>
25221 !! wikitext
25222 {{echo|1=f=oo}}
25223
25224 {{echo|1=f=oo|2=bar}}
25225
25226 <!--Orig params with data-parsoid has heuristics for handling = chars-->
25227 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
25228 {{echo|<nowiki>f=oo</nowiki>|bar}}
25229 !! end
25230
25231 !! test
25232 Parsoid: Serialize positional parameters with = in extlink as named parameter
25233 !! options
25234 parsoid=html2wt
25235 !! html/parsoid
25236 <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>
25237 !! wikitext
25238 {{echo|1=http://stuff?is=ok}}
25239 !! end
25240
25241 !! test
25242 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
25243 !! options
25244 parsoid=html2wt
25245 !! html/parsoid
25246 <div>a<p>b</p></div>
25247 <div>a
25248 <p>b</p></div>
25249 <div>
25250 a
25251 <p>b</p></div>
25252 !! wikitext
25253 <div>a
25254 b
25255 </div>
25256 <div>a
25257 b
25258 </div>
25259 <div>
25260 a
25261
25262 b
25263 </div>
25264 !! end
25265
25266 !! test
25267 Substrings resembling wikitext in hrefs should not get nowiki escapes
25268 !! options
25269 parsoid=html2wt
25270 !! html/parsoid
25271 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
25272 !! wikitext
25273 [[Foo''bar''baz]]
25274 !! end
25275
25276 !! test
25277 Enforce single-line context in the serializer
25278 !! options
25279 parsoid=html2wt
25280 !! html/parsoid
25281 <h2>testing
25282 123</h2>
25283
25284 <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">
25285 </span><span about="#mwt1">you</span> </h2>
25286
25287 <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>
25288
25289 <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
25290 there</span></li></ol>
25291
25292 <ul><li>asd
25293 sdf</li></ul>
25294
25295 <ul><li>foo
25296 bar
25297 baz</li>
25298 <li>foo <b>bar</b>
25299 baz</li></ul>
25300
25301 <dl><dt>hi
25302 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
25303 ho</dd></dl>
25304
25305 <dl><dd> <table>
25306 <tbody><tr><td> ha
25307 ha
25308 ha</td></tr>
25309 </tbody></table></dd></dl>
25310 !! wikitext
25311 == testing 123 ==
25312
25313 == hi {{bogus|there
25314 you}} ==
25315
25316 == foo <ref>hello
25317 there</ref> ==
25318
25319 <references />
25320
25321 * asd sdf
25322
25323 * foo bar baz
25324 * foo '''bar''' baz
25325
25326 ; hi ho : hi ho
25327
25328 : {|
25329 | ha
25330 ha
25331 ha
25332 |}
25333 !! end
25334
25335 !! test
25336 Serialize new placeholder space without spans
25337 !! options
25338 parsoid=html2wt
25339 !! html/parsoid
25340 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
25341
25342 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
25343
25344 <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>
25345 !! wikitext
25346 foo : bar
25347
25348 foo : bar
25349
25350 <ref>foo : bar</ref>ok
25351 !! end
25352
25353
25354 #-----------------------
25355 # Tag minimization tests
25356 #-----------------------
25357
25358 !! test
25359 1. I/B quote minimization: wikitext-only tags should be combined
25360 !! options
25361 parsoid=html2wt
25362 !! html/parsoid
25363 <p><i>A</i><i>B</i></p>
25364 <p><b>A</b><b>B</b></p>
25365 <p><i>A</i><b><i>B</i></b></p>
25366 <p><b>A</b><i><b>B</b></i></p>
25367 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
25368 <p><i><b>A</b></i><i><b>B</b></i></p>
25369 <p><i><b>A</b></i><b><i>B</i></b></p>
25370 <p><b><i>A</i></b><i><b>B</b></i></p>
25371 !! wikitext
25372 ''AB''
25373
25374 '''AB'''
25375
25376 ''A'''B'''''
25377
25378 '''A''B'''''
25379
25380 '''A''BC''D'''
25381
25382 '''''AB'''''
25383
25384 '''''AB'''''
25385
25386 '''''AB'''''
25387 !! end
25388
25389 !! test
25390 2. I/B quote minimization: wikitext and html tags should not be combined
25391 !! options
25392 parsoid=html2wt
25393 !! html/parsoid
25394 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
25395 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
25396 !! wikitext
25397 ''A''<i>B</i>
25398
25399 ''A''<nowiki/>'''<i>B</i>'''
25400 !! end
25401
25402 !! test
25403 3. I/B quote minimization: templated content stops minimization
25404 !! options
25405 parsoid=html2wt
25406 !! html/parsoid
25407 <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>
25408 <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>
25409 !! wikitext
25410 ''A''{{echo|''B''}}
25411
25412 ''A''{{echo|'''''B'''''}}
25413 !! end
25414
25415 !! test
25416 4. I/B quote minimization: new content should be mimimized with adjacent old content
25417 !! options
25418 parsoid=html2wt
25419 !! html/parsoid
25420 <p><i>A</i><i>B</i></p>
25421 <p><b>A</b><b>B</b></p>
25422 <p><i>A</i><b><i>B</i></b></p>
25423 !! wikitext
25424 ''AB''
25425
25426 '''AB'''
25427
25428 ''A'''B'''''
25429 !! end
25430
25431 !! test
25432 5a. Merge adjacent quote nodes if they've been edited
25433 !! options
25434 parsoid={
25435 "modes": ["wt2wt", "selser"],
25436 "changes": [
25437 ["p", "contents", "remove", ":contains('b')"]
25438 ]
25439 }
25440 !! wikitext
25441 ''a''b''c''
25442 !! wikitext/edited
25443 ''ac''
25444 !! end
25445
25446 !! test
25447 5b. Merge adjacent quote nodes if they've been edited
25448 !! options
25449 parsoid={
25450 "modes": ["wt2wt", "selser"],
25451 "changes": [
25452 ["#x", "remove"]
25453 ]
25454 }
25455 !! wikitext
25456 ''a''<span id="x">b</span>''c''
25457 !! wikitext/edited
25458 ''ac''
25459 !! end
25460
25461 !! test
25462 1. Merge adjacent link nodes as long as at least one element is new
25463 !! options
25464 parsoid={
25465 "modes": ["html2wt"],
25466 "scrubWikitext": true
25467 }
25468 !! html/parsoid
25469 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25470 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25471 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
25472 !! wikitext
25473 [[Football]]
25474 [[Football]]
25475 [[Football|Foot]][[Football|ball]]
25476 !! end
25477
25478 !! test
25479 2. Merge adjacent link nodes and enable additional normalizations
25480 !! options
25481 parsoid={
25482 "modes": ["html2wt"],
25483 "scrubWikitext": true
25484 }
25485 !! html/parsoid
25486 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
25487 !! wikitext
25488 [[Football|''Football'']]
25489 !! end
25490
25491 !! test
25492 3. Don't merge adjacent link nodes if scrubWikitext is false
25493 !! options
25494 parsoid={
25495 "modes": ["html2wt"],
25496 "scrubWikitext": false
25497 }
25498 !! html/parsoid
25499 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25500 !! wikitext
25501 [[Football|Foot]][[Football|ball]]
25502 !! end
25503
25504 #------------------------------
25505 # End of tag minimization tests
25506 #------------------------------
25507
25508 !!test
25509 Bug 54262: New entities
25510 !! options
25511 parsoid=html2wt
25512 !! html/parsoid
25513 <span typeof="mw:Entity">&nbsp;</span>
25514 !! wikitext
25515 &nbsp;
25516 !! end
25517
25518 ## Note that there is no wikitext output for 'unknownproperty' ##
25519 ## Unknown magic words are silently dropped ##
25520
25521 !! test
25522 Magic words
25523 !! options
25524 parsoid=html2wt
25525 !! html/parsoid
25526 <meta property='mw:PageProp/toc' />
25527 <meta property='mw:PageProp/notoc' />
25528 <meta property='mw:PageProp/forcetoc' />
25529 <meta property='mw:PageProp/index' />
25530 <meta property='mw:PageProp/noindex' />
25531 <meta property='mw:PageProp/nogallery' />
25532 <meta property='mw:PageProp/noeditsection' />
25533 <meta property='mw:PageProp/notitleconvert' />
25534 <meta property='mw:PageProp/nocontentconvert' />
25535 <meta property='mw:PageProp/unknownproperty' />
25536 !! wikitext
25537 __TOC__
25538 __NOTOC__
25539 __FORCETOC__
25540 __INDEX__
25541 __NOINDEX__
25542 __NOGALLERY__
25543 __NOEDITSECTION__
25544 __NOTITLECONVERT__
25545 __NOCONTENTCONVERT__
25546 !! end
25547
25548 !! test
25549 Consecutive <pre>s should not get merged
25550 !! options
25551 parsoid=html2wt,html2html
25552 !! html/parsoid
25553 <pre>a</pre><pre>b</pre>
25554
25555 <pre>c
25556 </pre><pre>
25557 d</pre>
25558
25559 <pre>e
25560
25561 </pre><pre>
25562
25563 f</pre>
25564 !! wikitext
25565 a
25566
25567 b
25568
25569 c
25570
25571 d
25572
25573 e
25574
25575
25576
25577 f
25578 !! end
25579
25580 !! test
25581 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
25582 !! options
25583 parsoid=html2wt
25584 !! html/parsoid
25585 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
25586 !! wikitext
25587 [[Special:BookSources/1234567890|ISBN 1234567895]]
25588 !! end
25589
25590 !! test
25591 Edited RFC links not serializable as RFC links should serialize as extlinks
25592 !! options
25593 parsoid=html2wt
25594 !! html/parsoid
25595 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
25596 !! wikitext
25597 [//tools.ietf.org/html/rfc123 New RFC]
25598 !! end
25599
25600 !! test
25601 Edited PMID links not serializable as PMID links should serialize as extlinks
25602 !! options
25603 parsoid=html2wt
25604 !! html/parsoid
25605 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
25606 !! wikitext
25607 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
25608 !! end
25609
25610 !! test
25611 WTS of autolinks with trailing/surrounding context
25612 !! options
25613 parsoid=html2wt
25614 !! html/parsoid
25615 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
25616 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
25617 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
25618 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
25619 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
25620 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
25621 !! wikitext
25622 http://cscott.net'''foo'''
25623
25624 http://cscott.net<b>foo</b>
25625
25626 '''http://cscott.net'''
25627
25628 '''http://cscott.net '''
25629
25630 '''http://cscott.net<nowiki/>x'''
25631
25632 http://cscott.net<nowiki/>x
25633 !! end
25634
25635 !! test
25636 WTS of autolinks with nowikis (round-trip)
25637 !! wikitext
25638 x<nowiki/>http://cscott.net<nowiki/>x
25639 !! html/parsoid
25640 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
25641 !! end
25642
25643 # this is the "easy" test because it leaves in place all the
25644 # data-parsoid information indicating this is an autolink
25645 !! test
25646 WTS of autolinks with escapes (editing)
25647 !! options
25648 parsoid={
25649 "modes": ["wt2wt"],
25650 "changes": [
25651 [ "meta", "remove" ]
25652 ]
25653 }
25654 !! wikitext
25655 x<nowiki/>http://cscott.net<nowiki/>x
25656 !! wikitext/edited
25657 x<nowiki/>http://cscott.net<nowiki/>x
25658 !! end
25659
25660 !! test
25661 WTS of edited autolink-like text (T103364)
25662 !! options
25663 parsoid={
25664 "modes": ["wt2wt"],
25665 "changes": [
25666 [ "span[typeof]", "removeAttr", "typeof" ]
25667 ]
25668 }
25669 !! wikitext
25670 Not a link: <nowiki>http://example.com</nowiki>.
25671 !! wikitext/edited
25672 Not a link: <span><nowiki>http://example.com</nowiki></span>.
25673 !! end
25674
25675 !! test
25676 WTS of newly-authored autolink-like text (T103364)
25677 !! options
25678 parsoid=html2wt
25679 !! html/parsoid
25680 <p>http://example.com is not a link.</p>
25681 !! wikitext
25682 <nowiki>http://example.com</nowiki> is not a link.
25683 !! end
25684
25685 !! test
25686 WTS of autolink-like text after an autolink (T108563)
25687 !! options
25688 parsoid=html2wt
25689 !! html/parsoid
25690 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
25691 !! wikitext
25692 http://example.com <nowiki>http://example.com</nowiki> is not a link.
25693 !! end
25694
25695 !! test
25696 Magic links inside links (not autolinked)
25697 !! wikitext
25698 [[Foo|http://example.com]]
25699 [[Foo|RFC 1234]]
25700 [[Foo|PMID 1234]]
25701 [[Foo|ISBN 123456789x]]
25702
25703 [http://foo.com http://example.com]
25704 [http://foo.com RFC 1234]
25705 [http://foo.com PMID 1234]
25706 [http://foo.com ISBN 123456789x]
25707 !! html+tidy
25708 <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>
25709 <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>
25710 !! html/parsoid
25711 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
25712 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
25713 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
25714 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
25715
25716 <p><a rel="mw:ExtLink" href="http://foo.com">http://example.com</a>
25717 <a rel="mw:ExtLink" href="http://foo.com">RFC 1234</a>
25718 <a rel="mw:ExtLink" href="http://foo.com">PMID 1234</a>
25719 <a rel="mw:ExtLink" href="http://foo.com">ISBN 123456789x</a></p>
25720 !! end
25721
25722 !! test
25723 Magic links inside image captions (autolinked)
25724 !! wikitext
25725 [[File:Foobar.jpg|thumb|http://example.com]]
25726 [[File:Foobar.jpg|thumb|RFC 1234]]
25727 [[File:Foobar.jpg|thumb|PMID 1234]]
25728 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
25729 !! html+tidy
25730 <div class="thumb tright">
25731 <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>
25732 <div class="thumbcaption">
25733 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25734 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div>
25735 </div>
25736 </div>
25737 <div class="thumb tright">
25738 <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>
25739 <div class="thumbcaption">
25740 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25741 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a></div>
25742 </div>
25743 </div>
25744 <div class="thumb tright">
25745 <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>
25746 <div class="thumbcaption">
25747 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25748 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a></div>
25749 </div>
25750 </div>
25751 <div class="thumb tright">
25752 <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>
25753 <div class="thumbcaption">
25754 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25755 <a href="/wiki/Special:BookSources/123456789X" class="internal mw-magiclink-isbn">ISBN 123456789x</a></div>
25756 </div>
25757 </div>
25758 !! html/parsoid
25759 <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>
25760 <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>
25761 <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>
25762 <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>
25763 !! end
25764
25765 !! test
25766 WTS of magic word text (T109371)
25767 !! options
25768 parsoid=html2wt
25769 !! html/parsoid
25770 <p>RFC 1234</p>
25771 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
25772 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
25773 !! wikitext
25774 <nowiki>RFC 1234</nowiki>
25775
25776 [http://foo.com RFC 1234]
25777
25778 [[Foo|RFC 1234]]
25779 !! end
25780
25781 !! test
25782 Edited Redirect link should emit a non-piped wikitext link
25783 !! options
25784 parsoid=html2wt
25785 !! html/parsoid
25786 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
25787 !! wikitext
25788 #REDIRECT [[Bar]]
25789 !! end
25790
25791 !! test
25792 T75121: Infer extension name from typeOf if data-mw is not present
25793 !! options
25794 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
25795 !! html/parsoid
25796 <div typeOf="mw:Extension/foo"></div>
25797 !! wikitext
25798 <foo />
25799 !! end
25800
25801 # Note that the <p> wrapping isn't present in PHP parser output
25802 # The important thing for this test is that P-wrapping doesn't
25803 # interfere with the <nowiki> protection for leading - in <td>
25804 # (which isn't necessary for <th>).
25805 !! test
25806 T88318: p-wrapped dash in table.
25807 !! options
25808 parsoid=html2wt,wt2wt
25809 !! html/parsoid
25810 <table><tbody>
25811 <tr><th><p>-</p></th><th><p>- </p></th></tr>
25812 <tr><td><p>-</p></td><td><p>- </p></td></tr>
25813 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
25814 </tbody></table>
25815 !! wikitext
25816 {|
25817 !-
25818 !-
25819 |-
25820 |<nowiki>-</nowiki>
25821 |<nowiki>- </nowiki>
25822 |-
25823 |<small>-</small>
25824 |<br>
25825 -
25826 |<br>
25827 -
25828 |}
25829 !! html/php+tidy
25830 <table>
25831 <tr>
25832 <th>-</th>
25833 <th>-</th>
25834 </tr>
25835 <tr>
25836 <td>-</td>
25837 <td>-</td>
25838 </tr>
25839 <tr>
25840 <td><small>-</small></td>
25841 <td><br />
25842 <p>-</p>
25843 </td>
25844 <td><br />
25845 <p>-</p>
25846 </td>
25847 </tr>
25848 </table>
25849 !! end
25850
25851 !! test
25852 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
25853 !! options
25854 parsoid=html2wt
25855 !! html/parsoid
25856 <table id='mwAb'>
25857 <td id='mwAc'>foo</td>
25858 <td id='serialize-this'>bar</td>
25859 </table>
25860 !! wikitext
25861 {|
25862 |foo
25863 | id="serialize-this" |bar
25864 |}
25865 !! end
25866
25867 !! test
25868 Parsoid-like element ids should not be serialized to wikitext unless shadowed
25869 !! options
25870 parsoid=html2wt
25871 !! html/parsoid
25872 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
25873 !! wikitext
25874 <div id="hello">ok</div>
25875 !! end
25876
25877 !! test
25878 WTS change modes
25879 !! options
25880 parsoid={
25881 "modes": ["wt2wt"],
25882 "changes": [
25883 [ "#xyz", "before", "<b>before</b> stuff " ],
25884 [ "#xyz", "after", " stuff <i>after</i>" ],
25885 [ "#xyz", "html", "x <b>y</b> z" ]
25886 ]
25887 }
25888 !! wikitext
25889 <span id="xyz">hello</span>
25890 !! wikitext/edited
25891 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
25892 !! end
25893
25894 !! test
25895 Never serialize a-tag as html, regardless of what data-parsoid has to say
25896 !! options
25897 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
25898 !! html/parsoid
25899 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
25900 !! wikitext
25901 [[Foo]]
25902 !! end
25903
25904 ## SSS FIXME: This is broken output nevertheless.
25905 ## What might be a reasonable non-broken output for this?
25906 ## This is an edge case unlikely to be seen in production
25907 ## that I am not wasting more time on this right now.
25908 !! test
25909 Never serialize a-tag as html, no matter what attributes it has
25910 !! options
25911 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
25912 !! html/parsoid
25913 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
25914 !! wikitext
25915 [http://boo.org http://boohoo.org]
25916 !! end
25917
25918 # Misnested is an indication that selser can reuse the source but these have
25919 # shown to sneak through on occasion. See T101768.
25920 # The original wikitext here is: [http://test.com [[one]] two three]
25921 !! test
25922 Strip span tags added to mark misnested links
25923 !! options
25924 parsoid=html2wt
25925 !! html/parsoid
25926 <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>
25927 !! wikitext
25928 [http://test.com][[one]] two three
25929 !! end
25930
25931 !! test
25932 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
25933 !! options
25934 parsoid=html2wt
25935 !! html/parsoid
25936 <span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a"}},"i":0}}]}'>a</span><table about="#mwt2" typeof="mw:Transclusion mw:ExpandedAttrs" data-parsoid='{"a":{"{{echo|c\n{{!}}d\n}}":null},"sa":{"{{echo|c\n{{!}}d\n}}":""},"firstWikitextNode":"table","pi":[[{"k":"1"}]]}' data-mw='{"parts":["{|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"c\n{{!}}d\n"}},"i":0}},"\n|}"]}'>
25937 <tbody><tr><td>d
25938 </td></tr>
25939 </tbody></table>
25940 !! wikitext
25941 {{echo|a}}
25942 {|{{echo|c
25943 {{!}}d
25944 }}
25945 |}
25946 !! end
25947
25948 ## This test verifies the presence and computation of this attribute indirectly
25949 ## by making an edit and ensuring that the serialization is correct (which it would be
25950 ## only if firstWikitextNode is properly set).
25951 !! test
25952 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
25953 !! options
25954 parsoid= {
25955 "modes": ["wt2wt"],
25956 "changes": [
25957 [ "div#x", "remove" ],
25958 [ "div", "before", "<div>new</div>" ]
25959 ]
25960 }
25961 !! wikitext
25962 <div id="x">foo</div>
25963 {|
25964 {{echo|<div>boo</div>
25965 {{!}}b}}
25966 |c
25967 |}
25968 !! wikitext/edited
25969
25970 <div>new</div>
25971 {|
25972 {{echo|<div>boo</div>
25973 {{!}}b}}
25974 |c
25975 |}
25976 !! end
25977
25978 # --------------------------------------------
25979 # Tests spec'ing wikitext serialization norms |
25980 # --------------------------------------------
25981
25982 !! test
25983 1. Categories should always be serialized on their own line
25984 !! options
25985 parsoid=html2wt
25986 !! html/parsoid
25987 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
25988 !! wikitext
25989 foo
25990 [[Category:Foo]]
25991 bar
25992 !! end
25993
25994 !! test
25995 2. Categories that are part of templates should not introduce a line break
25996 !! wikitext
25997 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
25998 !! html/parsoid
25999 <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>
26000 !! end
26001
26002 # Careful while editing these next 2 tests. There are \u200f characters
26003 # before and after the <link> tags in the HTML and following some
26004 # of the categories in wikitext
26005 # Do not remove these characters in edits.
26006 #
26007 # As part of the serialization, these bidi characters will get stripped.
26008 !! test
26009 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
26010 !! options
26011 parsoid={
26012 "modes": ["html2wt"],
26013 "scrubWikitext": true
26014 }
26015 !! html/parsoid
26016 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
26017 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
26018 !! wikitext
26019 [[קטגוריה:טקסים]]
26020 [[קטגוריה: שיטות משפט]]
26021 !! end
26022
26023 !! test
26024 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
26025 !! options
26026 parsoid={
26027 "modes": ["html2wt"],
26028 "scrubWikitext": true
26029 }
26030 !! html/parsoid
26031 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
26032 !! wikitext
26033 [[קטגוריה:טקסים]]
26034 ‏y
26035 !! end
26036
26037 !! test
26038 Lists: Add space after bullets
26039 !! options
26040 parsoid=html2wt
26041 !! html/parsoid
26042 <ul>
26043 <li>foo</li>
26044 <li> bar</li>
26045 <li><span> baz</span></li>
26046 </ul>
26047 !! wikitext
26048 * foo
26049 * bar
26050 * <span> baz</span>
26051 !! end
26052
26053 !! test
26054 1. Headings: Add space before/after == (T53744)
26055 !! options
26056 parsoid=html2wt
26057 !! html/parsoid
26058 <h2>foo</h2>
26059 <h2> bar</h2>
26060 <h2>baz </h2>
26061 <h2><span> baz</span></h2>
26062 !! wikitext
26063 == foo ==
26064
26065 == bar ==
26066
26067 == baz ==
26068
26069 == <span> baz</span> ==
26070 !! end
26071
26072 !! test
26073 2. Headings: Add space before/after == even after hoisted content
26074 !! options
26075 parsoid={
26076 "modes": ["html2wt"],
26077 "scrubWikitext": true
26078 }
26079 !! html/parsoid
26080 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
26081 !! wikitext
26082 [[Category:A2]]
26083
26084 == ok ==
26085 !! end
26086
26087 !! test
26088 1. Headings: suppress newly created empty headings
26089 !! options
26090 parsoid={
26091 "modes": ["html2wt"],
26092 "scrubWikitext": true
26093 }
26094 !! html/parsoid
26095 <h2></h2>
26096 !! wikitext
26097 !! end
26098
26099 !! test
26100 2. Headings: don't suppress empty headings if scrubWikitext is false
26101 !! options
26102 parsoid=html2wt
26103 !! html/parsoid
26104 <h2></h2>
26105 !! wikitext
26106 ==<nowiki/>==
26107 !! end
26108
26109 !! test
26110 3. Headings: suppress empty headings on edits
26111 !! options
26112 parsoid={
26113 "modes": ["selser"],
26114 "scrubWikitext": true,
26115 "changes": [
26116 [ "#x", "remove"]
26117 ]
26118 }
26119 !! wikitext
26120 ==<span id="x">foo</span>==
26121 !! wikitext/edited
26122 !! end
26123
26124 !! test
26125 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
26126 !! options
26127 parsoid={
26128 "modes": ["html2wt"],
26129 "scrubWikitext": true
26130 }
26131 !! html/parsoid
26132 <h2>foo<br/>bar</h2>
26133 <h2>foo <span><br/>bar</span> baz</h2>
26134 !! wikitext
26135 == foo bar ==
26136
26137 == foo <span> bar</span> baz ==
26138 !! end
26139
26140 !! test
26141 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
26142 !! options
26143 parsoid={
26144 "modes": ["html2wt"],
26145 "scrubWikitext": false
26146 }
26147 !! html/parsoid
26148 <h2>foo<br/>bar</h2>
26149 !! wikitext
26150 == foo<br> bar ==
26151 !! end
26152
26153 !! test
26154 1. WT Quote Tags: suppress newly created empty style tags
26155 !! options
26156 parsoid={
26157 "modes": ["html2wt"],
26158 "scrubWikitext": true
26159 }
26160 !! html/parsoid
26161 <i></i><b></b>
26162 !! wikitext
26163 !! end
26164
26165 !! test
26166 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
26167 !! options
26168 parsoid=html2wt
26169 !! html/parsoid
26170 <i></i><b></b>
26171 !! wikitext
26172 ''<nowiki/>'''''<nowiki/>'''
26173 !! end
26174
26175 !! test
26176 3. WT Quote Tags: suppress empty style tags on edits
26177 !! options
26178 parsoid={
26179 "modes": ["selser"],
26180 "scrubWikitext": true,
26181 "changes": [
26182 [ "#x", "remove"]
26183 ]
26184 }
26185 !! wikitext
26186 '''<span id="x">foo</span>'''
26187 !! wikitext/edited
26188 !! end
26189
26190 !! test
26191 1. Anchors: suppress newly created empty anchors
26192 !! options
26193 parsoid={
26194 "modes": ["html2wt"],
26195 "scrubWikitext": true
26196 }
26197 !! html/parsoid
26198 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
26199 !! wikitext
26200 !! end
26201
26202 !! test
26203 2. Anchors: don't suppress empty anchors if scrubWikitext is false
26204 !! options
26205 parsoid={
26206 "modes": ["html2wt"],
26207 "scrubWikitext": false
26208 }
26209 !! html/parsoid
26210 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
26211 !! wikitext
26212 [[Test|<nowiki/>]]
26213 !! end
26214
26215 !! test
26216 3. Anchors: suppress empty anchors on edits
26217 !! options
26218 parsoid={
26219 "modes": ["selser"],
26220 "scrubWikitext": true,
26221 "changes": [
26222 [ "#x", "remove"]
26223 ]
26224 }
26225 !! wikitext
26226 [[Test|<span id="x">foo</span>]]
26227 !! wikitext/edited
26228 !! end
26229
26230 !! test
26231 3a. Anchors: do not suppress numbered extlinks
26232 !! options
26233 parsoid={
26234 "modes": ["wt2wt"],
26235 "scrubWikitext": true
26236 }
26237 !! wikitext
26238 [http://foo.com]
26239 !! html/parsoid
26240 <a rel="mw:ExtLink" href="http://foo.com"></a>
26241 !! end
26242
26243 !! test
26244 3b. Anchors: do not suppress numbered extlinks
26245 !! options
26246 parsoid={
26247 "modes": ["wt2wt"],
26248 "scrubWikitext": true,
26249 "changes": [
26250 [ "#x", "remove"]
26251 ]
26252 }
26253 !! wikitext
26254 [http://foo.com <span id="x">foo</span>]
26255 !! wikitext/edited
26256 [http://foo.com]
26257 !! end
26258
26259 !!test
26260 Normalizations should be restricted to edited content
26261 !!options
26262 parsoid={
26263 "modes": ["selser"],
26264 "scrubWikitext": true,
26265 "changes": [
26266 [ "h1", "before", "<i></i>"]
26267 ]
26268 }
26269 !!wikitext
26270 a
26271 = =
26272 b
26273 !!wikitext/edited
26274 a
26275 = =
26276 b
26277 !!end
26278
26279 !! test
26280 1. Multiple normalizations (html2wt)
26281 !! options
26282 parsoid={
26283 "modes": ["html2wt"],
26284 "scrubWikitext": true
26285 }
26286 !! html
26287 <h2><i></i></h2>
26288 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
26289 </a><b><i></i></b>x</p>
26290 !! wikitext
26291
26292 [[foo]]
26293 x
26294
26295 !! end
26296
26297 !! test
26298 2. Multiple normalizations (selser)
26299 !! options
26300 parsoid={
26301 "modes": ["selser"],
26302 "scrubWikitext": true,
26303 "changes": [
26304 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
26305 ]
26306 }
26307 !! wikitext
26308 <span id="x">foo</span>
26309 !! wikitext/edited
26310 <span id="x">foo</span>
26311
26312 x
26313 !! end
26314
26315 !! test
26316 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
26317 !! options
26318 parsoid={
26319 "modes": ["html2wt"],
26320 "scrubWikitext": true
26321 }
26322 !! html/parsoid
26323 <p> hi</p>
26324 <p> hello</p>
26325 !! wikitext
26326 hi
26327
26328 hello
26329 !! end
26330
26331 !! test
26332 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
26333 !! options
26334 parsoid=html2wt
26335 !! html/parsoid
26336 <p> hi</p>
26337 <p> hello</p>
26338 !! wikitext
26339 <nowiki> </nowiki>hi
26340
26341 <nowiki> </nowiki> hello
26342 !! end
26343
26344 !! test
26345 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
26346 !! options
26347 parsoid={
26348 "modes": ["html2wt"],
26349 "scrubWikitext": true
26350 }
26351 !! html/parsoid
26352 <p>Foo
26353 bar
26354 baz</p>
26355
26356 <table><tr><td>Foo
26357 bar
26358 baz bang</td></tr></table>
26359
26360 <p><!--boo--> foo
26361 bar</p>
26362
26363 <p> foo
26364 bar<span>boo</span></p>
26365 !! wikitext
26366 Foo
26367 bar
26368 baz
26369
26370 {|
26371 |Foo
26372 bar
26373 baz bang
26374 |}
26375
26376 <!--boo-->foo
26377 bar
26378
26379 foo
26380 bar<span>boo</span>
26381 !! end
26382
26383 !! test
26384 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
26385 !! options
26386 parsoid={
26387 "modes": ["selser"],
26388 "scrubWikitext": true,
26389 "changes": [
26390 [ "p", "html", " a\n b" ]
26391 ]
26392 }
26393 !! wikitext
26394 xyz
26395 !! wikitext/edited
26396 a
26397 b
26398 !! end
26399
26400 !! test
26401 1. New links that end in spaces
26402 !! options
26403 parsoid={
26404 "modes": ["html2wt"],
26405 "scrubWikitext": false
26406 }
26407 !! html/parsoid
26408 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
26409 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
26410 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
26411 !! wikitext
26412 [[Berlin ]]<nowiki/>is the capital of Germany.
26413
26414 [[Foo ]]'''bar'''
26415
26416 [[Boston ]] is a city.
26417 !! end
26418
26419 !! test
26420 2. New links that end in spaces
26421 !! options
26422 parsoid={
26423 "modes": ["html2wt"],
26424 "scrubWikitext": true
26425 }
26426 !! html/parsoid
26427 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
26428 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
26429 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
26430 !! wikitext
26431 [[Berlin]] is the capital of Germany.
26432
26433 [[Foo]] '''bar'''
26434
26435 [[Boston]] is a city.
26436 !! end
26437
26438 !! test
26439 1. Table cells with escapable prefixes
26440 !! options
26441 parsoid={
26442 "modes": ["html2wt"],
26443 "scrubWikitext": false
26444 }
26445 !! html
26446 <table>
26447 <tr><td>a</td></tr>
26448 <tr><td>-</td></tr>
26449 <tr><td>+</td></tr>
26450 </table>
26451 !! wikitext
26452 {|
26453 |a
26454 |-
26455 |<nowiki>-</nowiki>
26456 |-
26457 |<nowiki>+</nowiki>
26458 |}
26459 !! end
26460
26461 !! test
26462 2. Table cells with escapable prefixes
26463 !! options
26464 parsoid={
26465 "modes": ["html2wt"],
26466 "scrubWikitext": true
26467 }
26468 !! html
26469 <table>
26470 <tr><td>a</td></tr>
26471 <tr><td>-</td></tr>
26472 <tr><td>+</td></tr>
26473 </table>
26474 !! wikitext
26475 {|
26476 |a
26477 |-
26478 | -
26479 |-
26480 | +
26481 |}
26482 !! end
26483
26484 !! test
26485 3a. Table cells with escapable prefixes after edits
26486 !! options
26487 parsoid={
26488 "modes": ["selser"],
26489 "scrubWikitext": true,
26490 "changes": [
26491 [ "table tbody tr:first-child td:first-child", "remove"]
26492 ]
26493 }
26494 !! wikitext
26495 {|
26496 |a||-
26497 |}
26498 !! wikitext/edited
26499 {|
26500 | -
26501 |}
26502 !! end
26503
26504 !! test
26505 3b. Table cells with escapable prefixes after edits
26506 !! options
26507 parsoid={
26508 "modes": ["selser"],
26509 "scrubWikitext": true,
26510 "changes": [
26511 [ "table tbody tr:first-child td:first-child", "html", "-" ],
26512 [ "#x", "remove" ]
26513 ]
26514 }
26515 !! wikitext
26516 {|
26517 |pqr
26518 |<span id="x">foo</span>+
26519 |}
26520 !! wikitext/edited
26521 {|
26522 | -
26523 | +
26524 |}
26525 !! end
26526
26527 # FIXME: This test will fail because
26528 # normalization doesn't realize that the id attribute
26529 # will eliminate the escapable scenario
26530 !! test
26531 4a. Table cells without escapable prefixes after edits
26532 !! options
26533 parsoid={
26534 "modes": ["selser"],
26535 "scrubWikitext": true,
26536 "changes": [
26537 [ "#x", "html", "-" ]
26538 ]
26539 }
26540 !! wikitext
26541 {|
26542 | id="x" |abcd
26543 |}
26544 !! wikitext/edited
26545 {|
26546 | id="x" |-
26547 |}
26548 !! end
26549
26550 ## This tests normalizer's ability to discriminate between
26551 ## cells having identical content.
26552 !! test
26553 4b. Table cells without escapable prefixes after edits
26554 !! options
26555 parsoid={
26556 "modes": ["selser"],
26557 "scrubWikitext": true,
26558 "changes": [
26559 [ "td", "html", "-" ]
26560 ]
26561 }
26562 !! wikitext
26563 {|
26564 |a||b
26565 |}
26566 !! wikitext/edited
26567 {|
26568 | -||-
26569 |}
26570 !! end
26571
26572 ## This tests normalizer's ability to not be tripped by
26573 ## comments (and whitespace)
26574 !! test
26575 4c. Table cells without escapable prefixes after edits
26576 !! options
26577 parsoid={
26578 "modes": ["selser"],
26579 "scrubWikitext": true,
26580 "changes": [
26581 [ "table tbody tr td:first-child", "remove" ]
26582 ]
26583 }
26584 !! wikitext
26585 {|
26586 |-
26587 <!--foo--> |a||-
26588 |}
26589 !! wikitext/edited
26590 {|
26591 |-
26592 <!--foo--> | -
26593 |}
26594 !! end
26595
26596 ## This tests normalizer's ability to handle HTML cells
26597 !! test
26598 4d. Table cells without escapable prefixes after edits
26599 !! options
26600 parsoid={
26601 "modes": ["selser"],
26602 "scrubWikitext": true,
26603 "changes": [
26604 [ "td", "html", "-" ]
26605 ]
26606 }
26607 !! wikitext
26608 <table>
26609 <tr><td>a</td></tr>
26610 </table>
26611 !! wikitext/edited
26612 <table>
26613 <tr><td>-</td></tr>
26614 </table>
26615 !! end
26616
26617 ## T111151 Remove font elements without attributes
26618 !! test
26619 5a. font tags without attributes should be dropped in scrubWikitext mode
26620 !! options
26621 parsoid={
26622 "modes": ["html2wt"],
26623 "scrubWikitext": true
26624 }
26625 !! html
26626 <font>foo</font>
26627 <font><font>bar</font></font>
26628 <font class="x">boo</font>
26629 !! wikitext
26630 foo
26631 bar
26632 <font class="x">boo</font>
26633 !! end
26634
26635 !! test
26636 5b. font tags should not be dropped without scrubWikitext being enabled
26637 !! options
26638 parsoid={
26639 "modes": ["html2wt"],
26640 "scrubWikitext": false
26641 }
26642 !! html
26643 <font>foo</font>
26644 !! wikitext
26645 <font>foo</font>
26646 !! end
26647
26648 !! test
26649 Escape nowiki DOM elements
26650 !! options
26651 parsoid=html2wt
26652 !! html/parsoid
26653 <nowiki><i>foo</i></nowiki>
26654 !! wikitext
26655 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
26656 !! end
26657
26658 # This is meant to be an interim fix while we go about figuring out
26659 # how to not introduce these trailing <nowiki/>s in the first place.
26660 !! test
26661 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
26662 !! options
26663 parsoid=html2wt
26664 !! html/parsoid
26665 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
26666 y</p>
26667 <p><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"dsr":[0,23,null,null],"pi":[[{"k":"1","named":true,"spc":["\n"," "," ",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;nowiki/>"}},"i":0}}]}'></span></p>
26668 <p><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"dsr":[0,24,null,null],"pi":[[{"k":"1","named":true,"spc":["\n"," "," ","\n"]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;nowiki/>"}},"i":0}}]}'></span></p>
26669 !! wikitext
26670 x
26671 y
26672
26673 {{echo|
26674 1 = <nowiki/>}}
26675
26676 {{echo|
26677 1 = <nowiki/>
26678 }}
26679 !! end
26680
26681 # ---------------------------------------------------
26682 # End of tests spec'ing wikitext serialization norms |
26683 # ---------------------------------------------------
26684
26685 # T104032
26686 !! test
26687 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
26688 !! options
26689 parsoid=html2wt
26690 !! html/parsoid
26691 a<p>b</p>
26692 <b>c</b><p>d</p>
26693 <table><tr>
26694 <td>a<p>b</p></td>
26695 <td><b>c</b><p>d</p></td>
26696 </tr></table>
26697 !! wikitext
26698 a
26699
26700 b
26701
26702 '''c'''
26703
26704 d
26705 {|
26706 |a
26707 b
26708 |'''c'''
26709 d
26710 |}
26711 !! end
26712
26713 # -----------------------------------------------------------------
26714 # End of section for Parsoid-only html2wt tests for serialization
26715 # of new content
26716 # -----------------------------------------------------------------
26717
26718 # -----------------------------------------------------------------
26719 # The following section of tests are primarily to spec behavior of
26720 # the selective serializer. All these tests have manual selser
26721 # changes. The automated selser changes for all tests handle the
26722 # wide variation of changes, but these tests here capture specs
26723 # deterministically.
26724 # ----------------------------------------------------------------
26725
26726 ## T90517
26727 !! test
26728 Selser: New comments should not be lost
26729 !! options
26730 parsoid={
26731 "modes": ["selser"],
26732 "changes": [
26733 [ "#a", "after", "<!--c1-->" ],
26734 [ "#b", "before", "<!--c2-->" ]
26735 ]
26736 }
26737 !! wikitext
26738 <span id="a">a</span>
26739
26740 <span id="b">b</span>
26741 !! wikitext/edited
26742 <span id="a">a</span><!--c1-->
26743
26744 <!--c2--><span id="b">b</span>
26745 !! end
26746
26747 ## T89383
26748 !! test
26749 Selser: Check for validity of DSR before using it
26750 !! options
26751 parsoid={
26752 "modes": ["selser"],
26753 "changes": [
26754 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
26755 ]
26756 }
26757 !! wikitext
26758 <span id="a">a</span>
26759 !! wikitext/edited
26760 {{DISPLAYTITLE:foo}}
26761 <span id="a">a</span>
26762 !! end
26763
26764 !! test
26765 1. DOMDiff: Changes to <ref> content should be looked up using id
26766 !! options
26767 parsoid={
26768 "modes": ["selser"],
26769 "changes": [
26770 ["#X", "after", "bar"],
26771 ["#Y", "after", "baz"]
26772 ]
26773 }
26774 !! wikitext
26775 X <ref><span id="X">foo</span></ref>
26776 Y <ref name="a" />
26777 <references>
26778 <ref name="a"><span id="Y">foo</span></ref>
26779 </references>
26780 !! wikitext/edited
26781 X <ref><span id="X">foo</span>bar</ref>
26782 Y <ref name="a" />
26783 <references>
26784 <ref name="a"><span id="Y">foo</span>baz</ref>
26785 </references>
26786 !! end
26787
26788 !! test
26789 2. DOMDiff: Changes to <ref> content should be looked up using id
26790 !! options
26791 parsoid={
26792 "modes": ["selser"],
26793 "changes": [
26794 ["#Z", "after", "bar"]
26795 ]
26796 }
26797 !! wikitext
26798 A <ref>foo bar for a</ref>
26799 B <ref group="X" name="b" />
26800
26801 <references />
26802
26803 <references group="X">
26804 <ref name="b"><span id="Z">foo</span></ref>
26805 </references>
26806 !! wikitext/edited
26807 A <ref>foo bar for a</ref>
26808 B <ref group="X" name="b" />
26809
26810 <references />
26811
26812 <references group="X">
26813 <ref name="b"><span id="Z">foo</span>bar</ref>
26814 </references>
26815 !! end
26816
26817 !! test
26818 Empty LI (T49673)
26819 !! wikitext
26820 * a
26821 *
26822 *
26823 * b
26824 !! html/php+tidy
26825 <ul>
26826 <li>a</li>
26827 <li class="mw-empty-li"></li>
26828 <li class="mw-empty-li"></li>
26829 <li>b</li>
26830 </ul>
26831 !! end