Sync up with Parsoid parserTests.
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
1 # MediaWiki Parser test cases
2 # Some taken from http://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
4 #
5 # The syntax should be fairly self-explanatory.
6 #
7 # Currently supported test options:
8 # One of the following three:
9 #
10 # (default) generate HTML output
11 # pst apply pre-save transform
12 # msg apply message transform
13 #
14 # Plus any combination of these:
15 #
16 # cat add category links
17 # (ignored by Parsoid, since it emits <link>s)
18 # ill add inter-language links
19 # (ignored by Parsoid, since it emits <link>s)
20 # subpage enable subpages (disabled by default)
21 # noxml don't check for XML well-formedness
22 # title=[[XXX]] run test using article title XXX
23 # language=XXX set content language to XXX for this test
24 # variant=XXX set the variant of language for this test (eg zh-tw)
25 # disabled do not run test
26 # parsoid parsoid-specific options (not run by PHP parser unless
27 # the test includes an html/php section)
28 # php php-only test (not run by the parsoid parser unless
29 # the test includes an html/parsoid section)
30 # showtitle make the first line the title
31 # showindicators make the first lines the page status indicators
32 # comment run through Linker::formatComment() instead of main parser
33 # local format section links in edit comment text as local links
34 # notoc disable table of contents
35 # thumbsize=NNN set the default thumb size to NNNpx for this test
36 #
37 # You can also set the following parser properties via test options:
38 # wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
39 # wgLinkHolderBatchSize, wgRawHtml
40 #
41 # For testing purposes, temporary articles can created:
42 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
43 # where '/' denotes a newline.
44
45 # This is the standard article assumed to exist.
46 !! article
47 Main Page
48 !! text
49 blah blah
50 !! endarticle
51
52 !!article
53 Foo
54 !!text
55 FOO
56 !!endarticle
57
58 !!article
59 Template:Foo
60 !!text
61 FOO
62 !!endarticle
63
64 !! article
65 Template:Blank
66 !! text
67 !! endarticle
68
69 !! article
70 Template:pipe
71 !! text
72 |
73 !! endarticle
74
75 !! article
76 Template:=
77 !! text
78 <nowiki>=</nowiki>
79 !! endarticle
80
81 !!article
82 MediaWiki:bad image list
83 !!text
84 * [[File:Bad.jpg]] except [[Nasty page]]
85 !!endarticle
86
87 !! article
88 Template:inner list
89 !! text
90 * item 1
91 !! endarticle
92
93 !! article
94 Template:tbl-start
95 !! text
96 {|
97 !! endarticle
98
99 !! article
100 Template:tbl-end
101 !! text
102 |}
103 !! endarticle
104
105 !! article
106 Template:echo
107 !! text
108 {{{1}}}
109 !! endarticle
110
111 !! article
112 Template:echo_with_span
113 !! text
114 <span>{{{1}}}</span>
115 !! endarticle
116
117 !! article
118 Template:echo_with_div
119 !! text
120 <div>{{{1}}}</div>
121 !! endarticle
122
123 !! article
124 Template:blank_param
125 !! text
126 {{{1}}}
127 {{{}}}
128 !! endarticle
129
130 !! article
131 Template:table_attribs
132 !! text
133 <noinclude>
134 |</noinclude>style="color:red;"|Foo
135 !! endarticle
136
137 !! article
138 Template:table_attribs_2
139 !! text
140 <noinclude>
141 |</noinclude>style="color:red;"|Foo
142 |Bar||Baz
143 !! endarticle
144
145 !! article
146 Template:table_attribs_3
147 !! text
148 <noinclude>
149 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo
150 !! endarticle
151
152 !! article
153 Template:table_attribs_4
154 !! text
155 | style="background-color:#DC241f;" width="10px" |
156 !! endarticle
157
158 !! article
159 Template:table_attribs_5
160 !! text
161 <noinclude>
162 |</noinclude>style="color:red;"||Bar
163 !! endarticle
164
165 !! article
166 Template:table_attribs_6
167 !! text
168 style="background: <nowiki>
169
170
171 red;</nowiki>" |
172 !! endarticle
173
174 !! article
175 Template:table_attribs_7
176 !! text
177 <noinclude>
178 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo<ref>foo</ref>
179 !! endarticle
180
181 !! article
182 Template:table_header_cells
183 !! text
184 {{table_attribs}}!!style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
185 !! endarticle
186
187 !! article
188 Template:table_cells
189 !! text
190 {{table_attribs}}||style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
191 !! endarticle
192
193 !! article
194 Template:PartialTable
195 !! text
196 {|
197 |-
198 !! endarticle
199
200 !! article
201 Template:image_attribs
202 !! text
203 <noinclude>
204 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
205 !! endarticle
206
207 ## See T48811 for details
208 !! article
209 Template:mixed_attr_content_template
210 !! text
211 style="color:red;" title="T48811"
212 |-
213 |foo
214 !! endarticle
215
216 !! article
217 Template:definition_list
218 !! text
219 one
220 ::two
221 !! endarticle
222
223 !! article
224 A?b
225 !! text
226 Weirdo titles!
227 !! endarticle
228
229 !!article
230 Template:Bullet
231 !!text
232 * Bar
233 !!endarticle
234
235 !!article
236 Template:OpenTable
237 !!text
238 {|
239 !!endarticle
240
241 !!article
242 Template:EmptyLITest
243 !!text
244 *a
245 *
246 *
247 *b
248 !!endarticle
249
250 !!article
251 Template:EmptyTRTest
252 !!text
253 {|
254 |-
255 |-
256 |foo
257 |-
258 |-
259 |bar
260 |}
261 !!endarticle
262
263 !!article
264 Template:EmptyTRWithHTMLAttrTest
265 !!text
266 <table>
267 <tr align="center"></tr>
268 <tr><td>foo</td></tr>
269 <tr align="center"></tr>
270 <tr><td>bar</td></tr>
271 </table>
272 !!endarticle
273
274 ###
275 ### Basic tests
276 ###
277 !! test
278 Blank input
279 !! wikitext
280 !! html
281 !! end
282
283
284 !! test
285 Simple paragraph
286 !! wikitext
287 This is a simple paragraph.
288 !! html
289 <p>This is a simple paragraph.
290 </p>
291 !! end
292
293 !! test
294 Paragraphs with extra newline spacing
295 !! wikitext
296 foo
297
298 bar
299
300
301 baz
302
303
304
305 booz
306 !! html
307 <p>foo
308 </p><p>bar
309 </p><p><br />
310 baz
311 </p><p><br />
312 </p><p>booz
313 </p>
314 !! end
315
316 !! test
317 Paragraphs with newline spacing with comment lines in between
318 !! wikitext
319 ----
320 a
321 <!--foo-->
322 b
323 ----
324 a
325 <!--foo--><!--More than 1 comment, still stripped-->
326 b
327 ----
328 a
329 <!--foo--> <!----> <!-- bar -->
330 b
331 ----
332 a
333 <!--foo-->
334
335 b
336 ----
337 a
338
339 <!--foo-->
340 b
341 ----
342 a
343 <!--foo-->
344
345
346 b
347 ----
348 a
349
350
351 <!--foo-->
352 b
353 ----
354 !! html
355 <hr />
356 <p>a
357 b
358 </p>
359 <hr />
360 <p>a
361 b
362 </p>
363 <hr />
364 <p>a
365 b
366 </p>
367 <hr />
368 <p>a
369 </p><p>b
370 </p>
371 <hr />
372 <p>a
373 </p><p>b
374 </p>
375 <hr />
376 <p>a
377 </p><p><br />
378 b
379 </p>
380 <hr />
381 <p>a
382 </p><p><br />
383 b
384 </p>
385 <hr />
386
387 !! end
388
389 !! test
390 Paragraphs with newline spacing with non-empty white-space lines in between
391 !! wikitext
392 ----
393 a
394
395 b
396 ----
397 a
398
399
400 b
401 ----
402 !! html
403 <hr />
404 <p>a
405 </p><p>b
406 </p>
407 <hr />
408 <p>a
409 </p><p><br />
410 b
411 </p>
412 <hr />
413
414 !! end
415
416 !! test
417 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
418 !! wikitext
419 ----
420 a
421 <!--foo-->
422 b
423 ----
424 a
425 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
426 b
427 ----
428 a
429
430 <!--foo-->
431 <!--bar-->
432 b
433 ----
434 a
435
436 <!--foo-->
437 <!--bar-->
438
439 b
440 ----
441 !! html
442 <hr />
443 <p>a
444 b
445 </p>
446 <hr />
447 <p>a
448 b
449 </p>
450 <hr />
451 <p>a
452 </p><p>b
453 </p>
454 <hr />
455 <p>a
456 </p><p><br />
457 b
458 </p>
459 <hr />
460
461 !! end
462
463 !! test
464 Extra newlines: More paragraphs with indented comment
465 !! wikitext
466 a
467
468 <!--boo-->
469
470 b
471 !! html
472 <p>a
473 </p><p><br />
474 b
475 </p>
476 !!end
477
478 !! test
479 Extra newlines followed by heading
480 !! wikitext
481 a
482
483
484
485 =b=
486 [[a]]
487
488
489 =b=
490 !! html
491 <p>a
492 </p><p><br />
493 </p>
494 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
495 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
496 </p><p><br />
497 </p>
498 <h1><span class="mw-headline" id="b_2">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
499
500 !! end
501
502 !! test
503 Extra newlines between heading and content are swallowed
504 !! wikitext
505 =b=
506
507
508
509 [[a]]
510 !! html
511 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
512 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
513 </p>
514 !! end
515
516 !! test
517 Parsing an URL
518 !! wikitext
519 http://fr.wikipedia.org/wiki/🍺
520 <!-- EasterEgg we love beer, better be able be able to link to it -->
521 !! html
522 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
523 </p>
524 !! end
525
526 # Note that the html+tidy output removes the spaces after the <li>,
527 # which is a bug (http://sourceforge.net/p/tidy/bugs/945/, etc).
528 # This is an issue for all tests with lists. We intentionally do
529 # *not* add html+tidy clauses for these, as we don't want to
530 # document/test the broken behavior. (Parsoid matches the non-tidy
531 # output in these cases.)
532
533 !! test
534 Simple list
535 !! wikitext
536 * Item 1
537 * Item 2
538 !! html
539 <ul><li> Item 1</li>
540 <li> Item 2</li></ul>
541
542 !! end
543
544 !! test
545 Italics and bold
546 !! wikitext
547 * plain
548 * plain''italic''plain
549 * plain''italic''plain''italic''plain
550 * plain'''bold'''plain
551 * plain'''bold'''plain'''bold'''plain
552 * plain''italic''plain'''bold'''plain
553 * plain'''bold'''plain''italic''plain
554 * plain''italic'''bold-italic'''italic''plain
555 * plain'''bold''bold-italic''bold'''plain
556 * plain'''''bold-italic'''italic''plain
557 * plain'''''bold-italic''bold'''plain
558 * plain''italic'''bold-italic'''''plain
559 * plain'''bold''bold-italic'''''plain
560 * plain l'''italic''plain
561 * plain l''''bold''' plain
562 !! html
563 <ul><li> plain</li>
564 <li> plain<i>italic</i>plain</li>
565 <li> plain<i>italic</i>plain<i>italic</i>plain</li>
566 <li> plain<b>bold</b>plain</li>
567 <li> plain<b>bold</b>plain<b>bold</b>plain</li>
568 <li> plain<i>italic</i>plain<b>bold</b>plain</li>
569 <li> plain<b>bold</b>plain<i>italic</i>plain</li>
570 <li> plain<i>italic<b>bold-italic</b>italic</i>plain</li>
571 <li> plain<b>bold<i>bold-italic</i>bold</b>plain</li>
572 <li> plain<i><b>bold-italic</b>italic</i>plain</li>
573 <li> plain<b><i>bold-italic</i>bold</b>plain</li>
574 <li> plain<i>italic<b>bold-italic</b></i>plain</li>
575 <li> plain<b>bold<i>bold-italic</i></b>plain</li>
576 <li> plain l'<i>italic</i>plain</li>
577 <li> plain l'<b>bold</b> plain</li></ul>
578
579 !! end
580
581 # this example taken from the [[simple:Moon]] article (bug 47326)
582 !! test
583 Italics and possessives (1)
584 !! wikitext
585 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
586 !! html
587 <p>obtained by <i><a href="/index.php?title=Lunar_Prospector&amp;action=edit&amp;redlink=1" class="new" title="Lunar Prospector (page does not exist)">Lunar Prospector</a>'</i>s gamma-ray spectrometer
588 </p>
589 !! end
590
591 # this example taken from [[en:Flaming Pie]] (bug 49926)
592 !! test
593 Italics and possessives (2)
594 !! wikitext
595 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
596 !! html
597 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
598 </p>
599 !! end
600
601 # this example taken from [[en:Dictionary]] (bug 49926)
602 !! test
603 Italics and possessives (3)
604 !! wikitext
605 The first monolingual dictionary written in a Romance language was ''Sebastián Covarrubias''' ''Tesoro de la lengua castellana o española'', published in 1611 in Madrid. In 1612 the first edition of the ''Vocabolario dell'[[Accademia della Crusca]]'', for Italian, was published. In 1690 in Rotterdam was published, posthumously, the ''Dictionnaire Universel''.
606 !! html
607 <p>The first monolingual dictionary written in a Romance language was <i>Sebastián Covarrubias'</i> <i>Tesoro de la lengua castellana o española</i>, published in 1611 in Madrid. In 1612 the first edition of the <i>Vocabolario dell'<a href="/index.php?title=Accademia_della_Crusca&amp;action=edit&amp;redlink=1" class="new" title="Accademia della Crusca (page does not exist)">Accademia della Crusca</a></i>, for Italian, was published. In 1690 in Rotterdam was published, posthumously, the <i>Dictionnaire Universel</i>.
608 </p>
609 !! end
610
611
612 ###
613 ### 2-quote opening sequence tests
614 ###
615 !! test
616 Italics and bold: 2-quote opening sequence: (2,2)
617 !! wikitext
618 ''foo''
619 !! html
620 <p><i>foo</i>
621 </p>
622 !!end
623
624 !! test
625 Italics and bold: 2-quote opening sequence: (2,3)
626 !! wikitext
627 ''foo'''
628 !! html/*
629 <p><i>foo'</i>
630 </p>
631 !!end
632
633 !! test
634 Italics and bold: 2-quote opening sequence: (2,4)
635 !! options
636 parsoid=wt2html
637 !! wikitext
638 ''foo''''
639 !! html/*
640 <p><i>foo''</i>
641 </p>
642 !!end
643
644 # same html as previous, but wikitext adjusted to match parsoid html2wt
645 !! test
646 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
647 !! wikitext
648 ''foo<nowiki>''</nowiki>''
649 !! html
650 <p><i>foo''</i>
651 </p>
652 !! end
653
654 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
655 !! test
656 Italics and bold: 2-quote opening sequence: (2,5)
657 !! options
658 parsoid=wt2html
659 !! wikitext
660 ''foo'''''
661 !! html/php
662 <p><i>foo</i>
663 </p>
664 !! html/parsoid
665 <p><i>foo</i><b></b>
666 </p>
667 !!end
668
669 # same html as previous, but wikitext adjusted to match parsoid html2wt
670 !! test
671 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
672 !! wikitext
673 ''foo'''''<nowiki/>'''
674 !! html/php
675 <p><i>foo</i>
676 </p>
677 !! html/parsoid
678 <p><i>foo</i><b></b>
679 </p>
680 !! end
681
682
683 ###
684 ### 3-quote opening sequence tests
685 ###
686
687 !! test
688 Italics and bold: 3-quote opening sequence: (3,2)
689 !! wikitext
690 '''foo''
691 !! html/*
692 <p>'<i>foo</i>
693 </p>
694 !!end
695
696 !! test
697 Italics and bold: 3-quote opening sequence: (3,3)
698 !! wikitext
699 '''foo'''
700 !! html
701 <p><b>foo</b>
702 </p>
703 !!end
704
705 !! test
706 Italics and bold: 3-quote opening sequence: (3,4)
707 !! wikitext
708 '''foo''''
709 !! html/*
710 <p><b>foo'</b>
711 </p>
712 !!end
713
714 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
715 !! test
716 Italics and bold: 3-quote opening sequence: (3,5)
717 !! options
718 parsoid=wt2html
719 !! wikitext
720 '''foo'''''
721 !! html/php
722 <p><b>foo</b>
723 </p>
724 !! html/parsoid
725 <p><b>foo</b><i></i>
726 </p>
727 !!end
728
729 # same html as previous, but wikitext adjusted to match parsoid html2wt
730 !! test
731 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
732 !! wikitext
733 '''foo'''''<nowiki/>''
734 !! html/php
735 <p><b>foo</b>
736 </p>
737 !! html/parsoid
738 <p><b>foo</b><i></i>
739 </p>
740 !! end
741
742
743 ###
744 ### 4-quote opening sequence tests
745 ###
746
747 !! test
748 Italics and bold: 4-quote opening sequence: (4,2)
749 !! options
750 parsoid=wt2html
751 !! wikitext
752 ''''foo''
753 !! html/*
754 <p>''<i>foo</i>
755 </p>
756 !!end
757
758 # same html as previous, but wikitext adjusted to match parsoid html2wt
759 !! test
760 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
761 !! wikitext
762 <nowiki>''</nowiki>''foo''
763 !! html
764 <p>''<i>foo</i>
765 </p>
766 !! end
767
768 !! test
769 Italics and bold: 4-quote opening sequence: (4,3)
770 !! wikitext
771 ''''foo'''
772 !! html/*
773 <p>'<b>foo</b>
774 </p>
775 !!end
776
777 !! test
778 Italics and bold: 4-quote opening sequence: (4,4)
779 !! options
780 parsoid=wt2html
781 !! wikitext
782 ''''foo''''
783 !! html/*
784 <p>'<b>foo'</b>
785 </p>
786 !!end
787
788 # same html as previous, but wikitext adjusted to match parsoid html2wt
789 !! test
790 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
791 !! wikitext
792 '<nowiki/>'''foo''''
793 !! html
794 <p>'<b>foo'</b>
795 </p>
796 !! end
797
798 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
799 !! test
800 Italics and bold: 4-quote opening sequence: (4,5)
801 !! options
802 parsoid=wt2html
803 !! wikitext
804 ''''foo'''''
805 !! html/php
806 <p>'<b>foo</b>
807 </p>
808 !! html/parsoid
809 <p>'<b>foo</b><i></i>
810 </p>
811 !!end
812
813 # same html as previous, but wikitext adjusted to match parsoid html2wt
814 !! test
815 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
816 !! wikitext
817 '<nowiki/>'''foo'''''<nowiki/>''
818 !! html/php
819 <p>'<b>foo</b>
820 </p>
821 !! html/parsoid
822 <p>'<b>foo</b><i></i>
823 </p>
824 !! end
825
826
827 ###
828 ### 5-quote opening sequence tests
829 ###
830
831 !! test
832 Italics and bold: 5-quote opening sequence: (5,2)
833 !! options
834 parsoid=wt2html
835 !! wikitext
836 '''''foo''
837 !! html/*
838 <p><b><i>foo</i></b>
839 </p>
840 !!end
841
842 # same html as previous, but wikitext adjusted to match parsoid html2wt
843 !! test
844 Italics and bold: 5-quote opening sequence: (5,2+3)
845 !! wikitext
846 '''''foo'''''
847 !! html/*
848 <p><i><b>foo</b></i>
849 </p>
850 !! end
851
852 !! test
853 Italics and bold: 5-quote opening sequence: (5,3)
854 !! options
855 parsoid=wt2html
856 !! wikitext
857 '''''foo'''
858 !! html/*
859 <p><i><b>foo</b></i>
860 </p>
861 !!end
862
863 # same html as previous, but wikitext adjusted to match parsoid html2wt
864 !! test
865 Italics and bold: 5-quote opening sequence: (5,3+2)
866 !! wikitext
867 '''''foo'''''
868 !! html
869 <p><i><b>foo</b></i>
870 </p>
871 !! end
872
873 !! test
874 Italics and bold: 5-quote opening sequence: (5,4)
875 !! options
876 parsoid=wt2html
877 !! wikitext
878 '''''foo''''
879 !! html/*
880 <p><i><b>foo'</b></i>
881 </p>
882 !!end
883
884 !! test
885 Italics and bold: 5-quote opening sequence: (5,5)
886 !! wikitext
887 '''''foo'''''
888 !! html
889 <p><i><b>foo</b></i>
890 </p>
891 !!end
892
893 !! test
894 Italics and bold: 5-quote opening sequence: (5,6)
895 !! wikitext
896 '''''foo''''''
897 !! html/*
898 <p><i><b>foo'</b></i>
899 </p>
900 !! end
901
902 ###
903 ### multiple quote sequences in a line
904 ###
905 !! test
906 Italics and bold: multiple quote sequences: (2,4,2)
907 !! options
908 parsoid=wt2html
909 !! wikitext
910 ''foo''''bar''
911 !! html/*
912 <p><i>foo'<b>bar</b></i>
913 </p>
914 !!end
915
916
917 # same html as previous, but wikitext adjusted to match parsoid html2wt
918 !! test
919 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
920 !! wikitext
921 ''foo'<nowiki/>'''bar'''''
922 !! html
923 <p><i>foo'<b>bar</b></i>
924 </p>
925 !! end
926
927
928 !! test
929 Italics and bold: multiple quote sequences: (2,4,3)
930 !! options
931 parsoid=wt2html
932 !! wikitext
933 ''foo''''bar'''
934 !! html/*
935 <p><i>foo'<b>bar</b></i>
936 </p>
937 !!end
938
939
940 # same html as previous, but wikitext adjusted to match parsoid html2wt
941 !! test
942 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
943 !! wikitext
944 ''foo'<nowiki/>'''bar'''''
945 !! html
946 <p><i>foo'<b>bar</b></i>
947 </p>
948 !! end
949
950
951 !! test
952 Italics and bold: multiple quote sequences: (2,4,4)
953 !! options
954 parsoid=wt2html
955 !! wikitext
956 ''foo''''bar''''
957 !! html/*
958 <p><i>foo'<b>bar'</b></i>
959 </p>
960 !!end
961
962
963 # same html as previous, but wikitext adjusted to match parsoid html2wt
964 !! test
965 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
966 !! wikitext
967 ''foo'<nowiki/>'''bar'<nowiki/>'''''
968 !! html
969 <p><i>foo'<b>bar'</b></i>
970 </p>
971 !! end
972
973
974 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
975 !! test
976 Italics and bold: multiple quote sequences: (3,4,2)
977 !! options
978 parsoid=wt2html
979 !! wikitext
980 '''foo''''bar''
981 !! html/php
982 <p><b>foo'</b>bar
983 </p>
984 !! html/parsoid
985 <p><b>foo'</b>bar<i></i>
986 </p>
987 !!end
988
989 # same html as previous, but wikitext adjusted to match parsoid html2wt
990 !! test
991 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
992 !! options
993 parsoid
994 !! wikitext
995 '''<nowiki>foo'</nowiki>'''bar''<nowiki/>''
996 !! html/php
997 <p><b>foo'</b>bar
998 </p>
999 !! html/parsoid
1000 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<i></i>
1001 </p>
1002 !! end
1003
1004
1005 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1006 !! test
1007 Italics and bold: multiple quote sequences: (3,4,3)
1008 !! options
1009 parsoid=wt2html
1010 !! wikitext
1011 '''foo''''bar'''
1012 !! html/php
1013 <p><b>foo'</b>bar
1014 </p>
1015 !! html/parsoid
1016 <p><b>foo'</b>bar<b></b>
1017 </p>
1018 !!end
1019
1020 # same html as previous, but wikitext adjusted to match parsoid html2wt
1021 !! test
1022 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
1023 !! wikitext
1024 '''<nowiki>foo'</nowiki>'''bar'''<nowiki/>'''
1025 !! html/php
1026 <p><b>foo'</b>bar
1027 </p>
1028 !! html/parsoid
1029 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<b></b>
1030 </p>
1031 !! end
1032
1033 ###
1034 ### other quote tests
1035 ###
1036 !! test
1037 Italics and bold: other quote tests: (2,3,5)
1038 !! wikitext
1039 ''this is about '''foo's family'''''
1040 !! html
1041 <p><i>this is about <b>foo's family</b></i>
1042 </p>
1043 !!end
1044
1045
1046 !! test
1047 Italics and bold: other quote tests: (2,(3,3),2)
1048 !! wikitext
1049 ''this is about '''foo's''' family''
1050 !! html
1051 <p><i>this is about <b>foo's</b> family</i>
1052 </p>
1053 !!end
1054
1055
1056 !! test
1057 Italics and bold: other quote tests: (3,2,3,2)
1058 !! options
1059 parsoid=wt2html
1060 !! wikitext
1061 '''this is about ''foo'''s family''
1062 !! html/*
1063 <p><b>this is about <i>foo</i></b><i>s family</i>
1064 </p>
1065 !!end
1066
1067
1068 # same html as previous, but wikitext adjusted to match parsoid html2wt
1069 !! test
1070 Italics and bold: other quote tests: (3,2,3+2+2,2)
1071 !! wikitext
1072 '''this is about ''foo'''''<nowiki/>''s family''
1073 !! html
1074 <p><b>this is about <i>foo</i></b><i>s family</i>
1075 </p>
1076 !! end
1077
1078
1079 !! test
1080 Italics and bold: other quote tests: (3,2,3,3)
1081 !! wikitext
1082 '''this is about ''foo'''s family'''
1083 !! html/*
1084 <p>'<i>this is about </i>foo<b>s family</b>
1085 </p>
1086 !!end
1087
1088
1089 !! test
1090 Italics and bold: other quote tests: (3,(2,2),3)
1091 !! wikitext
1092 '''this is about ''foo's'' family'''
1093 !! html
1094 <p><b>this is about <i>foo's</i> family</b>
1095 </p>
1096 !!end
1097
1098
1099 !! test
1100 Italicized possessive
1101 !! wikitext
1102 The ''[[Main Page]]'''s talk page.
1103 !! html/php
1104 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1105 </p>
1106 !! html/parsoid
1107 <p>The <i><a rel="mw:WikiLink" href="Main_Page" title="Main Page">Main Page</a>'</i>s talk page.</p>
1108 !! end
1109
1110 !! test
1111 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
1112 (Requires tidy for PHP parser output to be fixed up)
1113 !! options
1114 parsoid=wt2html,wt2wt
1115 !! wikitext
1116 {|
1117 !''a!!''b
1118 |''a||''b
1119 |}
1120 !! html/php+tidy
1121 <table>
1122 <tr>
1123 <th><i>a</i></th>
1124 <th><i>b</i></th>
1125 <td><i>a</i></td>
1126 <td><i>b</i></td>
1127 </tr>
1128 </table>
1129 !! html/parsoid
1130 <table>
1131 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
1132 <td><i>a</i></td><td><i>b</i></td></tr>
1133 </tbody></table>
1134 !! end
1135
1136 ###
1137 ### Non-html5 tags
1138 ###
1139
1140 !! test
1141 Non-html5 tags should be accepted
1142 !! wikitext
1143 <center>''foo''</center>
1144 <big>''foo''</big>
1145 <font>''foo''</font>
1146 <strike>''foo''</strike>
1147 <tt>''foo''</tt>
1148 !! html
1149 <center><i>foo</i></center>
1150 <p><big><i>foo</i></big>
1151 <font><i>foo</i></font>
1152 <strike><i>foo</i></strike>
1153 <tt><i>foo</i></tt>
1154 </p>
1155 !! end
1156
1157 !! test
1158 <wbr> is valid wikitext (bug 52468)
1159 !! wikitext
1160 <wbr>
1161 !! html
1162 <p><wbr />
1163 </p>
1164 !! end
1165
1166 # <strike> is HTML4, <s> is HTML4/5.
1167 !! test
1168 <s> or <strike> for strikethrough
1169 !! wikitext
1170 <strike>strike</strike>
1171
1172 <s>s</s>
1173 !! html
1174 <p><strike>strike</strike>
1175 </p><p><s>s</s>
1176 </p>
1177 !! end
1178
1179 ## a not permitted
1180 ## i,b,br omitted
1181 !! test
1182 Text-level semantic html elements in wikitext
1183 !! wikitext
1184 <em>text</em>
1185 <strong>text</strong>
1186 <small>text</small>
1187 <s>text</s>
1188 <cite>text</cite>
1189 <q>text</q>
1190 <dfn>text</dfn>
1191 <abbr>text</abbr>
1192 <data>text</data>
1193 <time>text</time>
1194 <code>text</code>
1195 <var>text</var>
1196 <samp>text</samp>
1197 <kbd>text</kbd>
1198 <sub>text</sub>
1199 <u>text</u>
1200 <mark>text</mark>
1201 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1202 <bdi>text</bdi>
1203 <bdo>text</bdo>
1204 <span>text</span>
1205 <wbr />
1206 !! html
1207 <p><em>text</em>
1208 <strong>text</strong>
1209 <small>text</small>
1210 <s>text</s>
1211 <cite>text</cite>
1212 <q>text</q>
1213 <dfn>text</dfn>
1214 <abbr>text</abbr>
1215 <data>text</data>
1216 <time>text</time>
1217 <code>text</code>
1218 <var>text</var>
1219 <samp>text</samp>
1220 <kbd>text</kbd>
1221 <sub>text</sub>
1222 <u>text</u>
1223 <mark>text</mark>
1224 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1225 <bdi>text</bdi>
1226 <bdo>text</bdo>
1227 <span>text</span>
1228 <wbr />
1229 </p>
1230 !! end
1231
1232 # test cases taken from
1233 # http://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
1234 !! test
1235 Ruby markup (W3C-style)
1236 !! wikitext
1237 ; Mono-ruby for individual base characters
1238 : <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
1239 ; Group ruby
1240 : <ruby>今日<rt>きょう</rt></ruby>
1241 ; Jukugo ruby
1242 : <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
1243 ; Inline ruby
1244 : <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
1245 ; Double-sided ruby
1246 : <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
1247 <ruby>
1248 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1249 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1250 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1251 </ruby>
1252 !! html
1253 <dl><dt> Mono-ruby for individual base characters</dt>
1254 <dd> <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1255 <dt> Group ruby</dt>
1256 <dd> <ruby>今日<rt>きょう</rt></ruby></dd>
1257 <dt> Jukugo ruby</dt>
1258 <dd> <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1259 <dt> Inline ruby</dt>
1260 <dd> <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1261 <dt> Double-sided ruby</dt>
1262 <dd> <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby></dd></dl>
1263 <p><ruby>
1264 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1265 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1266 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1267 </ruby>
1268 </p>
1269 !! end
1270
1271 # The next two test different paths in the sanitizer.
1272 !! test
1273 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
1274 !! wikitext
1275 <blockquote|>a</blockquote>
1276
1277 <b→> doesn't terminate </b→>
1278
1279 <bä> doesn't terminate </bä>
1280
1281 <boo> doesn't terminate </boo>
1282
1283 <s.foo> doesn't terminate </s.foo>
1284
1285 <sub-ID#1>
1286 !! html
1287 <p>&lt;blockquote|&gt;a&lt;/blockquote&gt;
1288 </p><p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1289 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1290 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1291 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1292 </p><p>&lt;sub-ID#1&gt;
1293 </p>
1294 !! end
1295
1296 # There is a tidy bug here: http://sourceforge.net/p/tidy/bugs/946/
1297 # If the non-word-character tag made it through the sanitizer, tidy
1298 # would munge it up.
1299 !! test
1300 Non-word characters don't terminate tag names + tidy
1301 !! wikitext
1302 <blockquote|>a</blockquote>
1303
1304 <b→> doesn't terminate </b→>
1305
1306 <bä> doesn't terminate </bä>
1307
1308 <boo> doesn't terminate </boo>
1309
1310 <s.foo> doesn't terminate </s.foo>
1311
1312 <sub-ID#1>
1313 !! html+tidy
1314 <p>&lt;blockquote|&gt;a</p>
1315 <p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;</p>
1316 <p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;</p>
1317 <p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;</p>
1318 <p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;</p>
1319 <p>&lt;sub-ID#1&gt;</p>
1320 !! end
1321
1322 ###
1323 ### See tests/parser/parserTestsParserHook.php for the <tåg> extension)
1324 ### This checks that HTML5 tags (with non-word characters in the tag
1325 ### name) make it safely through the parser -- the Sanitizer will
1326 ### munge them later, as it should.
1327 ###
1328 !! test
1329 Non-word characters are valid in extension tags (T19663)
1330 !! wikitext
1331 <tåg>tåg</tåg>
1332 !! html/php
1333 <pre>
1334 'tåg'
1335 array (
1336 )
1337 </pre>
1338
1339 !! html/parsoid
1340 <pre typeof="mw:Extension/tåg" data-mw='{"name":"tåg","attrs":{},"body":{"extsrc":"tåg"}}' data-parsoid='{}' about="#mwt2"></pre>
1341 !! end
1342
1343 !! test
1344 Isolated close tags should be treated as literal text (bug 52760)
1345 !! options
1346 parsoid=wt2html
1347 !! wikitext
1348 </b>
1349
1350 <s.foo>s</s>
1351 !! html/php+tidy
1352 <p>&lt;s.foo&gt;s</p>
1353 !! html/parsoid
1354 <p>&lt;s.foo&gt;s</p>
1355 !! end
1356
1357 ###
1358 ### Special characters
1359 ###
1360
1361 !! test
1362 Bare pipe character (bug 52363)
1363 !! wikitext
1364 |
1365 !! html
1366 <p>|
1367 </p>
1368 !! end
1369
1370 !! test
1371 Bare pipe character from a template (bug 52363)
1372 !! wikitext
1373 {{pipe}}
1374 !! html
1375 <p>|
1376 </p>
1377 !! end
1378
1379 ###
1380 ### <nowiki> test cases
1381 ###
1382
1383 !! test
1384 <nowiki> unordered list
1385 !! wikitext
1386 <nowiki>* This is not an unordered list item.</nowiki>
1387 !! html/php
1388 <p>* This is not an unordered list item.
1389 </p>
1390 !! html/parsoid
1391 <p><span typeof="mw:Nowiki">* This is not an unordered list item.</span></p>
1392 !! end
1393
1394 !! test
1395 <nowiki> spacing
1396 !! wikitext
1397 <nowiki>Lorem ipsum dolor
1398
1399 sed abit.
1400 sed nullum.
1401
1402 :and a colon
1403 </nowiki>
1404 !! html/php
1405 <p>Lorem ipsum dolor
1406
1407 sed abit.
1408 sed nullum.
1409
1410 :and a colon
1411
1412 </p>
1413 !! html/parsoid
1414 <p><span typeof="mw:Nowiki">Lorem ipsum dolor
1415
1416 sed abit.
1417 sed nullum.
1418
1419 :and a colon
1420 </span></p>
1421 !! end
1422
1423 !! test
1424 nowiki 3
1425 !! wikitext
1426 :There is not nowiki.
1427 :There is <nowiki>nowiki</nowiki>.
1428
1429 #There is not nowiki.
1430 #There is <nowiki>nowiki</nowiki>.
1431
1432 *There is not nowiki.
1433 *There is <nowiki>nowiki</nowiki>.
1434 !! html/php
1435 <dl><dd>There is not nowiki.</dd>
1436 <dd>There is nowiki.</dd></dl>
1437 <ol><li>There is not nowiki.</li>
1438 <li>There is nowiki.</li></ol>
1439 <ul><li>There is not nowiki.</li>
1440 <li>There is nowiki.</li></ul>
1441
1442 !! html/parsoid
1443 <dl><dd data-parsoid='{}'>There is not nowiki.</dd>
1444 <dd data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</dd></dl>
1445
1446 <ol><li data-parsoid='{}'>There is not nowiki.</li>
1447 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ol>
1448
1449 <ul><li data-parsoid='{}'>There is not nowiki.</li>
1450 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ul>
1451 !! end
1452
1453 !! test
1454 Entities inside <nowiki>
1455 !! wikitext
1456 <nowiki>&lt;</nowiki>
1457 !! html
1458 <p>&lt;
1459 </p>
1460 !! end
1461
1462 !! test
1463 Entities inside template parameters
1464 !! wikitext
1465 {{echo|&ndash;}}
1466 !! html/php+tidy
1467 <p>–</p>
1468 !! html/parsoid
1469 <p><span typeof="mw:Transclusion mw:Entity" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&amp;ndash;"}},"i":0}}]}'>&ndash;</span></p>
1470 !! end
1471
1472 !! test
1473 Properly escape nowiki when combined with other wiki markup
1474 !! options
1475 parsoid=html2wt
1476 !! html/parsoid
1477 <p>* &lt;/nowiki&gt; tag</p>
1478 !! wikitext
1479 <nowiki>*</nowiki> <nowiki>&lt;/nowiki&gt;</nowiki> tag
1480 !! end
1481
1482 !! test
1483 T93824: Put escaped HTML tags inside nowiki
1484 !! options
1485 parsoid=html2wt
1486 !! html/parsoid
1487 <p>&lt;h2&gt;foo&lt;/h2&gt;</p>
1488 !! wikitext
1489 <nowiki><h2>foo</h2></nowiki>
1490 !! end
1491
1492 !! test
1493 T71950: 1. Put nowiki as close to cause as possible, even with non-quote escapable chars
1494 !! options
1495 parsoid=html2wt
1496 !! html/parsoid
1497 <p>This text: L'<a rel="mw:WikiLink" href="./Foo">Foo</a>
1498 This text: L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1499 This text: L'''<a rel="mw:WikiLink" href="./Foo">Foo</a>''</p>
1500 !! wikitext
1501 This text: L'[[Foo]]
1502 This text: L<nowiki>''</nowiki>[[Foo]]
1503 This text: L<nowiki>'''</nowiki>[[Foo]]<nowiki>''</nowiki>
1504 !! end
1505
1506 # This test fails because wikitext whitespace is not normalized before comparing.
1507 !! test
1508 T71950: 2. Put nowiki as close to cause as possible, after ' :'
1509 !! options
1510 parsoid=html2wt
1511 !! html/parsoid
1512 <p>This text : L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1513 </p>
1514 !! wikitext
1515 This text : L<nowiki>''</nowiki>[[Foo]]
1516 !! end
1517
1518 # This test and the next one are html2wt only as they test that incorrect wikitext
1519 # passed in template arguments gets escaped or wrapped in nowikis where required.
1520 !! test
1521 T71482: Use {{!}} instead of nowiki for single pipe in template argument
1522 !! options
1523 parsoid=html2wt
1524 !! html/parsoid
1525 <p><span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo|bar&quot;}},&quot;i&quot;:0}}]}" about="#mwt1"></span>
1526 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo|bar |[[&quot;}},&quot;i&quot;:0}}]}" about="#mwt2"></p>
1527 !! wikitext
1528 {{echo|foo{{!}}bar}}
1529 {{echo|<nowiki>foo|bar |[[</nowiki>}}
1530 !! end
1531
1532 !! test
1533 T53961: Output correct nowikis in template arguments
1534 !! options
1535 parsoid=html2wt
1536 !! html/parsoid
1537 <p><span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a [ b&quot;}},&quot;i&quot;:0}}]}" about="#mwt1"></span>
1538 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a }} b&quot;}},&quot;i&quot;:0}}]}" about="#mwt2"></span>
1539 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a [[ b&quot;}},&quot;i&quot;:0}}]}" about="#mwt3"></span>
1540 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a | {{ ]]&quot;}},&quot;i&quot;:0}}]}" about="#mwt4"></span>
1541 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a }&quot;}},&quot;i&quot;:0}}]}" about="#mwt5"></span></p>
1542 !! wikitext
1543 {{echo|a [ b}}
1544 {{echo|a <nowiki>}}</nowiki> b}}
1545 {{echo|<nowiki>a [[ b</nowiki>}}
1546 {{echo|a {{!}} <nowiki>{{ ]]</nowiki>}}
1547 {{echo|a <nowiki>}</nowiki>}}
1548 !! end
1549
1550 !! test
1551 Cases where "!!" needs nowiki protection
1552 !! options
1553 parsoid=html2wt
1554 !! html/parsoid
1555 <table>
1556 <tr><th>this needs protection !! here</th></tr>
1557 </table>
1558
1559 <table>
1560 <tr><th>this does not need
1561 protection !! here</th></tr>
1562 </table>
1563 !! wikitext
1564 {|
1565 !<nowiki>this needs protection !! here</nowiki>
1566 |}
1567
1568 {|
1569 !this does not need
1570 protection !! here
1571 |}
1572 !! end
1573
1574 ###
1575 ### Comments
1576 ###
1577 !! test
1578 Comments and Indent-Pre
1579 !! wikitext
1580 <!-- comment 1 --> asdf
1581
1582 <!-- comment 1 --> asdf
1583 <!-- comment 2 -->
1584
1585 <!-- comment 1 --> asdf
1586 <!-- comment 2 -->xyz
1587
1588 <!-- comment 1 --> asdf
1589 <!-- comment 2 --> xyz
1590 !! html
1591 <pre>asdf
1592 </pre>
1593 <pre>asdf
1594 </pre>
1595 <pre>asdf
1596 </pre>
1597 <p>xyz
1598 </p>
1599 <pre>asdf
1600 xyz
1601 </pre>
1602 !! end
1603
1604 !! test
1605 Comment test 2a
1606 !! wikitext
1607 asdf
1608 <!-- comment 1 -->
1609 jkl
1610 !! html
1611 <p>asdf
1612 jkl
1613 </p>
1614 !! end
1615
1616 !! test
1617 Comment test 2b
1618 !! wikitext
1619 asdf
1620 <!-- comment 1 -->
1621
1622 jkl
1623 !! html
1624 <p>asdf
1625 </p><p>jkl
1626 </p>
1627 !! end
1628
1629 !! test
1630 Comment test 3
1631 !! wikitext
1632 asdf
1633 <!-- comment 1 -->
1634 <!-- comment 2 -->
1635 jkl
1636 !! html
1637 <p>asdf
1638 jkl
1639 </p>
1640 !! end
1641
1642 !! test
1643 Comment test 4
1644 !! wikitext
1645 asdf<!-- comment 1 -->jkl
1646 !! html
1647 <p>asdfjkl
1648 </p>
1649 !! end
1650
1651 !! test
1652 Comment spacing
1653 !! wikitext
1654 a
1655 <!-- foo --> b <!-- bar -->
1656 c
1657 !! html
1658 <p>a
1659 </p>
1660 <pre> b
1661 </pre>
1662 <p>c
1663 </p>
1664 !! end
1665
1666 !! test
1667 Comment whitespace
1668 !! wikitext
1669 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1670 !! html
1671
1672 !! end
1673
1674 !! test
1675 Comment semantics and delimiters
1676 !! wikitext
1677 <!-- --><!----><!-----><!------>
1678 !! html/php
1679
1680 !! html/parsoid
1681 <!-- --><!----><!--&#x2D;--><!--&#x2D;&#x2D;-->
1682 !! end
1683
1684 !! test
1685 Comment semantics and delimiters, redux
1686 !! wikitext
1687 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1688 -- foo -- funky huh? ... -->
1689 !! html/php
1690
1691 !! html/parsoid
1692 <!-- In SGML every "foo" here would actually show up in the text &#x2D;&#x2D; foo &#x2D;&#x2D; bar
1693 &#x2D;&#x2D; foo &#x2D;&#x2D; funky huh? ... -->
1694 !! end
1695
1696 !! test
1697 Comment semantics and delimiters: directors cut
1698 !! wikitext
1699 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1700 everything starting with < followed by !-- until the first -- and > we see,
1701 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1702 -->-->
1703 !! html/php
1704 <p>--&gt;
1705 </p>
1706 !! html/parsoid
1707 <!-- ... However we like to keep things simple and somewhat XML&#x2D;ish so we eat
1708 everything starting with < followed by !&#x2D;&#x2D; until the first &#x2D;&#x2D; and &#x3E; we see,
1709 that wouldn't be valid XML however, since in XML &#x2D;&#x2D; has to terminate a comment
1710 --><p>--></p>
1711 !! end
1712
1713 !! test
1714 Comment semantics: nesting
1715 !! wikitext
1716 <!--<!-- no, we're not going to do anything fancy here -->-->
1717 !! html/php
1718 <p>--&gt;
1719 </p>
1720 !! html/parsoid
1721 <!--<!&#x2D;&#x2D; no, we're not going to do anything fancy here --><p>--></p>
1722 !! end
1723
1724 # Parsoid closes the unclosed comment, even if it means a slight
1725 # round-trip diff.
1726 !! test
1727 Comment semantics: unclosed comment at end
1728 !! options
1729 parsoid=wt2html,html2html
1730 !! wikitext
1731 <!--This comment will run out to the end of the document
1732 !! html/php
1733
1734 !! html/parsoid
1735 <!--This comment will run out to the end of the document-->
1736 !! end
1737
1738 !! test
1739 Comment semantics: normalize comments to play nice with XML and browsers
1740 !! wikitext
1741 <!-- Browsers --!> think this is closed -->
1742 <!--> This would normally be text -->
1743 <!---> As would this -->
1744 <!-- XML doesn't like trailing dashes -------->
1745 <!-- Nor doubled hyphens -- anywhere in the data -->
1746 But this is not a comment.
1747 !! html/php
1748 <p>But this is not a comment.
1749 </p>
1750 !! html/parsoid
1751 <!-- Browsers &#x2D;&#x2D;!&#x3E; think this is closed -->
1752 <!--&#x3E; This would normally be text -->
1753 <!--&#x2D;&#x3E; As would this -->
1754 <!-- XML doesn't like trailing dashes &#x2D;&#x2D;&#x2D;&#x2D;&#x2D;&#x2D;-->
1755 <!-- Nor doubled hyphens &#x2D;&#x2D; anywhere in the data -->
1756 <p>But this is not a comment.</p>
1757 !! end
1758
1759 !! test
1760 Comment semantics: round-trip even text which contains encoded -->
1761 !! wikitext
1762 <!-- hello & goodbye - > --&gt; --&amp;gt; --&xx -->
1763 !! html/parsoid
1764 <!-- hello &#x26; goodbye &#x2D; &#x3E; &#x2D;&#x2D;&#x3E; &#x2D;&#x2D;&#x26;gt; &#x2D;&#x2D;&#x26;xx -->
1765 !! end
1766
1767 !! test
1768 Comment in template title
1769 !! wikitext
1770 {{f<!---->oo}}
1771 !! html
1772 <p>FOO
1773 </p>
1774 !! end
1775
1776 !! test
1777 Comment on its own line post-expand
1778 !! wikitext
1779 a
1780 {{blank}}<!---->
1781 b
1782 !! html
1783 <p>a
1784 </p><p>b
1785 </p>
1786 !! end
1787
1788 !! test
1789 Comment on its own line post-expand with non-significant whitespace
1790 !! wikitext
1791 a
1792 {{blank}} <!---->
1793 b
1794 !! html
1795 <p>a
1796 </p><p>b
1797 </p>
1798 !! end
1799
1800 !! test
1801 Multiple comments should still parse as SOL-transparent
1802 !! options
1803 parsoid=wt2html,wt2wt
1804 !! wikitext
1805 <!--c1-->*a
1806 <!--c2--><!--c3--><!--c4-->*b
1807 !! html/php
1808 <ul><li>a</li>
1809 <li>b</li></ul>
1810
1811 !! html/parsoid
1812 <!--c1--><ul>
1813 <li>a
1814 </li>
1815 <!--c2--><!--c3--><!--c4-->
1816 <li>b
1817 </li>
1818 </ul>
1819 !! end
1820
1821 ###
1822 ### paragraph wrapping tests
1823 ###
1824 !! test
1825 No block tags
1826 !! wikitext
1827 a
1828
1829 b
1830 !! html
1831 <p>a
1832 </p><p>b
1833 </p>
1834 !! end
1835
1836 !! test
1837 Block tag on one line (<div>)
1838 !! wikitext
1839 a <div>foo</div>
1840
1841 b
1842 !! html
1843 a <div>foo</div>
1844 <p>b
1845 </p>
1846 !! html+tidy
1847 <p>a</p>
1848 <div>foo</div>
1849 <p>b</p>
1850 !! end
1851
1852 !! test
1853 Block tag on one line (<blockquote>)
1854 !! wikitext
1855 a <blockquote>foo</blockquote>
1856
1857 b
1858 !! html
1859 a <blockquote>foo</blockquote>
1860 <p>b
1861 </p>
1862 !! html+tidy
1863 <p>a</p>
1864 <blockquote>
1865 <p>foo</p>
1866 </blockquote>
1867 <p>b</p>
1868 !! end
1869
1870 !! test
1871 Block tag on both lines (<div>)
1872 !! wikitext
1873 a <div>foo</div>
1874
1875 b <div>foo</div>
1876 !! html
1877 a <div>foo</div>
1878 b <div>foo</div>
1879
1880 !! html+tidy
1881 <p>a</p>
1882 <div>foo</div>
1883 <p>b</p>
1884 <div>foo</div>
1885 !! end
1886
1887 !! test
1888 Block tag on both lines (<blockquote>)
1889 !! wikitext
1890 a <blockquote>foo</blockquote>
1891
1892 b <blockquote>foo</blockquote>
1893 !! html
1894 a <blockquote>foo</blockquote>
1895 b <blockquote>foo</blockquote>
1896
1897 !! html+tidy
1898 <p>a</p>
1899 <blockquote>
1900 <p>foo</p>
1901 </blockquote>
1902 <p>b</p>
1903 <blockquote>
1904 <p>foo</p>
1905 </blockquote>
1906 !! end
1907
1908 !! test
1909 Multiple lines without block tags
1910 !! wikitext
1911 <div>foo</div> a
1912 b
1913 c
1914 d<!--foo--> e
1915 x <div>foo</div> z
1916 !! html
1917 <div>foo</div> a
1918 <p>b
1919 c
1920 d e
1921 </p>
1922 x <div>foo</div> z
1923
1924 !! html+tidy
1925 <div>foo</div>
1926 <p>a</p>
1927 <p>b c d e</p>
1928 <p>x</p>
1929 <div>foo</div>
1930 <p>z</p>
1931 !! end
1932
1933 # Tidy strips out the empty <div> tags. Parsoid doesn't.
1934 # So, we have a separate section for Parsoid. We don't want
1935 # to mimic this stripping behavior in Parsoid. It affects
1936 # editing experience and also requires us to maintain additional
1937 # info for RT-ing.
1938 !! test
1939 Empty lines between lines with block tags
1940 !! wikitext
1941 <div></div>
1942
1943
1944 <div></div>a
1945
1946 b
1947 <div>a</div>b
1948
1949 <div>b</div>d
1950
1951
1952 <div>e</div>
1953 !! html
1954 <div></div>
1955 <p><br />
1956 </p>
1957 <div></div>a
1958 <p>b
1959 </p>
1960 <div>a</div>b
1961 <div>b</div>d
1962 <p><br />
1963 </p>
1964 <div>e</div>
1965
1966 !! html+tidy
1967 <p><br /></p>
1968 <p>a</p>
1969 <p>b</p>
1970 <div>a</div>
1971 <p>b</p>
1972 <div>b</div>
1973 <p>d</p>
1974 <p><br /></p>
1975 <div>e</div>
1976 !! html/parsoid
1977 <div data-parsoid='{"stx":"html"}'></div>
1978
1979 <p><br /></p>
1980 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
1981
1982 <p>b</p>
1983 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
1984
1985 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
1986
1987 <p><br /></p>
1988 <div data-parsoid='{"stx":"html"}'>e</div>
1989 !! end
1990
1991 ## PHP parser emits output which is broken
1992 !! test
1993 Unclosed HTML p-tags should be handled properly
1994 !! wikitext
1995 <div><p>foo</div>
1996 a
1997
1998 b
1999 !! html/php+tidy
2000 <div>
2001 <p>foo</p>
2002 </div>
2003 <p>a</p>
2004 <p>b</p>
2005 !! html/parsoid
2006 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
2007 <p>a</p>
2008 <p>b</p>
2009 !! end
2010
2011 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
2012 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
2013 ## them for now.
2014 !! test
2015 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
2016 !! options
2017 parsoid=wt2html
2018 !! wikitext
2019 a [[Category:A1]] [[Category:A2]]
2020 [[Category:A3]]
2021 [[Category:A4]]
2022 !! html/parsoid
2023 <p>a</p>
2024 <link rel="mw:PageProp/Category" href="./Category:A1"/> <link rel="mw:PageProp/Category" href="./Category:A2"/> <link rel="mw:PageProp/Category" href="./Category:A3"/> <link rel="mw:PageProp/Category" href="./Category:A4"/>
2025 !! end
2026
2027 !! test
2028 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
2029 !! options
2030 parsoid=wt2html
2031 !! wikitext
2032 [[Category:A1]]a
2033 !! html/parsoid
2034 <link rel="mw:PageProp/Category" href="./Category:A1"/><p>a</p>
2035 !! end
2036
2037 ###
2038 ### Preformatted text
2039 ###
2040 !! test
2041 Preformatted text
2042 !! wikitext
2043 This is some
2044 Preformatted text
2045 With ''italic''
2046 And '''bold'''
2047 And a [[Main Page|link]]
2048 !! html
2049 <pre>This is some
2050 Preformatted text
2051 With <i>italic</i>
2052 And <b>bold</b>
2053 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
2054 </pre>
2055 !! end
2056
2057 !! test
2058 Tabs don't trigger preformatted text
2059 !! wikitext
2060 This is not
2061 preformatted text.
2062 This is preformatted text.
2063 So is this.
2064 !! html/php
2065 <p> This is not
2066 preformatted text.
2067 </p>
2068 <pre>This is preformatted text.
2069 So is this.
2070 </pre>
2071 !! html/parsoid
2072 <p> This is not
2073 preformatted text.</p>
2074 <pre>This is preformatted text.
2075 So is this.</pre>
2076 !! end
2077
2078 !! test
2079 Space before tab needs nowiki pre protection
2080 !! options
2081 parsoid=html2wt
2082 !! html/parsoid
2083 <p> a</p>
2084 !! wikitext
2085 <nowiki> </nowiki> a
2086 !! end
2087
2088 !! test
2089 Ident preformatting with inline content
2090 !! wikitext
2091 a
2092 ''b''
2093 !! html
2094 <pre>a
2095 <i>b</i>
2096 </pre>
2097 !! end
2098
2099 !! test
2100 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
2101 !! wikitext
2102 <pre><nowiki>
2103 <b>
2104 <cite>
2105 <em>
2106 </nowiki></pre>
2107 !! html
2108 <pre>
2109 &lt;b&gt;
2110 &lt;cite&gt;
2111 &lt;em&gt;
2112 </pre>
2113
2114 !! end
2115
2116 !! test
2117 Regression with preformatted in <center>
2118 !! wikitext
2119 <center>
2120 Blah
2121 </center>
2122 !! html
2123 <center>
2124 <pre>Blah
2125 </pre>
2126 </center>
2127
2128 !! end
2129
2130 !! test
2131 Bug 52763: Preformatted in <blockquote>
2132 !! wikitext
2133 <blockquote>
2134 Blah
2135 {|
2136 |
2137 indented cell (no pre-wrapping!)
2138 |}
2139 </blockquote>
2140 !! html
2141 <blockquote>
2142 <p> Blah
2143 </p>
2144 <table>
2145 <tr>
2146 <td>
2147 <p> indented cell (no pre-wrapping!)
2148 </p>
2149 </td></tr></table>
2150 </blockquote>
2151
2152 !! end
2153
2154 !! test
2155 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
2156 !! wikitext
2157 <blockquote>
2158 Foo
2159
2160 Bar
2161 </blockquote>
2162 !! html
2163 <blockquote>
2164 <p>Foo
2165 </p><p>Bar
2166 </p>
2167 </blockquote>
2168
2169 !! end
2170
2171 !! test
2172 Bug 15491: <ins>/<del> in blockquote
2173 !! wikitext
2174 <blockquote>
2175 Foo <del>bar</del> <ins>baz</ins> quux
2176 </blockquote>
2177 !! html
2178 <blockquote>
2179 <p>Foo <del>bar</del> <ins>baz</ins> quux
2180 </p>
2181 </blockquote>
2182
2183 !! end
2184
2185 # Note that the p-wrapping is newline sensitive, which could be
2186 # considered a bug: tidy will wrap only the 'Foo' in the example
2187 # below in a <p> tag. (see comment 23-25 of bug #6200)
2188 !! test
2189 Bug 15491: <ins>/<del> in blockquote (2)
2190 !! wikitext
2191 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2192 </blockquote>
2193 !! html
2194 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2195 </blockquote>
2196
2197 !! html+tidy
2198 <blockquote>
2199 <p>Foo</p>
2200 <del>bar</del> <ins>baz</ins> quux</blockquote>
2201 !! end
2202
2203 !! test
2204 <pre> with attributes (bug 3202)
2205 !! wikitext
2206 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2207 !! html
2208 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2209
2210 !! end
2211
2212 !! test
2213 <pre> with width attribute (bug 3202)
2214 !! wikitext
2215 <pre width="8">Narrow screen goodies</pre>
2216 !! html
2217 <pre width="8">Narrow screen goodies</pre>
2218
2219 !! end
2220
2221 !! test
2222 <pre> with forbidden attribute (bug 3202)
2223 !! wikitext
2224 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
2225 !! html
2226 <pre width="8">Narrow screen goodies</pre>
2227
2228 !! end
2229
2230 !! test
2231 Entities inside <pre>
2232 !! wikitext
2233 <pre>&lt;</pre>
2234 !! html
2235 <pre>&lt;</pre>
2236
2237 !! end
2238
2239 !! test
2240 <pre> with forbidden attribute values (bug 3202)
2241 !! wikitext
2242 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
2243 !! html
2244 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
2245
2246 !! end
2247
2248 !! test
2249 <nowiki> inside <pre> (bug 13238)
2250 !! wikitext
2251 <pre>
2252 <nowiki>
2253 </pre>
2254 <pre>
2255 <nowiki></nowiki>
2256 </pre>
2257 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
2258 !! html
2259 <pre>
2260 &lt;nowiki&gt;
2261 </pre>
2262 <pre>
2263
2264 </pre>
2265 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2266
2267 !! end
2268
2269 !! test
2270 <nowiki> and <pre> preference (first one wins)
2271 !! wikitext
2272 <pre>
2273 <nowiki>
2274 </pre>
2275 </nowiki>
2276 </pre>
2277
2278 <nowiki>
2279 <pre>
2280 <nowiki>
2281 </pre>
2282 </nowiki>
2283 </pre>
2284
2285 !! html/php
2286 <pre>
2287 &lt;nowiki&gt;
2288 </pre>
2289 <p>&lt;/nowiki&gt;
2290 &lt;/pre&gt;
2291 </p><p>
2292 &lt;pre&gt;
2293 &lt;nowiki&gt;
2294 &lt;/pre&gt;
2295
2296 &lt;/pre&gt;
2297 </p>
2298 !! html/parsoid
2299 <pre data-parsoid='{"stx":"html","strippedNL":true}'>&lt;nowiki>
2300 </pre>
2301 <p><span typeof="mw:Placeholder" data-parsoid='{"src":"&lt;/nowiki>"}'>&lt;/nowiki></span>
2302 &lt;/pre></p>
2303
2304 <p><span typeof="mw:Nowiki">
2305 &lt;pre>
2306 &lt;nowiki>
2307 &lt;/pre>
2308 </span>
2309 &lt;/pre></p>
2310 !! end
2311
2312 !! test
2313 </pre> inside nowiki
2314 !! wikitext
2315 <nowiki></pre></nowiki>
2316 !! html
2317 <p>&lt;/pre&gt;
2318 </p>
2319 !! end
2320
2321 # Parsoid doesn't strip empty tags, like Tidy does.
2322 !! test
2323 Empty pre; pre inside other HTML tags (bug 54946)
2324 !! options
2325 parsoid=wt2html,wt2wt
2326 !! wikitext
2327 a
2328
2329 <div><pre>
2330 foo
2331 </pre></div>
2332 <pre></pre>
2333 !! html/php
2334 <p>a
2335 </p>
2336 <div><pre>
2337 foo
2338 </pre></div>
2339 <pre></pre>
2340
2341 !! html/php+tidy
2342 <p>a</p>
2343 <div>
2344 <pre>
2345 foo
2346 </pre></div>
2347 !! html/parsoid
2348 <p>a</p>
2349
2350 <div><pre>foo
2351 </pre></div>
2352 <pre></pre>
2353 !! end
2354
2355 !! test
2356 HTML pre followed by indent-pre
2357 !! wikitext
2358 <pre>foo</pre>
2359 bar
2360 !! html
2361 <pre>foo</pre>
2362 <pre>bar
2363 </pre>
2364 !! end
2365
2366 # Note that tidy removes the empty <p> tags from the start and end.
2367 # Parsoid does not, by design.
2368 !!test
2369 Block tag pre
2370 !! wikitext
2371 <p><pre>foo</pre></p>
2372 !! html/php+tidy
2373 <pre>
2374 foo
2375 </pre>
2376 !! html/parsoid
2377 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2378 !!end
2379
2380 !!test
2381 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2382 !! wikitext
2383 {{echo|}}
2384 !! html
2385
2386 !!end
2387
2388 !!test
2389 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2390 !! wikitext
2391 {{echo|
2392 foo}}
2393 !! html
2394 <p>foo
2395 </p>
2396 !!end
2397
2398 !! test
2399 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2400 !! wikitext
2401 {{echo|a
2402 b}}
2403 !! html
2404 <pre>a
2405 </pre>
2406 <p>b
2407 </p>
2408 !!end
2409
2410 !! test
2411 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2412 !! wikitext
2413 {{echo|a
2414 b
2415 c
2416 d
2417 e
2418 }}
2419 !! html
2420 <pre>a
2421 </pre>
2422 <p>b
2423 c
2424 </p>
2425 <pre>d
2426 </pre>
2427 <p>e
2428 </p>
2429 !!end
2430
2431 !!test
2432 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2433 !! wikitext
2434 {{echo| foo}}
2435
2436 {{echo| foo}}{{echo| bar}}
2437
2438 {{echo| foo}}
2439 {{echo| bar}}
2440
2441 {{echo|<!--cmt--> foo}}
2442
2443 <!--cmt-->{{echo| foo}}
2444
2445 {{echo|{{echo| }}bar}}
2446 !! html
2447 <pre>foo
2448 </pre>
2449 <pre>foo bar
2450 </pre>
2451 <pre>foo
2452 bar
2453 </pre>
2454 <pre>foo
2455 </pre>
2456 <pre>foo
2457 </pre>
2458 <pre>bar
2459 </pre>
2460 !!end
2461
2462 !! test
2463 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2464 !! wikitext
2465 {{echo| }}a
2466
2467 {{echo|
2468 }}a
2469
2470 {{echo|
2471 b}}
2472
2473 {{echo|a
2474 }}b
2475
2476 {{echo|a
2477 }} b
2478 !! html
2479 <pre>a
2480 </pre>
2481 <p><br />
2482 </p>
2483 <pre>a
2484 </pre>
2485 <p><br />
2486 </p>
2487 <pre>b
2488 </pre>
2489 <p>a
2490 </p>
2491 <pre>b
2492 </pre>
2493 <p>a
2494 </p>
2495 <pre>b
2496 </pre>
2497 !!end
2498
2499 !! test
2500 Pres with newline attributes
2501 !! wikitext
2502 <pre class="one
2503 two">hi</pre>
2504 !! html/php
2505 <pre class="one two">hi</pre>
2506
2507 !! html/parsoid
2508 <pre class="one
2509 two" data-parsoid='{"stx":"html"}'>hi</pre>
2510 !! end
2511
2512 !! test
2513 Things that look like <pre> tags aren't treated as such
2514 !! wikitext
2515 Barack Obama <President> of the United States
2516 <President></President>
2517 !! html
2518 <p>Barack Obama &lt;President&gt; of the United States
2519 &lt;President&gt;&lt;/President&gt;
2520 </p>
2521 !! end
2522
2523 ## PHP parser discards the "<pre " string
2524 !! test
2525 Handle broken pre-like tags (bug 64025)
2526 !! options
2527 parsoid=wt2html
2528 !! wikitext
2529 {{echo|<pre <pre>x</pre>}}
2530
2531 <table><pre </table>
2532 !! html/php
2533 <pre>x</pre>
2534 <table><pre></pre></table>
2535
2536 !! html/parsoid
2537 <pre about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"a":{"&lt;pre":null},"sa":{"&lt;pre":""},"stx":"html","pi":[[{"k":"1"}]]}' 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 !! options
6571 parsoid=wt2html,html2html
6572 !! wikitext
6573 {|
6574 | style=| hello
6575 |}
6576 !! html/php
6577 <table>
6578 <tr>
6579 <td style=""> hello
6580 </td></tr></table>
6581
6582 !! html/parsoid
6583 <table>
6584 <tbody><tr><td style=""> hello</td></tr>
6585 </tbody></table>
6586 !! end
6587
6588 !! test
6589 Wikitext table with a lot of comments
6590 !! wikitext
6591 {|
6592 <!-- c0 -->
6593 | foo
6594 <!-- c1 -->
6595 |-<!-- c2 -->
6596 <!-- c3 -->
6597 |<!-- c4 -->
6598 <!-- c5 -->
6599 |}
6600 !! html
6601 <table>
6602 <tr>
6603 <td> foo
6604 </td></tr>
6605 <tr>
6606 <td>
6607 </td></tr></table>
6608
6609 !! end
6610
6611 !! test
6612 Wikitext table comments represented in parsoid dom
6613 !! wikitext
6614 {|<!--c1--><!--c2-->
6615 |-<!--c3-->
6616 | x
6617 |}
6618 !! html/php+tidy
6619 <table>
6620 <tr>
6621 <td>x</td>
6622 </tr>
6623 </table>
6624 !! html/parsoid
6625 <table><!--c1--><!--c2-->
6626 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
6627 <td data-parsoid='{"autoInsertedEnd":true}'> x</td></tr>
6628 </tbody></table>
6629 !! end
6630
6631 !! test
6632 Wikitext table with double-line table cell
6633 !! wikitext
6634 {|
6635 |a
6636 b
6637 |}
6638 !! html
6639 <table>
6640 <tr>
6641 <td>a
6642 <p>b
6643 </p>
6644 </td></tr></table>
6645
6646 !! end
6647
6648 !! test
6649 Table cell with a single comment
6650 !! wikitext
6651 {|
6652 | <!-- c1 -->
6653 | a
6654 |}
6655 !! html
6656 <table>
6657 <tr>
6658 <td>
6659 </td>
6660 <td> a
6661 </td></tr></table>
6662
6663 !! end
6664
6665 !! test
6666 Table-cell after a comment-only-empty-line
6667 !! wikitext
6668 {|
6669 |a
6670 <!--c1-->
6671 <!--c2-->| b
6672 |}
6673 !! html
6674 <table>
6675 <tr>
6676 <td>a
6677 </td>
6678 <td> b
6679 </td></tr></table>
6680
6681 !! html/parsoid
6682 <table>
6683 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
6684 <!--c1-->
6685 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
6686 </tbody></table>
6687
6688 !! end
6689
6690 !! test
6691 Build table with {{!}}
6692 !! wikitext
6693 {{{!}} class="wikitable"
6694 ! header
6695 ! second header
6696 {{!}}- style="color:red;"
6697 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
6698 {{!}}}
6699 !! html
6700 <table class="wikitable">
6701 <tr>
6702 <th> header
6703 </th>
6704 <th> second header
6705 </th></tr>
6706 <tr style="color:red;">
6707 <td> data </td>
6708 <td style="color:red;"> second data
6709 </td></tr></table>
6710
6711 !! end
6712
6713 !! test
6714 Build table with pipe as data
6715 !! wikitext
6716 {| class="wikitable"
6717 ! header
6718 ! second header
6719 |- style="color:red;"
6720 | data || style="color:red;" | second data
6721 |-
6722 | style="color:red;" | data with | || style="color:red;" | second data with |
6723 |-
6724 || data with | ||| second data with |
6725 |}
6726 !! html
6727 <table class="wikitable">
6728 <tr>
6729 <th> header
6730 </th>
6731 <th> second header
6732 </th></tr>
6733 <tr style="color:red;">
6734 <td> data </td>
6735 <td style="color:red;"> second data
6736 </td></tr>
6737 <tr>
6738 <td style="color:red;"> data with | </td>
6739 <td style="color:red;"> second data with |
6740 </td></tr>
6741 <tr>
6742 <td> data with | </td>
6743 <td> second data with |
6744 </td></tr></table>
6745
6746 !! end
6747
6748 !! test
6749 Build table with wikilink
6750 !! wikitext
6751 {| class="wikitable"
6752 ! header || second header
6753 |- style="color:red;"
6754 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
6755 |-
6756 | data || second data [[Main Page|link|text with pipe]]
6757 |}
6758 !! html
6759 <table class="wikitable">
6760 <tr>
6761 <th> header </th>
6762 <th> second header
6763 </th></tr>
6764 <tr style="color:red;">
6765 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
6766 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
6767 </td></tr>
6768 <tr>
6769 <td> data </td>
6770 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
6771 </td></tr></table>
6772
6773 !! end
6774
6775 # The expected HTML structure in this test is debatable. The PHP parser does
6776 # not parse this kind of table at all. The main focus for Parsoid is on
6777 # round-tripping, so this output is ok for now. TODO: revisit!
6778 !! test
6779 Wikitext table with html-syntax row
6780 !! wikitext
6781 {|
6782 |-
6783 <td>foo</td>
6784 |}
6785 !! html/parsoid
6786 <table>
6787 <tbody>
6788 <tr>
6789 <td>foo</td></tr></tbody></table>
6790 !! end
6791
6792 ## Note that Parsoid output differs from PHP and PHP+tidy here.
6793 ## The lack of <tr> tags in the PHP output is arguably a bug in the
6794 ## PHP parser, which tidy then compounds by fostering the content
6795 ## entirely out of the table. Parsoid recognizes the table context
6796 ## and generates <tr> and <td> wrappers as needed. Hopefully nobody
6797 ## depends on PHP's treatment of broken table markup!
6798 !! test
6799 Implicit <td> after a |-
6800 !! options
6801 parsoid=wt2html,html2html
6802 !! wikitext
6803 {|
6804 |-
6805 a
6806 |}
6807 !! html/php
6808 <table>
6809
6810 a
6811 </table>
6812
6813 !! html/php+tidy
6814 <p>a</p>
6815 !! html/parsoid
6816 <table>
6817 <tr><td>a</td></tr>
6818 </table>
6819 !! end
6820
6821 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
6822 !! test
6823 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
6824 !! options
6825 parsoid=wt2html,html2html
6826 !! wikitext
6827 {|
6828 |-
6829 |
6830 a
6831 |-
6832 b
6833 |}
6834 !! html/php
6835 <table>
6836
6837 <tr>
6838 <td>
6839 <pre>a
6840 </pre>
6841 </td></tr>
6842 b
6843 </table>
6844
6845 !! html/php+tidy
6846 <p>b</p>
6847 <table>
6848 <tr>
6849 <td>
6850 <pre>
6851 a
6852 </pre></td>
6853 </tr>
6854 </table>
6855 !! html/parsoid
6856 <table>
6857 <tbody>
6858 <tr><td><pre>a</pre></td></tr>
6859 <tr><td> b</td></tr>
6860 </tbody>
6861 </table>
6862 !! end
6863
6864 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
6865 # Parsoid generates the missing <td>, so wt2wt won't succeed.
6866 !! test
6867 Lists should be recognized in an implicit <td> context
6868 !! options
6869 parsoid=wt2html,html2html
6870 !! wikitext
6871 {|
6872 |-
6873 *a
6874 |}
6875 !! html/php
6876 <table>
6877
6878 <ul><li>a</li></ul>
6879 </table>
6880
6881 !! html/php+tidy
6882 <ul>
6883 <li>a</li>
6884 </ul>
6885 !! html/parsoid
6886 <table>
6887 <tr>
6888 <td><ul>
6889 <li>a</li>
6890 </ul></td>
6891 </tr>
6892 </table>
6893 !! end
6894
6895 !! test
6896 Table cells not properly parsed in an implicit-td context
6897 !! wikitext
6898 {|
6899 |-
6900 {{table_attribs_4}} || a || b
6901 |}
6902 !! html/php+tidy
6903 <table>
6904 <tr>
6905 <td style="background-color:#DC241f;" width="10px"></td>
6906 <td>a</td>
6907 <td>b</td>
6908 </tr>
6909 </table>
6910 !! html/parsoid
6911 <table>
6912 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
6913 <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>
6914 </tbody></table>
6915 !! end
6916
6917 !! test
6918 Parsoid: Round-trip tables directly followed by content (bug 51219)
6919 !! options
6920 parsoid=wt2html,wt2wt
6921 !! wikitext
6922 {|
6923 |foo
6924 |} bar
6925
6926 {|
6927 |baz
6928 |}<b>quux</b>
6929 !! html+tidy
6930 <table>
6931 <tr>
6932 <td>foo</td>
6933 </tr>
6934 </table>
6935 <p>bar</p>
6936 <table>
6937 <tr>
6938 <td>baz</td>
6939 </tr>
6940 </table>
6941 <p><b>quux</b></p>
6942 !! end
6943
6944 !! test
6945 Parsoid: Default to a newline after tables in new content (bug 51219)
6946 !! options
6947 parsoid=html2wt
6948 !! html/parsoid
6949 <table><tbody>
6950 <tr><td>foo</td></tr></tbody></table> bar
6951 <table><tbody>
6952 <tr><td>baz</td></tr></tbody></table><b>quux</b>
6953 !! wikitext
6954 {|
6955 |foo
6956 |}
6957 <nowiki> </nowiki>bar
6958 {|
6959 |baz
6960 |}
6961 '''quux'''
6962 !! end
6963
6964 !! test
6965 Parsoid: newline inducing block nodes don't suppress <nowiki>
6966 !! options
6967 parsoid=html2wt
6968 !! html/parsoid
6969 a<h1>foo</h1>
6970 !! wikitext
6971 <nowiki> </nowiki>a
6972
6973 = foo =
6974 !! end
6975
6976 !! test
6977 Parsoid: Row-syntax table headings followed by comment & table cells
6978 !! options
6979 parsoid=wt2html,wt2wt
6980 !! wikitext
6981 {|
6982 ! foo || bar
6983 <!-- foo --> || baz || quux
6984 |}
6985 !! html/php
6986 <table>
6987 <tr>
6988 <th> foo </th>
6989 <th> bar
6990 </th>
6991 <td> baz </td>
6992 <td> quux
6993 </td></tr></table>
6994
6995 !! html/parsoid
6996 <table>
6997 <tbody><tr><th> foo </th><th> bar
6998 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
6999 </tbody></table>
7000 !! end
7001
7002 !!test
7003 Parsoid: Recover better from broken table attributes
7004 !!options
7005 parsoid=wt2html
7006 !!wikitext
7007 {| class="foo
7008 | class="bar" |
7009 foo
7010 |}
7011 !!html/php+tidy
7012 <table class="foo">
7013 <tr>
7014 <td class="bar">
7015 <p>foo</p>
7016 </td>
7017 </tr>
7018 </table>
7019 !!html/parsoid
7020 <table class="foo">
7021 <tr>
7022 <td class="bar">
7023 <p>foo</p></td></tr>
7024 </tbody></table>
7025 !!end
7026
7027 !! test
7028 Tables: Digest broken attributes on table and tr tag
7029 !! options
7030 parsoid=wt2html
7031 !! wikitext
7032 {| || |} ++
7033 |- || || ++ --
7034 |- > [
7035 |}
7036 !! html
7037 <table>
7038 <tbody>
7039 <tr></tr>
7040 <tr></tr>
7041 </tbody></table>
7042 !! end
7043
7044 !! test
7045 Strip unsupported table tags
7046 !! options
7047 parsoid=html2wt
7048 !! html/parsoid
7049 <table>
7050 <thead>
7051 <tr>
7052 <th>Month</th>
7053 <th>Savings</th>
7054 </tr>
7055 </thead>
7056 <tbody>
7057 <tr>
7058 <td>January</td>
7059 <td>$100</td>
7060 </tr>
7061 <tr>
7062 <td>February</td>
7063 <td>$80</td>
7064 </tr>
7065 </tbody>
7066 <tfoot>
7067 <tr>
7068 <td>Sum</td>
7069 <td>$180</td>
7070 </tr>
7071 </tfoot>
7072 </table>
7073 !! wikitext
7074 {|
7075
7076 !Month
7077 !Savings
7078
7079 |January
7080 |$100
7081
7082 |-
7083 |February
7084 |$80
7085
7086 |Sum
7087 |$180
7088
7089 |}
7090 !! end
7091
7092 !!test
7093 Testing serialization after deletion of table cells
7094 !!options
7095 parsoid={
7096 "modes": ["wt2wt", "selser"],
7097 "changes": [
7098 ["#x", "remove"]
7099 ]
7100 }
7101 !!wikitext
7102 {|
7103 !h1 !!h2 !!h3
7104 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
7105 |}
7106 !! wikitext/edited
7107 {|
7108 !h1 !!h2 !!h3
7109 |c2 |||c3
7110 |}
7111 !!end
7112
7113 ###
7114 ### Internal links
7115 ###
7116 !! test
7117 Plain link, capitalized
7118 !! wikitext
7119 [[Main Page]]
7120 !! html
7121 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7122 </p>
7123 !! end
7124
7125 !! test
7126 Plain link, uncapitalized
7127 !! wikitext
7128 [[main Page]]
7129 !! html
7130 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
7131 </p>
7132 !! end
7133
7134 !! test
7135 Piped link
7136 !! wikitext
7137 [[Main Page|The Main Page]]
7138 !! html
7139 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7140 </p>
7141 !! end
7142
7143 !! test
7144 Piped link with comment in link text
7145 !! wikitext
7146 [[Main Page|The Main<!--front--> Page]]
7147 !! html
7148 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7149 </p>
7150 !! end
7151
7152 !! test
7153 Piped link with multiple pipe characters in link text
7154 !! wikitext
7155 [[Main Page||The|Main|Page|]]
7156 !! html/php
7157 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7158 </p>
7159 !! html/parsoid
7160 <p><a rel="mw:WikiLink" href="Main_Page" title="Main Page">|The|Main|Page|</a></p>
7161 !! end
7162
7163 !! test
7164 Piped link with no link text
7165 !! wikitext
7166 [[Thomas Bek (bishop of St David's)|]]
7167 !! html/php
7168 <p>[[Thomas Bek (bishop of St David's)|]]
7169 </p>
7170 !! html/parsoid
7171 <p>[[Thomas Bek (bishop of St David's)|]]</p>
7172 !! end
7173
7174 !! test
7175 Broken link
7176 !! wikitext
7177 [[Zigzagzogzagzig]]
7178 !! html
7179 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7180 </p>
7181 !! end
7182
7183 !! test
7184 Broken link with fragment
7185 !! wikitext
7186 [[Zigzagzogzagzig#zug]]
7187 !! html
7188 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7189 </p>
7190 !! end
7191
7192 !! test
7193 Special page link with fragment
7194 !! wikitext
7195 [[Special:Version#anchor]]
7196 !! html
7197 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7198 </p>
7199 !! end
7200
7201 !! test
7202 Nonexistent special page link with fragment
7203 !! wikitext
7204 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7205 !! html
7206 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7207 </p>
7208 !! end
7209
7210 !! test
7211 Link with prefix
7212 !! wikitext
7213 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7214 !! html
7215 <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>
7216 </p>
7217 !! end
7218
7219 !! test
7220 Link with suffix
7221 !! wikitext
7222 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7223 !! html
7224 <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>!!!
7225 </p>
7226 !! end
7227
7228 !! article
7229 prefixed article
7230 !! text
7231 Some text
7232 !! endarticle
7233
7234 !! test
7235 Bug 43661: Piped links with identical prefixes
7236 !! wikitext
7237 [[prefixed article|prefixed articles with spaces]]
7238
7239 [[prefixed article|prefixed articlesaoeu]]
7240
7241 [[Main Page|Main Page test]]
7242 !! html
7243 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7244 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7245 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7246 </p>
7247 !! end
7248
7249
7250 !! test
7251 Link with HTML entity in suffix / tail
7252 !! wikitext
7253 [[Main Page]]&quot;, [[Main Page]]&#97;
7254 !! html/php
7255 <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;
7256 </p>
7257 !! html/parsoid
7258 <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>
7259 !! end
7260
7261 !! test
7262 Link with 3 brackets
7263 !! wikitext
7264 [[[Main Page]]]
7265 Foo [[[Main Page]]]
7266 !! html
7267 <p>[[[Main Page]]]
7268 Foo [[[Main Page]]]
7269 </p>
7270 !! end
7271
7272 !! test
7273 Link with 4 brackets
7274 !! wikitext
7275 [[[[Main Page]]]]
7276 !! html
7277 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7278 </p>
7279 !! end
7280
7281 !! test
7282 Piped link with 3 brackets
7283 !! wikitext
7284 [[[main page|the main page]]]
7285 !! html
7286 <p>[[[main page|the main page]]]
7287 </p>
7288 !! end
7289
7290 !! test
7291 Piped link with extlink-like text
7292 !! wikitext
7293 [[Main Page|[bar]]]
7294 [[Main Page|This is a [bar]]]
7295 !! html/php
7296 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7297 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7298 </p>
7299 !! html/parsoid
7300 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7301 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a></p>
7302 !! end
7303
7304 !! test
7305 Link with multiple pipes
7306 !! wikitext
7307 [[Main Page|The|Main|Page]]
7308 !! html
7309 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7310 </p>
7311 !! end
7312
7313 # Note that parsoid does not munge anchor text; all non-space
7314 # characters are valid in HTML5 ids.
7315 !! test
7316 Anchor containing a #. (bug 63430)
7317 !! wikitext
7318 [[Main Page#And#Link]]
7319 !! html/php
7320 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
7321 </p>
7322 !! html/parsoid
7323 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link" title="Main Page">Main Page#And#Link</a></p>
7324 !! end
7325
7326 !! test
7327 Link to namespaces
7328 !! wikitext
7329 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7330 !! html
7331 <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>
7332 </p>
7333 !! end
7334
7335 !! test
7336 Link with space in namespace
7337 !! wikitext
7338 [[User talk:Foo bar]]
7339 !! html
7340 <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>
7341 </p>
7342 !! end
7343
7344 !! article
7345 MemoryAlpha:AlphaTest
7346 !! text
7347 This is an article in the MemoryAlpha namespace
7348 (which shadows the memoryalpha interwiki link).
7349 !! endarticle
7350
7351 !! test
7352 Namespace takes precedence over interwiki link (bug 51680)
7353 !! wikitext
7354 [[MemoryAlpha:AlphaTest]]
7355 !! html
7356 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7357 </p>
7358 !! end
7359
7360 # The previous test doesn't work correctly in html2*, due to not recognizing the
7361 # link as an internal one. This one checks for the correct behavior.
7362 !! test
7363 Link to namespace preferred over interwiki with correct rel attribute
7364 !! options
7365 parsoid=html2wt,html2html
7366 !! html/parsoid
7367 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7368 !! wikitext
7369 [[MemoryAlpha:AlphaTest]]
7370 !! end
7371
7372 !! test
7373 Piped link to namespace
7374 !! wikitext
7375 [[Meta:Disclaimers|The disclaimers]]
7376 !! html
7377 <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>
7378 </p>
7379 !! end
7380
7381 !! test
7382 Link containing }
7383 !! wikitext
7384 [[Usually caused by a typo (oops}]]
7385 !! html
7386 <p>[[Usually caused by a typo (oops}]]
7387 </p>
7388 !! end
7389
7390 !! article
7391 7% Solution
7392 !! text
7393 Just a test of an article title containing a percent.
7394 !! endarticle
7395
7396 !! test
7397 Link containing % (not as a hex sequence)
7398 !! wikitext
7399 [[7% Solution]]
7400 !! html/php
7401 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7402 </p>
7403 !! html/parsoid
7404 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
7405 !! end
7406
7407 # note that the parsoid HTML is identical to the previous test output,
7408 # so the previous test ensures that the html2wt mode will generate the
7409 # "not as a hex sequence" wikitext.
7410 !! test
7411 Link containing % as a single hex sequence interpreted to char
7412 !! options
7413 parsoid=wt2wt,wt2html,html2html
7414 !! wikitext
7415 [[7%25 Solution]]
7416 !! html/php
7417 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7418 </p>
7419 !! html/parsoid
7420 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
7421 !!end
7422
7423 !! test
7424 Link containing % as a double hex sequence interpreted to hex sequence
7425 !! wikitext
7426 [[7%2525 Solution]]
7427 !! html
7428 <p>[[7%2525 Solution]]
7429 </p>
7430 !!end
7431
7432 # note that parsoid does not munge anchor text; all non-space
7433 # characters are valid in HTML5 anchors.
7434 !! test
7435 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7436 Example for such a section: == < ==
7437 !! wikitext
7438 [[%23%3c]][[%23%3e]]
7439 !! html/php
7440 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7441 </p>
7442 !! html/parsoid
7443 <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>
7444 !! end
7445
7446 !! test
7447 Link containing "<#" and ">#" as a hex sequences
7448 !! wikitext
7449 [[%3c%23]][[%3e%23]]
7450 !! html
7451 <p>[[%3c%23]][[%3e%23]]
7452 </p>
7453 !! end
7454
7455 !! test
7456 Link containing an equals sign
7457 !! wikitext
7458 [[Special:BookSources/isbn=4-00-026157-6]]
7459 !! html/php
7460 <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>
7461 </p>
7462 !! html/parsoid
7463 <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>
7464 !! end
7465
7466 !! article
7467 Foo~bar
7468 !! text
7469 Just a test of an article title containing a tilde.
7470 !! endarticle
7471
7472 # note that links containing signatures, like [[Foo~~~~]], are
7473 # massaged by the pre-save transform (PST) and so the tildes are never
7474 # seen by the parser.
7475 !! test
7476 Link containing a tilde
7477 !! wikitext
7478 [[Foo~bar]]
7479 !! html/php
7480 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
7481 </p>
7482 !! html/parsoid
7483 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
7484 !! end
7485
7486 !! test
7487 Link containing double-single-quotes '' (bug 4598)
7488 !! wikitext
7489 [[Lista d''e paise d''o munno]]
7490 !! html/php
7491 <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>
7492 </p>
7493 !! html/parsoid
7494 <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>
7495 !! end
7496
7497 !! test
7498 Link containing double-single-quotes '' in text (bug 4598 sanity check)
7499 !! wikitext
7500 Some [[Link|pretty ''italics'' and stuff]]!
7501 !! html/php
7502 <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>!
7503 </p>
7504 !! html/parsoid
7505 <p>Some <a rel="mw:WikiLink" href="Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
7506 !! end
7507
7508 !! test
7509 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
7510 !! wikitext
7511 ''Some [[Link|pretty ''italics'' and stuff]]!''
7512 !! html
7513 <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>
7514 </p>
7515 !! end
7516
7517 !! test
7518 Link with double quotes in title part (literal) and alternate part (interpreted)
7519 !! wikitext
7520 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
7521
7522 [[''Pentecoste'']]
7523
7524 [[''Pentecoste''|Pentecoste]]
7525
7526 [[''Pentecoste''|''Pentecoste'']]
7527 !! html/php
7528 <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>
7529 </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>
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)"><i>Pentecoste</i></a>
7532 </p>
7533 !! html/parsoid
7534 <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>
7535 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
7536 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
7537 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
7538 !! end
7539
7540 !! test
7541 Broken image links with HTML captions (bug 39700)
7542 !! wikitext
7543 [[File:Nonexistent|<script></script>]]
7544 [[File:Nonexistent|100x100px|<script></script>]]
7545 [[File:Nonexistent|&lt;]]
7546 [[File:Nonexistent|a<i>b</i>c]]
7547 !! html/php
7548 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7549 <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;</a>
7551 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
7552 </p>
7553 !! html/parsoid
7554 <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>
7555 <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>
7556 <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>
7557 <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>
7558 !! end
7559
7560 !! test
7561 Plain link to URL
7562 !! wikitext
7563 [[http://www.example.com]]
7564 !! html/php
7565 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
7566 </p>
7567 !! html/parsoid
7568 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
7569 !! end
7570
7571 !! test
7572 Plain link to URL with link text
7573 !! wikitext
7574 [[http://www.example.com Link text]]
7575 !! html
7576 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
7577 </p>
7578 !! end
7579
7580 !! test
7581 Plain link to protocol-relative URL
7582 !! wikitext
7583 [[//www.example.com]]
7584 !! html/php
7585 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
7586 </p>
7587 !! html/parsoid
7588 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
7589 !! end
7590
7591 !! test
7592 Plain link to protocol-relative URL with link text
7593 !! wikitext
7594 [[//www.example.com Link text]]
7595 !! html
7596 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
7597 </p>
7598 !! end
7599
7600 !! test
7601 Plain link to page with question mark in title
7602 !! wikitext
7603 [[A?b]]
7604
7605 [[A?b|Baz]]
7606 !! html
7607 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
7608 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
7609 </p>
7610 !! end
7611
7612
7613 # I'm fairly sure the expected result here is wrong.
7614 # We want these to be URL links, not pseudo-pages with URLs for titles....
7615 # However the current output is also pretty screwy.
7616 #
7617 # ----
7618 # I'm changing it to match the current output--it arguably makes more
7619 # sense in the light of the test above. Old expected result was:
7620 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
7621 #</p>
7622 # But I think this test is bordering on "garbage in, garbage out" anyway.
7623 # -- wtm
7624 !! test
7625 Piped link to URL
7626 !! wikitext
7627 Piped link to URL: [[http://www.example.com|an example URL]]
7628 !! html/php
7629 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
7630 </p>
7631 !! html/parsoid
7632 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
7633 !! end
7634
7635 !! test
7636 BUG 2: [[page|http://url/]] should link to page, not http://url/
7637 !! wikitext
7638 [[Main Page|http://url/]]
7639 !! html/php
7640 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
7641 </p>
7642 !! html/parsoid
7643 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
7644 !! end
7645
7646 # Parsoid does not mark self-links, by design.
7647 !! test
7648 BUG 337: Escaped self-links should be bold
7649 !! options
7650 title=[[Bug462]]
7651 !! wikitext
7652 [[Bu&#103;462]] [[Bug462]]
7653 !! html/php
7654 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
7655 </p>
7656 !! html/php+tidy
7657 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
7658 !! html/parsoid
7659 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
7660 !! end
7661
7662 !! test
7663 Self-link to section should not be bold
7664 !! options
7665 title=[[Main Page]]
7666 !! wikitext
7667 [[Main Page#section]]
7668 !! html
7669 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
7670 </p>
7671 !! end
7672
7673 !! article
7674 00
7675 !! text
7676 This is 00.
7677 !! endarticle
7678
7679 !!test
7680 Self-link to numeric title
7681 !!options
7682 title=[[0]]
7683 !! wikitext
7684 [[0]]
7685 !! html
7686 <p><strong class="selflink">0</strong>
7687 </p>
7688 !!end
7689
7690 !!test
7691 Link to numeric-equivalent title
7692 !!options
7693 title=[[0]]
7694 !! wikitext
7695 [[00]]
7696 !! html
7697 <p><a href="/wiki/00" title="00">00</a>
7698 </p>
7699 !!end
7700
7701 !! test
7702 <nowiki> inside a link
7703 !! wikitext
7704 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
7705 !! html
7706 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
7707 </p>
7708 !! end
7709
7710 !! test
7711 Non-breaking spaces in title
7712 !! wikitext
7713 [[&nbsp; Main &nbsp; Page &nbsp;]]
7714 !! html
7715 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
7716 </p>
7717 !!end
7718
7719 !! test
7720 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
7721 !! options
7722 language=ca
7723 !! wikitext
7724 '''[[Main Page]]'''
7725 !! html
7726 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
7727 </p>
7728 !! end
7729
7730 !! test
7731 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
7732 !! options
7733 language=ca
7734 !! wikitext
7735 ''[[Main Page]]''
7736 !! html
7737 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
7738 </p>
7739 !! end
7740
7741 !! test
7742 Internal link with en linktrail: no apostrophes (bug 27473)
7743 !! options
7744 language=en
7745 !! wikitext
7746 [[Something]]'nice
7747 !! html
7748 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
7749 </p>
7750 !! end
7751
7752 !! test
7753 Internal link with ca linktrail with apostrophes (bug 27473)
7754 !! options
7755 language=ca
7756 !! wikitext
7757 [[Something]]'nice
7758 !! html
7759 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
7760 </p>
7761 !! end
7762
7763 !! test
7764 Internal link with kaa linktrail with apostrophes (bug 27473)
7765 !! options
7766 language=kaa
7767 !! wikitext
7768 [[Something]]'nice
7769 !! html
7770 <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>
7771 </p>
7772 !! end
7773
7774 !! test
7775 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
7776 !! wikitext
7777 [[User:Foo/Test/63636:Bar|Test]]
7778 !! html/php
7779 <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>
7780 </p>
7781 !! html/parsoid
7782 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
7783 !! end
7784
7785 !! test
7786 Purely hash wikilink
7787 !! options
7788 title=[[User:test/123]]
7789 !! wikitext
7790 [[#a|b]]
7791 !! html/php
7792 <p><a href="#a">b</a>
7793 </p>
7794 !! html/parsoid
7795 <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>
7796 !! end
7797
7798 !! test
7799 1. Interaction of linktrail and template encapsulation
7800 !! options
7801 parsoid
7802 !! wikitext
7803 {{echo|[[Foo]]}}l
7804 !! html
7805 <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>
7806 !! end
7807
7808 !! test
7809 2. Interaction of linktrail and template encapsulation
7810 !! options
7811 parsoid
7812 !! wikitext
7813 {{echo|Some [[Fool]]}}s
7814 !! html
7815 <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>
7816 !! end
7817
7818 !! test
7819 3. Interaction of linktrail and template encapsulation
7820 !! options
7821 parsoid
7822 !! wikitext
7823 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
7824 !! html
7825 <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>
7826 !! end
7827
7828 !! article
7829 Söfnuður
7830 !! text
7831 Test.
7832 !! endarticle
7833
7834 !! test
7835 Internal link with is link prefix
7836 !! options
7837 language=is
7838 !! wikitext
7839 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
7840 !! html
7841 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
7842 </p>
7843 !! end
7844
7845 !! article
7846 Mótmælendatrú
7847 !! text
7848 Test.
7849 !! endarticle
7850
7851 !! test
7852 Internal link with is link trail and link prefix
7853 !! options
7854 language=is
7855 !! wikitext
7856 [[mótmælendatrú|xxx]]ar
7857 [[mótmælendatrú]]ar
7858 mótmælenda[[söfnuður]]
7859 mótmælenda[[söfnuður|söfnuðir]]
7860 mótmælenda[[söfnuður|söfnuðir]]xxx
7861 !! html
7862 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
7863 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
7864 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
7865 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
7866 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
7867 </p>
7868 !! end
7869
7870 !! test
7871 Parsoid link trail escaping
7872 !! options
7873 parsoid=html2wt,html2html
7874 !! html/parsoid
7875 <p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p>
7876 !! wikitext
7877 [[apple]]<nowiki/>s
7878 !! end
7879
7880 !! test
7881 Parsoid link prefix escaping
7882 !! options
7883 language=is
7884 parsoid=html2wt,html2html
7885 !! html/parsoid
7886 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p>
7887 !! wikitext
7888 Aðrir mótmælenda<nowiki/>[[söfnuður]]
7889 !! end
7890
7891 !! test
7892 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
7893 !! wikitext
7894 [[Foo| bar]]
7895
7896 [[Foo| ''bar'']]
7897
7898 [http://wp.org foo]
7899
7900 [http://wp.org ''foo'']
7901 !! html
7902 <p><a href="/wiki/Foo" title="Foo"> bar</a>
7903 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
7904 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
7905 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
7906 </p>
7907 !! end
7908
7909 !! test
7910 Parsoid: Scoped parsing should handle mixed transclusions and plain text
7911 !! options
7912 parsoid
7913 !! wikitext
7914 [[Foo|{{echo|a}} b {{echo|c}}]]
7915 !! html
7916 <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>
7917 !! end
7918
7919 !! test
7920 Link with angle bracket after anchor
7921 !! wikitext
7922 [[Foo#<bar>]]
7923 !! html/php
7924 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
7925 </p>
7926 !! html/parsoid
7927 <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>
7928 !! end
7929
7930 ###
7931 ### Interwiki links (see maintenance/interwiki.sql)
7932 ###
7933
7934 !! test
7935 Inline interwiki link
7936 !! options
7937 parsoid=wt2html,wt2wt,html2html
7938 !! wikitext
7939 [[MeatBall:SoftSecurity]]
7940 !! html/php
7941 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
7942 </p>
7943 !! html/parsoid
7944 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
7945 !! end
7946
7947 !! test
7948 Inline interwiki link with empty title (bug 2372)
7949 !! options
7950 parsoid=wt2html,wt2wt,html2html
7951 !! wikitext
7952 [[MeatBall:]]
7953 !! html/php
7954 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
7955 </p>
7956 !! html/parsoid
7957 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
7958 !! end
7959
7960 !! test
7961 Interwiki link encoding conversion (bug 1636)
7962 !! wikitext
7963 *[[Wikipedia:ro:Olteni&#0355;a]]
7964 *[[Wikipedia:ro:Olteni&#355;a]]
7965 !! html
7966 <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>
7967 <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>
7968
7969 !! html+tidy
7970 <ul>
7971 <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>
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 </ul>
7974 !! end
7975
7976 !! test
7977 Interwiki link with fragment (bug 2130)
7978 !! wikitext
7979 [[MeatBall:SoftSecurity#foo]]
7980 !! html
7981 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
7982 </p>
7983 !! end
7984
7985 # Ideally the wikipedia: prefix here should be proto-relative too
7986 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
7987 # define the 'en' prefix, and originally the test used 'wikipedia',
7988 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
7989 # article.
7990 !! test
7991 Different interwiki prefixes mapping to the same URL
7992 !! wikitext
7993 [[:en:Foo]]
7994
7995 [[:en:Foo|Foo]]
7996
7997 [[wikipedia:Foo]]
7998
7999 [[:wikipedia:Foo|Foo]]
8000
8001 [[wikipedia:en:Foo]]
8002
8003 [[:wikipedia:en:Foo]]
8004
8005 [[ wikiPEdia :Foo]]
8006 !! html/parsoid
8007 <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>
8008
8009 <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>
8010
8011 <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>
8012
8013 <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>
8014
8015 <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>
8016
8017 <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>
8018
8019 <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>
8020 !! end
8021
8022 !! test
8023 Interwiki links that cannot be represented in wiki syntax
8024 !! wikitext
8025 [[meatball:ok]]
8026 [[meatball:ok#foo|ok with fragment]]
8027 [[meatball:ok_as_well?|ok ending with ? mark]]
8028 [http://de.wikipedia.org/wiki/Foo?action=history has query]
8029 [http://de.wikipedia.org/wiki/#foo is just fragment]
8030
8031 !! html/php
8032 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
8033 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
8034 <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>
8035 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8036 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
8037 </p>
8038 !! html/parsoid
8039 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
8040 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
8041 <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>
8042 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8043 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
8044 !! end
8045
8046 !! test
8047 Interwiki links: trail
8048 !! wikitext
8049 [[wikipedia:Foo|Ba]]r
8050 !! html/php
8051 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
8052 </p>
8053 !! html/parsoid
8054 <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>
8055 !! end
8056
8057 !! test
8058 Local interwiki link
8059 !! options
8060 parsoid=wt2html,wt2wt,html2html
8061 !! wikitext
8062 [[local:Template:Foo]]
8063 !! html/php
8064 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
8065 </p>
8066 !! html/parsoid
8067 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
8068 !! end
8069
8070 # Parsoid does not mark self-links, by design.
8071 !! test
8072 Local interwiki link: self-link to current page
8073 !! options
8074 title=[[Main Page]]
8075 parsoid=wt2html,wt2wt,html2html
8076 !! wikitext
8077 [[local:Main Page]]
8078 !! html/php
8079 <p><strong class="selflink">local:Main Page</strong>
8080 </p>
8081 !! html/parsoid
8082 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
8083 !! end
8084
8085 !! test
8086 Local interwiki link: prefix only (bug 64167)
8087 !! options
8088 parsoid=wt2html,wt2wt,html2html
8089 !! wikitext
8090 [[local:]]
8091 !! html/php
8092 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
8093 </p>
8094 !! html/parsoid
8095 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
8096 !! end
8097
8098 !! test
8099 Local interwiki link: with additional interwiki prefix (bug 61357)
8100 !! options
8101 parsoid=wt2html,wt2wt,html2html
8102 !! wikitext
8103 [[local:meatball:Hello]]
8104 !! html/php
8105 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8106 </p>
8107 !! html/parsoid
8108 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8109 !! end
8110
8111 !! test
8112 Multiple local interwiki link prefixes
8113 !! wikitext
8114 [[local:local:local:local:mi:local:Foo]]
8115 !! options
8116 parsoid=wt2html,wt2wt,html2html
8117 !! html/php
8118 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8119 </p>
8120 !! html/parsoid
8121 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8122 !! end
8123
8124 ###
8125 ### Interlanguage links
8126 ### Language links (so that searching for '### language' matches..)
8127 ###
8128
8129 !! test
8130 Interlanguage link
8131 !! options
8132 parsoid=wt2html,wt2wt,html2html
8133 !! wikitext
8134 Blah blah blah
8135 [[zh:Chinese]]
8136 !! html/php
8137 <p>Blah blah blah
8138 </p>
8139 !! html/parsoid
8140 <p>Blah blah blah</p>
8141 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8142 !! end
8143
8144 !! test
8145 Interlanguage link with spacing
8146 !! options
8147 parsoid=wt2html,wt2wt,html2html
8148 !! wikitext
8149 Blah blah blah
8150 [[ zh : Chinese ]]
8151 !! html/php
8152 <p>Blah blah blah
8153 </p>
8154 !! html/parsoid
8155 <p>Blah blah blah</p>
8156 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8157 !! end
8158
8159 !! test
8160 Double interlanguage link
8161 !! options
8162 parsoid=wt2html,wt2wt,html2html
8163 !! wikitext
8164 Blah blah blah
8165 [[es:Spanish]]
8166 [[zh:Chinese]]
8167 !! html/php
8168 <p>Blah blah blah
8169 </p>
8170 !! html/parsoid
8171 <p>Blah blah blah</p>
8172 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8173 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8174 !! end
8175
8176 !! test
8177 Interlanguage link variations
8178 !! options
8179 parsoid=wt2html,wt2wt,html2html
8180 !! wikitext
8181 Blah blah blah
8182 [[ es :Spanish]]
8183 [[ ZH :Chinese]]
8184 [[es:Foo_bar]]
8185 !! html/php
8186 <p>Blah blah blah
8187 </p>
8188 !! html/parsoid
8189 <p>Blah blah blah</p>
8190 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
8191 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
8192 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
8193 !! end
8194
8195 !! test
8196 Space and question mark encoding in interlanguage links (T95473)
8197 !! options
8198 parsoid=wt2html,wt2wt,html2html
8199 !! wikitext
8200 Blah blah blah
8201 [[es:Foo bar?]]
8202 !! html/php
8203 <p>Blah blah blah
8204 </p>
8205 !! html/parsoid
8206 <p>Blah blah blah</p>
8207 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
8208 !! end
8209
8210 !! test
8211 Interlanguage link, with prefix links
8212 !! options
8213 language=ln
8214 !! wikitext
8215 Blah blah blah
8216 [[zh:Chinese]]
8217 !! html/php
8218 <p>Blah blah blah
8219 </p>
8220 !! html/parsoid
8221 <p>Blah blah blah</p>
8222 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8223 !! end
8224
8225 !! test
8226 Double interlanguage link, with prefix links (bug 8897)
8227 !! options
8228 language=ln
8229 !! wikitext
8230 Blah blah blah
8231 [[es:Spanish]]
8232 [[zh:Chinese]]
8233 !! html/php
8234 <p>Blah blah blah
8235 </p>
8236 !! html/parsoid
8237 <p>Blah blah blah</p>
8238 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8239 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8240 !! end
8241
8242 !! test
8243 "Extra" interlanguage links (bug 32189 / gerrit 111390)
8244 !! wikitext
8245 Blah blah blah
8246 [[mul:Article]]
8247 !! html/php
8248 <p>Blah blah blah
8249 </p>
8250 !! html/parsoid
8251 <p>Blah blah blah</p>
8252 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
8253 !! end
8254
8255 !! test
8256 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
8257 !! options
8258 language=ln
8259 !! wikitext
8260 [[WW&nbsp;II]]
8261 !! html
8262 <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>
8263 </p>
8264 !! end
8265
8266 !! test
8267 Parsoid bug 53221: Wikilinks should be properly entity-escaped
8268 !! options
8269 parsoid=html2wt
8270 !! html/parsoid
8271 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8272 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8273 !! wikitext
8274 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
8275
8276 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
8277 !! end
8278
8279 !! test
8280 Parsoid: handle constructor well
8281 !! wikitext
8282 [[constructor]]
8283
8284 [[constructor:foo]]
8285 !! html/php
8286 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
8287 </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>
8288 </p>
8289 !! html/parsoid
8290 <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>
8291
8292 <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>
8293 !! end
8294
8295 !! article
8296 ko:
8297 !! text
8298 Test.
8299 !! endarticle
8300
8301 # Note that `ko` isn't a known interlanguage prefix
8302 !! test
8303 Parsoid: recognize interlanguage links without a target page
8304 !! options
8305 ill
8306 !! wikitext
8307 [[es:]]
8308
8309 [[ko:]]
8310 !! html/php
8311 es:
8312 !! html/parsoid
8313 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
8314
8315 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8316 !! end
8317
8318 # Note that `ko` isn't a known interwiki prefix
8319 !! test
8320 Parsoid: recognize interwiki links without a target page
8321 !! options
8322 parsoid=wt2html,wt2wt,html2html
8323 !! wikitext
8324 [[:es:]]
8325
8326 [[:ko:]]
8327 !! html/php
8328 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
8329 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
8330 </p>
8331 !! html/parsoid
8332 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
8333 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8334 !! end
8335
8336 !! test
8337 Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
8338 !! wikitext
8339 [[mi:Foo]]
8340 !! html/php
8341 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
8342 </p>
8343 !! html/parsoid
8344 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
8345 !! end
8346
8347 !! test
8348 Interlanguage link with preceding local interwiki link (bug 68085)
8349 !! options
8350 parsoid=wt2html,wt2wt,html2html
8351 !! wikitext
8352 Blah blah blah
8353 [[local:es:Spanish]]
8354 !! html/php
8355 <p>Blah blah blah
8356 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
8357 </p>
8358 !! html/parsoid
8359 <p>Blah blah blah
8360 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
8361 !! end
8362
8363 !! test
8364 Looks like an interlanguage link, but is actually a local interwiki
8365 !! options
8366 parsoid=wt2html,wt2wt,html2html
8367 !! wikitext
8368 Blah blah blah
8369 [[mi:Template:Foo]]
8370 !! html/php
8371 <p>Blah blah blah
8372 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
8373 </p>
8374 !! html/parsoid
8375 <p>Blah blah blah
8376 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
8377 !! end
8378
8379 ###
8380 ### Redirects, Parsoid-only
8381 ###
8382
8383 !! test
8384 1. Simple redirect to page
8385 !! wikitext
8386 #REDIRECT [[Main Page]]
8387 !! html/parsoid
8388 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8389 !! end
8390
8391 !! test
8392 2. Other redirect variants
8393 !! wikitext
8394 #REDIRECT [[Main_Page]]
8395 !! html/parsoid
8396 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
8397 !! end
8398
8399 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
8400 # This tests the Parsoid bail-out code.
8401 !! test
8402 3. Other redirect variants
8403 !! wikitext
8404 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
8405 !! html/parsoid
8406 <ol><li data-parsoid>REDIRECT [[[[Bar]]]]</li></ol>
8407 !! end
8408
8409 !! test
8410 4. Redirect to a templated destination
8411 !! wikitext
8412 #REDIRECT [[{{echo|Foo}}bar]]
8413 !! html/parsoid
8414 <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"}]]}'/>
8415 !! end
8416
8417 !! test
8418 Empty redirect
8419 !! options
8420 parsoid=wt2html,wt2wt
8421 !! wikitext
8422 #REDIRECT [[]]
8423 !! html/parsoid
8424 <ol>
8425 <li>REDIRECT [[]]</li></ol>
8426 !! end
8427
8428 !! test
8429 Optional colon in #REDIRECT
8430 !! options
8431 # the colon is archaic syntax. we support it for wt2html, but we
8432 # don't care that it roundtrips back to the modern syntax.
8433 parsoid=wt2html,html2html
8434 !! wikitext
8435 #REDIRECT:[[Main Page]]
8436 !! html/parsoid
8437 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8438 !! end
8439
8440 !! test
8441 Whitespace in #REDIRECT with optional colon
8442 !! options
8443 # the colon and gratuitous whitespace is archaic syntax. we support
8444 # it for wt2html, but we don't care that it roundtrips back to the
8445 # modern syntax (without extra whitespace)
8446 parsoid=wt2html,html2html
8447 !! wikitext
8448
8449 #REDIRECT
8450 :
8451 [[Main Page]]
8452 !! html/parsoid
8453 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8454 !! end
8455
8456 !! test
8457 Piped link in #REDIRECT
8458 !! options
8459 # content after piped link is ignored. we support this syntax,
8460 # but don't care that the piped link is lost when we roundtrip this.
8461 parsoid=wt2html
8462 !! wikitext
8463 #REDIRECT [[Main Page|bar]]
8464 !! html/parsoid
8465 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8466 !! end
8467
8468 !! test
8469 Redirect to category (T104502)
8470 !! options
8471 parsoid=wt2html,wt2wt
8472 !! wikitext
8473 #REDIRECT [[Category:Foo]]
8474 !! html/parsoid
8475 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8476 !! end
8477
8478 !! test
8479 Redirect to category with URL encoding (T104502)
8480 !! options
8481 parsoid=wt2html
8482 !! wikitext
8483 #REDIRECT [[Category%3AFoo]]
8484 !! html/parsoid
8485 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8486 !! end
8487
8488 !! test
8489 Redirect to category page
8490 !! wikitext
8491 #REDIRECT [[:Category:Foo]]
8492 !! html/parsoid
8493 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8494 !! end
8495
8496 !! test
8497 Redirect to image page (1)
8498 !! wikitext
8499 #REDIRECT [[File:Wiki.png]]
8500 !! html/parsoid
8501 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
8502 !! end
8503
8504 !! test
8505 Redirect to image page (2)
8506 !! wikitext
8507 #REDIRECT [[Image:Wiki.png]]
8508 !! html/parsoid
8509 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
8510 !! end
8511
8512 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
8513 # Next test confirms this.
8514 !! test
8515 Redirect to language (1) (T104918)
8516 !! options
8517 parsoid=wt2html,wt2wt,html2html
8518 !! wikitext
8519 #REDIRECT [[en:File:Wiki.png]]
8520 !! html/parsoid
8521 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8522 !! end
8523
8524 !! test
8525 Redirect to language (2) (T104918)
8526 !! wikitext
8527 #REDIRECT [[:en:File:Wiki.png]]
8528 !! html/parsoid
8529 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8530 !! end
8531
8532 !! test
8533 Redirect to interwiki (T104918)
8534 !! wikitext
8535 #REDIRECT [[meatball:File:Wiki.png]]
8536 !! html/parsoid
8537 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
8538 !! end
8539
8540 !! test
8541 Non-English #REDIRECT
8542 !! options
8543 language=is
8544 !! wikitext
8545 #TILVÍSUN [[Main Page]]
8546 !! html/parsoid
8547 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
8548 !! end
8549
8550 !! test
8551 Redirect syntax under text isn't considered a redirect
8552 !! wikitext
8553 some text
8554 #redirect [[Main Page]]
8555 !! html/parsoid
8556 <p>some text</p>
8557 <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>
8558 !! end
8559
8560 # FIXME: Should hoist the redirect to the top of the page and ensure there
8561 # is only one.
8562 !! test
8563 New redirect
8564 !! options
8565 parsoid=html2wt
8566 !! html/parsoid
8567 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
8568 !! wikitext
8569 Foo
8570 #REDIRECT [[Foo]]
8571 !! end
8572
8573 ##
8574 ## XHTML tidiness
8575 ###
8576
8577 !! test
8578 <br> to <br />
8579 !! wikitext
8580 1<br>2<br />3
8581 !! html
8582 <p>1<br />2<br />3
8583 </p>
8584 !! end
8585
8586 !! test
8587 Broken br tag sanitization
8588 !! wikitext
8589 </br>
8590 !! html/php
8591 <p>&lt;/br&gt;
8592 </p>
8593 !! end
8594
8595 # TODO: Fix html2html mode (bug 51055)!
8596 !! test
8597 Parsoid: Broken br tag recognition
8598 !! options
8599 parsoid=wt2html
8600 !! wikitext
8601 </br>
8602
8603 <br/ >
8604 !! html+tidy
8605 <p><br /></p>
8606 <p><br /></p>
8607 !! end
8608
8609 !! test
8610 Incorrecly removing closing slashes from correctly formed XHTML
8611 !! wikitext
8612 <br style="clear:both;" />
8613 !! html
8614 <p><br style="clear:both;" />
8615 </p>
8616 !! end
8617
8618 !! test
8619 Failing to transform badly formed HTML into correct XHTML
8620 !! wikitext
8621 <br style="clear: left;">
8622 <br style="clear: right;">
8623 <br style="clear: both;">
8624 !! html
8625 <p><br style="clear: left;" />
8626 <br style="clear: right;" />
8627 <br style="clear: both;" />
8628 </p>
8629 !!end
8630
8631 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
8632 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
8633 !! test
8634 Handling html with a div self-closing tag
8635 !! wikitext
8636 <div title />
8637 <div title/>
8638 <div title/ >
8639 <div title=bar />
8640 <div title=bar/>
8641 <div title=bar/ >
8642 !! html/php
8643 <p>&lt;div title /&gt;
8644 &lt;div title/&gt;
8645 </p>
8646 <div>
8647 <p>&lt;div title=bar /&gt;
8648 &lt;div title=bar/&gt;
8649 </p>
8650 <div title="bar/"></div>
8651 </div>
8652
8653 !! html/parsoid
8654 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8655 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8656 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
8657 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8658 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8659 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
8660 !! end
8661
8662 !! test
8663 Handling html with a br self-closing tag
8664 !! wikitext
8665 <br title />
8666 <br title/>
8667 <br title/ >
8668 <br title=bar />
8669 <br title=bar/>
8670 <br title=bar/ >
8671 !! html/php
8672 <p><br title="" />
8673 <br title="" />
8674 <br />
8675 <br title="bar" />
8676 <br title="bar" />
8677 <br title="bar/" />
8678 </p>
8679 !! html/parsoid
8680 <p><br title="" />
8681 <br title="" />
8682 <br title="" />
8683 <br title="bar" />
8684 <br title="bar" />
8685 <br title="bar/" />
8686 </p>
8687 !! end
8688
8689 !! test
8690 Horizontal ruler (should it add that extra space?)
8691 !! wikitext
8692 <hr>
8693 <hr >
8694 foo <hr
8695 > bar
8696 !! html+tidy
8697 <hr />
8698 <hr />
8699 <p>foo</p>
8700 <hr />
8701 <p>bar</p>
8702 !! end
8703
8704 !! test
8705 Horizontal ruler -- 4+ dashes render hr
8706 !! wikitext
8707 ----
8708 !! html
8709 <hr />
8710
8711 !! end
8712
8713 !! test
8714 Horizontal ruler -- eats additional dashes on the same line
8715 !! wikitext
8716 ---------
8717 !! html
8718 <hr />
8719
8720 !! end
8721
8722 !! test
8723 Horizontal ruler -- does not collapse dashes on consecutive lines
8724 !! wikitext
8725 ----
8726 ----
8727 !! html
8728 <hr />
8729 <hr />
8730
8731 !! end
8732
8733 !! test
8734 Horizontal ruler -- <4 dashes render as plain text
8735 !! wikitext
8736 ---
8737 !! html
8738 <p>---
8739 </p>
8740 !! end
8741
8742 !! test
8743 Horizontal ruler -- Supports content following dashes on same line
8744 !! wikitext
8745 ---- Foo
8746 !! html
8747 <hr /> Foo
8748
8749 !! html+tidy
8750 <hr />
8751 <p>Foo</p>
8752 !! end
8753
8754 ###
8755 ### Block-level elements
8756 ###
8757 !! test
8758 Common list
8759 !! wikitext
8760 *Common list
8761 * item 2
8762 *item 3
8763 !! html
8764 <ul><li>Common list</li>
8765 <li> item 2</li>
8766 <li>item 3</li></ul>
8767
8768 !! end
8769
8770 !! test
8771 Numbered list
8772 !! wikitext
8773 #Numbered list
8774 #item 2
8775 # item 3
8776 !! html
8777 <ol><li>Numbered list</li>
8778 <li>item 2</li>
8779 <li> item 3</li></ol>
8780
8781 !! end
8782
8783 !! test
8784 Mixed list
8785 !! wikitext
8786 *Mixed list
8787 *# with numbers
8788 ** and bullets
8789 *# and numbers
8790 *bullets again
8791 **bullet level 2
8792 ***bullet level 3
8793 ***#Number on level 4
8794 **bullet level 2
8795 **#Number on level 3
8796 **#Number on level 3
8797 *#number level 2
8798 *Level 1
8799 *** Level 3
8800 #** Level 3, but ordered
8801 !! html
8802 <ul><li>Mixed list
8803 <ol><li> with numbers</li></ol>
8804 <ul><li> and bullets</li></ul>
8805 <ol><li> and numbers</li></ol></li>
8806 <li>bullets again
8807 <ul><li>bullet level 2
8808 <ul><li>bullet level 3
8809 <ol><li>Number on level 4</li></ol></li></ul></li>
8810 <li>bullet level 2
8811 <ol><li>Number on level 3</li>
8812 <li>Number on level 3</li></ol></li></ul>
8813 <ol><li>number level 2</li></ol></li>
8814 <li>Level 1
8815 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
8816 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
8817
8818 !! end
8819
8820 !! test
8821 1. Nested mixed wikitext and html list
8822 !! wikitext
8823 * hi
8824 * <ul><li>ho</li></ul>
8825 * hi
8826 ** ho
8827 !! html/php
8828 <ul><li> hi</li>
8829 <li> <ul><li>ho</li></ul></li>
8830 <li> hi
8831 <ul><li> ho</li></ul></li></ul>
8832
8833 !! html/parsoid
8834 <ul><li> hi</li>
8835 <li> <ul data-parsoid='{"stx":"html"}'><li data-parsoid='{"stx":"html"}'>ho</li></ul></li>
8836 <li> hi
8837 <ul><li> ho</li></ul></li></ul>
8838 !! end
8839
8840 !! test
8841 2. Nested mixed wikitext and html list (incompatible)
8842 !! wikitext
8843 ; hi
8844 : {{echo|<li>ho</li>}}
8845 !! html/php
8846 <dl><dt> hi</dt>
8847 <dd> <li>ho</li></dd></dl>
8848
8849 !! html/parsoid
8850 <dl><dt> hi</dt>
8851 <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>
8852 !! end
8853
8854 !! test
8855 Nested lists 1
8856 !! wikitext
8857 *foo
8858 **bar
8859 !! html
8860 <ul><li>foo
8861 <ul><li>bar</li></ul></li></ul>
8862
8863 !! end
8864
8865 !! test
8866 Nested lists 2
8867 !! wikitext
8868 **foo
8869 *bar
8870 !! html
8871 <ul><li><ul><li>foo</li></ul></li>
8872 <li>bar</li></ul>
8873
8874 !! end
8875
8876 !! test
8877 Nested lists 3 (first element empty)
8878 !! wikitext
8879 *
8880 **bar
8881 !! html
8882 <ul><li>
8883 <ul><li>bar</li></ul></li></ul>
8884
8885 !! end
8886
8887 !! test
8888 Nested lists 4 (first element empty)
8889 !! wikitext
8890 **
8891 *bar
8892 !! html
8893 <ul><li><ul><li></li></ul></li>
8894 <li>bar</li></ul>
8895
8896 !! end
8897
8898 !! test
8899 Nested lists 5 (both elements empty)
8900 !! wikitext
8901 **
8902 *
8903 !! html
8904 <ul><li><ul><li></li></ul></li>
8905 <li></li></ul>
8906
8907 !! end
8908
8909 !! test
8910 Nested lists 6 (both elements empty)
8911 !! wikitext
8912 *
8913 **
8914 !! html
8915 <ul><li>
8916 <ul><li></li></ul></li></ul>
8917
8918 !! end
8919
8920 !! test
8921 Nested lists 7 (skip initial nesting levels)
8922 !! wikitext
8923 *** foo
8924 !! html
8925 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
8926
8927 !! end
8928
8929 !! test
8930 Nested lists 8 (multiple nesting transitions)
8931 !! wikitext
8932 * foo
8933 *** bar
8934 ** baz
8935 * boo
8936 !! html
8937 <ul><li> foo
8938 <ul><li><ul><li> bar</li></ul></li>
8939 <li> baz</li></ul></li>
8940 <li> boo</li></ul>
8941
8942 !! end
8943
8944 !! test
8945 Nested lists 9 (extension interaction)
8946 !! options
8947 parsoid
8948 !! wikitext
8949 *<references />
8950 !! html/parsoid
8951 <ul><li data-parsoid='{}'><ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
8952 !! end
8953
8954 !! test
8955 1. Lists with start-of-line-transparent tokens before bullets: Comments
8956 !! wikitext
8957 *foo
8958 *<!--cmt-->bar
8959 <!--cmt-->*baz
8960 !! html
8961 <ul><li>foo</li>
8962 <li>bar</li>
8963 <li>baz</li></ul>
8964
8965 !! end
8966
8967 !! test
8968 2. Lists with start-of-line-transparent tokens before bullets: Template close
8969 !! wikitext
8970 *foo {{echo|bar
8971 }}*baz
8972 !! html
8973 <ul><li>foo bar</li>
8974 <li>baz</li></ul>
8975
8976 !! end
8977
8978 !! test
8979 List items are not parsed correctly following a <pre> block (bug 785)
8980 !! wikitext
8981 * <pre>foo</pre>
8982 * <pre>bar</pre>
8983 * zar
8984 !! html/php
8985 <ul><li> <pre>foo</pre></li>
8986 <li> <pre>bar</pre></li>
8987 <li> zar</li></ul>
8988
8989 !! html/parsoid
8990 <ul><li> <pre data-parsoid='{"stx":"html"}'>foo</pre></li>
8991 <li> <pre data-parsoid='{"stx":"html"}'>bar</pre></li>
8992 <li> zar</li></ul>
8993 !! end
8994
8995 !! test
8996 List items from template
8997 !! wikitext
8998
8999 {{inner list}}
9000 * item 2
9001
9002 * item 0
9003 {{inner list}}
9004 * item 2
9005
9006 * item 0
9007 * notSOL{{inner list}}
9008 * item 2
9009 !! html
9010 <ul><li> item 1</li>
9011 <li> item 2</li></ul>
9012 <ul><li> item 0</li>
9013 <li> item 1</li>
9014 <li> item 2</li></ul>
9015 <ul><li> item 0</li>
9016 <li> notSOL</li>
9017 <li> item 1</li>
9018 <li> item 2</li></ul>
9019
9020 !! end
9021
9022 !! test
9023 List interrupted by empty line or heading
9024 !! wikitext
9025 * foo
9026
9027 ** bar
9028 == A heading ==
9029 * Another list item
9030 !! html
9031 <ul><li> foo</li></ul>
9032 <ul><li><ul><li> bar</li></ul></li></ul>
9033 <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>
9034 <ul><li> Another list item</li></ul>
9035
9036 !!end
9037
9038 !!test
9039 Multiple list tags generated by templates
9040 !! wikitext
9041 {{echo|<li>}}a
9042 {{echo|<li>}}b
9043 {{echo|<li>}}c
9044 !! html
9045 <li>a
9046 <li>b
9047 <li>c</li>
9048 </li>
9049 </li>
9050
9051 !! html+tidy
9052 <ul>
9053 <li>a</li>
9054 <li>b</li>
9055 <li>c</li>
9056 </ul>
9057 !!end
9058
9059 !!test
9060 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
9061 !! wikitext
9062 *a
9063 <!--This line will NOT split the list-->
9064 *b
9065 <!--This line will NOT split the list either-->
9066 *c
9067 <!--foo--> <!----> <!--This line NOT split the list either-->
9068 *d
9069 !! html
9070 <ul><li>a</li>
9071 <li>b</li>
9072 <li>c</li>
9073 <li>d</li></ul>
9074
9075 !!end
9076
9077 !!test
9078 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
9079 !! wikitext
9080 *a
9081 <!--This line will NOT split the list-->
9082 *b
9083 <!--This line will NOT split the list either-->
9084 *c
9085 <!--foo--> <!----> <!--This line NOT split the list
9086 either-->
9087 *d
9088 !! html
9089 <ul><li>a</li>
9090 <li>b</li>
9091 <li>c</li>
9092 <li>d</li></ul>
9093
9094 !!end
9095
9096 !!test
9097 Test the li-hack
9098 (The PHP parser relies on Tidy for the hack)
9099 !!options
9100 parsoid=wt2html,wt2wt
9101 !! wikitext
9102 * foo
9103 * <li>li-hack
9104 * {{echo|<li>templated li-hack}}
9105 * <!--foo--> <li> unsupported li-hack with preceding comments
9106
9107 <ul>
9108 <li><li>not a li-hack
9109 </li>
9110 </ul>
9111 !! html+tidy
9112 <ul>
9113 <li>foo</li>
9114 <li>li-hack</li>
9115 <li>templated li-hack</li>
9116 <li>unsupported li-hack with preceding comments</li>
9117 </ul>
9118 <ul>
9119 <li>not a li-hack</li>
9120 </ul>
9121 !!end
9122
9123 !! test
9124 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
9125 !! options
9126 parsoid
9127 !! wikitext
9128 # foo
9129 ## bar
9130 * foo
9131 ** bar
9132 : foo
9133 :: bar
9134 !! html
9135 <ol>
9136 <li> foo<ol>
9137 <li> bar</li>
9138 </ol></li>
9139 </ol><ul>
9140 <li> foo<ul>
9141 <li> bar</li>
9142 </ul></li>
9143 </ul><dl>
9144 <dd> foo<dl>
9145 <dd> bar</dd>
9146 </dl></dd>
9147 </dl>
9148 !! end
9149
9150 !! test
9151 Parsoid: Test of whitespace serialization with Templated bullets
9152 !! options
9153 parsoid
9154 !! wikitext
9155 * {{bullet}}
9156 !! html
9157 <ul>
9158 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
9159 </ul>
9160 !! end
9161
9162 # ------------------------------------------------------------------------
9163 # The next set of tests are about Parsoid's ability to handle badly nested
9164 # tags (parse, minimize scope of fixup, and roundtrip back)
9165 # ------------------------------------------------------------------------
9166
9167 !! test
9168 Unbalanced closing block tags break a list
9169 (php parser relies on Tidy to fix up)
9170 !! wikitext
9171 <div>
9172 *a</div><div>
9173 *b</div>
9174 !! html+tidy
9175 <div>
9176 <ul>
9177 <li>a</li>
9178 </ul>
9179 </div>
9180 <div>
9181 <ul>
9182 <li>b</li>
9183 </ul>
9184 </div>
9185 !! end
9186
9187 # Parsoid fails this test, but it might be tricky to support properly.
9188 # See bug 68395.
9189 !! test
9190 Unbalanced closing non-block tags don't break a list
9191 (php parser relies on Tidy to fix up)
9192 !! wikitext
9193 <span>
9194 *a</span><span>
9195 *b</span>
9196 !! html/php+tidy
9197 <ul>
9198 <li><span>a</span></li>
9199 <li><span>b</span></li>
9200 </ul>
9201 !! html/parsoid
9202 <span>
9203 <ul>
9204 <li>a<span></span>
9205 </li>
9206 <li>b
9207 </li>
9208 </ul>
9209 </span>
9210 !! end
9211
9212 !! test
9213 Unclosed formatting tags that straddle lists are closed and reopened
9214 (php parser relies on Tidy to fix up)
9215 !! options
9216 parsoid=wt2html,wt2wt,html2html
9217 !! wikitext
9218 # <s> a
9219 # b </s>
9220 !! html/php+tidy
9221 <ol>
9222 <li><s>a</s></li>
9223 <li><s>b</s></li>
9224 </ol>
9225 !! html/parsoid
9226 <ol><li> <s> a</s></li>
9227 <li><s> b </s></li></ol>
9228 !! end
9229
9230 # See bug 68395.
9231 !!test
9232 1. List embedded in a formatting tag
9233 !! wikitext
9234 <small>
9235 * foo
9236 </small>
9237 !! html/php+tidy
9238 <ul>
9239 <li><small>foo</small></li>
9240 </ul>
9241 !! html/parsoid
9242 <small>
9243 <ul>
9244 <li> foo</li>
9245 </ul>
9246 </small>
9247 !!end
9248
9249 ## Ugly Parsoid output here
9250 ## Not sure what the right output is.
9251 !!test
9252 2. List embedded in a formatting tag
9253 !! wikitext
9254 <small>
9255 *a
9256 *b</small>
9257 !! html/php+tidy
9258 <ul>
9259 <li><small>a</small></li>
9260 <li><small>b</small></li>
9261 </ul>
9262 !! html/parsoid
9263 <small></small>
9264 <ul><small>
9265 <li>a</li>
9266 </small>
9267 <li><small>b</small></li>
9268 </ul>
9269 !!end
9270
9271 # Ugly Parsoid and PHP parser output here
9272 # Not sure if we want to make this a test!
9273 #
9274 ## !!test
9275 ## 3. Unclosed formatting tags in list elements
9276 ## !! wikitext
9277 ## *<small>a
9278 ## *<small>b
9279 ## !! html/php+tidy
9280 ## <ul>
9281 ## <li><small>a</small></li>
9282 ## <li><small><small>b</small></small></li>
9283 ## </ul>
9284 ## !! html/parsoid
9285 ## <ul>
9286 ## <li><small>a</small></li>
9287 ## <small>
9288 ## <li><small>b</small></li>
9289 ## </small></ul>
9290 ## !!end
9291
9292 # This is a bug in the PHP parser + tidy combination.
9293 # (The </tr> tag gets parsed as text and html-escaped by PHP,
9294 # and then fostered out of the table by tidy.)
9295 # We believe the Parsoid output to be correct.
9296 !! test
9297 Table with missing opening <tr> tag
9298 !! options
9299 parsoid=wt2html,wt2wt
9300 !! wikitext
9301 <table>
9302 <td>foo</td>
9303 </tr>
9304 </table>
9305 !! html+tidy
9306 <table>
9307 <tr>
9308 <td>foo</td>
9309 </tr>
9310 </table>
9311 !! end
9312
9313 ###
9314 ### Magic Words
9315 ###
9316
9317 # Note that the current date is hard-coded as
9318 # 1970-01-01T00:02:03Z (a Thursday)
9319 # when running parser tests. The timezone is also fixed to GMT, so
9320 # local date will be identical to current date.
9321
9322 !! test
9323 Magic Word: {{CURRENTDAY}}
9324 !! wikitext
9325 {{CURRENTDAY}}
9326 !! html
9327 <p>1
9328 </p>
9329 !! end
9330
9331 !! test
9332 Magic Word: {{CURRENTDAY2}}
9333 !! wikitext
9334 {{CURRENTDAY2}}
9335 !! html
9336 <p>01
9337 </p>
9338 !! end
9339
9340 !! test
9341 Magic Word: {{CURRENTDAYNAME}}
9342 !! wikitext
9343 {{CURRENTDAYNAME}}
9344 !! html
9345 <p>Thursday
9346 </p>
9347 !! end
9348
9349 !! test
9350 Magic Word: {{CURRENTDOW}}
9351 !! wikitext
9352 {{CURRENTDOW}}
9353 !! html
9354 <p>4
9355 </p>
9356 !! end
9357
9358 !! test
9359 Magic Word: {{CURRENTMONTH}}
9360 !! wikitext
9361 {{CURRENTMONTH}}
9362 !! html
9363 <p>01
9364 </p>
9365 !! end
9366
9367 !! test
9368 Magic Word: {{CURRENTMONTH1}}
9369 !! wikitext
9370 {{CURRENTMONTH1}}
9371 !! html
9372 <p>1
9373 </p>
9374 !! end
9375
9376 !! test
9377 Magic Word: {{CURRENTMONTHABBREV}}
9378 !! wikitext
9379 {{CURRENTMONTHABBREV}}
9380 !! html
9381 <p>Jan
9382 </p>
9383 !! end
9384
9385 !! test
9386 Magic Word: {{CURRENTMONTHNAME}}
9387 !! wikitext
9388 {{CURRENTMONTHNAME}}
9389 !! html
9390 <p>January
9391 </p>
9392 !! end
9393
9394 !! test
9395 Magic Word: {{CURRENTMONTHNAMEGEN}}
9396 !! wikitext
9397 {{CURRENTMONTHNAMEGEN}}
9398 !! html
9399 <p>January
9400 </p>
9401 !! end
9402
9403 !! test
9404 Magic Word: {{CURRENTTIME}}
9405 !! wikitext
9406 {{CURRENTTIME}}
9407 !! html
9408 <p>00:02
9409 </p>
9410 !! end
9411
9412 !! test
9413 Magic Word: {{CURRENTHOUR}}
9414 !! wikitext
9415 {{CURRENTHOUR}}
9416 !! html
9417 <p>00
9418 </p>
9419 !! end
9420
9421 !! test
9422 Magic Word: {{CURRENTWEEK}} (@bug 4594)
9423 !! wikitext
9424 {{CURRENTWEEK}}
9425 !! html
9426 <p>1
9427 </p>
9428 !! end
9429
9430 !! test
9431 Magic Word: {{CURRENTYEAR}}
9432 !! wikitext
9433 {{CURRENTYEAR}}
9434 !! html
9435 <p>1970
9436 </p>
9437 !! end
9438
9439 !! test
9440 Magic Word: {{CURRENTTIMESTAMP}}
9441 !! wikitext
9442 {{CURRENTTIMESTAMP}}
9443 !! html
9444 <p>19700101000203
9445 </p>
9446 !! end
9447
9448 !! test
9449 Magic Words LOCAL (UTC)
9450 !! wikitext
9451 * {{LOCALMONTH}}
9452 * {{LOCALMONTH1}}
9453 * {{LOCALMONTHNAME}}
9454 * {{LOCALMONTHNAMEGEN}}
9455 * {{LOCALMONTHABBREV}}
9456 * {{LOCALDAY}}
9457 * {{LOCALDAY2}}
9458 * {{LOCALDAYNAME}}
9459 * {{LOCALYEAR}}
9460 * {{LOCALTIME}}
9461 * {{LOCALHOUR}}
9462 * {{LOCALWEEK}}
9463 * {{LOCALDOW}}
9464 * {{LOCALTIMESTAMP}}
9465 !! html
9466 <ul><li> 01</li>
9467 <li> 1</li>
9468 <li> January</li>
9469 <li> January</li>
9470 <li> Jan</li>
9471 <li> 1</li>
9472 <li> 01</li>
9473 <li> Thursday</li>
9474 <li> 1970</li>
9475 <li> 00:02</li>
9476 <li> 00</li>
9477 <li> 1</li>
9478 <li> 4</li>
9479 <li> 19700101000203</li></ul>
9480
9481 !! end
9482
9483 !! test
9484 Magic Word: {{FULLPAGENAME}}
9485 !! options
9486 title=[[User:Ævar Arnfjörð Bjarmason]]
9487 !! wikitext
9488 {{FULLPAGENAME}}
9489 !! html
9490 <p>User:Ævar Arnfjörð Bjarmason
9491 </p>
9492 !! end
9493
9494 !! test
9495 Magic Word: {{FULLPAGENAMEE}}
9496 !! options
9497 title=[[User:Ævar Arnfjörð Bjarmason]]
9498 !! wikitext
9499 {{FULLPAGENAMEE}}
9500 !! html
9501 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9502 </p>
9503 !! end
9504
9505 !! test
9506 Magic Word: {{TALKSPACE}}
9507 !! options
9508 title=[[User:Ævar Arnfjörð Bjarmason]]
9509 !! wikitext
9510 {{TALKSPACE}}
9511 !! html
9512 <p>User talk
9513 </p>
9514 !! end
9515
9516 !! test
9517 Magic Word: {{TALKSPACE}}, same namespace
9518 !! options
9519 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9520 !! wikitext
9521 {{TALKSPACE}}
9522 !! html
9523 <p>User talk
9524 </p>
9525 !! end
9526
9527 !! test
9528 Magic Word: {{TALKSPACE}}, main namespace
9529 !! options
9530 title=[[Parser Test]]
9531 !! wikitext
9532 {{TALKSPACE}}
9533 !! html
9534 <p>Talk
9535 </p>
9536 !! end
9537
9538 !! test
9539 Magic Word: {{TALKSPACEE}}
9540 !! options
9541 title=[[User:Ævar Arnfjörð Bjarmason]]
9542 !! wikitext
9543 {{TALKSPACEE}}
9544 !! html
9545 <p>User_talk
9546 </p>
9547 !! end
9548
9549 !! test
9550 Magic Word: {{SUBJECTSPACE}}
9551 !! options
9552 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9553 !! wikitext
9554 {{SUBJECTSPACE}}
9555 !! html
9556 <p>User
9557 </p>
9558 !! end
9559
9560 !! test
9561 Magic Word: {{SUBJECTSPACE}}, same namespace
9562 !! options
9563 title=[[User:Ævar Arnfjörð Bjarmason]]
9564 !! wikitext
9565 {{SUBJECTSPACE}}
9566 !! html
9567 <p>User
9568 </p>
9569 !! end
9570
9571 !! test
9572 Magic Word: {{SUBJECTSPACE}}, main namespace
9573 !! options
9574 title=[[Parser Test]]
9575 !! wikitext
9576 {{SUBJECTSPACE}}
9577 !! html
9578
9579 !! end
9580
9581 !! test
9582 Magic Word: {{SUBJECTSPACEE}}
9583 !! options
9584 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9585 !! wikitext
9586 {{SUBJECTSPACEE}}
9587 !! html
9588 <p>User
9589 </p>
9590 !! end
9591
9592 !! test
9593 Magic Word: {{NAMESPACE}}
9594 !! options
9595 title=[[User:Ævar Arnfjörð Bjarmason]]
9596 !! wikitext
9597 {{NAMESPACE}}
9598 !! html
9599 <p>User
9600 </p>
9601 !! end
9602
9603 !! test
9604 Magic Word: {{NAMESPACEE}}
9605 !! options
9606 title=[[User:Ævar Arnfjörð Bjarmason]]
9607 !! wikitext
9608 {{NAMESPACEE}}
9609 !! html
9610 <p>User
9611 </p>
9612 !! end
9613
9614 !! test
9615 Magic Word: {{NAMESPACENUMBER}}
9616 !! options
9617 title=[[User:Ævar Arnfjörð Bjarmason]]
9618 !! wikitext
9619 {{NAMESPACENUMBER}}
9620 !! html
9621 <p>2
9622 </p>
9623 !! end
9624
9625 !! test
9626 Magic Word: {{SUBPAGENAME}}
9627 !! options
9628 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9629 !! wikitext
9630 {{SUBPAGENAME}}
9631 !! html
9632 <p>sub ö
9633 </p>
9634 !! end
9635
9636 !! test
9637 Magic Word: {{SUBPAGENAMEE}}
9638 !! options
9639 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9640 !! wikitext
9641 {{SUBPAGENAMEE}}
9642 !! html
9643 <p>sub_%C3%B6
9644 </p>
9645 !! end
9646
9647 !! test
9648 Magic Word: {{ROOTPAGENAME}}
9649 !! options
9650 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9651 !! wikitext
9652 {{ROOTPAGENAME}}
9653 !! html
9654 <p>Ævar Arnfjörð Bjarmason
9655 </p>
9656 !! end
9657
9658 !! test
9659 Magic Word: {{ROOTPAGENAMEE}}
9660 !! options
9661 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9662 !! wikitext
9663 {{ROOTPAGENAMEE}}
9664 !! html
9665 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9666 </p>
9667 !! end
9668
9669 !! test
9670 Magic Word: {{BASEPAGENAME}}
9671 !! options
9672 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9673 !! wikitext
9674 {{BASEPAGENAME}}
9675 !! html
9676 <p>Ævar Arnfjörð Bjarmason
9677 </p>
9678 !! end
9679
9680 !! test
9681 Magic Word: {{BASEPAGENAMEE}}
9682 !! options
9683 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9684 !! wikitext
9685 {{BASEPAGENAMEE}}
9686 !! html
9687 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9688 </p>
9689 !! end
9690
9691 !! test
9692 Magic Word: {{TALKPAGENAME}}
9693 !! options
9694 title=[[User:Ævar Arnfjörð Bjarmason]]
9695 !! wikitext
9696 {{TALKPAGENAME}}
9697 !! html
9698 <p>User talk:Ævar Arnfjörð Bjarmason
9699 </p>
9700 !! end
9701
9702 !! test
9703 Magic Word: {{TALKPAGENAMEE}}
9704 !! options
9705 title=[[User:Ævar Arnfjörð Bjarmason]]
9706 !! wikitext
9707 {{TALKPAGENAMEE}}
9708 !! html
9709 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9710 </p>
9711 !! end
9712
9713 !! test
9714 Magic Word: {{SUBJECTPAGENAME}}
9715 !! options
9716 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9717 !! wikitext
9718 {{SUBJECTPAGENAME}}
9719 !! html
9720 <p>User:Ævar Arnfjörð Bjarmason
9721 </p>
9722 !! end
9723
9724 !! test
9725 Magic Word: {{SUBJECTPAGENAMEE}}
9726 !! options
9727 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9728 !! wikitext
9729 {{SUBJECTPAGENAMEE}}
9730 !! html
9731 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9732 </p>
9733 !! end
9734
9735 !! test
9736 Magic Word: {{NUMBEROFFILES}}
9737 !! wikitext
9738 {{NUMBEROFFILES}}
9739 !! html
9740 <p>6
9741 </p>
9742 !! end
9743
9744 !! test
9745 Magic Word: {{PAGENAME}}
9746 !! options
9747 title=[[User:Ævar Arnfjörð Bjarmason]]
9748 !! wikitext
9749 {{PAGENAME}}
9750 !! html
9751 <p>Ævar Arnfjörð Bjarmason
9752 </p>
9753 !! end
9754
9755 !! test
9756 Magic Word: {{PAGENAME}} with metacharacters
9757 !! options
9758 title=[['foo & bar = baz']]
9759 !! wikitext
9760 ''{{PAGENAME}}''
9761 !! html/php
9762 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
9763 </p>
9764 !! html+tidy
9765 <p><i>'foo &amp; bar = baz'</i></p>
9766 !! end
9767
9768 !! test
9769 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
9770 !! options
9771 title=[[*RFC 1234 http://example.com/]]
9772 !! wikitext
9773 {{PAGENAME}}
9774 !! html/php
9775 <p>&#42;RFC&#32;1234 http&#58;//example.com/
9776 </p>
9777 !! html+tidy
9778 <p>*RFC 1234 http://example.com/</p>
9779 !! end
9780
9781 !! test
9782 Magic Word: {{PAGENAMEE}}
9783 !! options
9784 title=[[User:Ævar Arnfjörð Bjarmason]]
9785 !! wikitext
9786 {{PAGENAMEE}}
9787 !! html
9788 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9789 </p>
9790 !! end
9791
9792 !! test
9793 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
9794 !! options
9795 title=[[*RFC 1234 http://example.com/]]
9796 !! wikitext
9797 {{PAGENAMEE}}
9798 !! html/php
9799 <p>&#42;RFC_1234_http&#58;//example.com/
9800 </p>
9801 !! html+tidy
9802 <p>*RFC_1234_http://example.com/</p>
9803 !! end
9804
9805 !! test
9806 Magic Word: {{REVISIONID}}
9807 !! wikitext
9808 {{REVISIONID}}
9809 !! html
9810 <p>1337
9811 </p>
9812 !! end
9813
9814 !! test
9815 Magic Word: {{SCRIPTPATH}}
9816 !! wikitext
9817 {{SCRIPTPATH}}
9818 !! html
9819
9820 !! end
9821
9822 !! test
9823 Magic Word: {{STYLEPATH}}
9824 !! wikitext
9825 {{STYLEPATH}}
9826 !! html
9827 <p>/skins
9828 </p>
9829 !! end
9830
9831 !! test
9832 Magic Word: {{SERVER}}
9833 !! wikitext
9834 {{SERVER}}
9835 !! html
9836 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9837 </p>
9838 !! end
9839
9840 !! test
9841 Magic Word: {{SERVERNAME}}
9842 !! wikitext
9843 {{SERVERNAME}}
9844 !! html
9845 <p>example.org
9846 </p>
9847 !! end
9848
9849 !! test
9850 Magic Word: {{SITENAME}}
9851 !! wikitext
9852 {{SITENAME}}
9853 !! html
9854 <p>MediaWiki
9855 </p>
9856 !! end
9857
9858 !! test
9859 Case-sensitive magic words, when cased differently, should just be template transclusions
9860 !! wikitext
9861 {{CurrentMonth}}
9862 {{currentday}}
9863 {{cURreNTweEK}}
9864 {{currentHour}}
9865 !! html
9866 <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>
9867 <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>
9868 <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>
9869 <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>
9870 </p>
9871 !! end
9872
9873 !! test
9874 Case-insensitive magic words should still work with weird casing.
9875 !! wikitext
9876 {{sErVeRNaMe}}
9877 {{LCFirst:AOEU}}
9878 {{ucFIRST:aoeu}}
9879 {{SERver}}
9880 !! html
9881 <p>example.org
9882 aOEU
9883 Aoeu
9884 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9885 </p>
9886 !! end
9887
9888 # From plwiki:PLOS_ONE
9889 !! test
9890 Parsoid: Page property magic word with magic word contents
9891 !! wikitext
9892 {{DISPLAYTITLE:''{{PAGENAME}}''}}
9893 !! html/parsoid
9894 <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>"}]]}'/>
9895 !! end
9896
9897 !! test
9898 Parsoid: Template-generated DISPLAYTITLE
9899 !! wikitext
9900 {{{{echo|DISPLAYTITLE}}:Foo}}
9901 !! html/parsoid
9902 <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}}]}'/>
9903 !! end
9904
9905 !! test
9906 Namespace 1 {{ns:1}}
9907 !! wikitext
9908 {{ns:1}}
9909 !! html
9910 <p>Talk
9911 </p>
9912 !! end
9913
9914 !! test
9915 Namespace 1 {{ns:01}}
9916 !! wikitext
9917 {{ns:01}}
9918 !! html
9919 <p>Talk
9920 </p>
9921 !! end
9922
9923 !! test
9924 Namespace 0 {{ns:0}} (bug 4783)
9925 !! wikitext
9926 {{ns:0}}
9927 !! html
9928
9929 !! end
9930
9931 !! test
9932 Namespace 0 {{ns:00}} (bug 4783)
9933 !! wikitext
9934 {{ns:00}}
9935 !! html
9936
9937 !! end
9938
9939 !! test
9940 Namespace -1 {{ns:-1}}
9941 !! wikitext
9942 {{ns:-1}}
9943 !! html
9944 <p>Special
9945 </p>
9946 !! end
9947
9948 !! test
9949 Namespace User {{ns:User}}
9950 !! wikitext
9951 {{ns:User}}
9952 !! html
9953 <p>User
9954 </p>
9955 !! end
9956
9957 !! test
9958 Namespace User talk {{ns:User_talk}}
9959 !! wikitext
9960 {{ns:User_talk}}
9961 !! html
9962 <p>User talk
9963 </p>
9964 !! end
9965
9966 !! test
9967 Namespace User talk {{ns:uSeR tAlK}}
9968 !! wikitext
9969 {{ns:uSeR tAlK}}
9970 !! html
9971 <p>User talk
9972 </p>
9973 !! end
9974
9975 !! test
9976 Namespace File {{ns:File}}
9977 !! wikitext
9978 {{ns:File}}
9979 !! html
9980 <p>File
9981 </p>
9982 !! end
9983
9984 !! test
9985 Namespace File {{ns:Image}}
9986 !! wikitext
9987 {{ns:Image}}
9988 !! html
9989 <p>File
9990 </p>
9991 !! end
9992
9993 !! test
9994 Namespace (lang=de) Benutzer {{ns:User}}
9995 !! options
9996 language=de
9997 !! wikitext
9998 {{ns:User}}
9999 !! html
10000 <p>Benutzer
10001 </p>
10002 !! end
10003
10004 !! test
10005 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
10006 !! options
10007 language=de
10008 !! wikitext
10009 {{ns:3}}
10010 !! html
10011 <p>Benutzer Diskussion
10012 </p>
10013 !! end
10014
10015
10016 !! test
10017 Urlencode
10018 !! wikitext
10019 {{urlencode:hi world?!}}
10020 {{urlencode:hi world?!|WIKI}}
10021 {{urlencode:hi world?!|PATH}}
10022 {{urlencode:hi world?!|QUERY}}
10023 !! html
10024 <p>hi+world%3F%21
10025 hi_world%3F!
10026 hi%20world%3F%21
10027 hi+world%3F%21
10028 </p>
10029 !! end
10030
10031 !! test
10032 Magic Word: prioritize type info over data-parsoid
10033 !! options
10034 parsoid=html2wt
10035 !! html/parsoid
10036 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
10037 !! wikitext
10038 __FORCETOC__
10039 !! end
10040
10041 !! test
10042 Magic Word: serialize on separate line (parsoid)
10043 !! options
10044 parsoid=wt2wt,html2wt
10045 !! wikitext
10046 foo
10047 __NOTOC__
10048 bar
10049 !! html/parsoid
10050 foo<meta property="mw:PageProp/notoc"/>bar
10051 !! end
10052
10053 !! test
10054 Magic Word: rt non-english wikis
10055 !! options
10056 parsoid=wt2wt
10057 language=de
10058 !! wikitext
10059 __NOEDITSECTION__
10060 !! html/parsoid
10061 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
10062 !! end
10063
10064 !!test
10065 __proto__ is treated as normal wikitext (T105997)
10066 !!wikitext
10067 __proto__
10068 !!html
10069 <p>__proto__
10070 </p>
10071 !!end
10072
10073 ###
10074 ### Magic links
10075 ###
10076 !! test
10077 Magic links: internal link to RFC (bug 479)
10078 !! wikitext
10079 [[RFC 123]]
10080 !! html/php
10081 <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>
10082 </p>
10083 !! html/parsoid
10084 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
10085 !! end
10086
10087 !! test
10088 Magic links: RFC (bug 479)
10089 !! wikitext
10090 RFC 822
10091 !! html/php
10092 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10093 </p>
10094 !! html/parsoid
10095 <p><a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a></p>
10096 !! end
10097
10098 !! test
10099 Magic links: RFC (bug 65278)
10100 !! wikitext
10101 This is RFC 822 but thisRFC 822 is not RFC 822linked.
10102 !! html/php
10103 <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.
10104 </p>
10105 !! html/parsoid
10106 <p>This is <a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a> but thisRFC 822 is not RFC 822linked.</p>
10107 !! end
10108
10109 !! test
10110 Magic links: RFC (w/ non-newline whitespace, bug 28950/29025)
10111 !! wikitext
10112 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
10113 RFC
10114 822
10115 !! html/php
10116 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10117 RFC
10118 822
10119 </p>
10120 !! html/parsoid
10121 <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>
10122 RFC
10123 822</p>
10124 !! end
10125
10126 !! test
10127 Magic links: ISBN (bug 1937)
10128 !! wikitext
10129 ISBN 0-306-40615-2
10130 !! html/php
10131 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
10132 </p>
10133 !! html/parsoid
10134 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
10135 !! end
10136
10137 !! test
10138 Magic links: ISBN (bug 65278)
10139 !! wikitext
10140 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
10141 !! html/php
10142 <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.
10143 </p>
10144 !! html/parsoid
10145 <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>
10146 !! end
10147
10148 !! test
10149 Magic links: ISBN (w/ non-newline whitespace, bug 28950/29025)
10150 !! wikitext
10151 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
10152 ISBN
10153 9780316098113
10154 ISBN 978
10155 0316098113
10156 !! html/php
10157 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
10158 ISBN
10159 9780316098113
10160 ISBN 978
10161 0316098113
10162 </p>
10163 !! html/parsoid
10164 <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>
10165 ISBN
10166 9780316098113
10167 ISBN 978
10168 0316098113</p>
10169 !! end
10170
10171 !! test
10172 Magic links: PMID incorrectly converts space to underscore
10173 !! wikitext
10174 PMID 1234
10175 !! html/php
10176 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10177 </p>
10178 !! html/parsoid
10179 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a></p>
10180 !! end
10181
10182 !! test
10183 Magic links: PMID (bug 65278)
10184 !! wikitext
10185 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
10186 !! html/php
10187 <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.
10188 </p>
10189 !! html/parsoid
10190 <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>
10191 !! end
10192
10193 !! test
10194 Magic links: PMID (w/ non-newline whitespace, bug 28950/29025)
10195 !! wikitext
10196 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
10197 PMID
10198 1234
10199 !! html/php
10200 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10201 PMID
10202 1234
10203 </p>
10204 !! html/parsoid
10205 <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>
10206 PMID
10207 1234</p>
10208 !! end
10209
10210 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
10211 # since these are ExtLinkText, not MagicLinkText
10212 !! test
10213 Magic links: use appropriate serialization for "almost" magic links.
10214 !! wikitext
10215 X[[Special:BookSources/0978739256|foo]]
10216
10217 X[//tools.ietf.org/html/rfc1234 foo]
10218 !! html/php
10219 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
10220 </p><p>X<a rel="nofollow" class="external text" href="//tools.ietf.org/html/rfc1234">foo</a>
10221 </p>
10222 !! html/parsoid
10223 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
10224 <p>X<a rel="mw:ExtLink" href="//tools.ietf.org/html/rfc1234">foo</a></p>
10225 !! end
10226
10227 ###
10228 ### Templates
10229 ####
10230
10231 !! test
10232 Nonexistent template
10233 !! wikitext
10234 {{thistemplatedoesnotexist}}
10235 !! html
10236 <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>
10237 </p>
10238 !! end
10239
10240 !! test
10241 Template with invalid target containing tags
10242 !! wikitext
10243 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10244 !! html
10245 <p>{{a<b>b</b>|foo|a=b|a = b}}
10246 </p>
10247 !! end
10248
10249 !! test
10250 Template with invalid target containing unclosed tag
10251 !! wikitext
10252 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10253 !! html
10254 <p>{{a<b>|foo|a=b|a = b}}</b>
10255 </p>
10256 !! end
10257
10258 !! test
10259 Template with invalid target containing wikilink
10260 !! wikitext
10261 {{[[Main Page]]}}
10262 !! html/php
10263 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
10264 </p>
10265 !! html/parsoid
10266 <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>
10267 !! end
10268
10269 !! test
10270 Template with just whitespace in it, bug #68421
10271 !! wikitext
10272 {{echo|{{ }}}}
10273 !! html/parsoid
10274 <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>
10275 !! end
10276
10277 !! article
10278 Template:test
10279 !! text
10280 This is a test template
10281 !! endarticle
10282
10283 !! test
10284 Simple template
10285 !! wikitext
10286 {{test}}
10287 !! html
10288 <p>This is a test template
10289 </p>
10290 !! end
10291
10292 !! test
10293 Template with explicit namespace
10294 !! wikitext
10295 {{Template:test}}
10296 !! html
10297 <p>This is a test template
10298 </p>
10299 !! end
10300
10301
10302 !! article
10303 Template:paramtest
10304 !! text
10305 This is a test template with parameter {{{param}}}
10306 !! endarticle
10307
10308 !! test
10309 Template parameter
10310 !! wikitext
10311 {{paramtest|param=foo}}
10312 !! html
10313 <p>This is a test template with parameter foo
10314 </p>
10315 !! end
10316
10317 !! article
10318 Template:paramtestnum
10319 !! text
10320 [[{{{1}}}|{{{2}}}]]
10321 !! endarticle
10322
10323 !! test
10324 Template unnamed parameter
10325 !! wikitext
10326 {{paramtestnum|Main Page|the main page}}
10327 !! html
10328 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
10329 </p>
10330 !! end
10331
10332 !! article
10333 Template:templatesimple
10334 !! text
10335 (test)
10336 !! endarticle
10337
10338 !! article
10339 Template:templateredirect
10340 !! text
10341 #redirect [[Template:templatesimple]]
10342 !! endarticle
10343
10344 !! article
10345 Template:templateasargtestnum
10346 !! text
10347 {{{{{1}}}}}
10348 !! endarticle
10349
10350 !! article
10351 Template:templateasargtest
10352 !! text
10353 {{template{{{templ}}}}}
10354 !! endarticle
10355
10356 !! article
10357 Template:templateasargtest2
10358 !! text
10359 {{{{{templ}}}}}
10360 !! endarticle
10361
10362 !! test
10363 Template with template name as unnamed argument
10364 !! wikitext
10365 {{templateasargtestnum|templatesimple}}
10366 !! html
10367 <p>(test)
10368 </p>
10369 !! end
10370
10371 !! test
10372 Template with template name as argument
10373 !! wikitext
10374 {{templateasargtest|templ=simple}}
10375 !! html
10376 <p>(test)
10377 </p>
10378 !! end
10379
10380 !! test
10381 Template with template name as argument (2)
10382 !! wikitext
10383 {{templateasargtest2|templ=templatesimple}}
10384 !! html
10385 <p>(test)
10386 </p>
10387 !! end
10388
10389 !! article
10390 Template:templateasargtestdefault
10391 !! text
10392 {{{{{templ|templatesimple}}}}}
10393 !! endarticle
10394
10395 !! article
10396 Template:templa
10397 !! text
10398 '''templ'''
10399 !! endarticle
10400
10401 !! test
10402 Template with default value
10403 !! wikitext
10404 {{templateasargtestdefault}}
10405 !! html
10406 <p>(test)
10407 </p>
10408 !! end
10409
10410 !! test
10411 Template with default value (value set)
10412 !! wikitext
10413 {{templateasargtestdefault|templ=templa}}
10414 !! html
10415 <p><b>templ</b>
10416 </p>
10417 !! end
10418
10419 !! test
10420 Template redirect
10421 !! wikitext
10422 {{templateredirect}}
10423 !! html/php
10424 <p>(test)
10425 </p>
10426 !! html/parsoid
10427 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
10428 !! end
10429
10430 !! test
10431 Template with argument in separate line
10432 !! wikitext
10433 {{ templateasargtest |
10434 templ = simple }}
10435 !! html
10436 <p>(test)
10437 </p>
10438 !! end
10439
10440 !! test
10441 Template with complex template as argument
10442 !! wikitext
10443 {{paramtest|
10444 param ={{ templateasargtest |
10445 templ = simple }}}}
10446 !! html
10447 <p>This is a test template with parameter (test)
10448 </p>
10449 !! end
10450
10451 !! test
10452 Template with thumb image (with link in description)
10453 !! wikitext
10454 {{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
10455 !! html/php
10456 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>
10457
10458 !! html+tidy
10459 <p>This is a test template with parameter</p>
10460 <div class="thumb tright">
10461 <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>
10462 <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>
10463 </div>
10464 </div>
10465 !! html/parsoid
10466 <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>
10467 !! end
10468
10469 !! article
10470 Template:complextemplate
10471 !! text
10472 {{{1}}} {{paramtest|
10473 param ={{{param}}}}}
10474 !! endarticle
10475
10476 !! test
10477 Template with complex arguments
10478 !! wikitext
10479 {{complextemplate|
10480 param ={{ templateasargtest |
10481 templ = simple }}|[[Template:complextemplate|link]]}}
10482 !! html
10483 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
10484 </p>
10485 !! end
10486
10487 !! test
10488 BUG 553: link with two variables in a piped link
10489 !! wikitext
10490 {|
10491 |[[{{{1}}}|{{{2}}}]]
10492 |}
10493 !! html/php
10494 <table>
10495 <tr>
10496 <td>[[{{{1}}}|{{{2}}}]]
10497 </td></tr></table>
10498
10499 !! html/parsoid
10500 <table>
10501 <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>
10502 !! end
10503
10504 # See: T2553
10505 !! test
10506 Abort table cell attribute parsing on wikilink
10507 !! wikitext
10508 {|
10509 | testing [[one|two]] | three || four
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>
10522 <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>
10523 <td> four
10524 </td></tr></table>
10525
10526 !! html/parsoid
10527 <table>
10528 <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>
10529 <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>
10530 <td> 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></tr>
10531 </tbody></table>
10532 !! end
10533
10534 !! test
10535 Don't abort table cell attribute parsing if wikilink is found in template arg
10536 !! wikitext
10537 {|
10538 | Test {{#tag:ref|One two "[[three]]" four}}
10539 |}
10540 !! html/parsoid
10541 <table>
10542 <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>
10543 </tbody></table>
10544 !! end
10545
10546 !! test
10547 Magic variable as template parameter
10548 !! wikitext
10549 {{paramtest|param={{SITENAME}}}}
10550 !! html
10551 <p>This is a test template with parameter MediaWiki
10552 </p>
10553 !! end
10554
10555 !! article
10556 Template:linktest
10557 !! text
10558 [[{{{param}}}|link]]
10559 !! endarticle
10560
10561 !! test
10562 Template parameter as link source
10563 !! wikitext
10564 {{linktest|param=Main Page}}
10565 !! html
10566 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
10567 </p>
10568 !! end
10569
10570 !!article
10571 Template:paramtest2
10572 !! text
10573 including another template, {{paramtest|param={{{arg}}}}}
10574 !! endarticle
10575
10576 !! test
10577 Template passing argument to another template
10578 !! wikitext
10579 {{paramtest2|arg='hmm'}}
10580 !! html
10581 <p>including another template, This is a test template with parameter 'hmm'
10582 </p>
10583 !! end
10584
10585 !! article
10586 Template:Linktest2
10587 !! text
10588 Main Page
10589 !! endarticle
10590
10591 !! test
10592 Template as link source
10593 !! wikitext
10594 [[{{linktest2}}]]
10595
10596 [[{{linktest2}}|Main Page]]
10597
10598 [[{{linktest2}}]]Page
10599 !! html
10600 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10601 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10602 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
10603 </p>
10604 !! end
10605
10606
10607 !! article
10608 Template:loop1
10609 !! text
10610 {{loop2}}
10611 !! endarticle
10612
10613 !! article
10614 Template:loop2
10615 !! text
10616 {{loop1}}
10617 !! endarticle
10618
10619 !! test
10620 Template infinite loop
10621 !! wikitext
10622 {{loop1}}
10623 !! html
10624 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
10625 </p>
10626 !! end
10627
10628 !! test
10629 Template from main namespace
10630 !! wikitext
10631 {{:Main Page}}
10632 !! html
10633 <p>blah blah
10634 </p>
10635 !! end
10636
10637 !! article
10638 Template:table
10639 !! text
10640 {|
10641 | 1 || 2
10642 |-
10643 | 3 || 4
10644 |}
10645 !! endarticle
10646
10647 !! test
10648 BUG 529: Template with table, not included at beginning of line
10649 !! wikitext
10650 foo {{table}}
10651 !! html
10652 <p>foo
10653 </p>
10654 <table>
10655 <tr>
10656 <td> 1 </td>
10657 <td> 2
10658 </td></tr>
10659 <tr>
10660 <td> 3 </td>
10661 <td> 4
10662 </td></tr></table>
10663
10664 !! end
10665
10666 !! test
10667 BUG 523: Template shouldn't eat newline (or add an extra one before table)
10668 !! wikitext
10669 foo
10670 {{table}}
10671 !! html
10672 <p>foo
10673 </p>
10674 <table>
10675 <tr>
10676 <td> 1 </td>
10677 <td> 2
10678 </td></tr>
10679 <tr>
10680 <td> 3 </td>
10681 <td> 4
10682 </td></tr></table>
10683
10684 !! end
10685
10686 !! test
10687 BUG 41: Template parameters shown as broken links
10688 !! wikitext
10689 {{{parameter}}}
10690 !! html
10691 <p>{{{parameter}}}
10692 </p>
10693 !! end
10694
10695 !! test
10696 Template with targets containing wikilinks
10697 !! wikitext
10698 {{[[foo]]}}
10699
10700 {{[[{{echo|foo}}]]}}
10701
10702 {{{{echo|[[foo}}]]}}
10703 !! html
10704 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10705 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10706 </p><p>{{[[foo}}]]
10707 </p>
10708 !! end
10709
10710 !! article
10711 Template:''
10712 !! text
10713 bar
10714 !! endarticle
10715
10716 !! test
10717 Templates: Double quotes as template target
10718 !! wikitext
10719 foo {{''}} baz
10720 !! html/php
10721 <p>foo bar baz
10722 </p>
10723 !! html/parsoid
10724 <p>foo <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"&#39;&#39;"},"params":{},"i":0}}]}'>bar</span> baz
10725 </p>
10726 !! end
10727
10728 ## This test is about making sure Parsoid's data-mw is well formed in the
10729 ## face of multiple templates with intersecting and overlapping ranges. The
10730 ## wikitext itself is wretched.
10731 !! test
10732 Templates with intersecting and overlapping ranges
10733 !! wikitext
10734 {|{{echo|
10735 <p>ha</p>}}
10736 {|{{echo|
10737 <p>ho</p>}}
10738 {{echo|{{!}}hi}}
10739 |}
10740 !! html/php+tidy
10741 <p>ha</p>
10742 <p>ho</p>
10743 <table>
10744 <tr>
10745 <td></td>
10746 </tr>
10747 <tr>
10748 <td>hi</td>
10749 </tr>
10750 </table>
10751 <table>
10752 <tr>
10753 <td></td>
10754 </tr>
10755 </table>
10756 !! html/parsoid
10757 <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":""}]]}'>
10758
10759 </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
10760
10761 <tbody><tr><td>hi</td></tr>
10762 </tbody></table>
10763 !! end
10764
10765 !! article
10766 Template:MSGNW test
10767 !! text
10768 ''None'' of '''this''' should be
10769 * interpreted
10770 but rather passed unmodified
10771 {{test}}
10772 <gallery>
10773 File:Foobar.jpg
10774 </gallery>
10775 <!-- comment -->
10776 !! endarticle
10777
10778 # hmm, fix this or just deprecate msgnw and document its behavior?
10779 !! test
10780 msgnw keyword
10781 !! wikitext
10782 {{msgnw:MSGNW test}}
10783 !! html/php
10784 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
10785 &#42; interpreted
10786 &#32;but rather passed unmodified
10787 &#123;&#123;test&#125;&#125;
10788 &#60;gallery&#62;
10789 File:Foobar.jpg
10790 &#60;/gallery&#62;
10791 &#60;!-- comment --&#62;
10792 </p>
10793 !! end
10794
10795 !! test
10796 int keyword
10797 !! wikitext
10798 {{int:youhavenewmessages|lots of money|not!}}
10799 !! html
10800 <p>You have lots of money (not!).
10801 </p>
10802 !! end
10803
10804 !! test
10805 int keyword - non-existing message
10806 !! wikitext
10807 {{int:var}}
10808 !! html
10809 <p>&lt;var&gt;
10810 </p>
10811 !! end
10812
10813 !! article
10814 Template:Includes
10815 !! text
10816 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
10817 !! endarticle
10818
10819 !! test
10820 <includeonly> and <noinclude> being included
10821 !! wikitext
10822 {{Includes}}
10823 !! html
10824 <p>Foobar
10825 </p>
10826 !! end
10827
10828 !! article
10829 Template:Includes2
10830 !! text
10831 <onlyinclude>Foo</onlyinclude>bar
10832 !! endarticle
10833
10834 !! test
10835 <onlyinclude> being included
10836 !! wikitext
10837 {{Includes2}}
10838 !! html
10839 <p>Foo
10840 </p>
10841 !! end
10842
10843
10844 !! article
10845 Template:Includes3
10846 !! text
10847 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
10848 !! endarticle
10849
10850 !! test
10851 <onlyinclude> and <includeonly> being included
10852 !! wikitext
10853 {{Includes3}}
10854 !! html
10855 <p>Foo
10856 </p>
10857 !! end
10858
10859 !! test
10860 <includeonly> and <noinclude> on a page
10861 !! wikitext
10862 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
10863 !! html
10864 <p>Foozar
10865 </p>
10866 !! end
10867
10868 !! test
10869 Un-closed <noinclude>
10870 !! wikitext
10871 <noinclude>
10872 !! html
10873 !! end
10874
10875 !! test
10876 <onlyinclude> on a page
10877 !! wikitext
10878 <onlyinclude>Foo</onlyinclude>bar
10879 !! html
10880 <p>Foobar
10881 </p>
10882 !! end
10883
10884 !! test
10885 Un-closed <onlyinclude>
10886 !! wikitext
10887 <onlyinclude>
10888 !! html
10889 !! end
10890
10891 !!test
10892 Self-closed noinclude, includeonly, onlyinclude tags
10893 !! wikitext
10894 <noinclude />
10895 <includeonly />
10896 <onlyinclude />
10897 !! html
10898 <p><br />
10899 </p>
10900 !!end
10901
10902 !!test
10903 Unbalanced includeonly and noinclude tags
10904 !! wikitext
10905 {|
10906 |a</noinclude>
10907 |b</noinclude></noinclude>
10908 |c</noinclude></includeonly>
10909 |d</includeonly></includeonly>
10910 |}
10911 !! html
10912 <table>
10913 <tr>
10914 <td>a
10915 </td>
10916 <td>b
10917 </td>
10918 <td>c&lt;/includeonly&gt;
10919 </td>
10920 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
10921 </td></tr></table>
10922
10923 !!end
10924
10925 !! article
10926 Template:Includeonly section
10927 !! text
10928 <includeonly>
10929 ==Includeonly section==
10930 </includeonly>
10931 ==Section T-1==
10932 !!endarticle
10933
10934 !! test
10935 Bug 6563: Edit link generation for section shown by <includeonly>
10936 !! wikitext
10937 {{includeonly section}}
10938 !! html
10939 <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>
10940 <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>
10941
10942 !! end
10943
10944 # Uses same input as the contents of [[Template:Includeonly section]]
10945 !! test
10946 Bug 6563: Section extraction for section shown by <includeonly>
10947 !! options
10948 section=T-2
10949 !! wikitext
10950 <includeonly>
10951 ==Includeonly section==
10952 </includeonly>
10953 ==Section T-2==
10954 !! html
10955 ==Section T-2==
10956 !! end
10957
10958 !! test
10959 Bug 6563: Edit link generation for section suppressed by <includeonly>
10960 !! wikitext
10961 <includeonly>
10962 ==Includeonly section==
10963 </includeonly>
10964 ==Section 1==
10965 !! html
10966 <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>
10967
10968 !! end
10969
10970 !! test
10971 Bug 6563: Section extraction for section suppressed by <includeonly>
10972 !! options
10973 section=1
10974 !! wikitext
10975 <includeonly>
10976 ==Includeonly section==
10977 </includeonly>
10978 ==Section 1==
10979 !! html
10980 ==Section 1==
10981 !! end
10982
10983 !! test
10984 Un-closed <includeonly>
10985 !! wikitext
10986 <includeonly>
10987 !! html/php
10988 !! html/parsoid
10989 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>"}'/>
10990 !! end
10991
10992 ## We used to, but no longer wt2wt this test since the default serializer
10993 ## will normalize the include directives to serialize on their own line.
10994 ## Selser will take care of preserving formatting in scenarios where they
10995 ## intermingled with other wikitext.
10996 !! test
10997 Includes and comments at SOL
10998 !! options
10999 parsoid=wt2html,html2html
11000 !! wikitext
11001 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
11002
11003 <noinclude>
11004 some
11005 </noinclude>* stuff
11006 * here
11007
11008 <includeonly>can have stuff</includeonly>=== here ===
11009
11010 !! html/php
11011 <h2><span class="mw-headline" id="hu">hu</span></h2>
11012 <p>some
11013 </p>
11014 <ul><li> stuff</li>
11015 <li> here</li></ul>
11016 <h3><span class="mw-headline" id="here">here</span></h3>
11017
11018 !! html/parsoid
11019 <!-- 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>
11020
11021 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
11022 <p>some</p>
11023 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
11024 <li> here</li></ul>
11025
11026 <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>
11027
11028 !! end
11029
11030 # TODO: test with DOM fragment reuse!
11031 !! test
11032 Parsoid: DOM fragment reuse
11033 !! options
11034 parsoid=wt2wt,wt2html
11035 !! wikitext
11036 a{{echo|b<table></table>c}}d
11037
11038 a{{echo|b
11039 <table></table>
11040 c}}d
11041
11042 {{echo|a
11043
11044 <table></table>
11045
11046 b}}
11047 !! html
11048 <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>
11049
11050 <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">
11051 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
11052 </span><p about="#mwt2">cd</p>
11053
11054 <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">
11055
11056 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
11057
11058 </span><p about="#mwt3">b</p>
11059 !! end
11060
11061 !! test
11062 Parsoid: Merge double tds (T52603)
11063 !! options
11064 parsoid
11065 !! wikitext
11066 {|
11067 |{{echo|{{!}} foo}}
11068 |}
11069 !! html
11070 <table><tbody>
11071 <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>
11072 </tbody></table>
11073 !! end
11074
11075 !! test
11076 Parsoid: Merge double tds in nested transclusion content (T52603)
11077 !! options
11078 parsoid
11079 !! wikitext
11080 {{echo|<div>}}
11081 {|
11082 |{{echo|{{!}} foo}}
11083 |}
11084 {{echo|</div>}}
11085 !! html
11086 <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}}]}'>
11087 <table><tbody>
11088 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
11089 </tbody></table>
11090 </div>
11091 !! end
11092
11093 ###
11094 ### <includeonly> and <noinclude> in attributes
11095 ###
11096 !!test
11097 0. includeonly around the entire attribute
11098 !! wikitext
11099 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
11100 !! html
11101 <p><span id="v2">bar</span>
11102 </p>
11103 !!end
11104
11105 !!test
11106 1. includeonly in html attr key
11107 !! wikitext
11108 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
11109 !! html
11110 <p><span id="foo">bar</span>
11111 </p>
11112 !!end
11113
11114 !!test
11115 2. includeonly in html attr value
11116 !! wikitext
11117 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
11118 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
11119 !! html
11120 <p><span id="v1">bar</span>
11121 <span id="v1">bar</span>
11122 </p>
11123 !!end
11124
11125 !!test
11126 3. includeonly in part of an attr value
11127 !! wikitext
11128 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
11129 !! html
11130 <p><span style="color:red;">bar</span>
11131 </p>
11132 !!end
11133
11134 !!test
11135 4. includeonly in table attributes
11136 !! wikitext
11137 {|
11138 |- <noinclude>
11139 |-
11140 |a
11141 </noinclude>
11142 |- <includeonly>
11143 |-
11144 |b
11145 </includeonly>
11146 |}
11147 !! html
11148 <table>
11149
11150
11151 <tr>
11152 <td>a
11153 </td></tr>
11154 </table>
11155
11156 !!end
11157
11158 ###
11159 ### Token Stream Patcher tests
11160 ###
11161 ### These tests won't always pass wt2wt and other modes because
11162 ### on serialization, the table will be output on a new line.
11163 ### For now, we are blacklisting them, and using this to test selser.
11164 ###
11165
11166 !!test
11167 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
11168 !!options
11169 parsoid=wt2html,wt2wt
11170 !!wikitext
11171 {{echo|}}{| width = '100%'
11172 |foo
11173 |}
11174 !!html/parsoid
11175 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
11176 <tbody><tr><td>foo</td></tr>
11177 </tbody></table>
11178 !!end
11179
11180 ## We used to, but no longer wt2wt this test since the default serializer
11181 ## will normalize the include directives to serialize on their own line.
11182 ## Selser will take care of preserving formatting in scenarios where they
11183 ## intermingled with other wikitext.
11184 !!test
11185 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
11186 !!options
11187 parsoid=wt2html
11188 !!wikitext
11189 <includeonly>a</includeonly>{| {{{b}}}
11190 |c
11191 |}
11192 !!html/parsoid
11193 <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}}}":""}}'>
11194 <tbody><tr><td>c</td></tr>
11195 </tbody></table>
11196
11197 !!end
11198
11199 ###
11200 ### Testing parsing of templates where a template arg
11201 ### has the same name as the template itself.
11202 ###
11203
11204 !! article
11205 Template:quote
11206 !! text
11207 {{{quote|{{{1}}}}}}
11208 !! endarticle
11209
11210 !!test
11211 Templates: Template Name/Arg clash: 1. Use of positional param
11212 !! wikitext
11213 {{quote|foo}}
11214 !! html
11215 <p>foo
11216 </p>
11217 !!end
11218
11219 !!test
11220 Templates: Template Name/Arg clash: 2. Use of named param
11221 !! wikitext
11222 {{quote|quote=foo}}
11223 !! html
11224 <p>foo
11225 </p>
11226 !!end
11227
11228 !!test
11229 Templates: Template Name/Arg clash: 3. Use of named param with empty input
11230 !! wikitext
11231 {{quote|quote}}
11232 !! html
11233 <p>quote
11234 </p>
11235 !!end
11236
11237 ###
11238 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
11239 ###
11240
11241 !!test
11242 Templates: 1. Simple use
11243 !! wikitext
11244 {{echo|Foo}}
11245 !! html
11246 <p>Foo
11247 </p>
11248 !!end
11249
11250 !!test
11251 Templates: 2. Inside a block tag
11252 !! wikitext
11253 <div>{{echo|Foo}}</div>
11254 <blockquote>{{echo|Foo}}</blockquote>
11255 !! html
11256 <div>Foo</div>
11257 <blockquote>Foo</blockquote>
11258
11259 !! html+tidy
11260 <div>Foo</div>
11261 <blockquote>
11262 <p>Foo</p>
11263 </blockquote>
11264 !!end
11265
11266 !!test
11267 Templates: P-wrapping: 1a. Templates on consecutive lines
11268 !! wikitext
11269 {{echo|Foo}}
11270 {{echo|bar}}
11271 !! html
11272 <p>Foo
11273 bar
11274 </p>
11275 !!end
11276
11277 !!test
11278 Templates: P-wrapping: 1b. Templates on consecutive lines
11279 !! wikitext
11280 Foo
11281
11282 {{echo|bar}}
11283 {{echo|baz}}
11284 !! html
11285 <p>Foo
11286 </p><p>bar
11287 baz
11288 </p>
11289 !!end
11290
11291 !!test
11292 Templates: P-wrapping: 1c. Templates on consecutive lines
11293 !! wikitext
11294 {{echo|Foo}}
11295 {{echo|bar}} <div>baz</div>
11296 !! html
11297 <p>Foo
11298 </p>
11299 bar <div>baz</div>
11300
11301 !! html+tidy
11302 <p>Foo</p>
11303 <p>bar</p>
11304 <div>baz</div>
11305 !! end
11306
11307 !!test
11308 Templates: P-wrapping: 1d. Template preceded by comment-only line
11309 !!options
11310 parsoid
11311 !! wikitext
11312 <!-- foo -->
11313 {{echo|Bar}}
11314 !! html
11315 <!-- foo -->
11316
11317 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
11318 !!end
11319
11320 !!test
11321 Templates: Inline Text: 1. Multiple template uses
11322 !! wikitext
11323 {{echo|Foo}}bar{{echo|baz}}
11324 !! html
11325 <p>Foobarbaz
11326 </p>
11327 !!end
11328
11329 !!test
11330 Templates: Inline Text: 2. Back-to-back template uses
11331 !! wikitext
11332 {{echo|Foo}}{{echo|bar}}
11333 !! html
11334 <p>Foobar
11335 </p>
11336 !!end
11337
11338 !!test
11339 Templates: Block Tags: 1. Multiple template uses
11340 !! wikitext
11341 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
11342 !! html
11343 <div>Foo</div><div>bar</div><div>baz</div>
11344
11345 !!end
11346
11347 !!test
11348 Templates: Block Tags: 2. Back-to-back template uses
11349 !! wikitext
11350 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
11351 !! html
11352 <div>Foo</div><div>bar</div>
11353
11354 !!end
11355
11356 # This is an edge case relating to paragraph wrapping.
11357 !!test
11358 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
11359 !! wikitext
11360 {{echo|a
11361 b</p>}}
11362 !! html/parsoid
11363 <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
11364 b</p>
11365 !!end
11366
11367 !!test
11368 Templates: Links: 1. Simple example
11369 !! wikitext
11370 {{echo|[[Foo|bar]]}}
11371 !! html
11372 <p><a href="/wiki/Foo" title="Foo">bar</a>
11373 </p>
11374 !!end
11375
11376 !!test
11377 Templates: Links: 2. Generation of link href
11378 !! wikitext
11379 [[{{echo|Foo}}|bar]]
11380 !! html
11381 <p><a href="/wiki/Foo" title="Foo">bar</a>
11382 </p>
11383 !!end
11384
11385 !!test
11386 Templates: Links: 3. Generation of part of a link href
11387 !! wikitext
11388 [[Fo{{echo|o}}|bar]]
11389
11390 [[Foo{{echo|bar}}]]
11391
11392 [[Foo{{echo|bar}}baz]]
11393
11394 [[Foo{{echo|bar}}|bar]]
11395
11396 [[:Foo{{echo|bar}}]]
11397
11398 [[:Foo{{echo|bar}}|bar]]
11399 !! html
11400 <p><a href="/wiki/Foo" title="Foo">bar</a>
11401 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11402 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
11403 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11404 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11405 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11406 </p>
11407 !!end
11408
11409 !!test
11410 Templates: Links: 4. Multiple templates generating link href
11411 !! wikitext
11412 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
11413 !! html
11414 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11415 </p>
11416 !!end
11417
11418 !!test
11419 Templates: Links: 5. Generation of link text
11420 !! wikitext
11421 [[Foo|{{echo|bar}}]]
11422 !! html
11423 <p><a href="/wiki/Foo" title="Foo">bar</a>
11424 </p>
11425 !!end
11426
11427 !!test
11428 Templates: Links: 5. Nested templates (only outermost template should be marked)
11429 !! wikitext
11430 {{echo|[[{{echo|Foo}}|bar]]}}
11431 !! html
11432 <p><a href="/wiki/Foo" title="Foo">bar</a>
11433 </p>
11434 !!end
11435
11436 !!test
11437 Templates: HTML Tag: 1. Generation of HTML attr. key
11438 !! wikitext
11439 <div {{echo|style}}="color:red;">foo</div>
11440 !! html
11441 <div style="color:red;">foo</div>
11442
11443 !!end
11444
11445 !!test
11446 Templates: HTML Tag: 2. Generation of HTML attr. value
11447 !! wikitext
11448 <div style={{echo|'color:red;'}}>foo</div>
11449 !! html
11450 <div style="color:red;">foo</div>
11451
11452 !!end
11453
11454 !!test
11455 Templates: HTML Tag: 3. Generation of HTML attr key and value
11456 !! wikitext
11457 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
11458 !! html
11459 <div style="color:red;">foo</div>
11460
11461 !!end
11462
11463 !!test
11464 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
11465 !! wikitext
11466 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
11467 !! html
11468 <div title="This is a long title with just one piece templated">foo</div>
11469
11470 !!end
11471
11472 !!test
11473 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
11474 !! wikitext
11475 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
11476 !! html
11477 <div title="This is a long title with just one piece templated">foo</div>
11478
11479 !!end
11480
11481 !!test
11482 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
11483 !! wikitext
11484 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
11485 !! html
11486 <div title="This is a long title with just one piece templated">foo</div>
11487
11488 !!end
11489
11490 # SSS FIXME: While it is great we added support for all this,
11491 # do we want to make this part of the spec? Maybe we want to
11492 # deprecate this kind of usage in the future?
11493 !!test
11494 Templates: HTML Tag: 7. Generation of partial attribute key string
11495 !! wikitext
11496 <div st{{echo|yle}}="color:red;">foo</div>
11497 !! html
11498 <div style="color:red;">foo</div>
11499
11500 !!end
11501
11502 !! test
11503 Templates: HTML Tag: 8. Template-generated attribute (k=v)
11504 !! wikitext
11505 <div {{echo|1=id="v1"}}>bar</div>
11506 !! html
11507 <div id="v1">bar</div>
11508
11509 !!end
11510
11511 !! test
11512 Templates: HTML Tag: 9. Multiple template-generated attributes
11513 !! wikitext
11514 <div {{echo|1=id="v1" title="foo"}}>bar</div>
11515 !! html
11516 <div id="v1" title="foo">bar</div>
11517
11518 !!end
11519
11520 !! test
11521 Templates: Support for templates generating attributes and content
11522 !! wikitext
11523 {| {{mixed_attr_content_template}}
11524 |-
11525 |bar
11526 |}
11527 !! html/php
11528 <table style="color:red;" title="T48811">
11529
11530 <tr>
11531 <td>foo
11532 </td></tr>
11533 <tr>
11534 <td>bar
11535 </td></tr></table>
11536
11537 !! html/parsoid
11538 <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|}"]}'>
11539 <tbody><tr>
11540 <td>foo</td></tr>
11541 <tr>
11542 <td>bar</td></tr>
11543 </tbody></table>
11544 !!end
11545
11546 !! test
11547 1. Entities and nowikis inside templated attributes should be handled correctly
11548 !! wikitext
11549 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
11550 !! html/php
11551 <div style="background:#f9f9f9;">foo</div>
11552
11553 !! html/parsoid
11554 <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>
11555 !! end
11556
11557 !! test
11558 2. Entities and nowikis inside templated attributes should be handled correctly
11559 !! wikitext
11560 {|
11561 |{{table_attribs_3}}
11562 |}
11563 !! html/php
11564 <table>
11565 <tr>
11566 <td style="background:#f9f9f9;">Foo
11567 </td></tr></table>
11568
11569 !! html/parsoid
11570 <table>
11571 <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>
11572 </tbody></table>
11573 !! end
11574
11575 !! test
11576 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11577 !! wikitext
11578 {{tbl-start}}
11579 |{{table_attribs_3}}
11580 {{tbl-end}}
11581 !! html/php
11582 <table>
11583 <tr>
11584 <td style="background:#f9f9f9;">Foo
11585 </td></tr></table>
11586
11587 !! html/parsoid
11588 <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}}]}'>
11589 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
11590 </tbody></table>
11591 !! end
11592
11593 # T107622
11594 !! test
11595 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11596 !! wikitext
11597 {|
11598 | {{table_attribs_6}} hi
11599 |}
11600 !! html/php
11601 <table>
11602 <tr>
11603 <td style="background: red;"> hi
11604 </td></tr></table>
11605
11606 !! html/parsoid
11607 <table>
11608 <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>
11609 </tbody></table>
11610 !! end
11611
11612 !!test
11613 Templates: HTML Tables: 1. Generating start of a HTML table
11614 !! wikitext
11615 {{echo|<table><tr><td>foo</td>}}</tr></table>
11616 !! html
11617 <table><tr><td>foo</td></tr></table>
11618
11619 !!end
11620
11621 !!test
11622 Templates: HTML Tables: 2a. Generating middle of a HTML table
11623 !! wikitext
11624 <table><tr>{{echo|<td>foo</td>}}</tr></table>
11625 !! html
11626 <table><tr><td>foo</td></tr></table>
11627
11628 !!end
11629
11630 !!test
11631 Templates: HTML Tables: 2b. Generating middle of a HTML table
11632 !! wikitext
11633 <table>{{echo|<tr><td>foo</td></tr>}}</table>
11634 !! html
11635 <table><tr><td>foo</td></tr></table>
11636
11637 !!end
11638
11639 !!test
11640 Templates: HTML Tables: 3. Generating end of a HTML table
11641 !! wikitext
11642 <table><tr>{{echo|<td>foo</td></tr></table>}}
11643 !! html
11644 <table><tr><td>foo</td></tr></table>
11645
11646 !!end
11647
11648 !!test
11649 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
11650 !! wikitext
11651 {{echo|<table>}}<tr><td>foo</td></tr></table>
11652 !! html
11653 <table><tr><td>foo</td></tr></table>
11654
11655 !!end
11656
11657 !!test
11658 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
11659 !! wikitext
11660 <table>{{echo|<tr>}}<td>foo</td></tr></table>
11661 !! html
11662 <table><tr><td>foo</td></tr></table>
11663
11664 !!end
11665
11666 !!test
11667 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
11668 !! wikitext
11669 <table><tr>{{echo|<td>}}foo</td></tr></table>
11670 !! html
11671 <table><tr><td>foo</td></tr></table>
11672
11673 !!end
11674
11675 !!test
11676 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
11677 !! wikitext
11678 <table><tr><td>foo{{echo|</td>}}</tr></table>
11679 !! html
11680 <table><tr><td>foo</td></tr></table>
11681
11682 !!end
11683
11684 !!test
11685 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
11686 !! wikitext
11687 <table><tr><td>foo</td>{{echo|</tr>}}</table>
11688 !! html
11689 <table><tr><td>foo</td></tr></table>
11690
11691 !!end
11692
11693 !!test
11694 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
11695 !! wikitext
11696 <table><tr><td>foo</td></tr>{{echo|</table>}}
11697 !! html
11698 <table><tr><td>foo</td></tr></table>
11699
11700 !!end
11701
11702 !!test
11703 Templates: HTML Tables: 5. Proper fostering of categories from inside
11704 !!options
11705 parsoid=wt2html,wt2wt
11706 !! wikitext
11707 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
11708 <!--Two categories (Bug 50330)-->
11709 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
11710 !! html
11711 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
11712 <!--Two categories (Bug 50330)-->
11713 <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>
11714 !!end
11715
11716 !!test
11717 Templates: Wiki Tables: 1a. Fostering of entire template content
11718 !! wikitext
11719 {|
11720 {{echo|a}}
11721 |}
11722 !! html
11723 <table>
11724 a
11725 <tr><td></td></tr></table>
11726
11727 !! html+tidy
11728 <p>a</p>
11729 <table>
11730 <tr>
11731 <td></td>
11732 </tr>
11733 </table>
11734 !! end
11735
11736 !!test
11737 Templates: Wiki Tables: 1b. Fostering of entire template content
11738 !! wikitext
11739 {|
11740 {{echo|<div>}}
11741 foo
11742 {{echo|</div>}}
11743 |}
11744 !! html
11745 <table>
11746 <div>
11747 <p>foo
11748 </p>
11749 </div>
11750 <tr><td></td></tr></table>
11751
11752 !! html+tidy
11753 <div>
11754 <p>foo</p>
11755 </div>
11756 <table>
11757 <tr>
11758 <td></td>
11759 </tr>
11760 </table>
11761 !! end
11762
11763 !!test
11764 Templates: Wiki Tables: 2. Fostering of partial template content
11765 !! wikitext
11766 {|
11767 {{echo|a
11768 <div>b</div>}}
11769 |}
11770 !! html
11771 <table>
11772 a
11773 <div>b</div>
11774 <tr><td></td></tr></table>
11775
11776 !! html+tidy
11777 <p>a</p>
11778 <div>b</div>
11779 <table>
11780 <tr>
11781 <td></td>
11782 </tr>
11783 </table>
11784 !! end
11785
11786 !!test
11787 Templates: Wiki Tables: 3. td-content via multiple templates
11788 !! wikitext
11789 {|
11790 {{echo|{{pipe}}a}}{{echo|b}}
11791 |}
11792 !! html
11793 <table>
11794 <tr>
11795 <td>ab
11796 </td></tr></table>
11797
11798 !!end
11799
11800 !!test
11801 Templates: Wiki Tables: 4. Templated tags, no content
11802 !! wikitext
11803 {{tbl-start}}
11804 {{tbl-end}}
11805 !! html
11806 <table>
11807 <tr><td></td></tr></table>
11808
11809 !!end
11810
11811 !!test
11812 Templates: Wiki Tables: 5. Templated tags, regular td-tags
11813 !! wikitext
11814 {{tbl-start}}
11815 |foo
11816 {{tbl-end}}
11817 !! html
11818 <table>
11819 <tr>
11820 <td>foo
11821 </td></tr></table>
11822
11823 !!end
11824
11825 !!test
11826 Templates: Wiki Tables: 6. Templated tags, templated td-tags
11827 !! wikitext
11828 {{tbl-start}}
11829 {{!}}foo
11830 {{tbl-end}}
11831 !! html
11832 <table>
11833 <tr>
11834 <td>foo
11835 </td></tr></table>
11836
11837 !!end
11838
11839 ## This test case is very specific to Parsoid's internals
11840 ## and is hence only tested for Parsoid's code. Parsoid uses
11841 ## a <meta> marker tag for <ref> tags and they are expanded
11842 ## much later. We are verifying that this <meta> tag usage
11843 ## doesn't prevent foster parenting.
11844 !!test
11845 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
11846 !!wikitext
11847 {{PartialTable}}<ref>foo</ref>
11848 |}
11849
11850 <references />
11851 !!html/parsoid
11852 <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">
11853 <tbody>
11854 </tbody></table>
11855
11856 <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>
11857 !!end
11858
11859 !! test
11860 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
11861 !! wikitext
11862 {{echo|
11863 {{{!}}
11864 {{!}}-}}
11865 <onlyinclude>
11866 |foo
11867 </onlyinclude>
11868 {{!}}}
11869 !! html/parsoid
11870 <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{{!}}}"]}'>
11871 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
11872 <tbody><tr>
11873
11874 <td>foo
11875 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
11876 </tbody></table>
11877 !! end
11878
11879 !!test
11880 Templates: Lists: Multi-line list-items via templates
11881 !! wikitext
11882 *{{echo|a {{nonexistent|
11883 unused}}}}
11884 *{{echo|b {{nonexistent|
11885 unused}}}}
11886 !! html
11887 <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>
11888 <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>
11889
11890 !!end
11891
11892 !!test
11893 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
11894 !! wikitext
11895 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
11896 !! html
11897 <p><i>ab</i>c<i>d</i>e
11898 </p>
11899 !!end
11900
11901 !!test
11902 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
11903 (PHP parser generates misnested html)
11904 !! wikitext
11905 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
11906 !! html/parsoid
11907 <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>
11908 !!end
11909
11910 !!test
11911 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
11912 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
11913 !! options
11914 parsoid=wt2html,wt2wt
11915 !! wikitext
11916 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
11917 !! html
11918 <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>
11919 <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>
11920 <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>
11921 !!end
11922
11923 !!test
11924 Templates: Ugly nesting: 4. Divs opened/closed across templates
11925 !! wikitext
11926 a<div>b{{echo|c</div>d}}e
11927 !! html
11928 a<div>bc</div>de
11929
11930 !! html+tidy
11931 <p>a</p>
11932 <div>bc</div>
11933 <p>de</p>
11934 !! end
11935
11936 !!test
11937 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
11938 (Parsoid-centric)
11939 !! options
11940 parsoid
11941 !! wikitext
11942 {|
11943 |{{echo|foo</table>}}
11944 |bar
11945 |}
11946 !! html
11947 <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|}"]}'>
11948
11949 <tbody>
11950 <tr>
11951 <td>foo</td></tr></tbody></table><span about="#mwt1">
11952 </span><span about="#mwt1">|bar</span><span about="#mwt1">
11953 |}</span>
11954 !!end
11955
11956 !!test
11957 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
11958 (Parsoid-centric)
11959 !! options
11960 parsoid
11961 !! wikitext
11962 <table>
11963 <tr>
11964 <td>
11965 <table>
11966 <tr>
11967 <td>1. {{echo|foo </table>}}</td>
11968 <td> bar </td>
11969 <td>2. {{echo|baz </table>}}</td>
11970 </tr>
11971 <tr>
11972 <td>abc</td>
11973 </tr>
11974 </table>
11975 </td>
11976 </tr>
11977 <tr>
11978 <td>xyz</td>
11979 </tr>
11980 </table>
11981 !! html
11982 <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>"]}'>
11983 <tbody><tr>
11984 <td>
11985 <table>
11986 <tbody><tr>
11987 <td>1. foo </td></tr></tbody></table></td>
11988 <td> bar </td>
11989 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
11990 </span><span about="#mwt2">
11991 </span><span about="#mwt2">
11992 </span><span about="#mwt2">abc</span><span about="#mwt2">
11993 </span><span about="#mwt2">
11994 </span><span about="#mwt2">
11995 </span><span about="#mwt2">
11996 </span><span about="#mwt2">
11997 </span><span about="#mwt2">
11998 </span><span about="#mwt2">xyz</span><span about="#mwt2">
11999 </span><span about="#mwt2">
12000 </span>
12001 !!end
12002
12003 !! test
12004 Templates: Ugly templates: 3. newline-only template parameter
12005 !! wikitext
12006 foo {{echo|
12007 }}
12008 !! html
12009 <p>foo
12010 </p>
12011 !! end
12012
12013 # This looks like a bug: a single newline triggers p/br for some reason.
12014 !! test
12015 Templates: Ugly templates: 4. newline-only template parameter inconsistency
12016 !! wikitext
12017 {{echo|
12018 }}
12019 !! html
12020 <p><br />
12021 </p>
12022 !! end
12023
12024 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
12025 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
12026 !! test
12027 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
12028 !! wikitext
12029 {{echo|<table>}}
12030 {{echo|<div>foo}}
12031 {{echo|</table>}}
12032 !! html/parsoid
12033 <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
12034 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12035 </table>
12036 !! end
12037
12038 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
12039 # that are "identical" and generate nesting cycles in the algorithm
12040 !! test
12041 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
12042 !! wikitext
12043 {{echo|<table><tr><td><table>}}
12044 {{echo|<div>}}
12045 {{echo|</div>}}
12046 !! html/parsoid
12047 <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"}'>
12048 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12049 </table></td></tr></tbody></table>
12050 !! end
12051
12052 !! test
12053 Templates: Parameters substituted at the top-level
12054 !! wikitext
12055 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
12056 !! html/php
12057 <p><i>who</i> me? <b>never!</b>
12058 </p>
12059 !! html/parsoid
12060 <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>
12061 !! end
12062
12063 !!test
12064 Parser Functions: 1. Simple example
12065 !! wikitext
12066 {{uc:foo}}
12067 !! html
12068 <p>FOO
12069 </p>
12070 !!end
12071
12072 !!test
12073 Parser Functions: 2. Nested use (only outermost should be marked up)
12074 !! wikitext
12075 {{uc:{{lc:FOO}}}}
12076 !! html
12077 <p>FOO
12078 </p>
12079 !!end
12080
12081 ###
12082 ### Pre-save transform tests
12083 ###
12084 !! test
12085 pre-save transform: subst:
12086 !! options
12087 pst
12088 !! wikitext
12089 {{subst:test}}
12090 !! html/php
12091 This is a test template
12092 !! end
12093
12094 !! test
12095 pre-save transform: normal template
12096 !! options
12097 pst
12098 !! wikitext
12099 {{test}}
12100 !! html/php
12101 {{test}}
12102 !! end
12103
12104 !! test
12105 pre-save transform: nonexistent template
12106 !! options
12107 pst
12108 !! wikitext
12109 {{thistemplatedoesnotexist}}
12110 !! html/php
12111 {{thistemplatedoesnotexist}}
12112 !! end
12113
12114 !! test
12115 pre-save transform: subst magic variables
12116 !! options
12117 pst
12118 !! wikitext
12119 {{subst:SITENAME}}
12120 !! html/php
12121 MediaWiki
12122 !! end
12123
12124 # This is bug 89, which I fixed. -- wtm
12125 !! test
12126 pre-save transform: subst: templates with parameters
12127 !! options
12128 pst
12129 !! wikitext
12130 {{subst:paramtest|param="something else"}}
12131 !! html/php
12132 This is a test template with parameter "something else"
12133 !! end
12134
12135 !! article
12136 Template:nowikitest
12137 !! text
12138 <nowiki>'''not wiki'''</nowiki>
12139 !! endarticle
12140
12141 !! test
12142 pre-save transform: nowiki in subst (bug 1188)
12143 !! options
12144 pst
12145 !! wikitext
12146 {{subst:nowikitest}}
12147 !! html/php
12148 <nowiki>'''not wiki'''</nowiki>
12149 !! end
12150
12151 !! article
12152 Template:commenttest
12153 !! text
12154 This template has <!-- a comment --> in it.
12155 !! endarticle
12156
12157 !! test
12158 pre-save transform: comment in subst (bug 1936)
12159 !! options
12160 pst
12161 !! wikitext
12162 {{subst:commenttest}}
12163 !! html/php
12164 This template has <!-- a comment --> in it.
12165 !! end
12166
12167 !! test
12168 pre-save transform: unclosed tag
12169 !! options
12170 pst noxml
12171 !! wikitext
12172 <nowiki>'''not wiki'''
12173 !! html/php
12174 <nowiki>'''not wiki'''
12175 !! end
12176
12177 !! test
12178 pre-save transform: mixed tag case
12179 !! options
12180 pst noxml
12181 !! wikitext
12182 <NOwiki>'''not wiki'''</noWIKI>
12183 !! html/php
12184 <NOwiki>'''not wiki'''</noWIKI>
12185 !! end
12186
12187 !! test
12188 pre-save transform: unclosed comment in <nowiki>
12189 !! options
12190 pst noxml
12191 !! wikitext
12192 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12193 !! html/php
12194 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12195 !!end
12196
12197 # Leading @ in this template definition works around a limitation
12198 # in parsoid's parserTests which otherwise strips the <span> from the
12199 # result (confusing it for a template wrapper)
12200 !! article
12201 Template:dangerous
12202 !!text
12203 @<span onmouseover="alert('crap')">Oh no</span>
12204 !!endarticle
12205
12206 !!test
12207 (confirming safety of fix for subst bug 1936)
12208 !! wikitext
12209 {{Template:dangerous}}
12210 !! html
12211 <p>@<span>Oh no</span>
12212 </p>
12213 !! end
12214
12215 !! test
12216 pre-save transform: comment containing gallery (bug 5024)
12217 !! options
12218 pst
12219 !! wikitext
12220 <!-- <gallery>data</gallery> -->
12221 !! html/php
12222 <!-- <gallery>data</gallery> -->
12223 !!end
12224
12225 !! test
12226 pre-save transform: comment containing extension
12227 !! options
12228 pst
12229 !! wikitext
12230 <!-- <tag>data</tag> -->
12231 !! html/php
12232 <!-- <tag>data</tag> -->
12233 !!end
12234
12235 !! test
12236 pre-save transform: comment containing nowiki
12237 !! options
12238 pst
12239 !! wikitext
12240 <!-- <nowiki>data</nowiki> -->
12241 !! html/php
12242 <!-- <nowiki>data</nowiki> -->
12243 !!end
12244
12245 !! test
12246 pre-save transform: <noinclude> in subst (bug 3298)
12247 !! options
12248 pst
12249 !! wikitext
12250 {{subst:Includes}}
12251 !! html/php
12252 Foobar
12253 !! end
12254
12255 !! test
12256 pre-save transform: <onlyinclude> in subst (bug 3298)
12257 !! options
12258 pst
12259 !! wikitext
12260 {{subst:Includes2}}
12261 !! html/php
12262 Foo
12263 !! end
12264
12265 !! article
12266 Template:SubstTest
12267 !!text
12268 {{<includeonly>subst:</includeonly>Includes}}
12269 !! endarticle
12270
12271 !! article
12272 Template:SafeSubstTest
12273 !! text
12274 {{<includeonly>safesubst:</includeonly>Includes}}
12275 !! endarticle
12276
12277 !! test
12278 bug 22297: safesubst: works during PST
12279 !! options
12280 pst
12281 !! wikitext
12282 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
12283 !! html/php
12284 FoobarFoobar
12285 !! end
12286
12287 !! test
12288 bug 22297: safesubst: works during normal parse
12289 !! wikitext
12290 {{SafeSubstTest}}
12291 !! html
12292 <p>Foobar
12293 </p>
12294 !! end
12295
12296 !! test
12297 subst: does not work during normal parse
12298 !! wikitext
12299 {{SubstTest}}
12300 !! html
12301 <p>{{subst:Includes}}
12302 </p>
12303 !! end
12304
12305 !! test
12306 pre-save transform: context links ("pipe trick")
12307 !! options
12308 pst
12309 !! wikitext
12310 [[Article (context)|]]
12311 [[Bar:Article|]]
12312 [[:Bar:Article|]]
12313 [[Bar:Article (context)|]]
12314 [[:Bar:Article (context)|]]
12315 [[|Article]]
12316 [[|Article (context)]]
12317 [[Bar:X (Y) Z|]]
12318 [[:Bar:X (Y) Z|]]
12319 !! html/php
12320 [[Article (context)|Article]]
12321 [[Bar:Article|Article]]
12322 [[:Bar:Article|Article]]
12323 [[Bar:Article (context)|Article]]
12324 [[:Bar:Article (context)|Article]]
12325 [[Article]]
12326 [[Article (context)]]
12327 [[Bar:X (Y) Z|X (Y) Z]]
12328 [[:Bar:X (Y) Z|X (Y) Z]]
12329 !! end
12330
12331 !! test
12332 pre-save transform: context links ("pipe trick") with interwiki prefix
12333 !! options
12334 pst
12335 !! wikitext
12336 [[interwiki:Article|]]
12337 [[:interwiki:Article|]]
12338 [[interwiki:Bar:Article|]]
12339 [[:interwiki:Bar:Article|]]
12340 !! html/php
12341 [[interwiki:Article|Article]]
12342 [[:interwiki:Article|Article]]
12343 [[interwiki:Bar:Article|Bar:Article]]
12344 [[:interwiki:Bar:Article|Bar:Article]]
12345 !! end
12346
12347 !! test
12348 pre-save transform: context links ("pipe trick") with parens in title
12349 !! options
12350 pst title=[[Somearticle (context)]]
12351 !! wikitext
12352 [[|Article]]
12353 !! html/php
12354 [[Article (context)|Article]]
12355 !! end
12356
12357 !! test
12358 pre-save transform: context links ("pipe trick") with comma in title
12359 !! options
12360 pst title=[[Someplace, Somewhere]]
12361 !! wikitext
12362 [[|Otherplace]]
12363 [[Otherplace, Elsewhere|]]
12364 [[Otherplace, Elsewhere, Anywhere|]]
12365 !! html/php
12366 [[Otherplace, Somewhere|Otherplace]]
12367 [[Otherplace, Elsewhere|Otherplace]]
12368 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
12369 !! end
12370
12371 !! test
12372 pre-save transform: context links ("pipe trick") with parens and comma
12373 !! options
12374 pst title=[[Someplace (IGNORED), Somewhere]]
12375 !! wikitext
12376 [[|Otherplace]]
12377 [[Otherplace (place), Elsewhere|]]
12378 !! html/php
12379 [[Otherplace, Somewhere|Otherplace]]
12380 [[Otherplace (place), Elsewhere|Otherplace]]
12381 !! end
12382
12383 !! test
12384 pre-save transform: context links ("pipe trick") with comma and parens
12385 !! options
12386 pst title=[[Who, me? (context)]]
12387 !! wikitext
12388 [[|Yes, you.]]
12389 [[Me, Myself, and I (1937 song)|]]
12390 !! html/php
12391 [[Yes, you. (context)|Yes, you.]]
12392 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
12393 !! end
12394
12395 !! test
12396 pre-save transform: context links ("pipe trick") with namespace
12397 !! options
12398 pst title=[[Ns:Somearticle]]
12399 !! wikitext
12400 [[|Article]]
12401 !! html/php
12402 [[Ns:Article|Article]]
12403 !! end
12404
12405 !! test
12406 pre-save transform: context links ("pipe trick") with namespace and parens
12407 !! options
12408 pst title=[[Ns:Somearticle (context)]]
12409 !! wikitext
12410 [[|Article]]
12411 !! html/php
12412 [[Ns:Article (context)|Article]]
12413 !! end
12414
12415 !! test
12416 pre-save transform: context links ("pipe trick") with namespace and comma
12417 !! options
12418 pst title=[[Ns:Somearticle, Context, Whatever]]
12419 !! wikitext
12420 [[|Article]]
12421 !! html/php
12422 [[Ns:Article, Context, Whatever|Article]]
12423 !! end
12424
12425 !! test
12426 pre-save transform: context links ("pipe trick") with namespace, comma and parens
12427 !! options
12428 pst title=[[Ns:Somearticle, Context (context)]]
12429 !! wikitext
12430 [[|Article]]
12431 !! html/php
12432 [[Ns:Article (context)|Article]]
12433 !! end
12434
12435 !! test
12436 pre-save transform: context links ("pipe trick") with namespace, parens and comma
12437 !! options
12438 pst title=[[Ns:Somearticle (IGNORED), Context]]
12439 !! wikitext
12440 [[|Article]]
12441 !! html/php
12442 [[Ns:Article, Context|Article]]
12443 !! end
12444
12445 !! test
12446 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
12447 !! options
12448 pst
12449 !! wikitext
12450 [[Article(context)|]]
12451 [[Bar:Article(context)|]]
12452 [[:Bar:Article(context)|]]
12453 [[|Article(context)]]
12454 [[Bar:X(Y)Z|]]
12455 [[:Bar:X(Y)Z|]]
12456 !! html/php
12457 [[Article(context)|Article]]
12458 [[Bar:Article(context)|Article]]
12459 [[:Bar:Article(context)|Article]]
12460 [[Article(context)]]
12461 [[Bar:X(Y)Z|X(Y)Z]]
12462 [[:Bar:X(Y)Z|X(Y)Z]]
12463 !! end
12464
12465 !! test
12466 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
12467 !! options
12468 pst
12469 !! wikitext
12470 [[Article (context)|]]
12471 [[Bar:Article (context)|]]
12472 [[:Bar:Article (context)|]]
12473 [[|Article (context)]]
12474 [[Bar:X (Y) Z|]]
12475 [[:Bar:X (Y) Z|]]
12476 !! html/php
12477 [[Article (context)|Article]]
12478 [[Bar:Article (context)|Article]]
12479 [[:Bar:Article (context)|Article]]
12480 [[Article (context)]]
12481 [[Bar:X (Y) Z|X (Y) Z]]
12482 [[:Bar:X (Y) Z|X (Y) Z]]
12483 !! end
12484
12485 !! test
12486 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
12487 !! options
12488 pst
12489 !! wikitext
12490 [[Article(context)|]]
12491 [[Bar:Article(context)|]]
12492 [[:Bar:Article(context)|]]
12493 [[|Article(context)]]
12494 [[Bar:X(Y)Z|]]
12495 [[:Bar:X(Y)Z|]]
12496 !! html/php
12497 [[Article(context)|Article]]
12498 [[Bar:Article(context)|Article]]
12499 [[:Bar:Article(context)|Article]]
12500 [[Article(context)]]
12501 [[Bar:X(Y)Z|X(Y)Z]]
12502 [[:Bar:X(Y)Z|X(Y)Z]]
12503 !! end
12504
12505 !! test
12506 pre-save transform: context links ("pipe trick") with commas (bug 21660)
12507 !! options
12508 pst
12509 !! wikitext
12510 [[Article (context), context|]]
12511 [[Article (context),context|]]
12512 [[Bar:Article (context), context|]]
12513 [[Bar:Article (context),context|]]
12514 [[:Bar:Article (context), context|]]
12515 [[:Bar:Article (context),context|]]
12516 !! html/php
12517 [[Article (context), context|Article]]
12518 [[Article (context),context|Article]]
12519 [[Bar:Article (context), context|Article]]
12520 [[Bar:Article (context),context|Article]]
12521 [[:Bar:Article (context), context|Article]]
12522 [[:Bar:Article (context),context|Article]]
12523 !! end
12524
12525 !! test
12526 pre-save transform: trim trailing empty lines
12527 !! options
12528 pst
12529 !! wikitext
12530 Empty lines are trimmed
12531
12532
12533
12534
12535 !! html/php
12536 Empty lines are trimmed
12537 !! end
12538
12539 !! test
12540 pre-save transform: Signature expansion
12541 !! options
12542 pst
12543 !! wikitext
12544 * ~~~
12545 * <noinclude>~~~</noinclude>
12546 * <includeonly>~~~</includeonly>
12547 * <onlyinclude>~~~</onlyinclude>
12548 !! html/php
12549 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
12550 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
12551 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
12552 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
12553 !! end
12554
12555
12556 !! test
12557 pre-save transform: Signature expansion in nowiki tags (bug 93)
12558 !! options
12559 pst disabled
12560 !! wikitext
12561 Shall not expand:
12562
12563 <nowiki>~~~~</nowiki>
12564
12565 <includeonly><nowiki>~~~~</nowiki></includeonly>
12566
12567 <noinclude><nowiki>~~~~</nowiki></noinclude>
12568
12569 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12570
12571 {{subst:Foo}} shall be converted to FOO
12572
12573 As well as inside noinclude/onlyinclude
12574 <noinclude>{{subst:Foo}}</noinclude>
12575 <onlyinclude>{{subst:Foo}}</onlyinclude>
12576
12577 But not inside includeonly
12578 <includeonly>{{subst:Foo}}</includeonly>
12579 !! html/php
12580 Shall not expand:
12581
12582 <nowiki>~~~~</nowiki>
12583
12584 <includeonly><nowiki>~~~~</nowiki></includeonly>
12585
12586 <noinclude><nowiki>~~~~</nowiki></noinclude>
12587
12588 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12589
12590 FOO shall be converted to FOO
12591
12592 As well as inside noinclude/onlyinclude
12593 <noinclude>FOO</noinclude>
12594 <onlyinclude>FOO</onlyinclude>
12595
12596 But not inside includeonly
12597 <includeonly>{{subst:Foo}}</includeonly>
12598 !! end
12599
12600 !! test
12601 Parsoid: Recognize nowiki with trailing space in tags
12602 !! options
12603 parsoid=wt2html
12604 !! wikitext
12605 <nowiki ><div>[[foo]]</nowiki >
12606
12607 a<nowiki / >b
12608
12609 c<nowiki />d
12610
12611 e<nowiki/ >f
12612 !! html
12613 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12614 <p>ab</p>
12615 <p>cd</p>
12616 <p>ef</p>
12617 !! end
12618
12619 !! test
12620 Parsoid: Recognize nowiki with odd capitalization
12621 !! options
12622 parsoid=wt2html
12623 !! wikitext
12624 <noWikI ><div>[[foo]]</Nowiki >
12625 !! html
12626 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12627 !! end
12628
12629
12630 !! test
12631 Parsoid: Escape nowiki with trailing space in tags
12632 !! options
12633 parsoid=html2wt
12634 !! html/parsoid
12635 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
12636 <p>a&lt;nowiki /&gt;b</p>
12637 <p>c&lt;nowiki/ &gt;d</p>
12638 !! wikitext
12639 &lt;nowiki &gt; foo &lt;/nowiki &gt;
12640
12641 a&lt;nowiki /&gt;b
12642
12643 c&lt;nowiki/ &gt;d
12644 !! end
12645
12646 !! test
12647 Parsoid: Escape weird noWikI capitalizations
12648 !! options
12649 parsoid=html2wt
12650 !! html/parsoid
12651 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
12652 !! wikitext
12653 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
12654 !! end
12655
12656 ###
12657 ### Message transform tests
12658 ###
12659 !! test
12660 message transform: magic variables
12661 !! options
12662 msg
12663 !! wikitext
12664 {{SITENAME}}
12665 !! html
12666 MediaWiki
12667 !! end
12668
12669 !! test
12670 message transform: should not transform wiki markup
12671 !! options
12672 msg
12673 !! wikitext
12674 ''test''
12675 !! html
12676 ''test''
12677 !! end
12678
12679 !! test
12680 message transform: <noinclude> in transcluded template (bug 4926)
12681 !! options
12682 msg
12683 !! wikitext
12684 {{Includes}}
12685 !! html
12686 Foobar
12687 !! end
12688
12689 !! test
12690 message transform: <onlyinclude> in transcluded template (bug 4926)
12691 !! options
12692 msg
12693 !! wikitext
12694 {{Includes2}}
12695 !! html
12696 Foo
12697 !! end
12698
12699 !! test
12700 {{#special:}} page name, known
12701 !! options
12702 msg
12703 !! wikitext
12704 {{#special:Recentchanges}}
12705 !! html
12706 Special:RecentChanges
12707 !! end
12708
12709 !! test
12710 {{#special:}} page name with subpage, known
12711 !! options
12712 msg
12713 !! wikitext
12714 {{#special:Recentchanges/param}}
12715 !! html
12716 Special:RecentChanges/param
12717 !! end
12718
12719 !! test
12720 {{#special:}} page name, unknown
12721 !! options
12722 msg
12723 !! wikitext
12724 {{#special:foobar nonexistent}}
12725 !! html
12726 Special:Foobar nonexistent
12727 !! end
12728
12729 !! test
12730 {{#speciale:}} page name, known
12731 !! options
12732 msg
12733 !! wikitext
12734 {{#speciale:Recentchanges}}
12735 !! html
12736 Special:RecentChanges
12737 !! end
12738
12739 !! test
12740 {{#speciale:}} page name with subpage, known
12741 !! options
12742 msg
12743 !! wikitext
12744 {{#speciale:Recentchanges/param}}
12745 !! html
12746 Special:RecentChanges/param
12747 !! end
12748
12749 !! test
12750 {{#speciale:}} page name, unknown
12751 !! options
12752 msg
12753 !! wikitext
12754 {{#speciale:foobar nonexistent}}
12755 !! html
12756 Special:Foobar_nonexistent
12757 !! end
12758
12759 ###
12760 ### Images
12761 ###
12762 ### For Parsoid-specific tests, see
12763 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
12764
12765 !! test
12766 Simple image
12767 !! options
12768 parsoid=wt2html,wt2wt,html2html
12769 !! wikitext
12770 [[Image:foobar.jpg]]
12771 !! html/php
12772 <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>
12773 </p>
12774 !! html/parsoid
12775 <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>
12776 !! end
12777
12778 !! test
12779 Simple image (using File: namespace, now canonical)
12780 !! wikitext
12781 [[File:Foobar.jpg]]
12782 !! html/php
12783 <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>
12784 </p>
12785 !! html/parsoid
12786 <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>
12787 !! end
12788
12789 !! test
12790 Right-aligned image
12791 !! wikitext
12792 [[File:Foobar.jpg|right]]
12793 !! html/php
12794 <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>
12795
12796 !! html/parsoid
12797 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
12798 !! end
12799
12800 !! test
12801 Image with caption
12802 !! wikitext
12803 [[File:Foobar.jpg|right|Caption text]]
12804 !! html/php
12805 <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>
12806
12807 !! html/parsoid
12808 <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>
12809 !! end
12810
12811 !! test
12812 Image with caption, bug 53312 #1
12813 !! wikitext
12814 [[File:Foobar.jpg|right|Caption page stuff]]
12815 !! html/php
12816 <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>
12817
12818 !! html/parsoid
12819 <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>
12820 !! end
12821
12822 !! test
12823 Image with caption, bug 53312 #2
12824 !! wikitext
12825 [[File:Foobar.jpg|right|Caption page=]]
12826 !! html/php
12827 <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>
12828
12829 !! html/parsoid
12830 <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>
12831 !! end
12832
12833 !! test
12834 Image with caption, bug 53312 #3
12835 !! wikitext
12836 [[File:Foobar.jpg|right|Caption page=stuff]]
12837 !! html/php
12838 <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>
12839
12840 !! html/parsoid
12841 <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>
12842 !! end
12843
12844 !! test
12845 Allow empty links in image captions (Bug 60753)
12846 !! options
12847 thumbsize=220
12848 !! wikitext
12849 [[File:Foobar.jpg|thumb|Caption [[Link1]]
12850 [[]]
12851 [[Link2]]
12852 ]]
12853 !! html/php
12854 <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>
12855
12856 !! html/parsoid
12857 <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>
12858 [[]]
12859 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
12860 </figcaption></figure>
12861 !! end
12862
12863 !! test
12864 Titles in unlinked images (T23454)
12865 !! wikitext
12866 [[File:Foobar.jpg|link=|stuff]]
12867 !! html/php
12868 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
12869 </p>
12870 !! end
12871
12872 !! test
12873 Link with empty target
12874 !! wikitext
12875 [[]]
12876 !! html
12877 <p>[[]]
12878 </p>
12879 !! end
12880
12881 !! test
12882 Image with link trail
12883 !! wikitext
12884 Linktrails should not work for images: [[File:Foobar.jpg]]s
12885 !! html/php
12886 <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
12887 </p>
12888 !! html/parsoid
12889 <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>
12890 !! end
12891
12892 !! test
12893 Image with empty attribute
12894 !! options
12895 parsoid=wt2html,wt2wt,html2html
12896 !! wikitext
12897 [[File:Foobar.jpg|right||Caption text]]
12898 !! html/php
12899 <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>
12900
12901 !! html/parsoid
12902 <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>
12903 !! end
12904
12905 !! test
12906 1. Block image with individual attributes from templates
12907 !! wikitext
12908 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
12909 !! html/php
12910 <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>
12911
12912 !! html/parsoid
12913 <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>
12914 !! end
12915
12916 !! test
12917 2. Block Image with individual attributes from templates
12918 !! wikitext
12919 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
12920 !! html/php
12921 <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>
12922
12923 !! html/parsoid
12924 <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>
12925 !! end
12926
12927 !! test
12928 3. Inline image with individual attributes from templates
12929 !! wikitext
12930 [[File:Foobar.jpg|{{echo|50px}}]]
12931 !! html/php
12932 <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>
12933 </p>
12934 !! html/parsoid
12935 <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>
12936 !! end
12937
12938 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
12939 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
12940 !! test
12941 Image with multiple attributes from the same template
12942 !! wikitext
12943 [[File:Foobar.jpg|{{image_attribs}}]]
12944 !! html/php
12945 <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>
12946
12947 !! html/parsoid
12948 <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>
12949 !! end
12950
12951 !! test
12952 Image with link tails
12953 !! options
12954 thumbsize=220
12955 !! wikitext
12956 123[[File:Foobar.jpg]]456
12957 123[[File:Foobar.jpg|right]]456
12958 123[[File:Foobar.jpg|thumb]]456
12959 !! html/php
12960 <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
12961 </p>
12962 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
12963 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
12964
12965 !! html/php+tidy
12966 <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>
12967 <p>123</p>
12968 <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>
12969 <p>456 123</p>
12970 <div class="thumb tright">
12971 <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>
12972 <div class="thumbcaption">
12973 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
12974 </div>
12975 </div>
12976 </div>
12977 <p>456</p>
12978 !! html/parsoid
12979 <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>
12980 <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>
12981 <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>
12982 !! end
12983
12984 !! test
12985 Image with multiple captions -- only last one is accepted
12986 !! wikitext
12987 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
12988 !! html/php
12989 <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>
12990
12991 !! html/parsoid
12992 <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>
12993 !! end
12994
12995 !! test
12996 Image with multiple widths -- use last
12997 !! wikitext
12998 [[File:Foobar.jpg|200px|300px|caption]]
12999 !! html/php
13000 <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>
13001 </p>
13002 !! html/parsoid
13003 <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>
13004 !! end
13005
13006 !! test
13007 Image with multiple alignments -- use first (bug 48664)
13008 !! options
13009 thumbsize=220
13010 !! wikitext
13011 [[File:Foobar.jpg|thumb|left|right|center|caption]]
13012
13013 [[File:Foobar.jpg|middle|text-top|caption]]
13014 !! html/php
13015 <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>
13016 <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>
13017 </p>
13018 !! html/parsoid
13019 <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>
13020 <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>
13021 !! end
13022
13023 !! test
13024 Image with width attribute at different positions
13025 !! wikitext
13026 [[File:Foobar.jpg|200px|right|Caption]]
13027 [[File:Foobar.jpg|right|200px|Caption]]
13028 [[File:Foobar.jpg|right|Caption|200px]]
13029 !! html/php
13030 <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>
13031 <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>
13032 <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>
13033
13034 !! html/parsoid
13035 <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>
13036 <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>
13037 <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>
13038 !! end
13039
13040 # a sad bit of backward-compatibility
13041 !! test
13042 Image with size specified with pxpx (bug 13500, 51628)
13043 !! options
13044 parsoid=wt2html,wt2wt,html2html
13045 !! wikitext
13046 [[File:Foobar.jpg|20pxpx]]
13047 [[File:Foobar.jpg|200x20pxpx]]
13048 !! html/php
13049 <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>
13050 <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>
13051 </p>
13052 !! html/parsoid
13053 <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>
13054 !! end
13055
13056 !! test
13057 Image with link parameter, wiki target
13058 !! wikitext
13059 [[File:Foobar.jpg|link=Main Page]]
13060 !! html/php
13061 <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>
13062 </p>
13063 !! html/parsoid
13064 <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>
13065 !! end
13066
13067 # parsoid bug 49293 (part 1)
13068 !! test
13069 Image with link parameter, URL target
13070 !! wikitext
13071 [[File:Foobar.jpg|link=http://example.com/]]
13072 !! html/php
13073 <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>
13074 </p>
13075 !! html/parsoid
13076 <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>
13077 !! end
13078
13079 # parsoid bug 49293 (part 2)
13080 !! test
13081 Image with link parameter, protocol-less URL target
13082 !! wikitext
13083 [[File:Foobar.jpg|link=//example.com/]]
13084 !! html/php
13085 <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>
13086 </p>
13087 !! html/parsoid
13088 <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>
13089 !! end
13090
13091 !! test
13092 Escaping non-block captions (T107435)
13093 !! options
13094 parsoid={
13095 "modes": ["wt2wt"],
13096 "changes": [
13097 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
13098 ]
13099 }
13100 !! wikitext
13101 [[Image:Foobar.jpg|caption]]
13102 !! wikitext/edited
13103 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
13104 !! end
13105
13106 # wgExternalLinkTarget not supported by Parsoid
13107 !! test
13108 Image with link parameter, wgExternalLinkTarget
13109 !! wikitext
13110 [[Image:foobar.jpg|link=http://example.com/]]
13111 !! config
13112 wgExternalLinkTarget='foobar'
13113 !! html/php
13114 <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>
13115 </p>
13116 !! end
13117
13118 !! test
13119 Image with link parameter, wgNoFollowLinks set to false
13120 !! wikitext
13121 [[Image:foobar.jpg|link=http://example.com/]]
13122 !! config
13123 wgNoFollowLinks=false
13124 !! html
13125 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13126 </p>
13127 !! end
13128
13129 !! test
13130 Image with link parameter, wgNoFollowDomainExceptions
13131 !! wikitext
13132 [[Image:foobar.jpg|link=http://example.com/]]
13133 !! config
13134 wgNoFollowDomainExceptions='example.com'
13135 !! html
13136 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13137 </p>
13138 !! end
13139
13140 # wgExternalLinkTarget not supported by Parsoid
13141 !! test
13142 Image with link parameter, wgExternalLinkTarget, unnamed parameter
13143 !! wikitext
13144 [[Image:foobar.jpg|link=http://example.com/|Title]]
13145 !! config
13146 wgExternalLinkTarget='foobar'
13147 !! html/php
13148 <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>
13149 </p>
13150 !! end
13151
13152 !! test
13153 Image with empty link parameter
13154 !! wikitext
13155 [[File:Foobar.jpg|link=]]
13156 !! html/php
13157 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
13158 </p>
13159 !! html/parsoid
13160 <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>
13161 !! end
13162
13163 !! test
13164 Image with link parameter (wiki target) and unnamed parameter
13165 !! wikitext
13166 [[File:Foobar.jpg|link=Main_Page|Title]]
13167 !! html/php
13168 <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>
13169 </p>
13170 !! html/parsoid
13171 <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>
13172 !! end
13173
13174 !! test
13175 Image with link parameter (URL target) and unnamed parameter
13176 !! wikitext
13177 [[File:Foobar.jpg|link=http://example.com/|Title]]
13178 !! html/php
13179 <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>
13180 </p>
13181 !! html/parsoid
13182 <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>
13183 !! end
13184
13185 !! test
13186 Thumbnail image with link parameter
13187 !! options
13188 thumbsize=220
13189 parsoid=wt2html,wt2wt,html2html
13190 !! wikitext
13191 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
13192 !! html/php
13193 <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>
13194
13195 !! html/parsoid
13196 <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>
13197 !! end
13198
13199 !! test
13200 Manually-specified thumbnail image
13201 !! options
13202 thumbsize=220
13203 !! wikitext
13204 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
13205 !! html/php
13206 <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>
13207
13208 !! html/parsoid
13209 <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>
13210 !! end
13211
13212 !! test
13213 Manually-specified thumbnail image with explicit link to wiki page
13214 !! options
13215 thumbsize=220
13216 parsoid=wt2html,wt2wt,html2html
13217 !! wikitext
13218 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
13219 !! html/php
13220 <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>
13221
13222 !! html/parsoid
13223 <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>
13224 !! end
13225
13226 !! test
13227 Manually-specified thumbnail image with explicit link to url
13228 !! options
13229 thumbsize=220
13230 parsoid=wt2html,wt2wt,html2html
13231 !! wikitext
13232 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
13233 !! html/php
13234 <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>
13235
13236 !! html/parsoid
13237 <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>
13238 !! end
13239
13240 !! test
13241 Manually-specified thumbnail image with explicit no link
13242 !! options
13243 thumbsize=220
13244 parsoid=wt2html,wt2wt,html2html
13245 !! wikitext
13246 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
13247 !! html/php
13248 <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>
13249
13250 !! html/parsoid
13251 <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>
13252 !! end
13253
13254 !! test
13255 Manually-specified thumbnail image with explicit link and alt text
13256 !! options
13257 thumbsize=220
13258 parsoid=wt2html,wt2wt,html2html
13259 !! wikitext
13260 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
13261 !! html/php
13262 <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>
13263
13264 !! html/parsoid
13265 <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>
13266 !! end
13267
13268 !! test
13269 Image with frame and link
13270 !! options
13271 parsoid=wt2html,wt2wt,html2html
13272 !! wikitext
13273 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
13274 !! html/php
13275 <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>
13276
13277 !! html/parsoid
13278 <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>
13279 !! end
13280
13281 !! test
13282 Image with frame and link and explicit alt
13283 !! options
13284 parsoid=wt2html,wt2wt,html2html
13285 !! wikitext
13286 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
13287 !! html/php
13288 <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>
13289
13290 !! html/parsoid
13291 <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>
13292 !! end
13293
13294 !! test
13295 Image with wiki markup in implicit alt
13296 !! wikitext
13297 [[Image:Foobar.jpg|testing '''bold''' in alt]]
13298
13299 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
13300 !! html/php
13301 <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>
13302 </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>
13303 </p>
13304 !! html/parsoid
13305 <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>
13306 <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>
13307 !! end
13308
13309 !! test
13310 Alt image option should handle most kinds of wikitext without barfing
13311 !! wikitext
13312 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
13313 !! html/php
13314 <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>
13315
13316 !! html/parsoid
13317 <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>
13318 !! end
13319
13320 ###################
13321 # Conflicting image format options.
13322 # First option specified should 'win'.
13323 # All three cases in each test should be identical.
13324
13325 !! test
13326 Image with 'frameless' first.
13327 !! options
13328 parsoid=wt2html,wt2wt,html2html
13329 !! wikitext
13330 [[File:Foobar.jpg|frameless|caption]]
13331
13332 [[File:Foobar.jpg|frameless|frame|caption]]
13333
13334 [[File:Foobar.jpg|frameless|thumb|caption]]
13335 !! html/php
13336 <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>
13337 </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>
13338 </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>
13339 </p>
13340 !! html/parsoid
13341 <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>
13342 <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>
13343 <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>
13344 !! end
13345
13346 !! test
13347 Image with 'frame' first.
13348 !! options
13349 parsoid=wt2html,wt2wt,html2html
13350 !! wikitext
13351 [[File:Foobar.jpg|frame|caption]]
13352 [[File:Foobar.jpg|frame|frameless|caption]]
13353 [[File:Foobar.jpg|frame|thumb|caption]]
13354 !! html/php
13355 <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>
13356 <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>
13357 <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>
13358
13359 !! html/parsoid
13360 <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>
13361 <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>
13362 <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>
13363 !! end
13364
13365 !! test
13366 Image with 'thumb' first.
13367 !! options
13368 parsoid=wt2html,wt2wt,html2html
13369 !! wikitext
13370 [[File:Foobar.jpg|thumb|caption]]
13371 [[File:Foobar.jpg|thumb|frameless|caption]]
13372 [[File:Foobar.jpg|thumb|frame|caption]]
13373 !! html/php
13374 <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>
13375 <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>
13376 <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>
13377
13378 !! html/parsoid
13379 <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>
13380 <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>
13381 <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>
13382 !! end
13383
13384 ###################
13385 # Image sizing.
13386 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
13387 # and https://phabricator.wikimedia.org/T64258
13388 # Foobar has actual size of 1941x220
13389 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
13390 # a scalable format.
13391 # 2. Framed images always ignore size options; always render at default size.
13392 # 3. "Unspecified format" and border are the only types which can be
13393 # enlarged.
13394
13395 !! test
13396 Image: "unspecified format" and border enlarge
13397 !! options
13398 parsoid=wt2html,wt2wt,html2html
13399 !! wikitext
13400 [[File:Foobar.jpg|2000px]]
13401
13402 [[File:Foobar.jpg|border|2000px]]
13403 !! html/php
13404 <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>
13405 </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>
13406 </p>
13407 !! html/parsoid
13408 <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>
13409 <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>
13410 !! end
13411
13412 !! test
13413 Image: "unspecified format" and border reduce
13414 !! options
13415 parsoid=wt2html,wt2wt,html2html
13416 !! wikitext
13417 [[File:Foobar.jpg|1000px]]
13418
13419 [[File:Foobar.jpg|border|1000px]]
13420 !! html/php
13421 <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>
13422 </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>
13423 </p>
13424 !! html/parsoid
13425 <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>
13426 <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>
13427 !! end
13428
13429 !! test
13430 Image: thumbs reduce
13431 !! options
13432 parsoid=wt2html,wt2wt,html2html
13433 !! wikitext
13434 [[File:Foobar.jpg|thumb|50px]]
13435 !! html/php
13436 <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>
13437
13438 !! html/parsoid
13439 <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>
13440 !! end
13441
13442 !! test
13443 Image: bitmap thumbs can't be enlarged past original size, but vector can.
13444 !! options
13445 parsoid=wt2html,wt2wt,html2html
13446 !! wikitext
13447 [[File:Foobar.jpg|thumb|2000px]]
13448
13449 [[File:Foobar.svg|thumb|2000px]]
13450 !! html/php
13451 <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>
13452 <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>
13453
13454 !! html/parsoid
13455 <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>
13456 <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>
13457 !! end
13458
13459 !! test
13460 Image: frameless can reduce in size
13461 !! options
13462 parsoid=wt2html,wt2wt,html2html
13463 !! wikitext
13464 [[File:Foobar.jpg|frameless|50px]]
13465 !! html/php
13466 <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>
13467 </p>
13468 !! html/parsoid
13469 <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>
13470 !! end
13471
13472 !! test
13473 Image: bitmap frameless can't be enlarged past original size, but vector can
13474 !! options
13475 parsoid=wt2html,wt2wt,html2html
13476 !! wikitext
13477 [[File:Foobar.jpg|frameless|2000px]]
13478
13479 [[File:Foobar.svg|frameless|2000px]]
13480 !! html/php
13481 <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>
13482 </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>
13483 </p>
13484 !! html/parsoid
13485 <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>
13486 <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>
13487 !! end
13488
13489 !! test
13490 Image: framed images are always unscaled.
13491 !! options
13492 parsoid=wt2html,wt2wt,html2html
13493 !! wikitext
13494 [[File:Foobar.jpg|frame]]
13495
13496 [[File:Foobar.jpg|frame|50px]]
13497
13498 [[File:Foobar.jpg|frame|50x50px]]
13499
13500 [[File:Foobar.jpg|frame|2000px]]
13501 !! html/php
13502 <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>
13503 <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>
13504 <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>
13505 <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>
13506
13507 !! html/parsoid
13508 <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>
13509 <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>
13510 <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>
13511 <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>
13512 !! end
13513
13514 ###################
13515
13516 !! test
13517 Link to image page- image page normally doesn't exists, hence edit link
13518 Add test with existing image page
13519 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
13520 !! wikitext
13521 [[:Image:test]]
13522 !! html
13523 <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>
13524 </p>
13525 !! end
13526
13527 !! test
13528 bug 18784 Link to non-existent image page with caption should use caption as link text
13529 !! wikitext
13530 [[:Image:test|caption]]
13531 !! html
13532 <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>
13533 </p>
13534 !! end
13535
13536 !! test
13537 Frameless image caption with a free URL
13538 !! wikitext
13539 [[File:Foobar.jpg|http://example.com]]
13540 !! html/php
13541 <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>
13542 </p>
13543 !! html/parsoid
13544 <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>
13545 !! end
13546
13547 !! test
13548 Thumbnail image caption with a free URL
13549 !! options
13550 thumbsize=220
13551 !! wikitext
13552 [[File:Foobar.jpg|thumb|http://example.com]]
13553 !! html/php
13554 <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>
13555
13556 !! html/parsoid
13557 <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>
13558 !! end
13559
13560 !! test
13561 Thumbnail image caption with a free URL and explicit alt
13562 !! options
13563 thumbsize=220
13564 parsoid=wt2html,wt2wt,html2html
13565 !! wikitext
13566 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
13567 !! html/php
13568 <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>
13569
13570 !! html/parsoid
13571 <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>
13572 !! end
13573
13574 !! test
13575 SVG thumbnails with no language set
13576 !! options
13577 !! wikitext
13578 [[File:Foobar.svg|thumb|caption]]
13579 !! html/php
13580 <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>
13581
13582 !! html/parsoid
13583 <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>
13584 !! end
13585
13586 !! test
13587 SVG thumbnails with language de
13588 !! options
13589 parsoid=wt2html,wt2wt,html2html
13590 !! wikitext
13591 [[File:Foobar.svg|thumb|caption|lang=de]]
13592 !! html/php
13593 <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>
13594
13595 !! html/parsoid
13596 <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>
13597 !! end
13598
13599 !! test
13600 SVG thumbnails with invalid language code
13601 !! options
13602 parsoid=wt2html,wt2wt,html2html
13603 !! wikitext
13604 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
13605 !! html/php
13606 <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>
13607
13608 !! html/parsoid
13609 <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>
13610 !! end
13611
13612 !! test
13613 BUG 1887: A ISBN with a thumbnail
13614 !! wikitext
13615 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
13616 !! html/php
13617 <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>
13618
13619 !! html/parsoid
13620 <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>
13621 !! end
13622
13623 !! test
13624 BUG 1887: A RFC with a thumbnail
13625 !! wikitext
13626 [[File:Foobar.jpg|thumb|This is RFC 12354]]
13627 !! html/php
13628 <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>
13629
13630 !! html/parsoid
13631 <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>
13632 !! end
13633
13634 !! test
13635 BUG 1887: A mailto link with a thumbnail
13636 !! wikitext
13637 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
13638 !! html/php
13639 <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>
13640
13641 !! html/parsoid
13642 <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>
13643 !! end
13644
13645 # Pending resolution to bug 368
13646 !! test
13647 BUG 648: Frameless image caption with a link
13648 !! wikitext
13649 [[File:Foobar.jpg|text with a [[link]] in it]]
13650 !! html/php
13651 <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>
13652 </p>
13653 !! html/parsoid
13654 <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>
13655 !! end
13656
13657 !! test
13658 BUG 648: Frameless image caption with a link (suffix)
13659 !! wikitext
13660 [[File:Foobar.jpg|text with a [[link]]foo in it]]
13661 !! html/php
13662 <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>
13663 </p>
13664 !! html/parsoid
13665 <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>
13666 !! end
13667
13668 !! test
13669 BUG 648: Frameless image caption with an interwiki link
13670 !! wikitext
13671 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
13672 !! html/php
13673 <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>
13674 </p>
13675 !! html/parsoid
13676 <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>
13677 !! end
13678
13679 !! test
13680 BUG 648: Frameless image caption with a piped interwiki link
13681 !! wikitext
13682 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
13683 !! html/php
13684 <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>
13685 </p>
13686 !! html/parsoid
13687 <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>
13688 !! end
13689
13690 !! test
13691 T107474: Frameless image caption with <nowiki>
13692 !! wikitext
13693 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
13694 !! html/parsoid
13695 <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>
13696 !! end
13697
13698 !! test
13699 Escape HTML special chars in image alt text
13700 !! wikitext
13701 [[File:Foobar.jpg|& < > "]]
13702 !! html/php
13703 <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>
13704 </p>
13705 !! html/parsoid
13706 <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>
13707 !! end
13708
13709 !! test
13710 BUG 499: Alt text should have &#1234;, not &amp;1234;
13711 !! wikitext
13712 [[File:Foobar.jpg|&#9792;]]
13713 !! html/php
13714 <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>
13715 </p>
13716 !! html/parsoid
13717 <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>
13718 !! end
13719
13720 !! test
13721 Broken image caption with link
13722 !! options
13723 parsoid=wt2html,wt2wt,html2html
13724 !! wikitext
13725 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
13726 !! html/php
13727 <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.
13728 </p>
13729 !! html/parsoid
13730 <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>
13731 !! end
13732
13733 !! test
13734 Image caption containing another image
13735 !! wikitext
13736 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
13737 !! html/php
13738 <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>
13739
13740 !! html/parsoid
13741 <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>
13742 !! end
13743
13744 !! test
13745 Image: caption containing a newline
13746 !! wikitext
13747 [[File:Foobar.jpg|This
13748 *is some text]]
13749 !! html/php
13750 <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>
13751 </p>
13752 !! html/parsoid
13753 <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>
13754 !!end
13755
13756 !!test
13757 Image: caption containing leading space
13758 (The leading space should not trigger nowiki escaping in wt2wt mode)
13759 !! wikitext
13760 [[File:Foobar.jpg|thumb| bar]]
13761 !! html/php
13762 <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>
13763
13764 !! html/parsoid
13765 <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>
13766 !!end
13767
13768 !! test
13769 Image: caption containing a table
13770 !! options
13771 parsoid=wt2html,wt2wt,html2html
13772 !! wikitext
13773 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
13774 {|
13775 ! Foo !! Bar
13776 |-
13777 | Foo1 || Bar1
13778 |}
13779 and some more text.]]
13780 !! html/php
13781 <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>
13782
13783 !! html/parsoid
13784 <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
13785 <table>
13786 <tbody>
13787 <tr><th>Foo </th><th>Bar</th></tr>
13788 <tr>
13789 <td>Foo1 </td>
13790 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
13791 !! end
13792
13793 !! test
13794 Bug 3090: External links other than http: in image captions
13795 !! wikitext
13796 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
13797 !! html/php
13798 <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>
13799
13800 !! html/parsoid
13801 <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>
13802 !! end
13803
13804 !! test
13805 Custom class
13806 !! options
13807 parsoid=wt2html,wt2wt,html2html
13808 !! wikitext
13809 [[Image:foobar.jpg|a|class=b]]
13810 !! html/php
13811 <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>
13812 </p>
13813 !! html/parsoid
13814 <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>
13815 !! end
13816
13817 !! test
13818 Localized image handling (1).
13819 !! options
13820 parsoid=wt2html,wt2wt,html2html
13821 language=es
13822 !! wikitext
13823 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
13824 !! html/php
13825 <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>
13826
13827 !! html/parsoid
13828 <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>
13829 !! end
13830
13831 !! test
13832 Localized image handling (2).
13833 !! options
13834 thumbsize=220
13835 parsoid=wt2html,wt2wt,html2html
13836 language=es
13837 !! wikitext
13838 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
13839 !! html/php
13840 <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>
13841
13842 !! html/parsoid
13843 <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>
13844 !! end
13845
13846 !! test
13847 "border", "frameless" and "class" attributes on an image.
13848 !! options
13849 thumbsize=220
13850 parsoid=wt2html,wt2wt,html2html
13851 !! wikitext
13852 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
13853 !! html/php
13854 <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>
13855 </p>
13856 !! html/parsoid
13857 <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>
13858 !! end
13859
13860 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
13861 !! test
13862 Invalid image attributes (bug 62500)
13863 !! options
13864 thumbsize=220
13865 parsoid=wt2html,wt2wt,html2html
13866 !! wikitext
13867 [[File:Foobar.jpg|thumb|float|left|caption]]
13868
13869 [[File:Foobar.jpg|thumb|righ|caption]]
13870
13871 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
13872 !! html/php
13873 <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>
13874 <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>
13875 <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>
13876
13877 !! html/parsoid
13878 <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>
13879 <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>
13880 <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>
13881 !! end
13882
13883 !! article
13884 File:Barfoo.jpg
13885 !! text
13886 #REDIRECT [[File:Barfoo.jpg]]
13887 !! endarticle
13888
13889 # FIXME: Parsoid should run this test -- but we'd need to teach the
13890 # mockAPI about the redirected Barfoo.jpg image.
13891 !! test
13892 Redirected image
13893 !! wikitext
13894 [[Image:Barfoo.jpg]]
13895 !! html/php
13896 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
13897 </p>
13898 !! end
13899
13900 !! test
13901 Missing image with uploads disabled
13902 !! options
13903 wgEnableUploads=0
13904 !! wikitext
13905 [[File:Foobaz.jpg]]
13906 !! html/php
13907 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
13908 </p>
13909 !! html/parsoid
13910 <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>
13911 !! end
13912
13913 # Parsoid-specific testing for images
13914 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
13915 # Currently imperfect due to a flaw in the Parsoid testrunner
13916 # Work in progress
13917 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
13918 # image tests.
13919
13920 !! test
13921 Parsoid-specific image handling - simple image with size and middle alignment
13922 !! wikitext
13923 [[File:Foobar.jpg|middle|50px]]
13924 !! html/parsoid
13925 <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>
13926 !! end
13927
13928 !! test
13929 Parsoid-specific image handling - simple image with size, middle alignment,
13930 non-standard namespace alias
13931 !! options
13932 parsoid=wt2wt,wt2html,html2html
13933 !! wikitext
13934 [[Image:Foobar.jpg|middle|50px]]
13935 !! html/parsoid
13936 <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>
13937 !! end
13938
13939 !! test
13940 Parsoid-specific image handling - simple image with size and middle alignment
13941 (existing content)
13942 !! wikitext
13943 [[File:Foobar.jpg|50px|middle]]
13944 !! html/parsoid
13945 <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>
13946 !! end
13947
13948 !! test
13949 Parsoid-specific image handling - simple image with size and middle alignment
13950 and non-standard namespace name
13951 !! options
13952 parsoid=wt2html,wt2wt,html2html
13953 !! wikitext
13954 [[Image:Foobar.jpg|50px|middle]]
13955 !! html/parsoid
13956 <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>
13957 !! end
13958
13959 !! test
13960 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
13961 !! wikitext
13962 [[File:Foobar.jpg|500x10px|baseline|caption]]
13963 !! html/parsoid
13964 <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>
13965 !! end
13966
13967 !! test
13968 Parsoid-specific image handling - simple image with border and size spec
13969 !! wikitext
13970 [[File:Foobar.jpg|50px|border|caption]]
13971 !! html/parsoid
13972 <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>
13973 !! end
13974
13975 !! test
13976 Parsoid-specific image handling - thumbnail with halign, valign, and caption
13977 !! wikitext
13978 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
13979 !! html/parsoid
13980 <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>
13981 !! end
13982
13983 !! test
13984 Parsoid-specific image handling - thumbnail with halign, valign, and caption
13985 (existing content)
13986 !! wikitext
13987 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
13988 !! html/parsoid
13989 <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>
13990 !! end
13991
13992 !! test
13993 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
13994 !! wikitext
13995 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
13996 !! html/parsoid
13997 <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>
13998 !! end
13999
14000 !! test
14001 Parsoid-specific image handling - thumbnail with specific size, halign,
14002 valign, and caption (existing content)
14003 !! wikitext
14004 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
14005 !! html/parsoid
14006 <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>
14007 !! end
14008
14009 !! test
14010 Parsoid-specific image handling - framed image with specific size and caption
14011 (size is ignored)
14012 !! options
14013 parsoid=wt2html,wt2wt,html2html
14014 !! wikitext
14015 [[File:Foobar.jpg|frame|500x50px|caption]]
14016 !! html/parsoid
14017 <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>
14018 !! end
14019
14020 !! test
14021 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
14022 (size is ignored)
14023 !! options
14024 parsoid=wt2html,wt2wt,html2html
14025 !! wikitext
14026 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
14027 !! html/parsoid
14028 <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>
14029 !! end
14030
14031 !! test
14032 Parsoid-specific image handling - frameless image with specific size, border, and caption
14033 !! wikitext
14034 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
14035 !! html/parsoid
14036 <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>
14037 !! end
14038
14039 !! test
14040 Parsoid-specific image handling - simple image with a formatted caption
14041 !! wikitext
14042 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
14043 !! html/parsoid
14044 <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>
14045 !! end
14046
14047 !! test
14048 Parsoid-specific image handling - caption with a template in it
14049 !! wikitext
14050 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
14051 !! html/parsoid
14052 <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>
14053 !! end
14054
14055 !! test
14056 Parsoid-specific image handling - caption with unbalanced tags in it
14057 !! options
14058 parsoid=wt2html,wt2wt,html2html
14059 !! wikitext
14060 foo
14061 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
14062 bar
14063 !! html/parsoid
14064 <p>foo</p>
14065 <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>
14066 <p>bar</p>
14067 !! end
14068
14069 !! test
14070 Parsoid-specific image handling - empty caption (1)
14071 !! options
14072 parsoid=wt2html,wt2wt
14073 !! wikitext
14074 [[File:Foobar.jpg|thumb|]]
14075 !! html/parsoid
14076 <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>
14077 !! end
14078
14079 # empty captions don't get serialized unless we're in the "round trip" case
14080 !! test
14081 Parsoid-specific image handling - empty caption (2)
14082 !! options
14083 parsoid=html2wt
14084 !! html/parsoid
14085 <figure class="mw-default-size" typeof="mw:Image/Thumb">
14086 <a href="./File:Foobar.jpg">
14087 <img resource="./File:Foobar.jpg"
14088 src="//example.com/images/3/3a/Foobar.jpg"
14089 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
14090 height="25" width="220"/>
14091 </a>
14092 <figcaption></figcaption>
14093 </figure>
14094 !! wikitext
14095 [[File:Foobar.jpg|thumb]]
14096 !! end
14097
14098 !! test
14099 Parsoid-specific image handling - whitespace caption
14100 !! wikitext
14101 [[File:Foobar.jpg|thumb| ]]
14102 !! html/parsoid
14103 <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>
14104 !! end
14105
14106 !! test
14107 Parsoid-specific image handling - lang option
14108 !! wikitext
14109 foo
14110 [[File:Foobar.svg|lang=de|caption]]
14111 bar
14112 !! html/parsoid
14113 <p>foo
14114 <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>
14115 bar</p>
14116 !! end
14117
14118 ## Edge case bugs in Parsoid from T93580
14119 !! test
14120 T93580: 1. Templated <ref> inside block images
14121 !! wikitext
14122 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
14123
14124 <references />
14125 !! html/parsoid
14126 <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>
14127
14128 <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>
14129 !! end
14130
14131 !! test
14132 T93580: 2. <ref> inside inline images
14133 !! wikitext
14134 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
14135
14136 <references />
14137 !! html/parsoid
14138 <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>
14139
14140 <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>
14141 !! end
14142
14143 !! test
14144 T93580: 3. Templated <ref> inside inline images
14145 !! wikitext
14146 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
14147
14148 <references />
14149 !! html/parsoid
14150 <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>
14151
14152 <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>
14153 !! end
14154
14155 ###
14156 ### Subpages
14157 ###
14158 !! article
14159 Subpage test/subpage
14160 !! text
14161 foo
14162 !! endarticle
14163
14164 !! test
14165 Subpage link
14166 !! options
14167 subpage title=[[Subpage test]]
14168 !! wikitext
14169 [[/subpage]]
14170 !! html
14171 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
14172 </p>
14173 !! end
14174
14175 !! test
14176 Subpage noslash link
14177 !! options
14178 subpage title=[[Subpage test]]
14179 !! wikitext
14180 [[/subpage/]]
14181 !! html
14182 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
14183 </p>
14184 !! end
14185
14186 !! article
14187 Subpage test/1/2/subpage
14188 !! text
14189 blah
14190 !! endarticle
14191
14192 !! test
14193 Relative subpage noslash link
14194 !! options
14195 parsoid=wt2wt,wt2html,html2html
14196 subpage title=[[Subpage test/1/2/3/4]]
14197 !! wikitext
14198 [[../../subpage/]]
14199
14200 [[../../subpage]]
14201 !! html/php
14202 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
14203 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
14204 </p>
14205 !! html/parsoid
14206 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
14207 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
14208 !! end
14209
14210 !! test
14211 Parsoid: dot-slash prefixed wikilinks
14212 !! wikitext
14213 [[./foo]]
14214
14215 [[././bar]]
14216
14217 [[././baz/]]
14218 !! html/php
14219 <p>[[./foo]]
14220 </p><p>[[././bar]]
14221 </p><p>[[././baz/]]
14222 </p>
14223 !! html/parsoid
14224 <p>[[./foo]]
14225 </p><p>[[././bar]]
14226 </p><p>[[././baz/]]
14227 </p>
14228 !! end
14229
14230 !! test
14231 Render invalid page names as plain text (bug 51090)
14232 !! wikitext
14233 [[./../foo|bar]]
14234 [[foo�|bar]]
14235 [[foo/.|bar]]
14236 [[foo/..|bar]]
14237 [[foo~~~bar]]
14238 [[foo>bar]]
14239 [[foo[bar]]
14240 [[.]]
14241 [[..]]
14242 [[foo././bar]]
14243
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 [[{{echo|foo}bar}}]]
14252 [[{{echo|foo[bar}}]]
14253 [[{{echo|foo]bar}}]]
14254 [[{{echo|foo<bar}}]]
14255 !!html/php
14256 <p>[[./../foo|bar]]
14257 [[foo�|bar]]
14258 [[foo/.|bar]]
14259 [[foo/..|bar]]
14260 [[foo~~~bar]]
14261 [[foo&gt;bar]]
14262 [[foo[bar]]
14263 [[.]]
14264 [[..]]
14265 [[foo././bar]]
14266 </p><p>[[./../foo|bar]]
14267 [[foo/.|bar]]
14268 [[foo/..|bar]]
14269 [[foo~~~~bar]]
14270 [[foo&gt;bar]]
14271 [[foo././bar]]
14272 [[foo{bar]]
14273 [[foo}bar]]
14274 [[foo[bar]]
14275 [[foo]bar]]
14276 [[foo&lt;bar]]
14277 </p>
14278 !!html/parsoid
14279 <p>[[./../foo|bar]]
14280 [[foo�|bar]]
14281 [[foo/.|bar]]
14282 [[foo/..|bar]]
14283 [[foo~~~bar]]
14284 [[foo>bar]]
14285 [[foo[bar]]
14286 [[.]]
14287 [[..]]
14288 [[foo././bar]]</p>
14289
14290 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
14291 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
14292 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
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{bar"}},"i":0}}]}'>foo{bar</span>]]
14297 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
14298 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
14299 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
14300 [[<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>
14301 !!end
14302
14303 !! test
14304 Disabled subpages
14305 !! wikitext
14306 [[/subpage]]
14307 !! html
14308 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
14309 </p>
14310 !! end
14311
14312 !! test
14313 BUG 561: {{/Subpage}}
14314 !! options
14315 subpage title=[[Page]]
14316 !! wikitext
14317 {{/Subpage}}
14318 !! html
14319 <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>
14320 </p>
14321 !! end
14322
14323 ###
14324 ### Categories
14325 ###
14326 !! article
14327 Category:MediaWiki User's Guide
14328 !! text
14329 blah
14330 !! endarticle
14331
14332 !! test
14333 Link to category
14334 !! wikitext
14335 [[:Category:MediaWiki User's Guide]]
14336 !! html
14337 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
14338 </p>
14339 !! end
14340
14341 !! test
14342 Simple category
14343 !! options
14344 cat
14345 !! wikitext
14346 [[Category:MediaWiki User's Guide]]
14347 !! html
14348 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14349 !! end
14350
14351 !! test
14352 PAGESINCATEGORY invalid title fatal (r33546 fix)
14353 !! wikitext
14354 {{PAGESINCATEGORY:<bogus>}}
14355 !! html
14356 <p>0
14357 </p>
14358 !! end
14359
14360 !! test
14361 Category with different sort key
14362 !! options
14363 cat
14364 !! wikitext
14365 [[Category:MediaWiki User's Guide|Foo]]
14366 !! html
14367 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14368 !! end
14369
14370 !! test
14371 Category with identical sort key
14372 !! options
14373 cat
14374 !! wikitext
14375 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14376 !! html
14377 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14378 !! end
14379
14380 !! test
14381 Category with empty sort key
14382 !! options
14383 cat
14384 pst
14385 !! wikitext
14386 [[Category:MediaWiki User's Guide|]]
14387 !! html/php
14388 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14389 !! end
14390
14391 !! test
14392 Category with empty sort key and parentheses
14393 !! options
14394 cat
14395 pst
14396 !! wikitext
14397 [[Category:Foo (bar)|]]
14398 !! html/php
14399 [[Category:Foo (bar)|Foo]]
14400 !! end
14401
14402 ## We used to, but no longer wt2wt this test since the default serializer
14403 ## will normalize all categories to serialize on their own line.
14404 ## This wikitext usage is going to be fairly uncommon in production and
14405 ## selser will take care of preserving formatting in those scenarios.
14406 !! test
14407 Category with link tail
14408 !! options
14409 cat
14410 pst
14411 parsoid=wt2html
14412 !! wikitext
14413 123[[Category:Foo]]456
14414 !! html/php
14415 123[[Category:Foo]]456
14416 !! html/parsoid
14417 <p>123<link rel="mw:PageProp/Category" href="Category:Foo"/>456</p>
14418 !! end
14419
14420 !! test
14421 Category with template
14422 !! options
14423 cat
14424 pst
14425 !! wikitext
14426 [[Category:{{echo|Foo}}]]
14427 !! html/php
14428 [[Category:{{echo|Foo}}]]
14429 !! end
14430
14431 !! test
14432 Category with template in sort key
14433 !! options
14434 cat
14435 pst
14436 !! wikitext
14437 [[Category:Foo|{{echo|Bar}}]]
14438 !! html/php
14439 [[Category:Foo|{{echo|Bar}}]]
14440 !! end
14441
14442 !! test
14443 Category with template in sort key and title
14444 !! options
14445 cat
14446 pst
14447 !! wikitext
14448 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14449 !! html/php
14450 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14451 !! end
14452
14453 ## We used to, but no longer wt2wt this test since the default serializer
14454 ## will normalize all categories to serialize on their own line.
14455 ## This wikitext usage is going to be fairly uncommon in production and
14456 ## selser will take care of preserving formatting in those scenarios.
14457 !! test
14458 Category / paragraph interactions
14459 !! options
14460 parsoid=wt2html
14461 !! wikitext
14462 Foo [[Category:Baz]] Bar
14463
14464 Foo [[Category:Baz]]
14465 Bar
14466
14467 Foo
14468 [[Category:Baz]]
14469 Bar
14470
14471 Foo
14472 [[Category:Baz]] Bar
14473
14474 Foo
14475 [[Category:Baz]]
14476 [[Category:Baz]]
14477 [[Category:Baz]]
14478 Bar
14479
14480 [[Category:Baz]]
14481 [[Category:Baz]]
14482 [[Category:Baz]]
14483
14484 [[Category:Baz]]
14485 {{echo|[[Category:Baz]]}}
14486 [[Category:Baz]]
14487 !! html/php
14488 <p>Foo Bar
14489 </p><p>Foo
14490 Bar
14491 </p><p>Foo
14492 Bar
14493 </p><p>Foo Bar
14494 </p><p>Foo
14495 Bar
14496 </p>
14497 !! html/parsoid
14498 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14499 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14500 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14501 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14502 <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>
14503 <link rel="mw:PageProp/Category" href="Category:Baz"/>
14504 !! end
14505
14506 ## We used to, but no longer wt2wt this test since the default serializer
14507 ## will normalize all categories to serialize on their own line.
14508 ## This wikitext usage is going to be fairly uncommon in production and
14509 ## selser will take care of preserving formatting in those scenarios.
14510 ##
14511 ## The whitespace on the empty line is part of the test. Please do not delete
14512 !! test
14513 1. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14514 !! options
14515 parsoid=wt2html
14516 !! wikitext
14517 This
14518
14519 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
14520
14521 {{echo|[[Category:Foo]] and so should this!}}
14522 !! html/php
14523 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
14524 </p>
14525 !! html/parsoid
14526 <p>This
14527
14528 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
14529
14530 <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>
14531 !! end
14532
14533 ## Parsoid will not try to wt2wt this while preserving newlines because
14534 ## it suppresses excess newlines within list items -- and we don't want to
14535 ## introduce a special case just for categories, which is, in reality somewhat
14536 ## odd behavior -- categories are unlikely to be used in list items like this
14537 ## in top-level pages and are only likely to show up in template-generated
14538 ## list items where this RT-ing is a non-issue.
14539 ##
14540 ## The whitespace on the empty line is part of the test. Please do not delete
14541 !! test
14542 2. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14543 !! options
14544 parsoid=wt2html
14545 !! wikitext
14546 * This
14547
14548 [[Category:Foo]] and this should be part of the same list item
14549 * So should this
14550
14551 {{echo|[[Category:Foo]] and this should be part of the same list item}}
14552 !! html
14553 <ul><li>This and this should be part of the same list item</li>
14554 <li>So should this and this should be part of the same list item</li></ul>
14555 !! html/parsoid
14556 <ul>
14557 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
14558 <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>
14559 </ul>
14560 !! end
14561
14562 ## Newlines and categories that follow the last item of a list
14563 ## are treated differently because this (list followed by categories)
14564 ## is an extremely common pattern on wikis.
14565 !! test
14566 3. Categories and newlines: newline suppression for last list item should RT properly
14567 !! wikitext
14568 * a
14569 * b
14570
14571 [[Category:Foo]]
14572
14573 [[Category:Bar]]
14574 [[Category:Baz]]
14575 !! html/parsoid
14576 <ul><li> a</li>
14577 <li> b</li></ul>
14578
14579 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14580
14581 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14582 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14583 !! end
14584
14585 !! test
14586 4. Categories and newlines: newline suppression for last list item should RT properly
14587 !! wikitext
14588 * a
14589 **** b
14590
14591 [[Category:Foo]]
14592 !! html/parsoid
14593 <ul><li> a
14594 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
14595
14596 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14597 !! end
14598
14599 ## only wt2html for this to make sure the algo only applies to the rightmost path
14600 !! test
14601 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
14602 !! options
14603 parsoid=wt2html
14604 !! wikitext
14605 * a
14606 ** b
14607 [[Category:Foo]]
14608 * c
14609 ** d
14610 [[Category:Foo]]
14611 !! html/parsoid
14612 <ul><li> a
14613 <ul><li> b
14614 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
14615 <li> c
14616 <ul><li> d</li></ul></li></ul>
14617 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14618 !! end
14619
14620 ## We used to, but no longer wt2wt this test since the default serializer
14621 ## will normalize all categories to serialize on their own line.
14622 ## This wikitext usage is going to be fairly uncommon in production and
14623 ## selser will take care of preserving formatting in those scenarios.
14624 !! test
14625 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
14626 !! options
14627 parsoid=wt2html
14628 !! wikitext
14629 * a [[Category:Foo]]
14630 !! html/parsoid
14631 <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>
14632 !! end
14633
14634 # This test also demonstrates because of newline+category tunneling
14635 # through the list hander, template wrapping doesn't expand to the
14636 # containing list when the list item swallows the category.
14637 !! test
14638 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
14639 !! wikitext
14640 * {{echo|a
14641 [[Category:Foo]]}}
14642 !! html/parsoid
14643 <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
14644 </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>
14645 !! end
14646
14647 !! test
14648 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
14649 !! wikitext
14650 * a
14651
14652 {{echo|[[Category:Foo]]
14653 [[Category:Bar]]}}
14654 [[Category:Baz]]
14655 !! html/parsoid
14656 <ul><li> a</li></ul>
14657
14658 <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">
14659 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14660 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14661 !! end
14662
14663 !! test
14664 Parsoid: Serialize link to category page with colon escape
14665 !! options
14666 parsoid
14667 !! wikitext
14668
14669 [[:Category:Foo]]
14670 [[:Category:Foo|Bar]]
14671 !! html
14672 <p>
14673 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
14674 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
14675 </p>
14676 !! end
14677
14678 # We used to, but no longer wt2wt this test since the default serializer
14679 # will normalize all categories to serialize on their own line.
14680 # This wikitext usage is going to be fairly uncommon in production and
14681 # selser will take care of preventing whitespace insertion if this
14682 # occurs in an article.
14683 #
14684 # html2html disabled for the same reason (whitespace insertion between
14685 # x and y).
14686 #
14687 # html2wt disabled because it localizes the "Category" namespace.
14688 !! test
14689 Link prefix/suffixes aren't applied to category links
14690 !! options
14691 parsoid=wt2html
14692 language=is
14693 !! wikitext
14694 x[[Category:Foo]]y
14695 !! html/php
14696 <p>xy
14697 </p>
14698 !! html/parsoid
14699 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
14700 !! end
14701
14702 !! test
14703 Parsoid: Serialize link to file page with colon escape
14704 !! options
14705 parsoid
14706 !! wikitext
14707
14708 [[:File:Foo.png]]
14709 [[:File:Foo.png|Bar]]
14710 !! html
14711 <p>
14712 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
14713 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
14714 </p>
14715 !! end
14716
14717 !! test
14718 Parsoid: Serialize a genuine category link without colon escape
14719 !! options
14720 parsoid
14721 !! wikitext
14722 [[Category:Foo]]
14723 [[Category:Foo|Bar]]
14724 !! html
14725 <link rel="mw:PageProp/Category" href="./Category:Foo">
14726 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
14727 !! end
14728
14729 !! test
14730 Normalize hrefs properly before testing for invalid link targets (bug 70894)
14731 !! options
14732 parsoid=html2wt
14733 !! html/parsoid
14734 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
14735 !! wikitext
14736 [[Category:Toxine bactérienne]]
14737 !! end
14738
14739 !! test
14740 Parsoid: Defaultsort
14741 !! wikitext
14742 {{DEFAULTSORT:Foo}}
14743 !! html/parsoid
14744 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
14745 !! end
14746
14747 !! test
14748 Parsoid: Defaultsort (template-generated)
14749 !! wikitext
14750 {{{{echo|DEFAULTSORT}}:Foo}}
14751 !! html/parsoid
14752 <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}}]}'/>
14753 !! end
14754
14755 ###
14756 ### Inter-language links
14757 ###
14758 !! test
14759 Interlanguage links
14760 !! options
14761 ill
14762 !! wikitext
14763 [[es:Alimento]]
14764 [[fr:Nourriture]]
14765 [[zh:食品]]
14766 !! html/php
14767 es:Alimento fr:Nourriture zh:食品
14768 !! html/parsoid
14769 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
14770 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
14771 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
14772 !! end
14773
14774 !! test
14775 Duplicate interlanguage links (bug 24502)
14776 !! options
14777 ill
14778 !! wikitext
14779 [[es:1]]
14780 [[es:2]]
14781 [[fr:1]]
14782 [[fr:2]]
14783 !! html/php
14784 es:1 fr:1
14785 !! html/parsoid
14786 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
14787 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
14788 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
14789 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
14790 !! end
14791
14792 ###
14793 ### Sections
14794 ###
14795 !! test
14796 Basic section headings
14797 !! wikitext
14798 == Headline 1 ==
14799 Some text
14800
14801 ==Headline 2==
14802 More
14803 ===Smaller headline===
14804 Blah blah
14805 !! html
14806 <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>
14807 <p>Some text
14808 </p>
14809 <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>
14810 <p>More
14811 </p>
14812 <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>
14813 <p>Blah blah
14814 </p>
14815 !! end
14816
14817 !! test
14818 Section headings with TOC
14819 !! wikitext
14820 == Headline 1 ==
14821 === Subheadline 1 ===
14822 ===== Skipping a level =====
14823 ====== Skipping a level ======
14824
14825 == Headline 2 ==
14826 Some text
14827 ===Another headline===
14828 !! html
14829 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14830 <ul>
14831 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
14832 <ul>
14833 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
14834 <ul>
14835 <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>
14836 <ul>
14837 <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>
14838 </ul>
14839 </li>
14840 </ul>
14841 </li>
14842 </ul>
14843 </li>
14844 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
14845 <ul>
14846 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
14847 </ul>
14848 </li>
14849 </ul>
14850 </div>
14851
14852 <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>
14853 <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>
14854 <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>
14855 <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>
14856 <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>
14857 <p>Some text
14858 </p>
14859 <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>
14860
14861 !! end
14862
14863 !! test
14864 TOC anchors don't collide
14865 !! wikitext
14866 __FORCETOC__
14867 == Headline 2 ==
14868 == Headline ==
14869 == Headline 2 ==
14870 == Headline ==
14871 !! html/php
14872 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14873 <ul>
14874 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
14875 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
14876 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
14877 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
14878 </ul>
14879 </div>
14880
14881 <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>
14882 <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>
14883 <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>
14884 <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>
14885
14886 !! end
14887
14888 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
14889 !! test
14890 Handling of sections up to level 6 and beyond
14891 !! wikitext
14892 = Level 1 Heading=
14893 == Level 2 Heading==
14894 === Level 3 Heading===
14895 ==== Level 4 Heading====
14896 ===== Level 5 Heading=====
14897 ====== Level 6 Heading======
14898 ======= Level 7 Heading=======
14899 ======== Level 8 Heading========
14900 ========= Level 9 Heading=========
14901 ========== Level 10 Heading==========
14902 !! html
14903 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14904 <ul>
14905 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
14906 <ul>
14907 <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>
14908 <ul>
14909 <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>
14910 <ul>
14911 <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>
14912 <ul>
14913 <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>
14914 <ul>
14915 <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>
14916 <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>
14917 <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>
14918 <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>
14919 <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>
14920 </ul>
14921 </li>
14922 </ul>
14923 </li>
14924 </ul>
14925 </li>
14926 </ul>
14927 </li>
14928 </ul>
14929 </li>
14930 </ul>
14931 </div>
14932
14933 <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>
14934 <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>
14935 <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>
14936 <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>
14937 <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>
14938 <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>
14939 <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>
14940 <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>
14941 <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>
14942 <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>
14943
14944 !! end
14945
14946 !! test
14947 TOC regression (T11764)
14948 !! wikitext
14949 == title 1 ==
14950 === title 1.1 ===
14951 ==== title 1.1.1 ====
14952 === title 1.2 ===
14953 == title 2 ==
14954 === title 2.1 ===
14955 !! html
14956 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14957 <ul>
14958 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14959 <ul>
14960 <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>
14961 <ul>
14962 <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>
14963 </ul>
14964 </li>
14965 <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>
14966 </ul>
14967 </li>
14968 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
14969 <ul>
14970 <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>
14971 </ul>
14972 </li>
14973 </ul>
14974 </div>
14975
14976 <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>
14977 <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>
14978 <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>
14979 <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>
14980 <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>
14981 <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>
14982
14983 !! end
14984
14985 !! test
14986 TOC for heading containing <span id="..."></span> (T96153)
14987 !! wikitext
14988 __FORCETOC__
14989 ==<span id="old-anchor"></span>New title==
14990 !! html/php
14991 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14992 <ul>
14993 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
14994 </ul>
14995 </div>
14996
14997 <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>
14998
14999 !! end
15000
15001 !! test
15002 TOC with wgMaxTocLevel=3 (bug 6204)
15003 !! options
15004 wgMaxTocLevel=3
15005 !! wikitext
15006 == title 1 ==
15007 === title 1.1 ===
15008 ==== title 1.1.1 ====
15009 === title 1.2 ===
15010 == title 2 ==
15011 === title 2.1 ===
15012 !! html
15013 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15014 <ul>
15015 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15016 <ul>
15017 <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>
15018 <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>
15019 </ul>
15020 </li>
15021 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15022 <ul>
15023 <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>
15024 </ul>
15025 </li>
15026 </ul>
15027 </div>
15028
15029 <h2><span class="mw-headline" id="title_1">title 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15030 <h3><span class="mw-headline" id="title_1.1">title 1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
15031 <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>
15032 <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>
15033 <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>
15034 <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>
15035
15036 !! end
15037
15038 !! test
15039 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
15040 !! options
15041 wgMaxTocLevel=3
15042 !! wikitext
15043 ==Section 1==
15044 ===Section 1.1===
15045 ====Section 1.1.1====
15046 ====Section 1.1.1.1====
15047 ==Section 2==
15048 !! html
15049 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15050 <ul>
15051 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
15052 <ul>
15053 <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>
15054 </ul>
15055 </li>
15056 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
15057 </ul>
15058 </div>
15059
15060 <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>
15061 <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>
15062 <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>
15063 <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>
15064 <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>
15065
15066 !! end
15067
15068
15069 !! test
15070 Resolving duplicate section names
15071 !! wikitext
15072 == Foo bar ==
15073 == Foo bar ==
15074 !! html
15075 <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>
15076 <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>
15077
15078 !! end
15079
15080 !! test
15081 Resolving duplicate section names with differing case (bug 10721)
15082 !! wikitext
15083 == Foo bar ==
15084 == Foo Bar ==
15085 !! html
15086 <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>
15087 <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>
15088
15089 !! end
15090
15091 !! article
15092 Template:sections
15093 !! text
15094 ===Section 1===
15095 ==Section 2==
15096 !! endarticle
15097
15098 !! test
15099 Template with sections, __NOTOC__
15100 !! wikitext
15101 __NOTOC__
15102 ==Section 0==
15103 {{sections}}
15104 ==Section 4==
15105 !! html
15106 <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>
15107 <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>
15108 <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>
15109 <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>
15110
15111 !! end
15112
15113 !! test
15114 __NOEDITSECTION__ keyword
15115 !! wikitext
15116 __NOEDITSECTION__
15117 ==Section 1==
15118 ==Section 2==
15119 !! html
15120 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
15121 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
15122
15123 !! end
15124
15125 !! test
15126 Link inside a section heading
15127 !! wikitext
15128 ==Section with a [[Main Page|link]] in it==
15129 !! html
15130 <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>
15131
15132 !! end
15133
15134 !! test
15135 TOC regression (T14077)
15136 !! wikitext
15137 __TOC__
15138 == title 1 ==
15139 === title 1.1 ===
15140 == title 2 ==
15141 !! html
15142 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15143 <ul>
15144 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15145 <ul>
15146 <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>
15147 </ul>
15148 </li>
15149 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
15150 </ul>
15151 </div>
15152
15153 <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>
15154 <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>
15155 <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>
15156
15157 !! end
15158
15159 !! test
15160 BUG 1219 URL next to image (good)
15161 !! wikitext
15162 http://example.com [[File:Foobar.jpg]]
15163 !! html/php
15164 <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>
15165 </p>
15166 !! html/parsoid
15167 <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>
15168 !!end
15169
15170 !! test
15171 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
15172 !! wikitext
15173 ===
15174 The line above must have a trailing space!
15175 === <!--
15176 --> <!-- -->
15177 But just in case it doesn't...
15178 !! html
15179 <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>
15180 <p>The line above must have a trailing space!
15181 </p>
15182 <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>
15183 <p>But just in case it doesn't...
15184 </p>
15185 !! end
15186
15187 !! test
15188 Header with special characters (bug 25462)
15189 !! wikitext
15190 The tooltips shall not show entities to the user (ie. be double escaped)
15191
15192 == text > text ==
15193 section 1
15194
15195 == text < text ==
15196 section 2
15197
15198 == text & text ==
15199 section 3
15200
15201 == text ' text ==
15202 section 4
15203
15204 == text " text ==
15205 section 5
15206 !! html
15207 <p>The tooltips shall not show entities to the user (ie. be double escaped)
15208 </p>
15209 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15210 <ul>
15211 <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>
15212 <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>
15213 <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>
15214 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
15215 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
15216 </ul>
15217 </div>
15218
15219 <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>
15220 <p>section 1
15221 </p>
15222 <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>
15223 <p>section 2
15224 </p>
15225 <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>
15226 <p>section 3
15227 </p>
15228 <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>
15229 <p>section 4
15230 </p>
15231 <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>
15232 <p>section 5
15233 </p>
15234 !! end
15235
15236 !! test
15237 Header with space, plus and underscore as entity
15238 !! wikitext
15239 Id should not contain + for spaces
15240
15241 == Space between Text ==
15242 section 1
15243
15244 == Space-Entity&#32;between&#32;Text ==
15245 section 2
15246
15247 == Plus+between+Text ==
15248 section 3
15249
15250 == Plus-Entity&#43;between&#43;Text ==
15251 section 4
15252
15253 == Underscore_between_Text ==
15254 section 5
15255
15256 == Underscore-Entity&#95;between&#95;Text ==
15257 section 6
15258
15259 [[#Space between Text]]
15260 [[#Space-Entity&#32;between&#32;Text]]
15261 [[#Plus+between+Text]]
15262 [[#Plus-Entity&#43;between&#43;Text]]
15263 [[#Underscore_between_Text]]
15264 [[#Underscore-Entity&#95;between&#95;Text]]
15265 !! html
15266 <p>Id should not contain + for spaces
15267 </p>
15268 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15269 <ul>
15270 <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>
15271 <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>
15272 <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>
15273 <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>
15274 <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>
15275 <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>
15276 </ul>
15277 </div>
15278
15279 <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>
15280 <p>section 1
15281 </p>
15282 <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>
15283 <p>section 2
15284 </p>
15285 <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>
15286 <p>section 3
15287 </p>
15288 <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>
15289 <p>section 4
15290 </p>
15291 <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>
15292 <p>section 5
15293 </p>
15294 <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>
15295 <p>section 6
15296 </p><p><a href="#Space_between_Text">#Space between Text</a>
15297 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
15298 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
15299 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
15300 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
15301 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
15302 </p>
15303 !! end
15304
15305 !! test
15306 Headers with excess '=' characters
15307 (Are similar tests necessary beyond the 1st level?)
15308 !! wikitext
15309 =foo==
15310 ==foo=
15311 =''italic'' heading==
15312 ==''italic'' heading=
15313 !! html
15314 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15315 <ul>
15316 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
15317 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
15318 <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>
15319 <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>
15320 </ul>
15321 </div>
15322
15323 <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>
15324 <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>
15325 <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>
15326 <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>
15327
15328 !! end
15329
15330 !! test
15331 HTML headers vs TOC (bug 23393)
15332 (__NOEDITSECTION__ for clearer output, doesn't matter here)
15333 !! wikitext
15334 <h1>Header 1</h1>
15335 == Header 1.1 ==
15336 == Header 1.2 ==
15337
15338 <h1>Header 2
15339 </h1>
15340 == Header 2.1 ==
15341 == Header 2.2 ==
15342 __NOEDITSECTION__
15343 !! html
15344 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15345 <ul>
15346 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
15347 <ul>
15348 <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>
15349 <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>
15350 </ul>
15351 </li>
15352 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
15353 <ul>
15354 <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>
15355 <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>
15356 </ul>
15357 </li>
15358 </ul>
15359 </div>
15360
15361 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
15362 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
15363 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
15364 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
15365 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
15366 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
15367
15368 !! end
15369
15370 !! test
15371 Single-line or multiline-comments can follow headings
15372 !! options
15373 parsoid=wt2html,wt2wt
15374 !! wikitext
15375 ==foo==<!---->
15376 ==bar==<!--c1-->
15377 ==baz==<!--
15378 c2
15379 c3-->
15380 !! html
15381 <h2><span class="mw-headline" id="foo">foo</span></h2>
15382 <h2><span class="mw-headline" id="bar">bar</span></h2>
15383 <h2><span class="mw-headline" id="baz">baz</span></h2>
15384
15385 !! end
15386
15387 !! test
15388 BUG 1219 URL next to image (broken)
15389 !! wikitext
15390 http://example.com[[File:Foobar.jpg]]
15391 !! html/php
15392 <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>
15393 </p>
15394 !! html/parsoid
15395 <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>
15396 !!end
15397
15398 !! test
15399 Bug 1186 news: in the middle of text
15400 !! wikitext
15401 http://en.wikinews.org/wiki/Wikinews:Workplace
15402 !! html
15403 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
15404 </p>
15405 !!end
15406
15407
15408 !! test
15409 Namespaced link must have a title
15410 !! wikitext
15411 [[Project:]]
15412 !! html
15413 <p>[[Project:]]
15414 </p>
15415 !!end
15416
15417 !! test
15418 Namespaced link must have a title (bad fragment version)
15419 !! wikitext
15420 [[Project:#fragment]]
15421 !! html
15422 <p>[[Project:#fragment]]
15423 </p>
15424 !!end
15425
15426
15427 ###
15428 ### HTML tags and HTML attributes
15429 ###
15430
15431 !! test
15432 div with no attributes
15433 !! wikitext
15434 <div>HTML rocks</div>
15435 !! html
15436 <div>HTML rocks</div>
15437
15438 !! end
15439
15440 !! test
15441 div with double-quoted attribute
15442 !! wikitext
15443 <div id="rock">HTML rocks</div>
15444 !! html
15445 <div id="rock">HTML rocks</div>
15446
15447 !! end
15448
15449 !! test
15450 div with single-quoted attribute
15451 !! wikitext
15452 <div id='rock'>HTML rocks</div>
15453 !! html
15454 <div id="rock">HTML rocks</div>
15455
15456 !! end
15457
15458 !! test
15459 div with unquoted attribute
15460 !! wikitext
15461 <div id=rock>HTML rocks</div>
15462 !! html
15463 <div id="rock">HTML rocks</div>
15464
15465 !! end
15466
15467 !! test
15468 div with illegal double attributes
15469 !! wikitext
15470 <div id="a" id="b">HTML rocks</div>
15471 !! html
15472 <div id="b">HTML rocks</div>
15473
15474 !!end
15475
15476 !! test
15477 div with empty attribute value, space before equals
15478 !! options
15479 parsoid=wt2html,html2html
15480 !! wikitext
15481 <div class =>HTML rocks</div>
15482 !! html/php
15483 <div class="">HTML rocks</div>
15484
15485 !! html/parsoid
15486 <div class="" data-parsoid='{"stx":"html"}'>HTML rocks</div>
15487 !! end
15488
15489 !! test
15490 div with multiple empty attribute values
15491 !! options
15492 parsoid=wt2html,html2html
15493 !! wikitext
15494 <div id= title=>HTML rocks</div>
15495 !! html/php
15496 <div id="title.3D">HTML rocks</div>
15497
15498 !! html/parsoid
15499 <div id="title=" data-parsoid='{"stx":"html"}'>HTML rocks</div>
15500 !! end
15501
15502 !! test
15503 table with multiple empty attribute values
15504 !! options
15505 parsoid=wt2html,html2html
15506 !! wikitext
15507 {| title= id=
15508 | hi
15509 |}
15510 !! html/php
15511 <table title="id=">
15512 <tr>
15513 <td> hi
15514 </td></tr></table>
15515
15516 !! html/parsoid
15517 <table title="id=">
15518 <tbody><tr><td> hi</td></tr>
15519 </tbody></table>
15520 !! end
15521
15522 !! test
15523 div with braces in attribute value
15524 !! wikitext
15525 <div title="{}">Foo</div>
15526 !! html/php
15527 <div title="&#123;}">Foo</div>
15528
15529 !! html/parsoid
15530 <div title="{}">Foo</div>
15531 !! end
15532
15533 !! test
15534 div with empty attribute value, no space before equals
15535 !! options
15536 parsoid=wt2html,html2html
15537 !! wikitext
15538 <div class=>HTML rocks</div>
15539 !! html/php
15540 <div class="">HTML rocks</div>
15541
15542 !! html/parsoid
15543 <div class="">HTML rocks</div>
15544 !! end
15545
15546 !! test
15547 HTML multiple attributes correction
15548 !! wikitext
15549 <p class="error" class="awesome">Awesome!</p>
15550 !! html
15551 <p class="awesome">Awesome!</p>
15552
15553 !!end
15554
15555 !! test
15556 Table multiple attributes correction
15557 !! wikitext
15558 {|
15559 !+ class="error" class="awesome"| status
15560 |}
15561 !! html
15562 <table>
15563 <tr>
15564 <th class="awesome"> status
15565 </th></tr></table>
15566
15567 !!end
15568
15569 !! test
15570 DIV IN UPPERCASE
15571 !! wikitext
15572 <DIV ID="x">HTML ROCKS</DIV>
15573 !! html
15574 <div id="x">HTML ROCKS</div>
15575
15576 !!end
15577
15578 !! test
15579 Non-ASCII pseudo-tags are rendered as text
15580 !! wikitext
15581 <khyô>
15582 !! html
15583 <p>&lt;khyô&gt;
15584 </p>
15585 !! end
15586
15587 !! test
15588 Pseudo-tag with URL 'name' renders as url link
15589 !! wikitext
15590 <http://example.com/>
15591 !! html
15592 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
15593 </p>
15594 !! end
15595
15596 !! test
15597 text with amp in the middle of nowhere
15598 !! wikitext
15599 Remember AT&T?
15600 !! html
15601 <p>Remember AT&amp;T?
15602 </p>
15603 !! end
15604
15605 !! test
15606 text with character entity: eacute
15607 !! wikitext
15608 I always thought &eacute; was a cute letter.
15609 !! html
15610 <p>I always thought &#233; was a cute letter.
15611 </p>
15612 !! html+tidy
15613 <p>I always thought é was a cute letter.</p>
15614 !! end
15615
15616 !! test
15617 text with entity-escaped character entity-like string: eacute
15618 !! wikitext
15619 I always thought &amp;eacute; was a cute letter.
15620 !! html
15621 <p>I always thought &amp;eacute; was a cute letter.
15622 </p>
15623 !! end
15624
15625 !! test
15626 text with undefined character entity: xacute
15627 !! wikitext
15628 I always thought &xacute; was a cute letter.
15629 !! html
15630 <p>I always thought &amp;xacute; was a cute letter.
15631 </p>
15632 !! end
15633
15634 !! test
15635 HTML5 tags
15636 !! wikitext
15637 <data value="5">five</data>
15638 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
15639 <mark>This highlighted text</mark>
15640 !! html
15641 <p><data value="5">five</data>
15642 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
15643 <mark>This highlighted text</mark>
15644 </p>
15645 !! end
15646
15647 !! test
15648 HTML tag with leading space is parsed as text
15649 !! wikitext
15650 < div>foo< /div>
15651 !! html
15652 <p>&lt; div&gt;foo&lt; /div&gt;
15653 </p>
15654 !! end
15655
15656 ###
15657 ### Nesting tests (see bug 41545, 50604, 51081)
15658 ###
15659
15660 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
15661 # Note that html2wt is considerably more difficult if we use <b> in
15662 # the test case, instead of <big>
15663 !! test
15664 Ensure that HTML adoption agency algorithm is properly implemented.
15665 !! wikitext
15666 <big>X<big>Y</big>Z</big>
15667 !! html
15668 <p><big>X<big>Y</big>Z</big>
15669 </p>
15670 !! end
15671
15672 # This was bug 41545 in the PHP parser.
15673 # Note that tidy doesn't handle this correctly.
15674 !! test
15675 Nesting of <kbd>
15676 !! wikitext
15677 <kbd>X<kbd>Y</kbd>Z</kbd>
15678 !! html
15679 <p><kbd>X<kbd>Y</kbd>Z</kbd>
15680 </p>
15681 !! end
15682
15683 # The following cases were bug 51081 in the PHP parser.
15684 # Note that there are some other nestable tags (b, i, etc) which are
15685 # not covered; see bug 51081 for discussion.
15686
15687 # Note that tidy doesn't handle this correctly.
15688 !! test
15689 Nesting of <em>
15690 !! wikitext
15691 <em>X<em>Y</em>Z</em>
15692 !! html
15693 <p><em>X<em>Y</em>Z</em>
15694 </p>
15695 !! end
15696
15697 # Note that tidy doesn't handle this correctly.
15698 !! test
15699 Nesting of <strong>
15700 !! wikitext
15701 <strong>X<strong>Y</strong>Z</strong>
15702 !! html
15703 <p><strong>X<strong>Y</strong>Z</strong>
15704 </p>
15705 !! end
15706
15707 !! test
15708 Nesting of <q>
15709 !! wikitext
15710 <q>X<q>Y</q>Z</q>
15711 !! html+tidy
15712 <p><q>X<q>Y</q>Z</q></p>
15713 !! end
15714
15715 # Note that tidy doesn't handle this correctly.
15716 !! test
15717 Nesting of <ruby>
15718 !! wikitext
15719 <ruby>X<ruby>Y</ruby>Z</ruby>
15720 !! html
15721 <p><ruby>X<ruby>Y</ruby>Z</ruby>
15722 </p>
15723 !! end
15724
15725 # Note that tidy doesn't handle this correctly.
15726 !! test
15727 Nesting of <bdo>
15728 !! wikitext
15729 <bdo>X<bdo>Y</bdo>Z</bdo>
15730 !! html
15731 <p><bdo>X<bdo>Y</bdo>Z</bdo>
15732 </p>
15733 !! end
15734
15735
15736 ###
15737 ### Media links
15738 ###
15739
15740 !! test
15741 Media link
15742 !! wikitext
15743 [[Media:Foobar.jpg]]
15744 !! html
15745 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
15746 </p>
15747 !! end
15748
15749 !! test
15750 Media link with text
15751 !! wikitext
15752 [[Media:Foobar.jpg|A neat file to look at]]
15753 !! html
15754 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
15755 </p>
15756 !! end
15757
15758 # FIXME: this is still bad HTML tag nesting
15759 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
15760 !! test
15761 Media link with nasty text
15762 !! wikitext
15763 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
15764 !! html
15765 <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>
15766
15767 !! html+tidy
15768 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
15769 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
15770 !! end
15771
15772 !! test
15773 Media link to nonexistent file (bug 1702)
15774 !! wikitext
15775 [[Media:No such.jpg]]
15776 !! html
15777 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
15778 </p>
15779 !! end
15780
15781 !! test
15782 Image link to nonexistent file (bug 1850 - good)
15783 !! wikitext
15784 [[File:No_such.jpg]]
15785 !! html/php
15786 <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>
15787 </p>
15788 !! html/parsoid
15789 <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>
15790 !! end
15791
15792 !! test
15793 :Image link to nonexistent file (bug 1850 - bad)
15794 !! wikitext
15795 [[:Image:No such.jpg]]
15796 !! html/php
15797 <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>
15798 </p>
15799 !! html/parsoid
15800 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
15801 !! end
15802
15803
15804
15805 !! test
15806 Character reference normalization in link text (bug 1938)
15807 !! wikitext
15808 [[Main Page|this&that]]
15809 !! html
15810 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
15811 </p>
15812 !!end
15813
15814 !! article
15815 אַ
15816 !! text
15817 Test for unicode normalization
15818
15819 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
15820 !! endarticle
15821
15822 !! test
15823 (bug 19451) Links should refer to the normalized form.
15824 !! wikitext
15825 [[&#xFB2E;]]
15826 [[&#x5d0;&#x5b7;]]
15827 [[&#x5d0;ַ]]
15828 [[א&#x5b7;]]
15829 [[אַ]]
15830 !! html
15831 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
15832 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
15833 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
15834 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
15835 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
15836 </p>
15837 !! end
15838
15839 !! test
15840 Empty attribute crash test (bug 2067)
15841 !! wikitext
15842 <font color="">foo</font>
15843 !! html
15844 <p><font color="">foo</font>
15845 </p>
15846 !! end
15847
15848 !! test
15849 Empty attribute crash test single-quotes (bug 2067)
15850 !! wikitext
15851 <font color=''>foo</font>
15852 !! html
15853 <p><font color="">foo</font>
15854 </p>
15855 !! end
15856
15857 !! test
15858 Attribute test: equals, then nothing
15859 !! options
15860 parsoid=wt2html,html2html
15861 !! wikitext
15862 <font color=>foo</font>
15863 !! html/php
15864 <p><font color="">foo</font>
15865 </p>
15866 !! html/parsoid
15867 <p><font color="" data-parsoid='{"stx":"html"}'>foo</font></p>
15868 !! end
15869
15870 !! test
15871 Attribute test: unquoted value
15872 !! options
15873 parsoid=wt2html,html2html
15874 !! wikitext
15875 <font color=x>foo</font>
15876 !! html/php
15877 <p><font color="x">foo</font>
15878 </p>
15879 !! html/parsoid
15880 <p><font color="x" data-parsoid='{"stx":"html"}'>foo</font></p>
15881 !! end
15882
15883 !! test
15884 Attribute test: unquoted but illegal value (hash)
15885 !! wikitext
15886 <font color=#x>foo</font>
15887 !! html
15888 <p><font color="#x">foo</font>
15889 </p>
15890 !! end
15891
15892 # Parsoid does not serialize to empty attribute syntax,
15893 # so wt2wt and html2wt cases are skipped
15894 !! test
15895 Attribute test: no value (T54330)
15896 !! options
15897 parsoid=wt2html,html2html
15898 !! wikitext
15899 <font color>foo</font>
15900 !! html/php
15901 <p><font color="">foo</font>
15902 </p>
15903 !! html/parsoid
15904 <p><font color="">foo</font></p>
15905 !! end
15906
15907 !! test
15908 Bug 2095: link with three closing brackets
15909 !! wikitext
15910 [[Main Page]]]
15911 !! html/php
15912 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
15913 </p>
15914 !! html/parsoid
15915 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
15916 !! end
15917
15918 !! test
15919 Bug 2095: link with pipe and three closing brackets
15920 !! wikitext
15921 [[Main Page|link]]]
15922 !! html/php
15923 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
15924 </p>
15925 !! html/parsoid
15926 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
15927 !! end
15928
15929 !! test
15930 Bug 2095: link with pipe and three closing brackets, version 2
15931 !! wikitext
15932 [[Main Page|[http://example.com/]]]
15933 !! html/php
15934 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
15935 </p>
15936 !! html/parsoid
15937 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
15938 !! end
15939
15940
15941 ###
15942 ### Safety
15943 ###
15944
15945 !! article
15946 Template:Dangerous attribute
15947 !! text
15948 " onmouseover="alert(document.cookie)
15949 !! endarticle
15950
15951 !! article
15952 Template:Dangerous style attribute
15953 !! text
15954 border-size: expression(alert(document.cookie))
15955 !! endarticle
15956
15957 !! article
15958 Template:Div style
15959 !! text
15960 <div style="float: right; {{{1}}}">Magic div</div>
15961 !! endarticle
15962
15963 !! test
15964 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
15965 !! wikitext
15966 <div title="{{test}}"></div>
15967 !! html
15968 <div title="This is a test template"></div>
15969
15970 !! end
15971
15972 # Parsoid has enough context to handle this case
15973 !! test
15974 Bug 2304: HTML attribute safety (dangerous template; 2309)
15975 !! wikitext
15976 <div title="{{dangerous attribute}}"></div>
15977 !! html/php
15978 <div title=""></div>
15979
15980 !! html/parsoid
15981 <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>
15982 !! end
15983
15984 !! test
15985 Bug 2304: HTML attribute safety (dangerous style template; 2309)
15986 !! wikitext
15987 <div style="{{dangerous style attribute}}"></div>
15988 !! html
15989 <div style="/* insecure input */"></div>
15990
15991 !! end
15992
15993 !! test
15994 Bug 2304: HTML attribute safety (safe parameter; 2309)
15995 !! wikitext
15996 {{div style|width: 200px}}
15997 !! html
15998 <div style="float: right; width: 200px">Magic div</div>
15999
16000 !! end
16001
16002 !! test
16003 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
16004 !! wikitext
16005 {{div style|width: expression(alert(document.cookie))}}
16006 !! html
16007 <div style="/* insecure input */">Magic div</div>
16008
16009 !! end
16010
16011 !! test
16012 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
16013 !! wikitext
16014 {{div style|"><script>alert(document.cookie)</script>}}
16015 !! html
16016 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16017
16018 !! end
16019
16020 !! test
16021 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
16022 !! wikitext
16023 {{div style|" ><script>alert(document.cookie)</script>}}
16024 !! html
16025 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16026
16027 !! end
16028
16029 !! test
16030 Bug 2304: HTML attribute safety (link)
16031 !! wikitext
16032 <div title="[[Main Page]]"></div>
16033 !! html
16034 <div title="&#91;&#91;Main Page]]"></div>
16035
16036 !! end
16037
16038 !! test
16039 Bug 2304: HTML attribute safety (italics)
16040 !! wikitext
16041 <div title="''foobar''"></div>
16042 !! html
16043 <div title="&#39;&#39;foobar&#39;&#39;"></div>
16044
16045 !! end
16046
16047 !! test
16048 Bug 2304: HTML attribute safety (bold)
16049 !! wikitext
16050 <div title="'''foobar'''"></div>
16051 !! html
16052 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
16053
16054 !! end
16055
16056
16057 !! test
16058 Bug 2304: HTML attribute safety (ISBN)
16059 !! wikitext
16060 <div title="ISBN 1234567890"></div>
16061 !! html
16062 <div title="&#73;SBN 1234567890"></div>
16063
16064 !! end
16065
16066 !! test
16067 Bug 2304: HTML attribute safety (RFC)
16068 !! wikitext
16069 <div title="RFC 1234"></div>
16070 !! html
16071 <div title="&#82;FC 1234"></div>
16072
16073 !! end
16074
16075 !! test
16076 Bug 2304: HTML attribute safety (PMID)
16077 !! wikitext
16078 <div title="PMID 1234567890"></div>
16079 !! html
16080 <div title="&#80;MID 1234567890"></div>
16081
16082 !! end
16083
16084 !! test
16085 Bug 2304: HTML attribute safety (web link)
16086 !! wikitext
16087 <div title="http://example.com/"></div>
16088 !! html
16089 <div title="http&#58;//example.com/"></div>
16090
16091 !! end
16092
16093 !! test
16094 Bug 2304: HTML attribute safety (named web link)
16095 !! wikitext
16096 <div title="[http://example.com/ link]"></div>
16097 !! html
16098 <div title="&#91;http&#58;//example.com/ link]"></div>
16099
16100 !! end
16101
16102 !! test
16103 Bug 3244: HTML attribute safety (extension; safe)
16104 !! wikitext
16105 <div style="<nowiki>background:blue</nowiki>"></div>
16106 !! html
16107 <div style="background:blue"></div>
16108
16109 !! end
16110
16111 !! test
16112 Bug 3244: HTML attribute safety (extension; unsafe)
16113 !! wikitext
16114 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
16115 !! html
16116 <div style="/* insecure input */"></div>
16117
16118 !! end
16119
16120 # More MSIE fun discovered by Tom Gilder
16121
16122 !! test
16123 MSIE CSS safety test: spurious slash
16124 !! wikitext
16125 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
16126 !! html
16127 <div style="/* insecure input */">evil</div>
16128
16129 !! end
16130
16131 !! test
16132 MSIE CSS safety test: hex code
16133 !! wikitext
16134 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
16135 !! html
16136 <div style="/* insecure input */">evil</div>
16137
16138 !! end
16139
16140 !! test
16141 MSIE CSS safety test: comment in url
16142 !! wikitext
16143 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
16144 !! html
16145 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
16146
16147 !! end
16148
16149 !! test
16150 MSIE CSS safety test: comment in expression
16151 !! wikitext
16152 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
16153 !! html
16154 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
16155
16156 !! end
16157
16158 !! test
16159 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
16160 !! wikitext
16161 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
16162 !! html
16163 <p style="/* invalid control char */">A</p>
16164
16165 !! end
16166
16167 !! test
16168 MSIE 6 CSS safety test: Fullwidth (bug 55332)
16169 !! wikitext
16170 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
16171 <div style="top:EXPRESSION(alert())">B</div>
16172 !! html
16173 <p style="/* insecure input */">A</p>
16174 <div style="/* insecure input */">B</div>
16175
16176 !! end
16177
16178 !! test
16179 MSIE 6 CSS safety test: IPA extensions (bug 55332)
16180 !! wikitext
16181 <div style="background-image:uʀʟ(javascript:alert())">A</div>
16182 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
16183 !! html
16184 <div style="/* insecure input */">A</div>
16185 <p style="/* insecure input */">B</p>
16186
16187 !! end
16188
16189 !! test
16190 MSIE 6 CSS safety test: sup/sub script (bug 55332)
16191 !! wikitext
16192 <div style="background-image:url⁽javascript:alert())">A</div>
16193 <div style="background-image:url₍javascript:alert())">B</div>
16194 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
16195 !! html
16196 <div style="/* insecure input */">A</div>
16197 <div style="/* insecure input */">B</div>
16198 <p style="/* insecure input */">C</p>
16199
16200 !! end
16201
16202 # FIXME: Parsoid fails to sanitize this! See T58846.
16203 !! test
16204 Opera -o-link CSS
16205 !! wikitext
16206 <div
16207 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;"
16208 style="-o-link:attr(title);-o-link-source:current">X</div>
16209 !! html
16210 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
16211
16212 !! end
16213
16214 !! test
16215 MSIE 6 CSS safety test: Repetition markers (bug 55332)
16216 !! wikitext
16217 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
16218 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
16219 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
16220 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
16221 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
16222 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
16223 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
16224 !! html
16225 <p style="/* insecure input */">A</p>
16226 <p style="/* insecure input */">B</p>
16227 <p style="/* insecure input */">C</p>
16228 <p style="/* insecure input */">D</p>
16229 <p style="/* insecure input */">E</p>
16230 <p style="/* insecure input */">F</p>
16231 <p style="/* insecure input */">G</p>
16232
16233 !! end
16234
16235 !! test
16236 Table attribute legitimate extension
16237 !! wikitext
16238 {|
16239 !+ style="<nowiki>color:blue</nowiki>"| status
16240 |}
16241 !! html
16242 <table>
16243 <tr>
16244 <th style="color:blue"> status
16245 </th></tr></table>
16246
16247 !!end
16248
16249 !! test
16250 Table attribute safety
16251 !! wikitext
16252 {|
16253 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
16254 |}
16255 !! html
16256 <table>
16257 <tr>
16258 <th style="/* insecure input */"> status
16259 </th></tr></table>
16260
16261 !! end
16262
16263 !! test
16264 CSS line continuation 1
16265 !! wikitext
16266 <div style="background-image: u\&#10;rl(test.jpg);"></div>
16267 !! html
16268 <div style="/* insecure input */"></div>
16269
16270 !! end
16271
16272 !! test
16273 CSS line continuation 2
16274 !! wikitext
16275 <div style="background-image: u\&#13;rl(test.jpg); "></div>
16276 !! html
16277 <div style="/* invalid control char */"></div>
16278
16279 !! end
16280
16281 !! article
16282 Template:Identity
16283 !! text
16284 {{{1}}}
16285 !! endarticle
16286
16287 !! test
16288 Expansion of multi-line templates in attribute values (bug 6255)
16289 !! wikitext
16290 <div style="background: {{identity|#00FF00}}">-</div>
16291 !! html
16292 <div style="background: #00FF00">-</div>
16293
16294 !! end
16295
16296
16297 !! test
16298 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
16299 !! wikitext
16300 <div style="background:
16301 #00FF00">-</div>
16302 !! html/php
16303 <div style="background: #00FF00">-</div>
16304
16305 !! html/parsoid
16306 <div style="background:
16307 #00FF00">-</div>
16308 !! end
16309
16310 !! test
16311 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
16312 !! wikitext
16313 <div style="background: &#10;#00FF00">-</div>
16314 !! html
16315 <div style="background: &#10;#00FF00">-</div>
16316
16317 !! end
16318
16319 !! test
16320 evil <math>-wiki-tags without Extension:Math enabled
16321 !! wikitext
16322 <math><img src="some evil external link"><script>some_evil_javascript();</script></math>
16323 !! html+tidy
16324 <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>
16325 !! end
16326
16327 ###
16328 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
16329 ###
16330 !! test
16331 Parser hook: empty input
16332 !! wikitext
16333 <tag></tag>
16334 !! html/php
16335 <pre>
16336 ''
16337 array (
16338 )
16339 </pre>
16340
16341 !! html/parsoid
16342 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16343 !! end
16344
16345 ## Don't expect parsoid to rt this form.
16346 !! test
16347 Parser hook: empty input using terminated empty elements
16348 !! options
16349 parsoid=wt2html,html2html
16350 !! wikitext
16351 <tag/>
16352 !! html/php
16353 <pre>
16354 NULL
16355 array (
16356 )
16357 </pre>
16358
16359 !! html/parsoid
16360 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16361 !! end
16362
16363 !! test
16364 Parser hook: empty input using terminated empty elements (space before)
16365 !! wikitext
16366 <tag />
16367 !! html/php
16368 <pre>
16369 NULL
16370 array (
16371 )
16372 </pre>
16373
16374 !! html/parsoid
16375 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16376 !! end
16377
16378 !! test
16379 Parser hook: basic input
16380 !! wikitext
16381 <tag>input</tag>
16382 !! html/php
16383 <pre>
16384 'input'
16385 array (
16386 )
16387 </pre>
16388
16389 !! html/parsoid
16390 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16391 !! end
16392
16393 ## Don't expect parsoid to rt this form.
16394 !! test
16395 Parser hook: case insensitive
16396 !! options
16397 parsoid=wt2html,html2html
16398 !! wikitext
16399 <TAG>input</TAG>
16400 !! html/php
16401 <pre>
16402 'input'
16403 array (
16404 )
16405 </pre>
16406
16407 !! html/parsoid
16408 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16409 !! end
16410
16411 ## Don't expect parsoid to rt this form.
16412 !! test
16413 Parser hook: case insensitive, redux
16414 !! options
16415 parsoid=wt2html,html2html
16416 !! wikitext
16417 <TaG>input</TAg>
16418 !! html/php
16419 <pre>
16420 'input'
16421 array (
16422 )
16423 </pre>
16424
16425 !! html/parsoid
16426 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16427 !! end
16428
16429 !! test
16430 Parser hook: nested tags
16431 !! options
16432 noxml
16433 !! wikitext
16434 <tag><tag></tag></tag>
16435 !! html/php
16436 <pre>
16437 '<tag>'
16438 array (
16439 )
16440 </pre>&lt;/tag&gt;
16441
16442 !! html/parsoid
16443 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}' data-parsoid='{}' about="#mwt2"></pre>&lt;/tag>
16444 !! end
16445
16446 !! test
16447 Parser hook: basic arguments
16448 !! wikitext
16449 <tag width="200" height="100" depth="50" square=""></tag>
16450 !! html/php
16451 <pre>
16452 ''
16453 array (
16454 'width' => '200',
16455 'height' => '100',
16456 'depth' => '50',
16457 'square' => '',
16458 )
16459 </pre>
16460
16461 !! html/parsoid
16462 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16463 !! end
16464
16465 ## Don't expect parsoid to rt this form.
16466 !! test
16467 Parser hook: basic arguments, variations
16468 !! options
16469 parsoid=wt2html,html2html
16470 !! wikitext
16471 <tag width=200 height = "100" depth = '50' square></tag>
16472 !! html/php
16473 <pre>
16474 ''
16475 array (
16476 'width' => '200',
16477 'height' => '100',
16478 'depth' => '50',
16479 'square' => '',
16480 )
16481 </pre>
16482
16483 !! html/parsoid
16484 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16485 !! end
16486
16487 !! test
16488 Parser hook: argument containing a forward slash (bug 5344)
16489 !! wikitext
16490 <tag filename="/tmp/bla"></tag>
16491 !! html/php
16492 <pre>
16493 ''
16494 array (
16495 'filename' => '/tmp/bla',
16496 )
16497 </pre>
16498
16499 !! html/parsoid
16500 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16501 !! end
16502
16503 ## Don't expect parsoid to rt this form.
16504 !! test
16505 Parser hook: empty input using terminated empty elements (bug 2374)
16506 !! options
16507 parsoid=wt2html,html2html
16508 !! wikitext
16509 <tag foo=bar/>text
16510 !! html/php
16511 <pre>
16512 NULL
16513 array (
16514 'foo' => 'bar',
16515 )
16516 </pre>text
16517
16518 !! html/parsoid
16519 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"foo":"bar"},"body":null}' data-parsoid='{}' about="#mwt2"></pre>text
16520 !! end
16521
16522 # </tag> should be output literally since there is no matching tag that begins it
16523 !! test
16524 Parser hook: basic arguments using terminated empty elements (bug 2374)
16525 !! wikitext
16526 <tag width=200 height = "100" depth = '50' square/>
16527 other stuff
16528 </tag>
16529 !! html/php
16530 <pre>
16531 NULL
16532 array (
16533 'width' => '200',
16534 'height' => '100',
16535 'depth' => '50',
16536 'square' => '',
16537 )
16538 </pre>
16539 <p>other stuff
16540 &lt;/tag&gt;
16541 </p>
16542 !! end
16543
16544 ###
16545 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
16546 ###
16547
16548 !! test
16549 Parser hook: static parser hook not inside a comment
16550 !! wikitext
16551 <statictag>hello, world</statictag>
16552
16553 <statictag action="flush" />
16554 !! html/php
16555 <p><br />
16556 hello, world
16557 </p>
16558 !! html/parsoid
16559 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
16560 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt4">hello, world</p>
16561 !! end
16562
16563 !! test
16564 Parser hook: static parser hook inside a comment
16565 !! wikitext
16566 <!-- <statictag>hello, world</statictag> -->
16567 <statictag action="flush" />
16568 !! html/php
16569 <p><br />
16570 </p>
16571 !! html/parsoid
16572 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
16573 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt2"></p>
16574 !! end
16575
16576 # Nested template calls; this case was broken by Parser.php rev 1.506,
16577 # since reverted.
16578
16579 !! article
16580 Template:One-parameter
16581 !! text
16582 (My parameter is: {{{1}}})
16583 !! endarticle
16584
16585 !! article
16586 Template:Map-one-parameter
16587 !! text
16588 {{{{{1}}}|{{{2}}}}}
16589 !! endarticle
16590
16591 !! test
16592 Nested template calls
16593 !! wikitext
16594 {{Map-one-parameter|One-parameter|param}}
16595 !! html
16596 <p>(My parameter is: param)
16597 </p>
16598 !! end
16599
16600
16601 ###
16602 ### Sanitizer
16603 ###
16604
16605 # HTML+Tidy effectively strips out the empty tags completely
16606 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
16607 # which Tidy would have done for the PHP parser had there been content inside it.
16608 !! test
16609 Sanitizer: Closing of open tags
16610 !! wikitext
16611 <s></s><table></table>
16612 !! html
16613 <s></s><table></table>
16614
16615 !! html/parsoid
16616 <p><s></s></p><table></table>
16617 !! end
16618
16619 !! test
16620 Sanitizer: Closing of open but not closed tags
16621 !! wikitext
16622 <s>foo
16623 !! html
16624 <p><s>foo</s>
16625 </p>
16626 !! end
16627
16628 !! test
16629 Sanitizer: Closing of closed but not open tags
16630 !! options
16631 parsoid=wt2html
16632 !! wikitext
16633 </s>
16634 !! html/php+tidy
16635 !! html/parsoid
16636 !! end
16637
16638 !! test
16639 Sanitizer: Closing of closed but not open table tags
16640 !! options
16641 parsoid=wt2html
16642 !! wikitext
16643 Table not started</td></tr></table>
16644 !! html/php+tidy
16645 <p>Table not started</p>
16646 !! html/parsoid
16647 <p>Table not started</p>
16648 !! end
16649
16650 !! test
16651 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
16652 !! wikitext
16653 <span id="æ: v">byte</span>[[#æ: v|backlink]]
16654 !! html
16655 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
16656 </p>
16657 !! end
16658
16659 # In HTML5, the restrictions are that id must contain at least one character,
16660 # and must not contain any space characters.
16661 !! test
16662 Sanitizer: Validating the contents of the id attribute (bug 4515)
16663 !! options
16664 disabled
16665 !! wikitext
16666 <br id="" /><br id="a space" />
16667 !! html
16668 Something ...
16669 !! end
16670
16671 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
16672 !! test
16673 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
16674 !! options
16675 disabled
16676 !! wikitext
16677 <br id="foo" /><br id="foo" />
16678 !! html
16679 Something need to be done. foo-2 ?
16680 !! end
16681
16682 !! test
16683 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
16684 !! wikitext
16685 <div itemscope>
16686 <meta itemprop="hello" content="world">
16687 <meta http-equiv="refresh" content="5">
16688 <meta itemprop="hello" http-equiv="refresh" content="5">
16689 <link itemprop="hello" href="{{SERVER}}">
16690 <link rel="stylesheet" href="{{SERVER}}">
16691 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
16692 </div>
16693 !! html
16694 <div itemscope="">
16695 <p> <meta itemprop="hello" content="world" />
16696 &lt;meta http-equiv="refresh" content="5"&gt;
16697 <meta itemprop="hello" content="5" />
16698 </p>
16699 <link itemprop="hello" href="http&#58;//example.org" />
16700 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
16701 <link itemprop="hello" href="http&#58;//example.org" />
16702 </div>
16703
16704 !! end
16705
16706 !! test
16707 Language converter: output gets cut off unexpectedly (bug 5757)
16708 !! options
16709 language=zh
16710 !! wikitext
16711 this bit is safe: }-
16712
16713 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
16714
16715 then we get cut off here: }-
16716
16717 all additional text is vanished
16718 !! html
16719 <p>this bit is safe: }-
16720 </p><p>but if we add a conversion instance: xxx
16721 </p><p>then we get cut off here: }-
16722 </p><p>all additional text is vanished
16723 </p>
16724 !! end
16725
16726 !! test
16727 Self closed html pairs (bug 5487)
16728 !! options
16729 !! wikitext
16730 <center><font id="bug" />Centered text</center>
16731 <div><font id="bug2" />In div text</div>
16732 !! html
16733 <center>&lt;font id="bug" /&gt;Centered text</center>
16734 <div>&lt;font id="bug2" /&gt;In div text</div>
16735
16736 !! end
16737
16738 #
16739 #
16740 #
16741
16742 !! test
16743 Punctuation: nbsp before exclamation
16744 !! wikitext
16745 C'est grave !
16746 !! html
16747 <p>C'est grave&#160;!
16748 </p>
16749 !! end
16750
16751 !! test
16752 Punctuation: CSS !important (bug 11874)
16753 !! wikitext
16754 <div style="width:50% !important">important</div>
16755 !! html
16756 <div style="width:50% !important">important</div>
16757
16758 !!end
16759
16760 !! test
16761 Punctuation: CSS ! important (bug 11874; with space after)
16762 !! wikitext
16763 <div style="width:50% ! important">important</div>
16764 !! html
16765 <div style="width:50% ! important">important</div>
16766
16767 !!end
16768
16769 !! test
16770 HTML bullet list, closed tags (bug 5497)
16771 !! wikitext
16772 <ul>
16773 <li>One</li>
16774 <li>Two</li>
16775 </ul>
16776 !! html/php
16777 <ul>
16778 <li>One</li>
16779 <li>Two</li>
16780 </ul>
16781
16782 !! html/parsoid
16783 <ul data-parsoid='{"stx":"html"}'>
16784 <li data-parsoid='{"stx":"html"}'>One</li>
16785 <li data-parsoid='{"stx":"html"}'>Two</li>
16786 </ul>
16787
16788 !! end
16789
16790 !! test
16791 HTML bullet list, unclosed tags (bug 5497)
16792 !! wikitext
16793 <ul>
16794 <li>One
16795 <li>Two
16796 </ul>
16797 !! html/php+tidy
16798 <ul>
16799 <li>One</li>
16800 <li>Two</li>
16801 </ul>
16802 !! html/parsoid
16803 <ul data-parsoid='{"stx":"html"}'>
16804 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
16805 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
16806 </ul>
16807
16808 !! end
16809
16810 !! test
16811 HTML ordered list, closed tags (bug 5497)
16812 !! wikitext
16813 <ol>
16814 <li>One</li>
16815 <li>Two</li>
16816 </ol>
16817 !! html/php
16818 <ol>
16819 <li>One</li>
16820 <li>Two</li>
16821 </ol>
16822
16823 !! html/parsoid
16824 <ol data-parsoid='{"stx":"html"}'>
16825 <li data-parsoid='{"stx":"html"}'>One</li>
16826 <li data-parsoid='{"stx":"html"}'>Two</li>
16827 </ol>
16828
16829 !! end
16830
16831 !! test
16832 HTML ordered list, unclosed tags (bug 5497)
16833 !! options
16834 !! wikitext
16835 <ol>
16836 <li>One
16837 <li>Two
16838 </ol>
16839 !! html/php+tidy
16840 <ol>
16841 <li>One</li>
16842 <li>Two</li>
16843 </ol>
16844 !! html/parsoid
16845 <ol data-parsoid='{"stx":"html"}'>
16846 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
16847 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
16848 </ol>
16849
16850 !! end
16851
16852 !! test
16853 HTML nested bullet list, closed tags (bug 5497)
16854 !! wikitext
16855 <ul>
16856 <li>One</li>
16857 <li>Two:
16858 <ul>
16859 <li>Sub-one</li>
16860 <li>Sub-two</li>
16861 </ul>
16862 </li>
16863 </ul>
16864 !! html
16865 <ul>
16866 <li>One</li>
16867 <li>Two:
16868 <ul>
16869 <li>Sub-one</li>
16870 <li>Sub-two</li>
16871 </ul>
16872 </li>
16873 </ul>
16874
16875 !! end
16876
16877 !! test
16878 HTML nested bullet list, open tags (bug 5497)
16879 !! wikitext
16880 <ul>
16881 <li>One
16882 <li>Two:
16883 <ul>
16884 <li>Sub-one
16885 <li>Sub-two
16886 </ul>
16887 </ul>
16888 !! html/php+tidy
16889 <ul>
16890 <li>One</li>
16891 <li>Two:
16892 <ul>
16893 <li>Sub-one</li>
16894 <li>Sub-two</li>
16895 </ul>
16896 </li>
16897 </ul>
16898 !! html/parsoid
16899 <ul>
16900 <li>One
16901 </li>
16902 <li>Two:
16903 <ul>
16904 <li>Sub-one
16905 </li>
16906 <li>Sub-two
16907 </li>
16908 </ul>
16909 </li>
16910 </ul>
16911
16912 !! end
16913
16914 !! test
16915 HTML nested ordered list, closed tags (bug 5497)
16916 !! wikitext
16917 <ol>
16918 <li>One</li>
16919 <li>Two:
16920 <ol>
16921 <li>Sub-one</li>
16922 <li>Sub-two</li>
16923 </ol>
16924 </li>
16925 </ol>
16926 !! html
16927 <ol>
16928 <li>One</li>
16929 <li>Two:
16930 <ol>
16931 <li>Sub-one</li>
16932 <li>Sub-two</li>
16933 </ol>
16934 </li>
16935 </ol>
16936
16937 !! end
16938
16939 !! test
16940 HTML nested ordered list, open tags (bug 5497)
16941 !! wikitext
16942 <ol>
16943 <li>One
16944 <li>Two:
16945 <ol>
16946 <li>Sub-one
16947 <li>Sub-two
16948 </ol>
16949 </ol>
16950 !! html/php
16951 <ol>
16952 <li>One
16953 <li>Two:
16954 <ol>
16955 <li>Sub-one
16956 <li>Sub-two
16957 </ol>
16958 </ol>
16959
16960 !! html/parsoid
16961 <ol>
16962 <li>One
16963 </li>
16964 <li>Two:
16965 <ol>
16966 <li>Sub-one
16967 </li>
16968 <li>Sub-two
16969 </li>
16970 </ol>
16971 </li>
16972 </ol>
16973
16974 !! end
16975
16976 !! test
16977 HTML ordered list item with parameters oddity
16978 !! wikitext
16979 <ol><li id="fragment">One</li>
16980 </ol>
16981 !! html
16982 <ol><li id="fragment">One</li>
16983 </ol>
16984
16985 !! end
16986
16987 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
16988 !!test
16989 bug 5918: autonumbering
16990 !! wikitext
16991 [http://first/] [http://second] [ftp://ftp]
16992
16993 ftp://inlineftp
16994
16995 [mailto:enclosed@mail.tld With target]
16996
16997 [mailto:enclosed@mail.tld]
16998
16999 mailto:inline@mail.tld
17000 !! html/php
17001 <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>
17002 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
17003 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
17004 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
17005 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
17006 </p>
17007 !! html/parsoid
17008 <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>
17009 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
17010 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
17011 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
17012 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
17013 !! end
17014
17015
17016 #
17017 # Security and HTML correctness
17018 # From Nick Jenkins' fuzz testing
17019 #
17020
17021 !! test
17022 Fuzz testing: Parser13
17023 !! wikitext
17024 {|
17025 | http://a|
17026 !! html
17027 <table>
17028 <tr>
17029 <td>
17030 </td>
17031 </tr>
17032 </table>
17033
17034 !! end
17035
17036 !! test
17037 Fuzz testing: Parser14
17038 !! wikitext
17039 == onmouseover= ==
17040 http://__TOC__
17041 !! html
17042 <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>
17043 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17044 <ul>
17045 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17046 </ul>
17047 </div>
17048
17049
17050 !! html+tidy
17051 <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>
17052 <p>http://</p>
17053 <div id="toc" class="toc">
17054 <div id="toctitle">
17055 <h2>Contents</h2>
17056 </div>
17057 <ul>
17058 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17059 </ul>
17060 </div>
17061 <p></p>
17062 !! end
17063
17064 !! test
17065 Fuzz testing: Parser14-table
17066 !! options
17067 parsoid=wt2html,html2html
17068 !! wikitext
17069 ==a==
17070 {| STYLE=__TOC__
17071 !! html
17072 <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>
17073 <table style="&#95;_TOC&#95;_">
17074 <tr><td></td></tr>
17075 </table>
17076
17077 !! html+tidy
17078 <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>
17079 <table style="__TOC__">
17080 <tr>
17081 <td></td>
17082 </tr>
17083 </table>
17084 !! html/parsoid
17085 <h2>a</h2>
17086 <table style="__TOC__"></table>
17087 !! end
17088
17089 # Known to produce bogus xml (extra </td>)
17090 !! test
17091 Fuzz testing: Parser16
17092 !! options
17093 noxml
17094 !! wikitext
17095 {|
17096 !https://||||||
17097 !! html
17098 <table>
17099 <tr>
17100 <th>https://</th>
17101 <th></th>
17102 <th></th>
17103 <th>
17104 </td>
17105 </tr>
17106 </table>
17107
17108 !! html+tidy
17109 <table>
17110 <tr>
17111 <th>https://</th>
17112 <th></th>
17113 <th></th>
17114 <th></th>
17115 </tr>
17116 </table>
17117 !! end
17118
17119 !! test
17120 Fuzz testing: Parser21
17121 !! wikitext
17122 {|
17123 ! irc://{{ftp://a" onmouseover="alert('hello world');"
17124 |
17125 !! html
17126 <table>
17127 <tr>
17128 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
17129 </th>
17130 <td>
17131 </td>
17132 </tr>
17133 </table>
17134
17135 !! end
17136
17137 !! test
17138 Fuzz testing: Parser22
17139 !! wikitext
17140 http://===r:::https://b
17141
17142 {|
17143 !! html
17144 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
17145 </p>
17146 <table>
17147 <tr><td></td></tr>
17148 </table>
17149
17150 !! end
17151
17152 # Known to produce bad XML for now
17153 !! test
17154 Fuzz testing: Parser24
17155 !! options
17156 noxml
17157 !! wikitext
17158 {|
17159 {{{|
17160 <u CLASS=
17161 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
17162 <br style="onmouseover='alert(document.cookie);' " />
17163
17164 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17165 |
17166 !! html
17167 <table>
17168 {{{|
17169 <u class="&#124;">}}}} &gt;
17170 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
17171
17172 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17173 <tr>
17174 <td></u>
17175 </td>
17176 </tr>
17177 </table>
17178
17179 !! end
17180
17181 # Note: the current result listed for this is not what the original one was,
17182 # but the original bug was JavaScript injection, which is fixed in any case.
17183 # It's not clear that the original result listed was any more correct than the
17184 # current one. Original result:
17185 # <p>{{{|
17186 # </p>
17187 # <li class="&#124;&#124;">
17188 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17189 !!test
17190 Fuzz testing: Parser25 (bug 6055)
17191 !! wikitext
17192 {{{
17193 |
17194 <LI CLASS=||
17195 >
17196 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
17197 !! html
17198 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17199 </p>
17200 !! end
17201
17202 !!test
17203 Fuzz testing: URL adjacent extension (with space, clean)
17204 !! wikitext
17205 http://example.com <nowiki>junk</nowiki>
17206 !! html/php
17207 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
17208 </p>
17209 !! html/parsoid
17210 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
17211 !! end
17212
17213 !!test
17214 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
17215 !! wikitext
17216 http://example.com<nowiki>junk</nowiki>
17217 !! html/php
17218 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
17219 </p>
17220 !! html/parsoid
17221 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
17222 !! end
17223
17224 !!test
17225 Fuzz testing: URL adjacent extension (no space, dirty; pre)
17226 !! wikitext
17227 http://example.com<pre>junk</pre>
17228 !! html/php
17229 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
17230
17231 !! html/php+tidy
17232 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
17233 <pre>
17234 junk
17235 </pre>
17236 !! html/parsoid
17237 <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>
17238 !!end
17239
17240 !!test
17241 Fuzz testing: image with bogus manual thumbnail
17242 !! wikitext
17243 [[Image:foobar.jpg|thumbnail= ]]
17244 !! html/php
17245 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
17246
17247 !! html/parsoid
17248 <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>
17249 !!end
17250
17251 !! test
17252 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
17253 !! wikitext
17254 <pre dir="&#10;"></pre>
17255 !! html
17256 <pre dir="&#10;"></pre>
17257
17258 !! end
17259
17260 !! test
17261 Parsing optional HTML elements (Bug 6171)
17262 !! options
17263 !! wikitext
17264 <table>
17265 <tr>
17266 <td> Some tabular data</td>
17267 <td> More tabular data ...
17268 <td> And yet som tabular data</td>
17269 </tr>
17270 </table>
17271 !! html
17272 <table>
17273 <tr>
17274 <td> Some tabular data</td>
17275 <td> More tabular data ...
17276 </td><td> And yet som tabular data</td>
17277 </tr>
17278 </table>
17279
17280 !! end
17281
17282 !! test
17283 Correct handling of <td>, <tr> (Bug 6171)
17284 !! options
17285 !! wikitext
17286 <table>
17287 <tr>
17288 <td> Some tabular data</td>
17289 <td> More tabular data ...</td>
17290 <td> And yet som tabular data</td>
17291 </tr>
17292 </table>
17293 !! html
17294 <table>
17295 <tr>
17296 <td> Some tabular data</td>
17297 <td> More tabular data ...</td>
17298 <td> And yet som tabular data</td>
17299 </tr>
17300 </table>
17301
17302 !! end
17303
17304
17305 !! test
17306 Parsing crashing regression (fr:JavaScript)
17307 !! wikitext
17308 </body></x>
17309 !! html
17310 <p>&lt;/body&gt;&lt;/x&gt;
17311 </p>
17312 !! end
17313
17314 !! test
17315 Inline wiki vs wiki block nesting
17316 !! wikitext
17317 '''Bold paragraph
17318
17319 New wiki paragraph
17320 !! html
17321 <p><b>Bold paragraph</b>
17322 </p><p>New wiki paragraph
17323 </p>
17324 !! end
17325
17326 # FIXME: The current php output is documented
17327 # and desired output is the parsoid target.
17328 !! test
17329 Inline HTML vs wiki block nesting
17330 !! wikitext
17331 <b>Bold paragraph
17332
17333 New wiki paragraph
17334 !! html/php
17335 <p><b>Bold paragraph
17336 </p><p>New wiki paragraph</b>
17337 </p>
17338 !! html/parsoid
17339 <p><b>Bold paragraph</b>
17340 </p><p>New wiki paragraph
17341 </p>
17342 !! end
17343
17344 # Original result was this:
17345 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
17346 # </p>
17347 # While that might be marginally more intuitive, maybe, the six-apostrophe
17348 # construct is clearly pathological and the result stated here (which is what
17349 # the parser actually does) is about as reasonable as anything.
17350 !!test
17351 Mixing markup for italics and bold
17352 !! options
17353 !! wikitext
17354 '''bold''''''bold''bolditalics'''''
17355 !! html
17356 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
17357 </p>
17358 !! end
17359
17360
17361 !! article
17362 Xyzzyx
17363 !! text
17364 Article for special page transclusion test
17365 !! endarticle
17366
17367 !! test
17368 Special page transclusion
17369 !! options
17370 !! wikitext
17371 {{Special:Prefixindex/Xyzzyx}}
17372 !! html
17373 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17374 </ul>
17375
17376 !! end
17377
17378 !! test
17379 Special page transclusion twice (bug 5021)
17380 !! options
17381 !! wikitext
17382 {{Special:Prefixindex/Xyzzyx}}
17383 {{Special:Prefixindex/Xyzzyx}}
17384 !! html
17385 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17386 </ul>
17387 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17388 </ul>
17389
17390 !! end
17391
17392 !! test
17393 Transclusion of default MediaWiki message
17394 !! wikitext
17395 {{MediaWiki:Mainpage}}
17396 !! html
17397 <p>Main Page
17398 </p>
17399 !! end
17400
17401 !! test
17402 Transclusion of nonexistent MediaWiki message
17403 !! wikitext
17404 {{MediaWiki:Mainpagexxx}}
17405 !! html
17406 <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>
17407 </p>
17408 !! end
17409
17410 !! test
17411 Transclusion of MediaWiki message with underscore
17412 !! wikitext
17413 {{MediaWiki:history_short}}
17414 !! html
17415 <p>History
17416 </p>
17417 !! end
17418
17419 !! test
17420 Transclusion of MediaWiki message with space
17421 !! wikitext
17422 {{MediaWiki:history short}}
17423 !! html
17424 <p>History
17425 </p>
17426 !! end
17427
17428 !! test
17429 Invalid header with following text
17430 !! wikitext
17431 = x = y
17432 !! html
17433 <p>= x = y
17434 </p>
17435 !! end
17436
17437
17438 !! test
17439 Section extraction test (section 0)
17440 !! options
17441 section=0
17442 !! wikitext
17443 start
17444 ==a==
17445 ===aa===
17446 ====aaa====
17447 ==b==
17448 ===ba===
17449 ===bb===
17450 ====bba====
17451 ===bc===
17452 ==c==
17453 ===ca===
17454 !! html/php
17455 start
17456 !! end
17457
17458 !! test
17459 Section extraction test (section 1)
17460 !! options
17461 section=1
17462 !! wikitext
17463 start
17464 ==a==
17465 ===aa===
17466 ====aaa====
17467 ==b==
17468 ===ba===
17469 ===bb===
17470 ====bba====
17471 ===bc===
17472 ==c==
17473 ===ca===
17474 !! html/php
17475 ==a==
17476 ===aa===
17477 ====aaa====
17478 !! end
17479
17480 !! test
17481 Section extraction test (section 2)
17482 !! options
17483 section=2
17484 !! wikitext
17485 start
17486 ==a==
17487 ===aa===
17488 ====aaa====
17489 ==b==
17490 ===ba===
17491 ===bb===
17492 ====bba====
17493 ===bc===
17494 ==c==
17495 ===ca===
17496 !! html/php
17497 ===aa===
17498 ====aaa====
17499 !! end
17500
17501 !! test
17502 Section extraction test (section 3)
17503 !! options
17504 section=3
17505 !! wikitext
17506 start
17507 ==a==
17508 ===aa===
17509 ====aaa====
17510 ==b==
17511 ===ba===
17512 ===bb===
17513 ====bba====
17514 ===bc===
17515 ==c==
17516 ===ca===
17517 !! html/php
17518 ====aaa====
17519 !! end
17520
17521 !! test
17522 Section extraction test (section 4)
17523 !! options
17524 section=4
17525 !! wikitext
17526 start
17527 ==a==
17528 ===aa===
17529 ====aaa====
17530 ==b==
17531 ===ba===
17532 ===bb===
17533 ====bba====
17534 ===bc===
17535 ==c==
17536 ===ca===
17537 !! html/php
17538 ==b==
17539 ===ba===
17540 ===bb===
17541 ====bba====
17542 ===bc===
17543 !! end
17544
17545 !! test
17546 Section extraction test (section 5)
17547 !! options
17548 section=5
17549 !! wikitext
17550 start
17551 ==a==
17552 ===aa===
17553 ====aaa====
17554 ==b==
17555 ===ba===
17556 ===bb===
17557 ====bba====
17558 ===bc===
17559 ==c==
17560 ===ca===
17561 !! html/php
17562 ===ba===
17563 !! end
17564
17565 !! test
17566 Section extraction test (section 6)
17567 !! options
17568 section=6
17569 !! wikitext
17570 start
17571 ==a==
17572 ===aa===
17573 ====aaa====
17574 ==b==
17575 ===ba===
17576 ===bb===
17577 ====bba====
17578 ===bc===
17579 ==c==
17580 ===ca===
17581 !! html/php
17582 ===bb===
17583 ====bba====
17584 !! end
17585
17586 !! test
17587 Section extraction test (section 7)
17588 !! options
17589 section=7
17590 !! wikitext
17591 start
17592 ==a==
17593 ===aa===
17594 ====aaa====
17595 ==b==
17596 ===ba===
17597 ===bb===
17598 ====bba====
17599 ===bc===
17600 ==c==
17601 ===ca===
17602 !! html/php
17603 ====bba====
17604 !! end
17605
17606 !! test
17607 Section extraction test (section 8)
17608 !! options
17609 section=8
17610 !! wikitext
17611 start
17612 ==a==
17613 ===aa===
17614 ====aaa====
17615 ==b==
17616 ===ba===
17617 ===bb===
17618 ====bba====
17619 ===bc===
17620 ==c==
17621 ===ca===
17622 !! html/php
17623 ===bc===
17624 !! end
17625
17626 !! test
17627 Section extraction test (section 9)
17628 !! options
17629 section=9
17630 !! wikitext
17631 start
17632 ==a==
17633 ===aa===
17634 ====aaa====
17635 ==b==
17636 ===ba===
17637 ===bb===
17638 ====bba====
17639 ===bc===
17640 ==c==
17641 ===ca===
17642 !! html/php
17643 ==c==
17644 ===ca===
17645 !! end
17646
17647 !! test
17648 Section extraction test (section 10)
17649 !! options
17650 section=10
17651 !! wikitext
17652 start
17653 ==a==
17654 ===aa===
17655 ====aaa====
17656 ==b==
17657 ===ba===
17658 ===bb===
17659 ====bba====
17660 ===bc===
17661 ==c==
17662 ===ca===
17663 !! html/php
17664 ===ca===
17665 !! end
17666
17667 !! test
17668 Section extraction test (nonexistent section 11)
17669 !! options
17670 section=11
17671 !! wikitext
17672 start
17673 ==a==
17674 ===aa===
17675 ====aaa====
17676 ==b==
17677 ===ba===
17678 ===bb===
17679 ====bba====
17680 ===bc===
17681 ==c==
17682 ===ca===
17683 !! html/php
17684 !! end
17685
17686 !! test
17687 Section extraction test with bogus heading (section 1)
17688 !! options
17689 section=1
17690 !! wikitext
17691 ==a==
17692 ==bogus== not a legal section
17693 ==b==
17694 !! html/php
17695 ==a==
17696 ==bogus== not a legal section
17697 !! end
17698
17699 !! test
17700 Section extraction test with bogus heading (section 2)
17701 !! options
17702 section=2
17703 !! wikitext
17704 ==a==
17705 ==bogus== not a legal section
17706 ==b==
17707 !! html/php
17708 ==b==
17709 !! end
17710
17711 !! test
17712 Section extraction test with comment after heading (section 1)
17713 !! options
17714 section=1
17715 !! wikitext
17716 ==a==
17717 ==b== <!-- -->
17718 ==c==
17719 !! html/php
17720 ==a==
17721 !! end
17722
17723 !! test
17724 Section extraction test with comment after heading (section 2)
17725 !! options
17726 section=2
17727 !! wikitext
17728 ==a==
17729 ==b== <!-- -->
17730 ==c==
17731 !! html/php
17732 ==b== <!-- -->
17733 !! end
17734
17735 !! test
17736 Section extraction test with bogus <nowiki> heading (section 1)
17737 !! options
17738 section=1
17739 !! wikitext
17740 ==a==
17741 ==bogus== <nowiki>not a legal section</nowiki>
17742 ==b==
17743 !! html/php
17744 ==a==
17745 ==bogus== <nowiki>not a legal section</nowiki>
17746 !! end
17747
17748 !! test
17749 Section extraction test with bogus <nowiki> heading (section 2)
17750 !! options
17751 section=2
17752 !! wikitext
17753 ==a==
17754 ==bogus== <nowiki>not a legal section</nowiki>
17755 ==b==
17756 !! html/php
17757 ==b==
17758 !! end
17759
17760 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
17761 # instead of respecting commented sections
17762 !! test
17763 Section extraction prefixed by comment (section 1)
17764 !! options
17765 section=1
17766 !! wikitext
17767 <!-- -->==sec1==
17768 ==sec2==
17769 !! html/php
17770 ==sec2==
17771 !!end
17772
17773 !! test
17774 Section extraction prefixed by comment (section 2)
17775 !! options
17776 section=2
17777 !! wikitext
17778 <!-- -->==sec1==
17779 ==sec2==
17780 !! html/php
17781
17782 !!end
17783
17784 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
17785 # instead of respecting HTML-style headings
17786 !! test
17787 Section extraction, mixed wiki and html (section 1)
17788 !! options
17789 section=1
17790 !! wikitext
17791 <h2>unmarked</h2>
17792 unmarked
17793 ==1==
17794 one
17795 ==2==
17796 two
17797 !! html/php
17798 ==1==
17799 one
17800 !! end
17801
17802 !! test
17803 Section extraction, mixed wiki and html (section 2)
17804 !! options
17805 section=2
17806 !! wikitext
17807 <h2>unmarked</h2>
17808 unmarked
17809 ==1==
17810 one
17811 ==2==
17812 two
17813 !! html/php
17814 ==2==
17815 two
17816 !! end
17817
17818
17819 # Formerly testing for bug 3342
17820 !! test
17821 Section extraction, heading surrounded by <noinclude>
17822 !! options
17823 section=1
17824 !! wikitext
17825 <noinclude>==unmarked==</noinclude>
17826 ==marked==
17827 !! html/php
17828 ==marked==
17829 !!end
17830
17831 # Test behavior of bug 19910
17832 !! test
17833 Sectiion with all-equals
17834 !! options
17835 section=2
17836 !! wikitext
17837 ===
17838 The line above must have a trailing space
17839 === <!--
17840 --> <!-- -->
17841 But just in case it doesn't...
17842 !! html/php
17843 === <!--
17844 --> <!-- -->
17845 But just in case it doesn't...
17846 !! end
17847
17848 !! test
17849 Section replacement test (section 0)
17850 !! options
17851 replace=0,"xxx"
17852 !! wikitext
17853 start
17854 ==a==
17855 ===aa===
17856 ====aaa====
17857 ==b==
17858 ===ba===
17859 ===bb===
17860 ====bba====
17861 ===bc===
17862 ==c==
17863 ===ca===
17864 !! html/php
17865 xxx
17866
17867 ==a==
17868 ===aa===
17869 ====aaa====
17870 ==b==
17871 ===ba===
17872 ===bb===
17873 ====bba====
17874 ===bc===
17875 ==c==
17876 ===ca===
17877 !! end
17878
17879 !! test
17880 Section replacement test (section 1)
17881 !! options
17882 replace=1,"xxx"
17883 !! wikitext
17884 start
17885 ==a==
17886 ===aa===
17887 ====aaa====
17888 ==b==
17889 ===ba===
17890 ===bb===
17891 ====bba====
17892 ===bc===
17893 ==c==
17894 ===ca===
17895 !! html/php
17896 start
17897 xxx
17898
17899 ==b==
17900 ===ba===
17901 ===bb===
17902 ====bba====
17903 ===bc===
17904 ==c==
17905 ===ca===
17906 !! end
17907
17908 !! test
17909 Section replacement test (section 2)
17910 !! options
17911 replace=2,"xxx"
17912 !! wikitext
17913 start
17914 ==a==
17915 ===aa===
17916 ====aaa====
17917 ==b==
17918 ===ba===
17919 ===bb===
17920 ====bba====
17921 ===bc===
17922 ==c==
17923 ===ca===
17924 !! html/php
17925 start
17926 ==a==
17927 xxx
17928
17929 ==b==
17930 ===ba===
17931 ===bb===
17932 ====bba====
17933 ===bc===
17934 ==c==
17935 ===ca===
17936 !! end
17937
17938 !! test
17939 Section replacement test (section 3)
17940 !! options
17941 replace=3,"xxx"
17942 !! wikitext
17943 start
17944 ==a==
17945 ===aa===
17946 ====aaa====
17947 ==b==
17948 ===ba===
17949 ===bb===
17950 ====bba====
17951 ===bc===
17952 ==c==
17953 ===ca===
17954 !! html/php
17955 start
17956 ==a==
17957 ===aa===
17958 xxx
17959
17960 ==b==
17961 ===ba===
17962 ===bb===
17963 ====bba====
17964 ===bc===
17965 ==c==
17966 ===ca===
17967 !! end
17968
17969 !! test
17970 Section replacement test (section 4)
17971 !! options
17972 replace=4,"xxx"
17973 !! wikitext
17974 start
17975 ==a==
17976 ===aa===
17977 ====aaa====
17978 ==b==
17979 ===ba===
17980 ===bb===
17981 ====bba====
17982 ===bc===
17983 ==c==
17984 ===ca===
17985 !! html/php
17986 start
17987 ==a==
17988 ===aa===
17989 ====aaa====
17990 xxx
17991
17992 ==c==
17993 ===ca===
17994 !! end
17995
17996 !! test
17997 Section replacement test (section 5)
17998 !! options
17999 replace=5,"xxx"
18000 !! wikitext
18001 start
18002 ==a==
18003 ===aa===
18004 ====aaa====
18005 ==b==
18006 ===ba===
18007 ===bb===
18008 ====bba====
18009 ===bc===
18010 ==c==
18011 ===ca===
18012 !! html/php
18013 start
18014 ==a==
18015 ===aa===
18016 ====aaa====
18017 ==b==
18018 xxx
18019
18020 ===bb===
18021 ====bba====
18022 ===bc===
18023 ==c==
18024 ===ca===
18025 !! end
18026
18027 !! test
18028 Section replacement test (section 6)
18029 !! options
18030 replace=6,"xxx"
18031 !! wikitext
18032 start
18033 ==a==
18034 ===aa===
18035 ====aaa====
18036 ==b==
18037 ===ba===
18038 ===bb===
18039 ====bba====
18040 ===bc===
18041 ==c==
18042 ===ca===
18043 !! html/php
18044 start
18045 ==a==
18046 ===aa===
18047 ====aaa====
18048 ==b==
18049 ===ba===
18050 xxx
18051
18052 ===bc===
18053 ==c==
18054 ===ca===
18055 !! end
18056
18057 !! test
18058 Section replacement test (section 7)
18059 !! options
18060 replace=7,"xxx"
18061 !! wikitext
18062 start
18063 ==a==
18064 ===aa===
18065 ====aaa====
18066 ==b==
18067 ===ba===
18068 ===bb===
18069 ====bba====
18070 ===bc===
18071 ==c==
18072 ===ca===
18073 !! html/php
18074 start
18075 ==a==
18076 ===aa===
18077 ====aaa====
18078 ==b==
18079 ===ba===
18080 ===bb===
18081 xxx
18082
18083 ===bc===
18084 ==c==
18085 ===ca===
18086 !! end
18087
18088 !! test
18089 Section replacement test (section 8)
18090 !! options
18091 replace=8,"xxx"
18092 !! wikitext
18093 start
18094 ==a==
18095 ===aa===
18096 ====aaa====
18097 ==b==
18098 ===ba===
18099 ===bb===
18100 ====bba====
18101 ===bc===
18102 ==c==
18103 ===ca===
18104 !! html/php
18105 start
18106 ==a==
18107 ===aa===
18108 ====aaa====
18109 ==b==
18110 ===ba===
18111 ===bb===
18112 ====bba====
18113 xxx
18114
18115 ==c==
18116 ===ca===
18117 !!end
18118
18119 !! test
18120 Section replacement test (section 9)
18121 !! options
18122 replace=9,"xxx"
18123 !! wikitext
18124 start
18125 ==a==
18126 ===aa===
18127 ====aaa====
18128 ==b==
18129 ===ba===
18130 ===bb===
18131 ====bba====
18132 ===bc===
18133 ==c==
18134 ===ca===
18135 !! html/php
18136 start
18137 ==a==
18138 ===aa===
18139 ====aaa====
18140 ==b==
18141 ===ba===
18142 ===bb===
18143 ====bba====
18144 ===bc===
18145 xxx
18146 !! end
18147
18148 !! test
18149 Section replacement test (section 10)
18150 !! options
18151 replace=10,"xxx"
18152 !! wikitext
18153 start
18154 ==a==
18155 ===aa===
18156 ====aaa====
18157 ==b==
18158 ===ba===
18159 ===bb===
18160 ====bba====
18161 ===bc===
18162 ==c==
18163 ===ca===
18164 !! html/php
18165 start
18166 ==a==
18167 ===aa===
18168 ====aaa====
18169 ==b==
18170 ===ba===
18171 ===bb===
18172 ====bba====
18173 ===bc===
18174 ==c==
18175 xxx
18176 !! end
18177
18178 !! test
18179 Section replacement test with initial whitespace (bug 13728)
18180 !! options
18181 replace=2,"xxx"
18182 !! wikitext
18183 Preformatted initial line
18184 ==a==
18185 ===a===
18186 !! html/php
18187 Preformatted initial line
18188 ==a==
18189 xxx
18190 !! end
18191
18192
18193 !! test
18194 Section extraction, heading followed by pre with 20 spaces (bug 6398)
18195 !! options
18196 section=1
18197 !! wikitext
18198 ==a==
18199 a
18200 !! html/php
18201 ==a==
18202 a
18203 !! end
18204
18205 !! test
18206 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
18207 !! options
18208 section=1
18209 !! wikitext
18210 ==a==
18211 a
18212 !! html/php
18213 ==a==
18214 a
18215 !! end
18216
18217
18218 !! test
18219 Section extraction, <pre> around bogus header (bug 10309)
18220 !! options
18221 noxml section=2
18222 !! wikitext
18223 == Section One ==
18224 <pre>
18225 =======
18226 </pre>
18227
18228 == Section Two ==
18229 stuff
18230 !! html/php
18231 == Section Two ==
18232 stuff
18233 !! end
18234
18235 !! test
18236 Section replacement, <pre> around bogus header (bug 10309)
18237 !! options
18238 noxml replace=2,"xxx"
18239 !! wikitext
18240 == Section One ==
18241 <pre>
18242 =======
18243 </pre>
18244
18245 == Section Two ==
18246 stuff
18247 !! html/php
18248 == Section One ==
18249 <pre>
18250 =======
18251 </pre>
18252
18253 xxx
18254 !! end
18255
18256
18257 !! test
18258 Handling of &#x0A; in URLs
18259 !! wikitext
18260 ** irc://&#x0A;a
18261 !! html/php
18262 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18263
18264 !! html/parsoid
18265 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
18266 a">irc://
18267 a</a></li></ul></li></ul>
18268 !! end
18269
18270 !! test
18271 Handling of %0A in URLs
18272 !! wikitext
18273 ** irc://%0Aa
18274 !! html/php
18275 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18276
18277 !! html/parsoid
18278 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18279 !! end
18280
18281
18282 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
18283 !! test
18284 5 quotes, code coverage +1 line
18285 !! options
18286 parsoid=wt2html
18287 !! wikitext
18288 '''''
18289 !! html/php
18290 !! html/parsoid
18291 <p><b><i></i></b></p>
18292 !! end
18293
18294 # same html as previous, but wikitext adjusted to match parsoid html2wt
18295 # note that wt2html and html2html will put the <i> before the <b>
18296 !! test
18297 5 quotes, code coverage +1 line w/ nowiki (1)
18298 !! options
18299 parsoid=wt2wt,html2wt
18300 !! wikitext
18301 '''''<nowiki/>'''''
18302 !! html/php
18303 <p><i></i>
18304 </p>
18305 !! html/parsoid
18306 <p><b><i></i></b></p>
18307 !! end
18308
18309 # same as previous, just swapping the <i> and <b>
18310 !! test
18311 5 quotes, code coverage +1 line w/ nowiki (2)
18312 !! wikitext
18313 '''''<nowiki/>'''''
18314 !! html/php
18315 <p><i></i>
18316 </p>
18317 !! html/parsoid
18318 <p><i><b></b></i></p>
18319 !! end
18320
18321 !! test
18322 Special:Search page linking.
18323 !! wikitext
18324 {{Special:search}}
18325 !! html
18326 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
18327 </p>
18328 !! end
18329
18330 !! test
18331 {{!}} is a magic word
18332 !! wikitext
18333 {{!}} is a magic word there and {{!}} is still a magic word here
18334 | is not a magic word here but {{!}} is still a magic word here
18335 !! html/php
18336 <p>| is a magic word there and | is still a magic word here
18337 | is not a magic word here but | is still a magic word here
18338 </p>
18339 !! html/parsoid
18340 <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
18341 | 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>
18342
18343 !! end
18344
18345 !! test
18346 Say the magic word
18347 !! options
18348 title=[[Parser test]]
18349 !! wikitext
18350 * {{PAGENAME}}
18351 * {{PAGENAMEE}}
18352 * {{FULLPAGENAME}}
18353 * {{FULLPAGENAMEE}}
18354 * {{BASEPAGENAME}}
18355 * {{BASEPAGENAMEE}}
18356 * {{SUBPAGENAME}}
18357 * {{SUBPAGENAMEE}}
18358 * {{ROOTPAGENAME}}
18359 * {{ROOTPAGENAMEE}}
18360 * {{TALKPAGENAME}}
18361 * {{TALKPAGENAMEE}}
18362 * {{SUBJECTPAGENAME}}
18363 * {{SUBJECTPAGENAMEE}}
18364 * {{NAMESPACEE}}
18365 * {{NAMESPACE}}
18366 * {{NAMESPACENUMBER}}
18367 * {{TALKSPACE}}
18368 * {{TALKSPACEE}}
18369 * {{SUBJECTSPACE}}
18370 * {{SUBJECTSPACEE}}
18371 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
18372 !! html
18373 <ul><li> Parser test</li>
18374 <li> Parser_test</li>
18375 <li> Parser test</li>
18376 <li> Parser_test</li>
18377 <li> Parser test</li>
18378 <li> Parser_test</li>
18379 <li> Parser test</li>
18380 <li> Parser_test</li>
18381 <li> Parser test</li>
18382 <li> Parser_test</li>
18383 <li> Talk:Parser test</li>
18384 <li> Talk:Parser_test</li>
18385 <li> Parser test</li>
18386 <li> Parser_test</li>
18387 <li> </li>
18388 <li> </li>
18389 <li> 0</li>
18390 <li> Talk</li>
18391 <li> Talk</li>
18392 <li> </li>
18393 <li> </li>
18394 <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>
18395
18396 !! end
18397 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
18398
18399 !! test
18400 Gallery
18401 !! wikitext
18402 <gallery>
18403 image1.png |
18404 image2.gif|||||
18405
18406 image3|
18407 image4 |300px| centre
18408 image5.svg| http://///////
18409 [[x|xx]]]]
18410 * image6
18411 </gallery>
18412 !! html
18413 <ul class="gallery mw-gallery-traditional">
18414 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18415 <div class="thumb" style="height: 150px;">Image1.png</div>
18416 <div class="gallerytext">
18417 </div>
18418 </div></li>
18419 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18420 <div class="thumb" style="height: 150px;">Image2.gif</div>
18421 <div class="gallerytext">
18422 </div>
18423 </div></li>
18424 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18425 <div class="thumb" style="height: 150px;">Image3</div>
18426 <div class="gallerytext">
18427 </div>
18428 </div></li>
18429 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18430 <div class="thumb" style="height: 150px;">Image4</div>
18431 <div class="gallerytext">
18432 <pre>centre
18433 </pre>
18434 </div>
18435 </div></li>
18436 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18437 <div class="thumb" style="height: 150px;">Image5.svg</div>
18438 <div class="gallerytext">
18439 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
18440 </p>
18441 </div>
18442 </div></li>
18443 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18444 <div class="thumb" style="height: 150px;">* image6</div>
18445 <div class="gallerytext">
18446 </div>
18447 </div></li>
18448 </ul>
18449
18450 !! end
18451
18452 !! test
18453 Gallery (with options)
18454 !! wikitext
18455 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
18456 File:Nonexistent.jpg|caption
18457 File:Nonexistent.jpg
18458 image:foobar.jpg|some '''caption''' [[Main Page]]
18459 image:foobar.jpg
18460 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
18461 </gallery>
18462 !! html
18463 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
18464 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
18465 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18466 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18467 <div class="gallerytext">
18468 <p>caption
18469 </p>
18470 </div>
18471 </div></li>
18472 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18473 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18474 <div class="gallerytext">
18475 </div>
18476 </div></li>
18477 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18478 <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>
18479 <div class="gallerytext">
18480 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18481 </p>
18482 </div>
18483 </div></li>
18484 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18485 <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>
18486 <div class="gallerytext">
18487 </div>
18488 </div></li>
18489 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18490 <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>
18491 <div class="gallerytext">
18492 <p>blabla.
18493 </p>
18494 </div>
18495 </div></li>
18496 </ul>
18497
18498 !! end
18499
18500 !! test
18501 Gallery with link that has fragment
18502 !! wikitext
18503 <gallery>
18504 image:foobar.jpg|link=Main_Page
18505 image:foobar.jpg|link=Main_Page#section
18506 image:foobar.jpg|link=Main Page#section|caption
18507 </gallery>
18508 !! html
18509 <ul class="gallery mw-gallery-traditional">
18510 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18511 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/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>
18512 <div class="gallerytext">
18513 </div>
18514 </div></li>
18515 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18516 <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>
18517 <div class="gallerytext">
18518 </div>
18519 </div></li>
18520 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18521 <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>
18522 <div class="gallerytext">
18523 <p>caption
18524 </p>
18525 </div>
18526 </div></li>
18527 </ul>
18528
18529 !! end
18530
18531 !! test
18532 Gallery with wikitext inside caption
18533 !! wikitext
18534 <gallery>
18535 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
18536 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
18537 </gallery>
18538 !! html
18539 <ul class="gallery mw-gallery-traditional">
18540 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18541 <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>
18542 <div class="gallerytext">
18543 <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>
18544 </p>
18545 </div>
18546 </div></li>
18547 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18548 <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>
18549 <div class="gallerytext">
18550 <p>This is a test template
18551 </p>
18552 </div>
18553 </div></li>
18554 </ul>
18555
18556 !! end
18557
18558 !! test
18559 gallery (with showfilename option)
18560 !! wikitext
18561 <gallery showfilename>
18562 File:Nonexistent.jpg|caption
18563 File:Nonexistent.jpg
18564 image:foobar.jpg|some '''caption''' [[Main Page]]
18565 File:Foobar.jpg
18566 </gallery>
18567 !! html
18568 <ul class="gallery mw-gallery-traditional">
18569 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18570 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18571 <div class="gallerytext">
18572 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
18573 caption
18574 </p>
18575 </div>
18576 </div></li>
18577 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18578 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18579 <div class="gallerytext">
18580 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
18581 </p>
18582 </div>
18583 </div></li>
18584 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18585 <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>
18586 <div class="gallerytext">
18587 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
18588 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18589 </p>
18590 </div>
18591 </div></li>
18592 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18593 <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>
18594 <div class="gallerytext">
18595 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
18596 </p>
18597 </div>
18598 </div></li>
18599 </ul>
18600
18601 !! end
18602
18603 !! test
18604 Gallery (with namespace-less filenames)
18605 !! wikitext
18606 <gallery>
18607 File:Nonexistent.jpg
18608 Nonexistent.jpg
18609 image:foobar.jpg
18610 foobar.jpg
18611 </gallery>
18612 !! html
18613 <ul class="gallery mw-gallery-traditional">
18614 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18615 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18616 <div class="gallerytext">
18617 </div>
18618 </div></li>
18619 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18620 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18621 <div class="gallerytext">
18622 </div>
18623 </div></li>
18624 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18625 <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>
18626 <div class="gallerytext">
18627 </div>
18628 </div></li>
18629 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18630 <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>
18631 <div class="gallerytext">
18632 </div>
18633 </div></li>
18634 </ul>
18635
18636 !! end
18637
18638 !! test
18639 HTML Hex character encoding (spells the word "JavaScript")
18640 !! options
18641 parsoid=wt2html,wt2wt,html2html
18642 !! wikitext
18643 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
18644 !! html/php
18645 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
18646 </p>
18647 !! html/php+tidy
18648 <p>JavaScript</p>
18649 !! html/parsoid
18650 <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>
18651 !! end
18652
18653 !! test
18654 HTML Hex character encoding bogus encoding (bug 26437 regression check)
18655 !! wikitext
18656 &#xsee;&#XSEE;
18657 !! html/php
18658 <p>&amp;#xsee;&amp;#XSEE;
18659 </p>
18660 !! html/parsoid
18661 <p>&amp;#xsee;&amp;#XSEE;</p>
18662 !! end
18663
18664 !! test
18665 HTML Hex character encoding mixed case
18666 !! options
18667 parsoid=wt2html,wt2wt,html2html
18668 !! wikitext
18669 &#xEE;&#Xee;
18670 !! html/php
18671 <p>&#xee;&#xee;
18672 </p>
18673 !! html/php+tidy
18674 <p>îî</p>
18675 !! html/parsoid
18676 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
18677 !! end
18678
18679 # See: http://www.w3.org/TR/html5/syntax.html#character-references
18680 # Note that U+000C (form feed) is not a valid XML character, so
18681 # it is banned even though allowed in HTML5.
18682 !! test
18683 Illegal character references (T106578)
18684 !! wikitext
18685 ; Null: &#00;
18686 ; FF: &#xC;
18687 ; CR: &#xD;
18688 ; Control (low): &#8;
18689 ; Control (high): &#x7F; &#x9F;
18690 ; Surrogate: &#xD83D;&#xDCA9;
18691 ; This is an okay astral character: &#x1F4A9;
18692 !! html+tidy
18693 <dl>
18694 <dt>Null</dt>
18695 <dd>&amp;#00;</dd>
18696 <dt>FF</dt>
18697 <dd>&amp;#xC;</dd>
18698 <dt>CR</dt>
18699 <dd>&amp;#xD;</dd>
18700 <dt>Control (low)</dt>
18701 <dd>&amp;#8;</dd>
18702 <dt>Control (high)</dt>
18703 <dd>&amp;#x7F; &amp;#x9F;</dd>
18704 <dt>Surrogate</dt>
18705 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
18706 <dt>This is an okay astral character</dt>
18707 <dd>💩</dd>
18708 </dl>
18709 !! end
18710
18711 !! test
18712 __FORCETOC__ override
18713 !! wikitext
18714 __NEWSECTIONLINK__
18715 __FORCETOC__
18716 !! html/php
18717 <p><br />
18718 </p>
18719 !! end
18720
18721 !! test
18722 ISBN code coverage
18723 !! wikitext
18724 ISBN 978-0-1234-56&#x20;789
18725 !! html
18726 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
18727 </p>
18728 !! html+tidy
18729 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
18730 !! html/parsoid
18731 <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>
18732 !! end
18733
18734 !! test
18735 ISBN followed by 5 spaces
18736 !! wikitext
18737 ISBN
18738 !! html
18739 <p>ISBN
18740 </p>
18741 !! end
18742
18743 !! test
18744 Double ISBN
18745 !! wikitext
18746 ISBN ISBN 1234567890
18747 !! html/php
18748 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18749 </p>
18750 !! html/parsoid
18751 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
18752 !! end
18753
18754 # Uppercase X and lowercase x as well
18755 !! test
18756 ISBN with an X
18757 !! wikitext
18758 ISBN 3-462-04561-X
18759 ISBN 3-462-04561-x
18760 ISBN 080442957X
18761 ISBN 080442957x
18762 ISBN 978080442957X
18763 ISBN 978080442957x
18764 !! html/php
18765 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
18766 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
18767 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
18768 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
18769 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
18770 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
18771 </p>
18772 !! html/parsoid
18773 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
18774 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
18775 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
18776 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
18777 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
18778 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
18779 !! end
18780
18781 !! test
18782 ISBN with empty prefix (parsoid test)
18783 !! wikitext
18784 ISBN 1234567890
18785 !! html/php
18786 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18787 </p>
18788 !! html/parsoid
18789 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
18790 !! end
18791
18792 !! test
18793 Bug 22905: <abbr> followed by ISBN followed by </a>
18794 !! wikitext
18795 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
18796 !! html/php
18797 <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>
18798 </p>
18799 !! html/parsoid
18800 <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>
18801 !! end
18802
18803 !! test
18804 Double RFC
18805 !! wikitext
18806 RFC RFC 1234
18807 !! html
18808 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
18809 </p>
18810 !! end
18811
18812 !! test
18813 Double RFC with a wiki link
18814 !! wikitext
18815 RFC [[RFC 1234]]
18816 !! html
18817 <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>
18818 </p>
18819 !! end
18820
18821 !! test
18822 RFC code coverage
18823 !! wikitext
18824 RFC 983&#x20;987
18825 !! html
18826 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
18827 </p>
18828 !! html+tidy
18829 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
18830 !! end
18831
18832 !! test
18833 Centre-aligned image
18834 !! wikitext
18835 [[Image:foobar.jpg|centre]]
18836 !! html
18837 <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>
18838
18839 !!end
18840
18841 !! test
18842 None-aligned image
18843 !! wikitext
18844 [[Image:foobar.jpg|none]]
18845 !! html
18846 <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>
18847
18848 !!end
18849
18850 !! test
18851 Width + Height sized image (using px) (height is ignored)
18852 !! wikitext
18853 [[Image:foobar.jpg|640x480px]]
18854 !! html
18855 <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>
18856 </p>
18857 !!end
18858
18859 !! test
18860 Width-sized image (using px, no following whitespace)
18861 !! wikitext
18862 [[Image:foobar.jpg|640px]]
18863 !! html
18864 <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>
18865 </p>
18866 !!end
18867
18868 !! test
18869 Width-sized image (using px, with following whitespace - test regression from r39467)
18870 !! wikitext
18871 [[Image:foobar.jpg|640px ]]
18872 !! html
18873 <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>
18874 </p>
18875 !!end
18876
18877 !! test
18878 Width-sized image (using px, with preceding whitespace - test regression from r39467)
18879 !! wikitext
18880 [[Image:foobar.jpg| 640px]]
18881 !! html
18882 <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>
18883 </p>
18884 !!end
18885
18886 !! test
18887 Image with page parameter
18888 !! options
18889 djvu
18890 !! wikitext
18891 [[File:LoremIpsum.djvu|page=2]]
18892 !! html/php
18893 <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>
18894 </p>
18895 !! html/parsoid
18896 <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>
18897 !! end
18898
18899 !! test
18900 Another italics / bold test
18901 !! wikitext
18902 ''' ''x'
18903 !! html
18904 <pre>'<i> </i>x'
18905 </pre>
18906 !!end
18907
18908 # FIXME: The php output seems broken. It's interleaving some open/close tags.
18909 !! test
18910 dt/dd/dl test
18911 !! wikitext
18912 :;;;::
18913 !! html/php
18914 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
18915
18916 !! html/parsoid
18917 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
18918
18919 !!end
18920
18921
18922 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
18923 !! test
18924 Images with the "|" character in the comment
18925 !! wikitext
18926 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
18927 !! html/php
18928 <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>
18929
18930 !! html/parsoid
18931 <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>
18932 !! end
18933
18934 !! test
18935 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
18936 !! wikitext
18937 <html><script>alert(1);</script></html>
18938 !! html
18939 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
18940 </p>
18941 !! end
18942
18943 !! test
18944 HTML with raw HTML ($wgRawHtml==true)
18945 !! options
18946 wgRawHtml=1
18947 !! wikitext
18948 <html><script>alert(1);</script></html>
18949 !! html
18950 <p><script>alert(1);</script>
18951 </p>
18952 !! end
18953
18954 !! test
18955 Parents of subpages, one level up
18956 !! options
18957 subpage title=[[Subpage test/L1/L2/L3]]
18958 !! wikitext
18959 [[../|L2]]
18960 !! html
18961 <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>
18962 </p>
18963 !! end
18964
18965
18966 !! test
18967 Parents of subpages, one level up, not named
18968 !! options
18969 subpage title=[[Subpage test/L1/L2/L3]]
18970 !! wikitext
18971 [[../]]
18972 !! html
18973 <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>
18974 </p>
18975 !! end
18976
18977
18978
18979 !! test
18980 Parents of subpages, two levels up
18981 !! options
18982 subpage title=[[Subpage test/L1/L2/L3]]
18983 !! wikitext
18984 [[../../|L1]]2
18985
18986 [[../../|L1]]l
18987 !! html
18988 <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
18989 </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>
18990 </p>
18991 !! end
18992
18993 !! test
18994 Parents of subpages, two levels up, without trailing slash or name.
18995 !! options
18996 subpage title=[[Subpage test/L1/L2/L3]]
18997 !! wikitext
18998 [[../..]]
18999 !! html
19000 <p>[[../..]]
19001 </p>
19002 !! end
19003
19004 !! test
19005 Parents of subpages, two levels up, with lots of extra trailing slashes.
19006 !! options
19007 subpage title=[[Subpage test/L1/L2/L3]]
19008 !! wikitext
19009 [[../../////]]
19010 !! html
19011 <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>
19012 </p>
19013 !! end
19014
19015 !! article
19016 Subpage test/L1/L2/L3Sibling
19017 !! text
19018 Sibling article
19019 !! endarticle
19020
19021 !! test
19022 Transclusion of a sibling page (one level up)
19023 !! options
19024 subpage title=[[Subpage test/L1/L2/L3]]
19025 !! wikitext
19026 {{../L3Sibling}}
19027 !! html
19028 <p>Sibling article
19029 </p>
19030 !! end
19031
19032 !! test
19033 Transclusion of a child page
19034 !! options
19035 subpage title=[[Subpage test/L1/L2]]
19036 !! wikitext
19037 {{/L3Sibling}}
19038 !! html
19039 <p>Sibling article
19040 </p>
19041 !! end
19042
19043 !! test
19044 Non-transclusion because of too many up levels
19045 !! options
19046 subpage title=[[Subpage test/L1/L2/L3]]
19047 !! wikitext
19048 {{../../../../More than parent}}
19049 !! html
19050 <p>{{../../../../More than parent}}
19051 </p>
19052 !! end
19053
19054 !! test
19055 Definition list code coverage
19056 !! wikitext
19057 ; title : def
19058 ; title : def
19059 ;title: def
19060 !! html/php
19061 <dl><dt> title &#160;</dt>
19062 <dd> def</dd>
19063 <dt> title&#160;</dt>
19064 <dd> def</dd>
19065 <dt>title</dt>
19066 <dd> def</dd></dl>
19067
19068 !! html/parsoid
19069 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
19070 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
19071 <dt>title</dt><dd> def</dd></dl>
19072 !! end
19073
19074 !! test
19075 Don't fall for the self-closing div
19076 !! wikitext
19077 <div>hello world</div/>
19078 !! html
19079 <div>hello world</div>
19080
19081 !! end
19082
19083 !! test
19084 MSGNW magic word
19085 !! wikitext
19086 {{MSGNW:msg}}
19087 !! html/php
19088 <p>&#91;&#91;:Template:Msg&#93;&#93;
19089 </p>
19090 !! end
19091
19092 !! test
19093 RAW magic word
19094 !! wikitext
19095 {{RAW:QUERTY}}
19096 !! html
19097 <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>
19098 </p>
19099 !! end
19100
19101 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
19102 !! test
19103 Always escape literal '>' in output, not just after '<'
19104 !! wikitext
19105 ><>
19106 !! html
19107 <p>&gt;&lt;&gt;
19108 </p>
19109 !! end
19110
19111 !! test
19112 Template caching
19113 !! wikitext
19114 {{Test}}
19115 {{Test}}
19116 !! html
19117 <p>This is a test template
19118 This is a test template
19119 </p>
19120 !! end
19121
19122
19123 !! article
19124 MediaWiki:Fake
19125 !! text
19126 ==header==
19127 !! endarticle
19128
19129 !! test
19130 Inclusion of !userCanEdit() content
19131 !! wikitext
19132 {{MediaWiki:Fake}}
19133 !! html
19134 <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>
19135
19136 !! end
19137
19138
19139 !! test
19140 Out-of-order TOC heading levels
19141 !! wikitext
19142 ==2==
19143 ======6======
19144 ===3===
19145 =1=
19146 =====5=====
19147 ==2==
19148 !! html
19149 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19150 <ul>
19151 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
19152 <ul>
19153 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
19154 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
19155 </ul>
19156 </li>
19157 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
19158 <ul>
19159 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
19160 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
19161 </ul>
19162 </li>
19163 </ul>
19164 </div>
19165
19166 <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>
19167 <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>
19168 <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>
19169 <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>
19170 <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>
19171 <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>
19172
19173 !! end
19174
19175
19176 !! test
19177 ISBN with a dummy number
19178 !! wikitext
19179 ISBN ---
19180 !! html
19181 <p>ISBN ---
19182 </p>
19183 !! end
19184
19185
19186 !! test
19187 ISBN with space-delimited number
19188 !! wikitext
19189 ISBN 92 9017 032 8
19190 !! html
19191 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
19192 </p>
19193 !! end
19194
19195
19196 !! test
19197 ISBN with multiple spaces, no number
19198 !! wikitext
19199 ISBN foo
19200 !! html
19201 <p>ISBN foo
19202 </p>
19203 !! end
19204
19205
19206 !! test
19207 ISBN length
19208 !! wikitext
19209 ISBN 123456789
19210
19211 ISBN 1234567890
19212
19213 ISBN 12345678901
19214 !! html
19215 <p>ISBN 123456789
19216 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19217 </p><p>ISBN 12345678901
19218 </p>
19219 !! end
19220
19221
19222 !! test
19223 ISBN with trailing year (bug 8110)
19224 !! wikitext
19225 ISBN 1-234-56789-0 - 2006
19226
19227 ISBN 1 234 56789 0 - 2006
19228 !! html
19229 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
19230 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
19231 </p>
19232 !! end
19233
19234
19235 !! test
19236 anchorencode
19237 !! wikitext
19238 {{anchorencode:foo bar©#%n}}
19239 !! html
19240 <p>foo_bar.C2.A9.23.25n
19241 </p>
19242 !! end
19243
19244 !! test
19245 anchorencode trims spaces
19246 !! wikitext
19247 {{anchorencode: __pretty__please__}}
19248 !! html
19249 <p>pretty_please
19250 </p>
19251 !! end
19252
19253 !! test
19254 anchorencode deals with links
19255 !! wikitext
19256 {{anchorencode: [[hello|world]] [[hi]]}}
19257 !! html
19258 <p>world_hi
19259 </p>
19260 !! end
19261
19262 !! test
19263 anchorencode deals with templates
19264 !! wikitext
19265 {{anchorencode: {{Foo}} }}
19266 !! html
19267 <p>FOO
19268 </p>
19269 !! end
19270
19271 !! test
19272 anchorencode encodes like the TOC generator: (bug 18431)
19273 !! wikitext
19274 === _ +:.3A%3A&&amp;]] ===
19275 {{anchorencode: _ +:.3A%3A&&amp;]] }}
19276 __NOEDITSECTION__
19277 !! html
19278 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
19279 <p>.2B:.3A.253A.26.26.5D.5D
19280 </p>
19281 !! end
19282
19283 !! test
19284 Bug 6200: blockquotes and paragraph formatting
19285 !! wikitext
19286 <blockquote>
19287 foo
19288 </blockquote>
19289
19290 bar
19291
19292 baz
19293 !! html
19294 <blockquote>
19295 <p>foo
19296 </p>
19297 </blockquote>
19298 <p>bar
19299 </p>
19300 <pre>baz
19301 </pre>
19302 !! end
19303
19304 !! test
19305 Bug 8293: Use of center tag ruins paragraph formatting
19306 !! wikitext
19307 <center>
19308 foo
19309 </center>
19310
19311 bar
19312
19313 baz
19314 !! html
19315 <center>
19316 <p>foo
19317 </p>
19318 </center>
19319 <p>bar
19320 </p>
19321 <pre>baz
19322 </pre>
19323 !! end
19324
19325 !!test
19326 Parsing of overlapping (improperly nested) inline html tags
19327 !! wikitext
19328 <span><s>x</span></s>
19329 !! html/php
19330 <p><span><s>x&lt;/span&gt;</s></span>
19331 </p>
19332 !! html/parsoid
19333 <p><span><s>x</s></span>
19334 </p>
19335 !!end
19336
19337 ###
19338 ### Language variants related tests
19339 ###
19340 !! test
19341 Self-link in language variants
19342 !! options
19343 title=[[Dunav]] language=sr
19344 !! wikitext
19345 Both [[Dunav]] and [[Дунав]] are names for this river.
19346 !! html
19347 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
19348 </p>
19349 !!end
19350
19351 !! article
19352 Дуна
19353 !! text
19354 content
19355 !! endarticle
19356
19357 !! test
19358 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
19359 !! options
19360 title=[[Duna]] language=sr
19361 !! wikitext
19362 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
19363 !! html
19364 <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.
19365 </p>
19366 !! end
19367
19368 !! test
19369 Link to a section of a variant of this title shouldn't be parsed as self-link
19370 !! options
19371 title=[[Duna]] language=sr
19372 !! wikitext
19373 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
19374 !! html
19375 <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.
19376 </p>
19377 !! end
19378
19379 !! test
19380 Link to pages in language variants
19381 !! options
19382 language=sr
19383 !! wikitext
19384 Main Page can be written as [[Маин Паге]]
19385 !! html
19386 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
19387 </p>
19388 !!end
19389
19390
19391 !! test
19392 Multiple links to pages in language variants
19393 !! options
19394 language=sr
19395 !! wikitext
19396 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
19397 !! html
19398 <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>.
19399 </p>
19400 !!end
19401
19402
19403 !! test
19404 Simple template in language variants
19405 !! options
19406 language=sr
19407 !! wikitext
19408 {{тест}}
19409 !! html
19410 <p>This is a test template
19411 </p>
19412 !! end
19413
19414
19415 !! test
19416 Template with explicit namespace in language variants
19417 !! options
19418 language=sr
19419 !! wikitext
19420 {{Template:тест}}
19421 !! html
19422 <p>This is a test template
19423 </p>
19424 !! end
19425
19426
19427 !! test
19428 Basic test for template parameter in language variants
19429 !! options
19430 language=sr
19431 !! wikitext
19432 {{парамтест|param=foo}}
19433 !! html
19434 <p>This is a test template with parameter foo
19435 </p>
19436 !! end
19437
19438
19439 !! test
19440 Simple category in language variants
19441 !! options
19442 language=sr cat
19443 !! wikitext
19444 [[Category:МедиаWики Усер'с Гуиде]]
19445 !! html
19446 <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>
19447 !! end
19448
19449
19450 !! article
19451 Category:分类
19452 !! text
19453 blah
19454 !! endarticle
19455
19456 !! article
19457 Category:分類
19458 !! text
19459 blah
19460 !! endarticle
19461
19462 ## We used to, but no longer wt2wt this test since the default serializer
19463 ## will normalize all categories to serialize on their own line.
19464 ## This wikitext usage is going to be fairly uncommon in production and
19465 ## selser will take care of preserving formatting in those scenarios.
19466 !! test
19467 Don't convert blue categorylinks to another variant (bug 33210)
19468 !! options
19469 cat
19470 language=zh
19471 parsoid=wt2html
19472 !! wikitext
19473 [[A]][[Category:分类]]
19474 !! html/php
19475 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
19476 !! html/parsoid
19477 <p><a rel="mw:WikiLink" href="A" title="A">A</a></p>
19478 <link rel="mw:PageProp/Category" href="Category:分类"/>
19479 !! end
19480
19481 !! test
19482 Stripping -{}- tags (language variants)
19483 !! options
19484 language=sr
19485 !! wikitext
19486 Latin proverb: -{Ne nuntium necare}-
19487 !! html
19488 <p>Latin proverb: Ne nuntium necare
19489 </p>
19490 !! end
19491
19492
19493 !! test
19494 Prevent conversion with -{}- tags (language variants)
19495 !! options
19496 language=sr variant=sr-ec
19497 !! wikitext
19498 Latinski: -{Ne nuntium necare}-
19499 !! html
19500 <p>Латински: Ne nuntium necare
19501 </p>
19502 !! end
19503
19504
19505 !! test
19506 Prevent conversion of text with -{}- tags (language variants)
19507 !! options
19508 language=sr variant=sr-ec
19509 !! wikitext
19510 Latinski: -{Ne nuntium necare}-
19511 !! html
19512 <p>Латински: Ne nuntium necare
19513 </p>
19514 !! end
19515
19516
19517 !! test
19518 Prevent conversion of links with -{}- tags (language variants)
19519 !! options
19520 language=sr variant=sr-ec
19521 !! wikitext
19522 -{[[Main Page]]}-
19523 !! html
19524 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19525 </p>
19526 !! end
19527
19528
19529 !! test
19530 -{}- tags within headlines (within html for parserConvert())
19531 !! options
19532 language=sr variant=sr-ec
19533 !! wikitext
19534 == -{Naslov}- ==
19535 !! html
19536 <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>
19537
19538 !! end
19539
19540
19541 !! test
19542 Explicit definition of language variant alternatives
19543 !! options
19544 language=zh variant=zh-tw
19545 !! wikitext
19546 -{zh:China;zh-tw:Taiwan}-, not China
19547 !! html
19548 <p>Taiwan, not China
19549 </p>
19550 !! end
19551
19552
19553 !! test
19554 Conversion around HTML tags
19555 !! options
19556 language=sr variant=sr-ec
19557 !! wikitext
19558 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
19559 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
19560 !! html
19561 <p>
19562 <span title="ЛаCтин">ски</span>
19563 </p>
19564 !! end
19565
19566
19567 !! test
19568 Explicit session-wise language variant mapping (A flag and - flag)
19569 !! options
19570 language=zh variant=zh-tw
19571 !! wikitext
19572 Taiwan is not China.
19573 But -{A|zh:China;zh-tw:Taiwan}- is China,
19574 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
19575 and -{China}- is China.
19576 !! html
19577 <p>Taiwan is not China.
19578 But Taiwan is Taiwan,
19579 (This should be stripped!)
19580 and China is China.
19581 </p>
19582 !! end
19583
19584 !! test
19585 Explicit session-wise language variant mapping (H flag for hide)
19586 !! options
19587 language=zh variant=zh-tw
19588 !! wikitext
19589 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
19590 Taiwan is China.
19591 !! html
19592 <p>(This should be stripped!)
19593 Taiwan is Taiwan.
19594 </p>
19595 !! end
19596
19597 !! test
19598 Adding explicit conversion rule for title (T flag)
19599 !! options
19600 language=zh variant=zh-tw showtitle
19601 !! wikitext
19602 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19603 !! html
19604 Taiwan
19605 <p>Should be stripped!
19606 </p>
19607 !! end
19608
19609 !! test
19610 Testing that changing the language variant here in the tests actually works
19611 !! options
19612 language=zh variant=zh showtitle
19613 !! wikitext
19614 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19615 !! html
19616 China
19617 <p>Should be stripped!
19618 </p>
19619 !! end
19620
19621 !! test
19622 Recursive conversion of alt and title attrs shouldn't clear converter state
19623 !! options
19624 language=zh variant=zh-cn showtitle
19625 !! wikitext
19626 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
19627 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
19628 !! html
19629 China
19630 <p>
19631 Should be stripped<span title="Exclamation">!</span>
19632 </p>
19633 !! end
19634
19635 !! test
19636 Bug 24072: more test on conversion rule for title
19637 !! options
19638 language=zh variant=zh-tw showtitle
19639 !! wikitext
19640 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19641 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
19642 !! html
19643 Taiwan
19644 <p>This should be stripped!
19645 This won't take interferes with the title rule.
19646 </p>
19647 !! end
19648
19649 !! test
19650 Partly disable title conversion if variant == main language code
19651 !! options
19652 language=zh variant=zh title=[[ZH]] showtitle
19653 !! wikitext
19654 -{T|zh-cn:CN;zh-tw:TW}-
19655 !! html
19656 ZH
19657 <p>
19658 </p>
19659 !! end
19660
19661 !! test
19662 Partly disable title conversion if variant == main language code, more
19663 !! options
19664 language=zh variant=zh title=[[ZH]] showtitle
19665 !! wikitext
19666 -{T|TW}-
19667 !! html
19668 ZH
19669 <p>
19670 </p>
19671 !! end
19672
19673 !! test
19674 Raw output of variant escape tags (R flag)
19675 !! options
19676 language=zh variant=zh-tw
19677 !! wikitext
19678 Raw: -{R|zh:China;zh-tw:Taiwan}-
19679 !! html
19680 <p>Raw: zh:China;zh-tw:Taiwan
19681 </p>
19682 !! end
19683
19684 !! test
19685 Strings evaluating false shouldn't be ignored by Language converter (T51072)
19686 !! options
19687 language=zh variant=zh-cn
19688 !! input
19689 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
19690 !! result
19691 <p>0
19692 </p>
19693 !! end
19694
19695 !! test
19696 Conversion rules from [numeric-only string] to [something else] (T48634)
19697 !! options
19698 language=zh variant=zh-cn
19699 !! input
19700 -{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
19701 !! result
19702 <p>D12345EE12345
19703 </p>
19704 !! end
19705
19706 !! test
19707 Bidirectional converter rule entries with an empty value should be ignored (T53551)
19708 !! options
19709 language=zh variant=zh-cn
19710 !! input
19711 -{H|zh-cn:foo;zh-tw:;}-foobar
19712 !! result
19713 <p>foobar
19714 </p>
19715 !! end
19716
19717 !! test
19718 Unidirectional converter rule entries with an empty "from" string should be ignored (T53551)
19719 !! options
19720 language=zh variant=zh-cn
19721 !! input
19722 -{H|=>zh-cn:foo;}-foobar
19723 !! result
19724 <p>foobar
19725 </p>
19726 !! end
19727
19728 !! test
19729 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
19730 !! options
19731 language=zh variant=zh-cn
19732 !! input
19733 -{H|}-foobar
19734 !! result
19735 <p>foobar
19736 </p>
19737 !! end
19738
19739 !! test
19740 Nested using of manual convert syntax
19741 !! options
19742 language=zh variant=zh-hk
19743 !! wikitext
19744 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
19745 !! html
19746 <p>Nested: Hello Hong Kong!
19747 </p>
19748 !! end
19749
19750 !! test
19751 Proper conversion of text in external links
19752 !! options
19753 language=sr variant=sr-ec
19754 !! wikitext
19755 http://www.google.com
19756 gopher://www.google.com
19757 [http://www.google.com http://www.google.com]
19758 [gopher://www.google.com gopher://www.google.com]
19759 [https://www.google.com irc://www.google.com]
19760 [ftp://www.google.com www.google.com/ftp://dir]
19761 [//www.google.com www.google.com]
19762 !! html
19763 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
19764 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
19765 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
19766 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
19767 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
19768 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
19769 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
19770 </p>
19771 !! end
19772
19773 !! test
19774 Do not convert roman numbers to language variants
19775 !! options
19776 language=sr variant=sr-ec
19777 !! wikitext
19778 Fridrih IV je car.
19779 !! html
19780 <p>Фридрих IV је цар.
19781 </p>
19782 !! end
19783
19784 !! test
19785 Unclosed language converter markup "-{"
19786 !! options
19787 language=sr
19788 !! wikitext
19789 -{T|hello
19790 !! html
19791 <p>-{T|hello
19792 </p>
19793 !! end
19794
19795 !! test
19796 Don't convert raw rule "-{R|=&gt;}-" to "=>"
19797 !! options
19798 language=sr
19799 !! wikitext
19800 -{R|=&gt;}-
19801 !! html
19802 <p>=&gt;
19803 </p>
19804 !!end
19805
19806 !! test
19807 Don't break link parsing if language converter markup is in the caption.
19808 !! options
19809 language=sr variant=sr-ec
19810 !! wikitext
19811 [[Main Page|-{R|main page}-]]
19812 !! html
19813 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
19814 </p>
19815 !! end
19816
19817 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19818 !! test
19819 Don't break image parsing if language converter markup is in the caption.
19820 !! options
19821 language=sr
19822 !! wikitext
19823 [[File:Foobar.jpg|-{R|caption}-]]
19824 !! html/parsoid
19825 <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>
19826 </p>
19827 !! end
19828
19829 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19830 !! test
19831 Don't break list handling if language converter markup is in the item.
19832 !! options
19833 language=zh variant=zh-cn
19834 !! wikitext
19835 ;-{zh-cn:AAA;zh-tw:BBB}-
19836 !! html/php
19837 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
19838
19839 !! html/parsoid
19840 <dl><dt>AAA
19841 </dt></dl>
19842 !! end
19843
19844 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19845 !! test
19846 Don't break table handling if language converter markup is in the cell.
19847 !! options
19848 language=sr variant=sr-ec
19849 !! wikitext
19850 {|
19851 |-
19852 | -{R|B}-
19853 |}
19854 !! html/php
19855 <table>
19856
19857 <tr>
19858 <td>Б}-
19859 </td></tr></table>
19860
19861 !! html/parsoid
19862 <table>
19863
19864 <tr>
19865 <td> B
19866 </td></tr></table>
19867
19868 !! end
19869
19870 !! test
19871 Bug 529: Uncovered bullet
19872 !! wikitext
19873 * Foo {{bullet}}
19874 !! html
19875 <ul><li> Foo </li>
19876 <li> Bar</li></ul>
19877
19878 !! end
19879
19880 # Plain MediaWiki does not remove empty lists, but tidy actually does.
19881 # Templates in Wikipedia rely on this behavior, as tidy has always been
19882 # enabled there. These tests are normally run *without* tidy, so specify the
19883 # full output here.
19884 # To test realistic parsing behavior, apply a tidy-like transformation to both
19885 # the expected output and your parser's output.
19886 !! test
19887 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
19888 !! wikitext
19889 ******* Foo {{bullet}}
19890 !! html
19891 <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>
19892 <li> Bar</li></ul>
19893
19894 !! end
19895
19896 !! test
19897 Bug 529: Uncovered table already at line-start
19898 !! wikitext
19899 x
19900
19901 {{table}}
19902 y
19903 !! html
19904 <p>x
19905 </p>
19906 <table>
19907 <tr>
19908 <td> 1 </td>
19909 <td> 2
19910 </td></tr>
19911 <tr>
19912 <td> 3 </td>
19913 <td> 4
19914 </td></tr></table>
19915 <p>y
19916 </p>
19917 !! end
19918
19919 !! test
19920 Bug 529: Uncovered bullet in parser function result
19921 !! wikitext
19922 * Foo {{lc:{{bullet}} }}
19923 !! html
19924 <ul><li> Foo </li>
19925 <li> bar</li></ul>
19926
19927 !! end
19928
19929 !! test
19930 Bug 5678: Double-parsed template argument
19931 !! wikitext
19932 {{lc:{{{1}}}|hello}}
19933 !! html
19934 <p>{{{1}}}
19935 </p>
19936 !! end
19937
19938 !! test
19939 Bug 5678: Double-parsed template invocation
19940 !! wikitext
19941 {{lc:{{paramtest {{!}} param = hello }} }}
19942 !! html
19943 <p>{{paramtest | param = hello }}
19944 </p>
19945 !! end
19946
19947 !! test
19948 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
19949 !! options
19950 language=cs
19951 title=[[Main Page]]
19952 !! wikitext
19953 {{PRVNÍVELKÉ:ěščř}}
19954 {{prvnívelké:ěščř}}
19955 {{PRVNÍMALÉ:ěščř}}
19956 {{prvnímalé:ěščř}}
19957 {{MALÁ:ěščř}}
19958 {{malá:ěščř}}
19959 {{VELKÁ:ěščř}}
19960 {{velká:ěščř}}
19961 !! html
19962 <p>Ěščř
19963 Ěščř
19964 ěščř
19965 ěščř
19966 ěščř
19967 ěščř
19968 ĚŠČŘ
19969 ĚŠČŘ
19970 </p>
19971 !! end
19972
19973 !! test
19974 Morwen/13: Unclosed link followed by heading
19975 !! wikitext
19976 [[link
19977 ==heading==
19978 !! html
19979 <p>[[link
19980 </p>
19981 <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>
19982
19983 !! end
19984
19985 !! test
19986 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
19987 !! wikitext
19988 {{foo|
19989 =heading=
19990 !! html
19991 <p>{{foo|
19992 </p>
19993 <h1><span class="mw-headline" id="heading">heading</span></h1>
19994
19995 !! end
19996
19997 !! test
19998 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
19999 !! wikitext
20000 {{foo|
20001 ==heading==
20002 !! html
20003 <p>{{foo|
20004 </p>
20005 <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>
20006
20007 !! end
20008
20009 !! test
20010 Tildes in comments
20011 !! options
20012 pst
20013 !! wikitext
20014 <!-- ~~~~ -->
20015 !! html/php
20016 <!-- ~~~~ -->
20017 !! end
20018
20019 !! test
20020 Paragraphs inside divs (no extra line breaks)
20021 !! wikitext
20022 <div>Line one
20023
20024 Line two</div>
20025 !! html
20026 <div>Line one
20027 Line two</div>
20028
20029 !! end
20030
20031 !! test
20032 Paragraphs inside divs (extra line break on open)
20033 !! wikitext
20034 <div>
20035 Line one
20036
20037 Line two</div>
20038 !! html
20039 <div>
20040 <p>Line one
20041 </p>
20042 Line two</div>
20043
20044 !! end
20045
20046 !! test
20047 Paragraphs inside divs (extra line break on close)
20048 !! wikitext
20049 <div>Line one
20050
20051 Line two
20052 </div>
20053 !! html
20054 <div>Line one
20055 <p>Line two
20056 </p>
20057 </div>
20058
20059 !! end
20060
20061 !! test
20062 Paragraphs inside divs (extra line break on open and close)
20063 !! wikitext
20064 <div>
20065 Line one
20066
20067 Line two
20068 </div>
20069 !! html
20070 <div>
20071 <p>Line one
20072 </p><p>Line two
20073 </p>
20074 </div>
20075
20076 !! end
20077
20078 !! test
20079 Nesting tags, paragraphs on lines which begin with <div>
20080 !! wikitext
20081 <div></div><strong>A
20082 B</strong>
20083 !! html/php+tidy
20084 <p><strong>A</strong></p>
20085 <p><strong>B</strong></p>
20086 !! html/parsoid
20087 <div></div>
20088 <p><strong>A
20089 B</strong>
20090 </p>
20091 !! end
20092
20093 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
20094 !! test
20095 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
20096 !! wikitext
20097 <blockquote>Line one
20098
20099 Line two</blockquote>
20100 !! html
20101 <blockquote>Line one
20102 Line two</blockquote>
20103
20104 !! html+tidy
20105 <blockquote>
20106 <p>Line one Line two</p>
20107 </blockquote>
20108 !! end
20109
20110 !! test
20111 Bug 6200: paragraphs inside blockquotes (extra line break on open)
20112 !! wikitext
20113 <blockquote>
20114 Line one
20115
20116 Line two</blockquote>
20117 !! html
20118 <blockquote>
20119 <p>Line one
20120 </p>
20121 Line two</blockquote>
20122
20123 !! html+tidy
20124 <blockquote>
20125 <p>Line one</p>
20126 Line two</blockquote>
20127 !! end
20128
20129 !! test
20130 Bug 6200: paragraphs inside blockquotes (extra line break on close)
20131 !! wikitext
20132 <blockquote>Line one
20133
20134 Line two
20135 </blockquote>
20136 !! html
20137 <blockquote>Line one
20138 <p>Line two
20139 </p>
20140 </blockquote>
20141
20142 !! html+tidy
20143 <blockquote>
20144 <p>Line one</p>
20145 <p>Line two</p>
20146 </blockquote>
20147 !! end
20148
20149 !! test
20150 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
20151 !! wikitext
20152 <blockquote>
20153 Line one
20154
20155 Line two
20156 </blockquote>
20157 !! html
20158 <blockquote>
20159 <p>Line one
20160 </p><p>Line two
20161 </p>
20162 </blockquote>
20163
20164 !! html+tidy
20165 <blockquote>
20166 <p>Line one</p>
20167 <p>Line two</p>
20168 </blockquote>
20169 !! end
20170
20171 !! test
20172 Paragraphs inside blockquotes/divs (no extra line breaks)
20173 !! wikitext
20174 <blockquote><div>Line one
20175
20176 Line two</div></blockquote>
20177 !! html
20178 <blockquote><div>Line one
20179 Line two</div></blockquote>
20180
20181 !! end
20182
20183 !! test
20184 Paragraphs inside blockquotes/divs (extra line break on open)
20185 !! wikitext
20186 <blockquote><div>
20187 Line one
20188
20189 Line two</div></blockquote>
20190 !! html
20191 <blockquote><div>
20192 <p>Line one
20193 </p>
20194 Line two</div></blockquote>
20195
20196 !! end
20197
20198 !! test
20199 Paragraphs inside blockquotes/divs (extra line break on close)
20200 !! wikitext
20201 <blockquote><div>Line one
20202
20203 Line two
20204 </div></blockquote>
20205 !! html
20206 <blockquote><div>Line one
20207 <p>Line two
20208 </p>
20209 </div></blockquote>
20210
20211 !! end
20212
20213 !! test
20214 Paragraphs inside blockquotes/divs (extra line break on open and close)
20215 !! wikitext
20216 <blockquote><div>
20217 Line one
20218
20219 Line two
20220 </div></blockquote>
20221 !! html
20222 <blockquote><div>
20223 <p>Line one
20224 </p><p>Line two
20225 </p>
20226 </div></blockquote>
20227
20228 !! end
20229
20230 !! test
20231 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
20232 !! options
20233 wgLinkHolderBatchSize=0
20234 !! wikitext
20235 [[meatball:1]]
20236 [[meatball:2]]
20237 [[meatball:3]]
20238 !! html
20239 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
20240 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
20241 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
20242 </p>
20243 !! end
20244
20245 !! test
20246 Free external link invading image caption
20247 !! wikitext
20248 [[Image:Foobar.jpg|thumb|http://x|hello]]
20249 !! html
20250 <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>
20251
20252 !! end
20253
20254 !! test
20255 Bug 15196: localised external link numbers
20256 !! options
20257 language=fa
20258 !! wikitext
20259 [http://en.wikipedia.org/]
20260 !! html/php
20261 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
20262 </p>
20263 !! html/parsoid
20264 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
20265 !! end
20266
20267 !! test
20268 Multibyte character in padleft
20269 !! wikitext
20270 {{padleft:-Hello|7|Æ}}
20271 !! html
20272 <p>Æ-Hello
20273 </p>
20274 !! end
20275
20276 !! test
20277 Multibyte character in padright
20278 !! wikitext
20279 {{padright:Hello-|7|Æ}}
20280 !! html
20281 <p>Hello-Æ
20282 </p>
20283 !! end
20284
20285 !!test
20286 formatdate parser function
20287 !! wikitext
20288 {{#formatdate:2009-03-24}}
20289 !! html
20290 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
20291 </p>
20292 !! end
20293
20294 !!test
20295 formatdate parser function, with default format
20296 !! wikitext
20297 {{#formatdate:2009-03-24|mdy}}
20298 !! html
20299 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
20300 </p>
20301 !! end
20302
20303 !! test
20304 Spacing of numbers in formatted dates
20305 !! wikitext
20306 {{#formatdate:January 15}}
20307 !! html
20308 <p><span class="mw-formatted-date" title="01-15">January 15</span>
20309 </p>
20310 !! end
20311
20312 !! test
20313 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
20314 !! options
20315 language=nl title=[[MediaWiki:Common.css]]
20316 !! wikitext
20317 {{#formatdate:2009-03-24|dmy}}
20318 !! html
20319 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
20320 </p>
20321 !! end
20322
20323 #
20324 #
20325 #
20326
20327 #
20328 # Edit comments
20329 #
20330
20331 !! test
20332 Edit comment with link
20333 !! options
20334 comment
20335 !! wikitext
20336 I like the [[Main Page]] a lot
20337 !! html/php
20338 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
20339 !!end
20340
20341 !! test
20342 Edit comment with link and link text
20343 !! options
20344 comment
20345 !! wikitext
20346 I like the [[Main Page|best pages]] a lot
20347 !! html/php
20348 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
20349 !!end
20350
20351 !! test
20352 Edit comment with link and link text with suffix
20353 !! options
20354 comment
20355 !! wikitext
20356 I like the [[Main Page|best page]]s a lot
20357 !! html/php
20358 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
20359 !!end
20360
20361 !! test
20362 Edit comment with section link (non-local, eg in history list)
20363 !! options
20364 comment title=[[Main Page]]
20365 !! wikitext
20366 /* External links */ removed bogus entries
20367 !! html/php
20368 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
20369 !!end
20370
20371 !! test
20372 Edit comment with section link and text before it (non-local, eg in history list)
20373 !! options
20374 comment title=[[Main Page]]
20375 !! wikitext
20376 pre-comment text /* External links */ removed bogus entries
20377 !! html/php
20378 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>
20379 !!end
20380
20381 !! test
20382 Edit comment with section link (local, eg in diff view)
20383 !! options
20384 comment local title=[[Main Page]]
20385 !! wikitext
20386 /* External links */ removed bogus entries
20387 !! html/php
20388 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
20389 !!end
20390
20391 !! test
20392 Edit comment with subpage link (bug 14080)
20393 !! options
20394 comment
20395 subpage
20396 title=[[Subpage test]]
20397 !! wikitext
20398 Poked at a [[/subpage]] here...
20399 !! html/php
20400 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
20401 !!end
20402
20403 !! test
20404 Edit comment with subpage link and link text (bug 14080)
20405 !! options
20406 comment
20407 subpage
20408 title=[[Subpage test]]
20409 !! wikitext
20410 Poked at a [[/subpage|neat little page]] here...
20411 !! html/php
20412 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
20413 !!end
20414
20415 !! test
20416 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
20417 !! options
20418 comment
20419 title=[[Subpage test]]
20420 !! wikitext
20421 Poked at a [[/subpage]] here...
20422 !! html/php
20423 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...
20424 !!end
20425
20426 !! test
20427 Edit comment with bare anchor link (local, as on diff)
20428 !! options
20429 comment
20430 local
20431 title=[[Main Page]]
20432 !! wikitext
20433 [[#section]]
20434 !! html/php
20435 <a href="#section">#section</a>
20436 !! end
20437
20438 !! test
20439 Edit comment with bare anchor link (non-local, as on history)
20440 !! options
20441 comment
20442 title=[[Main Page]]
20443 !! wikitext
20444 [[#section]]
20445 !! html/php
20446 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
20447 !! end
20448
20449 !! test
20450 Anchor starting with underscore
20451 !! options
20452 title=[[Foo]]
20453 !! wikitext
20454 [[#_ref|One]]
20455 !! html/php
20456 <p><a href="#_ref">One</a>
20457 </p>
20458 !! html/parsoid
20459 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
20460 !! end
20461
20462 !! test
20463 Id starting with underscore
20464 !! wikitext
20465 <div id="_ref"></div>
20466 !! html/*
20467 <div id="_ref"></div>
20468
20469 !! end
20470
20471 !! test
20472 Space normalisation on autocomment (bug 22784)
20473 !! options
20474 comment
20475 title=[[Main Page]]
20476 !! wikitext
20477 /* __hello__world__ */
20478 !! html/php
20479 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
20480 !! end
20481
20482 !! test
20483 percent-encoding and + signs in comments (Bug 26410)
20484 !! options
20485 comment
20486 !! wikitext
20487 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
20488 !! html/php
20489 <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>
20490 !! end
20491
20492 # Parsoid doesn't support this yet: see bug 73581
20493 # but it *should* omit the 'src' attribute if the image is bad.
20494 # PHP side of tests was disabled in
20495 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
20496 # because of issues in the PHP parserTests infrastructure
20497 # (but the output below is indeed what the PHP side emits)
20498 !! test
20499 Bad images - basic functionality
20500 !! wikitext
20501 [[File:Bad.jpg]]
20502 !! DISABLED/html/php
20503 !! html/parsoid
20504 <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>
20505 !! end
20506
20507 !! test
20508 Bad images - bug 16039: text after bad image disappears
20509 !! wikitext
20510 Foo bar
20511 [[File:Bad.jpg]]
20512 Bar foo
20513 !! DISABLED/html/php
20514 <p>Foo bar
20515 </p><p>Bar foo
20516 </p>
20517 !! html/parsoid
20518 <p>Foo bar
20519 <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>
20520 Bar foo</p>
20521 !! end
20522
20523 !! test
20524 Verify that displaytitle works (bug #22501) no displaytitle
20525 !! options
20526 showtitle
20527 !! config
20528 wgAllowDisplayTitle=true
20529 wgRestrictDisplayTitle=false
20530 !! wikitext
20531 this is not the the title
20532 !! html/php
20533 Parser test
20534 <p>this is not the the title
20535 </p>
20536 !! end
20537
20538 !! test
20539 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
20540 !! options
20541 showtitle
20542 title=[[Screen]]
20543 !! config
20544 wgAllowDisplayTitle=true
20545 wgRestrictDisplayTitle=false
20546 !! wikitext
20547 this is not the the title
20548 {{DISPLAYTITLE:whatever}}
20549 !! html/php
20550 whatever
20551 <p>this is not the the title
20552 </p>
20553 !! end
20554
20555 !! test
20556 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
20557 !! options
20558 showtitle
20559 title=[[Screen]]
20560 !! config
20561 wgAllowDisplayTitle=true
20562 wgRestrictDisplayTitle=true
20563 !! wikitext
20564 this is not the the title
20565 {{DISPLAYTITLE:whatever}}
20566 !! html/php
20567 Screen
20568 <p>this is not the the title
20569 </p>
20570 !! end
20571
20572 !! test
20573 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
20574 !! options
20575 showtitle
20576 title=[[Screen]]
20577 !! config
20578 wgAllowDisplayTitle=true
20579 wgRestrictDisplayTitle=true
20580 !! wikitext
20581 this is not the the title
20582 {{DISPLAYTITLE:screen}}
20583 !! html/php
20584 screen
20585 <p>this is not the the title
20586 </p>
20587 !! end
20588
20589 !! test
20590 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
20591 !! options
20592 showtitle
20593 title=[[Screen]]
20594 !! config
20595 wgAllowDisplayTitle=false
20596 !! wikitext
20597 this is not the the title
20598 {{DISPLAYTITLE:screen}}
20599 !! html/php
20600 Screen
20601 <p>this is not the the title
20602 <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>
20603 </p>
20604 !! end
20605
20606 !! test
20607 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
20608 !! options
20609 showtitle
20610 title=[[Screen]]
20611 !! config
20612 wgAllowDisplayTitle=false
20613 !! wikitext
20614 this is not the the title
20615 !! html/php
20616 Screen
20617 <p>this is not the the title
20618 </p>
20619 !! end
20620
20621 !! test
20622 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
20623 !! options
20624 showtitle
20625 title=[[Screen]]
20626 !! config
20627 wgAllowDisplayTitle=true
20628 wgRestrictDisplayTitle=true
20629 !! wikitext
20630 this is not the the title
20631 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
20632 !! html/php
20633 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
20634 <p>this is not the the title
20635 </p>
20636 !! end
20637
20638 !! test
20639 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
20640 !! options
20641 showtitle
20642 title=[[Screen]]
20643 !! config
20644 wgAllowDisplayTitle=true
20645 wgRestrictDisplayTitle=true
20646 !! wikitext
20647 this is not the the title
20648 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
20649 !! html/php
20650 <span style="color: red;">s</span>creen
20651 <p>this is not the the title
20652 </p>
20653 !! end
20654
20655 !! test
20656 Page status indicators: Empty name is invalid
20657 !! options
20658 showindicators
20659 !! wikitext
20660 <indicator name=" "></indicator>
20661 <indicator></indicator>
20662 !! html
20663 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
20664 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
20665 </p>
20666 !! end
20667
20668 !! test
20669 Page status indicators: Weird syntaxes that are okay
20670 !! options
20671 showindicators
20672 !! wikitext
20673 <indicator name="empty" />
20674 <indicator name="name"></indicator>
20675 !! html
20676 empty=
20677 name=
20678 <p><br />
20679 </p>
20680 !! end
20681
20682 !! test
20683 Page status indicators: Torture test
20684 !! options
20685 showindicators
20686 !! wikitext
20687 <indicator name="01">hello world</indicator>
20688 <indicator name="02">[[Main Page]]</indicator>
20689 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
20690 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
20691 <indicator name="05">* foo
20692 * bar</indicator>
20693 <indicator name="06"><nowiki>foo</nowiki></indicator>
20694 <indicator name="07"> Preformatted</indicator>
20695 <indicator name="08"><div>Broken tag</indicator>
20696 <indicator name="09">{| class=wikitable
20697 | cell
20698 |}</indicator>
20699 <indicator name="10">Two
20700
20701 paragraphs</indicator>
20702 !! html
20703 01=hello world
20704 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20705 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" />
20706 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>
20707 05=<ul><li> foo</li>
20708 <li> bar</li></ul>
20709
20710 06=foo
20711 07=<pre>Preformatted
20712 </pre>
20713 08=<div>Broken tag</div>
20714
20715 09=<table class="wikitable">
20716 <tr>
20717 <td> cell
20718 </td></tr></table>
20719
20720 10=<p>Two
20721 </p><p>paragraphs
20722 </p>
20723 <p><br />
20724 </p><p><br />
20725 </p><p><br />
20726 </p><p><br />
20727 </p><p><br />
20728 </p>
20729 !! end
20730
20731 !! test
20732 preload: check <noinclude> and <includeonly>
20733 !! options
20734 preload
20735 !! wikitext
20736 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
20737 !! html/php
20738 Hello kind world.
20739 !! end
20740
20741 !! test
20742 preload: check <onlyinclude>
20743 !! options
20744 preload
20745 !! wikitext
20746 Goodbye <onlyinclude>Hello world</onlyinclude>
20747 !! html/php
20748 Hello world
20749 !! end
20750
20751 !! test
20752 preload: can pass tags through if we want to
20753 !! options
20754 preload
20755 !! wikitext
20756 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
20757 !! html/php
20758 <includeonly>Hello world</includeonly>
20759 !! end
20760
20761 !! test
20762 preload: check that it doesn't try to do tricks
20763 !! options
20764 preload
20765 !! wikitext
20766 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
20767 !! html/php
20768 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
20769 !! end
20770
20771 !! test
20772 Play a bit with r67090 and bug 3158
20773 !! wikitext
20774 <div style="width:50% !important">&nbsp;</div>
20775 <div style="width:50%&nbsp;!important">&nbsp;</div>
20776 <div style="width:50%&#160;!important">&nbsp;</div>
20777 <div style="border : solid;">&nbsp;</div>
20778 !! html/php
20779 <div style="width:50% !important">&#160;</div>
20780 <div style="width:50% !important">&#160;</div>
20781 <div style="width:50% !important">&#160;</div>
20782 <div style="border&#160;: solid;">&#160;</div>
20783
20784 !! html/parsoid
20785 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
20786 <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>
20787 <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>
20788 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
20789
20790 !! end
20791
20792 !! test
20793 HTML5 data attributes
20794 !! wikitext
20795 <span data-foo="bar">Baz</span>
20796 <p data-abc-def_hij="">Quuz</p>
20797 !! html/php
20798 <p><span data-foo="bar">Baz</span>
20799 </p>
20800 <p data-abc-def_hij="">Quuz</p>
20801
20802 !! html/parsoid
20803 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
20804 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
20805 !! end
20806
20807 !! test
20808 Strip reserved data attributes
20809 !! wikitext
20810 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
20811 !! html/php
20812 <div data-ok="fred">d</div>
20813
20814 !! html/parsoid
20815 <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>
20816 !! end
20817
20818 !! test
20819 percent-encoding and + signs in internal links (Bug 26410)
20820 !! wikitext
20821 [[User:+%]] [[Page+title%]]
20822 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
20823 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
20824 [[%33%45]] [[%33%45+]]
20825 !! html/php
20826 <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>
20827 <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>
20828 <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>
20829 <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>
20830 </p>
20831 !! html/parsoid
20832 <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>
20833 <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>
20834 <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>
20835 <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>
20836 !! end
20837
20838 !! test
20839 Special characters in embedded file links (bug 27679)
20840 !! wikitext
20841 [[File:Contains & ampersand.jpg]]
20842 [[File:Does not exist.jpg|Title with & ampersand]]
20843 !! html/php
20844 <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>
20845 <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>
20846 </p>
20847 !! html/parsoid
20848 <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>
20849 <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>
20850 !! end
20851
20852 !! test
20853 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
20854 !! wikitext
20855 Text&apos;s been normalized?
20856 !! html
20857 <p>Text&#39;s been normalized?
20858 </p>
20859 !! end
20860
20861 !! test
20862 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
20863 !! wikitext
20864 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
20865 !! html
20866 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
20867 </p>
20868 !! end
20869
20870 !! test
20871 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
20872 !! wikitext
20873 [http://www.example.org/ ideograms]
20874 !! html
20875 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
20876 </p>
20877 !! end
20878
20879 !! test
20880 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
20881 !! wikitext
20882 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
20883 !! html
20884 <p><img src="http://www.example.org/pic.png" alt="pic.png"/> &lt;-- U+3000 (vim: ^Vu3000)
20885 </p>
20886 !! end
20887
20888 !! article
20889 Mediawiki:loop1
20890 !! text
20891 {{Identical|A}}
20892 !! endarticle
20893
20894 !! article
20895 Mediawiki:loop2
20896 !! text
20897 {{Identical|B}}
20898 !! endarticle
20899
20900 !! article
20901 Template:Identical
20902 !! text
20903 {{int:loop1}}
20904 {{int:loop2}}
20905 !! endarticle
20906
20907 !! test
20908 Bug 31098 Template which includes system messages which includes the template
20909 !! wikitext
20910 {{Identical}}
20911 !! html
20912 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
20913 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
20914 </p>
20915 !! end
20916
20917 !! test
20918 Bug31490 Turkish: ucfirst 'blah'
20919 !! options
20920 language=tr
20921 !! wikitext
20922 {{ucfirst:blah}}
20923 !! html
20924 <p>Blah
20925 </p>
20926 !! end
20927
20928 !! test
20929 Bug31490 Turkish: ucfirst 'ix'
20930 !! options
20931 language=tr
20932 !! wikitext
20933 {{ucfirst:ix}}
20934 !! html
20935 <p>İx
20936 </p>
20937 !! end
20938
20939 !! test
20940 Bug31490 Turkish: lcfirst 'BLAH'
20941 !! options
20942 language=tr
20943 !! wikitext
20944 {{lcfirst:BLAH}}
20945 !! html
20946 <p>bLAH
20947 </p>
20948 !! end
20949
20950 !! test
20951 Bug31490 Turkish: ucfırst (with a dotless i)
20952 !! options
20953 language=tr
20954 !! wikitext
20955 {{ucfırst:blah}}
20956 !! html
20957 <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>
20958 </p>
20959 !! end
20960
20961 !! test
20962 Bug31490 ucfırst (with a dotless i) with English language
20963 !! options
20964 language=en
20965 !! wikitext
20966 {{ucfırst:blah}}
20967 !! html
20968 <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>
20969 </p>
20970 !! end
20971
20972 !! test
20973 Bug 26375: TOC with italics
20974 !! options
20975 title=[[Main Page]]
20976 !! wikitext
20977 __TOC__
20978 == ''Lost'' episodes ==
20979 !! html
20980 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20981 <ul>
20982 <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>
20983 </ul>
20984 </div>
20985
20986 <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>
20987
20988 !! end
20989
20990 !! test
20991 Bug 26375: TOC with bold
20992 !! options
20993 title=[[Main Page]]
20994 !! wikitext
20995 __TOC__
20996 == '''should be bold''' then normal text ==
20997 !! html
20998 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20999 <ul>
21000 <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>
21001 </ul>
21002 </div>
21003
21004 <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>
21005
21006 !! end
21007
21008 !! test
21009 Bug 33845: Headings become cursive in TOC when they contain an image
21010 !! options
21011 title=[[Main Page]]
21012 !! wikitext
21013 __TOC__
21014 == Image [[Image:foobar.jpg]] ==
21015 !! html
21016 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21017 <ul>
21018 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
21019 </ul>
21020 </div>
21021
21022 <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>
21023
21024 !! end
21025
21026 !! test
21027 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
21028 !! options
21029 title=[[Main Page]]
21030 !! wikitext
21031 __TOC__
21032 == <blockquote>Quote</blockquote> ==
21033 !! html
21034 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21035 <ul>
21036 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
21037 </ul>
21038 </div>
21039
21040 <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>
21041
21042 !! html+tidy
21043 <p></p>
21044 <div id="toc" class="toc">
21045 <div id="toctitle">
21046 <h2>Contents</h2>
21047 </div>
21048 <ul>
21049 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
21050 </ul>
21051 </div>
21052 <p></p>
21053 <h2><span class="mw-headline" id="Quote"></span></h2>
21054 <blockquote>
21055 <p><span class="mw-headline" id="Quote">Quote</span></p>
21056 </blockquote>
21057 <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>
21058 !! end
21059
21060 !! test
21061 Unclosed tags in TOC
21062 !! options
21063 title=[[Main Page]]
21064 !! wikitext
21065 __TOC__
21066 == Proof: 2 < 3 ==
21067 <small>Hanc marginis exiguitas non caperet.</small>
21068 QED
21069 !! html
21070 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21071 <ul>
21072 <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>
21073 </ul>
21074 </div>
21075
21076 <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>
21077 <p><small>Hanc marginis exiguitas non caperet.</small>
21078 QED
21079 </p>
21080 !! end
21081
21082 !! test
21083 Multiple tags in TOC
21084 !! wikitext
21085 __TOC__
21086 == <i>Foo</i> <b>Bar</b> ==
21087
21088 == <i>Foo</i> <blockquote>Bar</blockquote> ==
21089 !! html
21090 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21091 <ul>
21092 <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>
21093 <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>
21094 </ul>
21095 </div>
21096
21097 <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>
21098 <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>
21099
21100 !! html+tidy
21101 <p></p>
21102 <div id="toc" class="toc">
21103 <div id="toctitle">
21104 <h2>Contents</h2>
21105 </div>
21106 <ul>
21107 <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>
21108 <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>
21109 </ul>
21110 </div>
21111 <p></p>
21112 <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>
21113 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
21114 <blockquote>
21115 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
21116 </blockquote>
21117 <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>
21118 !! end
21119
21120 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
21121 # html5 tag parsing.
21122 !! test
21123 Tags with parameters in TOC
21124 !! options
21125 parsoid=wt2html
21126 !! wikitext
21127 __TOC__
21128 == <sup class="in-h2">Hello</sup> ==
21129
21130 == <sup class="a > b">Evilbye</sup> ==
21131 !! html/php
21132 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21133 <ul>
21134 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
21135 <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>
21136 </ul>
21137 </div>
21138
21139 <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>
21140 <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>
21141
21142 !! html/parsoid
21143 <meta property="mw:PageProp/toc" />
21144 <h2> <sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup> </h2>
21145
21146 <h2> <sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup> </h2>
21147 !! end
21148
21149 !! test
21150 span tags with directionality in TOC
21151 !! wikitext
21152 __TOC__
21153 == <span dir="ltr">C++</span> ==
21154
21155 == <span dir="rtl">זבנג!</span> ==
21156
21157 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
21158
21159 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
21160
21161 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
21162 !! html
21163 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21164 <ul>
21165 <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>
21166 <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>
21167 <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>
21168 <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>
21169 <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>
21170 </ul>
21171 </div>
21172
21173 <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>
21174 <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>
21175 <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>
21176 <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>
21177 <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>
21178
21179 !! end
21180
21181 !! test
21182 Bug 72884: bdi element in ToC
21183 !! wikitext
21184 __TOC__
21185 == <bdi>test</bdi> ==
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="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
21190 </ul>
21191 </div>
21192
21193 <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>
21194
21195 !! end
21196
21197 # Note that the html output does not have the <p></p>, but the
21198 # html+tidy output *does*. This is because the empty <p></p> is
21199 # removed by the sanitizer, but only when tidy is *not* enabled (!).
21200 !! test
21201 Empty <p> tag in TOC, removed by Sanitizer (T92892)
21202 !! wikitext
21203 __TOC__
21204 == x ==
21205 !! html
21206 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21207 <ul>
21208 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
21209 </ul>
21210 </div>
21211
21212 <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>
21213
21214 !! html+tidy
21215 <p></p>
21216 <div id="toc" class="toc">
21217 <div id="toctitle">
21218 <h2>Contents</h2>
21219 </div>
21220 <ul>
21221 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
21222 </ul>
21223 </div>
21224 <p></p>
21225 <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>
21226 !! end
21227
21228 !! article
21229 MediaWiki:Bug32057
21230 !! text
21231 == {{int:headline_sample}} ==
21232 !! endarticle
21233
21234 !! test
21235 Bug 32057: Title needed when expanding <h> nodes.
21236 !! options
21237 title=[[Main Page]]
21238 !! wikitext
21239 {{int:Bug32057}}
21240 !! html
21241 <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>
21242
21243 !! end
21244
21245 !! test
21246 Strip marker in urlencode
21247 !! wikitext
21248 {{urlencode:x<nowiki/>y}}
21249 {{urlencode:x<nowiki/>y|wiki}}
21250 {{urlencode:x<nowiki/>y|path}}
21251 {{urlencode:x<pre id="one">two</pre>y}}
21252 !! html
21253 <p>xy
21254 xy
21255 xy
21256 xy
21257 </p>
21258 !! end
21259
21260 !! test
21261 Strip marker in lc
21262 !! wikitext
21263 {{lc:x<nowiki/>y}}
21264 !! html
21265 <p>xy
21266 </p>
21267 !! end
21268
21269 !! test
21270 Strip marker in uc
21271 !! wikitext
21272 {{uc:x<nowiki/>y}}
21273 !! html
21274 <p>XY
21275 </p>
21276 !! end
21277
21278 !! test
21279 Strip marker in formatNum
21280 !! wikitext
21281 {{formatnum:1<nowiki/>2}}
21282 {{formatnum:1<nowiki/>2|R}}
21283 !! html
21284 <p>12
21285 12
21286 </p>
21287 !! end
21288
21289 !! test
21290 Check noCommafy in formatNum
21291 !! options
21292 language=be-tarask
21293 !! wikitext
21294 {{formatnum:123456.78}}
21295 {{formatnum:123456.78|NOSEP}}
21296 !! html
21297 <p>123 456,78
21298 123456.78
21299 </p>
21300 !! end
21301
21302 !! test
21303 Wrong option for formatNum (bug 56199)
21304 !! wikitext
21305 {{formatnum:1,234.56|Random}}
21306 {{formatnum:1,234.56|EVERYTHING}}
21307 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
21308 !! html
21309 <p>1,234.56
21310 1,234.56
21311 1,234.56
21312 </p>
21313 !! end
21314
21315 !! test
21316 Strip marker in grammar
21317 !! options
21318 language=fi
21319 !! wikitext
21320 {{grammar:elative|foo<nowiki/>bar}}
21321 !! html
21322 <p>foobarista
21323 </p>
21324 !! end
21325
21326 !! test
21327 Strip marker in padleft
21328 !! wikitext
21329 {{padleft:|2|x<nowiki/>y}}
21330 !! html
21331 <p>xy
21332 </p>
21333 !! end
21334
21335 !! test
21336 Strip marker in padright
21337 !! wikitext
21338 {{padright:|2|x<nowiki/>y}}
21339 !! html
21340 <p>xy
21341 </p>
21342 !! end
21343
21344 !! test
21345 Strip marker in anchorencode
21346 !! wikitext
21347 {{anchorencode:x<nowiki/>y}}
21348 !! html
21349 <p>xy
21350 </p>
21351 !! end
21352
21353 !! test
21354 nowiki inside link inside heading (bug 18295)
21355 !! wikitext
21356 ==[[foo|x<nowiki>y</nowiki>z]]==
21357 !! html
21358 <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>
21359
21360 !! end
21361
21362 !! test
21363 new support for bdi element (bug 31817)
21364 !! wikitext
21365 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
21366 !! html
21367 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
21368
21369 !!end
21370
21371 !! test
21372 Ignore pipe between table row attributes
21373 !! wikitext
21374 {|
21375 | quux
21376 |- id=foo | style='color: red'
21377 | bar
21378 |}
21379 !! html
21380 <table>
21381 <tr>
21382 <td> quux
21383 </td></tr>
21384 <tr id="foo" style="color: red">
21385 <td> bar
21386 </td></tr></table>
21387
21388 !! end
21389
21390 !!test
21391 Gallery override link with WikiLink (bug 34852)
21392 !! wikitext
21393 <gallery>
21394 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
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="/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>
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 absolute external link (bug 34852)
21411 !! wikitext
21412 <gallery>
21413 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
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="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>
21419 <div class="gallerytext">
21420 <p>caption
21421 </p>
21422 </div>
21423 </div></li>
21424 </ul>
21425
21426 !! end
21427
21428 !!test
21429 Gallery override link with malicious javascript (bug 34852)
21430 !! wikitext
21431 <gallery>
21432 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
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/%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>
21438 <div class="gallerytext">
21439 <p>caption
21440 </p>
21441 </div>
21442 </div></li>
21443 </ul>
21444
21445 !! end
21446
21447 !!test
21448 Gallery with invalid title as link (bug 43964)
21449 !! wikitext
21450 <gallery>
21451 File:foobar.jpg|link=<
21452 </gallery>
21453 !! html
21454 <ul class="gallery mw-gallery-traditional">
21455 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21456 <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>
21457 <div class="gallerytext">
21458 </div>
21459 </div></li>
21460 </ul>
21461
21462 !! end
21463
21464 !!test
21465 Language parser function
21466 !! wikitext
21467 {{#language:ar}}
21468 !! html
21469 <p>العربية
21470 </p>
21471 !! end
21472
21473 !!test
21474 Padleft and padright as substr
21475 !! wikitext
21476 {{padleft:|3|abcde}}
21477 {{padright:|3|abcde}}
21478 !! html
21479 <p>abc
21480 abc
21481 </p>
21482 !! end
21483
21484 !!test
21485 Special parser function
21486 !! wikitext
21487 {{#special:RandomPage}}
21488 {{#special:BaDtItLe}}
21489 {{#special:Foobar}}
21490 !! html
21491 <p>Special:Random
21492 Special:Badtitle
21493 Special:Foobar
21494 </p>
21495 !! end
21496
21497 !!test
21498 Bug 34939 - Case insensitive link parsing ([HttP://])
21499 !! wikitext
21500 [HttP://MediaWiki.Org/]
21501 !! html/php
21502 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
21503 </p>
21504 !! html/parsoid
21505 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
21506 !! end
21507
21508 !!test
21509 Bug 34939 - Case insensitive link parsing ([HttP:// title])
21510 !! wikitext
21511 [HttP://MediaWiki.Org/ MediaWiki]
21512 !! html
21513 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
21514 </p>
21515 !! end
21516
21517 !!test
21518 Bug 34939 - Case insensitive link parsing (HttP://)
21519 !! wikitext
21520 HttP://MediaWiki.Org/
21521 !! html/php
21522 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
21523 </p>
21524 !! html/parsoid
21525 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
21526 !! end
21527
21528 !!test
21529 Disable TOC
21530 !! options
21531 notoc
21532 !! wikitext
21533 Lead
21534 == Section 1 ==
21535 == Section 2 ==
21536 == Section 3 ==
21537 == Section 4 ==
21538 == Section 5 ==
21539 !! html
21540 <p>Lead
21541 </p>
21542
21543 <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>
21544 <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>
21545 <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>
21546 <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>
21547 <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>
21548
21549 !! end
21550
21551
21552 ###
21553 ### Parsoid-specific tests
21554 ### Parsoid-PHP parser incompatibilities
21555 ###
21556 !!test
21557 1. SOL-sensitive wikitext tokens as template-args
21558 !!options
21559 parsoid=wt2html,wt2wt
21560 !! wikitext
21561 {{echo|*a}}
21562 {{echo|#a}}
21563 {{echo|:a}}
21564 !! html
21565 <span about="#mwt1" typeof="mw:Transclusion">
21566 </span><ul about="#mwt1"><li>a</li>
21567 </ul>
21568 <span about="#mwt2" typeof="mw:Transclusion">
21569 </span><ol about="#mwt2"><li>a</li>
21570 </ol>
21571 <span about="#mwt3" typeof="mw:Transclusion">
21572 </span><dl about="#mwt3"><dd>a</dd>
21573 </dl>
21574 !!end
21575
21576 #### -----------------------------------------------------------------
21577 #### Parsoid-specific functionality tests
21578 #### -----------------------------------------------------------------
21579
21580 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
21581 # We know wt2wt will fail, but we expect selser to pass.
21582 # Due to the nature of our testing, wt2wt and selser tests will enter the
21583 # blacklist and we'll catch selser regressions based on changes to the
21584 # blacklist entries for selser tests.
21585 !! test
21586 1. Bad treebuilder fixup of formatting elt is cleaned up
21587 !! options
21588 parsoid=wt2html,wt2wt
21589 !! wikitext
21590 {|
21591 |
21592 <small>
21593 [[Image:Foobar.jpg|right|Test]]
21594 </small>
21595 |}
21596 !! html/parsoid
21597 <table>
21598 <tbody><tr><td>
21599 <small>
21600 <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>
21601 </small>
21602 </td></tr>
21603 </tbody></table>
21604 !! end
21605
21606 !! test
21607 2. Bad treebuilder fixup of formatting elt is cleaned up
21608 !! options
21609 parsoid=wt2html,wt2wt
21610 !! wikitext
21611 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
21612
21613 <small>[[Image:Foobar.jpg|right|300px]]</small>
21614 !! html/parsoid
21615
21616 <p><b>foo</b></p>
21617 <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>
21618 <p><b>bar</b></p>
21619 <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>
21620 !! end
21621
21622 !! test
21623 3. Bad treebuilder fixup of formatting elt is cleaned up
21624 !! options
21625 parsoid=wt2html,wt2wt
21626 !! wikitext
21627 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
21628 !! html/parsoid
21629 <p><small><b>foo</b></small></p>
21630 <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>
21631 <p><small><b>bar</b></small></p>
21632 !! end
21633
21634 !! test
21635 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
21636 !! options
21637 parsoid=wt2html,wt2wt
21638 !! wikitext
21639 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
21640 !! html/parsoid
21641 <p><b><small></small></b></p>
21642 <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>
21643 <p></p>
21644 !! end
21645
21646 #### ----------------------------------------------------------------
21647 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
21648 #### tags. Parsoid's output for these tags differs from that of the
21649 #### PHP parser.
21650 #### ----------------------------------------------------------------
21651
21652 !!test
21653 Ref: 1. ref-location should be replaced with an index span
21654 !! wikitext
21655 A <ref>foo</ref>
21656 B <ref name="x">foo</ref>
21657 C <ref name="y" />
21658 <references />
21659 !! html/parsoid
21660 <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>
21661 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>
21662 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>
21663 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21664 <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>
21665 <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>
21666 <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>
21667 </ol>
21668 !!end
21669
21670 !!test
21671 Ref: 2. ref-tags with identical names should all get the same index
21672 !! wikitext
21673 A <ref name="x">foo</ref>
21674 B <ref name="x" />
21675 <references />
21676 !! html/parsoid
21677 <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>
21678 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>
21679 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21680 <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>
21681 </ol>
21682 !!end
21683
21684 !!test
21685 Ref: 3. spaces in ref-names should be ignored
21686 !! wikitext
21687 A <ref name="x">foo</ref>
21688 B <ref name=" x " />
21689 C <ref name= x />
21690 <references />
21691 !! html/parsoid
21692 <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>
21693 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>
21694 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>
21695 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21696 <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>
21697 </ol>
21698 !!end
21699
21700 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
21701 !!test
21702 Ref: 4. 'constructor' should be accepted as a valid ref-name
21703 !! wikitext
21704 A <ref name="constructor">foo</ref>
21705 <references />
21706 !! html/parsoid
21707 <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>
21708 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21709 <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>
21710 </ol>
21711 !!end
21712
21713 !!test
21714 Ref: 5. body should accept generic wikitext
21715 !! wikitext
21716 A <ref>
21717 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
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="#mwt5" 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">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>
21726 </span></li>
21727 </ol>
21728 !!end
21729
21730 !!test
21731 Ref: 6. indent-pres should not be output in ref-body
21732 !! wikitext
21733 A <ref>
21734 foo
21735 bar
21736 baz
21737 </ref>
21738
21739 <references />
21740 !! html/parsoid
21741 <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>
21742
21743 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21744 <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
21745 bar
21746 baz
21747 </span></li>
21748 </ol>
21749 !!end
21750
21751 !!test
21752 Ref: 7. No p-wrapping in ref-body
21753 !! wikitext
21754 A <ref>
21755 foo
21756
21757 bar
21758
21759
21760 baz
21761
21762
21763
21764 booz
21765 </ref>
21766
21767 <references />
21768 !! html/parsoid
21769 <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>
21770
21771 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21772 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo
21773
21774 bar
21775
21776
21777 baz
21778
21779
21780
21781 booz
21782 </span></li>
21783 </ol>
21784 !!end
21785
21786 !!test
21787 Ref: 8. transclusion wikitext has lower precedence
21788 !! wikitext
21789 A <ref> foo {{echo|</ref> B C}}
21790
21791 <references />
21792 !! html/parsoid
21793 <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>
21794 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21795 <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>
21796 </ol>
21797 !!end
21798
21799 !!test
21800 Ref: 9. unclosed comments should not leak out of ref-body
21801 !! wikitext
21802 A <ref> foo <!--</ref> B C
21803 <references />
21804 !! html/parsoid
21805 <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>
21806 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21807 <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>
21808 </ol>
21809 !!end
21810
21811 !!test
21812 Ref: 10. Unclosed HTML tags should not leak out of ref-body
21813 !! wikitext
21814 A <ref> <b> foo </ref> B C
21815
21816 <references />
21817 !! html/parsoid
21818 <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>
21819
21820
21821 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21822 <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>
21823 </ol>
21824 !!end
21825
21826 !!test
21827 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
21828 !! wikitext
21829 A <ref>foo</ref> B
21830 C <ref>bar</ref> D
21831 <references />
21832 !! html/parsoid
21833 <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
21834 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>
21835 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21836 <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>
21837 <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>
21838 </ol>
21839 !!end
21840
21841 !!test
21842 Ref: 12. ref-tags act as trailing newline migration barrier
21843 !! wikitext
21844 <!--the newline at the end of this line moves out of the p tag-->a
21845
21846 b<!--the newline at the end of this line stays inside the p tag--> <ref />
21847 <ref />
21848
21849 c
21850 <references />
21851 !! html/parsoid
21852 <!--the newline at the end of this line moves out of the p tag--><p>a</p>
21853
21854
21855 <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>
21856 <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>
21857
21858 <p>c</p>
21859 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21860 <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>
21861 <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>
21862 !!end
21863
21864 !!test
21865 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
21866 !! wikitext
21867 <ref>foo</ref> A
21868 <ref>bar
21869 </ref> B
21870 <references />
21871 !! html/parsoid
21872 <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
21873 <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>
21874 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21875 <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>
21876 <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
21877 </span></li>
21878 </ol>
21879 !!end
21880
21881 !!test
21882 Ref: 14. A nested ref-tag should be emitted as plain text
21883 !! wikitext
21884 <ref>foo <ref>bar</ref> baz</ref>
21885
21886 <references />
21887 !! html/parsoid
21888 <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>
21889 </p>
21890 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21891 <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>
21892 </ol>
21893 !!end
21894
21895 !!test
21896 Ref: 15. ref-tags with identical names should get identical indexes
21897 !! wikitext
21898 A1 <ref name="a">foo</ref> A2 <ref name="a" />
21899 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
21900
21901 <references />
21902 !! html/parsoid
21903 <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>
21904 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>
21905
21906 <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>
21907 </ol>
21908 !!end
21909
21910 ## We don't bother wt2wt-ing non-standard whitespace
21911 !!test
21912 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
21913 !!options
21914 parsoid=wt2html
21915 !! wikitext
21916 A <ref >foo</ref >
21917
21918 <references />
21919 !! html/parsoid
21920 <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>
21921 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21922 <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>
21923 !!end
21924
21925 !!test
21926 Ref: 17. Generate valid HTML5 id/about attributes
21927 !!wikitext
21928 <ref name="a b">foo</ref>
21929
21930 <references />
21931 !!html/parsoid
21932 <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>
21933 </p>
21934
21935 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21936 <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>
21937 </ol>
21938 !!end
21939
21940 !!test
21941 Ref: 18. T58916: Extension attributes should be parsed as plain text
21942 !!wikitext
21943 <ref name="{{echo|a}}">foo</ref>
21944
21945 <references />
21946 !!html/parsoid
21947 <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>
21948 </p>
21949
21950 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21951 <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>
21952 </ol>
21953 !!end
21954
21955 !!test
21956 Ref: 19. ref-tags with identical name encodings should get identical indexes
21957 !! wikitext
21958 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
21959
21960 <references />
21961 !! html/parsoid
21962 <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>
21963 </p>
21964 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21965 <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>
21966 </ol>
21967 !!end
21968
21969 !!test
21970 Ref: 20. ref-tags with identical names but different content should keep it
21971 !! wikitext
21972 A <ref name="foo">Foo one</ref>
21973 B <ref name="foo">Foo two</ref>
21974 C <ref name="foo" />
21975
21976 <references />
21977 !! html/parsoid
21978 <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>
21979 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>
21980 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>
21981
21982 <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>
21983 </ol>
21984 !!end
21985
21986 !!test
21987 References: 1. references tag without any refs should be handled properly
21988 !! wikitext
21989 <references />
21990 !! html/parsoid
21991 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
21992 !!end
21993
21994 !!test
21995 References: 2. references tag with group only outputs references from that group
21996 !! wikitext
21997 A <ref group="a">foo</ref>
21998 B <ref group="b">bar</ref>
21999 C <ref>baz</ref>
22000
22001 <references group="a" />
22002 <references />
22003 <references group="b" />
22004 !! html/parsoid
22005 <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>
22006 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>
22007 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>
22008
22009 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="a" data-mw='{"name":"references","attrs":{"group":"a"}}'>
22010 <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>
22011 </ol>
22012 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'>
22013 <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>
22014 </ol>
22015 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt12" data-mw-group="b" data-mw='{"name":"references","attrs":{"group":"b"}}'>
22016 <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>
22017 </ol>
22018 !!end
22019
22020 !!test
22021 References: 3. ref list should be cleared after processing references
22022 !! wikitext
22023 A <ref>foo</ref>
22024
22025 <references />
22026
22027 B <ref>bar</ref>
22028
22029 <references />
22030 !! html/parsoid
22031 <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>
22032
22033 <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>
22034 </ol>
22035
22036 <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>
22037
22038 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22039 <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>
22040 </ol>
22041 !!end
22042
22043 !!test
22044 References: 4. only referenced group should be cleared after processing references
22045 !! wikitext
22046 A <ref group="a">afoo</ref>
22047 B <ref>bfoo</ref>
22048
22049 <references group="a" />
22050
22051 C <ref>cfoo</ref>
22052
22053 <references />
22054 !! html/parsoid
22055 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{"group":"a"}}'><a href="#cite_note-1" data-mw-group="a"><span class="mw-reflink-text">[a 1]</span></a></span>
22056 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>
22057
22058 <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>
22059 </ol>
22060
22061 <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>
22062
22063 <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>
22064 </ol>
22065 !!end
22066
22067 ## Don't expect this to rt since we're dropping content
22068 !! test
22069 References: 5. ref tags in references should be processed while ignoring all other content
22070 !! options
22071 parsoid=wt2html,html2html
22072 !! wikitext
22073 A <ref name="a" />
22074 B <ref name="b">bar</ref>
22075
22076 <references>
22077 <ref name="a">foo</ref>
22078 This should just get lost.
22079 </references>
22080 !! html/parsoid
22081 <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>
22082 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>
22083
22084
22085 <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>
22086 </ol>
22087 !! end
22088
22089 !! test
22090 References: 6. <references /> from a transclusion
22091 !! wikitext
22092 <ref>Foo</ref> {{echo|<references />}}
22093 !! html/parsoid
22094 <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>
22095 </ol>
22096 !! end
22097
22098 !! test
22099 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
22100 !! wikitext
22101 A <ref>foo bar for a</ref>
22102 B <ref group="X" name="b" />
22103
22104 <references />
22105
22106 <references group="X">
22107 <ref name="b">foo</ref>
22108 </references>
22109 !! html/parsoid
22110 <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>
22111 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>
22112 </p>
22113
22114 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22115 <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>
22116 </ol>
22117
22118 <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"}}'>
22119 <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>
22120 </ol>
22121 !! end
22122
22123 !! test
22124 References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
22125 !! wikitext
22126 X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
22127 <references />
22128 !! html/parsoid
22129 <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>
22130 <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>
22131 </ol>
22132 !!end
22133
22134 # This test only works in wt2html now as the <references /> are always generated
22135 # unless selser is active. Once T72722 is fixed, we should add a changes test
22136 # here to ensure that unrelated changes don't add the new <references /> in
22137 # wt2wt.
22138 !! test
22139 References: 9. Generate missing references list at the end
22140 !! wikitext
22141 A <ref>foo</ref>
22142 B <ref group="inexistent">bar</ref>
22143 !! html/parsoid
22144 <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>
22145 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
22146 <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>
22147 </ol>
22148 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="inexistent" data-mw='{"name":"references","attrs":{"group":"inexistent"}}'>
22149 <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>
22150 </ol>
22151 !! end
22152
22153 !! test
22154 References: 10. New <references/> shouldn't be added for unrelated edits.
22155 !! options
22156 parsoid={
22157 "modes": ["selser"],
22158 "changes": [["#x", "remove"]],
22159 "selser": "noauto"
22160 }
22161 !! wikitext
22162 Unrelated text<span id="x"> that's going to disappear</span>.
22163 A <ref>foo</ref>
22164 !! wikitext/edited
22165 Unrelated text.
22166 A <ref>foo</ref>
22167 !!end
22168
22169 !! test
22170 Entities in ref name
22171 !! wikitext
22172 <ref name="test &amp; me">hi</ref>
22173 <references />
22174 !! html/parsoid
22175 <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>
22176 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22177 <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>
22178 </ol>
22179 !! end
22180
22181 # This test is wt2html only because we're permitting the serializer to produce
22182 # dirty diffs, normalizing the unclosed references to the self-closed version.
22183 !! test
22184 Generate references for unclosed references tag
22185 !! options
22186 parsoid=wt2html
22187 !! wikitext
22188 a<ref>foo</ref>
22189
22190 <references>
22191 !! html/parsoid
22192 <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>
22193 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22194 <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>
22195 !! end
22196
22197 !! test
22198 New reference serializes on its own line
22199 !! options
22200 parsoid=wt2wt,html2wt
22201 !! wikitext
22202 foo
22203 <references />
22204 !! html/parsoid
22205 foo<ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
22206 !! end
22207
22208 #### ----------------------------------------------------------------
22209 #### Parsoid-only testing of Parsoid's impl of LST
22210 #### Not implemented yet, see
22211 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
22212 #### ----------------------------------------------------------------
22213
22214 !! test
22215 LST Sections: 1. Simple section start and end
22216 !! options
22217 parsoid={ "suppressErrors": true }
22218 !! wikitext
22219 <section begin="2011-05-16" />
22220 <section end="2014-04-10 (MW 1.23wmf22)" />
22221 !! html/parsoid
22222 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
22223 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
22224 !! end
22225
22226 #--------- Test stripping of empty nodes in template content ----------
22227 !!test
22228 Empty LI and TR nodes should be stripped from template content
22229 !!wikitext
22230 {{EmptyLITest}}
22231 {{EmptyTRTest}}
22232 !!html/parsoid
22233 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
22234 <li>a</li>
22235 <li>b</li>
22236 </ul>
22237 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
22238 <tbody>
22239 <tr>
22240 <td>foo</td>
22241 </tr>
22242 <tr>
22243 <td>bar</td>
22244 </tr>
22245 </tbody>
22246 </table>
22247 !!end
22248
22249 !!test
22250 Empty LI and TR nodes should not be stripped from top-level content
22251 !!wikitext
22252 * a
22253 *
22254 * b
22255 {|
22256 |-
22257 |-
22258 |foo
22259 |}
22260 !!html/parsoid
22261 <ul>
22262 <li> a</li>
22263 <li></li>
22264 <li> b</li>
22265 </ul>
22266 <table>
22267 <tbody>
22268 <tr></tr>
22269 <tr>
22270 <td>foo</td>
22271 </tr>
22272 </tbody>
22273 </table>
22274 !!end
22275
22276 !!test
22277 Empty TR nodes should not be stripped if they have any attributes set
22278 !!wikitext
22279 {{EmptyTRWithHTMLAttrTest}}
22280 !!html/parsoid
22281 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
22282 <tr align="center"></tr>
22283 <tr><td>foo</td></tr>
22284 <tr align="center"></tr>
22285 <tr><td>bar</td></tr>
22286 </table>
22287 !!end
22288
22289 #### ----------------------------------------------------------------
22290 #### The following section of tests are primarily to test
22291 #### wikitext escaping capabilities of Parsoid. Given that
22292 #### escaping can be done any number of ways, the wikitext (input)
22293 #### is always adjusted to reflect how Parsoid adds nowiki
22294 #### escape tags.
22295 ####
22296 #### We are marking several tests as parsoid-only since the
22297 #### HTML in the result section is different from what the
22298 #### PHP parser generates for it.
22299 #### ----------------------------------------------------------------
22300
22301
22302 #### --------------- Headings ---------------
22303 #### 0. Unnested
22304 #### 1. Nested inside html <h1>=foo=</h1>
22305 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
22306 #### 3. Nested inside html with wikitext split by html tags
22307 #### 4. No escape needed
22308 #### 5. Empty headings <h1></h1>
22309 #### 6. Heading chars in SOL context
22310 #### ----------------------------------------
22311 !! test
22312 Headings: 0. Unnested
22313 !! options
22314 parsoid=html2wt
22315 !! html/parsoid
22316 <p>=foo=</p>
22317
22318 <p> =foo=
22319 <!--cmt-->
22320 =foo=</p>
22321
22322 <p>=foo<i>a</i>=</p>
22323 !! wikitext
22324 <nowiki>=foo=</nowiki>
22325
22326 <nowiki> </nowiki>=foo=
22327 <!--cmt-->
22328 <nowiki>=foo=</nowiki>
22329
22330 =foo''a''<nowiki>=</nowiki>
22331 !!end
22332
22333 # New headings and existing headings are handled differently
22334 !! test
22335 Headings: 1. Nested inside html
22336 !! options
22337 parsoid=html2wt
22338 !! html/parsoid
22339 <h1>=foo=</h1>
22340 <h2>=foo=</h2>
22341 <h3>=foo=</h3>
22342
22343 <h1 data-parsoid=''>=foo=</h1>
22344 <h2 data-parsoid=''>=foo=</h2>
22345 <h3 data-parsoid=''>=foo=</h3>
22346 <h4 data-parsoid=''>=foo=</h4>
22347 <h5 data-parsoid=''>=foo=</h5>
22348 <h6 data-parsoid=''>=foo=</h6>
22349 !! wikitext
22350 = =foo= =
22351
22352 == =foo= ==
22353
22354 === =foo= ===
22355
22356 =<nowiki>=foo=</nowiki>=
22357 ==<nowiki>=foo=</nowiki>==
22358 ===<nowiki>=foo=</nowiki>===
22359 ====<nowiki>=foo=</nowiki>====
22360 =====<nowiki>=foo=</nowiki>=====
22361 ======<nowiki>=foo=</nowiki>======
22362
22363 !!end
22364
22365 !! test
22366 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
22367 !! options
22368 parsoid=html2wt
22369 !! html/parsoid
22370 <h1>foo</h1>*bar
22371 <h1>foo</h1>=bar
22372 <h1>foo</h1>=bar=
22373 !! wikitext
22374 = foo =
22375 <nowiki>*</nowiki>bar
22376
22377 = foo =
22378 =bar
22379
22380 = foo =
22381 <nowiki>=bar=</nowiki>
22382 !!end
22383
22384 !! test
22385 Headings: 3. Nested inside html with wikitext split by html tags
22386 !! options
22387 parsoid=html2wt
22388 !! html/parsoid
22389 <h1>=<b>bold</b>foo=</h1>
22390 !! wikitext
22391 = ='''bold'''foo= =
22392 !!end
22393
22394 !! test
22395 Headings: 4a. No escaping needed (testing just h1 and h2)
22396 !! options
22397 parsoid=html2wt
22398 !! html/parsoid
22399 <h1>=foo</h1>
22400 <h1>foo=</h1>
22401 <h1> =foo= </h1>
22402 <h1>=foo= bar</h1>
22403 <h2>=foo</h2>
22404 <h2>foo=</h2>
22405 <h1>=</h1>
22406 <h1><i>=</i>foo=</h1>
22407 !! wikitext
22408 = =foo =
22409
22410 = foo= =
22411
22412 = =foo= =
22413
22414 = =foo= bar =
22415
22416 == =foo ==
22417
22418 == foo= ==
22419
22420 = = =
22421
22422 = ''=''foo= =
22423 !!end
22424
22425 !! test
22426 Headings: 4b. No escaping needed (inside p-tags)
22427 !! options
22428 parsoid=html2wt
22429 !! html/parsoid
22430 <p>===
22431 =foo= x
22432 =foo= <s></s>
22433 </p>
22434 !! wikitext
22435 ===
22436 =foo= x
22437 =foo= <s></s>
22438 !!end
22439
22440 !! test
22441 Headings: 5. Empty headings
22442 !! options
22443 parsoid=html2wt
22444 !! html/parsoid
22445 <h1 data-parsoid='{}'></h1>
22446
22447 <h2 data-parsoid='{}'></h2>
22448
22449 <h3 data-parsoid='{}'></h3>
22450
22451 <h4 data-parsoid='{}'></h4>
22452
22453 <h5 data-parsoid='{}'></h5>
22454
22455 <h6 data-parsoid='{}'></h6>
22456 !! wikitext
22457 =<nowiki/>=
22458
22459 ==<nowiki/>==
22460
22461 ===<nowiki/>===
22462
22463 ====<nowiki/>====
22464
22465 =====<nowiki/>=====
22466
22467 ======<nowiki/>======
22468 !!end
22469
22470 !! test
22471 Headings: 6a. Heading chars in SOL context (with trailing spaces)
22472 !! options
22473 parsoid=html2wt
22474 !! html/parsoid
22475 <p>=a=</p>
22476
22477 <p>=a=</p>
22478
22479 <p>=a=</p>
22480 !! wikitext
22481 <nowiki>=a=</nowiki>
22482
22483 <nowiki>=a=</nowiki>
22484
22485 <nowiki>=a=</nowiki>
22486 !!end
22487
22488 !! test
22489 Headings: 6b. Heading chars in SOL context (with trailing newlines)
22490 !! options
22491 parsoid=html2wt
22492 !! html/parsoid
22493 <p>=a=
22494 b</p>
22495
22496 <p>=a=
22497 b</p>
22498
22499 <p>=a=
22500 b</p>
22501 !! wikitext
22502 <nowiki>=a=</nowiki>
22503 b
22504
22505 <nowiki>=a=</nowiki>
22506 b
22507
22508 <nowiki>=a=</nowiki>
22509 b
22510 !!end
22511
22512 !! test
22513 Headings: 6c. Heading chars in SOL context (leading newline break)
22514 !! options
22515 parsoid=html2wt
22516 !! html/parsoid
22517 <p>a
22518 =b=</p>
22519 !! wikitext
22520 a
22521 <nowiki>=b=</nowiki>
22522 !!end
22523
22524 !! test
22525 Headings: 6d. Heading chars in SOL context (with interspersed comments)
22526 !! options
22527 parsoid=html2wt
22528 !! html/parsoid
22529 <!--c0--><p>=a=</p>
22530
22531 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
22532 !! wikitext
22533 <!--c0--><nowiki>=a=</nowiki>
22534
22535 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
22536 !!end
22537
22538 !! test
22539 Headings: 6d. Heading chars in SOL context (No escaping needed)
22540 !! options
22541 parsoid=html2wt
22542 !! html/parsoid
22543 =a=<div>b</div>
22544 !! wikitext
22545 =a=<div>b</div>
22546 !!end
22547
22548 !! test
22549 Headings: 7. Insert a newline between new content and headings
22550 !! options
22551 parsoid=html2wt
22552 !! html/parsoid
22553 <h2>NEW</h2>
22554 <p>new</p>
22555 <h2 data-parsoid='{}'>A</h2>
22556 <p data-parsoid='{}'>a</p>
22557 !! wikitext
22558 == NEW ==
22559 new
22560
22561 ==A==
22562 a
22563
22564 !! end
22565
22566 #### --------------- Lists ---------------
22567 #### 0. Outside nests (*foo, etc.)
22568 #### 1. Nested inside html <ul><li>*foo</li></ul>
22569 #### 2. Inside definition lists
22570 #### 3. Only bullets at start should be escaped
22571 #### 4. No escapes needed
22572 #### 5. No unnecessary escapes
22573 #### 6. Escape bullets in SOL position
22574 #### 7. Escape bullets in a multi-line context
22575 #### ----------------------------------------
22576
22577 !! test
22578 Lists: 0. Outside nests
22579 !! options
22580 parsoid=html2wt
22581 !! html/parsoid
22582 <p>*foo</p>
22583
22584 <p>#foo</p>
22585
22586 <p>;Foo:bar</p>
22587 !! wikitext
22588 <nowiki>*</nowiki>foo
22589
22590 <nowiki>#</nowiki>foo
22591
22592 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
22593 !!end
22594
22595 ## Making these next 3 tests Parsoid-only since they are html2wt tests
22596 ## to test wikitext escaping, and insignificant whitespace diffs
22597 ## cause PHP parser tests to barf
22598 !! test
22599 Lists: 1. Nested inside html (No unnecessary escapes)
22600 !! options
22601 parsoid=html2wt
22602 !! html/parsoid
22603 <ul>
22604 <li>*foo</li>
22605 <li>#foo</li>
22606 <li>:foo</li>
22607 <li>;foo</li>
22608 <li data-parsoid='{}'>*foo</li>
22609 <li data-parsoid='{}'>#foo</li>
22610 <li data-parsoid='{}'>:foo</li>
22611 <li data-parsoid='{}'>;foo</li>
22612 </ul>
22613
22614 <ol>
22615 <li>*foo</li>
22616 <li>#foo</li>
22617 <li>:foo</li>
22618 <li>;foo</li>
22619 <li data-parsoid='{}'>*foo</li>
22620 <li data-parsoid='{}'>#foo</li>
22621 <li data-parsoid='{}'>:foo</li>
22622 <li data-parsoid='{}'>;foo</li>
22623 </ol>
22624 !! wikitext
22625 * *foo
22626 * #foo
22627 * :foo
22628 * ;foo
22629 *<nowiki>*foo</nowiki>
22630 *<nowiki>#foo</nowiki>
22631 *<nowiki>:foo</nowiki>
22632 *<nowiki>;foo</nowiki>
22633
22634 # *foo
22635 # #foo
22636 # :foo
22637 # ;foo
22638 #<nowiki>*foo</nowiki>
22639 #<nowiki>#foo</nowiki>
22640 #<nowiki>:foo</nowiki>
22641 #<nowiki>;foo</nowiki>
22642 !!end
22643
22644 !! test
22645 Lists: 2. Inside definition lists
22646 !! options
22647 parsoid=html2wt
22648 !! html/parsoid
22649 <dl><dt>;foo</dt></dl>
22650 <dl><dt>:foo</dt></dl>
22651 <dl><dt>:foo</dt>
22652 <dd>bar</dd></dl>
22653 <dl><dd>:foo</dd></dl>
22654 !! wikitext
22655 ; ;foo
22656
22657 ; <nowiki>:foo</nowiki>
22658
22659 ; <nowiki>:foo</nowiki>
22660 : bar
22661
22662 : :foo
22663 !!end
22664
22665 !! test
22666 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
22667 !! options
22668 parsoid=html2wt
22669 !! html/parsoid
22670 <ul>
22671 <li>*foo*bar</li>
22672 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
22673 </ul>
22674 !! wikitext
22675 * *foo*bar
22676 *<nowiki>*foo</nowiki>''it''*bar
22677 !!end
22678
22679 !! test
22680 Lists: 4. No escapes needed
22681 !! options
22682 parsoid=html2wt
22683 !! html/parsoid
22684 <ul>
22685 <li>foo*bar
22686 </li>
22687 </ul>
22688 <ul>
22689 <li><i>foo</i>*bar
22690 </li>
22691 </ul>
22692 <ul>
22693 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
22694 </li>
22695 </ul>
22696 <ul>
22697 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
22698 </li>
22699 </ul>
22700 !! wikitext
22701 *foo*bar
22702
22703 *''foo''*bar
22704
22705 *[[Foo]]: bar
22706
22707 *[[Foo]]*bar
22708 !!end
22709
22710 !! test
22711 Lists: 5. No unnecessary escapes
22712 !! options
22713 parsoid=html2wt
22714 !! html/parsoid
22715 <ul><li> bar <span>[[foo]]</span></li></ul>
22716 <ul><li> =bar <span>[[foo]]</span></li></ul>
22717 <ul><li> [[bar <span>[[foo]]</span></li></ul>
22718 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
22719 <ul><li> =bar <span>foo]]</span>=</li></ul>
22720 <ul><li> <s></s>: a</li></ul>
22721 <ul><li> <i>* foo</i></li></ul>
22722
22723 !! wikitext
22724 * bar <span><nowiki>[[foo]]</nowiki></span>
22725
22726 * =bar <span><nowiki>[[foo]]</nowiki></span>
22727
22728 * [[bar <span><nowiki>[[foo]]</nowiki></span>
22729
22730 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
22731
22732 * =bar <span>foo]]</span>=
22733
22734 * <s></s>: a
22735
22736 * ''* foo''
22737 !!end
22738
22739 !! test
22740 Lists: 6. Escape bullets in SOL position
22741 !! options
22742 parsoid=html2wt
22743 !! html/parsoid
22744 <p><!--cmt-->*foo</p>
22745 !! wikitext
22746 <!--cmt--><nowiki>*</nowiki>foo
22747 !!end
22748
22749 !! test
22750 Lists: 7. Escape bullets in a multi-line context
22751 !! options
22752 parsoid=html2wt
22753 !! html/parsoid
22754 <p>a
22755 *b
22756 </p>
22757 !! wikitext
22758 a
22759 <nowiki>*</nowiki>b
22760 !!end
22761
22762 !! test
22763 Lists: 8. Escape colons only if not present in tags
22764 !! options
22765 parsoid=html2wt
22766 !! html/parsoid
22767 <dl><dt>a:b<i>c:d</i></dt></dl>
22768 !! wikitext
22769 ; <nowiki>a:b</nowiki>''c:d''
22770 !! end
22771
22772 #### --------------- HRs ---------------
22773 #### 1. Single line
22774 #### -----------------------------------
22775
22776 !! test
22777 HRs: 1. Single line
22778 !! options
22779 parsoid=html2wt
22780 !! html/parsoid
22781 <hr />----
22782 <hr />=foo=
22783 <hr />*foo
22784 !! wikitext
22785 ----<nowiki>----</nowiki>
22786 ----=foo=
22787 ----*foo
22788 !! end
22789
22790 #### --------------- Tables ---------------
22791 #### 1a. Simple example
22792 #### 1b. No escaping needed (!foo)
22793 #### 1c. No escaping needed (|foo)
22794 #### 1d. No escaping needed (|}foo)
22795 ####
22796 #### 2a. Nested in td (<td>foo|bar</td>)
22797 #### 2b. Nested in td (<td>foo||bar</td>)
22798 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
22799 ####
22800 #### 3a. Nested in th (<th>foo!bar</th>)
22801 #### 3b. Nested in th (<th>foo!!bar</th>)
22802 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
22803 ####
22804 #### 4a. Escape -
22805 #### 4b. Escape +
22806 #### 4c. No escaping needed
22807 #### --------------------------------------
22808
22809 !! test
22810 Tables: 1a. Simple example
22811 !! options
22812 parsoid=html2wt
22813 !! html/parsoid
22814 <p>{|
22815 |}
22816 </p>
22817 !! wikitext
22818 <nowiki>{|</nowiki>
22819 |}
22820 !! end
22821
22822 !! test
22823 Tables: 1b. No escaping needed
22824 !! options
22825 parsoid=html2wt
22826 !! html/parsoid
22827 <p>!foo
22828 </p>
22829 !! wikitext
22830 !foo
22831 !! end
22832
22833 !! test
22834 Tables: 1c. No escaping needed
22835 !! options
22836 parsoid=html2wt
22837 !! html/parsoid
22838 <p>|foo
22839 </p>
22840 !! wikitext
22841 |foo
22842 !! end
22843
22844 !! test
22845 Tables: 1d. No escaping needed
22846 !! options
22847 parsoid=html2wt
22848 !! html/parsoid
22849 <p>|}foo
22850 </p>
22851 !! wikitext
22852 |}foo
22853 !! end
22854
22855 !! test
22856 Tables: 2a. Nested in td
22857 !! options
22858 parsoid=html2wt
22859 !! html/parsoid
22860 <table><tbody><tr>
22861 <td>foo|bar</td></tr>
22862 <tr><td>x<div>a|b</div></td>
22863 </tbody></table>
22864 !! wikitext
22865 {|
22866 |<nowiki>foo|bar</nowiki>
22867 |-
22868 |x<div><nowiki>a|b</nowiki></div>
22869 |}
22870 !! html/php+tidy
22871 <table>
22872 <tr>
22873 <td>foo|bar</td>
22874 </tr>
22875 <tr>
22876 <td>x
22877 <div>a|b</div>
22878 </td>
22879 </tr>
22880 </table>
22881 !! end
22882
22883 !! test
22884 Tables: 2b. Nested in td
22885 !! options
22886 parsoid=html2wt
22887 !! html/parsoid
22888 <table><tbody><tr>
22889 <td>foo||bar</td>
22890 <td>a<i>b||c</i></td>
22891 <td>a<i><div>b||c</div></i></td>
22892 </tr></tbody></table>
22893 !! wikitext
22894 {|
22895 |<nowiki>foo||bar</nowiki>
22896 |a''<nowiki>b||c</nowiki>''
22897 |a''<div><nowiki>b||c</nowiki></div>''
22898 |}
22899 !! html/php
22900 <table>
22901 <tr>
22902 <td>foo||bar
22903 </td>
22904 <td>a<i>b||c</i>
22905 </td>
22906 <td>a<i><div>b||c</div></i>
22907 </td></tr></table>
22908
22909 !! end
22910
22911 !! test
22912 Tables: 2c. Nested in td -- no escaping needed
22913 !! options
22914 parsoid=html2wt
22915 !! html/*
22916 <table>
22917
22918 <tr>
22919 <td>foo!!bar
22920 </td></tr></table>
22921
22922 !! wikitext
22923 {|
22924
22925 |foo!!bar
22926 |}
22927 !! end
22928
22929 !! test
22930 Tables: 3a. Nested in th
22931 !! options
22932 parsoid=html2wt
22933 !! html/*
22934 <table>
22935
22936 <tr>
22937 <th>foo!bar
22938 </th></tr></table>
22939
22940 !! wikitext
22941 {|
22942
22943 !foo!bar
22944 |}
22945 !! end
22946
22947 !! test
22948 Tables: 3b. Nested in th
22949 !! options
22950 parsoid=html2wt
22951 !! html/parsoid
22952 <table><tbody>
22953 <tr><th>foo!!bar</th>
22954 <th><i>foo|bar</i></th>
22955 <th><i>foo!!bar</i></th>
22956 <th><i><span>foo!!bar</span></i></th>
22957 </tr></tbody></table>
22958 !! wikitext
22959 {|
22960 !<nowiki>foo!!bar</nowiki>
22961 !''<nowiki>foo|bar</nowiki>''
22962 !''<nowiki>foo!!bar</nowiki>''
22963 !''<span><nowiki>foo!!bar</nowiki></span>''
22964 |}
22965 !! html/php
22966 <table>
22967 <tr>
22968 <th>foo!!bar
22969 </th>
22970 <th><i>foo|bar</i>
22971 </th>
22972 <th><i>foo!!bar</i>
22973 </th>
22974 <th><i><span>foo!!bar</span></i>
22975 </th></tr></table>
22976
22977 !! end
22978
22979 !! test
22980 Tables: 3c. Nested in th
22981 !! options
22982 parsoid=html2wt
22983 !! html/parsoid
22984 <table><tbody>
22985 <tr><th>foo||bar</th>
22986 <th><span typeof="mw:Nowiki">foo||bar</span></th>
22987 </tr></tbody></table>
22988 !! wikitext
22989 {|
22990 !<nowiki>foo||bar</nowiki>
22991 !<nowiki>foo||bar</nowiki>
22992 |}
22993 !! html/php
22994 <table>
22995 <tr>
22996 <th>foo||bar
22997 </th>
22998 <th>foo||bar
22999 </th></tr></table>
23000
23001 !! end
23002
23003 !! test
23004 Tables: 4a. Escape -
23005 !! options
23006 parsoid=html2wt
23007 !! html/*
23008 <table>
23009
23010 <tr>
23011 <th>-bar
23012 </th></tr>
23013 <tr>
23014 <td>-bar
23015 </td></tr></table>
23016
23017 !! wikitext
23018 {|
23019
23020 !-bar
23021
23022 |-
23023 |<nowiki>-bar</nowiki>
23024 |}
23025 !! end
23026
23027 !! test
23028 Tables: 4b. Escape +
23029 !! options
23030 parsoid=html2wt
23031 !! html/*
23032 <table>
23033
23034 <tr>
23035 <th>+bar
23036 </th></tr>
23037 <tr>
23038 <td>+bar
23039 </td></tr></table>
23040
23041 !! wikitext
23042 {|
23043
23044 !+bar
23045
23046 |-
23047 |<nowiki>+bar</nowiki>
23048 |}
23049 !! end
23050
23051 !! test
23052 Tables: 4c. No escaping needed
23053 !! options
23054 parsoid=html2wt
23055 !! html/parsoid
23056 <table><tbody>
23057 <tr><td>foo-bar</td><td>foo+bar</td></tr>
23058 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
23059 <tr><td>foo
23060 <p>bar|baz
23061 +bar
23062 -bar</p></td></tr>
23063 <tr><td>x
23064 <div>a|b</div></td>
23065 </tbody></table>
23066 !! wikitext
23067 {|
23068 |foo-bar
23069 |foo+bar
23070 |-
23071 |''foo''-bar
23072 |''foo''+bar
23073 |-
23074 |foo
23075 bar|baz
23076 +bar
23077 -bar
23078 |-
23079 |x
23080 <div>a|b</div>
23081 |}
23082 !! html/php
23083 <table>
23084 <tr>
23085 <td>foo-bar
23086 </td>
23087 <td>foo+bar
23088 </td></tr>
23089 <tr>
23090 <td><i>foo</i>-bar
23091 </td>
23092 <td><i>foo</i>+bar
23093 </td></tr>
23094 <tr>
23095 <td>foo
23096 <p>bar|baz
23097 +bar
23098 -bar
23099 </p>
23100 </td></tr>
23101 <tr>
23102 <td>x
23103 <div>a|b</div>
23104 </td></tr></table>
23105
23106 !! end
23107
23108 !! test
23109 Tables: 4d. No escaping needed
23110 !! options
23111 parsoid=html2wt
23112 !! html/parsoid
23113 <table>
23114 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
23115 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
23116 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
23117 </tbody></table>
23118 !! wikitext
23119 {|
23120 |[[Foo]]-bar
23121 ||+1
23122 ||-2
23123 |}
23124 !! html/php
23125 <table>
23126 <tr>
23127 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
23128 </td>
23129 <td>+1
23130 </td>
23131 <td>-2
23132 </td></tr></table>
23133
23134 !! end
23135
23136 !! test
23137 T97430: Don't emit empty nowiki pairs around marker meta tags
23138 !! options
23139 parsoid=html2wt
23140 !! html/parsoid
23141 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
23142 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
23143 !! wikitext
23144 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
23145 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
23146 !! end
23147
23148 !! test
23149 Unclosed xmlish element in table line shouldn't eat end delimiters
23150 !! options
23151 parsoid=html2wt
23152 !! html/parsoid
23153 <table>
23154 <tbody><tr><td> &lt;foo</td>
23155 <td> bar></td></tr>
23156 </tbody></table>
23157 !! wikitext
23158 {|
23159 | <foo
23160 | bar>
23161 |}
23162 !! html/php
23163 <table>
23164 <tr>
23165 <td> &lt;foo
23166 </td>
23167 <td> bar&gt;
23168 </td></tr></table>
23169
23170 !! end
23171
23172 #### --------------- Links ----------------
23173 #### 1. Quote marks in link text
23174 #### 2. Wikilinks: Escapes needed
23175 #### 3. Wikilinks: No escapes needed
23176 #### 4. Extlinks: Escapes needed
23177 #### 5. Extlinks: No escapes needed
23178 #### --------------------------------------
23179 !! test
23180 Links 1. WikiLinks: No escapes needed
23181 !! options
23182 parsoid=html2wt
23183 !! html/parsoid
23184 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
23185 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
23186 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
23187 !! wikitext
23188 [[Foo|Foo''boo'']]
23189 [[Foo|[Foobar]]]
23190 [[Foo|x [Foobar] x]]
23191 !! html/php
23192 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
23193 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
23194 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
23195 </p>
23196 !! end
23197
23198 !! test
23199 Links 2. WikiLinks: Escapes needed
23200 !! options
23201 parsoid=html2wt
23202 !! html/parsoid
23203 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
23204 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
23205 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
23206 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
23207 <a href="Foo" rel="mw:WikiLink">|Bar</a>
23208 <a href="Foo" rel="mw:WikiLink">]]bar</a>
23209 <a href="Foo" rel="mw:WikiLink">[[bar</a>
23210 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
23211 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
23212 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
23213 !! wikitext
23214 [[Foo|<nowiki>Foobar]</nowiki>]]
23215 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
23216 [[Foo|<nowiki>[[Bar]]</nowiki>]]
23217 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
23218 [[Foo|<nowiki>|Bar</nowiki>]]
23219 [[Foo|<nowiki>]]bar</nowiki>]]
23220 [[Foo|<nowiki>[[bar</nowiki>]]
23221 [[Foo|<nowiki>x [[ y</nowiki>]]
23222 [[Foo|<nowiki>x ]] y</nowiki>]]
23223 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
23224 !! html/php
23225 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
23226 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
23227 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
23228 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
23229 <a href="/wiki/Foo" title="Foo">|Bar</a>
23230 <a href="/wiki/Foo" title="Foo">]]bar</a>
23231 <a href="/wiki/Foo" title="Foo">[[bar</a>
23232 <a href="/wiki/Foo" title="Foo">x [[ y</a>
23233 <a href="/wiki/Foo" title="Foo">x ]] y</a>
23234 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
23235 </p>
23236 !! end
23237
23238 !! test
23239 Links 3. WikiLinks: No escapes needed
23240 !! options
23241 parsoid=html2wt
23242 !! html/parsoid
23243 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
23244 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
23245 !! wikitext
23246 [[Foo|[Foobar]]
23247 [[Foo|foo|bar]]
23248 !! html/php
23249 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
23250 <a href="/wiki/Foo" title="Foo">foo|bar</a>
23251 </p>
23252 !! end
23253
23254 !! test
23255 Links 4. ExtLinks: Escapes needed
23256 !! options
23257 parsoid=html2wt
23258 !! html/parsoid
23259 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
23260 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
23261 <p>[http://google.com]</p>
23262 <p>[http://google.com google]</p>
23263 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
23264 <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>
23265 !! wikitext
23266 [http://google.com <nowiki>[google]</nowiki>]
23267 [http://google.com <nowiki>google]</nowiki>]
23268
23269 <nowiki>[http://google.com]</nowiki>
23270
23271 <nowiki>[http://google.com google]</nowiki>
23272
23273 [http://google.com<nowiki>]</nowiki>
23274
23275 [{{echo|http://google.com}}<nowiki>]</nowiki>
23276 !! html/php
23277 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
23278 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
23279 </p><p>[http://google.com]
23280 </p><p>[http://google.com google]
23281 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
23282 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
23283 </p>
23284 !! end
23285
23286 !! test
23287 Links 5. ExtLinks: No escapes needed
23288 !! options
23289 parsoid=html2wt
23290 !! html/parsoid
23291 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
23292 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
23293 !! wikitext
23294 [http://google.com [google]
23295
23296 [[http://google.com]]
23297 !! html/php
23298 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
23299 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
23300 </p>
23301 !! end
23302
23303 !! test
23304 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
23305 !! options
23306 parsoid=html2wt
23307 !! html/parsoid
23308 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
23309 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
23310 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
23311 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
23312 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
23313 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
23314 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
23315 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
23316 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
23317 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
23318 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
23319 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
23320 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
23321 </p>
23322 !! wikitext
23323 x<nowiki/>http://example.com<nowiki/>y
23324 http://example.com<nowiki/>?x
23325 http://example.com<nowiki/>&x
23326 http://example.com<nowiki/>'x
23327 http://example.com<nowiki/>,x
23328 http://example.com<nowiki/>.x
23329 http://example.com<nowiki/>;x
23330 http://example.com<nowiki/>:x
23331 http://example.com<nowiki/>;x
23332 http://example.com<nowiki/>!x
23333 http://example.com<nowiki/>=x
23334 http://example.com<nowiki/>(x)
23335 http://example.com(x<nowiki/>)
23336 !! end
23337
23338 !! test
23339 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
23340 !! options
23341 parsoid=html2wt
23342 !! html/parsoid
23343 <p>x
23344 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
23345 y
23346 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
23347 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
23348 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
23349 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
23350 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
23351 </p>
23352 !! wikitext
23353 x
23354 http://example.com
23355 y
23356 "http://example.com"
23357 (http://example.com)
23358 (http://example.com) foo
23359 http://example.com,
23360 http://example.com, foo
23361 !! html/php
23362 <p>x
23363 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
23364 y
23365 "<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 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
23368 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
23369 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
23370 </p>
23371 !! end
23372
23373 !! test
23374 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
23375 !! options
23376 parsoid=html2wt
23377 !! html/parsoid
23378 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
23379 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
23380 !! wikitext
23381 http://example.com.,;:!?\
23382 -http://example.com:
23383 !! html/php
23384 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
23385 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
23386 </p>
23387 !! end
23388
23389 !! test
23390 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
23391 !! options
23392 parsoid=html2wt
23393 !! html/parsoid
23394 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
23395 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
23396 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
23397 !! wikitext
23398 RFC 123<nowiki/>4
23399 RFC 123<nowiki/>y
23400 X<nowiki/>RFC 123<nowiki/>y
23401 !! end
23402
23403 !! test
23404 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
23405 !! options
23406 parsoid=html2wt
23407 !! html/parsoid
23408 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
23409 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
23410 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
23411 </p>
23412 !! wikitext
23413 RFC 123?foo
23414 RFC 123&foo
23415 -RFC 123-
23416 !! html/php
23417 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
23418 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
23419 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
23420 </p>
23421 !! end
23422
23423 !! test
23424 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
23425 !! options
23426 parsoid=html2wt
23427 !! html/parsoid
23428 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
23429 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
23430 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
23431 !! wikitext
23432 PMID 123<nowiki/>4
23433 PMID 123<nowiki/>y
23434 X<nowiki/>PMID 123<nowiki/>y
23435 !! end
23436
23437 !! test
23438 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
23439 !! options
23440 parsoid=html2wt
23441 !! html/parsoid
23442 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
23443 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
23444 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
23445 </p>
23446 !! wikitext
23447 PMID 123?foo
23448 PMID 123&foo
23449 -PMID 123-
23450 !! html/php
23451 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
23452 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
23453 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
23454 </p>
23455 !! end
23456
23457 !! test
23458 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
23459 !! options
23460 parsoid=html2wt
23461 !! html/parsoid
23462 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
23463 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
23464 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
23465 </p>
23466 !! wikitext
23467 ISBN 1234567890<nowiki/>1
23468 ISBN 1234567890<nowiki/>x
23469 a<nowiki/>ISBN 1234567890<nowiki/>b
23470 !! end
23471
23472 !! test
23473 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
23474 !! options
23475 parsoid=html2wt
23476 !! html/parsoid
23477 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
23478 !! wikitext
23479 -ISBN 1234567890's
23480 !! html/php
23481 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
23482 </p>
23483 !! end
23484
23485 !! test
23486 Links 14. Protect link-like plain text. (Parsoid bug T78425)
23487 !! options
23488 parsoid=html2wt
23489 !! html/*
23490 <p>this is not a link: http://example.com
23491 </p>
23492 !! wikitext
23493 this is not a link: <nowiki>http://example.com</nowiki>
23494 !! end
23495
23496 !! test
23497 Links 15. Link trails can't become link prefixes.
23498 !! options
23499 language=is
23500 parsoid=html2wt
23501 !! html/parsoid
23502 <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>
23503 !! wikitext
23504 [[Söfnuður]]-[[00]]
23505 !! html/php
23506 <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>
23507 </p>
23508 !! end
23509
23510 #### --------------- Quotes ---------------
23511 #### 1. Quotes inside <b> and <i>
23512 #### 2. Link fragments separated by <i> and <b> tags
23513 #### 3. Link fragments inside <i> and <b>
23514 #### 4. No escaping needed
23515 #### --------------------------------------
23516 !! test
23517 1a. Quotes inside <b> and <i>
23518 !! options
23519 parsoid=html2wt
23520 !! html/*
23521 <p><i>'foo'</i>
23522 <i>''foo''</i>
23523 <i>'''foo'''</i>
23524 <i>foo</i>'s
23525 <b>'foo'</b>
23526 <b>''foo''</b>
23527 <b>'''foo'''</b>
23528 <b>foo'<i>bar'</i>baz</b>
23529 <b>foo</b>'s
23530 '<i>foo</i>
23531 <i>foo</i>'
23532 <i>foo'</i>'
23533 '<i>foo</i>'
23534 '<b>foo</b>
23535 <b>foo</b>'
23536 '<b>foo</b>'
23537 <i>fools'<span> errand</span></i>
23538 <i><span>fool</span>'s errand</i>
23539 '<i>foo</i> bar '<i>baz</i>
23540 a|!*#-:;+-~[]{}b'<i>x</i>
23541 </p>
23542 !! wikitext
23543 ''<nowiki/>'foo'''
23544 ''<nowiki>''foo''</nowiki>''
23545 ''<nowiki>'''foo'''</nowiki>''
23546 ''foo''<nowiki/>'s
23547 '''<nowiki/>'foo''''
23548 '''<nowiki>''foo''</nowiki>'''
23549 '''<nowiki>'''foo'''</nowiki>'''
23550 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
23551 '''foo'''<nowiki/>'s
23552 '''foo''
23553 ''foo''<nowiki/>'
23554 ''foo'''<nowiki/>'
23555 '''foo''<nowiki/>'
23556 ''''foo'''
23557 '''foo'''<nowiki/>'
23558 ''''foo'''<nowiki/>'
23559 ''fools'<span> errand</span>''
23560 ''<span>fool</span>'s errand''
23561 '<nowiki/>''foo'' bar '''baz''
23562 a|!*#-:;+-~[]{}b'''x''
23563 !! end
23564
23565 !! test
23566 1b. Quotes inside <b> and <i> with other tags on same line
23567 !! options
23568 parsoid=html2wt
23569 !! html/parsoid
23570 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
23571 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
23572 <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>
23573 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
23574 '<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>
23575 '<i>foo</i> <div title="name">test</div>
23576 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
23577 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
23578 <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>
23579 </ol>
23580 !! wikitext
23581 '''a'' foo ''[[bar]]''
23582 ''a''' foo ''[[bar]]''
23583 ''a''' foo '''{{echo|[[bar]]}}'''
23584 [[foo]] x'''[[bar]]''
23585 '''foo'' <ref>test</ref>
23586 '''foo'' <div title="name">test</div>
23587 '''foo'' and <br> bar
23588 <references />
23589 !! end
23590
23591 !! test
23592 2. Link fragments separated by <i> and <b> tags
23593 !! options
23594 parsoid=html2wt
23595 !! html/parsoid
23596 <p>[[<i>foo</i>hello]]</p>
23597 <p>[[<b>foo</b>hello]]</p>
23598 !! wikitext
23599 [[''foo''<nowiki>hello]]</nowiki>
23600
23601 [['''foo'''<nowiki>hello]]</nowiki>
23602 !! end
23603
23604 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
23605 # this is one of the shortcomings of this format
23606 !! test
23607 3. Link fragments inside <i> and <b>
23608 !! options
23609 parsoid=html2wt
23610 !! html/parsoid
23611 <p><i>[[foo</i>]]</p>
23612 <p><b>[[foo</b>]]</p>
23613 !! wikitext
23614 ''[[foo''<nowiki>]]</nowiki>
23615
23616 '''[[foo'''<nowiki>]]</nowiki>
23617 !! end
23618
23619 !! test
23620 4. No escaping needed
23621 !! options
23622 options=html2wt
23623 !! html/parsoid
23624 <p>'<span><i>bar</i></span>'
23625 '<span><b>bar</b></span>'
23626 'a:b'foo
23627 </p>
23628 !! wikitext
23629 '<span>''bar''</span>'
23630 '<span>'''bar'''</span>'
23631 'a:b'foo
23632 !! end
23633
23634 #### ----------- Paragraphs ---------------
23635 #### 1. No unnecessary escapes
23636 #### --------------------------------------
23637
23638 !! test
23639 1. No unnecessary escapes
23640 !! options
23641 parsoid=html2wt
23642 !! html/parsoid
23643 <p>bar <span>[[foo]]</span>
23644 </p><p>=bar <span>[[foo]]</span>
23645 </p><p>[[bar <span>[[foo]]</span>
23646 </p><p>]]bar <span>[[foo]]</span>
23647 </p><p>=bar <span>foo]]</span>=
23648 </p>
23649 !! wikitext
23650 bar <span><nowiki>[[foo]]</nowiki></span>
23651
23652 =bar <span><nowiki>[[foo]]</nowiki></span>
23653
23654 [[bar <span><nowiki>[[foo]]</nowiki></span>
23655
23656 ]]bar <span><nowiki>[[foo]]</nowiki></span>
23657
23658 =bar <span>foo]]</span><nowiki>=</nowiki>
23659 !!end
23660
23661 #### ----------------------- PRE --------------------------
23662 #### 1. Leading whitespace in SOL context should be escaped
23663 #### ------------------------------------------------------
23664 !! test
23665 1. Leading whitespace in SOL context should be escaped
23666 !! options
23667 parsoid=html2wt
23668 !! html/parsoid
23669 <p> a</p>
23670
23671 <p> a</p>
23672
23673 <p> a(tab)</p>
23674
23675 <p> a
23676 <!--cmt-->
23677 a</p>
23678
23679 <p>a
23680 b</p>
23681
23682 <p>a
23683 b</p>
23684
23685 <p>a
23686 b</p>
23687 !! wikitext
23688 <nowiki> </nowiki>a
23689
23690 <nowiki> </nowiki> a
23691
23692 a(tab)
23693
23694 <nowiki> </nowiki> a
23695 <!--cmt-->
23696 <nowiki> </nowiki>a
23697
23698 a
23699 <nowiki> </nowiki>b
23700
23701 a
23702 b
23703
23704 a
23705 b
23706 !! html/php
23707 <p> a
23708 </p><p> a
23709 </p><p> a(tab)
23710 </p><p> a
23711 a
23712 </p><p>a
23713 b
23714 </p><p>a
23715 b
23716 </p><p>a
23717 b
23718 </p>
23719 !! end
23720
23721 !! test
23722 2. Leading whitespace in non-indent-pre contexts should not be escaped
23723 !! options
23724 parsoid=htm2wt
23725 !! html/parsoid
23726 <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>
23727 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
23728 <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>
23729 b</span></li>
23730 </ol>
23731 !! wikitext
23732 foo <ref>''a''
23733 b</ref>
23734 <references />
23735 !! end
23736
23737 !! test
23738 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
23739 !! options
23740 parsoid=html2wt
23741 !! html/parsoid
23742 <blockquote>
23743 <p>
23744 a
23745 <span>b</span>
23746 c</p>
23747 </blockquote>
23748 !! wikitext
23749 <blockquote>
23750 a
23751 <span>b</span>
23752 c
23753 </blockquote>
23754 !! end
23755
23756 !! test
23757 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
23758 !! options
23759 options=html2wt
23760 !! html/parsoid
23761 <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>
23762 !! wikitext
23763 [[File:Foobar.jpg|thumb|caption]]
23764 !! end
23765
23766 !! test
23767 5. Nowiki escaping should account for indent-pres
23768 !! options
23769 parsoid=html2wt
23770 !! html/parsoid
23771 <pre>==foo==</pre>
23772 !! wikitext
23773 ==foo==
23774 !! end
23775
23776 !!test
23777 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
23778 !! options
23779 parsoid=html2wt
23780 !! html/parsoid
23781 <pre>
23782 * foo
23783 * bar
23784 </pre>
23785 !! wikitext
23786 * foo
23787 * bar
23788 !! end
23789
23790 #### --------------- Behavior Switches --------------------
23791
23792 !! test
23793 1. Valid behavior switches should be escaped
23794 !! options
23795 parsoid=html2wt
23796 !! html/parsoid
23797 __TOC__
23798 <i>__TOC__</i>
23799 !! wikitext
23800 <nowiki>__TOC__</nowiki>
23801 ''<nowiki>__TOC__</nowiki>''
23802 !! end
23803
23804 !! test
23805 2. Invalid behavior switches should not be escaped
23806 !! options
23807 parsoid=html2wt
23808 !! html/parsoid
23809 __TOO__
23810 __|__
23811 !! wikitext
23812 __TOO__
23813 __|__
23814 !! end
23815
23816 # We use indent-pre as an indirect way to test for sol-transparent behavior.
23817 !! test
23818 Behavior switches should be SOL-transparent
23819 !! options
23820 parsoid=html2wt
23821 !! html/parsoid
23822 <meta property="mw:PageProp/toc" />
23823
23824 <!-- this one's bogus -->
23825 <pre>__TOO__</pre>
23826
23827 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
23828
23829 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
23830 !! wikitext
23831 __TOC__
23832
23833 <!-- this one's bogus -->
23834 __TOO__
23835
23836 __TOC__ foo
23837
23838 __TOC__
23839 bar
23840 !! end
23841
23842 #### --------------- HTML tags ---------------
23843 #### 1. a tags
23844 #### 2. other tags
23845 #### 3. multi-line html tag
23846 #### 4. extension tags
23847 #### -----------------------------------------
23848 !! test
23849 1. a tags
23850 !! options
23851 parsoid=html2wt
23852 !! html/parsoid
23853 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
23854 !! wikitext
23855 <a href="http://google.com">google</a>
23856 !! end
23857
23858 !! test
23859 2. other tags
23860 !! options
23861 parsoid=html2wt
23862 !! html/parsoid
23863 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
23864 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
23865 <li> &lt;td&gt;</li></ul>
23866
23867 !! wikitext
23868 * <nowiki><div>foo</div></nowiki>
23869 * <nowiki><div style="color:red">foo</div></nowiki>
23870 * <nowiki><td></nowiki>
23871 !! end
23872
23873 !! test
23874 3. multi-line html tag
23875 !! options
23876 parsoid=html2wt
23877 !! html/parsoid
23878 <p>&lt;div
23879 &gt;foo&lt;/div
23880 &gt;
23881 </p>
23882 !! wikitext
23883 <nowiki><div
23884 >foo</div
23885 ></nowiki>
23886 !! end
23887
23888 !! test
23889 4. extension tags
23890 !! options
23891 parsoid=html2wt
23892 !! html/parsoid
23893 <p>&lt;ref&gt;foo&lt;/ref&gt;
23894 </p><p>&lt;ref&gt;bar
23895 </p><p>baz&lt;/ref&gt;
23896 </p>
23897 !! wikitext
23898 <nowiki><ref>foo</ref></nowiki>
23899
23900 <nowiki><ref>bar</nowiki>
23901
23902 baz<nowiki></ref></nowiki>
23903 !! end
23904
23905 #### --------------- Others ---------------
23906 !! test
23907 Escaping nowikis
23908 !! options
23909 parsoid=html2wt
23910 !! html/parsoid
23911 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
23912 </p>
23913 !! wikitext
23914 &lt;nowiki&gt;foo&lt;/nowiki&gt;
23915 !! end
23916
23917 ## The quote-char in the input is necessary for triggering the bug
23918 !! test
23919 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
23920 !! options
23921 parsoid=html2wt
23922 !! html/parsoid
23923 <p>foo's bar :</p>
23924 !! wikitext
23925 foo's bar :
23926 !! end
23927
23928 #----------- End of wikitext escaping tests --------------
23929
23930 !! test
23931
23932 Tag-like HTML structures are passed through as text
23933 !! wikitext
23934 <x y>
23935
23936 <x.y>
23937
23938 <x-y>
23939
23940 1>2
23941
23942 x<y
23943
23944 a>b
23945
23946 1<d e>f
23947 !! html
23948 <p>&lt;x y&gt;
23949 </p><p>&lt;x.y&gt;
23950 </p><p>&lt;x-y&gt;
23951 </p><p>1&gt;2
23952 </p><p>x&lt;y
23953 </p><p>a&gt;b
23954 </p><p>1&lt;d e&gt;f
23955 </p>
23956 !! end
23957
23958 !! test
23959 HTML tag with necessary entities in attributes
23960 !! wikitext
23961 <span title="&amp;amp;">foo</span>
23962 !! html
23963 <p><span title="&amp;amp;">foo</span>
23964 </p>
23965 !! end
23966
23967 !! test
23968 HTML tag with 'unnecessary' entity encoding in attributes
23969 !! wikitext
23970 <span title="&amp;">foo</span>
23971 !! html
23972 <p><span title="&amp;">foo</span>
23973 </p>
23974 !! end
23975
23976 !! test
23977 HTML tag with broken attribute value quoting
23978 !! options
23979 parsoid=wt2html,html2html
23980 !! wikitext
23981 <span title="Hello world>Foo</span>
23982 !! html/php
23983 <p><span title="Hello world">Foo</span>
23984 </p>
23985 !! html/parsoid
23986 <p><span title="Hello world">Foo</span></p>
23987 !! end
23988
23989 !! test
23990 Self-closed tag with broken attribute value quoting
23991 !! options
23992 parsoid=wt2html,html2html
23993 !! wikitext
23994 <div title="Hello world />Foo
23995 !! html/php+tidy
23996 <div title="Hello world"></div>
23997 <p>Foo</p>
23998 !! html/parsoid
23999 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
24000 !! end
24001
24002 !! test
24003 Table with broken attribute value quoting
24004 !! options
24005 parsoid=wt2html,html2html
24006 !! wikitext
24007 {|
24008 | title="Hello world|Foo
24009 |}
24010 !! html/php
24011 <table>
24012 <tr>
24013 <td title="Hello world">Foo
24014 </td></tr></table>
24015
24016 !! html/parsoid
24017 <table>
24018 <tr>
24019 <td title="Hello world">Foo
24020 </td></tr></table>
24021
24022 !! end
24023
24024 !! test
24025 Table with broken attribute value quoting on consecutive lines
24026 !! options
24027 parsoid=wt2html,html2html
24028 !! wikitext
24029 {|
24030 | title="Hello world|Foo
24031 | style="color:red|Bar
24032 |}
24033 !! html/php
24034 <table>
24035 <tr>
24036 <td title="Hello world">Foo
24037 </td>
24038 <td style="color:red">Bar
24039 </td></tr></table>
24040
24041 !! html/parsoid
24042 <table><tbody>
24043 <tr>
24044 <td title="Hello world">Foo
24045 </td><td style="color: red">Bar
24046 </td></tr></tbody></table>
24047
24048 !! end
24049
24050 !! test
24051 2. Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
24052 !! options
24053 parsoid
24054 !! wikitext
24055 {{}}
24056 !! html
24057 {{}}
24058 !! end
24059
24060 !! test
24061 1. Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
24062 !! options
24063 parsoid
24064 !! wikitext
24065 }}{{
24066 !! html
24067 }}{{
24068 !! end
24069
24070 !!test
24071 Accept empty td cell attribute
24072 !! wikitext
24073 {|
24074 | align="center" | foo || |
24075 |}
24076 !! html
24077 <table>
24078 <tr>
24079 <td align="center"> foo </td>
24080 <td>
24081 </td></tr></table>
24082
24083 !!end
24084
24085 !!test
24086 Non-empty attributes in th-cells
24087 !! wikitext
24088 {|
24089 ! Foo !! style="color: red" | Bar
24090 |}
24091 !! html
24092 <table>
24093 <tr>
24094 <th> Foo </th>
24095 <th style="color: red"> Bar
24096 </th></tr></table>
24097
24098 !!end
24099
24100 !!test
24101 Accept empty attributes in th-cells
24102 !! wikitext
24103 {|
24104 !| foo !!| bar
24105 |}
24106 !! html
24107 <table>
24108 <tr>
24109 <th> foo </th>
24110 <th> bar
24111 </th></tr></table>
24112
24113 !!end
24114
24115 !!test
24116 Empty table rows go away
24117 !! wikitext
24118 {|
24119 | Hello
24120 | there
24121 |- class="foo"
24122 |-
24123 |}
24124 !! html
24125 <table>
24126 <tr>
24127 <td> Hello
24128 </td>
24129 <td> there
24130 </td></tr>
24131
24132 </table>
24133
24134 !! end
24135
24136 ###
24137 ### Parsoid-centric tests for testing RTing of inter-element separators
24138 ### Edge cases not tested by existing parser tests and specific to
24139 ### Parsoid-specific serialization strategies.
24140 ###
24141
24142 !!test
24143 RT-ed inter-element separators should be valid separators
24144 !! wikitext
24145 {|
24146 |- [[foo]]
24147 |}
24148 !! html/php
24149 <table>
24150
24151 </table>
24152
24153 !! html/parsoid
24154 <table>
24155 <tbody><tr data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
24156 </tbody></table>
24157 !!end
24158
24159 # Parsoid-only since PHP parser relies on Tidy for correct output
24160 !!test
24161 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
24162 !!options
24163 parsoid
24164 !! wikitext
24165 {|
24166 |<small>foo
24167 bar
24168 |}
24169
24170 {|
24171 |<small>foo<small>
24172 |}
24173 !! html
24174 <table>
24175 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
24176 <p>bar</p></small></td></tr>
24177 </tbody></table>
24178
24179 <table>
24180 <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>
24181 </tbody></table>
24182 !!end
24183
24184 # Note that the "style" attribute is really a template parameter here.
24185 # The = would have to be {{=}} if you wanted the literal.
24186 !!test
24187 Empty TD followed by TD with tpl-generated attribute
24188 !! wikitext
24189 {|
24190 |-
24191 |
24192 |{{echo|style='color:red'}}|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 !!test
24206 Indented table with an empty td
24207 !! wikitext
24208 {|
24209 |-
24210 |
24211 |foo
24212 |}
24213 !! html
24214 <table>
24215
24216 <tr>
24217 <td>
24218 </td>
24219 <td>foo
24220 </td></tr></table>
24221
24222 !!end
24223
24224 ## We have some newline diffs RT-ing this edge case
24225 ## and it is not important enough -- we seem to be emitting
24226 ## at most 2 newlines after a </tr> and this is unrelated to
24227 ## the issue from T85627 that this is testing.
24228 !!test
24229 Indented table with blank lines in between (T85627)
24230 !! options
24231 parsoid=wt2html
24232 !! wikitext
24233 {|
24234 |foo
24235
24236
24237 |}
24238 !! html
24239 <table>
24240
24241 <tr>
24242 <td>foo
24243 </td></tr></table>
24244
24245 !!end
24246
24247 !!test
24248 Indented block & table
24249 !! wikitext
24250 <div>foo</div>
24251 {|
24252 |foo
24253 |}
24254 !! html/php
24255 <div>foo</div>
24256 <table>
24257 <tr>
24258 <td>foo
24259 </td></tr></table>
24260
24261 !! html/parsoid
24262 <div data-parsoid='{"stx":"html"}'>foo</div>
24263 <table><tbody>
24264 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
24265 </tbody></table>
24266 !!end
24267
24268 !! test
24269 Indent and comment before table row
24270 !! wikitext
24271 {|
24272 <!--hi-->|-
24273 | there
24274 |}
24275 !! html/php
24276 <table>
24277
24278 <tr>
24279 <td> there
24280 </td></tr></table>
24281
24282 !! html/parsoid
24283 <table>
24284 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
24285 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
24286 </tbody></table>
24287 !! end
24288
24289 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
24290 !!test
24291 Empty TR followed by a template-generated TR
24292 !!options
24293 parsoid
24294 !! wikitext
24295 {|
24296 |-
24297 {{echo|<tr><td>foo</td></tr>}}
24298 |}
24299 !! html
24300 <table>
24301 <tbody>
24302 <tr></tr>
24303 <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}}]}'>
24304 <td>foo</td></tr>
24305 </tbody></table>
24306 !!end
24307
24308 ## PHP and parsoid output differ for this, and since this is primarily
24309 ## for testing Parsoid's serializer, marking this Parsoid only
24310 !!test
24311 Empty TR followed by mixed-ws-comment line should RT correctly
24312 !!options
24313 parsoid
24314 !! wikitext
24315 {|
24316 |-
24317 <!--c-->
24318 |-
24319 <!--c--> <!--d-->
24320 |}
24321 !! html
24322 <table>
24323 <tbody>
24324 <tr></tr>
24325 <!--c-->
24326 <tr>
24327 <!--c--> </tr><!--d-->
24328 </tbody></table>
24329
24330 !!end
24331
24332 !!test
24333 Multi-line image caption generated by templates with/without trailing newlines
24334 !! wikitext
24335 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
24336 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
24337 !! html/parsoid
24338 <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>
24339 <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>
24340 !!end
24341
24342 !! test
24343 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
24344 !! options
24345 parsoid=html2wt
24346 !! html/parsoid
24347 <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>
24348
24349 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
24350 !! wikitext
24351 <includeonly>foo</includeonly>
24352 new para
24353
24354 [[Category:Foo]]
24355
24356 = new heading =
24357 !! end
24358
24359 ## PHP emits broken html for this, and since this is primarily
24360 ## a Parsoid serializer test, marking this Parsoid only
24361 !!test
24362 Improperly nested inline or quotes tags with whitespace in between
24363 !! wikitext
24364 <span> <s>x</span> </s>
24365 ''' ''x''' ''
24366 !! html/parsoid
24367 <p><span> <s>x</s></span><s> </s>
24368 <b> <i>x</i></b><i> </i>
24369 </p>
24370 !!end
24371
24372 !!test
24373 Encapsulate protected attributes from wt
24374 !! wikitext
24375 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
24376 !! html/parsoid
24377 <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>
24378 </body>
24379 !!end
24380
24381 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
24382 ## Having nested or stray pre tags results in the attempt to add duplicates,
24383 ## causing an assertion fail. This test tries to prevent that situation.
24384 !!test
24385 Ensure ParagraphWrapper can deal with stray closing pre tags
24386 !!options
24387 parsoid=wt2html
24388 !! wikitext
24389 plain text</pre>
24390 !! html/parsoid
24391 plain text
24392 !!end
24393
24394 !!test
24395 1. Ensure fostered text content is wrapped in element nodes
24396 !!options
24397 parsoid=wt2html
24398 !! wikitext
24399 <table>hi</table><table>ho</table>
24400 !! html/parsoid
24401 <p>hi</p>
24402 <table></table>
24403 <p>ho</p>
24404 <table></table>
24405 !!end
24406
24407 !!test
24408 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
24409 !!options
24410 parsoid=wt2html,wt2wt
24411 !! wikitext
24412 <table>
24413 <tr> || ||
24414 <td> a
24415 </table>
24416 !! html/parsoid
24417 <p> || ||
24418 </p><table>
24419 <tbody><tr><td> a</td></tr>
24420 </tbody></table>
24421 !!end
24422
24423 !!test
24424 Encapsulation properly handles null DSR information from foster box
24425 !!options
24426 parsoid=wt2html,wt2wt
24427 !! wikitext
24428 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
24429 !! html/parsoid
24430 <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>
24431 !!end
24432
24433 !!test
24434 1. Encapsulate foster-parented transclusion content
24435 !!options
24436 parsoid=wt2wt,wt2html
24437 !! wikitext
24438 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
24439 !! html/parsoid
24440 <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>
24441 <tbody>
24442 <tr>
24443 <td>bar</td>
24444 </tr>
24445 </tbody>
24446 </table>
24447 !!end
24448
24449 !!test
24450 2. Encapsulate foster-parented transclusion content
24451 !!options
24452 parsoid=wt2wt,wt2html
24453 !! wikitext
24454 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
24455 !! html/parsoid
24456 <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>
24457 <table>
24458 <tbody>
24459 <tr>
24460 <td>bar</td>
24461 </tr>
24462 </tbody>
24463 </table>
24464 !!end
24465
24466 !!test
24467 3. 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 4. Encapsulate foster-parented transclusion content
24487 !!options
24488 parsoid=wt2wt,wt2html
24489 !! wikitext
24490 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
24491 !! html/parsoid
24492 <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;]}">
24493 <p>foo</p>
24494 </div>
24495 <table>
24496 <tbody>
24497 <tr>
24498 <td>bar</td>
24499 </tr>
24500 </tbody>
24501 </table>
24502 !!end
24503
24504 !!test
24505 5. Encapsulate foster-parented transclusion content
24506 !!options
24507 parsoid=wt2wt,wt2html
24508 !! wikitext
24509 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
24510 !! html/parsoid
24511 <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>
24512 <table>
24513 <tbody>
24514 <tr>
24515 <td>
24516 <div>
24517 <p>foo</p>
24518 </div>
24519 </td>
24520 </tr>
24521 </tbody>
24522 </table>
24523 !!end
24524
24525 !!test
24526 6. Encapsulate foster-parented transclusion content
24527 !!options
24528 parsoid=wt2wt,wt2html
24529 !! wikitext
24530 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
24531 !! html/parsoid
24532 <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>
24533 <table>
24534 <tbody>
24535 <tr>
24536 <td>
24537 <div>
24538 <p>foo</p>
24539 </div>
24540 </td>
24541 </tr>
24542 </tbody>
24543 </table>
24544 <p>ok</p>
24545 !!end
24546
24547 !!test
24548 7. Encapsulate foster-parented transclusion content
24549 !!options
24550 parsoid=wt2wt,wt2html
24551 !! wikitext
24552 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
24553 !! html/parsoid
24554 <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>
24555 <table>
24556 <tbody>
24557 <tr>
24558 <td>bar</td>
24559 </tr>
24560 </tbody>
24561 </table>
24562 !!end
24563
24564 # Note that the wt is broken on purpose: the = should be {{=}} if you
24565 # don't want it to be a template parameter key.
24566 !!test
24567 8. Encapsulate foster-parented transclusion content
24568 !!options
24569 parsoid=wt2wt,wt2html
24570 !! wikitext
24571 {{echo|a
24572 }}{|{{echo|style='color:red'}}
24573 |-
24574 |b
24575 |}
24576 !! html/parsoid
24577 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
24578 <span> </span>
24579 <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>
24580 <table>
24581 <tbody>
24582 <tr>
24583 <td>b</td>
24584 </tr>
24585 </tbody>
24586 </table>
24587 !!end
24588
24589 !!test
24590 9. Encapsulate foster-parented transclusion content
24591 !!options
24592 parsoid=wt2wt,wt2html
24593 !! wikitext
24594 <table>{{echo|hi</table>hello}}
24595 !! html/parsoid
24596 <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>
24597 !!end
24598
24599 !!test
24600 Table in fosterable position
24601 !!options
24602 parsoid=wt2html
24603 !! wikitext
24604 {{OpenTable}}
24605 <div>
24606 {|
24607 |}
24608 </div>
24609 |}
24610 !! html/parsoid
24611 <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">
24612 </span>
24613 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
24614
24615 <table>
24616 </table>
24617 !!end
24618
24619 # Parsoid only for bug 64747
24620 !! test
24621 Properly encapsulate empty-content transclusions in fosterable positions
24622 !! wikitext
24623 <table>
24624 {{#if:|
24625 <td>foo</td>
24626 }}
24627 </table>
24628 !! html/parsoid
24629 <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"}]]}'>
24630
24631 </table>
24632 !! end
24633
24634 !! test
24635 Always encapsulate foster box when template range is expanded to table
24636 !! options
24637 parsoid=wt2wt
24638 !! wikitext
24639 {|
24640 hello
24641 {{OpenTable}}
24642 |}
24643 !! html/parsoid
24644
24645 !! end
24646
24647 !! test
24648 T115289: Unclosed table
24649 !! wikitext
24650 {{echo|<table>}}<!--c-->[[Category:Two]]
24651 !! html/parsoid
24652 <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>
24653 !! end
24654
24655 !! test
24656 T115289: Don't migrate newlines out of tables with fostered content
24657 !! wikitext
24658 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
24659 !! html/parsoid
24660 <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>
24661 !! end
24662
24663 !! test
24664 T73074: More fostering fun
24665 !! wikitext
24666 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
24667 !! html/parsoid
24668 <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>
24669 !! end
24670
24671 !!test
24672 Support <object> element with .data attribute
24673 !!options
24674 parsoid=html2wt
24675 !! html/parsoid
24676 <object data="test.swf"></object>
24677 !! wikitext
24678 <object data="test.swf"></object>
24679 !!end
24680
24681 !! test
24682 Don't block XML namespace declaration
24683 !! wikitext
24684 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
24685 !! html/php
24686 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
24687 </p>
24688 !! html/parsoid
24689 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
24690 !! end
24691
24692 # -----------------------------------------------------------------
24693 # The following section of tests are primarily to spec requirements
24694 # around serialization of new/edited content.
24695 #
24696 # All these tests are marked Parsoid html2wt and html2html only
24697 # ----------------------------------------------------------------
24698
24699 # 'mi' is a localinterwiki prefix as well as a language
24700 !! test
24701 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
24702 !! options
24703 parsoid=html2wt
24704 !! html/parsoid
24705 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
24706 !! wikitext
24707 [[Foo]]
24708 !! end
24709
24710 # See T93839
24711 !! test
24712 New wikilinks should be serialized properly
24713 !! options
24714 parsoid=html2wt
24715 !! html/parsoid
24716 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
24717 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
24718 !! wikitext
24719 [[Foo]]
24720 [[Foo]]
24721 !! end
24722
24723 !! test
24724 New wiki links (href variations)
24725 !! options
24726 parsoid=html2wt
24727 !! html/parsoid
24728 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
24729 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
24730 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
24731 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
24732 !! wikitext
24733 [[Foo_bar]]
24734 [[Foo_bar]]
24735 [[Foo_bar]]
24736 [[Toxine bactérienne]]
24737 !! end
24738
24739 !! test
24740 New wiki links (content string variations)
24741 !! options
24742 parsoid=html2wt
24743 !! html/parsoid
24744 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
24745 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
24746 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
24747 !! wikitext
24748 [[Foo_bar]]
24749 [[Foo bar]]
24750 [[Foo_bar|./Foo_bar]]
24751 !! end
24752
24753 !! test
24754 New category links (href variations)
24755 !! options
24756 parsoid=html2wt
24757 !! html/parsoid
24758 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
24759 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
24760 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
24761 !! wikitext
24762 [[Category:Toxine bactérienne]]
24763 [[Category:Toxine bactérienne]]
24764 [[Category:Toxine bactérienne]]
24765 !! end
24766
24767 !! test
24768 New sol transparent links don't need indent-pre nowiki protection
24769 !! options
24770 parsoid=html2wt
24771 language=de
24772 !! html/parsoid
24773 <link rel="mw:PageProp/redirect" href="./Main_Page">
24774 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
24775 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
24776 !! wikitext
24777 #WEITERLEITUNG [[Main Page]]
24778 <!-- this is good --> [[Category:Good]]
24779 <!-- this is great --> [[Kategorie:Great]]
24780 !! end
24781
24782 !! test
24783 New interlanguage links (href variations)
24784 !! options
24785 parsoid=html2wt
24786 !! html/parsoid
24787 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
24788 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
24789 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
24790 !! wikitext
24791 [[es:Toxine bactérienne]]
24792 [[es:Toxine_bactérienne]]
24793 [[es:Toxine_bactérienne]]
24794 !! end
24795
24796 !! test
24797 Image: Modifying size of an image (1)
24798 !! options
24799 parsoid={
24800 "modes": ["wt2wt"],
24801 "changes": [
24802 ["img[height]", "attr", "height", "22"],
24803 ["img[width]", "attr", "width", "200"]
24804 ]
24805 }
24806 !! wikitext
24807 [[Image:Foobar.jpg|230x230px]]
24808 !! wikitext/edited
24809 [[Image:Foobar.jpg|200x200px]]
24810 !!end
24811
24812 !! test
24813 Image: Modifying size of an image (2)
24814 !! options
24815 parsoid={
24816 "modes": ["wt2wt"],
24817 "changes": [
24818 ["img[height]", "attr", "height", "100"],
24819 ["img[width]", "attr", "width", "500"]
24820 ]
24821 }
24822 !! wikitext
24823 [[Image:Foobar.jpg|230x230px]]
24824 !! wikitext/edited
24825 [[Image:Foobar.jpg|500x500px]]
24826 !!end
24827
24828 # Change in size is ignored so long as class='mw-default-size'
24829 !! test
24830 Image: Modifying size of an image (3)
24831 !! options
24832 parsoid={
24833 "modes": ["wt2wt"],
24834 "changes": [
24835 ["figure[class]", "removeClass", "mw-default-size"],
24836 ["figure img", "attr", "height", "19"],
24837 ["figure img", "attr", "width", "170"]
24838 ]
24839 }
24840 !! wikitext
24841 [[Image:Foobar.jpg|thumb]]
24842 !! wikitext/edited
24843 [[Image:Foobar.jpg|thumb|170x170px]]
24844 !!end
24845
24846 !! test
24847 Image: Modifying alignment of an image (bug 48665)
24848 !! options
24849 parsoid={
24850 "modes": ["wt2wt"],
24851 "changes": [
24852 ["figure[class]", "removeClass", "mw-halign-right"],
24853 ["figure[class]", "addClass", "mw-halign-left"]
24854 ]
24855 }
24856 !! wikitext
24857 [[Image:Foobar.jpg|thumb|caption|right]]
24858 !! wikitext/edited
24859 [[Image:Foobar.jpg|thumb|caption|left]]
24860 !! end
24861
24862 !! test
24863 Image: Modifying mw-default-size of an frameless image (bug 62805)
24864 !! options
24865 parsoid={
24866 "modes": ["wt2wt"],
24867 "changes": [
24868 ["figure.mw-default-size", "removeClass", "mw-default-size"]
24869 ]
24870 }
24871 !! wikitext
24872 [[Image:Foobar.jpg|frameless|right]]
24873 !! wikitext/edited
24874 [[Image:Foobar.jpg|frameless|right|220x220px]]
24875 !! end
24876
24877 !! test
24878 Image: Modifying valign of an image (bug 49221)
24879 !! options
24880 parsoid={
24881 "modes": ["wt2wt"],
24882 "changes": [
24883 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
24884 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
24885 ]
24886 }
24887 !! wikitext
24888 [[File:Foobar.jpg|20px|middle]]
24889 !! wikitext/edited
24890 [[File:Foobar.jpg|20px|text-top]]
24891 !! end
24892
24893 !! test
24894 Image: Modifying alt attribute of an image (bug 56400)
24895 !! options
24896 parsoid={
24897 "modes": ["wt2wt"],
24898 "changes": [
24899 ["img[alt]", "attr", "alt", "some alternate edited text"]
24900 ]
24901 }
24902 !! wikitext
24903 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
24904 !! wikitext/edited
24905 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
24906 !!end
24907
24908 !! test
24909 Image: Modifying caption of an image
24910 !! options
24911 parsoid={
24912 "modes": ["wt2wt"],
24913 "changes": [
24914 ["figcaption", "text", "new caption"]
24915 ]
24916 }
24917 !! wikitext
24918 [[Image:Foobar.jpg|thumb|original caption]]
24919 !! wikitext/edited
24920 [[Image:Foobar.jpg|thumb|new caption]]
24921 !!end
24922
24923 !! test
24924 Image: empty alt attribute (bug 48924)
24925 !! options
24926 parsoid
24927 !! wikitext
24928 [[File:Foobar.jpg|thumb|alt=|bar]]
24929 !! html
24930 <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>
24931 !! end
24932
24933 !! test
24934 Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
24935 !! options
24936 parsoid=html2wt
24937 language=ar
24938 disabled
24939 !! html/parsoid
24940 <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>
24941 !! wikitext
24942 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
24943 !! end
24944
24945 !! test
24946 Image: Block level image should have \n before and after
24947 !! wikitext
24948 123
24949 [[File:Foobar.jpg|right|thumb|150x150px]]
24950 456
24951 !! html/parsoid
24952 <p>123</p>
24953 <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>
24954 <p>456</p>
24955 !!end
24956
24957 !! test
24958 Image: New block level image should have \n before and after (existing content)
24959 !! wikitext
24960 123
24961 [[File:Foobar.jpg|right|thumb|150x150px]]
24962 456
24963 !! html/parsoid
24964 <p>123</p>
24965 <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>
24966 <p>456</p>
24967 !!end
24968
24969 !! test
24970 Image: upright option (parsoid)
24971 !! wikitext
24972 [[File:Foobar.jpg|thumb|upright|caption]]
24973 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
24974 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
24975 !! html/parsoid
24976 <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>
24977 <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>
24978 <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>
24979 !!end
24980
24981 !! test
24982 Image: upright option is ignored on inline and frame images (parsoid)
24983 !! wikitext
24984 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
24985 !! html/parsoid
24986 <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>
24987 !!end
24988
24989 !! test
24990 Image: from basic HTML (1)
24991 !! options
24992 parsoid=html2wt
24993 !! html/parsoid
24994 <span typeof="mw:Image">
24995 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
24996 </span>
24997 !! wikitext
24998 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
24999 !! end
25000
25001 !! test
25002 Image: from basic HTML (2)
25003 !! options
25004 parsoid=html2wt
25005 !! html/parsoid
25006 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
25007 !! wikitext
25008 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
25009 !! end
25010
25011 !! test
25012 Image: from basic HTML (3)
25013 !! options
25014 parsoid=html2wt
25015 !! html/parsoid
25016 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
25017 !! wikitext
25018 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
25019 !! end
25020
25021 !! test
25022 Image: from basic HTML (4)
25023 !! options
25024 parsoid=html2wt
25025 !! html/parsoid
25026 <img src="./File:Foobar.jpg">
25027 !! wikitext
25028 [[File:Foobar.jpg|link=]]
25029 !! end
25030
25031 !! test
25032 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
25033 !! options
25034 parsoid=html2wt
25035 !! html/parsoid
25036 <ul>
25037 <li><p>foo</p></li>
25038 </ul>
25039 !! wikitext
25040 * foo
25041 !! end
25042
25043 !! test
25044 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
25045 !! options
25046 parsoid=html2wt
25047 !! html/parsoid
25048 <ul> <li>foo</li></ul>
25049 !! wikitext
25050 * foo
25051 !! end
25052
25053 !! test
25054 Don't strip leading whitespace when handling indent-pre suppressing tags
25055 !! options
25056 parsoid=html2wt
25057 !! html/parsoid
25058 <table>
25059 <tr><td> indented row</td></tr>
25060 </table>
25061 <blockquote><p>
25062 <b>This is very bold of you!</b>
25063 </p>
25064 <table><tr><td>
25065 indented cell (no pre-wrapping!)
25066 </td></tr></table>
25067 </blockquote>
25068 <p>foo</p>
25069 <div>bar</div>
25070 !! wikitext
25071 {|
25072 | indented row
25073 |}
25074 <blockquote>
25075 '''This is very bold of you!'''
25076
25077 {|
25078 |
25079 indented cell (no pre-wrapping!)
25080 |}
25081 </blockquote>
25082 foo
25083 <div>bar</div>
25084 !! end
25085
25086 !! test
25087 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
25088 !! options
25089 parsoid=html2wt
25090 !! html/parsoid
25091 <p>foo</p>
25092 <span>bar</span>
25093
25094 <span>foo2
25095 </span>bar2
25096
25097 <div>foo</div>
25098 <span>bar</span>
25099
25100 <div>
25101 <span>foo</span>
25102 </div>
25103 !! wikitext
25104 foo
25105
25106 <span>bar</span>
25107
25108 <span>foo2
25109 <nowiki> </nowiki></span>bar2
25110
25111 <div>foo</div>
25112 <nowiki> </nowiki><span>bar</span>
25113
25114 <div>
25115 <nowiki> </nowiki><span>foo</span>
25116 </div>
25117 !! end
25118
25119 !! test
25120 Lists: Dont insert newlines in a serialized list item.
25121 !! options
25122 parsoid=html2wt
25123 !! html/parsoid
25124 <ul><li>a<br>b</li><li>c</li></ul>
25125 !! wikitext
25126 * a<br>b
25127 * c
25128 !! end
25129
25130 !! test
25131 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
25132 !! options
25133 parsoid={
25134 "modes": ["html2wt"],
25135 "scrubWikitext": false
25136 }
25137 !! html/parsoid
25138 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
25139 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
25140
25141 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
25142 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
25143
25144 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
25145
25146 <h2><meta property="mw:PageProp/toc" /> ok</h2>
25147 !! wikitext
25148 == hello there [[Category:A1]] ==
25149
25150 == [[Category:A2]] hi pal ==
25151
25152 == <!--foo--> [[Category:A3]] how goes it ==
25153
25154 == it goes well [[Category:A4]] <!--bar--> ==
25155
25156 ==howdy [[Category:A5]]==
25157
25158 == __TOC__ ok ==
25159 !! end
25160
25161 !! test
25162 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
25163 !! options
25164 parsoid={
25165 "modes": ["html2wt"],
25166 "scrubWikitext": true
25167 }
25168 !! html/parsoid
25169 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
25170 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
25171
25172 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
25173 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
25174
25175 <h2><meta property="mw:PageProp/toc" /> ok</h2>
25176 !! wikitext
25177 == hello there ==
25178 [[Category:A1]]
25179 [[Category:A2]]
25180
25181 == hi pal ==
25182
25183 <!--foo--> [[Category:A3]]
25184
25185 == how goes it ==
25186
25187 == it goes well ==
25188 [[Category:A4]] <!--bar-->
25189
25190 __TOC__
25191
25192 == ok ==
25193 !! end
25194
25195 !! test
25196 Headings: Don't hoist metas that come from templates
25197 !! options
25198 parsoid={
25199 "modes": ["html2wt"],
25200 "scrubWikitext": true
25201 }
25202 !! html/parsoid
25203 <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>
25204 !! wikitext
25205 == {{echo|foo [[Category:Foo]]}} ==
25206 !! end
25207
25208 !! test
25209 Headings: Category in ref isn't hoisted
25210 !! options
25211 parsoid={
25212 "modes": ["html2wt"],
25213 "scrubWikitext": true
25214 }
25215 !! html/parsoid
25216 <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>
25217
25218 <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>
25219 !! wikitext
25220 == foo <ref>bar
25221 [[Category:Baz]] </ref> ==
25222
25223 <references />
25224 !! end
25225
25226 !! test
25227 Parsoid: Serialize positional parameters with = in them as named parameter
25228 !! options
25229 parsoid=html2wt
25230 !! html/parsoid
25231 <p about="#mwt1" typeof="mw:Transclusion"
25232 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
25233
25234 <p about="#mwt1" typeof="mw:Transclusion"
25235 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
25236
25237 <!--Orig params with data-parsoid has heuristics for handling = chars-->
25238 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
25239 <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>
25240 !! wikitext
25241 {{echo|1=f=oo}}
25242
25243 {{echo|1=f=oo|2=bar}}
25244
25245 <!--Orig params with data-parsoid has heuristics for handling = chars-->
25246 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
25247 {{echo|<nowiki>f=oo</nowiki>|bar}}
25248 !! end
25249
25250 !! test
25251 Parsoid: Serialize positional parameters with = in extlink as named parameter
25252 !! options
25253 parsoid=html2wt
25254 !! html/parsoid
25255 <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>
25256 !! wikitext
25257 {{echo|1=http://stuff?is=ok}}
25258 !! end
25259
25260 !! test
25261 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
25262 !! options
25263 parsoid=html2wt
25264 !! html/parsoid
25265 <div>a<p>b</p></div>
25266 <div>a
25267 <p>b</p></div>
25268 <div>
25269 a
25270 <p>b</p></div>
25271 !! wikitext
25272 <div>a
25273 b
25274 </div>
25275 <div>a
25276 b
25277 </div>
25278 <div>
25279 a
25280
25281 b
25282 </div>
25283 !! end
25284
25285 !! test
25286 Substrings resembling wikitext in hrefs should not get nowiki escapes
25287 !! options
25288 parsoid=html2wt
25289 !! html/parsoid
25290 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
25291 !! wikitext
25292 [[Foo''bar''baz]]
25293 !! end
25294
25295 !! test
25296 Enforce single-line context in the serializer
25297 !! options
25298 parsoid=html2wt
25299 !! html/parsoid
25300 <h2>testing
25301 123</h2>
25302
25303 <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">
25304 </span><span about="#mwt1">you</span> </h2>
25305
25306 <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>
25307
25308 <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
25309 there</span></li></ol>
25310
25311 <ul><li>asd
25312 sdf</li></ul>
25313
25314 <ul><li>foo
25315 bar
25316 baz</li>
25317 <li>foo <b>bar</b>
25318 baz</li></ul>
25319
25320 <dl><dt>hi
25321 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
25322 ho</dd></dl>
25323
25324 <dl><dd> <table>
25325 <tbody><tr><td> ha
25326 ha
25327 ha</td></tr>
25328 </tbody></table></dd></dl>
25329 !! wikitext
25330 == testing 123 ==
25331
25332 == hi {{bogus|there
25333 you}} ==
25334
25335 == foo <ref>hello
25336 there</ref> ==
25337
25338 <references />
25339
25340 * asd sdf
25341
25342 * foo bar baz
25343 * foo '''bar''' baz
25344
25345 ; hi ho : hi ho
25346
25347 : {|
25348 | ha
25349 ha
25350 ha
25351 |}
25352 !! end
25353
25354 !! test
25355 Serialize new placeholder space without spans
25356 !! options
25357 parsoid=html2wt
25358 !! html/parsoid
25359 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
25360
25361 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
25362
25363 <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>
25364 !! wikitext
25365 foo : bar
25366
25367 foo : bar
25368
25369 <ref>foo : bar</ref>ok
25370 !! end
25371
25372
25373 #-----------------------
25374 # Tag minimization tests
25375 #-----------------------
25376
25377 !! test
25378 1. I/B quote minimization: wikitext-only tags should be combined
25379 !! options
25380 parsoid=html2wt
25381 !! html/parsoid
25382 <p><i>A</i><i>B</i></p>
25383 <p><b>A</b><b>B</b></p>
25384 <p><i>A</i><b><i>B</i></b></p>
25385 <p><b>A</b><i><b>B</b></i></p>
25386 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
25387 <p><i><b>A</b></i><i><b>B</b></i></p>
25388 <p><i><b>A</b></i><b><i>B</i></b></p>
25389 <p><b><i>A</i></b><i><b>B</b></i></p>
25390 !! wikitext
25391 ''AB''
25392
25393 '''AB'''
25394
25395 ''A'''B'''''
25396
25397 '''A''B'''''
25398
25399 '''A''BC''D'''
25400
25401 '''''AB'''''
25402
25403 '''''AB'''''
25404
25405 '''''AB'''''
25406 !! end
25407
25408 !! test
25409 2. I/B quote minimization: wikitext and html tags should not be combined
25410 !! options
25411 parsoid=html2wt
25412 !! html/parsoid
25413 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
25414 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
25415 !! wikitext
25416 ''A''<i>B</i>
25417
25418 ''A''<nowiki/>'''<i>B</i>'''
25419 !! end
25420
25421 !! test
25422 3. I/B quote minimization: templated content stops minimization
25423 !! options
25424 parsoid=html2wt
25425 !! html/parsoid
25426 <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>
25427 <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>
25428 !! wikitext
25429 ''A''{{echo|''B''}}
25430
25431 ''A''{{echo|'''''B'''''}}
25432 !! end
25433
25434 !! test
25435 4. I/B quote minimization: new content should be mimimized with adjacent old content
25436 !! options
25437 parsoid=html2wt
25438 !! html/parsoid
25439 <p><i>A</i><i>B</i></p>
25440 <p><b>A</b><b>B</b></p>
25441 <p><i>A</i><b><i>B</i></b></p>
25442 !! wikitext
25443 ''AB''
25444
25445 '''AB'''
25446
25447 ''A'''B'''''
25448 !! end
25449
25450 !! test
25451 5a. Merge adjacent quote nodes if they've been edited
25452 !! options
25453 parsoid={
25454 "modes": ["wt2wt", "selser"],
25455 "changes": [
25456 ["p", "contents", "remove", ":contains('b')"]
25457 ]
25458 }
25459 !! wikitext
25460 ''a''b''c''
25461 !! wikitext/edited
25462 ''ac''
25463 !! end
25464
25465 !! test
25466 5b. Merge adjacent quote nodes if they've been edited
25467 !! options
25468 parsoid={
25469 "modes": ["wt2wt", "selser"],
25470 "changes": [
25471 ["#x", "remove"]
25472 ]
25473 }
25474 !! wikitext
25475 ''a''<span id="x">b</span>''c''
25476 !! wikitext/edited
25477 ''ac''
25478 !! end
25479
25480 !! test
25481 1. Merge adjacent link nodes as long as at least one element is new
25482 !! options
25483 parsoid={
25484 "modes": ["html2wt"],
25485 "scrubWikitext": true
25486 }
25487 !! html/parsoid
25488 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25489 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25490 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
25491 !! wikitext
25492 [[Football]]
25493 [[Football]]
25494 [[Football|Foot]][[Football|ball]]
25495 !! end
25496
25497 !! test
25498 2. Merge adjacent link nodes and enable additional normalizations
25499 !! options
25500 parsoid={
25501 "modes": ["html2wt"],
25502 "scrubWikitext": true
25503 }
25504 !! html/parsoid
25505 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
25506 !! wikitext
25507 [[Football|''Football'']]
25508 !! end
25509
25510 !! test
25511 3. Don't merge adjacent link nodes if scrubWikitext is false
25512 !! options
25513 parsoid={
25514 "modes": ["html2wt"],
25515 "scrubWikitext": false
25516 }
25517 !! html/parsoid
25518 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25519 !! wikitext
25520 [[Football|Foot]][[Football|ball]]
25521 !! end
25522
25523 #------------------------------
25524 # End of tag minimization tests
25525 #------------------------------
25526
25527 !!test
25528 Bug 54262: New entities
25529 !! options
25530 parsoid=html2wt
25531 !! html/parsoid
25532 <span typeof="mw:Entity">&nbsp;</span>
25533 !! wikitext
25534 &nbsp;
25535 !! end
25536
25537 ## Note that there is no wikitext output for 'unknownproperty' ##
25538 ## Unknown magic words are silently dropped ##
25539
25540 !! test
25541 Magic words
25542 !! options
25543 parsoid=html2wt
25544 !! html/parsoid
25545 <meta property='mw:PageProp/toc' />
25546 <meta property='mw:PageProp/notoc' />
25547 <meta property='mw:PageProp/forcetoc' />
25548 <meta property='mw:PageProp/index' />
25549 <meta property='mw:PageProp/noindex' />
25550 <meta property='mw:PageProp/nogallery' />
25551 <meta property='mw:PageProp/noeditsection' />
25552 <meta property='mw:PageProp/notitleconvert' />
25553 <meta property='mw:PageProp/nocontentconvert' />
25554 <meta property='mw:PageProp/unknownproperty' />
25555 !! wikitext
25556 __TOC__
25557 __NOTOC__
25558 __FORCETOC__
25559 __INDEX__
25560 __NOINDEX__
25561 __NOGALLERY__
25562 __NOEDITSECTION__
25563 __NOTITLECONVERT__
25564 __NOCONTENTCONVERT__
25565 !! end
25566
25567 !! test
25568 Consecutive <pre>s should not get merged
25569 !! options
25570 parsoid=html2wt,html2html
25571 !! html/parsoid
25572 <pre>a</pre><pre>b</pre>
25573
25574 <pre>c
25575 </pre><pre>
25576 d</pre>
25577
25578 <pre>e
25579
25580 </pre><pre>
25581
25582 f</pre>
25583 !! wikitext
25584 a
25585
25586 b
25587
25588 c
25589
25590 d
25591
25592 e
25593
25594
25595
25596 f
25597 !! end
25598
25599 !! test
25600 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
25601 !! options
25602 parsoid=html2wt
25603 !! html/parsoid
25604 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
25605 !! wikitext
25606 [[Special:BookSources/1234567890|ISBN 1234567895]]
25607 !! end
25608
25609 !! test
25610 Edited RFC links not serializable as RFC links should serialize as extlinks
25611 !! options
25612 parsoid=html2wt
25613 !! html/parsoid
25614 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
25615 !! wikitext
25616 [//tools.ietf.org/html/rfc123 New RFC]
25617 !! end
25618
25619 !! test
25620 Edited PMID links not serializable as PMID links should serialize as extlinks
25621 !! options
25622 parsoid=html2wt
25623 !! html/parsoid
25624 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
25625 !! wikitext
25626 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
25627 !! end
25628
25629 !! test
25630 WTS of autolinks with trailing/surrounding context
25631 !! options
25632 parsoid=html2wt
25633 !! html/parsoid
25634 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
25635 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
25636 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
25637 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
25638 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
25639 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
25640 !! wikitext
25641 http://cscott.net'''foo'''
25642
25643 http://cscott.net<b>foo</b>
25644
25645 '''http://cscott.net'''
25646
25647 '''http://cscott.net '''
25648
25649 '''http://cscott.net<nowiki/>x'''
25650
25651 http://cscott.net<nowiki/>x
25652 !! end
25653
25654 !! test
25655 WTS of autolinks with nowikis (round-trip)
25656 !! wikitext
25657 x<nowiki/>http://cscott.net<nowiki/>x
25658 !! html/parsoid
25659 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
25660 !! end
25661
25662 # this is the "easy" test because it leaves in place all the
25663 # data-parsoid information indicating this is an autolink
25664 !! test
25665 WTS of autolinks with escapes (editing)
25666 !! options
25667 parsoid={
25668 "modes": ["wt2wt"],
25669 "changes": [
25670 [ "meta", "remove" ]
25671 ]
25672 }
25673 !! wikitext
25674 x<nowiki/>http://cscott.net<nowiki/>x
25675 !! wikitext/edited
25676 x<nowiki/>http://cscott.net<nowiki/>x
25677 !! end
25678
25679 !! test
25680 WTS of edited autolink-like text (T103364)
25681 !! options
25682 parsoid={
25683 "modes": ["wt2wt"],
25684 "changes": [
25685 [ "span[typeof]", "removeAttr", "typeof" ]
25686 ]
25687 }
25688 !! wikitext
25689 Not a link: <nowiki>http://example.com</nowiki>.
25690 !! wikitext/edited
25691 Not a link: <span><nowiki>http://example.com</nowiki></span>.
25692 !! end
25693
25694 !! test
25695 WTS of newly-authored autolink-like text (T103364)
25696 !! options
25697 parsoid=html2wt
25698 !! html/parsoid
25699 <p>http://example.com is not a link.</p>
25700 !! wikitext
25701 <nowiki>http://example.com</nowiki> is not a link.
25702 !! end
25703
25704 !! test
25705 WTS of autolink-like text after an autolink (T108563)
25706 !! options
25707 parsoid=html2wt
25708 !! html/parsoid
25709 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
25710 !! wikitext
25711 http://example.com <nowiki>http://example.com</nowiki> is not a link.
25712 !! end
25713
25714 !! test
25715 Magic links inside links (not autolinked)
25716 !! wikitext
25717 [[Foo|http://example.com]]
25718 [[Foo|RFC 1234]]
25719 [[Foo|PMID 1234]]
25720 [[Foo|ISBN 123456789x]]
25721
25722 [http://foo.com http://example.com]
25723 [http://foo.com RFC 1234]
25724 [http://foo.com PMID 1234]
25725 [http://foo.com ISBN 123456789x]
25726 !! html+tidy
25727 <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>
25728 <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>
25729 !! html/parsoid
25730 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
25731 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
25732 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
25733 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
25734
25735 <p><a rel="mw:ExtLink" href="http://foo.com">http://example.com</a>
25736 <a rel="mw:ExtLink" href="http://foo.com">RFC 1234</a>
25737 <a rel="mw:ExtLink" href="http://foo.com">PMID 1234</a>
25738 <a rel="mw:ExtLink" href="http://foo.com">ISBN 123456789x</a></p>
25739 !! end
25740
25741 !! test
25742 Magic links inside image captions (autolinked)
25743 !! wikitext
25744 [[File:Foobar.jpg|thumb|http://example.com]]
25745 [[File:Foobar.jpg|thumb|RFC 1234]]
25746 [[File:Foobar.jpg|thumb|PMID 1234]]
25747 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
25748 !! html+tidy
25749 <div class="thumb tright">
25750 <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>
25751 <div class="thumbcaption">
25752 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25753 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div>
25754 </div>
25755 </div>
25756 <div class="thumb tright">
25757 <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>
25758 <div class="thumbcaption">
25759 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25760 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a></div>
25761 </div>
25762 </div>
25763 <div class="thumb tright">
25764 <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>
25765 <div class="thumbcaption">
25766 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25767 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a></div>
25768 </div>
25769 </div>
25770 <div class="thumb tright">
25771 <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>
25772 <div class="thumbcaption">
25773 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25774 <a href="/wiki/Special:BookSources/123456789X" class="internal mw-magiclink-isbn">ISBN 123456789x</a></div>
25775 </div>
25776 </div>
25777 !! html/parsoid
25778 <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>
25779 <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>
25780 <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>
25781 <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>
25782 !! end
25783
25784 !! test
25785 WTS of magic word text (T109371)
25786 !! options
25787 parsoid=html2wt
25788 !! html/parsoid
25789 <p>RFC 1234</p>
25790 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
25791 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
25792 !! wikitext
25793 <nowiki>RFC 1234</nowiki>
25794
25795 [http://foo.com RFC 1234]
25796
25797 [[Foo|RFC 1234]]
25798 !! end
25799
25800 !! test
25801 Edited Redirect link should emit a non-piped wikitext link
25802 !! options
25803 parsoid=html2wt
25804 !! html/parsoid
25805 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
25806 !! wikitext
25807 #REDIRECT [[Bar]]
25808 !! end
25809
25810 !! test
25811 T75121: Infer extension name from typeOf if data-mw is not present
25812 !! options
25813 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
25814 !! html/parsoid
25815 <div typeOf="mw:Extension/foo"></div>
25816 !! wikitext
25817 <foo />
25818 !! end
25819
25820 # Note that the <p> wrapping isn't present in PHP parser output
25821 # The important thing for this test is that P-wrapping doesn't
25822 # interfere with the <nowiki> protection for leading - in <td>
25823 # (which isn't necessary for <th>).
25824 !! test
25825 T88318: p-wrapped dash in table.
25826 !! options
25827 parsoid=html2wt,wt2wt
25828 !! html/parsoid
25829 <table><tbody>
25830 <tr><th><p>-</p></th><th><p>- </p></th></tr>
25831 <tr><td><p>-</p></td><td><p>- </p></td></tr>
25832 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
25833 </tbody></table>
25834 !! wikitext
25835 {|
25836 !-
25837 !-
25838 |-
25839 |<nowiki>-</nowiki>
25840 |<nowiki>- </nowiki>
25841 |-
25842 |<small>-</small>
25843 |<br>
25844 -
25845 |<br>
25846 -
25847 |}
25848 !! html/php+tidy
25849 <table>
25850 <tr>
25851 <th>-</th>
25852 <th>-</th>
25853 </tr>
25854 <tr>
25855 <td>-</td>
25856 <td>-</td>
25857 </tr>
25858 <tr>
25859 <td><small>-</small></td>
25860 <td><br />
25861 <p>-</p>
25862 </td>
25863 <td><br />
25864 <p>-</p>
25865 </td>
25866 </tr>
25867 </table>
25868 !! end
25869
25870 !! test
25871 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
25872 !! options
25873 parsoid=html2wt
25874 !! html/parsoid
25875 <table id='mwAb'>
25876 <td id='mwAc'>foo</td>
25877 <td id='serialize-this'>bar</td>
25878 </table>
25879 !! wikitext
25880 {|
25881 |foo
25882 | id="serialize-this" |bar
25883 |}
25884 !! end
25885
25886 !! test
25887 Parsoid-like element ids should not be serialized to wikitext unless shadowed
25888 !! options
25889 parsoid=html2wt
25890 !! html/parsoid
25891 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
25892 !! wikitext
25893 <div id="hello">ok</div>
25894 !! end
25895
25896 !! test
25897 WTS change modes
25898 !! options
25899 parsoid={
25900 "modes": ["wt2wt"],
25901 "changes": [
25902 [ "#xyz", "before", "<b>before</b> stuff " ],
25903 [ "#xyz", "after", " stuff <i>after</i>" ],
25904 [ "#xyz", "html", "x <b>y</b> z" ]
25905 ]
25906 }
25907 !! wikitext
25908 <span id="xyz">hello</span>
25909 !! wikitext/edited
25910 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
25911 !! end
25912
25913 !! test
25914 Never serialize a-tag as html, regardless of what data-parsoid has to say
25915 !! options
25916 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
25917 !! html/parsoid
25918 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
25919 !! wikitext
25920 [[Foo]]
25921 !! end
25922
25923 ## SSS FIXME: This is broken output nevertheless.
25924 ## What might be a reasonable non-broken output for this?
25925 ## This is an edge case unlikely to be seen in production
25926 ## that I am not wasting more time on this right now.
25927 !! test
25928 Never serialize a-tag as html, no matter what attributes it has
25929 !! options
25930 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
25931 !! html/parsoid
25932 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
25933 !! wikitext
25934 [http://boo.org http://boohoo.org]
25935 !! end
25936
25937 # Misnested is an indication that selser can reuse the source but these have
25938 # shown to sneak through on occasion. See T101768.
25939 # The original wikitext here is: [http://test.com [[one]] two three]
25940 !! test
25941 Strip span tags added to mark misnested links
25942 !! options
25943 parsoid=html2wt
25944 !! html/parsoid
25945 <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>
25946 !! wikitext
25947 [http://test.com][[one]] two three
25948 !! end
25949
25950 !! test
25951 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
25952 !! options
25953 parsoid=html2wt
25954 !! html/parsoid
25955 <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|}"]}'>
25956 <tbody><tr><td>d
25957 </td></tr>
25958 </tbody></table>
25959 !! wikitext
25960 {{echo|a}}
25961 {|{{echo|c
25962 {{!}}d
25963 }}
25964 |}
25965 !! end
25966
25967 ## This test verifies the presence and computation of this attribute indirectly
25968 ## by making an edit and ensuring that the serialization is correct (which it would be
25969 ## only if firstWikitextNode is properly set).
25970 !! test
25971 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
25972 !! options
25973 parsoid= {
25974 "modes": ["wt2wt"],
25975 "changes": [
25976 [ "div#x", "remove" ],
25977 [ "div", "before", "<div>new</div>" ]
25978 ]
25979 }
25980 !! wikitext
25981 <div id="x">foo</div>
25982 {|
25983 {{echo|<div>boo</div>
25984 {{!}}b}}
25985 |c
25986 |}
25987 !! wikitext/edited
25988
25989 <div>new</div>
25990 {|
25991 {{echo|<div>boo</div>
25992 {{!}}b}}
25993 |c
25994 |}
25995 !! end
25996
25997 # --------------------------------------------
25998 # Tests spec'ing wikitext serialization norms |
25999 # --------------------------------------------
26000
26001 !! test
26002 1. Categories should always be serialized on their own line
26003 !! options
26004 parsoid=html2wt
26005 !! html/parsoid
26006 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
26007 !! wikitext
26008 foo
26009 [[Category:Foo]]
26010 bar
26011 !! end
26012
26013 !! test
26014 2. Categories that are part of templates should not introduce a line break
26015 !! wikitext
26016 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
26017 !! html/parsoid
26018 <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>
26019 !! end
26020
26021 # Careful while editing these next 2 tests. There are \u200f characters
26022 # before and after the <link> tags in the HTML and following some
26023 # of the categories in wikitext
26024 # Do not remove these characters in edits.
26025 #
26026 # As part of the serialization, these bidi characters will get stripped.
26027 !! test
26028 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
26029 !! options
26030 parsoid={
26031 "modes": ["html2wt"],
26032 "scrubWikitext": true
26033 }
26034 !! html/parsoid
26035 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
26036 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
26037 !! wikitext
26038 [[קטגוריה:טקסים]]
26039 [[קטגוריה: שיטות משפט]]
26040 !! end
26041
26042 !! test
26043 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
26044 !! options
26045 parsoid={
26046 "modes": ["html2wt"],
26047 "scrubWikitext": true
26048 }
26049 !! html/parsoid
26050 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
26051 !! wikitext
26052 [[קטגוריה:טקסים]]
26053 ‏y
26054 !! end
26055
26056 !! test
26057 Lists: Add space after bullets
26058 !! options
26059 parsoid=html2wt
26060 !! html/parsoid
26061 <ul>
26062 <li>foo</li>
26063 <li> bar</li>
26064 <li><span> baz</span></li>
26065 </ul>
26066 !! wikitext
26067 * foo
26068 * bar
26069 * <span> baz</span>
26070 !! end
26071
26072 !! test
26073 1. Headings: Add space before/after == (T53744)
26074 !! options
26075 parsoid=html2wt
26076 !! html/parsoid
26077 <h2>foo</h2>
26078 <h2> bar</h2>
26079 <h2>baz </h2>
26080 <h2><span> baz</span></h2>
26081 !! wikitext
26082 == foo ==
26083
26084 == bar ==
26085
26086 == baz ==
26087
26088 == <span> baz</span> ==
26089 !! end
26090
26091 !! test
26092 2. Headings: Add space before/after == even after hoisted content
26093 !! options
26094 parsoid={
26095 "modes": ["html2wt"],
26096 "scrubWikitext": true
26097 }
26098 !! html/parsoid
26099 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
26100 !! wikitext
26101 [[Category:A2]]
26102
26103 == ok ==
26104 !! end
26105
26106 !! test
26107 1. Headings: suppress newly created empty headings
26108 !! options
26109 parsoid={
26110 "modes": ["html2wt"],
26111 "scrubWikitext": true
26112 }
26113 !! html/parsoid
26114 <h2></h2>
26115 !! wikitext
26116 !! end
26117
26118 !! test
26119 2. Headings: don't suppress empty headings if scrubWikitext is false
26120 !! options
26121 parsoid=html2wt
26122 !! html/parsoid
26123 <h2></h2>
26124 !! wikitext
26125 ==<nowiki/>==
26126 !! end
26127
26128 !! test
26129 3. Headings: suppress empty headings on edits
26130 !! options
26131 parsoid={
26132 "modes": ["selser"],
26133 "scrubWikitext": true,
26134 "changes": [
26135 [ "#x", "remove"]
26136 ]
26137 }
26138 !! wikitext
26139 ==<span id="x">foo</span>==
26140 !! wikitext/edited
26141 !! end
26142
26143 !! test
26144 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
26145 !! options
26146 parsoid={
26147 "modes": ["html2wt"],
26148 "scrubWikitext": true
26149 }
26150 !! html/parsoid
26151 <h2>foo<br/>bar</h2>
26152 <h2>foo <span><br/>bar</span> baz</h2>
26153 !! wikitext
26154 == foo bar ==
26155
26156 == foo <span> bar</span> baz ==
26157 !! end
26158
26159 !! test
26160 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
26161 !! options
26162 parsoid={
26163 "modes": ["html2wt"],
26164 "scrubWikitext": false
26165 }
26166 !! html/parsoid
26167 <h2>foo<br/>bar</h2>
26168 !! wikitext
26169 == foo<br> bar ==
26170 !! end
26171
26172 !! test
26173 1. WT Quote Tags: suppress newly created empty style tags
26174 !! options
26175 parsoid={
26176 "modes": ["html2wt"],
26177 "scrubWikitext": true
26178 }
26179 !! html/parsoid
26180 <i></i><b></b>
26181 !! wikitext
26182 !! end
26183
26184 !! test
26185 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
26186 !! options
26187 parsoid=html2wt
26188 !! html/parsoid
26189 <i></i><b></b>
26190 !! wikitext
26191 ''<nowiki/>'''''<nowiki/>'''
26192 !! end
26193
26194 !! test
26195 3. WT Quote Tags: suppress empty style tags on edits
26196 !! options
26197 parsoid={
26198 "modes": ["selser"],
26199 "scrubWikitext": true,
26200 "changes": [
26201 [ "#x", "remove"]
26202 ]
26203 }
26204 !! wikitext
26205 '''<span id="x">foo</span>'''
26206 !! wikitext/edited
26207 !! end
26208
26209 !! test
26210 1. Anchors: suppress newly created empty anchors
26211 !! options
26212 parsoid={
26213 "modes": ["html2wt"],
26214 "scrubWikitext": true
26215 }
26216 !! html/parsoid
26217 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
26218 !! wikitext
26219 !! end
26220
26221 !! test
26222 2. Anchors: don't suppress empty anchors if scrubWikitext is false
26223 !! options
26224 parsoid={
26225 "modes": ["html2wt"],
26226 "scrubWikitext": false
26227 }
26228 !! html/parsoid
26229 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
26230 !! wikitext
26231 [[Test|<nowiki/>]]
26232 !! end
26233
26234 !! test
26235 3. Anchors: suppress empty anchors on edits
26236 !! options
26237 parsoid={
26238 "modes": ["selser"],
26239 "scrubWikitext": true,
26240 "changes": [
26241 [ "#x", "remove"]
26242 ]
26243 }
26244 !! wikitext
26245 [[Test|<span id="x">foo</span>]]
26246 !! wikitext/edited
26247 !! end
26248
26249 !! test
26250 3a. Anchors: do not suppress numbered extlinks
26251 !! options
26252 parsoid={
26253 "modes": ["wt2wt"],
26254 "scrubWikitext": true
26255 }
26256 !! wikitext
26257 [http://foo.com]
26258 !! html/parsoid
26259 <a rel="mw:ExtLink" href="http://foo.com"></a>
26260 !! end
26261
26262 !! test
26263 3b. Anchors: do not suppress numbered extlinks
26264 !! options
26265 parsoid={
26266 "modes": ["wt2wt"],
26267 "scrubWikitext": true,
26268 "changes": [
26269 [ "#x", "remove"]
26270 ]
26271 }
26272 !! wikitext
26273 [http://foo.com <span id="x">foo</span>]
26274 !! wikitext/edited
26275 [http://foo.com]
26276 !! end
26277
26278 !!test
26279 Normalizations should be restricted to edited content
26280 !!options
26281 parsoid={
26282 "modes": ["selser"],
26283 "scrubWikitext": true,
26284 "changes": [
26285 [ "h1", "before", "<i></i>"]
26286 ]
26287 }
26288 !!wikitext
26289 a
26290 = =
26291 b
26292 !!wikitext/edited
26293 a
26294 = =
26295 b
26296 !!end
26297
26298 !! test
26299 1. Multiple normalizations (html2wt)
26300 !! options
26301 parsoid={
26302 "modes": ["html2wt"],
26303 "scrubWikitext": true
26304 }
26305 !! html
26306 <h2><i></i></h2>
26307 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
26308 </a><b><i></i></b>x</p>
26309 !! wikitext
26310
26311 [[foo]]
26312 x
26313
26314 !! end
26315
26316 !! test
26317 2. Multiple normalizations (selser)
26318 !! options
26319 parsoid={
26320 "modes": ["selser"],
26321 "scrubWikitext": true,
26322 "changes": [
26323 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
26324 ]
26325 }
26326 !! wikitext
26327 <span id="x">foo</span>
26328 !! wikitext/edited
26329 <span id="x">foo</span>
26330
26331 x
26332 !! end
26333
26334 !! test
26335 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
26336 !! options
26337 parsoid={
26338 "modes": ["html2wt"],
26339 "scrubWikitext": true
26340 }
26341 !! html/parsoid
26342 <p> hi</p>
26343 <p> hello</p>
26344 !! wikitext
26345 hi
26346
26347 hello
26348 !! end
26349
26350 !! test
26351 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
26352 !! options
26353 parsoid=html2wt
26354 !! html/parsoid
26355 <p> hi</p>
26356 <p> hello</p>
26357 !! wikitext
26358 <nowiki> </nowiki>hi
26359
26360 <nowiki> </nowiki> hello
26361 !! end
26362
26363 !! test
26364 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
26365 !! options
26366 parsoid={
26367 "modes": ["html2wt"],
26368 "scrubWikitext": true
26369 }
26370 !! html/parsoid
26371 <p>Foo
26372 bar
26373 baz</p>
26374
26375 <table><tr><td>Foo
26376 bar
26377 baz bang</td></tr></table>
26378
26379 <p><!--boo--> foo
26380 bar</p>
26381
26382 <p> foo
26383 bar<span>boo</span></p>
26384 !! wikitext
26385 Foo
26386 bar
26387 baz
26388
26389 {|
26390 |Foo
26391 bar
26392 baz bang
26393 |}
26394
26395 <!--boo-->foo
26396 bar
26397
26398 foo
26399 bar<span>boo</span>
26400 !! end
26401
26402 !! test
26403 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
26404 !! options
26405 parsoid={
26406 "modes": ["selser"],
26407 "scrubWikitext": true,
26408 "changes": [
26409 [ "p", "html", " a\n b" ]
26410 ]
26411 }
26412 !! wikitext
26413 xyz
26414 !! wikitext/edited
26415 a
26416 b
26417 !! end
26418
26419 !! test
26420 1. New links that end in spaces
26421 !! options
26422 parsoid={
26423 "modes": ["html2wt"],
26424 "scrubWikitext": false
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 ]]<nowiki/>is the capital of Germany.
26432
26433 [[Foo ]]'''bar'''
26434
26435 [[Boston ]] is a city.
26436 !! end
26437
26438 !! test
26439 2. New links that end in spaces
26440 !! options
26441 parsoid={
26442 "modes": ["html2wt"],
26443 "scrubWikitext": true
26444 }
26445 !! html/parsoid
26446 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
26447 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
26448 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
26449 !! wikitext
26450 [[Berlin]] is the capital of Germany.
26451
26452 [[Foo]] '''bar'''
26453
26454 [[Boston]] is a city.
26455 !! end
26456
26457 !! test
26458 1. Table cells with escapable prefixes
26459 !! options
26460 parsoid={
26461 "modes": ["html2wt"],
26462 "scrubWikitext": false
26463 }
26464 !! html
26465 <table>
26466 <tr><td>a</td></tr>
26467 <tr><td>-</td></tr>
26468 <tr><td>+</td></tr>
26469 </table>
26470 !! wikitext
26471 {|
26472 |a
26473 |-
26474 |<nowiki>-</nowiki>
26475 |-
26476 |<nowiki>+</nowiki>
26477 |}
26478 !! end
26479
26480 !! test
26481 2. Table cells with escapable prefixes
26482 !! options
26483 parsoid={
26484 "modes": ["html2wt"],
26485 "scrubWikitext": true
26486 }
26487 !! html
26488 <table>
26489 <tr><td>a</td></tr>
26490 <tr><td>-</td></tr>
26491 <tr><td>+</td></tr>
26492 </table>
26493 !! wikitext
26494 {|
26495 |a
26496 |-
26497 | -
26498 |-
26499 | +
26500 |}
26501 !! end
26502
26503 !! test
26504 3a. Table cells with escapable prefixes after edits
26505 !! options
26506 parsoid={
26507 "modes": ["selser"],
26508 "scrubWikitext": true,
26509 "changes": [
26510 [ "table tbody tr:first-child td:first-child", "remove"]
26511 ]
26512 }
26513 !! wikitext
26514 {|
26515 |a||-
26516 |}
26517 !! wikitext/edited
26518 {|
26519 | -
26520 |}
26521 !! end
26522
26523 !! test
26524 3b. Table cells with escapable prefixes after edits
26525 !! options
26526 parsoid={
26527 "modes": ["selser"],
26528 "scrubWikitext": true,
26529 "changes": [
26530 [ "table tbody tr:first-child td:first-child", "html", "-" ],
26531 [ "#x", "remove" ]
26532 ]
26533 }
26534 !! wikitext
26535 {|
26536 |pqr
26537 |<span id="x">foo</span>+
26538 |}
26539 !! wikitext/edited
26540 {|
26541 | -
26542 | +
26543 |}
26544 !! end
26545
26546 # FIXME: This test will fail because
26547 # normalization doesn't realize that the id attribute
26548 # will eliminate the escapable scenario
26549 !! test
26550 4a. Table cells without escapable prefixes after edits
26551 !! options
26552 parsoid={
26553 "modes": ["selser"],
26554 "scrubWikitext": true,
26555 "changes": [
26556 [ "#x", "html", "-" ]
26557 ]
26558 }
26559 !! wikitext
26560 {|
26561 | id="x" |abcd
26562 |}
26563 !! wikitext/edited
26564 {|
26565 | id="x" |-
26566 |}
26567 !! end
26568
26569 ## This tests normalizer's ability to discriminate between
26570 ## cells having identical content.
26571 !! test
26572 4b. Table cells without escapable prefixes after edits
26573 !! options
26574 parsoid={
26575 "modes": ["selser"],
26576 "scrubWikitext": true,
26577 "changes": [
26578 [ "td", "html", "-" ]
26579 ]
26580 }
26581 !! wikitext
26582 {|
26583 |a||b
26584 |}
26585 !! wikitext/edited
26586 {|
26587 | -||-
26588 |}
26589 !! end
26590
26591 ## This tests normalizer's ability to not be tripped by
26592 ## comments (and whitespace)
26593 !! test
26594 4c. Table cells without escapable prefixes after edits
26595 !! options
26596 parsoid={
26597 "modes": ["selser"],
26598 "scrubWikitext": true,
26599 "changes": [
26600 [ "table tbody tr td:first-child", "remove" ]
26601 ]
26602 }
26603 !! wikitext
26604 {|
26605 |-
26606 <!--foo--> |a||-
26607 |}
26608 !! wikitext/edited
26609 {|
26610 |-
26611 <!--foo--> | -
26612 |}
26613 !! end
26614
26615 ## This tests normalizer's ability to handle HTML cells
26616 !! test
26617 4d. Table cells without escapable prefixes after edits
26618 !! options
26619 parsoid={
26620 "modes": ["selser"],
26621 "scrubWikitext": true,
26622 "changes": [
26623 [ "td", "html", "-" ]
26624 ]
26625 }
26626 !! wikitext
26627 <table>
26628 <tr><td>a</td></tr>
26629 </table>
26630 !! wikitext/edited
26631 <table>
26632 <tr><td>-</td></tr>
26633 </table>
26634 !! end
26635
26636 ## T111151 Remove font elements without attributes
26637 !! test
26638 5a. font tags without attributes should be dropped in scrubWikitext mode
26639 !! options
26640 parsoid={
26641 "modes": ["html2wt"],
26642 "scrubWikitext": true
26643 }
26644 !! html
26645 <font>foo</font>
26646 <font><font>bar</font></font>
26647 <font class="x">boo</font>
26648 !! wikitext
26649 foo
26650 bar
26651 <font class="x">boo</font>
26652 !! end
26653
26654 !! test
26655 5b. font tags should not be dropped without scrubWikitext being enabled
26656 !! options
26657 parsoid={
26658 "modes": ["html2wt"],
26659 "scrubWikitext": false
26660 }
26661 !! html
26662 <font>foo</font>
26663 !! wikitext
26664 <font>foo</font>
26665 !! end
26666
26667 !! test
26668 Escape nowiki DOM elements
26669 !! options
26670 parsoid=html2wt
26671 !! html/parsoid
26672 <nowiki><i>foo</i></nowiki>
26673 !! wikitext
26674 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
26675 !! end
26676
26677 # This is meant to be an interim fix while we go about figuring out
26678 # how to not introduce these trailing <nowiki/>s in the first place.
26679 !! test
26680 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
26681 !! options
26682 parsoid=html2wt
26683 !! html/parsoid
26684 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
26685 y</p>
26686 <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>
26687 <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>
26688 !! wikitext
26689 x
26690 y
26691
26692 {{echo|
26693 1 = <nowiki/>}}
26694
26695 {{echo|
26696 1 = <nowiki/>
26697 }}
26698 !! end
26699
26700 # ---------------------------------------------------
26701 # End of tests spec'ing wikitext serialization norms |
26702 # ---------------------------------------------------
26703
26704 # T104032
26705 !! test
26706 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
26707 !! options
26708 parsoid=html2wt
26709 !! html/parsoid
26710 a<p>b</p>
26711 <b>c</b><p>d</p>
26712 <table><tr>
26713 <td>a<p>b</p></td>
26714 <td><b>c</b><p>d</p></td>
26715 </tr></table>
26716 !! wikitext
26717 a
26718
26719 b
26720
26721 '''c'''
26722
26723 d
26724 {|
26725 |a
26726 b
26727 |'''c'''
26728 d
26729 |}
26730 !! end
26731
26732 # -----------------------------------------------------------------
26733 # End of section for Parsoid-only html2wt tests for serialization
26734 # of new content
26735 # -----------------------------------------------------------------
26736
26737 # -----------------------------------------------------------------
26738 # The following section of tests are primarily to spec behavior of
26739 # the selective serializer. All these tests have manual selser
26740 # changes. The automated selser changes for all tests handle the
26741 # wide variation of changes, but these tests here capture specs
26742 # deterministically.
26743 # ----------------------------------------------------------------
26744
26745 ## T90517
26746 !! test
26747 Selser: New comments should not be lost
26748 !! options
26749 parsoid={
26750 "modes": ["selser"],
26751 "changes": [
26752 [ "#a", "after", "<!--c1-->" ],
26753 [ "#b", "before", "<!--c2-->" ]
26754 ]
26755 }
26756 !! wikitext
26757 <span id="a">a</span>
26758
26759 <span id="b">b</span>
26760 !! wikitext/edited
26761 <span id="a">a</span><!--c1-->
26762
26763 <!--c2--><span id="b">b</span>
26764 !! end
26765
26766 ## T89383
26767 !! test
26768 Selser: Check for validity of DSR before using it
26769 !! options
26770 parsoid={
26771 "modes": ["selser"],
26772 "changes": [
26773 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
26774 ]
26775 }
26776 !! wikitext
26777 <span id="a">a</span>
26778 !! wikitext/edited
26779 {{DISPLAYTITLE:foo}}
26780 <span id="a">a</span>
26781 !! end
26782
26783 !! test
26784 1. DOMDiff: Changes to <ref> content should be looked up using id
26785 !! options
26786 parsoid={
26787 "modes": ["selser"],
26788 "changes": [
26789 ["#X", "after", "bar"],
26790 ["#Y", "after", "baz"]
26791 ]
26792 }
26793 !! wikitext
26794 X <ref><span id="X">foo</span></ref>
26795 Y <ref name="a" />
26796 <references>
26797 <ref name="a"><span id="Y">foo</span></ref>
26798 </references>
26799 !! wikitext/edited
26800 X <ref><span id="X">foo</span>bar</ref>
26801 Y <ref name="a" />
26802 <references>
26803 <ref name="a"><span id="Y">foo</span>baz</ref>
26804 </references>
26805 !! end
26806
26807 !! test
26808 2. DOMDiff: Changes to <ref> content should be looked up using id
26809 !! options
26810 parsoid={
26811 "modes": ["selser"],
26812 "changes": [
26813 ["#Z", "after", "bar"]
26814 ]
26815 }
26816 !! wikitext
26817 A <ref>foo bar for a</ref>
26818 B <ref group="X" name="b" />
26819
26820 <references />
26821
26822 <references group="X">
26823 <ref name="b"><span id="Z">foo</span></ref>
26824 </references>
26825 !! wikitext/edited
26826 A <ref>foo bar for a</ref>
26827 B <ref group="X" name="b" />
26828
26829 <references />
26830
26831 <references group="X">
26832 <ref name="b"><span id="Z">foo</span>bar</ref>
26833 </references>
26834 !! end
26835
26836 !! test
26837 Empty LI (T49673)
26838 !! wikitext
26839 * a
26840 *
26841 *
26842 * b
26843 !! html/php+tidy
26844 <ul>
26845 <li>a</li>
26846 <li class="mw-empty-li"></li>
26847 <li class="mw-empty-li"></li>
26848 <li>b</li>
26849 </ul>
26850 !! end