Merge "Update weblinks in comments from HTTP to HTTPS"
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
1 # MediaWiki Parser test cases
2 # Some taken from https://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 # title=[[XXX]] run test using article title XXX
22 # language=XXX set content language to XXX for this test
23 # variant=XXX set the variant of language for this test (eg zh-tw)
24 # disabled do not run test
25 # parsoid parsoid-specific options (not run by PHP parser unless
26 # the test includes an html/php section)
27 # php php-only test (not run by the parsoid parser unless
28 # the test includes an html/parsoid section)
29 # showtitle make the first line the title
30 # showindicators make the first lines the page status indicators
31 # comment run through Linker::formatComment() instead of main parser
32 # local format section links in edit comment text as local links
33 # notoc disable table of contents
34 # thumbsize=NNN set the default thumb size to NNNpx for this test
35 #
36 # You can also set the following parser properties via test options:
37 # wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
38 # wgLinkHolderBatchSize, wgRawHtml, wgInterwikiMagic,
39 # wgEnableMagicLinks
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 (https://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 # https://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: https://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 Don't parse <nowiki><span class="error"></nowiki> (T149622)
1425 !! wikitext
1426 <nowiki><span class="error"></nowiki>
1427 !! html/php
1428 <p>&lt;span class="error"&gt;
1429 </p>
1430 !! end
1431
1432 !! test
1433 nowiki 3
1434 !! wikitext
1435 :There is not nowiki.
1436 :There is <nowiki>nowiki</nowiki>.
1437
1438 #There is not nowiki.
1439 #There is <nowiki>nowiki</nowiki>.
1440
1441 *There is not nowiki.
1442 *There is <nowiki>nowiki</nowiki>.
1443 !! html/php
1444 <dl><dd>There is not nowiki.</dd>
1445 <dd>There is nowiki.</dd></dl>
1446 <ol><li>There is not nowiki.</li>
1447 <li>There is nowiki.</li></ol>
1448 <ul><li>There is not nowiki.</li>
1449 <li>There is nowiki.</li></ul>
1450
1451 !! html/parsoid
1452 <dl><dd data-parsoid='{}'>There is not nowiki.</dd>
1453 <dd data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</dd></dl>
1454
1455 <ol><li data-parsoid='{}'>There is not nowiki.</li>
1456 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ol>
1457
1458 <ul><li data-parsoid='{}'>There is not nowiki.</li>
1459 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ul>
1460 !! end
1461
1462 !! test
1463 Entities inside <nowiki>
1464 !! wikitext
1465 <nowiki>&lt;</nowiki>
1466 !! html
1467 <p>&lt;
1468 </p>
1469 !! end
1470
1471 !! test
1472 Entities inside template parameters
1473 !! wikitext
1474 {{echo|&ndash;}}
1475 !! html/php+tidy
1476 <p>–</p>
1477 !! html/parsoid
1478 <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>
1479 !! end
1480
1481 !! test
1482 Properly escape nowiki when combined with other wiki markup
1483 !! options
1484 parsoid=html2wt
1485 !! html/parsoid
1486 <p>* &lt;/nowiki&gt; tag</p>
1487 !! wikitext
1488 <nowiki>*</nowiki> <nowiki>&lt;/nowiki&gt;</nowiki> tag
1489 !! end
1490
1491 !! test
1492 T93824: Put escaped HTML tags inside nowiki
1493 !! options
1494 parsoid=html2wt
1495 !! html/parsoid
1496 <p>&lt;h2&gt;foo&lt;/h2&gt;</p>
1497 !! wikitext
1498 <nowiki><h2>foo</h2></nowiki>
1499 !! end
1500
1501 !! test
1502 T71950: 1. Put nowiki as close to cause as possible, even with non-quote escapable chars
1503 !! options
1504 parsoid=html2wt
1505 !! html/parsoid
1506 <p>This text: L'<a rel="mw:WikiLink" href="./Foo">Foo</a>
1507 This text: L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1508 This text: L'''<a rel="mw:WikiLink" href="./Foo">Foo</a>''</p>
1509 !! wikitext
1510 This text: L'[[Foo]]
1511 This text: L<nowiki>''</nowiki>[[Foo]]
1512 This text: L<nowiki>'''</nowiki>[[Foo]]<nowiki>''</nowiki>
1513 !! end
1514
1515 # This test fails because wikitext whitespace is not normalized before comparing.
1516 !! test
1517 T71950: 2. Put nowiki as close to cause as possible, after ' :'
1518 !! options
1519 parsoid=html2wt
1520 !! html/parsoid
1521 <p>This text : L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1522 </p>
1523 !! wikitext
1524 This text : L<nowiki>''</nowiki>[[Foo]]
1525 !! end
1526
1527 # This test and the next one are html2wt only as they test that incorrect wikitext
1528 # passed in template arguments gets escaped or wrapped in nowikis where required.
1529 !! test
1530 T71482: Use {{!}} instead of nowiki for single pipe in template argument
1531 !! options
1532 parsoid=html2wt
1533 !! html/parsoid
1534 <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>
1535 <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>
1536 !! wikitext
1537 {{echo|foo{{!}}bar}}
1538 {{echo|<nowiki>foo|bar |[[</nowiki>}}
1539 !! end
1540
1541 !! test
1542 T53961: Output correct nowikis in template arguments
1543 !! options
1544 parsoid=html2wt
1545 !! html/parsoid
1546 <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>
1547 <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>
1548 <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>
1549 <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>
1550 <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>
1551 !! wikitext
1552 {{echo|a [ b}}
1553 {{echo|<nowiki>a }} b</nowiki>}}
1554 {{echo|<nowiki>a [[ b</nowiki>}}
1555 {{echo|<nowiki>a | {{ ]]</nowiki>}}
1556 {{echo|a <nowiki>}</nowiki>}}
1557 !! end
1558
1559 !! test
1560 Cases where "!!" needs nowiki protection
1561 !! options
1562 parsoid=html2wt
1563 !! html/parsoid
1564 <table>
1565 <tr><th>this needs protection !! here</th></tr>
1566 </table>
1567
1568 <table>
1569 <tr><th>this does not need
1570 protection !! here</th></tr>
1571 </table>
1572 !! wikitext
1573 {|
1574 !<nowiki>this needs protection !! here</nowiki>
1575 |}
1576
1577 {|
1578 !this does not need
1579 protection !! here
1580 |}
1581 !! end
1582
1583 ###
1584 ### Comments
1585 ###
1586 !! test
1587 Comments and Indent-Pre
1588 !! wikitext
1589 <!-- comment 1 --> asdf
1590
1591 <!-- comment 1 --> asdf
1592 <!-- comment 2 -->
1593
1594 <!-- comment 1 --> asdf
1595 <!-- comment 2 -->xyz
1596
1597 <!-- comment 1 --> asdf
1598 <!-- comment 2 --> xyz
1599 !! html
1600 <pre>asdf
1601 </pre>
1602 <pre>asdf
1603 </pre>
1604 <pre>asdf
1605 </pre>
1606 <p>xyz
1607 </p>
1608 <pre>asdf
1609 xyz
1610 </pre>
1611 !! end
1612
1613 !! test
1614 Comment test 2a
1615 !! wikitext
1616 asdf
1617 <!-- comment 1 -->
1618 jkl
1619 !! html
1620 <p>asdf
1621 jkl
1622 </p>
1623 !! end
1624
1625 !! test
1626 Comment test 2b
1627 !! wikitext
1628 asdf
1629 <!-- comment 1 -->
1630
1631 jkl
1632 !! html
1633 <p>asdf
1634 </p><p>jkl
1635 </p>
1636 !! end
1637
1638 !! test
1639 Comment test 3
1640 !! wikitext
1641 asdf
1642 <!-- comment 1 -->
1643 <!-- comment 2 -->
1644 jkl
1645 !! html
1646 <p>asdf
1647 jkl
1648 </p>
1649 !! end
1650
1651 !! test
1652 Comment test 4
1653 !! wikitext
1654 asdf<!-- comment 1 -->jkl
1655 !! html
1656 <p>asdfjkl
1657 </p>
1658 !! end
1659
1660 !! test
1661 Comment spacing
1662 !! wikitext
1663 a
1664 <!-- foo --> b <!-- bar -->
1665 c
1666 !! html
1667 <p>a
1668 </p>
1669 <pre> b
1670 </pre>
1671 <p>c
1672 </p>
1673 !! end
1674
1675 !! test
1676 Comment whitespace
1677 !! wikitext
1678 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1679 !! html
1680
1681 !! end
1682
1683 !! test
1684 Comment semantics and delimiters
1685 !! wikitext
1686 <!-- --><!----><!-----><!------>
1687 !! html/php
1688
1689 !! html/parsoid
1690 <!-- --><!----><!--&#x2D;--><!--&#x2D;&#x2D;-->
1691 !! end
1692
1693 !! test
1694 Comment semantics and delimiters, redux
1695 !! wikitext
1696 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1697 -- foo -- funky huh? ... -->
1698 !! html/php
1699
1700 !! html/parsoid
1701 <!-- In SGML every "foo" here would actually show up in the text &#x2D;&#x2D; foo &#x2D;&#x2D; bar
1702 &#x2D;&#x2D; foo &#x2D;&#x2D; funky huh? ... -->
1703 !! end
1704
1705 !! test
1706 Comment semantics and delimiters: directors cut
1707 !! wikitext
1708 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1709 everything starting with < followed by !-- until the first -- and > we see,
1710 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1711 -->-->
1712 !! html/php
1713 <p>--&gt;
1714 </p>
1715 !! html/parsoid
1716 <!-- ... However we like to keep things simple and somewhat XML&#x2D;ish so we eat
1717 everything starting with < followed by !&#x2D;&#x2D; until the first &#x2D;&#x2D; and &#x3E; we see,
1718 that wouldn't be valid XML however, since in XML &#x2D;&#x2D; has to terminate a comment
1719 --><p>--></p>
1720 !! end
1721
1722 !! test
1723 Comment semantics: nesting
1724 !! wikitext
1725 <!--<!-- no, we're not going to do anything fancy here -->-->
1726 !! html/php
1727 <p>--&gt;
1728 </p>
1729 !! html/parsoid
1730 <!--<!&#x2D;&#x2D; no, we're not going to do anything fancy here --><p>--></p>
1731 !! end
1732
1733 # Parsoid closes the unclosed comment, even if it means a slight
1734 # round-trip diff.
1735 !! test
1736 Comment semantics: unclosed comment at end
1737 !! options
1738 parsoid=wt2html,html2html
1739 !! wikitext
1740 <!--This comment will run out to the end of the document
1741 !! html/php
1742
1743 !! html/parsoid
1744 <!--This comment will run out to the end of the document-->
1745 !! end
1746
1747 !! test
1748 Comment semantics: normalize comments to play nice with XML and browsers
1749 !! wikitext
1750 <!-- Browsers --!> think this is closed -->
1751 <!--> This would normally be text -->
1752 <!---> As would this -->
1753 <!-- XML doesn't like trailing dashes -------->
1754 <!-- Nor doubled hyphens -- anywhere in the data -->
1755 But this is not a comment.
1756 !! html/php
1757 <p>But this is not a comment.
1758 </p>
1759 !! html/parsoid
1760 <!-- Browsers &#x2D;&#x2D;!&#x3E; think this is closed -->
1761 <!--&#x3E; This would normally be text -->
1762 <!--&#x2D;&#x3E; As would this -->
1763 <!-- XML doesn't like trailing dashes &#x2D;&#x2D;&#x2D;&#x2D;&#x2D;&#x2D;-->
1764 <!-- Nor doubled hyphens &#x2D;&#x2D; anywhere in the data -->
1765 <p>But this is not a comment.</p>
1766 !! end
1767
1768 !! test
1769 Comment semantics: round-trip even text which contains encoded -->
1770 !! wikitext
1771 <!-- hello & goodbye - > --&gt; --&amp;gt; --&xx -->
1772 !! html/parsoid
1773 <!-- hello &#x26; goodbye &#x2D; &#x3E; &#x2D;&#x2D;&#x3E; &#x2D;&#x2D;&#x26;gt; &#x2D;&#x2D;&#x26;xx -->
1774 !! end
1775
1776 !! test
1777 Comment in template title
1778 !! wikitext
1779 {{f<!---->oo}}
1780 !! html
1781 <p>FOO
1782 </p>
1783 !! end
1784
1785 !! test
1786 Comment on its own line post-expand
1787 !! wikitext
1788 a
1789 {{blank}}<!---->
1790 b
1791 !! html
1792 <p>a
1793 </p><p>b
1794 </p>
1795 !! end
1796
1797 !! test
1798 Comment on its own line post-expand with non-significant whitespace
1799 !! wikitext
1800 a
1801 {{blank}} <!---->
1802 b
1803 !! html
1804 <p>a
1805 </p><p>b
1806 </p>
1807 !! end
1808
1809 !! test
1810 Multiple comments should still parse as SOL-transparent
1811 !! options
1812 parsoid=wt2html,wt2wt
1813 !! wikitext
1814 <!--c1-->*a
1815 <!--c2--><!--c3--><!--c4-->*b
1816 !! html/php
1817 <ul><li>a</li>
1818 <li>b</li></ul>
1819
1820 !! html/parsoid
1821 <!--c1--><ul>
1822 <li>a
1823 </li>
1824 <!--c2--><!--c3--><!--c4-->
1825 <li>b
1826 </li>
1827 </ul>
1828 !! end
1829
1830 ###
1831 ### paragraph wrapping tests
1832 ###
1833 !! test
1834 No block tags
1835 !! wikitext
1836 a
1837
1838 b
1839 !! html
1840 <p>a
1841 </p><p>b
1842 </p>
1843 !! end
1844
1845 !! test
1846 Block tag on one line (<div>)
1847 !! wikitext
1848 a <div>foo</div>
1849
1850 b
1851 !! html
1852 a <div>foo</div>
1853 <p>b
1854 </p>
1855 !! html+tidy
1856 <p>a</p>
1857 <div>foo</div>
1858 <p>b</p>
1859 !! end
1860
1861 !! test
1862 Block tag on one line (<blockquote>)
1863 !! wikitext
1864 a <blockquote>foo</blockquote>
1865
1866 b
1867 !! html
1868 a <blockquote>foo</blockquote>
1869 <p>b
1870 </p>
1871 !! html+tidy
1872 <p>a</p>
1873 <blockquote>
1874 <p>foo</p>
1875 </blockquote>
1876 <p>b</p>
1877 !! end
1878
1879 !! test
1880 Block tag on both lines (<div>)
1881 !! wikitext
1882 a <div>foo</div>
1883
1884 b <div>foo</div>
1885 !! html
1886 a <div>foo</div>
1887 b <div>foo</div>
1888
1889 !! html+tidy
1890 <p>a</p>
1891 <div>foo</div>
1892 <p>b</p>
1893 <div>foo</div>
1894 !! end
1895
1896 !! test
1897 Block tag on both lines (<blockquote>)
1898 !! wikitext
1899 a <blockquote>foo</blockquote>
1900
1901 b <blockquote>foo</blockquote>
1902 !! html
1903 a <blockquote>foo</blockquote>
1904 b <blockquote>foo</blockquote>
1905
1906 !! html+tidy
1907 <p>a</p>
1908 <blockquote>
1909 <p>foo</p>
1910 </blockquote>
1911 <p>b</p>
1912 <blockquote>
1913 <p>foo</p>
1914 </blockquote>
1915 !! end
1916
1917 !! test
1918 Multiple lines without block tags
1919 !! wikitext
1920 <div>foo</div> a
1921 b
1922 c
1923 d<!--foo--> e
1924 x <div>foo</div> z
1925 !! html
1926 <div>foo</div> a
1927 <p>b
1928 c
1929 d e
1930 </p>
1931 x <div>foo</div> z
1932
1933 !! html+tidy
1934 <div>foo</div>
1935 <p>a</p>
1936 <p>b c d e</p>
1937 <p>x</p>
1938 <div>foo</div>
1939 <p>z</p>
1940 !! end
1941
1942 # Tidy strips out the empty <div> tags. Parsoid doesn't.
1943 # So, we have a separate section for Parsoid. We don't want
1944 # to mimic this stripping behavior in Parsoid. It affects
1945 # editing experience and also requires us to maintain additional
1946 # info for RT-ing.
1947 !! test
1948 Empty lines between lines with block tags
1949 !! wikitext
1950 <div></div>
1951
1952
1953 <div></div>a
1954
1955 b
1956 <div>a</div>b
1957
1958 <div>b</div>d
1959
1960
1961 <div>e</div>
1962 !! html
1963 <div></div>
1964 <p><br />
1965 </p>
1966 <div></div>a
1967 <p>b
1968 </p>
1969 <div>a</div>b
1970 <div>b</div>d
1971 <p><br />
1972 </p>
1973 <div>e</div>
1974
1975 !! html+tidy
1976 <p><br /></p>
1977 <p>a</p>
1978 <p>b</p>
1979 <div>a</div>
1980 <p>b</p>
1981 <div>b</div>
1982 <p>d</p>
1983 <p><br /></p>
1984 <div>e</div>
1985 !! html/parsoid
1986 <div data-parsoid='{"stx":"html"}'></div>
1987
1988 <p><br /></p>
1989 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
1990
1991 <p>b</p>
1992 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
1993
1994 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
1995
1996 <p><br /></p>
1997 <div data-parsoid='{"stx":"html"}'>e</div>
1998 !! end
1999
2000 ## PHP parser emits output which is broken
2001 !! test
2002 Unclosed HTML p-tags should be handled properly
2003 !! wikitext
2004 <div><p>foo</div>
2005 a
2006
2007 b
2008 !! html/php+tidy
2009 <div>
2010 <p>foo</p>
2011 </div>
2012 <p>a</p>
2013 <p>b</p>
2014 !! html/parsoid
2015 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
2016 <p>a</p>
2017 <p>b</p>
2018 !! end
2019
2020 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
2021 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
2022 ## them for now.
2023 !! test
2024 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
2025 !! options
2026 parsoid=wt2html
2027 !! wikitext
2028 a [[Category:A1]] [[Category:A2]]
2029 [[Category:A3]]
2030 [[Category:A4]]
2031 !! html/parsoid
2032 <p>a</p>
2033 <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"/>
2034 !! end
2035
2036 !! test
2037 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
2038 !! options
2039 parsoid=wt2html
2040 !! wikitext
2041 [[Category:A1]]a
2042 !! html/parsoid
2043 <link rel="mw:PageProp/Category" href="./Category:A1"/><p>a</p>
2044 !! end
2045
2046 ###
2047 ### Preformatted text
2048 ###
2049 !! test
2050 Preformatted text
2051 !! wikitext
2052 This is some
2053 Preformatted text
2054 With ''italic''
2055 And '''bold'''
2056 And a [[Main Page|link]]
2057 !! html
2058 <pre>This is some
2059 Preformatted text
2060 With <i>italic</i>
2061 And <b>bold</b>
2062 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
2063 </pre>
2064 !! end
2065
2066 !! test
2067 Tabs don't trigger preformatted text
2068 !! wikitext
2069 This is not
2070 preformatted text.
2071 This is preformatted text.
2072 So is this.
2073 !! html/php
2074 <p> This is not
2075 preformatted text.
2076 </p>
2077 <pre>This is preformatted text.
2078 So is this.
2079 </pre>
2080 !! html/parsoid
2081 <p> This is not
2082 preformatted text.</p>
2083 <pre>This is preformatted text.
2084 So is this.</pre>
2085 !! end
2086
2087 !! test
2088 Space before tab needs nowiki pre protection
2089 !! options
2090 parsoid=html2wt
2091 !! html/parsoid
2092 <p> a</p>
2093 !! wikitext
2094 <nowiki> </nowiki> a
2095 !! end
2096
2097 !! test
2098 Ident preformatting with inline content
2099 !! wikitext
2100 a
2101 ''b''
2102 !! html
2103 <pre>a
2104 <i>b</i>
2105 </pre>
2106 !! end
2107
2108 !! test
2109 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
2110 !! wikitext
2111 <pre><nowiki>
2112 <b>
2113 <cite>
2114 <em>
2115 </nowiki></pre>
2116 !! html
2117 <pre>
2118 &lt;b&gt;
2119 &lt;cite&gt;
2120 &lt;em&gt;
2121 </pre>
2122
2123 !! end
2124
2125 !! test
2126 Regression with preformatted in <center>
2127 !! wikitext
2128 <center>
2129 Blah
2130 </center>
2131 !! html
2132 <center>
2133 <pre>Blah
2134 </pre>
2135 </center>
2136
2137 !! end
2138
2139 !! test
2140 Bug 52763: Preformatted in <blockquote>
2141 !! wikitext
2142 <blockquote>
2143 Blah
2144 {|
2145 |
2146 indented cell (no pre-wrapping!)
2147 |}
2148 </blockquote>
2149 !! html
2150 <blockquote>
2151 <p> Blah
2152 </p>
2153 <table>
2154 <tr>
2155 <td>
2156 <p> indented cell (no pre-wrapping!)
2157 </p>
2158 </td></tr></table>
2159 </blockquote>
2160
2161 !! end
2162
2163 !! test
2164 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
2165 !! wikitext
2166 <blockquote>
2167 Foo
2168
2169 Bar
2170 </blockquote>
2171 !! html
2172 <blockquote>
2173 <p>Foo
2174 </p><p>Bar
2175 </p>
2176 </blockquote>
2177
2178 !! end
2179
2180 !! test
2181 Bug 15491: <ins>/<del> in blockquote
2182 !! wikitext
2183 <blockquote>
2184 Foo <del>bar</del> <ins>baz</ins> quux
2185 </blockquote>
2186 !! html
2187 <blockquote>
2188 <p>Foo <del>bar</del> <ins>baz</ins> quux
2189 </p>
2190 </blockquote>
2191
2192 !! end
2193
2194 # Note that the p-wrapping is newline sensitive, which could be
2195 # considered a bug: tidy will wrap only the 'Foo' in the example
2196 # below in a <p> tag. (see comment 23-25 of bug #6200)
2197 !! test
2198 Bug 15491: <ins>/<del> in blockquote (2)
2199 !! wikitext
2200 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2201 </blockquote>
2202 !! html
2203 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2204 </blockquote>
2205
2206 !! html+tidy
2207 <blockquote>
2208 <p>Foo</p>
2209 <del>bar</del> <ins>baz</ins> quux</blockquote>
2210 !! end
2211
2212 !! test
2213 <pre> with attributes (bug 3202)
2214 !! wikitext
2215 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2216 !! html
2217 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2218
2219 !! end
2220
2221 !! test
2222 <pre> with width attribute (bug 3202)
2223 !! wikitext
2224 <pre width="8">Narrow screen goodies</pre>
2225 !! html
2226 <pre width="8">Narrow screen goodies</pre>
2227
2228 !! end
2229
2230 !! test
2231 <pre> with forbidden attribute (bug 3202)
2232 !! wikitext
2233 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
2234 !! html
2235 <pre width="8">Narrow screen goodies</pre>
2236
2237 !! end
2238
2239 !! test
2240 Entities inside <pre>
2241 !! wikitext
2242 <pre>&lt;</pre>
2243 !! html
2244 <pre>&lt;</pre>
2245
2246 !! end
2247
2248 !! test
2249 <pre> with forbidden attribute values (bug 3202)
2250 !! wikitext
2251 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
2252 !! html
2253 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
2254
2255 !! end
2256
2257 !! test
2258 <nowiki> inside <pre> (bug 13238)
2259 !! wikitext
2260 <pre>
2261 <nowiki>
2262 </pre>
2263 <pre>
2264 <nowiki></nowiki>
2265 </pre>
2266 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
2267 !! html
2268 <pre>
2269 &lt;nowiki&gt;
2270 </pre>
2271 <pre>
2272
2273 </pre>
2274 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2275
2276 !! end
2277
2278 !! test
2279 <nowiki> inside of #tag:pre
2280 !! wikitext
2281 {{#tag:pre|Foo <nowiki>&rarr;bar</nowiki>}}
2282 !! html/php
2283 <pre>Foo &#8594;bar</pre>
2284
2285 !! html/parsoid
2286 <pre about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"#tag:pre","function":"#tag"},"params":{"1":{"wt":"Foo &lt;nowiki>&amp;rarr;bar&lt;/nowiki>"}},"i":0}}]}'>Foo <span typeof="mw:Entity">→</span>bar</pre>
2287 !! end
2288
2289 !! test
2290 <nowiki> and <pre> preference (first one wins)
2291 !! wikitext
2292 <pre>
2293 <nowiki>
2294 </pre>
2295 </nowiki>
2296 </pre>
2297
2298 <nowiki>
2299 <pre>
2300 <nowiki>
2301 </pre>
2302 </nowiki>
2303 </pre>
2304
2305 !! html/php
2306 <pre>
2307 &lt;nowiki&gt;
2308 </pre>
2309 <p>&lt;/nowiki&gt;
2310 &lt;/pre&gt;
2311 </p><p>
2312 &lt;pre&gt;
2313 &lt;nowiki&gt;
2314 &lt;/pre&gt;
2315
2316 &lt;/pre&gt;
2317 </p>
2318 !! html/parsoid
2319 <pre data-parsoid='{"stx":"html","strippedNL":true}'>&lt;nowiki>
2320 </pre>
2321 <p><span typeof="mw:Placeholder" data-parsoid='{"src":"&lt;/nowiki>"}'>&lt;/nowiki></span>
2322 &lt;/pre></p>
2323
2324 <p><span typeof="mw:Nowiki">
2325 &lt;pre>
2326 &lt;nowiki>
2327 &lt;/pre>
2328 </span>
2329 &lt;/pre></p>
2330 !! end
2331
2332 !! test
2333 </pre> inside nowiki
2334 !! wikitext
2335 <nowiki></pre></nowiki>
2336 !! html
2337 <p>&lt;/pre&gt;
2338 </p>
2339 !! end
2340
2341 # Parsoid doesn't strip empty tags, like Tidy does.
2342 !! test
2343 Empty pre; pre inside other HTML tags (bug 54946)
2344 !! options
2345 parsoid=wt2html,wt2wt
2346 !! wikitext
2347 a
2348
2349 <div><pre>
2350 foo
2351 </pre></div>
2352 <pre></pre>
2353 !! html/php
2354 <p>a
2355 </p>
2356 <div><pre>
2357 foo
2358 </pre></div>
2359 <pre></pre>
2360
2361 !! html/php+tidy
2362 <p>a</p>
2363 <div>
2364 <pre>
2365 foo
2366 </pre></div>
2367 !! html/parsoid
2368 <p>a</p>
2369
2370 <div><pre>foo
2371 </pre></div>
2372 <pre></pre>
2373 !! end
2374
2375 !! test
2376 HTML pre followed by indent-pre
2377 !! wikitext
2378 <pre>foo</pre>
2379 bar
2380 !! html
2381 <pre>foo</pre>
2382 <pre>bar
2383 </pre>
2384 !! end
2385
2386 # Note that tidy removes the empty <p> tags from the start and end.
2387 # Parsoid does not, by design.
2388 !!test
2389 Block tag pre
2390 !! wikitext
2391 <p><pre>foo</pre></p>
2392 !! html/php+tidy
2393 <pre>
2394 foo
2395 </pre>
2396 !! html/parsoid
2397 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2398 !!end
2399
2400 !!test
2401 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2402 !! wikitext
2403 {{echo|}}
2404 !! html
2405
2406 !!end
2407
2408 !!test
2409 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2410 !! wikitext
2411 {{echo|
2412 foo}}
2413 !! html
2414 <p>foo
2415 </p>
2416 !!end
2417
2418 !! test
2419 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2420 !! wikitext
2421 {{echo|a
2422 b}}
2423 !! html
2424 <pre>a
2425 </pre>
2426 <p>b
2427 </p>
2428 !!end
2429
2430 !! test
2431 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2432 !! wikitext
2433 {{echo|a
2434 b
2435 c
2436 d
2437 e
2438 }}
2439 !! html
2440 <pre>a
2441 </pre>
2442 <p>b
2443 c
2444 </p>
2445 <pre>d
2446 </pre>
2447 <p>e
2448 </p>
2449 !!end
2450
2451 !!test
2452 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2453 !! wikitext
2454 {{echo| foo}}
2455
2456 {{echo| foo}}{{echo| bar}}
2457
2458 {{echo| foo}}
2459 {{echo| bar}}
2460
2461 {{echo|<!--cmt--> foo}}
2462
2463 <!--cmt-->{{echo| foo}}
2464
2465 {{echo|{{echo| }}bar}}
2466 !! html
2467 <pre>foo
2468 </pre>
2469 <pre>foo bar
2470 </pre>
2471 <pre>foo
2472 bar
2473 </pre>
2474 <pre>foo
2475 </pre>
2476 <pre>foo
2477 </pre>
2478 <pre>bar
2479 </pre>
2480 !!end
2481
2482 !! test
2483 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2484 !! wikitext
2485 {{echo| }}a
2486
2487 {{echo|
2488 }}a
2489
2490 {{echo|
2491 b}}
2492
2493 {{echo|a
2494 }}b
2495
2496 {{echo|a
2497 }} b
2498 !! html
2499 <pre>a
2500 </pre>
2501 <p><br />
2502 </p>
2503 <pre>a
2504 </pre>
2505 <p><br />
2506 </p>
2507 <pre>b
2508 </pre>
2509 <p>a
2510 </p>
2511 <pre>b
2512 </pre>
2513 <p>a
2514 </p>
2515 <pre>b
2516 </pre>
2517 !!end
2518
2519 !! test
2520 Pres with newline attributes
2521 !! wikitext
2522 <pre class="one
2523 two">hi</pre>
2524 !! html/php
2525 <pre class="one two">hi</pre>
2526
2527 !! html/parsoid
2528 <pre class="one
2529 two" data-parsoid='{"stx":"html"}'>hi</pre>
2530 !! end
2531
2532 !! test
2533 Things that look like <pre> tags aren't treated as such
2534 !! wikitext
2535 Barack Obama <President> of the United States
2536 <President></President>
2537 !! html
2538 <p>Barack Obama &lt;President&gt; of the United States
2539 &lt;President&gt;&lt;/President&gt;
2540 </p>
2541 !! end
2542
2543 !! test
2544 Handle broken pre-like tags (bug 64025)
2545 !! options
2546 parsoid=wt2html
2547 !! wikitext
2548 {{echo|<pre <pre>x</pre>}}
2549
2550 <table><pre </table>
2551 !! html/php
2552 <pre>x</pre>
2553 <table>&lt;pre </table>
2554
2555 !! html/php+tidy
2556 <pre>
2557 x
2558 </pre>
2559 <p>&lt;pre</p>
2560 !! html/parsoid
2561 <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>
2562
2563
2564 <p>&lt;pre </p>
2565
2566 <table></table>
2567 !! end
2568
2569 !! test
2570 Parsoid: handle pre with space after attribute
2571 !! options
2572 parsoid=wt2html
2573 !! wikitext
2574 <pre style="width:50%;" >{{echo|foo}}</pre>
2575 !! html/php
2576 <pre style="width:50%;">{{echo|foo}}</pre>
2577
2578 !! html/parsoid
2579 <pre style="width:50%;">{{echo|foo}}</pre>
2580 !! end
2581
2582 # TODO / maybe: fix wt2wt for this
2583 !! test
2584 Parsoid: Don't paragraph-wrap fosterable content
2585 !! options
2586 parsoid=wt2html
2587 !! wikitext
2588 {|
2589 <td></td>
2590 <td></td>
2591
2592
2593
2594 |}
2595 !! html
2596 <table>
2597
2598 <tbody>
2599 <tr>
2600 <td></td>
2601
2602 <td></td></tr>
2603
2604
2605
2606 </tbody></table>
2607 !! end
2608
2609 !! test
2610 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2611 !! options
2612 parsoid=wt2html
2613 !! wikitext
2614 {|
2615 <td>
2616 <td>
2617 </td>
2618
2619
2620
2621 |}
2622 !! html
2623 <table>
2624
2625 <tbody>
2626 <tr>
2627 <td></td>
2628
2629 <td>
2630 </td></tr>
2631
2632
2633
2634 </tbody></table>
2635 !! end
2636
2637
2638 #--------------------------------------------------------------------
2639 # Transclusion parameter whitespace stripping tests
2640 # Behavior is different for positional and named parameters
2641 #--------------------------------------------------------------------
2642 !! test
2643 Templates: Strip leading and trailing whitespace from named-param values
2644 !! wikitext
2645 {{echo|1= a }}
2646
2647 {{echo|1= {{echo|b}} }}
2648
2649 {{echo| 1 =
2650 c }}
2651
2652 {{echo| 1 =
2653 * d
2654 }}
2655 !! html
2656 <p>a
2657 </p><p>b
2658 </p><p>c
2659 </p>
2660 <ul><li> d</li></ul>
2661
2662 !! end
2663
2664 !! test
2665 Templates: Don't strip whitespace from positional-param values
2666 !! wikitext
2667 {{echo|a }}
2668
2669 {{echo|{{echo|b}} }}
2670
2671 {{echo| c
2672 }}
2673
2674 {{echo| {{echo|d}}
2675 }}
2676
2677 {{echo|
2678 e}}
2679
2680 {{echo|
2681 * f}}
2682
2683 {{echo|
2684 }}g
2685 !! html
2686 <p>a
2687 </p><p>b
2688 </p>
2689 <pre>c
2690 </pre>
2691 <p><br />
2692 </p>
2693 <pre>d
2694 </pre>
2695 <p><br />
2696 </p>
2697 <pre>e
2698 </pre>
2699 <p><br />
2700 </p>
2701 <ul><li> f</li></ul>
2702 <p><br />
2703 </p>
2704 <pre>g
2705 </pre>
2706 !! end
2707
2708 !! test
2709 Templates: Handle empty comment-and-ws-only lines correctly
2710 !! wikitext
2711 {{echo|foo
2712 <!--should be ignored-->
2713 <!--should be ignored as well-->
2714 bar}}
2715 !! html
2716 <p>foo
2717 bar
2718 </p>
2719 !! end
2720
2721 !! test
2722 Templates: Handle comments in the target
2723 !! wikitext
2724 {{echo
2725 <!-- should be ignored -->
2726 |foo}}
2727
2728 {{echo<!-- should be ignored -->
2729 |foo}}
2730
2731 {{echo<!-- should be ignored -->|foo}}
2732
2733 {{<!-- should be ignored -->echo|foo}}
2734 !!html/parsoid
2735 <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>
2736
2737 <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>
2738
2739 <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>
2740
2741 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2742 !!end
2743
2744 !! test
2745 Templates: Handle comments in parameter names (bug 67657)
2746 !! wikitext
2747 {{echo|1
2748 <!-- should be ignored -->
2749 =foo}}
2750
2751 {{echo|
2752 <!-- should be ignored -->
2753 1 = foo}}
2754
2755 {{echo|1<!-- should be ignored -->=foo}}
2756
2757 {{echo|<!-- should be ignored -->1=foo}}
2758 !!html/parsoid
2759 <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>
2760
2761 <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>
2762
2763 <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>
2764
2765 <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>
2766 !!end
2767
2768 !! test
2769 Templates: Other wikitext in parameter names (bug 67657)
2770 !! wikitext
2771 {{echo|''1''=foo}}
2772 !!html/parsoid
2773 <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>
2774 !!html/php
2775 <p>{{{1}}}
2776 </p>
2777 !!end
2778
2779 #--------------------------------------------------------------------
2780 # Transclusion parameter escaping tests
2781 #--------------------------------------------------------------------
2782 !! test
2783 Templates: Parsoid parameter escaping test 1
2784 !! wikitext
2785 {{echo|[foo]|{{echo|[bar]}}}}
2786 !! html/php+tidy
2787 <p>[foo]</p>
2788 !! html/parsoid
2789 <p about="#mwt1" typeof="mw:Transclusion"
2790 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2791 !! end
2792
2793 !! test
2794 Parsoid: Pipes in external links in template parameter
2795 !! wikitext
2796 {{echo|[{{echo|http://example.com}} link]}}
2797 !! html/php+tidy
2798 <p><a rel="nofollow" class="external text" href="http://example.com">link</a></p>
2799 !! html/parsoid
2800 <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>
2801 !! end
2802
2803 !! test
2804 Parsoid: pipe in transclusion parameter
2805 !! wikitext
2806 {{echo|http://foo.com/a&#124;b}}
2807 !! html/php+tidy
2808 <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</a></p>
2809 !! html/parsoid
2810 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2811 typeof="mw:Transclusion"
2812 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>
2813 !! end
2814
2815 !! test
2816 Parsoid: Pipe in external link target and content in template parameter
2817 !! options
2818 parsoid=html2wt,wt2wt
2819 !! wikitext
2820 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2821 !! html/php+tidy
2822 <p><a rel="nofollow" class="external text" href="http://foo.com/a%7Cb">a|b</a></p>
2823 !! html/parsoid
2824 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2825 typeof="mw:Transclusion"
2826 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2827 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2828 !! end
2829
2830 !! test
2831 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2832 !! options
2833 parsoid
2834 !! wikitext
2835 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2836 !! html
2837 <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>
2838 !! end
2839
2840 !! test
2841 Templates: Don't escape already nowiki-escaped text in template parameters
2842 !! options
2843 parsoid=html2wt,wt2wt
2844 !! wikitext
2845 {{echo|foo<nowiki>|</nowiki>bar}}
2846 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2847 {{echo|<nowiki></nowiki>}}
2848 !! html/php+tidy
2849 <p>foo|bar &lt;div&gt;</p>
2850 !! html/parsoid
2851 <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>
2852 <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>
2853 <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>
2854 </p>
2855 !! end
2856
2857 ## Bug 52824
2858 !! test
2859 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2860 !! options
2861 parsoid=html2wt,wt2wt
2862 !! wikitext
2863 {{echo|{{echo|1=bar}}}}
2864 !! html/php+tidy
2865 <p>bar</p>
2866 !! html/parsoid
2867 <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>
2868 !! end
2869
2870 ## Bug 56733
2871 !! test
2872 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2873 !! wikitext
2874 {{echo|a : b}}
2875 !! html/php+tidy
2876 <p>a&#160;: b</p>
2877 !! html/parsoid
2878 <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>
2879 !! end
2880
2881 ## Bug T73412
2882 !! test
2883 Templates: Preserve blank parameter names
2884 !! wikitext
2885 {{echo|=foo}}
2886 !! html/php+tidy
2887 <p>{{{1}}}</p>
2888 !! html/parsoid
2889 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2890 !! end
2891
2892 !! test
2893 Templates: Preserve blank parameter names in other positions
2894 !! wikitext
2895 {{blank_param|bar|=foo}}
2896 !! html/php+tidy
2897 <p>bar foo</p>
2898 !! html/parsoid
2899 <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
2900 foo</p>
2901 !! end
2902
2903 ###
2904 ### Parsoid-centric tests for testing RT edge cases for pre
2905 ###
2906
2907 !!test
2908 1a. Indent-Pre and Comments
2909 !! wikitext
2910 a
2911 <!--a-->
2912 c
2913 !! html
2914 <pre>a
2915 </pre>
2916 <p>c
2917 </p>
2918 !!end
2919
2920 !!test
2921 1b. Indent-Pre and Comments
2922 !! wikitext
2923 a
2924 <!--a-->
2925 c
2926 !! html
2927 <pre>a
2928 </pre>
2929 <p>c
2930 </p>
2931 !!end
2932
2933 !!test
2934 1c. Indent-Pre and Comments
2935 !! wikitext
2936 <!--a--> a
2937
2938 <!--a--> a
2939 !! html
2940 <pre> a
2941 </pre>
2942 <pre> a
2943 </pre>
2944 !!end
2945
2946 !!test
2947 1d. Indent-Pre and Comments
2948 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2949 !! wikitext
2950 <!--a--> a
2951
2952 <!--b-->b
2953 !! html
2954 <pre>a
2955 </pre>
2956 <pre>b
2957 </pre>
2958 !!end
2959
2960 !!test
2961 2a. Indent-Pre and tables
2962 !! wikitext
2963 {|
2964 |-
2965 !h1!!h2
2966 |foo||bar
2967 |}
2968 !! html
2969 <table>
2970
2971 <tr>
2972 <th>h1</th>
2973 <th>h2
2974 </th>
2975 <td>foo</td>
2976 <td>bar
2977 </td></tr></table>
2978
2979 !!end
2980
2981 !!test
2982 2b. Indent-Pre and tables
2983 !! wikitext
2984 {|
2985 |-
2986 |foo
2987 |}
2988 !! html
2989 <table>
2990
2991 <tr>
2992 <td>foo
2993 </td></tr></table>
2994
2995 !!end
2996
2997 !!test
2998 2c. Indent-Pre and tables (bug 42252)
2999 !! wikitext
3000 {|
3001 |+ foo
3002 ! | bar
3003 |}
3004 !! html
3005 <table>
3006 <caption> foo
3007 </caption>
3008 <tr>
3009 <th> bar
3010 </th></tr></table>
3011
3012 !!end
3013
3014 !!test
3015 2d. Indent-Pre and tables
3016 !! wikitext
3017 a
3018 {|
3019 | b
3020 |}
3021 !! html/php
3022 <pre>a
3023 </pre>
3024 <table>
3025 <tr>
3026 <td> b
3027 </td></tr></table>
3028
3029 !! html/parsoid
3030 <pre>a</pre>
3031 <table>
3032 <tbody><tr><td> b</td></tr>
3033 </tbody></table>
3034 !!end
3035
3036 !!test
3037 2e. Indent-Pre and table-line syntax
3038 !! wikitext
3039 a
3040 | b
3041 | c
3042 !! html/php
3043 <pre>a
3044 | b
3045 | c
3046 </pre>
3047 !!end
3048
3049 !!test
3050 2f. Indent-pre started by table-line syntax
3051 !! wikitext
3052 a
3053 | b
3054 | c
3055 !! html/php
3056 <p>a
3057 </p>
3058 <pre>| b
3059 | c
3060 </pre>
3061 !! html/parsoid
3062 <p>a</p>
3063 <pre>
3064 | b
3065 | c</pre>
3066 !!end
3067
3068 !! test
3069 2g. Indented table markup mixed with indented pre content (proposed in bug 6200)
3070 !! wikitext
3071 <table>
3072 <tr>
3073 <td>
3074 Text that should be rendered preformatted
3075 </td>
3076 </tr>
3077 </table>
3078 !! html
3079 <table>
3080 <tr>
3081 <td>
3082 <pre>Text that should be rendered preformatted
3083 </pre>
3084 </td>
3085 </tr>
3086 </table>
3087
3088 !! end
3089
3090 !!test
3091 3a. Indent-Pre and block tags (single-line html)
3092 !! wikitext
3093 a <p> foo </p>
3094 b <div> foo </div>
3095 c <blockquote> foo </blockquote>
3096 <span> foo </span>
3097 !! html
3098 a <p> foo </p>
3099 b <div> foo </div>
3100 c <blockquote> foo </blockquote>
3101 <pre><span> foo </span>
3102 </pre>
3103 !! html/parsoid
3104 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
3105 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3106 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
3107 <pre><span> foo </span>
3108 </pre>
3109 !! html+tidy
3110 <p>a</p>
3111 <p>foo</p>
3112 <p>b</p>
3113 <div>foo</div>
3114 <p>c</p>
3115 <blockquote>
3116 <p>foo</p>
3117 </blockquote>
3118 <pre>
3119 <span> foo </span>
3120 </pre>
3121 !! end
3122
3123 !!test
3124 3b. Indent-Pre and block tags (multi-line html)
3125 !! wikitext
3126 a <span>foo</span>
3127 b <div> foo </div>
3128 !! html
3129 <pre>a <span>foo</span>
3130 </pre>
3131 b <div> foo </div>
3132
3133 !! html/parsoid
3134 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3135 b <div data-parsoid='{"stx":"html"}'> foo </div>
3136 !! html+tidy
3137 <pre>
3138 a <span>foo</span>
3139 </pre>
3140 <p>b</p>
3141 <div>foo</div>
3142 !!end
3143
3144 !!test
3145 3c. Indent-Pre and block tags (pre-content on separate line)
3146 !! wikitext
3147 <p>
3148 foo
3149 </p>
3150
3151 <div>
3152 foo
3153 </div>
3154
3155 <center>
3156 foo
3157 </center>
3158
3159 <blockquote>
3160 foo
3161 </blockquote>
3162
3163 <blockquote>
3164 <pre>
3165 foo
3166 </pre>
3167 </blockquote>
3168
3169 <table><tr><td>
3170 foo
3171 </td></tr></table>
3172
3173 <ul><li>
3174 foo
3175 </li></ul>
3176
3177 !! html
3178 <p>
3179 foo
3180 </p>
3181 <div>
3182 <pre>foo
3183 </pre>
3184 </div>
3185 <center>
3186 <pre>foo
3187 </pre>
3188 </center>
3189 <blockquote>
3190 <p> foo
3191 </p>
3192 </blockquote>
3193 <blockquote>
3194 <pre>
3195 foo
3196 </pre>
3197 </blockquote>
3198 <table><tr><td>
3199 <pre>foo
3200 </pre>
3201 </td></tr></table>
3202 <ul><li>
3203 foo
3204 </li></ul>
3205
3206 !!end
3207
3208 !! test
3209 4. Indent-Pre and extension tags
3210 !! wikitext
3211 a <tag />
3212 !! html/php
3213 a <pre>
3214 NULL
3215 array (
3216 )
3217 </pre>
3218
3219 !! html/parsoid
3220 a <pre typeof="mw:Extension/tag" about="#mwt2" data-parsoid='{}' data-mw='{"name":"tag","attrs":{},"body":null}'></pre>
3221 !! end
3222
3223 !!test
3224 Render paragraphs when indent-pre is suppressed in blocklevels
3225 !! wikitext
3226 <blockquote>
3227 foo
3228
3229 bar
3230 </blockquote>
3231 !! html
3232 <blockquote>
3233 <p> foo
3234 </p><p> bar
3235 </p>
3236 </blockquote>
3237
3238 !!end
3239
3240 !!test
3241 4. Multiple spaces at start-of-line
3242 !! wikitext
3243 <p> foo </p>
3244 foo
3245 {|
3246 |foo
3247 |}
3248 !! html
3249 <p> foo </p>
3250 <pre> foo
3251 </pre>
3252 <table>
3253 <tr>
3254 <td>foo
3255 </td></tr></table>
3256
3257 !!end
3258
3259 ## NOTE: the leading white-space chars on empty line are significant
3260 !! test
3261 5a. White-space in indent-pre
3262 !! wikitext
3263 a<br />
3264
3265 b
3266 !! html
3267 <pre>a<br />
3268
3269 b
3270 </pre>
3271 !! end
3272
3273 ## NOTE: the leading white-space chars on empty line are significant
3274 !! test
3275 5b. White-space in indent-pre
3276 !! wikitext
3277 a
3278
3279 b
3280
3281
3282 c
3283 !! html
3284 <pre>a
3285
3286 b
3287
3288
3289 c
3290 </pre>
3291 !! end
3292
3293 !! test
3294 5c. White-space in indent-pre
3295 !! wikitext
3296 ''a''
3297 ''b''
3298 ''c''
3299 !! html
3300 <pre><i>a</i>
3301 <i>b</i>
3302 <i>c</i>
3303 </pre>
3304 !! end
3305
3306 !! test
3307 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3308 !! wikitext
3309 a
3310
3311 <!-- continue -->
3312 b
3313
3314 c
3315
3316 d
3317 !! html
3318 <pre>a
3319
3320 b
3321 </pre>
3322 <pre>c
3323
3324 </pre>
3325 <p>d
3326 </p>
3327 !! end
3328
3329 !! test
3330 7a. Indent-pre and category links
3331 !! options
3332 parsoid=wt2html,wt2wt
3333 !! wikitext
3334 [[Category:foo]] <!-- No pre-wrapping -->
3335 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3336 !! html/php+tidy
3337 !! html/parsoid
3338 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3339 <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 -->
3340 !! end
3341
3342 ## We used to, but no longer wt2wt this test since the default serializer
3343 ## will normalize all categories to serialize on their own line.
3344 ## This wikitext usage is going to be fairly uncommon in production and
3345 ## selser will take care of preserving formatting in those scenarios.
3346 !! test
3347 7b. Indent-pre and category links
3348 !! options
3349 parsoid=wt2html
3350 !! wikitext
3351 [[Category:foo]] a
3352 [[Category:foo]] {{echo|b}}
3353 !! html/parsoid
3354 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3355 <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>
3356 !! end
3357
3358 !! test
3359 Indent-Pre: Newlines in comments shouldn't affect sol state
3360 !! wikitext
3361 a <!--
3362 foo
3363 --> b
3364 !! html/php+tidy
3365 <p>a b</p>
3366 !! html/parsoid
3367 <p>a <!--
3368 foo
3369 --> b</p>
3370 !! end
3371
3372 ###
3373 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3374 ###
3375
3376 !!test
3377 HTML-pre: 1. embedded newlines
3378 !! wikitext
3379 <pre>foo</pre>
3380
3381 <pre>
3382 foo
3383 </pre>
3384
3385 <pre>
3386
3387 foo
3388 </pre>
3389
3390 <pre>
3391
3392
3393 foo
3394 </pre>
3395 !! html/php+tidy
3396 <pre>
3397 foo
3398 </pre>
3399 <pre>
3400 foo
3401 </pre>
3402 <pre>
3403
3404 foo
3405 </pre>
3406 <pre>
3407
3408
3409 foo
3410 </pre>
3411 !! html/parsoid
3412 <pre data-parsoid='{"stx":"html"}'>foo</pre>
3413
3414 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
3415 foo
3416 </pre>
3417
3418 <pre data-parsoid='{"stx":"html"}'>
3419
3420 foo
3421 </pre>
3422
3423 <pre data-parsoid='{"stx":"html"}'>
3424
3425
3426 foo
3427 </pre>
3428 !!end
3429
3430 !! test
3431 HTML-pre: big spaces
3432 !! wikitext
3433 <pre>
3434
3435
3436
3437
3438 haha
3439
3440
3441
3442
3443 haha
3444
3445
3446
3447
3448 </pre>
3449 !! html/php+tidy
3450 <pre>
3451
3452
3453
3454
3455 haha
3456
3457
3458
3459
3460 haha
3461
3462
3463
3464
3465 </pre>
3466 !! html/parsoid
3467 <pre data-parsoid='{"stx":"html"}'>
3468
3469
3470
3471
3472 haha
3473
3474
3475
3476
3477 haha
3478
3479
3480
3481
3482 </pre>
3483 !! end
3484
3485 !!test
3486 HTML-pre: 2: indented text
3487 !! wikitext
3488 <pre>
3489 foo
3490 </pre>
3491 !! html
3492 <pre>
3493 foo
3494 </pre>
3495
3496 !!end
3497
3498 !!test
3499 HTML-pre: 3: other wikitext
3500 !! wikitext
3501 <pre>
3502 * foo
3503 # bar
3504 = no-h =
3505 '' no-italic ''
3506 [[ NoLink ]]
3507 </pre>
3508 !! html/php
3509 <pre>
3510 * foo
3511 # bar
3512 = no-h =
3513 '' no-italic ''
3514 [[ NoLink ]]
3515 </pre>
3516
3517 !! html/parsoid
3518 <pre data-parsoid='{"stx":"html","strippedNL":true}'>* foo
3519 # bar
3520 = no-h =
3521 '' no-italic ''
3522 [[ NoLink ]]
3523 </pre>
3524 !!end
3525
3526 ###
3527 ### Definition lists
3528 ###
3529 !! test
3530 Simple definition
3531 !! wikitext
3532 ; name : Definition
3533 !! html
3534 <dl><dt> name&#160;</dt>
3535 <dd> Definition</dd></dl>
3536
3537 !! end
3538
3539 !! test
3540 Definition list for indentation only
3541 !! wikitext
3542 : Indented text
3543 !! html
3544 <dl><dd> Indented text</dd></dl>
3545
3546 !! end
3547
3548 !! test
3549 Definition list with no space
3550 !! wikitext
3551 ;name:Definition
3552 !! html
3553 <dl><dt>name</dt>
3554 <dd>Definition</dd></dl>
3555
3556 !!end
3557
3558 !! test
3559 Definition list with URL link
3560 !! wikitext
3561 ; http://example.com/ : definition
3562 !! html
3563 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3564 <dd> definition</dd></dl>
3565
3566 !! end
3567
3568 !! test
3569 Definition list with bracketed URL link
3570 !! wikitext
3571 ;[http://www.example.com/ Example]:Something about it
3572 !! html
3573 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3574 <dd>Something about it</dd></dl>
3575
3576 !! end
3577
3578 !! test
3579 Definition list with wikilink containing colon
3580 !! wikitext
3581 ; [[Help:FAQ]]: The least-read page on Wikipedia
3582 !! html
3583 <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>
3584 <dd> The least-read page on Wikipedia</dd></dl>
3585
3586 !! end
3587
3588 # At Brion's and JeLuF's insistence... :)
3589 !! test
3590 Definition list with news link containing colon
3591 !! wikitext
3592 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
3593 !! html/php
3594 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3595 <dd> This isn't even a real newsgroup!</dd></dl>
3596
3597 !! html/parsoid
3598 <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>
3599 !! end
3600
3601 !! test
3602 Malformed definition list with colon
3603 !! wikitext
3604 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3605 !! html
3606 <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>
3607
3608 !! end
3609
3610 !! test
3611 Definition lists: colon in external link text
3612 !! wikitext
3613 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3614 !! html
3615 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3616 <dd> OK, I made that up</dd></dl>
3617
3618 !! end
3619
3620 !! test
3621 Definition lists: colon in HTML attribute
3622 !! wikitext
3623 ;<b style="display: inline">bold</b>
3624 !! html
3625 <dl><dt><b style="display: inline">bold</b></dt></dl>
3626
3627 !! end
3628
3629 !! test
3630 Definition lists: self-closed tag
3631 !! wikitext
3632 ;one<br/>two : two-line fun
3633 !! html
3634 <dl><dt>one<br />two&#160;</dt>
3635 <dd> two-line fun</dd></dl>
3636
3637 !! end
3638
3639 !! test
3640 Bug 11748: Literal closing tags
3641 !! wikitext
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 !! html
3649 <dl>
3650 <dt>test 1</dt>
3651 <dd>test test test test test</dd>
3652 <dt>test 2</dt>
3653 <dd>test test test test test</dd>
3654 </dl>
3655
3656 !! end
3657
3658 !! test
3659 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3660 !! wikitext
3661 <ul><li>
3662 ; term : description
3663 * unordered
3664 </li></ul>
3665 !! html
3666 <ul><li>
3667 <dl><dt> term&#160;</dt>
3668 <dd> description</dd></dl>
3669 <ul><li> unordered</li></ul>
3670 </li></ul>
3671
3672 !! end
3673
3674 !! test
3675
3676 Definition list with empty definition and following paragraph
3677 !! wikitext
3678 ; term:
3679 Paragraph text
3680 !! html
3681 <dl><dt> term</dt>
3682 <dd></dd></dl>
3683 <p>Paragraph text
3684 </p>
3685 !! end
3686
3687 !! test
3688 Nested definition lists using html syntax
3689 !! wikitext
3690 <dl><dt>x</dt>
3691 <dd>a</dd>
3692 <dd>b</dd></dl>
3693 !! html
3694 <dl><dt>x</dt>
3695 <dd>a</dd>
3696 <dd>b</dd></dl>
3697
3698 !! end
3699
3700 !! test
3701 Definition Lists: No nesting: Multiple dd's
3702 !! wikitext
3703 ;x
3704 :a
3705 :b
3706 !! html
3707 <dl><dt>x</dt>
3708 <dd>a</dd>
3709 <dd>b</dd></dl>
3710
3711 !! end
3712
3713 !! test
3714 Definition Lists: Indentation: Regular
3715 !! wikitext
3716 :i1
3717 ::i2
3718 :::i3
3719 !! html
3720 <dl><dd>i1
3721 <dl><dd>i2
3722 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3723
3724 !! end
3725
3726 !! test
3727 Definition Lists: Indentation: Missing 1st level
3728 !! wikitext
3729 ::i2
3730 :::i3
3731 !! html
3732 <dl><dd><dl><dd>i2
3733 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3734
3735 !! end
3736
3737 !! test
3738 Definition Lists: Indentation: Multi-level indent
3739 !! wikitext
3740 :::i3
3741 !! html
3742 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3743
3744 !! end
3745
3746 !! test
3747 Definition Lists: Hacky use to indent tables
3748 !! wikitext
3749 ::{|
3750 |foo
3751 |bar
3752 |}
3753 this text
3754 should be left alone
3755 !! html
3756 <dl><dd><dl><dd><table>
3757 <tr>
3758 <td>foo
3759 </td>
3760 <td>bar
3761 </td></tr></table></dd></dl></dd></dl>
3762 <p>this text
3763 should be left alone
3764 </p>
3765 !! end
3766
3767 !! test
3768 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3769 !! wikitext
3770 <!-- foo -->
3771 ::{|
3772 |foo
3773 |bar
3774 |}<!-- bar -->
3775 this text
3776 should be left alone
3777 !! html/parsoid
3778 <!-- foo -->
3779 <dl><dd><dl><dd><table><tr>
3780 <td>foo</td>
3781 <td>bar</td>
3782 </tr></table><!-- bar --></dd></dl></dd></dl>
3783 <p>this text
3784 should be left alone</p>
3785 !! end
3786
3787 !! test
3788 Definition Lists: Hacky use to indent tables, with comment before table
3789 !! wikitext
3790 ::<!-- foo -->{|
3791 |foo
3792 |}
3793 !! html/parsoid
3794 <dl><dd><dl><dd><!-- foo --><table><tr>
3795 <td>foo</td>
3796 </tr></table></dd></dl></dd></dl>
3797 !! end
3798
3799 # The trailing whitespace in this test is to catch a regression in
3800 # Parsoid after T54473.
3801 !! test
3802 Definition Lists: Hacky use to indent tables (WS-insensitive)
3803 !! wikitext
3804 : {|
3805 |a
3806 |}
3807 !! html/php
3808 <dl><dd><table>
3809 <tr>
3810 <td>a
3811 </td></tr></table></dd></dl>
3812
3813 !! html/parsoid
3814 <dl><dd> <table>
3815 <tbody><tr><td>a</td></tr>
3816 </tbody></table> </dd></dl>
3817 !! end
3818
3819 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3820 ## as an empty dt item. It also ignores all but the last ";" when followed
3821 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3822 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3823 ## ";"s.
3824 ##
3825 ## Ex: ";;t2 ::d2" is transformed into:
3826 ##
3827 ## <dl>
3828 ## <dt>t2 </dt>
3829 ## <dd>
3830 ## <dl>
3831 ## <dt></dt>
3832 ## <dd>d2</dd>
3833 ## </dl>
3834 ## </dd>
3835 ## </dl>
3836 ##
3837 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3838 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3839 ##
3840 ## <dl>
3841 ## <dt>
3842 ## <dl>
3843 ## <dt>t2 </dt>
3844 ## <dd>:d2</dd>
3845 ## </dl>
3846 ## </dt>
3847 ## </dl>
3848 ##
3849 ## All Parsoid only definition list tests have this difference.
3850 ##
3851 ## See also: https://phabricator.wikimedia.org/T8569
3852 ## and https://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3853
3854 !! test
3855 Table / list interaction: indented table with lists in table contents
3856 !! wikitext
3857 :{|
3858 |-
3859 | a
3860 * b
3861 |-
3862 | c
3863 * d
3864 |}
3865 !! html
3866 <dl><dd><table>
3867
3868 <tr>
3869 <td> a
3870 <ul><li> b</li></ul>
3871 </td></tr>
3872 <tr>
3873 <td> c
3874 <ul><li> d</li></ul>
3875 </td></tr></table></dd></dl>
3876
3877 !! end
3878
3879 !!test
3880 Table / list interaction: lists nested in tables nested in indented lists
3881 !! wikitext
3882 :{|
3883 |
3884 :a
3885 :b
3886 |
3887 *c
3888 *d
3889 |}
3890
3891 *e
3892 *f
3893 !! html
3894 <dl><dd><table>
3895 <tr>
3896 <td>
3897 <dl><dd>a</dd>
3898 <dd>b</dd></dl>
3899 </td>
3900 <td>
3901 <ul><li>c</li>
3902 <li>d</li></ul>
3903 </td></tr></table></dd></dl>
3904 <ul><li>e</li>
3905 <li>f</li></ul>
3906
3907 !!end
3908
3909 !! test
3910 Definition Lists: Nesting: Multi-level (Parsoid only)
3911 !! options
3912 parsoid
3913 !! wikitext
3914 ;t1 :d1
3915 ;;t2 ::d2
3916 ;;;t3 :::d3
3917 !! html
3918 <dl>
3919 <dt>t1 </dt>
3920 <dd>d1</dd>
3921 <dt>
3922 <dl>
3923 <dt>t2 </dt>
3924 <dd>:d2</dd>
3925 <dt>
3926 <dl>
3927 <dt>t3 </dt>
3928 <dd>::d3</dd>
3929 </dl>
3930 </dt>
3931 </dl>
3932 </dt>
3933 </dl>
3934
3935
3936 !! end
3937
3938
3939 !! test
3940 Definition Lists: Nesting: Test 2 (Parsoid only)
3941 !! wikitext
3942 ;t1
3943 ::d2
3944 !! html/php+tidy
3945 <dl>
3946 <dt>t1</dt>
3947 <dd>
3948 <dl>
3949 <dd>d2</dd>
3950 </dl>
3951 </dd>
3952 </dl>
3953 !! html/parsoid
3954 <dl>
3955 <dt>t1</dt>
3956 <dd>
3957 <dl>
3958 <dd>d2</dd>
3959 </dl>
3960 </dd>
3961 </dl>
3962
3963 !! end
3964
3965
3966 !! test
3967 Definition Lists: Nesting: Test 3 (Parsoid only)
3968 !! wikitext
3969 :;t1
3970 ::::d2
3971 !! html/php+tidy
3972 <dl>
3973 <dd>
3974 <dl>
3975 <dt>t1</dt>
3976 <dd>
3977 <dl>
3978 <dd>
3979 <dl>
3980 <dd>d2</dd>
3981 </dl>
3982 </dd>
3983 </dl>
3984 </dd>
3985 </dl>
3986 </dd>
3987 </dl>
3988 !! html/parsoid
3989 <dl>
3990 <dd>
3991 <dl>
3992 <dt>t1</dt>
3993 <dd>
3994 <dl>
3995 <dd>
3996 <dl>
3997 <dd>d2</dd>
3998 </dl>
3999 </dd>
4000 </dl>
4001 </dd>
4002 </dl>
4003 </dd>
4004 </dl>
4005
4006 !! end
4007
4008
4009 !! test
4010 Definition Lists: Nesting: Test 4
4011 !! wikitext
4012 ::;t3
4013 :::d3
4014 !! html
4015 <dl><dd><dl><dd><dl><dt>t3</dt>
4016 <dd>d3</dd></dl></dd></dl></dd></dl>
4017
4018 !! end
4019
4020
4021 ## The Parsoid team believes the following three test exposes a
4022 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
4023 ## wrong to close the <dl> after the <dt> containing the <ul>.)
4024 ## It also exposes a "misfeature" in tidy, which doesn't like
4025 ## <dl> tags with a single <dt> child; it converts the <dt> into
4026 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
4027 !! test
4028 Definition Lists: Mixed Lists: Test 1
4029 !! wikitext
4030 :;* foo
4031 ::* bar
4032 :; baz
4033 !! html/php
4034 <dl><dd><dl><dt><ul><li> foo</li>
4035 <li> bar</li></ul></dt></dl>
4036 <dl><dt> baz</dt></dl></dd></dl>
4037
4038 !! html/php+tidy
4039 <dl>
4040 <dd>
4041 <dl>
4042 <dd>
4043 <ul>
4044 <li>foo</li>
4045 <li>bar</li>
4046 </ul>
4047 </dd>
4048 </dl>
4049 <dl>
4050 <dt>baz</dt>
4051 </dl>
4052 </dd>
4053 </dl>
4054 !! html/parsoid
4055 <dl>
4056 <dd><dl>
4057 <dt><ul>
4058 <li> foo
4059 </li>
4060 </ul></dt>
4061 <dd><ul>
4062 <li> bar
4063 </li>
4064 </ul></dd>
4065 <dt> baz</dt>
4066 </dl></dd>
4067 </dl>
4068 !! end
4069
4070 !! test
4071 Definition Lists: Mixed Lists: Test 2
4072 !! wikitext
4073 *: d1
4074 *: d2
4075 !! html
4076 <ul><li><dl><dd> d1</dd>
4077 <dd> d2</dd></dl></li></ul>
4078
4079 !! end
4080
4081
4082 !! test
4083 Definition Lists: Mixed Lists: Test 3
4084 !! wikitext
4085 *::: d1
4086 *::: d2
4087 !! html
4088 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
4089 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
4090
4091 !! end
4092
4093
4094 !! test
4095 Definition Lists: Mixed Lists: Test 4
4096 !! wikitext
4097 *;d1 :d2
4098 *;d3 :d4
4099 !! html
4100 <ul><li><dl><dt>d1&#160;</dt>
4101 <dd>d2</dd>
4102 <dt>d3&#160;</dt>
4103 <dd>d4</dd></dl></li></ul>
4104
4105 !! end
4106
4107
4108 !! test
4109 Definition Lists: Mixed Lists: Test 5
4110 !! wikitext
4111 *:d1
4112 *:: d2
4113 !! html
4114 <ul><li><dl><dd>d1
4115 <dl><dd> d2</dd></dl></dd></dl></li></ul>
4116
4117 !! end
4118
4119
4120 !! test
4121 Definition Lists: Mixed Lists: Test 6
4122 !! wikitext
4123 #*:d1
4124 #*::: d3
4125 !! html
4126 <ol><li><ul><li><dl><dd>d1
4127 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4128
4129 !! end
4130
4131
4132 !! test
4133 Definition Lists: Mixed Lists: Test 7
4134 !! wikitext
4135 :* d1
4136 :* d2
4137 !! html
4138 <dl><dd><ul><li> d1</li>
4139 <li> d2</li></ul></dd></dl>
4140
4141 !! end
4142
4143
4144 !! test
4145 Definition Lists: Mixed Lists: Test 8
4146 !! wikitext
4147 :* d1
4148 ::* d2
4149 !! html
4150 <dl><dd><ul><li> d1</li></ul>
4151 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
4152
4153 !! end
4154
4155
4156 !! test
4157 Definition Lists: Mixed Lists: Test 9
4158 !! wikitext
4159 *;foo :bar
4160 !! html
4161 <ul><li><dl><dt>foo&#160;</dt>
4162 <dd>bar</dd></dl></li></ul>
4163
4164 !! end
4165
4166
4167 !! test
4168 Definition Lists: Mixed Lists: Test 10
4169 !! wikitext
4170 *#;foo :bar
4171 !! html
4172 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4173 <dd>bar</dd></dl></li></ol></li></ul>
4174
4175 !! end
4176
4177 # The Parsoid team disagrees with the PHP parser's seemingly-random
4178 # rules regarding dd/dt on the next two tests. Parsoid is more
4179 # consistent, and recognizes the shared nesting and keeps the
4180 # still-open tags around until the nesting is complete.
4181 # (And tidy again converts <dt> to <dd> before 'bar'.)
4182
4183 !! test
4184 Definition Lists: Mixed Lists: Test 11
4185 !! wikitext
4186 *#*#;*;;foo :bar
4187 *#*#;boo :baz
4188 !! html/php
4189 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4190 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4191 <dl><dt>boo&#160;</dt>
4192 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4193
4194 !! html/php+tidy
4195 <ul>
4196 <li>
4197 <ol>
4198 <li>
4199 <ul>
4200 <li>
4201 <ol>
4202 <li>
4203 <dl>
4204 <dt>foo&#160;</dt>
4205 <dd>
4206 <ul>
4207 <li>
4208 <dl>
4209 <dd>
4210 <dl>
4211 <dt>bar</dt>
4212 </dl>
4213 </dd>
4214 </dl>
4215 </li>
4216 </ul>
4217 </dd>
4218 </dl>
4219 <dl>
4220 <dt>boo&#160;</dt>
4221 <dd>baz</dd>
4222 </dl>
4223 </li>
4224 </ol>
4225 </li>
4226 </ul>
4227 </li>
4228 </ol>
4229 </li>
4230 </ul>
4231 !! html/parsoid
4232 <ul>
4233 <li>
4234 <ol>
4235 <li>
4236 <ul>
4237 <li>
4238 <ol>
4239 <li>
4240 <dl>
4241 <dt>
4242 <ul>
4243 <li>
4244 <dl>
4245 <dt>
4246 <dl>
4247 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4248 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4249 </dl></dt>
4250 </dl></li>
4251 </ul></dt>
4252 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4253 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4254 </dl></li>
4255 </ol></li>
4256 </ul></li>
4257 </ol></li>
4258 </ul>
4259 !! end
4260
4261
4262 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
4263 # From whitelist:
4264 # * The test is wrong, there are two colons where there should be :;
4265 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4266 !! test
4267 Definition Lists: Weird Ones: Test 1
4268 !! wikitext
4269 *#;*::;; foo : bar (who uses this?)
4270 !! html/php
4271 <ul><li><ol><li><dl><dt> foo&#160;</dt>
4272 <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>
4273
4274 !! html/php+tidy
4275 <ul>
4276 <li>
4277 <ol>
4278 <li>
4279 <dl>
4280 <dt>foo&#160;</dt>
4281 <dd>
4282 <ul>
4283 <li>
4284 <dl>
4285 <dd>
4286 <dl>
4287 <dd>
4288 <dl>
4289 <dd>
4290 <dl>
4291 <dt>bar (who uses this?)</dt>
4292 </dl>
4293 </dd>
4294 </dl>
4295 </dd>
4296 </dl>
4297 </dd>
4298 </dl>
4299 </li>
4300 </ul>
4301 </dd>
4302 </dl>
4303 </li>
4304 </ol>
4305 </li>
4306 </ul>
4307 !! html/parsoid
4308 <ul>
4309 <li>
4310 <ol>
4311 <li>
4312 <dl>
4313 <dt>
4314 <ul>
4315 <li>
4316 <dl>
4317 <dd>
4318 <dl>
4319 <dd>
4320 <dl>
4321 <dt>
4322 <dl>
4323 <dt> foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span></dt>
4324 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
4325 </dl></dt>
4326 </dl></dd>
4327 </dl></dd>
4328 </dl></li>
4329 </ul></dt>
4330 </dl></li>
4331 </ol></li>
4332 </ul>
4333 !! end
4334
4335 !! test
4336 Definition Lists: colons occurring in tags
4337 !! wikitext
4338 ;a:b
4339 ;'''a:b'''
4340 ;<i>a:b</i>
4341 ;<span>a:b</span>
4342 ;<div>a:b</div>
4343 ;<div>a
4344 :b</div>
4345 ;{{echo|a:b}}
4346 ;{{echo|''a:b''}}
4347 ;;;''a:b''
4348 !! html+tidy
4349 <dl>
4350 <dt>a</dt>
4351 <dd>b</dd>
4352 <dt><b>a:b</b></dt>
4353 <dt><i>a:b</i></dt>
4354 <dt><span>a:b</span></dt>
4355 <dd>
4356 <div>a:b</div>
4357 </dd>
4358 <dd>
4359 <div>a
4360 <dl>
4361 <dd>b</dd>
4362 </dl>
4363 </div>
4364 </dd>
4365 <dt>a</dt>
4366 <dd>b</dd>
4367 <dt><i>a:b</i></dt>
4368 </dl>
4369 <dl>
4370 <dd>
4371 <dl>
4372 <dd>
4373 <dl>
4374 <dt><i>a:b</i></dt>
4375 </dl>
4376 </dd>
4377 </dl>
4378 </dd>
4379 </dl>
4380 !! html/parsoid
4381 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4382 <dt><b>a:b</b></dt>
4383 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4384 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4385 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4386 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4387 <dd>b</dd>
4388 <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>
4389 <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>
4390 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4391 !! end
4392
4393 !! test
4394 Definition Lists: colons and tables 1
4395 !! wikitext
4396 :{|
4397 | x
4398 |}
4399 :{|
4400 | y
4401 |}
4402 !! html
4403 <dl><dd><table>
4404 <tr>
4405 <td> x
4406 </td></tr></table></dd></dl>
4407 <dl><dd><table>
4408 <tr>
4409 <td> y
4410 </td></tr></table></dd></dl>
4411
4412 !! end
4413
4414 # Parsoid's output (as documented below) differs from php's in this case.
4415 # This is probably a bug. If we fixup parsoid to match php's output, the
4416 # above test should pass and the below test case can be removed. It is
4417 # unclear which output is more desirable.
4418
4419 !! test
4420 Definition Lists: colons and tables 2
4421 !! wikitext
4422 :{|
4423 | x
4424 |}
4425 :{|
4426 | y
4427 |}
4428 !! html/parsoid
4429 <dl><dd><table>
4430 <tr>
4431 <td> x
4432 </td></tr></table></dd>
4433 <dd><table>
4434 <tr>
4435 <td> y
4436 </td></tr></table></dd></dl>
4437 !! end
4438
4439 !! test
4440 Definition Lists: template interaction
4441 !! wikitext
4442 ::{{definition_list}}
4443
4444 :one
4445 ::{{definition_list}}
4446 :::two
4447 :::three
4448 ::four
4449 !! html/parsoid
4450 <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">
4451 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4452
4453 <dl><dd data-parsoid='{}'>one
4454 <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">
4455 </span><dd about="#mwt2">two
4456 <dl><dd>two</dd>
4457 <dd>three</dd></dl></dd>
4458 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4459 !! end
4460
4461
4462 ###
4463 ### External links
4464 ###
4465 !! test
4466 External links: non-bracketed
4467 !! wikitext
4468 Non-bracketed: http://example.com
4469 !! html
4470 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4471 </p>
4472 !! end
4473
4474 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4475 !! test
4476 External links: numbered
4477 !! wikitext
4478 Numbered: [http://example.com]
4479 Numbered: [http://example.net]
4480 Numbered: [http://example.com]
4481 !! html/php
4482 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4483 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4484 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4485 </p>
4486 !! html/parsoid
4487 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
4488 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
4489 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
4490 !!end
4491
4492 !! test
4493 External links: specified text
4494 !! wikitext
4495 Specified text: [http://example.com link]
4496 !! html
4497 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4498 </p>
4499 !!end
4500
4501 !! test
4502 External links: trail
4503 !! wikitext
4504 Linktrails should not work for external links: [http://example.com link]s
4505 !! html
4506 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4507 </p>
4508 !! end
4509
4510 !! test
4511 External links: dollar sign in URL
4512 !! wikitext
4513 http://example.com/1$2345
4514 !! html
4515 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4516 </p>
4517 !! end
4518
4519 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4520 !! test
4521 External links: dollar sign in URL (autonumber)
4522 !! wikitext
4523 [http://example.com/1$2345]
4524 !! html/php
4525 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4526 </p>
4527 !! html/parsoid
4528 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4529 !!end
4530
4531 !! test
4532 External links: open square bracket forbidden in URL (bug 4377)
4533 !! options
4534 parsoid=wt2html,wt2wt,html2html
4535 !! wikitext
4536 http://example.com/1[2345
4537 !! html/php
4538 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4539 </p>
4540 !! html/parsoid
4541 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4542 !! end
4543
4544 !! test
4545 External links: open square bracket forbidden in URL (named) (bug 4377)
4546 !! options
4547 parsoid=wt2html,html2html
4548 !! wikitext
4549 [http://example.com/1[2345]
4550 !! html/php
4551 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4552 </p>
4553 !! html/parsoid
4554 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4555 !!end
4556
4557 # parsoid adds a space before the link name
4558 !! test
4559 External links: open square bracket forbidden in URL (named) (bug 4377)
4560 Parsoid variant.
4561 !! wikitext
4562 [http://example.com/1 [2345]
4563 !! html
4564 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4565 </p>
4566 !!end
4567
4568 !! test
4569 External links: nowiki in URL link text (bug 6230)
4570 !! wikitext
4571 [http://example.com/ <nowiki>''example site''</nowiki>]
4572 !! html
4573 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4574 </p>
4575 !! end
4576
4577 !! test
4578 External links: newline forbidden in text (bug 6230 regression check)
4579 !! wikitext
4580 [http://example.com/ first
4581 second]
4582 !! html
4583 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4584 second]
4585 </p>
4586 !!end
4587
4588 !! test
4589 External links: Pipe char between url and text
4590 !! wikitext
4591 [http://example.com | link]
4592 !! html
4593 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4594 </p>
4595 !!end
4596
4597 !! test
4598 External links: protocol-relative URL in brackets
4599 !! wikitext
4600 [//example.com/ Test]
4601 !! html
4602 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4603 </p>
4604 !! end
4605
4606 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4607 !! test
4608 External links: protocol-relative URL in brackets without text
4609 !! wikitext
4610 [//example.com]
4611 !! html/php
4612 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4613 </p>
4614 !! html/parsoid
4615 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4616 !! end
4617
4618 !! test
4619 External links: protocol-relative URL in free text is left alone
4620 !! wikitext
4621 //example.com/Foo
4622 !! html
4623 <p>//example.com/Foo
4624 </p>
4625 !!end
4626
4627 !! test
4628 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
4629 !! wikitext
4630 foo//example.com/Foo
4631 !! html
4632 <p>foo//example.com/Foo
4633 </p>
4634 !! end
4635
4636 !! test
4637 External links: with no contents
4638 !! wikitext
4639 [http://en.wikipedia.org/wiki/Foo]
4640
4641 [[wikipedia:Foo|Bar]]
4642
4643 [[wikipedia:Foo|<span>Bar</span>]]
4644 !! html/php
4645 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4646 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4647 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4648 </p>
4649 !! html/parsoid
4650 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4651 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4652 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4653 !! end
4654
4655 !! test
4656 External links: Free with trailing punctuation
4657 !! wikitext
4658 http://example.com,
4659 http://example.com;
4660 http://example.com\
4661 http://example.com.
4662 http://example.com:
4663 http://example.com!
4664 http://example.com?
4665 http://example.com)
4666 http://example.com/url_with_(brackets)
4667 (http://example.com/url_without_brackets)
4668 http://example.com/url_with_entity&amp;
4669 http://example.com/url_with_entity&#x26;
4670 http://example.com/url_with_entity&#038;
4671 http://example.com/url_with_entity&nbsp;
4672 http://example.com/url_with_entity&#xA0;
4673 http://example.com/url_with_entity&#160;
4674 http://example.com/url_with_entity&lt;
4675 http://example.com/url_with_entity&#x3C;
4676 http://example.com/url_with_entity&#60;
4677 !! html/php
4678 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4679 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4680 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4681 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4682 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4683 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4684 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4685 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4686 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4687 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4688 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4689 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4690 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4691 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4692 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#xa0;
4693 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4694 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4695 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#x3c;
4696 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#60;
4697 </p>
4698 !! html/parsoid
4699 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>,
4700 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>;
4701 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>\
4702 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>.
4703 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:
4704 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>!
4705 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>?
4706 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)
4707 <a rel="mw:ExtLink" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4708 (<a rel="mw:ExtLink" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4709 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4710 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4711 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4712 <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>
4713 <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>
4714 <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>
4715 <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>
4716 <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>
4717 <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>
4718 !! end
4719
4720 !! test
4721 External links: tricky Parsoid html2html case
4722 !! options
4723 parsoid=wt2html,wt2wt,html2html
4724 !! wikitext
4725 http://example.com/url_with_entity&amp;amp;
4726 !! html/php
4727 <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>;
4728 </p>
4729 !! html/parsoid
4730 <p><a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;amp">http://example.com/url_with_entity&amp;amp</a>;</p>
4731 !! end
4732
4733 !! test
4734 External links: Free with trailing quotes (T113666)
4735 !! wikitext
4736 '''News:''' Stuff here
4737
4738 news:'a'b''c''d e
4739 !! html/php
4740 <p><b>News:</b> Stuff here
4741 </p><p><a rel="nofollow" class="external free" href="news:'a'b">news:'a'b</a><i>c</i>d e
4742 </p>
4743 !! html/parsoid
4744 <p><b>News:</b> Stuff here</p>
4745 <p><a rel="mw:ExtLink" href="news:'a'b">news:'a'b</a><i>c</i>d e</p>
4746 !! end
4747
4748 !! test
4749 External links: Lone protocols are never linked (T105697)
4750 !! wikitext
4751 http://
4752 http://;
4753 (http://)
4754 bitcoin:
4755 bitcoin:;
4756 (bitcoin:)
4757 !! html
4758 <p>http://
4759 http://;
4760 (http://)
4761 bitcoin:
4762 bitcoin:;
4763 (bitcoin:)
4764 </p>
4765 !! end
4766
4767 !! test
4768 External links: No preceding word characters allowed (bug 65278)
4769 !! wikitext
4770 NOPEhttp://example.com
4771 N0http://example.com
4772 ok:http://example.com
4773 ok-http://example.com
4774 !! html
4775 <p>NOPEhttp://example.com
4776 N0http://example.com
4777 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4778 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4779 </p>
4780 !! end
4781
4782 !! test
4783 External links: nofollow domain exception
4784 !! wikitext
4785 A [https://no-nofollow.org/foobar link], and another [https://example.org link].
4786 !! html
4787 <p>A <a class="external text" href="https://no-nofollow.org/foobar">link</a>, and another <a rel="nofollow" class="external text" href="https://example.org">link</a>.
4788 </p>
4789 !!end
4790
4791 !! test
4792 External image
4793 !! wikitext
4794 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4795 !! html
4796 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4797 </p>
4798 !! end
4799
4800 !! test
4801 External image from https
4802 !! wikitext
4803 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4804 !! html
4805 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4806 </p>
4807 !! end
4808
4809 !! test
4810 External image (when not allowed)
4811 !! options
4812 wgAllowExternalImages=0
4813 !! wikitext
4814 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4815 !! html
4816 <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>
4817 </p>
4818 !! end
4819
4820 !! test
4821 Link to non-http image, no img tag
4822 !! wikitext
4823 Link to non-http image, no img tag: ftp://example.com/test.jpg
4824 !! html
4825 <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>
4826 </p>
4827 !! end
4828
4829 !! test
4830 External links: terminating separator
4831 !! wikitext
4832 Terminating separator: http://example.com/thing,
4833 !! html
4834 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4835 </p>
4836 !! end
4837
4838 !! test
4839 External links: intervening separator
4840 !! wikitext
4841 Intervening separator: http://example.com/1,2,3
4842 !! html
4843 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4844 </p>
4845 !! end
4846
4847 !! test
4848 External links: old bug with URL in query
4849 !! wikitext
4850 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4851 !! html
4852 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4853 </p>
4854 !! end
4855
4856 !! test
4857 External links: old URL-in-URL bug, mixed protocols
4858 !! wikitext
4859 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4860 !! html
4861 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4862 </p>
4863 !!end
4864
4865 # Since Parsoid is starting to emit canonical wikitext for links,
4866 # [http://example.com http://example.com] will not RT back to that
4867 # form anymore.
4868 !! test
4869 External links: URL in text
4870 !! options
4871 parsoid=wt2html
4872 !! wikitext
4873 URL in text: [http://example.com http://example.com]
4874 !! html/php
4875 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4876 </p>
4877 !! html/parsoid
4878 <p>URL in text: <a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
4879 !! end
4880
4881 !! test
4882 External links: Clickable images
4883 !! wikitext
4884 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4885 !! html/php
4886 <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>
4887 </p>
4888 !! html/parsoid
4889 <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>
4890 !! end
4891
4892 !! test
4893 External links: raw ampersand
4894 !! wikitext
4895 Old &amp; use: http://x&y
4896 !! html
4897 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4898 </p>
4899 !! end
4900
4901 !! test
4902 External links: encoded ampersand
4903 !! wikitext
4904 Old &amp; use: http://x&amp;y
4905 !! html/php
4906 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4907 </p>
4908 !! html/parsoid
4909 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4910 !! end
4911
4912 !! test
4913 External links: encoded equals (bug 6102)
4914 !! wikitext
4915 http://example.com/?foo&#61;bar
4916 !! html/php
4917 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4918 </p>
4919 !! html/parsoid
4920 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4921 !! end
4922
4923 ##
4924 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4925 ## does it number them. As discussed in bug 53505, we can identify
4926 ## autonumbered links via CSS.
4927 ##
4928
4929 !! test
4930 External links: [raw ampersand]
4931 !! wikitext
4932 Old &amp; use: [http://x&y]
4933 !! html/php
4934 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4935 </p>
4936 !! html/parsoid
4937 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4938 !! end
4939
4940 # note that parsoid html is identical to [raw ampersand] case; so html2wt
4941 # mode will return the [raw ampersand] wikitext
4942 !! test
4943 External links: [encoded ampersand]
4944 !! options
4945 parsoid=wt2html,wt2wt,html2html
4946 !! wikitext
4947 Old &amp; use: [http://x&amp;y]
4948 !! html/php
4949 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4950 </p>
4951 !! html/parsoid
4952 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4953 !! end
4954
4955 !! test
4956 External links: [raw equals]
4957 !! wikitext
4958 [http://example.com/?foo=bar]
4959 !! html/php
4960 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4961 </p>
4962 !! html/parsoid
4963 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4964 !! end
4965
4966 # note that parsoid html is identical to [raw equals] case; so html2wt
4967 # mode will return the [raw equals] wikitext
4968 !! test
4969 External links: [encoded equals] (bug 6102)
4970 !! options
4971 parsoid=wt2html,wt2wt,html2html
4972 !! wikitext
4973 [http://example.com/?foo&#61;bar]
4974 !! html/php
4975 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4976 </p>
4977 !! html/parsoid
4978 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4979 !! end
4980
4981 # xxx parsoid strips the IDN character, so the round-trip tests will
4982 # obviously fail and are disabled. --cscott
4983 !! test
4984 External links: [IDN ignored character reference in hostname; strip it right off]
4985 !! options
4986 parsoid=wt2html,wt2wt,html2html
4987 !! wikitext
4988 [http://e&zwnj;xample.com/]
4989 !! html/php
4990 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
4991 </p>
4992 !! html/parsoid
4993 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
4994 !! end
4995
4996 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
4997 # Where an external link could easily circumvent the sanitization of the text of
4998 # a link like this (where an IDN-ignore character is in the URL somewhere), this
4999 # test demands a higher standard. That's a bit strange.
5000 #
5001 # Example:
5002 #
5003 # http://e‌xample.com -> [http://example.com|http://example.com]
5004 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
5005 #
5006 # The first example is sanitized, but the second is not. Any security benefits
5007 # from this production are trivial to circumvent. Either remove this test and
5008 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
5009 # the test accordingly.
5010 #
5011 # All our love,
5012 # The Parsoid team.
5013 # xxx parsoid strips the IDN character, so the round-trip tests will
5014 # obviously fail and are disabled. --cscott
5015 !! test
5016 External links: IDN ignored character reference in hostname; strip it right off
5017 !! options
5018 parsoid=wt2html,html2html
5019 !! wikitext
5020 http://e&zwnj;xample.com/
5021 !! html/php
5022 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
5023 </p>
5024 !! html/parsoid
5025 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
5026 !! end
5027
5028 !! test
5029 External links: www.jpeg.org (bug 554)
5030 !! wikitext
5031 http://www.jpeg.org
5032 !! html
5033 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
5034 </p>
5035 !! end
5036
5037 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
5038 !! test
5039 External links: URL within URL (original bug 2)
5040 !! wikitext
5041 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
5042 !! html/php
5043 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
5044 </p>
5045 !! html/parsoid
5046 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
5047 !! end
5048
5049 !! test
5050 BUG 361: URL inside bracketed URL
5051 !! wikitext
5052 [http://www.example.com/foo http://www.example.com/bar]
5053 !! html
5054 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
5055 </p>
5056 !! end
5057
5058 !! test
5059 BUG 361: URL within URL, not bracketed
5060 !! wikitext
5061 http://www.example.com/foo?=http://www.example.com/bar
5062 !! html
5063 <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>
5064 </p>
5065 !! end
5066
5067 !! test
5068 BUG 289: ">"-token in URL-tail
5069 !! wikitext
5070 http://www.example.com/<hello>
5071 !! html
5072 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
5073 </p>
5074 !!end
5075
5076 !! test
5077 BUG 289: literal ">"-token in URL-tail
5078 !! wikitext
5079 http://www.example.com/<b>html</b>
5080 !! html/php
5081 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
5082 </p>
5083 !! html/parsoid
5084 <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>
5085 !! end
5086
5087 !! test
5088 BUG 289: ">"-token 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/">&lt;hello&gt; stuff</a>
5093 </p>
5094 !!end
5095
5096 !! test
5097 BUG 289: literal ">"-token in bracketed URL
5098 !! wikitext
5099 [http://www.example.com/<b>html</b> stuff]
5100 !! html
5101 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
5102 </p>
5103 !!end
5104
5105 !! test
5106 BUG 289: literal double quote at end of URL
5107 !! wikitext
5108 http://www.example.com/"hello"
5109 !! html
5110 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
5111 </p>
5112 !!end
5113
5114 !! test
5115 BUG 289: literal double quote in bracketed URL
5116 !! wikitext
5117 [http://www.example.com/"hello" stuff]
5118 !! html
5119 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
5120 </p>
5121 !!end
5122
5123 !! test
5124 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
5125 !! wikitext
5126 [http://www.example.com test]
5127 !! html
5128 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
5129 </p>
5130 !! end
5131
5132 !! test
5133 External links: link text with spaces
5134 !! wikitext
5135 [http://www.example.com a b c]
5136 [http://www.example.com ''a'' ''b'']
5137 !! html
5138 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5139 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5140 </p>
5141 !! end
5142
5143 !! test
5144 External links: wiki links within external link (Bug 3695)
5145 !! options
5146 parsoid=wt2html,html2html
5147 !! wikitext
5148 [http://example.com [[wikilink]] embedded in ext link]
5149 !! html/php
5150 <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>
5151 </p>
5152 !! html/parsoid
5153 <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>
5154 !! end
5155
5156 !! test
5157 BUG 787: Links with one slash after the url protocol are invalid
5158 !! wikitext
5159 http:/example.com
5160
5161 [http:/example.com title]
5162 !! html
5163 <p>http:/example.com
5164 </p><p>[http:/example.com title]
5165 </p>
5166 !! end
5167
5168 !! test
5169 Bracketed external links with template-generated invalid target
5170 !! wikitext
5171 [{{echo|http:/example.com}} title]
5172 !! html
5173 <p>[http:/example.com title]
5174 </p>
5175 !! end
5176
5177 !! test
5178 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
5179 !! wikitext
5180 ''[http://example.com text'']
5181 [http://example.com '''text]'''
5182 ''Something [http://example.com in italic'']
5183 ''Something [http://example.com mixed''''', even bold]'''
5184 '''''Now [http://example.com both''''']
5185 !! html
5186 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5187 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5188 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5189 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5190 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5191 </p>
5192 !! end
5193
5194
5195 !! test
5196 Bug 4781: %26 in URL
5197 !! wikitext
5198 http://www.example.com/?title=AT%26T
5199 !! html/php
5200 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5201 </p>
5202 !! html/parsoid
5203 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
5204 !! end
5205
5206 # According to https://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5207 # % is actually legal in HTML5. Any change in output would need testing though.
5208 !! test
5209 Bug 4781, 5267: %25 in URL
5210 !! wikitext
5211 http://www.example.com/?title=100%25_Bran
5212 !! html/php
5213 <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>
5214 </p>
5215 !! html/parsoid
5216 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
5217 !! end
5218
5219 !! test
5220 Bug 4781, 5267: %28, %29 in URL
5221 !! wikitext
5222 http://www.example.com/?title=Ben-Hur_%281959_film%29
5223 !! html/php
5224 <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>
5225 </p>
5226 !! html/parsoid
5227 <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>
5228 !! end
5229
5230
5231 !! test
5232 Bug 4781: %26 in autonumber URL
5233 !! wikitext
5234 [http://www.example.com/?title=AT%26T]
5235 !! html/php
5236 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5237 </p>
5238 !! html/parsoid
5239 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
5240 !! end
5241
5242 !! test
5243 Bug 4781, 5267: %26 in autonumber URL
5244 !! wikitext
5245 [http://www.example.com/?title=100%25_Bran]
5246 !! html/php
5247 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5248 </p>
5249 !! html/parsoid
5250 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
5251 !! end
5252
5253 !! test
5254 Bug 4781, 5267: %28, %29 in autonumber URL
5255 !! wikitext
5256 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5257 !! html/php
5258 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5259 </p>
5260 !! html/parsoid
5261 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5262 !! end
5263
5264
5265 !! test
5266 Bug 4781: %26 in bracketed URL
5267 !! wikitext
5268 [http://www.example.com/?title=AT%26T link]
5269 !! html/php
5270 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5271 </p>
5272 !! html/parsoid
5273 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
5274 !! end
5275
5276 !! test
5277 Bug 4781, 5267: %25 in bracketed URL
5278 !! wikitext
5279 [http://www.example.com/?title=100%25_Bran link]
5280 !! html
5281 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5282 </p>
5283 !! end
5284
5285 !! test
5286 Bug 4781, 5267: %28, %29 in bracketed URL
5287 !! wikitext
5288 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5289 !! html/php
5290 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5291 </p>
5292 !! html/parsoid
5293 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5294 !! end
5295
5296 !! test
5297 External link containing a period in the anchor. (bug 63947)
5298 !! wikitext
5299 [//foo.org/bar#baz. bang]
5300
5301 [//foo.org/bar. bang]
5302 !! html/php
5303 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5304 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5305 </p>
5306 !! html/parsoid
5307 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
5308 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
5309 !! end
5310
5311 !! test
5312 External link containing a single quote. (bug 63947)
5313 !! wikitext
5314 [//foo.org/bar'baz]
5315
5316 [//foo.org/bar'baz bang]
5317 !! html/php
5318 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
5319 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
5320 </p>
5321 !! html/parsoid
5322 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
5323 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
5324 !! end
5325
5326 !! test
5327 External link containing double-single-quotes in text '' (bug 4598 sanity check)
5328 !! wikitext
5329 Some [http://example.com/ pretty ''italics'' and stuff]!
5330 !! html
5331 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5332 </p>
5333 !! end
5334
5335 !! test
5336 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
5337 !! wikitext
5338 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5339 !! html
5340 <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>
5341 </p>
5342 !! end
5343
5344 !! test
5345 External link containing double-single-quotes with no space separating the url from text in italics
5346 !! wikitext
5347 [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]].]
5348 !! html/php
5349 <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>
5350 </p>
5351 !! html/php+tidy
5352 <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>
5353 !! html/parsoid
5354 <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>
5355 !! end
5356
5357 !! test
5358 External link with comments in link text
5359 !! wikitext
5360 [http://www.google.com Google <!-- comment -->]
5361 !! html/php
5362 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5363 </p>
5364 !! html/parsoid
5365 <p><a rel="mw:ExtLink" href="http://www.google.com">Google <!-- comment --></a></p>
5366 !! end
5367
5368 !! test
5369 External link to bare IPv4 address
5370 !! wikitext
5371 [http://192.168.0.1 Link]
5372 !! html/php
5373 <p><a rel="nofollow" class="external text" href="http://192.168.0.1">Link</a>
5374 </p>
5375 !! html/parsoid
5376 <p><a rel="mw:ExtLink" href="http://192.168.0.1">Link</a></p>
5377 !! end
5378
5379 !! test
5380 URL-encoding in URL functions (single parameter)
5381 !! wikitext
5382 {{localurl:Some page|amp=&}}
5383 !! html
5384 <p>/index.php?title=Some_page&amp;amp=&amp;
5385 </p>
5386 !! end
5387
5388 !! test
5389 URL-encoding in URL functions (multiple parameters)
5390 !! wikitext
5391 {{localurl:Some page|q=?&amp=&}}
5392 !! html
5393 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5394 </p>
5395 !! end
5396
5397 !! test
5398 Brackets in urls
5399 !! wikitext
5400 http://example.com/index.php?foozoid%5B%5D=bar
5401
5402 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5403 !! html/php
5404 <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>
5405 </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>
5406 </p>
5407 !! html/parsoid
5408 <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>
5409
5410 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
5411 !! end
5412
5413 !! test
5414 IPv6 urls, autolink format (T23261)
5415 !! wikitext
5416 http://[2404:130:0:1000::187:2]/index.php
5417
5418 Examples from RFC 2373, section 2.2:
5419 * http://[1080::8:800:200C:417A]/unicast
5420 * http://[FF01::101]/multicast
5421 * http://[::1]/loopback
5422 * http://[::]/unspecified
5423 * http://[::13.1.68.3]/ipv4compat
5424 * http://[::FFFF:129.144.52.38]/ipv4compat
5425
5426 Examples from RFC 2732, section 2:
5427 * http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5428 * http://[1080:0:0:0:8:800:200C:417A]/index.html
5429 * http://[3ffe:2a00:100:7031::1]
5430 * http://[1080::8:800:200C:417A]/foo
5431 * http://[::192.9.5.5]/ipng
5432 * http://[::FFFF:129.144.52.38]:80/index.html
5433 * http://[2010:836B:4179::836B:4179]
5434
5435 !! html/php
5436 <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>
5437 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5438 </p>
5439 <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>
5440 <li> <a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5441 <li> <a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5442 <li> <a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5443 <li> <a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5444 <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>
5445 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5446 </p>
5447 <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>
5448 <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>
5449 <li> <a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5450 <li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5451 <li> <a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5452 <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>
5453 <li> <a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5454
5455 !! html/parsoid
5456 <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>
5457
5458 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5459 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5460 <li> <a rel="mw:ExtLink" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5461 <li> <a rel="mw:ExtLink" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5462 <li> <a rel="mw:ExtLink" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5463 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5464 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5465
5466 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5467 <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>
5468 <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>
5469 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5470 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5471 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5472 <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>
5473 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5474 !! end
5475
5476 !! test
5477 IPv6 urls, bracketed format (T23261)
5478 !! wikitext
5479 [http://[2404:130:0:1000::187:2]/index.php test]
5480
5481 Examples from RFC 2373, section 2.2:
5482 * [http://[1080::8:800:200C:417A] unicast]
5483 * [http://[FF01::101] multicast]
5484 * [http://[::1]/ loopback]
5485 * [http://[::] unspecified]
5486 * [http://[::13.1.68.3] ipv4compat]
5487 * [http://[::FFFF:129.144.52.38] ipv4compat]
5488
5489 Examples from RFC 2732, section 2:
5490 * [http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5491 * [http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5492 * [http://[3ffe:2a00:100:7031::1] 3]
5493 * [http://[1080::8:800:200C:417A]/foo 4]
5494 * [http://[::192.9.5.5]/ipng 5]
5495 * [http://[::FFFF:129.144.52.38]:80/index.html 6]
5496 * [http://[2010:836B:4179::836B:4179] 7]
5497
5498 !! html/php
5499 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5500 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5501 </p>
5502 <ul><li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5503 <li> <a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5504 <li> <a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5505 <li> <a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5506 <li> <a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5507 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5508 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5509 </p>
5510 <ul><li> <a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5511 <li> <a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5512 <li> <a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5513 <li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5514 <li> <a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5515 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5516 <li> <a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5517
5518 !! html/parsoid
5519 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php">test</a></p>
5520
5521 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5522 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5523 <li> <a rel="mw:ExtLink" href="http://[FF01::101]">multicast</a></li>
5524 <li> <a rel="mw:ExtLink" href="http://[::1]/">loopback</a></li>
5525 <li> <a rel="mw:ExtLink" href="http://[::]">unspecified</a></li>
5526 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]">ipv4compat</a></li>
5527 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5528
5529 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5530 <ul><li> <a rel="mw:ExtLink" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5531 <li> <a rel="mw:ExtLink" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5532 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5533 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5534 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">5</a></li>
5535 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5536 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5537 !! end
5538
5539 !! test
5540 Non-extlinks in brackets
5541 !! wikitext
5542 [foo]
5543 [foo bar]
5544 [foo ''bar'']
5545 [fool's] errand
5546 [fool's errand]
5547 [{{echo|foo}}]
5548 [{{echo|foo}} bar]
5549 [{{echo|foo}} ''bar'']
5550 [{{echo|foo}}l's] errand
5551 [{{echo|foo}}l's errand]
5552 [url={{echo|foo}}]
5553 [url=http://example.com]
5554 [http:// bare protocols don't count]
5555 !! html/php
5556 <p>[foo]
5557 [foo bar]
5558 [foo <i>bar</i>]
5559 [fool's] errand
5560 [fool's errand]
5561 [foo]
5562 [foo bar]
5563 [foo <i>bar</i>]
5564 [fool's] errand
5565 [fool's errand]
5566 [url=foo]
5567 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5568 [http:// bare protocols don't count]
5569 </p>
5570 !! html/parsoid
5571 <p>[foo]
5572 [foo bar]
5573 [foo <i>bar</i>]
5574 [fool's] errand
5575 [fool's errand]
5576 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span>]
5577 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> bar]
5578 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> <i>bar</i>]
5579 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span>] errand
5580 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span> errand]
5581 [<span typeof="mw:Placeholder" data-parsoid='{"src":"url={{echo|foo}}"}'>url=foo</span>]
5582 [url=<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>]
5583 [http:// bare protocols don't count]</p>
5584 !! end
5585
5586 !! test
5587 Percent encoding in external links
5588 !! wikitext
5589 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
5590 !! html/php
5591 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
5592 </p>
5593 !! html/parsoid
5594 <p><a rel="mw:ExtLink"
5595 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
5596 !! end
5597
5598 !! test
5599 Use url link syntax for links where the content is equal the link target
5600 !! wikitext
5601 http://example.com
5602 !! html/php
5603 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5604 </p>
5605 !! html/parsoid
5606 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5607 !! end
5608
5609 !! test
5610 Parenthesis in external links, especially URL links
5611 !! wikitext
5612 http://example.com)
5613
5614 http://example.com/test)
5615
5616 http://example.com/(test)
5617
5618 http://example.com/((test)
5619
5620 (http://example.com/(test))
5621
5622 (http://example.com/(test)))))
5623
5624 http://example.com/a)b
5625
5626 [http://example.com) foo]
5627 !! html/php
5628 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5629 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
5630 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
5631 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
5632 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
5633 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
5634 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
5635 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5636 </p>
5637 !! html/parsoid
5638 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
5639 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
5640 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
5641 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
5642 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
5643 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
5644 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
5645 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
5646 !! end
5647
5648 !! test
5649 Parenthesis in external links, w/ transclusion or comment
5650 !! wikitext
5651 (http://example.com/{{echo|hi}})
5652
5653 (http://example.com<!-- hi -->)
5654 !! html/php
5655 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5656 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5657 </p>
5658 !! html/parsoid
5659 <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=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[20,31,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"hi\"}},\"i\":0}}]}&#39;>hi&lt;/span>"}]]}'>http://example.com/hi</a>)</p>
5660
5661 <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>
5662 !! end
5663
5664 !! test
5665 Serialize <a> tags with invalid link targets as plain text
5666 !! options
5667 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
5668 !! html/parsoid
5669 <a rel="mw:WikiLink" href="[[foo]]">text</a>
5670 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
5671 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
5672 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
5673 !! wikitext
5674 text
5675 <nowiki>*</nowiki>text
5676 <nowiki>[[foo]]</nowiki>
5677 <nowiki>*</nowiki>a <nowiki>[[foo]]</nowiki>
5678 !! end
5679
5680 !! test
5681 mw:ExtLink -vs- mw:WikiLink (T94723)
5682 !! options
5683 parsoid=html2wt
5684 !! html/parsoid
5685 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>Bar</a>
5686 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
5687 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5688 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5689 <p>
5690 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5691 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5692 </p>
5693 !! wikitext
5694 [[Foo|Bar]]
5695 [[Foo|Bar]]
5696 [[wikipedia:Foo|Bar]]
5697 [[wikipedia:Foo|Bar]]
5698
5699 [[wikipedia:European_Robin|European Robin]]
5700 [[wikipedia:European_Robin|European Robin]]
5701 !! end
5702
5703 !! test
5704 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
5705 !! options
5706 parsoid=wt2wt
5707 !! wikitext
5708 [http://en.wikipedia.org/wiki/European_Robin European Robin]
5709 !! html/parsoid
5710 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
5711 !! end
5712
5713
5714 ###
5715 ### Quotes
5716 ###
5717
5718 !! test
5719 Quotes
5720 !! wikitext
5721 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5722
5723 Normal text. '''''Bold italic text.''''' Normal text.
5724 !! html
5725 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5726 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5727 </p>
5728 !! end
5729
5730
5731 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5732 # parser strips. The wikitext contains just the first half of the bold
5733 # quote pair.
5734 !! test
5735 Unclosed and unmatched quotes
5736 !! wikitext
5737 '''''Bold italic text '''with bold deactivated''' in between.'''''
5738
5739 '''''Bold italic text ''with italic deactivated'' in between.'''''
5740
5741 '''Bold text..
5742
5743 ..spanning two paragraphs (should not work).'''
5744
5745 '''Bold tag left open
5746
5747 ''Italic tag left open
5748
5749 Normal text.
5750
5751 <!-- Unmatching number of opening, closing tags: -->
5752 '''This year''''s election ''should'' beat '''last year''''s.
5753
5754 ''Tom'''s car is bigger than ''Susan'''s.
5755
5756 Plain ''italic'''s plain
5757 !! html/php
5758 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5759 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5760 </p><p><b>Bold text..</b>
5761 </p><p>..spanning two paragraphs (should not work).
5762 </p><p><b>Bold tag left open</b>
5763 </p><p><i>Italic tag left open</i>
5764 </p><p>Normal text.
5765 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5766 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5767 </p><p>Plain <i>italic'</i>s plain
5768 </p>
5769 !! html/parsoid
5770 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5771 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5772 </p><p><b>Bold text..</b>
5773 </p><p>..spanning two paragraphs (should not work).<b></b>
5774 </p><p><b>Bold tag left open</b>
5775 </p><p><i>Italic tag left open</i>
5776 </p><p>Normal text.
5777 </p>
5778 <!-- Unmatching number of opening, closing tags: -->
5779 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5780 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5781 </p><p>Plain <i>italic'</i>s plain
5782 </p>
5783 !! end
5784
5785 ###
5786 ### Tables
5787 ###
5788 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5789 ###
5790
5791 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5792 # is the bare minimum required by the spec, see:
5793 # https://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5794 # Parsoid team replies: empty table tags are legal in HTML5
5795 !! test
5796 A table with no data.
5797 !! options
5798 parsoid=wt2html
5799 !! wikitext
5800 {||}
5801 !! html/php
5802
5803 !! html/parsoid
5804 <table></table>
5805
5806 !! end
5807
5808 !! test
5809 A table with stray table end tags on start tag line (wt2html)
5810 !! options
5811 parsoid=wt2html
5812 !! wikitext
5813 {|style="color: red;"|}
5814
5815 {|style="color: red;" |}
5816 |foo
5817 |}
5818
5819 {|style="color: red;"|} id="foo"
5820 |foo
5821 |}
5822
5823 {|style="color: red;" |} id="foo"
5824 |foo
5825 |}
5826 !! html
5827 <table style="color: red;"></table>
5828
5829 <table style="color: red;">
5830 <tbody><tr>
5831 <td>foo</td>
5832 </tr></tbody>
5833 </table>
5834
5835 <table style="color: red;" id="foo">
5836 <tbody><tr>
5837 <td>foo</td>
5838 </tr></tbody>
5839 </table>
5840
5841 <table style="color: red;" id="foo">
5842 <tbody><tr>
5843 <td>foo</td>
5844 </tr></tbody>
5845 </table>
5846
5847 !! end
5848
5849 !! test
5850 A table with no data (take 2)
5851 !! wikitext
5852 {|
5853 |}
5854 !! html/parsoid
5855 <table></table>
5856 !! end
5857
5858 # A table with nothing but a caption is invalid XHTML, we might want to render
5859 # this as <p>caption</p>
5860 # Parsoid team replies: table with only a caption is legal in HTML5
5861 !! test
5862 A table with nothing but a caption
5863 !! wikitext
5864 {|
5865 |+ caption
5866 |}
5867 !! html/php
5868 <table>
5869 <caption> caption
5870 </caption><tr><td></td></tr></table>
5871
5872 !! html/parsoid
5873 <table><caption> caption</caption></table>
5874 !! end
5875
5876 !! test
5877 A table with caption with default-spaced attributes and a table row
5878 !! wikitext
5879 {|
5880 |+ style="color: red;" | caption1
5881 |-
5882 | foo
5883 |}
5884 !! html
5885 <table>
5886 <caption style="color: red;"> caption1
5887 </caption>
5888 <tr>
5889 <td> foo
5890 </td></tr></table>
5891
5892 !! end
5893
5894 !! test
5895 A table with captions with non-default spaced attributes and a table row
5896 !! wikitext
5897 {|
5898 |+style="color: red;"|caption2
5899 |+ style="color: red;"| caption3
5900 |-
5901 | foo
5902 |}
5903 !! html
5904 <table>
5905 <caption style="color: red;">caption2
5906 </caption>
5907 <caption style="color: red;"> caption3
5908 </caption>
5909 <tr>
5910 <td> foo
5911 </td></tr></table>
5912
5913 !! end
5914
5915 !! test
5916 Table td-cell syntax variations
5917 !! wikitext
5918 {|
5919 | foo bar foo | baz
5920 | foo bar foo || baz
5921 | style='color:red;' | baz
5922 | style='color:red;' || baz
5923 |}
5924 !! html
5925 <table>
5926 <tr>
5927 <td> baz
5928 </td>
5929 <td> foo bar foo </td>
5930 <td> baz
5931 </td>
5932 <td style="color:red;"> baz
5933 </td>
5934 <td> style='color:red;' </td>
5935 <td> baz
5936 </td></tr></table>
5937
5938 !! end
5939
5940 !! test
5941 Simple table
5942 !! wikitext
5943 {|
5944 | 1 || 2
5945 |-
5946 | 3 || 4
5947 |}
5948 !! html
5949 <table>
5950 <tr>
5951 <td> 1 </td>
5952 <td> 2
5953 </td></tr>
5954 <tr>
5955 <td> 3 </td>
5956 <td> 4
5957 </td></tr></table>
5958
5959 !! end
5960
5961 !! test
5962 Simple table but with multiple dashes for row wikitext
5963 !! wikitext
5964 {|
5965 | foo
5966 |-----
5967 | bar
5968 |}
5969 !! html
5970 <table>
5971 <tr>
5972 <td> foo
5973 </td></tr>
5974 <tr>
5975 <td> bar
5976 </td></tr></table>
5977
5978 !! end
5979
5980 !! test
5981 Multiplication table
5982 !! wikitext
5983 {| border="1" cellpadding="2"
5984 |+Multiplication table
5985 |-
5986 ! &times; !! 1 !! 2 !! 3
5987 |-
5988 ! 1
5989 | 1 || 2 || 3
5990 |-
5991 ! 2
5992 | 2 || 4 || 6
5993 |-
5994 ! 3
5995 | 3 || 6 || 9
5996 |-
5997 ! 4
5998 | 4 || 8 || 12
5999 |-
6000 ! 5
6001 | 5 || 10 || 15
6002 |}
6003 !! html
6004 <table border="1" cellpadding="2">
6005 <caption>Multiplication table
6006 </caption>
6007 <tr>
6008 <th> &#215; </th>
6009 <th> 1 </th>
6010 <th> 2 </th>
6011 <th> 3
6012 </th></tr>
6013 <tr>
6014 <th> 1
6015 </th>
6016 <td> 1 </td>
6017 <td> 2 </td>
6018 <td> 3
6019 </td></tr>
6020 <tr>
6021 <th> 2
6022 </th>
6023 <td> 2 </td>
6024 <td> 4 </td>
6025 <td> 6
6026 </td></tr>
6027 <tr>
6028 <th> 3
6029 </th>
6030 <td> 3 </td>
6031 <td> 6 </td>
6032 <td> 9
6033 </td></tr>
6034 <tr>
6035 <th> 4
6036 </th>
6037 <td> 4 </td>
6038 <td> 8 </td>
6039 <td> 12
6040 </td></tr>
6041 <tr>
6042 <th> 5
6043 </th>
6044 <td> 5 </td>
6045 <td> 10 </td>
6046 <td> 15
6047 </td></tr></table>
6048
6049 !! end
6050
6051 !! test
6052 Accept "||" in table headings
6053 !! wikitext
6054 {|
6055 !h1 || h2
6056 |}
6057 !! html
6058 <table>
6059 <tr>
6060 <th>h1 </th>
6061 <th> h2
6062 </th></tr></table>
6063
6064 !! end
6065
6066 !! test
6067 Accept "!!" in table data
6068 !! wikitext
6069 {|
6070 | Foo!! ||
6071 |}
6072 !! html
6073 <table>
6074 <tr>
6075 <td> Foo!! </td>
6076 <td>
6077 </td></tr></table>
6078
6079 !! html/parsoid
6080 <table>
6081 <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>
6082 </tbody></table>
6083 !! end
6084
6085 !! test
6086 Accept "||" in indented table headings
6087 !! wikitext
6088 :{|
6089 !h1 || h2
6090 |}
6091 !! html
6092 <dl><dd><table>
6093 <tr>
6094 <th>h1 </th>
6095 <th> h2
6096 </th></tr></table></dd></dl>
6097
6098 !! end
6099
6100 !! test
6101 Accept "!!" in templates
6102 !! wikitext
6103 {|
6104 !a {{echo|b!!c}}
6105 |}
6106 !! html/php
6107 <table>
6108 <tr>
6109 <th>a b</th>
6110 <th>c
6111 </th></tr></table>
6112
6113 !! html/parsoid
6114 <table>
6115 <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>
6116 !! end
6117
6118 !! test
6119 Accept "!!" in table headings after newline
6120 !! wikitext
6121 {|
6122 !a
6123 b!!c
6124 |}
6125 !! html/php
6126 <table>
6127 <tr>
6128 <th>a
6129 <p>b!!c
6130 </p>
6131 </th></tr></table>
6132
6133 !! html/parsoid
6134 <table>
6135 <tbody><tr><th>a
6136 <p>b!!c</p></th></tr>
6137 </tbody></table>
6138 !! end
6139
6140 !! test
6141 Accept "!!" in table data of mixed wikitext / html syntax
6142 !! wikitext
6143 {|
6144 !a
6145 <tr><td>b!!c</td></tr>
6146 |}
6147 !! html+tidy
6148 <table>
6149 <tr>
6150 <th>a</th>
6151 </tr>
6152 <tr>
6153 <td>b!!c</td>
6154 </tr>
6155 </table>
6156 !! html/parsoid
6157 <table>
6158 <tbody><tr><th>a</th></tr>
6159 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6160 </tbody></table>
6161 !! end
6162
6163 !! test
6164 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6165 !! wikitext
6166 {|
6167 !| h1
6168 || a
6169 |}
6170 !! html
6171 <table>
6172 <tr>
6173 <th> h1
6174 </th>
6175 <td> a
6176 </td></tr></table>
6177
6178 !! end
6179
6180 !!test
6181 Accept "| !" at start of line in tables (ignore !-attribute)
6182 !! wikitext
6183 {|
6184 |-
6185 | !style="color:red" | bar
6186 |}
6187 !! html
6188 <table>
6189
6190 <tr>
6191 <td> bar
6192 </td></tr></table>
6193
6194 !!end
6195
6196 !!test
6197 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 +/-
6198 !! wikitext
6199 {|
6200 |-
6201 |style='color:red;'|+1
6202 |style='color:blue;'|-1
6203 |-
6204 | 1 || 2 || 3
6205 | 1 ||+2 ||-3
6206 |-
6207 | +1
6208 | -1
6209 |}
6210 !! html
6211 <table>
6212
6213 <tr>
6214 <td style="color:red;">+1
6215 </td>
6216 <td style="color:blue;">-1
6217 </td></tr>
6218 <tr>
6219 <td> 1 </td>
6220 <td> 2 </td>
6221 <td> 3
6222 </td>
6223 <td> 1 </td>
6224 <td>+2 </td>
6225 <td>-3
6226 </td></tr>
6227 <tr>
6228 <td> +1
6229 </td>
6230 <td> -1
6231 </td></tr></table>
6232
6233 !!end
6234
6235 !! test
6236 Table rowspan
6237 !! wikitext
6238 {| border=1
6239 | Cell 1, row 1
6240 |rowspan=2| Cell 2, row 1 (and 2)
6241 | Cell 3, row 1
6242 |-
6243 | Cell 1, row 2
6244 | Cell 3, row 2
6245 |}
6246 !! html
6247 <table border="1">
6248 <tr>
6249 <td> Cell 1, row 1
6250 </td>
6251 <td rowspan="2"> Cell 2, row 1 (and 2)
6252 </td>
6253 <td> Cell 3, row 1
6254 </td></tr>
6255 <tr>
6256 <td> Cell 1, row 2
6257 </td>
6258 <td> Cell 3, row 2
6259 </td></tr></table>
6260
6261 !! end
6262
6263 !! test
6264 Nested table
6265 !! wikitext
6266 {| border=1
6267 | &alpha;
6268 |
6269 {| bgcolor=#ABCDEF border=2
6270 |nested
6271 |-
6272 |table
6273 |}
6274 |the original table again
6275 |}
6276 !! html
6277 <table border="1">
6278 <tr>
6279 <td> &#945;
6280 </td>
6281 <td>
6282 <table bgcolor="#ABCDEF" border="2">
6283 <tr>
6284 <td>nested
6285 </td></tr>
6286 <tr>
6287 <td>table
6288 </td></tr></table>
6289 </td>
6290 <td>the original table again
6291 </td></tr></table>
6292
6293 !! end
6294
6295 !! test
6296 Invalid attributes in table cell (bug 1830)
6297 !! wikitext
6298 {|
6299 |Cell:|broken
6300 |}
6301 !! html
6302 <table>
6303 <tr>
6304 <td>broken
6305 </td></tr></table>
6306
6307 !! end
6308
6309 !! test
6310 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6311 !! wikitext
6312 {|
6313 | title="foo" |bar
6314 | title="foo<nowiki>|</nowiki>" |bar
6315 | title="foo<nowiki>|</nowiki>" bar
6316 |}
6317 !! html/php
6318 <table>
6319 <tr>
6320 <td title="foo">bar
6321 </td>
6322 <td title="foo&#124;">bar
6323 </td>
6324 <td> title="foo|" bar
6325 </td></tr></table>
6326
6327 !! html/parsoid
6328 <table>
6329 <tbody><tr><td title="foo">bar</td>
6330 <td title="foo|" data-parsoid='{"a":{"title":"foo|"},"sa":{"title":"foo&lt;nowiki>|&lt;/nowiki>"},"autoInsertedEnd":true}'>bar</td>
6331 <td> title="foo<span typeof="mw:Nowiki">|</span>" bar</td></tr>
6332 </tbody></table>
6333 !! end
6334
6335 # See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
6336 # N.B. The "|}" to close the table is missing from the input, so parsoid's
6337 # *2wt modes will fail.
6338 !! test
6339 Table security: embedded pipes
6340 !! options
6341 parsoid=wt2html,html2html
6342 !! wikitext
6343 {|
6344 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6345 !! html/php
6346 <table>
6347 <tr>
6348 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6349 <td>]" onmouseover="alert(document.cookie)"&gt;test
6350 </td>
6351 </tr>
6352 </table>
6353
6354 !! html/parsoid
6355 <table><tbody>
6356 <tr>
6357 <td data-parsoid='{"startTagSrc":"| ","attrSepSrc":"|","autoInsertedEnd":true}'><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
6358 !! end
6359
6360 !! test
6361 Element attributes with double ! should not be broken up by <th>
6362 !! wikitext
6363 {|
6364 ! hi <div class="!!">ha</div> ho
6365 |}
6366 !! html/php
6367 <table>
6368 <tr>
6369 <th> hi <div class="!!">ha</div> ho
6370 </th></tr></table>
6371
6372 !! html/parsoid
6373 <table>
6374 <tbody><tr><th> hi <div class="!!" data-parsoid='{"stx":"html"}'>ha</div> ho</th></tr>
6375 </tbody></table>
6376 !! end
6377
6378 !! test
6379 ! and || in element attributes should not be parsed as <th>/<td>
6380 !! wikitext
6381 {|
6382 | <div style="color: red !important;" data-contrived="put this here ||">hi</div>
6383 |}
6384 !! html/php
6385 <table>
6386 <tr>
6387 <td> <div style="color: red !important;" data-contrived="put this here &#124;&#124;">hi</div>
6388 </td></tr></table>
6389
6390 !! html/parsoid
6391 <table>
6392 <tbody><tr><td> <div style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"stx":"html"}'>hi</div></td></tr>
6393 </tbody></table>
6394 !! end
6395
6396 # FIXME: The output seems broken. Filed as T110268.
6397 !! test
6398 ! and || in td attributes should not be parsed as <th>/<td>
6399 !! options
6400 parsoid=wt2html
6401 !! wikitext
6402 {|
6403 | style="color: red !important;" data-contrived="put this here ||" | foo
6404 |}
6405 !! html/php
6406 <table>
6407 <tr>
6408 <td> style="color: red !important;" data-contrived="put this here </td>
6409 <td> foo
6410 </td></tr></table>
6411
6412 !! html/parsoid
6413 <table>
6414 <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>
6415 </tbody></table>
6416 !! end
6417
6418 !! test
6419 Break on | in element attribute in template
6420 !! options
6421 parsoid=wt2html,html2html
6422 !! wikitext
6423 {{echo|1=<div class="hi|ho">ha</div>}}
6424 !! html/php
6425 <p>ho"&gt;ha&lt;/div&gt;
6426 </p>
6427 !! html/parsoid
6428 <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>
6429 !! end
6430
6431 ## We don't support roundtripping of these attributes in Parsoid.
6432 ## Selective serialization takes care of preventing dirty diffs.
6433 ## But, on edits, we dirty-diff the invalid attribute text.
6434 !! test
6435 Invalid text in table attributes should be discarded
6436 !! options
6437 parsoid=wt2html
6438 !! wikitext
6439 {| <span>boo</span> style='border:1px solid black'
6440 | <span>boo</span> style='color:blue' | 1
6441 |<span>boo</span> style='color:blue'| 2
6442 |}
6443 !! html/php
6444 <table style="border:1px solid black">
6445 <tr>
6446 <td style="color:blue"> 1
6447 </td>
6448 <td style="color:blue"> 2
6449 </td></tr></table>
6450
6451 !! html/parsoid
6452 <table style="border:1px solid black">
6453 <tr>
6454 <td style="color:blue"> 1</td>
6455 <td style="color:blue"> 2</td>
6456 </tr>
6457 </table>
6458 !! end
6459
6460 !! test
6461 Invalid text in table attributes should be preserved by selective serializer
6462 !! options
6463 parsoid={
6464 "modes": ["selser"],
6465 "changes": [
6466 ["td:first-child", "text", "abc"],
6467 ["td + td", "text", "xyz"]
6468 ]
6469 }
6470 !! wikitext
6471 {| <span>boo</span> style='border:1px solid black'
6472 | <span>boo</span> style='color:blue' | 1
6473 |<span>boo</span> style='color:blue'| 2
6474 |}
6475 !! wikitext/edited
6476 {| <span>boo</span> style='border:1px solid black'
6477 | <span>boo</span> style='color:blue' |abc
6478 |<span>boo</span> style='color:blue'|xyz
6479 |}
6480 !! end
6481
6482 !! test
6483 1. Template-generated table cell attributes and cell content
6484 !! wikitext
6485 {|
6486 |{{table_attribs}}
6487 | {{table_attribs}}
6488 || {{table_attribs_5}}
6489 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6490 |align=center {{table_attribs}}
6491 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6492 |}
6493 !! html
6494 <table>
6495 <tr>
6496 <td style="color:red;">Foo
6497 </td>
6498 <td style="color:red;">Foo
6499 </td>
6500 <td> style="color:red;"</td>
6501 <td>Bar
6502 </td>
6503 <td style="color:red;">Foo
6504 </td>
6505 <td align="center" style="color:red;">Foo
6506 </td>
6507 <td align="center" style="color:red;">Foo
6508 </td></tr></table>
6509
6510 !! end
6511
6512 !! test
6513 2. Template-generated table cell attributes and cell content
6514 !! wikitext
6515 {|
6516 |{{table_attribs_2}}
6517 |}
6518 !! html/php
6519 <table>
6520 <tr>
6521 <td style="color:red;">Foo
6522 </td>
6523 <td>Bar</td>
6524 <td>Baz
6525 </td></tr></table>
6526
6527 !! html/parsoid
6528 <table>
6529 <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>
6530 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6531 </tbody></table>
6532 !! end
6533
6534 !! test
6535 3. Template-generated table cell attributes and cell content
6536 !! wikitext
6537 {|
6538 !align=center {{table_header_cells}}
6539 |-
6540 |align=center {{table_cells}}
6541 |}
6542 !! html/php
6543 <table>
6544 <tr>
6545 <th align="center" style="color:red;">Foo</th>
6546 <th style="color:red;"><i>Bar</i></th>
6547 <th style="color:brown;"><i>Foo</i> and Baz
6548 </th></tr>
6549 <tr>
6550 <td align="center" style="color:red;">Foo</td>
6551 <td style="color:red;"><i>Bar</i></td>
6552 <td style="color:brown;"><i>Foo</i> and Baz
6553 </td></tr></table>
6554
6555 !! html/parsoid
6556 <table>
6557 <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>
6558 <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>
6559 </tbody></table>
6560 !! end
6561
6562 !! test
6563 4. Template-generated table cell attributes and cell content inside a templated table
6564 !! wikitext
6565 {{tbl-start}}
6566 !align=center {{table_header_cells}}
6567 |-
6568 |align=center {{table_cells}}
6569 {{tbl-end}}
6570 !! html/php
6571 <table>
6572 <tr>
6573 <th align="center" style="color:red;">Foo</th>
6574 <th style="color:red;"><i>Bar</i></th>
6575 <th style="color:brown;"><i>Foo</i> and Baz
6576 </th></tr>
6577 <tr>
6578 <td align="center" style="color:red;">Foo</td>
6579 <td style="color:red;"><i>Bar</i></td>
6580 <td style="color:brown;"><i>Foo</i> and Baz
6581 </td></tr></table>
6582
6583 !! html/parsoid
6584 <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}}]}'>
6585 <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>
6586 <tr>
6587 <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>
6588 </tbody></table>
6589 !! end
6590
6591 ## Edge case fix to prevent future regressions
6592 !! test
6593 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
6594 !! wikitext
6595 {|
6596 |{{table_attribs_7}}
6597 |}
6598 <references />
6599 !! html/parsoid
6600 <table>
6601 <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>
6602 </tbody></table>
6603 <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>
6604 !! end
6605
6606 !! test
6607 Table with row followed by newlines and table heading
6608 !! options
6609 parsoid=wt2html,html2html
6610 !! wikitext
6611 {|
6612 |-
6613
6614 ! foo
6615 |}
6616 !! html/*
6617 <table>
6618
6619
6620 <tr>
6621 <th> foo
6622 </th></tr></table>
6623
6624 !! end
6625
6626 !! test
6627 Table with empty line following the start tag
6628 !! options
6629 parsoid=wt2html,html2html
6630 !! wikitext
6631 {|
6632
6633 |-
6634 | foo
6635 |}
6636 !! html/*
6637 <table>
6638
6639
6640 <tr>
6641 <td> foo
6642 </td></tr></table>
6643
6644 !! end
6645
6646 !! test
6647 Table attributes with empty value
6648 !! options
6649 parsoid=wt2html,html2html
6650 !! wikitext
6651 {|
6652 | style=| hello
6653 |}
6654 !! html/php
6655 <table>
6656 <tr>
6657 <td style=""> hello
6658 </td></tr></table>
6659
6660 !! html/parsoid
6661 <table>
6662 <tbody><tr><td style=""> hello</td></tr>
6663 </tbody></table>
6664 !! end
6665
6666 !! test
6667 Wikitext table with a lot of comments
6668 !! wikitext
6669 {|
6670 <!-- c0 -->
6671 | foo
6672 <!-- c1 -->
6673 |-<!-- c2 -->
6674 <!-- c3 -->
6675 |<!-- c4 -->
6676 <!-- c5 -->
6677 |}
6678 !! html
6679 <table>
6680 <tr>
6681 <td> foo
6682 </td></tr>
6683 <tr>
6684 <td>
6685 </td></tr></table>
6686
6687 !! end
6688
6689 !! test
6690 Wikitext table comments represented in parsoid dom
6691 !! wikitext
6692 {|<!--c1--><!--c2-->
6693 |-<!--c3-->
6694 | x
6695 |}
6696 !! html/php+tidy
6697 <table>
6698 <tr>
6699 <td>x</td>
6700 </tr>
6701 </table>
6702 !! html/parsoid
6703 <table><!--c1--><!--c2-->
6704 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
6705 <td data-parsoid='{"autoInsertedEnd":true}'> x</td></tr>
6706 </tbody></table>
6707 !! end
6708
6709 !! test
6710 Wikitext table with double-line table cell
6711 !! wikitext
6712 {|
6713 |a
6714 b
6715 |}
6716 !! html
6717 <table>
6718 <tr>
6719 <td>a
6720 <p>b
6721 </p>
6722 </td></tr></table>
6723
6724 !! end
6725
6726 !! test
6727 Table cell with a single comment
6728 !! wikitext
6729 {|
6730 | <!-- c1 -->
6731 | a
6732 |}
6733 !! html
6734 <table>
6735 <tr>
6736 <td>
6737 </td>
6738 <td> a
6739 </td></tr></table>
6740
6741 !! end
6742
6743 !! test
6744 Table-cell after a comment-only-empty-line
6745 !! wikitext
6746 {|
6747 |a
6748 <!--c1-->
6749 <!--c2-->| b
6750 |}
6751 !! html
6752 <table>
6753 <tr>
6754 <td>a
6755 </td>
6756 <td> b
6757 </td></tr></table>
6758
6759 !! html/parsoid
6760 <table>
6761 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
6762 <!--c1-->
6763 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
6764 </tbody></table>
6765
6766 !! end
6767
6768 !! test
6769 Build table with {{!}}
6770 !! wikitext
6771 {{{!}} class="wikitable"
6772 ! header
6773 ! second header
6774 {{!}}- style="color:red;"
6775 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
6776 {{!}}}
6777 !! html
6778 <table class="wikitable">
6779 <tr>
6780 <th> header
6781 </th>
6782 <th> second header
6783 </th></tr>
6784 <tr style="color:red;">
6785 <td> data </td>
6786 <td style="color:red;"> second data
6787 </td></tr></table>
6788
6789 !! end
6790
6791 !! test
6792 Build table with pipe as data
6793 !! wikitext
6794 {| class="wikitable"
6795 ! header
6796 ! second header
6797 |- style="color:red;"
6798 | data || style="color:red;" | second data
6799 |-
6800 | style="color:red;" | data with | || style="color:red;" | second data with |
6801 |-
6802 || data with | ||| second data with |
6803 |}
6804 !! html
6805 <table class="wikitable">
6806 <tr>
6807 <th> header
6808 </th>
6809 <th> second header
6810 </th></tr>
6811 <tr style="color:red;">
6812 <td> data </td>
6813 <td style="color:red;"> second data
6814 </td></tr>
6815 <tr>
6816 <td style="color:red;"> data with | </td>
6817 <td style="color:red;"> second data with |
6818 </td></tr>
6819 <tr>
6820 <td> data with | </td>
6821 <td> second data with |
6822 </td></tr></table>
6823
6824 !! end
6825
6826 !! test
6827 Build table with wikilink
6828 !! wikitext
6829 {| class="wikitable"
6830 ! header || second header
6831 |- style="color:red;"
6832 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
6833 |-
6834 | data || second data [[Main Page|link|text with pipe]]
6835 |}
6836 !! html
6837 <table class="wikitable">
6838 <tr>
6839 <th> header </th>
6840 <th> second header
6841 </th></tr>
6842 <tr style="color:red;">
6843 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
6844 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
6845 </td></tr>
6846 <tr>
6847 <td> data </td>
6848 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
6849 </td></tr></table>
6850
6851 !! end
6852
6853 # The expected HTML structure in this test is debatable. The PHP parser does
6854 # not parse this kind of table at all. The main focus for Parsoid is on
6855 # round-tripping, so this output is ok for now. TODO: revisit!
6856 !! test
6857 Wikitext table with html-syntax row
6858 !! wikitext
6859 {|
6860 |-
6861 <td>foo</td>
6862 |}
6863 !! html/parsoid
6864 <table>
6865 <tbody>
6866 <tr>
6867 <td>foo</td></tr></tbody></table>
6868 !! end
6869
6870 ## Note that Parsoid output differs from PHP and PHP+tidy here.
6871 ## The lack of <tr> tags in the PHP output is arguably a bug in the
6872 ## PHP parser, which tidy then compounds by fostering the content
6873 ## entirely out of the table. Parsoid recognizes the table context
6874 ## and generates <tr> and <td> wrappers as needed. Hopefully nobody
6875 ## depends on PHP's treatment of broken table markup!
6876 !! test
6877 Implicit <td> after a |-
6878 !! options
6879 parsoid=wt2html,html2html
6880 !! wikitext
6881 {|
6882 |-
6883 a
6884 |}
6885 !! html/php
6886 <table>
6887
6888 a
6889 </table>
6890
6891 !! html/php+tidy
6892 <p>a</p>
6893 !! html/parsoid
6894 <table>
6895 <tr><td>a</td></tr>
6896 </table>
6897 !! end
6898
6899 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
6900 !! test
6901 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
6902 !! options
6903 parsoid=wt2html,html2html
6904 !! wikitext
6905 {|
6906 |-
6907 |
6908 a
6909 |-
6910 b
6911 |}
6912 !! html/php
6913 <table>
6914
6915 <tr>
6916 <td>
6917 <pre>a
6918 </pre>
6919 </td></tr>
6920 b
6921 </table>
6922
6923 !! html/php+tidy
6924 <p>b</p>
6925 <table>
6926 <tr>
6927 <td>
6928 <pre>
6929 a
6930 </pre></td>
6931 </tr>
6932 </table>
6933 !! html/parsoid
6934 <table>
6935 <tbody>
6936 <tr><td><pre>a</pre></td></tr>
6937 <tr><td> b</td></tr>
6938 </tbody>
6939 </table>
6940 !! end
6941
6942 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
6943 # Parsoid generates the missing <td>, so wt2wt won't succeed.
6944 !! test
6945 Lists should be recognized in an implicit <td> context
6946 !! options
6947 parsoid=wt2html,html2html
6948 !! wikitext
6949 {|
6950 |-
6951 *a
6952 |}
6953 !! html/php
6954 <table>
6955
6956 <ul><li>a</li></ul>
6957 </table>
6958
6959 !! html/php+tidy
6960 <ul>
6961 <li>a</li>
6962 </ul>
6963 !! html/parsoid
6964 <table>
6965 <tr>
6966 <td><ul>
6967 <li>a</li>
6968 </ul></td>
6969 </tr>
6970 </table>
6971 !! end
6972
6973 !! test
6974 Table cells not properly parsed in an implicit-td context
6975 !! wikitext
6976 {|
6977 |-
6978 {{table_attribs_4}} || a || b
6979 |}
6980 !! html/php+tidy
6981 <table>
6982 <tr>
6983 <td style="background-color:#DC241f;" width="10px"></td>
6984 <td>a</td>
6985 <td>b</td>
6986 </tr>
6987 </table>
6988 !! html/parsoid
6989 <table>
6990 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
6991 <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>
6992 </tbody></table>
6993 !! end
6994
6995 !! test
6996 Parsoid: Round-trip tables directly followed by content (bug 51219)
6997 !! options
6998 parsoid=wt2html,wt2wt
6999 !! wikitext
7000 {|
7001 |foo
7002 |} bar
7003
7004 {|
7005 |baz
7006 |}<b>quux</b>
7007 !! html+tidy
7008 <table>
7009 <tr>
7010 <td>foo</td>
7011 </tr>
7012 </table>
7013 <p>bar</p>
7014 <table>
7015 <tr>
7016 <td>baz</td>
7017 </tr>
7018 </table>
7019 <p><b>quux</b></p>
7020 !! end
7021
7022 !! test
7023 Parsoid: Default to a newline after tables in new content (bug 51219)
7024 !! options
7025 parsoid=html2wt
7026 !! html/parsoid
7027 <table><tbody>
7028 <tr><td>foo</td></tr></tbody></table> bar
7029 <table><tbody>
7030 <tr><td>baz</td></tr></tbody></table><b>quux</b>
7031 !! wikitext
7032 {|
7033 |foo
7034 |}
7035 <nowiki> </nowiki>bar
7036 {|
7037 |baz
7038 |}
7039 '''quux'''
7040 !! end
7041
7042 !! test
7043 Parsoid: newline inducing block nodes don't suppress <nowiki>
7044 !! options
7045 parsoid=html2wt
7046 !! html/parsoid
7047 a<h1>foo</h1>
7048 !! wikitext
7049 <nowiki> </nowiki>a
7050
7051 = foo =
7052 !! end
7053
7054 !! test
7055 Parsoid: Row-syntax table headings followed by comment & table cells
7056 !! options
7057 parsoid=wt2html,wt2wt
7058 !! wikitext
7059 {|
7060 ! foo || bar
7061 <!-- foo --> || baz || quux
7062 |}
7063 !! html/php
7064 <table>
7065 <tr>
7066 <th> foo </th>
7067 <th> bar
7068 </th>
7069 <td> baz </td>
7070 <td> quux
7071 </td></tr></table>
7072
7073 !! html/parsoid
7074 <table>
7075 <tbody><tr><th> foo </th><th> bar
7076 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
7077 </tbody></table>
7078 !! end
7079
7080 !!test
7081 Parsoid: Recover better from broken table attributes
7082 !!options
7083 parsoid=wt2html
7084 !!wikitext
7085 {| class="foo
7086 | class="bar" |
7087 foo
7088 |}
7089 !!html/php+tidy
7090 <table class="foo">
7091 <tr>
7092 <td class="bar">
7093 <p>foo</p>
7094 </td>
7095 </tr>
7096 </table>
7097 !!html/parsoid
7098 <table class="foo">
7099 <tr>
7100 <td class="bar">
7101 <p>foo</p></td></tr>
7102 </tbody></table>
7103 !!end
7104
7105 !! test
7106 Tables: Digest broken attributes on table and tr tag
7107 !! options
7108 parsoid=wt2html
7109 !! wikitext
7110 {| || |} ++
7111 |- || || ++ --
7112 |- > [
7113 |}
7114 !! html
7115 <table>
7116 <tbody>
7117 <tr></tr>
7118 <tr></tr>
7119 </tbody></table>
7120 !! end
7121
7122 # T137406: Whitespace in the HTML
7123 !! test
7124 1. Generate correct wikitext for tables with thead/tbody/tfoot
7125 !! options
7126 parsoid=html2wt
7127 !! html/parsoid
7128 <table>
7129 <caption>Test</caption>
7130 <thead>
7131 <tr>
7132 <th>Month</th>
7133 <th>Savings</th>
7134 </tr>
7135 </thead>
7136 <tbody>
7137 <tr>
7138 <td>January</td>
7139 <td>$100</td>
7140 </tr>
7141 <tr>
7142 <td>February</td>
7143 <td>$80</td>
7144 </tr>
7145 </tbody>
7146 <tfoot>
7147 <tr>
7148 <td>Sum</td>
7149 <td>$180</td>
7150 </tr>
7151 </tfoot>
7152 </table>
7153 !! wikitext
7154 {|
7155 |+Test
7156 !Month
7157 !Savings
7158 |-
7159 |January
7160 |$100
7161 |-
7162 |February
7163 |$80
7164 |-
7165 |Sum
7166 |$180
7167 |}
7168 !! html/php+tidy
7169 <table>
7170 <caption>Test</caption>
7171 <tr>
7172 <th>Month</th>
7173 <th>Savings</th>
7174 </tr>
7175 <tr>
7176 <td>January</td>
7177 <td>$100</td>
7178 </tr>
7179 <tr>
7180 <td>February</td>
7181 <td>$80</td>
7182 </tr>
7183 <tr>
7184 <td>Sum</td>
7185 <td>$180</td>
7186 </tr>
7187 </table>
7188 !! end
7189
7190 # T137406: No whitespace in the HTML
7191 !! test
7192 2. Generate correct wikitext for tables with thead/tbody/tfoot
7193 !! options
7194 parsoid=html2wt
7195 !! html/parsoid
7196 <table><thead><tr><th>heading</th></tr></thead><tbody><tr><td>foo</td></tr></tbody></table>
7197 !! wikitext
7198 {|
7199 !heading
7200 |-
7201 |foo
7202 |}
7203 !! end
7204
7205 !! test
7206 Testing serialization after deletion in references
7207 !! options
7208 parsoid={
7209 "modes": ["wt2wt"],
7210 "changes": [
7211 ["#x", "remove"]
7212 ]
7213 }
7214 !! wikitext
7215 hi <ref><div id="x">ho</div></ref>
7216
7217 <references />
7218 !! wikitext/edited
7219 hi <ref></ref>
7220
7221 <references />
7222 !! end
7223
7224 !!test
7225 Testing serialization after deletion of table cells
7226 !!options
7227 parsoid={
7228 "modes": ["wt2wt", "selser"],
7229 "changes": [
7230 ["#x", "remove"]
7231 ]
7232 }
7233 !!wikitext
7234 {|
7235 !h1 !!h2 !!h3
7236 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
7237 |}
7238 !! wikitext/edited
7239 {|
7240 !h1 !!h2 !!h3
7241 |c2 |||c3
7242 |}
7243 !!end
7244
7245 !! test
7246 Testing selser after addition of new row before first row (T125419)
7247 !! options
7248 parsoid={
7249 "modes": ["wt2wt", "selser"],
7250 "changes": [
7251 [ "tr", "before", "<tr><td>X</td></tr>" ]
7252 ]
7253 }
7254 !! wikitext
7255 {|
7256 |a
7257 |}
7258 !! wikitext/edited
7259 {|
7260 |X
7261 |-
7262 |a
7263 |}
7264 !! end
7265
7266 !! test
7267 Serialize new table rows in a HTML table using HTML tags
7268 !! options
7269 parsoid={
7270 "modes": ["wt2wt", "selser"],
7271 "changes": [
7272 [ "tr", "before", "<tr><td>X</td></tr>" ]
7273 ]
7274 }
7275 !! wikitext
7276 <table><tr><td>a</td></tr></table>
7277 !! wikitext/edited
7278 <table><tr><td>X</td></tr><tr><td>a</td></tr></table>
7279 !! end
7280
7281 !! test
7282 Serialize new table cells in a HTML row using HTML tags
7283 !! options
7284 parsoid={
7285 "modes": ["wt2wt", "selser"],
7286 "changes": [
7287 [ "td", "before", "<td>X</td>" ]
7288 ]
7289 }
7290 !! wikitext
7291 <table><tr><td>a</td></tr></table>
7292 !! wikitext/edited
7293 <table><tr><td>X</td><td>a</td></tr></table>
7294 !! end
7295
7296 !! test
7297 Wikitext tables can be nested inside HTML tables
7298 !! options
7299 parsoid=html2wt
7300 !! html
7301 <table data-parsoid='{"stx":"html"}'>
7302 <tr><td>
7303 <table>
7304 <tr><td>foo</td></tr>
7305 </table>
7306 </td></tr>
7307 </table>
7308 !! wikitext
7309 <table>
7310 <tr><td>
7311 {|
7312 |foo
7313 |}
7314 </td></tr>
7315 </table>
7316 !! end
7317
7318 !! test
7319 Serialize wikitext list items as HTML list items when embedded in a HTML list
7320 !! options
7321 parsoid=html2wt
7322 !! html
7323 <ul data-parsoid='{"stx": "html"}'>
7324 <li data-parsoid='{}'>a</li>
7325 <li>b</li>
7326 </ul>
7327 !! wikitext
7328 <ul>
7329 <li>a</li>
7330 <li>b</li>
7331 </ul>
7332 !! end
7333
7334 # SSS FIXME: Is this actually a good thing given the
7335 # odd nested list output that is generated by MW?
7336 # <ul><li>foo<ul>..</ul></li></ul> instead of
7337 # <ul><li>foo</li><ul>..</ul></ul>
7338 !! test
7339 Wikitext lists can be nested inside HTML lists
7340 !! options
7341 parsoid=html2wt
7342 !! html
7343 <ul data-parsoid='{"stx": "html"}'>
7344 <li data-parsoid='{"stx": "html"}'>a
7345 <ul><li>b</li></ul>
7346 </li>
7347 </ul>
7348
7349 <ul data-parsoid='{"stx": "html"}'>
7350 <li>x
7351 <ul><li>y</li></ul>
7352 </li>
7353 </ul>
7354 !! wikitext
7355 <ul>
7356 <li>a
7357 * b
7358 </li>
7359 </ul>
7360
7361 <ul>
7362 <li>x
7363 * y
7364 </li>
7365 </ul>
7366 !! end
7367
7368 ###
7369 ### Internal links
7370 ###
7371 !! test
7372 Plain link, capitalized
7373 !! wikitext
7374 [[Main Page]]
7375 !! html
7376 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7377 </p>
7378 !! end
7379
7380 !! test
7381 Plain link, uncapitalized
7382 !! wikitext
7383 [[main Page]]
7384 !! html
7385 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
7386 </p>
7387 !! end
7388
7389 !! test
7390 Piped link
7391 !! wikitext
7392 [[Main Page|The Main Page]]
7393 !! html
7394 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7395 </p>
7396 !! end
7397
7398 !! test
7399 Piped link with comment in link text
7400 !! wikitext
7401 [[Main Page|The Main<!--front--> Page]]
7402 !! html
7403 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7404 </p>
7405 !! end
7406
7407 !! test
7408 Piped link with multiple pipe characters in link text
7409 !! wikitext
7410 [[Main Page||The|Main|Page|]]
7411 !! html/php
7412 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7413 </p>
7414 !! html/parsoid
7415 <p><a rel="mw:WikiLink" href="Main_Page" title="Main Page">|The|Main|Page|</a></p>
7416 !! end
7417
7418 !! test
7419 Piped link with no link text
7420 !! wikitext
7421 [[Thomas Bek (bishop of St David's)|]]
7422 !! html/php
7423 <p>[[Thomas Bek (bishop of St David's)|]]
7424 </p>
7425 !! html/parsoid
7426 <p>[[Thomas Bek (bishop of St David's)|]]</p>
7427 !! end
7428
7429 !! test
7430 Broken link
7431 !! wikitext
7432 [[Zigzagzogzagzig]]
7433 !! html
7434 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7435 </p>
7436 !! end
7437
7438 !! test
7439 Broken link with fragment
7440 !! wikitext
7441 [[Zigzagzogzagzig#zug]]
7442 !! html
7443 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7444 </p>
7445 !! end
7446
7447 !! test
7448 Special page link with fragment
7449 !! wikitext
7450 [[Special:Version#anchor]]
7451 !! html
7452 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7453 </p>
7454 !! end
7455
7456 !! test
7457 Nonexistent special page link with fragment
7458 !! wikitext
7459 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7460 !! html
7461 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7462 </p>
7463 !! end
7464
7465 !! test
7466 Link with prefix
7467 !! wikitext
7468 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7469 !! html
7470 <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>
7471 </p>
7472 !! end
7473
7474 !! test
7475 Link with suffix
7476 !! wikitext
7477 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7478 !! html
7479 <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>!!!
7480 </p>
7481 !! end
7482
7483 !! article
7484 prefixed article
7485 !! text
7486 Some text
7487 !! endarticle
7488
7489 !! test
7490 Bug 43661: Piped links with identical prefixes
7491 !! wikitext
7492 [[prefixed article|prefixed articles with spaces]]
7493
7494 [[prefixed article|prefixed articlesaoeu]]
7495
7496 [[Main Page|Main Page test]]
7497 !! html
7498 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7499 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7500 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7501 </p>
7502 !! end
7503
7504
7505 !! test
7506 Link with HTML entity in suffix / tail
7507 !! wikitext
7508 [[Main Page]]&quot;, [[Main Page]]&#97;
7509 !! html/php
7510 <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;
7511 </p>
7512 !! html/parsoid
7513 <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>
7514 !! end
7515
7516 !! test
7517 Link with 3 brackets
7518 !! wikitext
7519 [[[Main Page]]]
7520 Foo [[[Main Page]]]
7521 !! html
7522 <p>[[[Main Page]]]
7523 Foo [[[Main Page]]]
7524 </p>
7525 !! end
7526
7527 !! test
7528 Link with 4 brackets
7529 !! wikitext
7530 [[[[Main Page]]]]
7531 !! html
7532 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7533 </p>
7534 !! end
7535
7536 !! test
7537 Piped link with 3 brackets
7538 !! wikitext
7539 [[[main page|the main page]]]
7540 !! html
7541 <p>[[[main page|the main page]]]
7542 </p>
7543 !! end
7544
7545 !! test
7546 Piped link with extlink-like text
7547 !! wikitext
7548 [[Main Page|[bar]]]
7549 [[Main Page|This is a [bar]]]
7550 !! html/php
7551 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7552 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7553 </p>
7554 !! html/parsoid
7555 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7556 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a></p>
7557 !! end
7558
7559 !! test
7560 Link with multiple pipes
7561 !! wikitext
7562 [[Main Page|The|Main|Page]]
7563 !! html
7564 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7565 </p>
7566 !! end
7567
7568 # Note that parsoid does not munge anchor text; all non-space
7569 # characters are valid in HTML5 ids.
7570 !! test
7571 Anchor containing a #. (bug 63430)
7572 !! wikitext
7573 [[Main Page#And#Link]]
7574 !! html/php
7575 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
7576 </p>
7577 !! html/parsoid
7578 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link" title="Main Page">Main Page#And#Link</a></p>
7579 !! end
7580
7581 !! test
7582 Link to namespaces
7583 !! wikitext
7584 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7585 !! html
7586 <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>
7587 </p>
7588 !! end
7589
7590 !! test
7591 Link with space in namespace
7592 !! wikitext
7593 [[User talk:Foo bar]]
7594 !! html
7595 <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>
7596 </p>
7597 !! end
7598
7599 !! article
7600 MemoryAlpha:AlphaTest
7601 !! text
7602 This is an article in the MemoryAlpha namespace
7603 (which shadows the memoryalpha interwiki link).
7604 !! endarticle
7605
7606 !! test
7607 Namespace takes precedence over interwiki link (bug 51680)
7608 !! wikitext
7609 [[MemoryAlpha:AlphaTest]]
7610 !! html
7611 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7612 </p>
7613 !! end
7614
7615 # The previous test doesn't work correctly in html2*, due to not recognizing the
7616 # link as an internal one. This one checks for the correct behavior.
7617 !! test
7618 Link to namespace preferred over interwiki with correct rel attribute
7619 !! options
7620 parsoid=html2wt,html2html
7621 !! html/parsoid
7622 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7623 !! wikitext
7624 [[MemoryAlpha:AlphaTest]]
7625 !! end
7626
7627 !! test
7628 Piped link to namespace
7629 !! wikitext
7630 [[Meta:Disclaimers|The disclaimers]]
7631 !! html
7632 <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>
7633 </p>
7634 !! end
7635
7636 !! test
7637 Link containing }
7638 !! wikitext
7639 [[Usually caused by a typo (oops}]]
7640 !! html
7641 <p>[[Usually caused by a typo (oops}]]
7642 </p>
7643 !! end
7644
7645 !! article
7646 7% Solution
7647 !! text
7648 Just a test of an article title containing a percent.
7649 !! endarticle
7650
7651 !! test
7652 Link containing % (not as a hex sequence)
7653 !! wikitext
7654 [[7% Solution]]
7655 [[7% Solution|7%25 Solution]]
7656 !! html/php
7657 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7658 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7659 </p>
7660 !! html/parsoid
7661 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7662 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7663 !! end
7664
7665 # note that the parsoid HTML is identical to the previous test output,
7666 # so the previous test ensures that the html2wt mode will generate the
7667 # "not as a hex sequence" wikitext.
7668 !! test
7669 Link containing % as a single hex sequence interpreted to char
7670 !! options
7671 parsoid=wt2wt,wt2html,html2html
7672 !! wikitext
7673 [[7%25 Solution]]
7674 [[7%25 Solution|7%25 Solution]]
7675 !! html/php
7676 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7677 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7678 </p>
7679 !! html/parsoid
7680 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7681 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7682 !!end
7683
7684 !! test
7685 Link containing % as a double hex sequence interpreted to hex sequence
7686 !! wikitext
7687 [[7%2525 Solution]]
7688 !! html
7689 <p>[[7%2525 Solution]]
7690 </p>
7691 !!end
7692
7693 # note that parsoid does not munge anchor text; all non-space
7694 # characters are valid in HTML5 anchors.
7695 !! test
7696 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7697 Example for such a section: == < ==
7698 !! wikitext
7699 [[%23%3c]][[%23%3e]]
7700 !! html/php
7701 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7702 </p>
7703 !! html/parsoid
7704 <p><a rel="mw:WikiLink" href="./Main_Page#%3C" title="Main Page">#&lt;</a><a rel="mw:WikiLink" href="./Main_Page#%3E" title="Main Page">#></a></p>
7705 !! end
7706
7707 !! test
7708 Link containing "<#" and ">#" as a hex sequences
7709 !! wikitext
7710 [[%3c%23]][[%3e%23]]
7711 !! html
7712 <p>[[%3c%23]][[%3e%23]]
7713 </p>
7714 !! end
7715
7716 !! test
7717 Link containing an equals sign
7718 !! wikitext
7719 [[Special:BookSources/isbn=4-00-026157-6]]
7720 !! html/php
7721 <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>
7722 </p>
7723 !! html/parsoid
7724 <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>
7725 !! end
7726
7727 !! article
7728 Foo~bar
7729 !! text
7730 Just a test of an article title containing a tilde.
7731 !! endarticle
7732
7733 # note that links containing signatures, like [[Foo~~~~]], are
7734 # massaged by the pre-save transform (PST) and so the tildes are never
7735 # seen by the parser.
7736 !! test
7737 Link containing a tilde
7738 !! wikitext
7739 [[Foo~bar]]
7740 !! html/php
7741 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
7742 </p>
7743 !! html/parsoid
7744 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
7745 !! end
7746
7747 !! test
7748 Link containing double-single-quotes '' (bug 4598)
7749 !! wikitext
7750 [[Lista d''e paise d''o munno]]
7751 !! html/php
7752 <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>
7753 </p>
7754 !! html/parsoid
7755 <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>
7756 !! end
7757
7758 !! test
7759 Link containing double-single-quotes '' in text (bug 4598 sanity check)
7760 !! wikitext
7761 Some [[Link|pretty ''italics'' and stuff]]!
7762 !! html/php
7763 <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>!
7764 </p>
7765 !! html/parsoid
7766 <p>Some <a rel="mw:WikiLink" href="Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
7767 !! end
7768
7769 !! test
7770 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
7771 !! wikitext
7772 ''Some [[Link|pretty ''italics'' and stuff]]!''
7773 !! html
7774 <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>
7775 </p>
7776 !! end
7777
7778 !! test
7779 Link with double quotes in title part (literal) and alternate part (interpreted)
7780 !! wikitext
7781 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
7782
7783 [[''Pentecoste'']]
7784
7785 [[''Pentecoste''|Pentecoste]]
7786
7787 [[''Pentecoste''|''Pentecoste'']]
7788 !! html/php
7789 <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>
7790 </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>
7791 </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>
7792 </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>
7793 </p>
7794 !! html/parsoid
7795 <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>
7796 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
7797 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
7798 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
7799 !! end
7800
7801 !! test
7802 Broken image links with HTML captions (bug 39700)
7803 !! wikitext
7804 [[File:Nonexistent|<script></script>]]
7805 [[File:Nonexistent|100x100px|<script></script>]]
7806 [[File:Nonexistent|&lt;]]
7807 [[File:Nonexistent|a<i>b</i>c]]
7808 !! html/php
7809 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7810 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7811 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
7812 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
7813 </p>
7814 !! html/parsoid
7815 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&lt;script>&lt;/script>"}]}' data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&amp;lt;script>&amp;lt;/script>"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"220","width":"220"},"sa":{"resource":"File:Nonexistent"}}'/></a></span>
7816 <span typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"width","ak":"100x100px"},{"ck":"caption","ak":"&lt;script>&lt;/script>"}]}' data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&amp;lt;script>&amp;lt;/script>"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="100" width="100" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"100","width":"100"},"sa":{"resource":"File:Nonexistent"}}'/></a></span>
7817 <span class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&amp;lt;"}]}' data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&lt;span typeof=\"mw:Entity\" data-parsoid=&#39;{\"src\":\"&amp;amp;lt;\",\"srcContent\":\"&amp;lt;\",\"dsr\":[107,111,null,null]}&#39;>&amp;lt;&lt;/span>"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"220","width":"220"},"sa":{"resource":"File:Nonexistent"}}'/></a></span>
7818 <span class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"a&lt;i>b&lt;/i>c"}]}' data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"a&lt;i data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[134,142,3,4]}&#39;>b&lt;/i>c"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"220","width":"220"},"sa":{"resource":"File:Nonexistent"}}'/></a></span></p>
7819 !! end
7820
7821 !! test
7822 Plain link to URL
7823 !! wikitext
7824 [[http://www.example.com]]
7825 !! html/php
7826 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
7827 </p>
7828 !! html/parsoid
7829 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
7830 !! end
7831
7832 !! test
7833 Plain link to URL with link text
7834 !! wikitext
7835 [[http://www.example.com Link text]]
7836 !! html
7837 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
7838 </p>
7839 !! end
7840
7841 !! test
7842 Plain link to protocol-relative URL
7843 !! wikitext
7844 [[//www.example.com]]
7845 !! html/php
7846 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
7847 </p>
7848 !! html/parsoid
7849 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
7850 !! end
7851
7852 !! test
7853 Plain link to protocol-relative URL with link text
7854 !! wikitext
7855 [[//www.example.com Link text]]
7856 !! html
7857 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
7858 </p>
7859 !! end
7860
7861 !! test
7862 Plain link to page with question mark in title
7863 !! wikitext
7864 [[A?b]]
7865
7866 [[A?b|Baz]]
7867 !! html
7868 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
7869 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
7870 </p>
7871 !! end
7872
7873
7874 # I'm fairly sure the expected result here is wrong.
7875 # We want these to be URL links, not pseudo-pages with URLs for titles....
7876 # However the current output is also pretty screwy.
7877 #
7878 # ----
7879 # I'm changing it to match the current output--it arguably makes more
7880 # sense in the light of the test above. Old expected result was:
7881 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
7882 #</p>
7883 # But I think this test is bordering on "garbage in, garbage out" anyway.
7884 # -- wtm
7885 !! test
7886 Piped link to URL
7887 !! wikitext
7888 Piped link to URL: [[http://www.example.com|an example URL]]
7889 !! html/php
7890 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
7891 </p>
7892 !! html/parsoid
7893 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
7894 !! end
7895
7896 !! test
7897 BUG 2: [[page|http://url/]] should link to page, not http://url/
7898 !! wikitext
7899 [[Main Page|http://url/]]
7900 !! html/php
7901 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
7902 </p>
7903 !! html/parsoid
7904 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
7905 !! end
7906
7907 # Parsoid does not mark self-links, by design.
7908 !! test
7909 BUG 337: Escaped self-links should be bold
7910 !! options
7911 title=[[Bug462]]
7912 !! wikitext
7913 [[Bu&#103;462]] [[Bug462]]
7914 !! html/php
7915 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
7916 </p>
7917 !! html/php+tidy
7918 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
7919 !! html/parsoid
7920 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
7921 !! end
7922
7923 !! test
7924 Self-link to section should not be bold
7925 !! options
7926 title=[[Main Page]]
7927 !! wikitext
7928 [[Main Page#section]]
7929 !! html
7930 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
7931 </p>
7932 !! end
7933
7934 !! article
7935 00
7936 !! text
7937 This is 00.
7938 !! endarticle
7939
7940 !!test
7941 Self-link to numeric title
7942 !!options
7943 title=[[0]]
7944 !! wikitext
7945 [[0]]
7946 !! html
7947 <p><strong class="selflink">0</strong>
7948 </p>
7949 !!end
7950
7951 !!test
7952 Link to numeric-equivalent title
7953 !!options
7954 title=[[0]]
7955 !! wikitext
7956 [[00]]
7957 !! html
7958 <p><a href="/wiki/00" title="00">00</a>
7959 </p>
7960 !!end
7961
7962 !! test
7963 <nowiki> inside a link
7964 !! wikitext
7965 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
7966 !! html
7967 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
7968 </p>
7969 !! end
7970
7971 !! test
7972 Non-breaking spaces in title
7973 !! wikitext
7974 [[&nbsp; Main &nbsp; Page &nbsp;]]
7975 !! html
7976 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
7977 </p>
7978 !!end
7979
7980 !! test
7981 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
7982 !! options
7983 language=ca
7984 !! wikitext
7985 '''[[Main Page]]'''
7986 !! html
7987 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
7988 </p>
7989 !! end
7990
7991 !! test
7992 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
7993 !! options
7994 language=ca
7995 !! wikitext
7996 ''[[Main Page]]''
7997 !! html
7998 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
7999 </p>
8000 !! end
8001
8002 !! test
8003 Internal link with en linktrail: no apostrophes (bug 27473)
8004 !! options
8005 language=en
8006 !! wikitext
8007 [[Something]]'nice
8008 !! html
8009 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
8010 </p>
8011 !! end
8012
8013 !! test
8014 Internal link with ca linktrail with apostrophes (bug 27473)
8015 !! options
8016 language=ca
8017 !! wikitext
8018 [[Something]]'nice
8019 !! html
8020 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
8021 </p>
8022 !! end
8023
8024 !! test
8025 Internal link with kaa linktrail with apostrophes (bug 27473)
8026 !! options
8027 language=kaa
8028 !! wikitext
8029 [[Something]]'nice
8030 !! html
8031 <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>
8032 </p>
8033 !! end
8034
8035 !! test
8036 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
8037 !! wikitext
8038 [[User:Foo/Test/63636:Bar|Test]]
8039 !! html/php
8040 <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>
8041 </p>
8042 !! html/parsoid
8043 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
8044 !! end
8045
8046 ## Mainly a sanity check for Parsoid
8047 !! test
8048 Handle title parsing for subpages
8049 !! options
8050 title=[[/123123]]
8051 !! wikitext
8052 123
8053 !! html/parsoid
8054 <p>123</p>
8055 !! end
8056
8057 ## FIXME: Add a working php section here
8058 !! test
8059 Link to a subpage from a namespace other than main
8060 !! options
8061 title=[[User:test]]
8062 !! wikitext
8063 [[/123]]
8064 !! html/parsoid
8065 <p><a rel="mw:WikiLink" href="./User:Test/123" title="User:Test/123" data-parsoid='{"stx":"simple","a":{"href":"./User:Test/123"},"sa":{"href":"/123"}}'>/123</a></p>
8066 !! end
8067
8068 !! test
8069 Ensure that transclusion titles are not url-decoded
8070 !! options
8071 subpage title=[[Test]]
8072 parsoid=wt2html
8073 !! wikitext
8074 {{Bar%C3%A9}} {{/Bar%C3%A9}}
8075 !! html/php
8076 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}
8077 </p>
8078 !! html/parsoid
8079 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}</p>
8080 !! end
8081
8082 !! test
8083 Purely hash wikilink
8084 !! options
8085 title=[[User:test/123]]
8086 !! wikitext
8087 [[#a|b]]
8088 !! html/php
8089 <p><a href="#a">b</a>
8090 </p>
8091 !! html/parsoid
8092 <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>
8093 !! end
8094
8095 !! test
8096 1. Interaction of linktrail and template encapsulation
8097 !! options
8098 parsoid
8099 !! wikitext
8100 {{echo|[[Foo]]}}l
8101 !! html
8102 <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>
8103 !! end
8104
8105 !! test
8106 2. Interaction of linktrail and template encapsulation
8107 !! options
8108 parsoid
8109 !! wikitext
8110 {{echo|Some [[Fool]]}}s
8111 !! html
8112 <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>
8113 !! end
8114
8115 !! test
8116 3. Interaction of linktrail and template encapsulation
8117 !! options
8118 parsoid
8119 !! wikitext
8120 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
8121 !! html
8122 <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>
8123 !! end
8124
8125 !! article
8126 Söfnuður
8127 !! text
8128 Test.
8129 !! endarticle
8130
8131 !! test
8132 Internal link with is link prefix
8133 !! options
8134 language=is
8135 !! wikitext
8136 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
8137 !! html
8138 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
8139 </p>
8140 !! end
8141
8142 !! article
8143 Mótmælendatrú
8144 !! text
8145 Test.
8146 !! endarticle
8147
8148 !! test
8149 Internal link with is link trail and link prefix
8150 !! options
8151 language=is
8152 !! wikitext
8153 [[mótmælendatrú|xxx]]ar
8154 [[mótmælendatrú]]ar
8155 mótmælenda[[söfnuður]]
8156 mótmælenda[[söfnuður|söfnuðir]]
8157 mótmælenda[[söfnuður|söfnuðir]]xxx
8158 !! html
8159 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
8160 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
8161 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
8162 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
8163 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
8164 </p>
8165 !! end
8166
8167 !! test
8168 Parsoid link trail escaping
8169 !! options
8170 parsoid=html2wt,html2html
8171 !! html/parsoid
8172 <p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p>
8173 !! wikitext
8174 [[apple]]<nowiki/>s
8175 !! end
8176
8177 !! test
8178 Parsoid link prefix escaping
8179 !! options
8180 language=is
8181 parsoid=html2wt,html2html
8182 !! html/parsoid
8183 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p>
8184 !! wikitext
8185 Aðrir mótmælenda<nowiki/>[[söfnuður]]
8186 !! end
8187
8188 !! test
8189 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
8190 !! wikitext
8191 [[Foo| bar]]
8192
8193 [[Foo| ''bar'']]
8194
8195 [http://wp.org foo]
8196
8197 [http://wp.org ''foo'']
8198 !! html
8199 <p><a href="/wiki/Foo" title="Foo"> bar</a>
8200 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
8201 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
8202 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
8203 </p>
8204 !! end
8205
8206 !! test
8207 Parsoid: Scoped parsing should handle mixed transclusions and plain text
8208 !! options
8209 parsoid
8210 !! wikitext
8211 [[Foo|{{echo|a}} b {{echo|c}}]]
8212 !! html
8213 <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>
8214 !! end
8215
8216 !! test
8217 Link with angle bracket after anchor
8218 !! wikitext
8219 [[Foo#<bar>]]
8220 !! html/php
8221 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
8222 </p>
8223 !! html/parsoid
8224 <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>
8225 !! end
8226
8227 ###
8228 ### Interwiki links (see maintenance/interwiki.sql)
8229 ###
8230
8231 !! test
8232 Inline interwiki link
8233 !! options
8234 parsoid=wt2html,wt2wt,html2html
8235 !! wikitext
8236 [[MeatBall:SoftSecurity]]
8237 !! html/php
8238 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
8239 </p>
8240 !! html/parsoid
8241 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
8242 !! end
8243
8244 !! test
8245 Inline interwiki link with empty title (bug 2372)
8246 !! options
8247 parsoid=wt2html,wt2wt,html2html
8248 !! wikitext
8249 [[MeatBall:]]
8250 !! html/php
8251 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
8252 </p>
8253 !! html/parsoid
8254 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
8255 !! end
8256
8257 !! test
8258 Interwiki link encoding conversion (bug 1636)
8259 !! wikitext
8260 *[[Wikipedia:ro:Olteni&#0355;a]]
8261 *[[Wikipedia:ro:Olteni&#355;a]]
8262 !! html
8263 <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>
8264 <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>
8265
8266 !! html+tidy
8267 <ul>
8268 <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>
8269 <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>
8270 </ul>
8271 !! end
8272
8273 !! test
8274 Interwiki link with fragment (bug 2130)
8275 !! wikitext
8276 [[MeatBall:SoftSecurity#foo]]
8277 !! html
8278 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
8279 </p>
8280 !! end
8281
8282 # Ideally the wikipedia: prefix here should be proto-relative too
8283 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
8284 # define the 'en' prefix, and originally the test used 'wikipedia',
8285 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
8286 # article.
8287 !! test
8288 Different interwiki prefixes mapping to the same URL
8289 !! wikitext
8290 [[:en:Foo]]
8291
8292 [[:en:Foo|Foo]]
8293
8294 [[wikipedia:Foo]]
8295
8296 [[:wikipedia:Foo|Foo]]
8297
8298 [[wikipedia:en:Foo]]
8299
8300 [[:wikipedia:en:Foo]]
8301
8302 [[ wikiPEdia :Foo]]
8303 !! html/parsoid
8304 <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>
8305
8306 <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>
8307
8308 <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>
8309
8310 <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>
8311
8312 <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>
8313
8314 <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>
8315
8316 <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>
8317 !! end
8318
8319 !! test
8320 Interwiki links that cannot be represented in wiki syntax
8321 !! wikitext
8322 [[meatball:ok]]
8323 [[meatball:ok#foo|ok with fragment]]
8324 [[meatball:ok_as_well?|ok ending with ? mark]]
8325 [http://de.wikipedia.org/wiki/Foo?action=history has query]
8326 [http://de.wikipedia.org/wiki/#foo is just fragment]
8327
8328 !! html/php
8329 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
8330 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
8331 <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>
8332 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8333 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
8334 </p>
8335 !! html/parsoid
8336 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
8337 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
8338 <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>
8339 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8340 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
8341 !! end
8342
8343 !! test
8344 Interwiki links: trail
8345 !! wikitext
8346 [[wikipedia:Foo|Ba]]r
8347 !! html/php
8348 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
8349 </p>
8350 !! html/parsoid
8351 <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>
8352 !! end
8353
8354 !! test
8355 Local interwiki link
8356 !! options
8357 parsoid=wt2html,wt2wt,html2html
8358 !! wikitext
8359 [[local:Template:Foo]]
8360 !! html/php
8361 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
8362 </p>
8363 !! html/parsoid
8364 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
8365 !! end
8366
8367 # Parsoid does not mark self-links, by design.
8368 !! test
8369 Local interwiki link: self-link to current page
8370 !! options
8371 title=[[Main Page]]
8372 parsoid=wt2html,wt2wt,html2html
8373 !! wikitext
8374 [[local:Main Page]]
8375 !! html/php
8376 <p><strong class="selflink">local:Main Page</strong>
8377 </p>
8378 !! html/parsoid
8379 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
8380 !! end
8381
8382 !! test
8383 Local interwiki link: prefix only (bug 64167)
8384 !! options
8385 parsoid=wt2html,wt2wt,html2html
8386 !! wikitext
8387 [[local:]]
8388 !! html/php
8389 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
8390 </p>
8391 !! html/parsoid
8392 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
8393 !! end
8394
8395 !! test
8396 Local interwiki link: with additional interwiki prefix (bug 61357)
8397 !! options
8398 parsoid=wt2html,wt2wt,html2html
8399 !! wikitext
8400 [[local:meatball:Hello]]
8401 !! html/php
8402 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8403 </p>
8404 !! html/parsoid
8405 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8406 !! end
8407
8408 !! test
8409 Multiple local interwiki link prefixes
8410 !! wikitext
8411 [[local:local:local:local:mi:local:Foo]]
8412 !! options
8413 parsoid=wt2html,wt2wt,html2html
8414 !! html/php
8415 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8416 </p>
8417 !! html/parsoid
8418 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8419 !! end
8420
8421 ###
8422 ### Interlanguage links
8423 ### Language links (so that searching for '### language' matches..)
8424 ###
8425
8426 !! test
8427 Interlanguage link
8428 !! wikitext
8429 Blah blah blah
8430 [[zh:Chinese]]
8431 !! html/php
8432 <p>Blah blah blah
8433 </p>
8434 !! html/parsoid
8435 <p>Blah blah blah</p>
8436 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8437 !! end
8438
8439 ## parsoid html2wt will lose the space variations
8440 !! test
8441 Interlanguage link with spacing
8442 !! options
8443 parsoid=wt2html,wt2wt,html2html
8444 !! wikitext
8445 Blah blah blah
8446 [[ zh : Chinese ]]
8447 !! html/php
8448 <p>Blah blah blah
8449 </p>
8450 !! html/parsoid
8451 <p>Blah blah blah</p>
8452 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8453 !! end
8454
8455 !! test
8456 Double interlanguage link
8457 !! wikitext
8458 Blah blah blah
8459 [[es:Spanish]]
8460 [[zh:Chinese]]
8461 !! html/php
8462 <p>Blah blah blah
8463 </p>
8464 !! html/parsoid
8465 <p>Blah blah blah</p>
8466 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8467 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8468 !! end
8469
8470 ## parsoid html2wt will lose the space variations
8471 !! test
8472 Interlanguage link variations
8473 !! options
8474 parsoid=wt2html,wt2wt,html2html
8475 !! wikitext
8476 Blah blah blah
8477 [[ es :Spanish]]
8478 [[ ZH :Chinese]]
8479 [[es:Foo_bar]]
8480 !! html/php
8481 <p>Blah blah blah
8482 </p>
8483 !! html/parsoid
8484 <p>Blah blah blah</p>
8485 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
8486 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
8487 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
8488 !! end
8489
8490 ## parsoid html2wt will normalize the space to _
8491 !! test
8492 Space and question mark encoding in interlanguage links (T95473)
8493 !! options
8494 parsoid=wt2html,wt2wt,html2html
8495 !! wikitext
8496 Blah blah blah
8497 [[es:Foo bar?]]
8498 !! html/php
8499 <p>Blah blah blah
8500 </p>
8501 !! html/parsoid
8502 <p>Blah blah blah</p>
8503 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
8504 !! end
8505
8506 !! test
8507 Interlanguage link, with prefix links
8508 !! options
8509 language=ln
8510 !! wikitext
8511 Blah blah blah
8512 [[zh:Chinese]]
8513 !! html/php
8514 <p>Blah blah blah
8515 </p>
8516 !! html/parsoid
8517 <p>Blah blah blah</p>
8518 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8519 !! end
8520
8521 !! test
8522 Double interlanguage link, with prefix links (bug 8897)
8523 !! options
8524 language=ln
8525 !! wikitext
8526 Blah blah blah
8527 [[es:Spanish]]
8528 [[zh:Chinese]]
8529 !! html/php
8530 <p>Blah blah blah
8531 </p>
8532 !! html/parsoid
8533 <p>Blah blah blah</p>
8534 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8535 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8536 !! end
8537
8538 !! test
8539 "Extra" interlanguage links (bug 32189 / gerrit 111390)
8540 !! wikitext
8541 Blah blah blah
8542 [[mul:Article]]
8543 !! html/php
8544 <p>Blah blah blah
8545 </p>
8546 !! html/parsoid
8547 <p>Blah blah blah</p>
8548 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
8549 !! end
8550
8551 ## PHP parser tests script needs an update
8552 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
8553 !! test
8554 Language links render as inline links if $wgInterwikiMagic=false
8555 !! options
8556 wgInterwikiMagic=false
8557 parsoid=wt2html,wt2wt,html2html
8558 !! wikitext
8559 Blah blah blah
8560 [[zh:Chinese]]
8561 !! html/parsoid
8562 <p>Blah blah blah <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
8563 !! end
8564
8565 ## PHP parser tests script needs an update
8566 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
8567 !! test
8568 Language links render as inline links in the Talk namespace
8569 !! options
8570 title=Talk:Foo
8571 parsoid=wt2html,wt2wt,html2html
8572 !! wikitext
8573 Blah blah blah
8574 [[zh:Chinese]]
8575 !! html/parsoid
8576 <p>Blah blah blah <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
8577 !! end
8578
8579 !! test
8580 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
8581 !! options
8582 language=ln
8583 !! wikitext
8584 [[WW&nbsp;II]]
8585 !! html
8586 <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>
8587 </p>
8588 !! end
8589
8590 !! test
8591 Parsoid bug 53221: Wikilinks should be properly entity-escaped
8592 !! options
8593 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
8594 !! html/parsoid
8595 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8596 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8597 !! wikitext
8598 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
8599
8600 He&amp;nbsp;llo He&amp;nbsp;llo
8601 !! html/php
8602 <p>He&amp;nbsp;llo <a href="/wiki/Foo" title="Foo">He&amp;nbsp;llo</a>
8603 </p><p>He&amp;nbsp;llo He&amp;nbsp;llo
8604 </p>
8605 !! end
8606
8607 # html2wt will fail because of title normalization without data-parsoid
8608 !! test
8609 Parsoid: handle constructor well
8610 !! options
8611 parsoid=wt2html,wt2wt
8612 !! wikitext
8613 [[constructor]]
8614
8615 [[constructor:foo]]
8616 !! html/php
8617 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
8618 </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>
8619 </p>
8620 !! html/parsoid
8621 <p><a rel="mw:WikiLink" href="./Constructor" title="Constructor" data-parsoid='{"stx":"simple","a":{"href":"./Constructor"},"sa":{"href":"constructor"}}'>constructor</a></p>
8622
8623 <p><a rel="mw:WikiLink" href="./Constructor:foo" title="Constructor:foo" data-parsoid='{"stx":"simple","a":{"href":"./Constructor:foo"},"sa":{"href":"constructor:foo"}}'>constructor:foo</a></p>
8624 !! end
8625
8626 !! article
8627 ko:
8628 !! text
8629 Test.
8630 !! endarticle
8631
8632 # Note that `ko` isn't a known interlanguage prefix
8633 !! test
8634 Parsoid: recognize interlanguage links without a target page
8635 !! options
8636 ill
8637 !! wikitext
8638 [[es:]]
8639
8640 [[ko:]]
8641 !! html/php
8642 es:
8643 !! html/parsoid
8644 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
8645
8646 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8647 !! end
8648
8649 # Note that `ko` isn't a known interwiki prefix
8650 !! test
8651 Parsoid: recognize interwiki links without a target page
8652 !! options
8653 parsoid=wt2html,wt2wt,html2html
8654 !! wikitext
8655 [[:es:]]
8656
8657 [[:ko:]]
8658 !! html/php
8659 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
8660 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
8661 </p>
8662 !! html/parsoid
8663 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
8664 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8665 !! end
8666
8667 !! test
8668 Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
8669 !! wikitext
8670 [[mi:Foo]]
8671 !! html/php
8672 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
8673 </p>
8674 !! html/parsoid
8675 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
8676 !! end
8677
8678 !! test
8679 Interlanguage link with preceding local interwiki link (bug 68085)
8680 !! options
8681 parsoid=wt2html,wt2wt,html2html
8682 !! wikitext
8683 Blah blah blah
8684 [[local:es:Spanish]]
8685 !! html/php
8686 <p>Blah blah blah
8687 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
8688 </p>
8689 !! html/parsoid
8690 <p>Blah blah blah
8691 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
8692 !! end
8693
8694 !! test
8695 Looks like an interlanguage link, but is actually a local interwiki
8696 !! options
8697 parsoid=wt2html,wt2wt,html2html
8698 !! wikitext
8699 Blah blah blah
8700 [[mi:Template:Foo]]
8701 !! html/php
8702 <p>Blah blah blah
8703 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
8704 </p>
8705 !! html/parsoid
8706 <p>Blah blah blah
8707 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
8708 !! end
8709
8710 ###
8711 ### Redirects, Parsoid-only
8712 ###
8713
8714 !! test
8715 1. Simple redirect to page
8716 !! wikitext
8717 #REDIRECT [[Main Page]]
8718 !! html/parsoid
8719 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8720 !! end
8721
8722 !! test
8723 2. Other redirect variants
8724 !! wikitext
8725 #REDIRECT [[Main_Page]]
8726 !! html/parsoid
8727 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
8728 !! end
8729
8730 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
8731 # This tests the Parsoid bail-out code.
8732 !! test
8733 3. Other redirect variants
8734 !! wikitext
8735 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
8736 !! html/parsoid
8737 <ol><li data-parsoid>REDIRECT [[[[Bar]]]]</li></ol>
8738 !! end
8739
8740 !! test
8741 4. Redirect to a templated destination
8742 !! wikitext
8743 #REDIRECT [[{{echo|Foo}}bar]]
8744 !! html/parsoid
8745 <link about="#mwt2" typeof="mw:ExpandedAttrs" rel="mw:PageProp/redirect" href="./Foobar" data-parsoid='{"a":{"href":"./Foobar"},"sa":{"href":"{{echo|Foo}}bar"}}' data-mw='{"attribs":[[{"txt":"href"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[12,24,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"Foo\"}},\"i\":0}}]}&#39;>Foo&lt;/span>bar"}]]}'/>
8746 !! end
8747
8748 !! test
8749 Empty redirect
8750 !! options
8751 parsoid=wt2html,wt2wt
8752 !! wikitext
8753 #REDIRECT [[]]
8754 !! html/parsoid
8755 <ol>
8756 <li>REDIRECT [[]]</li></ol>
8757 !! end
8758
8759 !! test
8760 Optional colon in #REDIRECT
8761 !! options
8762 # the colon is archaic syntax. we support it for wt2html, but we
8763 # don't care that it roundtrips back to the modern syntax.
8764 parsoid=wt2html,html2html
8765 !! wikitext
8766 #REDIRECT:[[Main Page]]
8767 !! html/parsoid
8768 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8769 !! end
8770
8771 !! test
8772 Whitespace in #REDIRECT with optional colon
8773 !! options
8774 # the colon and gratuitous whitespace is archaic syntax. we support
8775 # it for wt2html, but we don't care that it roundtrips back to the
8776 # modern syntax (without extra whitespace)
8777 parsoid=wt2html,html2html
8778 !! wikitext
8779
8780 #REDIRECT
8781 :
8782 [[Main Page]]
8783 !! html/parsoid
8784 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8785 !! end
8786
8787 !! test
8788 Piped link in #REDIRECT
8789 !! options
8790 # content after piped link is ignored. we support this syntax,
8791 # but don't care that the piped link is lost when we roundtrip this.
8792 parsoid=wt2html
8793 !! wikitext
8794 #REDIRECT [[Main Page|bar]]
8795 !! html/parsoid
8796 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8797 !! end
8798
8799 !! test
8800 Redirect to category (T104502)
8801 !! options
8802 parsoid=wt2html,wt2wt
8803 !! wikitext
8804 #REDIRECT [[Category:Foo]]
8805 !! html/parsoid
8806 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8807 !! end
8808
8809 !! test
8810 Redirect to category with URL encoding (T104502)
8811 !! options
8812 parsoid=wt2html
8813 !! wikitext
8814 #REDIRECT [[Category%3AFoo]]
8815 !! html/parsoid
8816 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8817 !! end
8818
8819 !! test
8820 Redirect to category page
8821 !! wikitext
8822 #REDIRECT [[:Category:Foo]]
8823 !! html/parsoid
8824 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8825 !! end
8826
8827 !! test
8828 Redirect to image page (1)
8829 !! wikitext
8830 #REDIRECT [[File:Wiki.png]]
8831 !! html/parsoid
8832 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
8833 !! end
8834
8835 !! test
8836 Redirect to image page (2)
8837 !! wikitext
8838 #REDIRECT [[Image:Wiki.png]]
8839 !! html/parsoid
8840 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
8841 !! end
8842
8843 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
8844 # Next test confirms this.
8845 !! test
8846 Redirect to language (1) (T104918)
8847 !! options
8848 parsoid=wt2html,wt2wt,html2html
8849 !! wikitext
8850 #REDIRECT [[en:File:Wiki.png]]
8851 !! html/parsoid
8852 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8853 !! end
8854
8855 !! test
8856 Redirect to language (2) (T104918)
8857 !! wikitext
8858 #REDIRECT [[:en:File:Wiki.png]]
8859 !! html/parsoid
8860 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8861 !! end
8862
8863 !! test
8864 Redirect to interwiki (T104918)
8865 !! wikitext
8866 #REDIRECT [[meatball:File:Wiki.png]]
8867 !! html/parsoid
8868 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
8869 !! end
8870
8871 !! test
8872 Non-English #REDIRECT
8873 !! options
8874 language=is
8875 !! wikitext
8876 #TILVÍSUN [[Main Page]]
8877 !! html/parsoid
8878 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
8879 !! end
8880
8881 !! test
8882 Redirect syntax under text isn't considered a redirect
8883 !! wikitext
8884 some text
8885 #redirect [[Main Page]]
8886 !! html/parsoid
8887 <p>some text</p>
8888 <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>
8889 !! end
8890
8891 # FIXME: Should hoist the redirect to the top of the page and ensure there
8892 # is only one.
8893 !! test
8894 New redirect
8895 !! options
8896 parsoid=html2wt
8897 !! html/parsoid
8898 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
8899 !! wikitext
8900 Foo
8901 #REDIRECT [[Foo]]
8902 !! end
8903
8904 ##
8905 ## XHTML tidiness
8906 ###
8907
8908 !! test
8909 <br> to <br />
8910 !! wikitext
8911 1<br>2<br />3
8912 !! html
8913 <p>1<br />2<br />3
8914 </p>
8915 !! end
8916
8917 !! test
8918 Broken br tag sanitization
8919 !! wikitext
8920 </br>
8921 !! html/php
8922 <p>&lt;/br&gt;
8923 </p>
8924 !! end
8925
8926 # TODO: Fix html2html mode (bug 51055)!
8927 !! test
8928 Parsoid: Broken br tag recognition
8929 !! options
8930 parsoid=wt2html
8931 !! wikitext
8932 </br>
8933
8934 <br/ >
8935 !! html+tidy
8936 <p><br /></p>
8937 <p><br /></p>
8938 !! end
8939
8940 !! test
8941 Incorrecly removing closing slashes from correctly formed XHTML
8942 !! wikitext
8943 <br style="clear:both;" />
8944 !! html
8945 <p><br style="clear:both;" />
8946 </p>
8947 !! end
8948
8949 !! test
8950 Failing to transform badly formed HTML into correct XHTML
8951 !! wikitext
8952 <br style="clear: left;">
8953 <br style="clear: right;">
8954 <br style="clear: both;">
8955 !! html
8956 <p><br style="clear: left;" />
8957 <br style="clear: right;" />
8958 <br style="clear: both;" />
8959 </p>
8960 !!end
8961
8962 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
8963 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
8964 !! test
8965 Handling html with a div self-closing tag
8966 !! wikitext
8967 <div title />
8968 <div title/>
8969 <div title/ >
8970 <div title=bar />
8971 <div title=bar/>
8972 <div title=bar/ >
8973 !! html/php
8974 <p>&lt;div title /&gt;
8975 &lt;div title/&gt;
8976 </p>
8977 <div>
8978 <p>&lt;div title=bar /&gt;
8979 &lt;div title=bar/&gt;
8980 </p>
8981 <div title="bar/"></div>
8982 </div>
8983
8984 !! html/parsoid
8985 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8986 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8987 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
8988 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8989 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8990 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
8991 !! end
8992
8993 !! test
8994 Handling html with a br self-closing tag
8995 !! wikitext
8996 <br title />
8997 <br title/>
8998 <br title/ >
8999 <br title=bar />
9000 <br title=bar/>
9001 <br title=bar/ >
9002 !! html/php
9003 <p><br title="" />
9004 <br title="" />
9005 <br />
9006 <br title="bar" />
9007 <br title="bar" />
9008 <br title="bar/" />
9009 </p>
9010 !! html/parsoid
9011 <p><br title="" />
9012 <br title="" />
9013 <br title="" />
9014 <br title="bar" />
9015 <br title="bar" />
9016 <br title="bar/" />
9017 </p>
9018 !! end
9019
9020 !! test
9021 Horizontal ruler (should it add that extra space?)
9022 !! wikitext
9023 <hr>
9024 <hr >
9025 foo <hr
9026 > bar
9027 !! html+tidy
9028 <hr />
9029 <hr />
9030 <p>foo</p>
9031 <hr />
9032 <p>bar</p>
9033 !! end
9034
9035 !! test
9036 Horizontal ruler -- 4+ dashes render hr
9037 !! wikitext
9038 ----
9039 !! html
9040 <hr />
9041
9042 !! end
9043
9044 !! test
9045 Horizontal ruler -- eats additional dashes on the same line
9046 !! wikitext
9047 ---------
9048 !! html
9049 <hr />
9050
9051 !! end
9052
9053 !! test
9054 Horizontal ruler -- does not collapse dashes on consecutive lines
9055 !! wikitext
9056 ----
9057 ----
9058 !! html
9059 <hr />
9060 <hr />
9061
9062 !! end
9063
9064 !! test
9065 Horizontal ruler -- <4 dashes render as plain text
9066 !! wikitext
9067 ---
9068 !! html
9069 <p>---
9070 </p>
9071 !! end
9072
9073 !! test
9074 Horizontal ruler -- Supports content following dashes on same line
9075 !! wikitext
9076 ---- Foo
9077 !! html
9078 <hr /> Foo
9079
9080 !! html+tidy
9081 <hr />
9082 <p>Foo</p>
9083 !! end
9084
9085 ###
9086 ### Block-level elements
9087 ###
9088 !! test
9089 Common list
9090 !! wikitext
9091 *Common list
9092 * item 2
9093 *item 3
9094 !! html
9095 <ul><li>Common list</li>
9096 <li> item 2</li>
9097 <li>item 3</li></ul>
9098
9099 !! end
9100
9101 !! test
9102 Numbered list
9103 !! wikitext
9104 #Numbered list
9105 #item 2
9106 # item 3
9107 !! html
9108 <ol><li>Numbered list</li>
9109 <li>item 2</li>
9110 <li> item 3</li></ol>
9111
9112 !! end
9113
9114 !! test
9115 Mixed list
9116 !! wikitext
9117 *Mixed list
9118 *# with numbers
9119 ** and bullets
9120 *# and numbers
9121 *bullets again
9122 **bullet level 2
9123 ***bullet level 3
9124 ***#Number on level 4
9125 **bullet level 2
9126 **#Number on level 3
9127 **#Number on level 3
9128 *#number level 2
9129 *Level 1
9130 *** Level 3
9131 #** Level 3, but ordered
9132 !! html
9133 <ul><li>Mixed list
9134 <ol><li> with numbers</li></ol>
9135 <ul><li> and bullets</li></ul>
9136 <ol><li> and numbers</li></ol></li>
9137 <li>bullets again
9138 <ul><li>bullet level 2
9139 <ul><li>bullet level 3
9140 <ol><li>Number on level 4</li></ol></li></ul></li>
9141 <li>bullet level 2
9142 <ol><li>Number on level 3</li>
9143 <li>Number on level 3</li></ol></li></ul>
9144 <ol><li>number level 2</li></ol></li>
9145 <li>Level 1
9146 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
9147 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
9148
9149 !! end
9150
9151 !! test
9152 1. Nested mixed wikitext and html list
9153 !! wikitext
9154 * hi
9155 * <ul><li>ho</li></ul>
9156 * hi
9157 ** ho
9158 !! html/php
9159 <ul><li> hi</li>
9160 <li> <ul><li>ho</li></ul></li>
9161 <li> hi
9162 <ul><li> ho</li></ul></li></ul>
9163
9164 !! html/parsoid
9165 <ul><li> hi</li>
9166 <li> <ul data-parsoid='{"stx":"html"}'><li data-parsoid='{"stx":"html"}'>ho</li></ul></li>
9167 <li> hi
9168 <ul><li> ho</li></ul></li></ul>
9169 !! end
9170
9171 !! test
9172 2. Nested mixed wikitext and html list (incompatible)
9173 !! wikitext
9174 ; hi
9175 : {{echo|<li>ho</li>}}
9176 !! html/php
9177 <dl><dt> hi</dt>
9178 <dd> <li>ho</li></dd></dl>
9179
9180 !! html/parsoid
9181 <dl><dt> hi</dt>
9182 <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>
9183 !! end
9184
9185 !! test
9186 Nested lists 1
9187 !! wikitext
9188 *foo
9189 **bar
9190 !! html
9191 <ul><li>foo
9192 <ul><li>bar</li></ul></li></ul>
9193
9194 !! end
9195
9196 !! test
9197 Nested lists 2
9198 !! wikitext
9199 **foo
9200 *bar
9201 !! html
9202 <ul><li><ul><li>foo</li></ul></li>
9203 <li>bar</li></ul>
9204
9205 !! end
9206
9207 !! test
9208 Nested lists 3 (first element empty)
9209 !! wikitext
9210 *
9211 **bar
9212 !! html
9213 <ul><li>
9214 <ul><li>bar</li></ul></li></ul>
9215
9216 !! end
9217
9218 !! test
9219 Nested lists 4 (first element empty)
9220 !! wikitext
9221 **
9222 *bar
9223 !! html
9224 <ul><li><ul><li></li></ul></li>
9225 <li>bar</li></ul>
9226
9227 !! end
9228
9229 !! test
9230 Nested lists 5 (both elements empty)
9231 !! wikitext
9232 **
9233 *
9234 !! html
9235 <ul><li><ul><li></li></ul></li>
9236 <li></li></ul>
9237
9238 !! end
9239
9240 !! test
9241 Nested lists 6 (both elements empty)
9242 !! wikitext
9243 *
9244 **
9245 !! html
9246 <ul><li>
9247 <ul><li></li></ul></li></ul>
9248
9249 !! end
9250
9251 !! test
9252 Nested lists 7 (skip initial nesting levels)
9253 !! wikitext
9254 *** foo
9255 !! html
9256 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
9257
9258 !! end
9259
9260 !! test
9261 Nested lists 8 (multiple nesting transitions)
9262 !! wikitext
9263 * foo
9264 *** bar
9265 ** baz
9266 * boo
9267 !! html
9268 <ul><li> foo
9269 <ul><li><ul><li> bar</li></ul></li>
9270 <li> baz</li></ul></li>
9271 <li> boo</li></ul>
9272
9273 !! end
9274
9275 !! test
9276 Nested lists 9 (extension interaction)
9277 !! options
9278 parsoid
9279 !! wikitext
9280 *<references />
9281 !! html/parsoid
9282 <ul><li data-parsoid='{}'><ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
9283 !! end
9284
9285 !! test
9286 1. Lists with start-of-line-transparent tokens before bullets: Comments
9287 !! wikitext
9288 *foo
9289 *<!--cmt-->bar
9290 <!--cmt-->*baz
9291 !! html
9292 <ul><li>foo</li>
9293 <li>bar</li>
9294 <li>baz</li></ul>
9295
9296 !! end
9297
9298 !! test
9299 2. Lists with start-of-line-transparent tokens before bullets: Template close
9300 !! wikitext
9301 *foo {{echo|bar
9302 }}*baz
9303 !! html
9304 <ul><li>foo bar</li>
9305 <li>baz</li></ul>
9306
9307 !! end
9308
9309 !! test
9310 List items are not parsed correctly following a <pre> block (bug 785)
9311 !! wikitext
9312 * <pre>foo</pre>
9313 * <pre>bar</pre>
9314 * zar
9315 !! html/php
9316 <ul><li> <pre>foo</pre></li>
9317 <li> <pre>bar</pre></li>
9318 <li> zar</li></ul>
9319
9320 !! html/parsoid
9321 <ul><li> <pre data-parsoid='{"stx":"html"}'>foo</pre></li>
9322 <li> <pre data-parsoid='{"stx":"html"}'>bar</pre></li>
9323 <li> zar</li></ul>
9324 !! end
9325
9326 !! test
9327 List items from template
9328 !! wikitext
9329
9330 {{inner list}}
9331 * item 2
9332
9333 * item 0
9334 {{inner list}}
9335 * item 2
9336
9337 * item 0
9338 * notSOL{{inner list}}
9339 * item 2
9340 !! html
9341 <ul><li> item 1</li>
9342 <li> item 2</li></ul>
9343 <ul><li> item 0</li>
9344 <li> item 1</li>
9345 <li> item 2</li></ul>
9346 <ul><li> item 0</li>
9347 <li> notSOL</li>
9348 <li> item 1</li>
9349 <li> item 2</li></ul>
9350
9351 !! end
9352
9353 !! test
9354 List interrupted by empty line or heading
9355 !! wikitext
9356 * foo
9357
9358 ** bar
9359 == A heading ==
9360 * Another list item
9361 !! html
9362 <ul><li> foo</li></ul>
9363 <ul><li><ul><li> bar</li></ul></li></ul>
9364 <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>
9365 <ul><li> Another list item</li></ul>
9366
9367 !!end
9368
9369 !!test
9370 Multiple list tags generated by templates
9371 !! wikitext
9372 {{echo|<li>}}a
9373 {{echo|<li>}}b
9374 {{echo|<li>}}c
9375 !! html
9376 <li>a
9377 <li>b
9378 <li>c</li>
9379 </li>
9380 </li>
9381
9382 !! html+tidy
9383 <ul>
9384 <li>a</li>
9385 <li>b</li>
9386 <li>c</li>
9387 </ul>
9388 !!end
9389
9390 !!test
9391 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
9392 !! wikitext
9393 *a
9394 <!--This line will NOT split the list-->
9395 *b
9396 <!--This line will NOT split the list either-->
9397 *c
9398 <!--foo--> <!----> <!--This line NOT split the list either-->
9399 *d
9400 !! html
9401 <ul><li>a</li>
9402 <li>b</li>
9403 <li>c</li>
9404 <li>d</li></ul>
9405
9406 !!end
9407
9408 !!test
9409 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
9410 !! wikitext
9411 *a
9412 <!--This line will NOT split the list-->
9413 *b
9414 <!--This line will NOT split the list either-->
9415 *c
9416 <!--foo--> <!----> <!--This line NOT split the list
9417 either-->
9418 *d
9419 !! html
9420 <ul><li>a</li>
9421 <li>b</li>
9422 <li>c</li>
9423 <li>d</li></ul>
9424
9425 !!end
9426
9427 !!test
9428 Test the li-hack
9429 (The PHP parser relies on Tidy for the hack)
9430 !!options
9431 parsoid=wt2html,wt2wt
9432 !! wikitext
9433 * foo
9434 * <li>li-hack
9435 * {{echo|<li>templated li-hack}}
9436 * <!--foo--> <li> unsupported li-hack with preceding comments
9437
9438 <ul>
9439 <li><li>not a li-hack
9440 </li>
9441 </ul>
9442 !! html+tidy
9443 <ul>
9444 <li>foo</li>
9445 <li>li-hack</li>
9446 <li>templated li-hack</li>
9447 <li>unsupported li-hack with preceding comments</li>
9448 </ul>
9449 <ul>
9450 <li>not a li-hack</li>
9451 </ul>
9452 !!end
9453
9454 !! test
9455 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
9456 !! options
9457 parsoid
9458 !! wikitext
9459 # foo
9460 ## bar
9461 * foo
9462 ** bar
9463 : foo
9464 :: bar
9465 !! html
9466 <ol>
9467 <li> foo<ol>
9468 <li> bar</li>
9469 </ol></li>
9470 </ol><ul>
9471 <li> foo<ul>
9472 <li> bar</li>
9473 </ul></li>
9474 </ul><dl>
9475 <dd> foo<dl>
9476 <dd> bar</dd>
9477 </dl></dd>
9478 </dl>
9479 !! end
9480
9481 !! test
9482 Parsoid: Test of whitespace serialization with Templated bullets
9483 !! options
9484 parsoid
9485 !! wikitext
9486 * {{bullet}}
9487 !! html
9488 <ul>
9489 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
9490 </ul>
9491 !! end
9492
9493 # ------------------------------------------------------------------------
9494 # The next set of tests are about Parsoid's ability to handle badly nested
9495 # tags (parse, minimize scope of fixup, and roundtrip back)
9496 # ------------------------------------------------------------------------
9497
9498 !! test
9499 Unbalanced closing block tags break a list
9500 (php parser relies on Tidy to fix up)
9501 !! wikitext
9502 <div>
9503 *a</div><div>
9504 *b</div>
9505 !! html+tidy
9506 <div>
9507 <ul>
9508 <li>a</li>
9509 </ul>
9510 </div>
9511 <div>
9512 <ul>
9513 <li>b</li>
9514 </ul>
9515 </div>
9516 !! end
9517
9518 # Parsoid fails this test, but it might be tricky to support properly.
9519 # See bug 68395.
9520 !! test
9521 Unbalanced closing non-block tags don't break a list
9522 (php parser relies on Tidy to fix up)
9523 !! wikitext
9524 <span>
9525 *a</span><span>
9526 *b</span>
9527 !! html/php+tidy
9528 <ul>
9529 <li><span>a</span></li>
9530 <li><span>b</span></li>
9531 </ul>
9532 !! html/parsoid
9533 <span>
9534 <ul>
9535 <li>a<span></span>
9536 </li>
9537 <li>b
9538 </li>
9539 </ul>
9540 </span>
9541 !! end
9542
9543 !! test
9544 Unclosed formatting tags that straddle lists are closed and reopened
9545 (php parser relies on Tidy to fix up)
9546 !! options
9547 parsoid=wt2html,wt2wt,html2html
9548 !! wikitext
9549 # <s> a
9550 # b </s>
9551 !! html/php+tidy
9552 <ol>
9553 <li><s>a</s></li>
9554 <li><s>b</s></li>
9555 </ol>
9556 !! html/parsoid
9557 <ol><li> <s> a</s></li>
9558 <li><s> b </s></li></ol>
9559 !! end
9560
9561 # See bug 68395.
9562 !!test
9563 1. List embedded in a formatting tag
9564 !! wikitext
9565 <small>
9566 * foo
9567 </small>
9568 !! html/php+tidy
9569 <ul>
9570 <li><small>foo</small></li>
9571 </ul>
9572 !! html/parsoid
9573 <small>
9574 <ul>
9575 <li> foo</li>
9576 </ul>
9577 </small>
9578 !!end
9579
9580 ## Ugly Parsoid output here
9581 ## Not sure what the right output is.
9582 !!test
9583 2. List embedded in a formatting tag
9584 !! wikitext
9585 <small>
9586 *a
9587 *b</small>
9588 !! html/php+tidy
9589 <ul>
9590 <li><small>a</small></li>
9591 <li><small>b</small></li>
9592 </ul>
9593 !! html/parsoid
9594 <small></small>
9595 <ul><small>
9596 <li>a</li>
9597 </small>
9598 <li><small>b</small></li>
9599 </ul>
9600 !!end
9601
9602 # Ugly Parsoid and PHP parser output here
9603 # Not sure if we want to make this a test!
9604 #
9605 ## !!test
9606 ## 3. Unclosed formatting tags in list elements
9607 ## !! wikitext
9608 ## *<small>a
9609 ## *<small>b
9610 ## !! html/php+tidy
9611 ## <ul>
9612 ## <li><small>a</small></li>
9613 ## <li><small><small>b</small></small></li>
9614 ## </ul>
9615 ## !! html/parsoid
9616 ## <ul>
9617 ## <li><small>a</small></li>
9618 ## <small>
9619 ## <li><small>b</small></li>
9620 ## </small></ul>
9621 ## !!end
9622
9623 # This is a bug in the PHP parser + tidy combination.
9624 # (The </tr> tag gets parsed as text and html-escaped by PHP,
9625 # and then fostered out of the table by tidy.)
9626 # We believe the Parsoid output to be correct.
9627 !! test
9628 Table with missing opening <tr> tag
9629 !! options
9630 parsoid=wt2html,wt2wt
9631 !! wikitext
9632 <table>
9633 <td>foo</td>
9634 </tr>
9635 </table>
9636 !! html+tidy
9637 <table>
9638 <tr>
9639 <td>foo</td>
9640 </tr>
9641 </table>
9642 !! end
9643
9644 ###
9645 ### Magic Words
9646 ###
9647
9648 # Note that the current date is hard-coded as
9649 # 1970-01-01T00:02:03Z (a Thursday)
9650 # when running parser tests. The timezone is also fixed to GMT, so
9651 # local date will be identical to current date.
9652
9653 !! test
9654 Magic Word: {{CURRENTDAY}}
9655 !! wikitext
9656 {{CURRENTDAY}}
9657 !! html
9658 <p>1
9659 </p>
9660 !! end
9661
9662 !! test
9663 Magic Word: {{CURRENTDAY2}}
9664 !! wikitext
9665 {{CURRENTDAY2}}
9666 !! html
9667 <p>01
9668 </p>
9669 !! end
9670
9671 !! test
9672 Magic Word: {{CURRENTDAYNAME}}
9673 !! wikitext
9674 {{CURRENTDAYNAME}}
9675 !! html
9676 <p>Thursday
9677 </p>
9678 !! end
9679
9680 !! test
9681 Magic Word: {{CURRENTDOW}}
9682 !! wikitext
9683 {{CURRENTDOW}}
9684 !! html
9685 <p>4
9686 </p>
9687 !! end
9688
9689 !! test
9690 Magic Word: {{CURRENTMONTH}}
9691 !! wikitext
9692 {{CURRENTMONTH}}
9693 !! html
9694 <p>01
9695 </p>
9696 !! end
9697
9698 !! test
9699 Magic Word: {{CURRENTMONTH1}}
9700 !! wikitext
9701 {{CURRENTMONTH1}}
9702 !! html
9703 <p>1
9704 </p>
9705 !! end
9706
9707 !! test
9708 Magic Word: {{CURRENTMONTHABBREV}}
9709 !! wikitext
9710 {{CURRENTMONTHABBREV}}
9711 !! html
9712 <p>Jan
9713 </p>
9714 !! end
9715
9716 !! test
9717 Magic Word: {{CURRENTMONTHNAME}}
9718 !! wikitext
9719 {{CURRENTMONTHNAME}}
9720 !! html
9721 <p>January
9722 </p>
9723 !! end
9724
9725 !! test
9726 Magic Word: {{CURRENTMONTHNAMEGEN}}
9727 !! wikitext
9728 {{CURRENTMONTHNAMEGEN}}
9729 !! html
9730 <p>January
9731 </p>
9732 !! end
9733
9734 !! test
9735 Magic Word: {{CURRENTTIME}}
9736 !! wikitext
9737 {{CURRENTTIME}}
9738 !! html
9739 <p>00:02
9740 </p>
9741 !! end
9742
9743 !! test
9744 Magic Word: {{CURRENTHOUR}}
9745 !! wikitext
9746 {{CURRENTHOUR}}
9747 !! html
9748 <p>00
9749 </p>
9750 !! end
9751
9752 !! test
9753 Magic Word: {{CURRENTWEEK}} (@bug 4594)
9754 !! wikitext
9755 {{CURRENTWEEK}}
9756 !! html
9757 <p>1
9758 </p>
9759 !! end
9760
9761 !! test
9762 Magic Word: {{CURRENTYEAR}}
9763 !! wikitext
9764 {{CURRENTYEAR}}
9765 !! html
9766 <p>1970
9767 </p>
9768 !! end
9769
9770 !! test
9771 Magic Word: {{CURRENTTIMESTAMP}}
9772 !! wikitext
9773 {{CURRENTTIMESTAMP}}
9774 !! html
9775 <p>19700101000203
9776 </p>
9777 !! end
9778
9779 !! test
9780 Magic Words LOCAL (UTC)
9781 !! wikitext
9782 * {{LOCALMONTH}}
9783 * {{LOCALMONTH1}}
9784 * {{LOCALMONTHNAME}}
9785 * {{LOCALMONTHNAMEGEN}}
9786 * {{LOCALMONTHABBREV}}
9787 * {{LOCALDAY}}
9788 * {{LOCALDAY2}}
9789 * {{LOCALDAYNAME}}
9790 * {{LOCALYEAR}}
9791 * {{LOCALTIME}}
9792 * {{LOCALHOUR}}
9793 * {{LOCALWEEK}}
9794 * {{LOCALDOW}}
9795 * {{LOCALTIMESTAMP}}
9796 !! html
9797 <ul><li> 01</li>
9798 <li> 1</li>
9799 <li> January</li>
9800 <li> January</li>
9801 <li> Jan</li>
9802 <li> 1</li>
9803 <li> 01</li>
9804 <li> Thursday</li>
9805 <li> 1970</li>
9806 <li> 00:02</li>
9807 <li> 00</li>
9808 <li> 1</li>
9809 <li> 4</li>
9810 <li> 19700101000203</li></ul>
9811
9812 !! end
9813
9814 !! test
9815 Magic Word: {{FULLPAGENAME}}
9816 !! options
9817 title=[[User:Ævar Arnfjörð Bjarmason]]
9818 !! wikitext
9819 {{FULLPAGENAME}}
9820 !! html
9821 <p>User:Ævar Arnfjörð Bjarmason
9822 </p>
9823 !! end
9824
9825 !! test
9826 Magic Word: {{FULLPAGENAMEE}}
9827 !! options
9828 title=[[User:Ævar Arnfjörð Bjarmason]]
9829 !! wikitext
9830 {{FULLPAGENAMEE}}
9831 !! html
9832 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9833 </p>
9834 !! end
9835
9836 !! test
9837 Magic Word: {{TALKSPACE}}
9838 !! options
9839 title=[[User:Ævar Arnfjörð Bjarmason]]
9840 !! wikitext
9841 {{TALKSPACE}}
9842 !! html
9843 <p>User talk
9844 </p>
9845 !! end
9846
9847 !! test
9848 Magic Word: {{TALKSPACE}}, same namespace
9849 !! options
9850 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9851 !! wikitext
9852 {{TALKSPACE}}
9853 !! html
9854 <p>User talk
9855 </p>
9856 !! end
9857
9858 !! test
9859 Magic Word: {{TALKSPACE}}, main namespace
9860 !! options
9861 title=[[Parser Test]]
9862 !! wikitext
9863 {{TALKSPACE}}
9864 !! html
9865 <p>Talk
9866 </p>
9867 !! end
9868
9869 !! test
9870 Magic Word: {{TALKSPACEE}}
9871 !! options
9872 title=[[User:Ævar Arnfjörð Bjarmason]]
9873 !! wikitext
9874 {{TALKSPACEE}}
9875 !! html
9876 <p>User_talk
9877 </p>
9878 !! end
9879
9880 !! test
9881 Magic Word: {{SUBJECTSPACE}}
9882 !! options
9883 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9884 !! wikitext
9885 {{SUBJECTSPACE}}
9886 !! html
9887 <p>User
9888 </p>
9889 !! end
9890
9891 !! test
9892 Magic Word: {{SUBJECTSPACE}}, same namespace
9893 !! options
9894 title=[[User:Ævar Arnfjörð Bjarmason]]
9895 !! wikitext
9896 {{SUBJECTSPACE}}
9897 !! html
9898 <p>User
9899 </p>
9900 !! end
9901
9902 !! test
9903 Magic Word: {{SUBJECTSPACE}}, main namespace
9904 !! options
9905 title=[[Parser Test]]
9906 !! wikitext
9907 {{SUBJECTSPACE}}
9908 !! html
9909
9910 !! end
9911
9912 !! test
9913 Magic Word: {{SUBJECTSPACEE}}
9914 !! options
9915 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9916 !! wikitext
9917 {{SUBJECTSPACEE}}
9918 !! html
9919 <p>User
9920 </p>
9921 !! end
9922
9923 !! test
9924 Magic Word: {{NAMESPACE}}
9925 !! options
9926 title=[[User:Ævar Arnfjörð Bjarmason]]
9927 !! wikitext
9928 {{NAMESPACE}}
9929 !! html
9930 <p>User
9931 </p>
9932 !! end
9933
9934 !! test
9935 Magic Word: {{NAMESPACEE}}
9936 !! options
9937 title=[[User:Ævar Arnfjörð Bjarmason]]
9938 !! wikitext
9939 {{NAMESPACEE}}
9940 !! html
9941 <p>User
9942 </p>
9943 !! end
9944
9945 !! test
9946 Magic Word: {{NAMESPACENUMBER}}
9947 !! options
9948 title=[[User:Ævar Arnfjörð Bjarmason]]
9949 !! wikitext
9950 {{NAMESPACENUMBER}}
9951 !! html
9952 <p>2
9953 </p>
9954 !! end
9955
9956 !! test
9957 Magic Word: {{SUBPAGENAME}}
9958 !! options
9959 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9960 !! wikitext
9961 {{SUBPAGENAME}}
9962 !! html
9963 <p>sub ö
9964 </p>
9965 !! end
9966
9967 !! test
9968 Magic Word: {{SUBPAGENAMEE}}
9969 !! options
9970 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9971 !! wikitext
9972 {{SUBPAGENAMEE}}
9973 !! html
9974 <p>sub_%C3%B6
9975 </p>
9976 !! end
9977
9978 !! test
9979 Magic Word: {{ROOTPAGENAME}}
9980 !! options
9981 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9982 !! wikitext
9983 {{ROOTPAGENAME}}
9984 !! html
9985 <p>Ævar Arnfjörð Bjarmason
9986 </p>
9987 !! end
9988
9989 !! test
9990 Magic Word: {{ROOTPAGENAMEE}}
9991 !! options
9992 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9993 !! wikitext
9994 {{ROOTPAGENAMEE}}
9995 !! html
9996 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9997 </p>
9998 !! end
9999
10000 !! test
10001 Magic Word: {{BASEPAGENAME}}
10002 !! options
10003 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10004 !! wikitext
10005 {{BASEPAGENAME}}
10006 !! html
10007 <p>Ævar Arnfjörð Bjarmason
10008 </p>
10009 !! end
10010
10011 !! test
10012 Magic Word: {{BASEPAGENAMEE}}
10013 !! options
10014 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10015 !! wikitext
10016 {{BASEPAGENAMEE}}
10017 !! html
10018 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10019 </p>
10020 !! end
10021
10022 !! test
10023 Magic Word: {{TALKPAGENAME}}
10024 !! options
10025 title=[[User:Ævar Arnfjörð Bjarmason]]
10026 !! wikitext
10027 {{TALKPAGENAME}}
10028 !! html
10029 <p>User talk:Ævar Arnfjörð Bjarmason
10030 </p>
10031 !! end
10032
10033 !! test
10034 Magic Word: {{TALKPAGENAMEE}}
10035 !! options
10036 title=[[User:Ævar Arnfjörð Bjarmason]]
10037 !! wikitext
10038 {{TALKPAGENAMEE}}
10039 !! html
10040 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10041 </p>
10042 !! end
10043
10044 !! test
10045 Magic Word: {{SUBJECTPAGENAME}}
10046 !! options
10047 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10048 !! wikitext
10049 {{SUBJECTPAGENAME}}
10050 !! html
10051 <p>User:Ævar Arnfjörð Bjarmason
10052 </p>
10053 !! end
10054
10055 !! test
10056 Magic Word: {{SUBJECTPAGENAMEE}}
10057 !! options
10058 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10059 !! wikitext
10060 {{SUBJECTPAGENAMEE}}
10061 !! html
10062 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10063 </p>
10064 !! end
10065
10066 !! test
10067 Magic Word: {{NUMBEROFFILES}}
10068 !! wikitext
10069 {{NUMBEROFFILES}}
10070 !! html
10071 <p>7
10072 </p>
10073 !! end
10074
10075 !! test
10076 Magic Word: {{PAGENAME}}
10077 !! options
10078 title=[[User:Ævar Arnfjörð Bjarmason]]
10079 !! wikitext
10080 {{PAGENAME}}
10081 !! html
10082 <p>Ævar Arnfjörð Bjarmason
10083 </p>
10084 !! end
10085
10086 !! test
10087 Magic Word: {{PAGENAME}} with metacharacters
10088 !! options
10089 title=[['foo & bar = baz']]
10090 !! wikitext
10091 ''{{PAGENAME}}''
10092 !! html/php
10093 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
10094 </p>
10095 !! html+tidy
10096 <p><i>'foo &amp; bar = baz'</i></p>
10097 !! end
10098
10099 !! test
10100 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
10101 !! options
10102 title=[[*RFC 1234 http://example.com/]]
10103 !! wikitext
10104 {{PAGENAME}}
10105 !! html/php
10106 <p>&#42;RFC&#32;1234 http&#58;//example.com/
10107 </p>
10108 !! html+tidy
10109 <p>*RFC 1234 http://example.com/</p>
10110 !! end
10111
10112 !! test
10113 Magic Word: {{PAGENAMEE}}
10114 !! options
10115 title=[[User:Ævar Arnfjörð Bjarmason]]
10116 !! wikitext
10117 {{PAGENAMEE}}
10118 !! html
10119 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10120 </p>
10121 !! end
10122
10123 !! test
10124 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
10125 !! options
10126 title=[[*RFC 1234 http://example.com/]]
10127 !! wikitext
10128 {{PAGENAMEE}}
10129 !! html/php
10130 <p>&#42;RFC_1234_http&#58;//example.com/
10131 </p>
10132 !! html+tidy
10133 <p>*RFC_1234_http://example.com/</p>
10134 !! end
10135
10136 !! test
10137 Magic Word: {{REVISIONID}}
10138 !! wikitext
10139 {{REVISIONID}}
10140 !! html
10141 <p>1337
10142 </p>
10143 !! end
10144
10145 !! test
10146 Magic Word: {{SCRIPTPATH}}
10147 !! wikitext
10148 {{SCRIPTPATH}}
10149 !! html
10150
10151 !! end
10152
10153 !! test
10154 Magic Word: {{STYLEPATH}}
10155 !! wikitext
10156 {{STYLEPATH}}
10157 !! html
10158 <p>/skins
10159 </p>
10160 !! end
10161
10162 !! test
10163 Magic Word: {{SERVER}}
10164 !! wikitext
10165 {{SERVER}}
10166 !! html
10167 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10168 </p>
10169 !! end
10170
10171 !! test
10172 Magic Word: {{SERVERNAME}}
10173 !! wikitext
10174 {{SERVERNAME}}
10175 !! html
10176 <p>example.org
10177 </p>
10178 !! end
10179
10180 !! test
10181 Magic Word: {{SITENAME}}
10182 !! wikitext
10183 {{SITENAME}}
10184 !! html
10185 <p>MediaWiki
10186 </p>
10187 !! end
10188
10189 !! test
10190 Case-sensitive magic words, when cased differently, should just be template transclusions
10191 !! wikitext
10192 {{CurrentMonth}}
10193 {{currentday}}
10194 {{cURreNTweEK}}
10195 {{currentHour}}
10196 !! html
10197 <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>
10198 <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>
10199 <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>
10200 <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>
10201 </p>
10202 !! end
10203
10204 !! test
10205 Case-insensitive magic words should still work with weird casing.
10206 !! wikitext
10207 {{sErVeRNaMe}}
10208 {{LCFirst:AOEU}}
10209 {{ucFIRST:aoeu}}
10210 {{SERver}}
10211 !! html
10212 <p>example.org
10213 aOEU
10214 Aoeu
10215 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10216 </p>
10217 !! end
10218
10219 # From plwiki:PLOS_ONE
10220 !! test
10221 Parsoid: Page property magic word with magic word contents
10222 !! wikitext
10223 {{DISPLAYTITLE:''{{PAGENAME}}''}}
10224 !! html/parsoid
10225 <meta property="mw:PageProp/displaytitle" content="Main Page" about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"src":"{{DISPLAYTITLE:&#39;&#39;{{PAGENAME}}&#39;&#39;}}"}' data-mw='{"attribs":[[{"txt":"content"},{"html":"&lt;i data-parsoid=&#39;{\"dsr\":[15,31,2,2]}&#39;>&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[17,29,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"PAGENAME\",\"function\":\"pagename\"},\"params\":{},\"i\":0}}]}&#39;>Main Page&lt;/span>&lt;/i>"}]]}'/>
10226 !! end
10227
10228 !! test
10229 Parsoid: Template-generated DISPLAYTITLE
10230 !! wikitext
10231 {{{{echo|DISPLAYTITLE}}:Foo}}
10232 !! html/parsoid
10233 <meta property="mw:PageProp/displaytitle" content="Foo" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"{{echo|DISPLAYTITLE}}:Foo"},"params":{},"i":0}}]}'/>
10234 !! end
10235
10236 !! test
10237 Namespace 1 {{ns:1}}
10238 !! wikitext
10239 {{ns:1}}
10240 !! html
10241 <p>Talk
10242 </p>
10243 !! end
10244
10245 !! test
10246 Namespace 1 {{ns:01}}
10247 !! wikitext
10248 {{ns:01}}
10249 !! html
10250 <p>Talk
10251 </p>
10252 !! end
10253
10254 !! test
10255 Namespace 0 {{ns:0}} (bug 4783)
10256 !! wikitext
10257 {{ns:0}}
10258 !! html
10259
10260 !! end
10261
10262 !! test
10263 Namespace 0 {{ns:00}} (bug 4783)
10264 !! wikitext
10265 {{ns:00}}
10266 !! html
10267
10268 !! end
10269
10270 !! test
10271 Namespace -1 {{ns:-1}}
10272 !! wikitext
10273 {{ns:-1}}
10274 !! html
10275 <p>Special
10276 </p>
10277 !! end
10278
10279 !! test
10280 Namespace User {{ns:User}}
10281 !! wikitext
10282 {{ns:User}}
10283 !! html
10284 <p>User
10285 </p>
10286 !! end
10287
10288 !! test
10289 Namespace User talk {{ns:User_talk}}
10290 !! wikitext
10291 {{ns:User_talk}}
10292 !! html
10293 <p>User talk
10294 </p>
10295 !! end
10296
10297 !! test
10298 Namespace User talk {{ns:uSeR tAlK}}
10299 !! wikitext
10300 {{ns:uSeR tAlK}}
10301 !! html
10302 <p>User talk
10303 </p>
10304 !! end
10305
10306 !! test
10307 Namespace File {{ns:File}}
10308 !! wikitext
10309 {{ns:File}}
10310 !! html
10311 <p>File
10312 </p>
10313 !! end
10314
10315 !! test
10316 Namespace File {{ns:Image}}
10317 !! wikitext
10318 {{ns:Image}}
10319 !! html
10320 <p>File
10321 </p>
10322 !! end
10323
10324 !! test
10325 Namespace (lang=de) Benutzer {{ns:User}}
10326 !! options
10327 language=de
10328 !! wikitext
10329 {{ns:User}}
10330 !! html
10331 <p>Benutzer
10332 </p>
10333 !! end
10334
10335 !! test
10336 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
10337 !! options
10338 language=de
10339 !! wikitext
10340 {{ns:3}}
10341 !! html
10342 <p>Benutzer Diskussion
10343 </p>
10344 !! end
10345
10346
10347 !! test
10348 Urlencode
10349 !! wikitext
10350 {{urlencode:hi world?!}}
10351 {{urlencode:hi world?!|WIKI}}
10352 {{urlencode:hi world?!|PATH}}
10353 {{urlencode:hi world?!|QUERY}}
10354 !! html
10355 <p>hi+world%3F%21
10356 hi_world%3F!
10357 hi%20world%3F%21
10358 hi+world%3F%21
10359 </p>
10360 !! end
10361
10362 !! test
10363 Magic Word: prioritize type info over data-parsoid
10364 !! options
10365 parsoid=html2wt
10366 !! html/parsoid
10367 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
10368 !! wikitext
10369 __FORCETOC__
10370 !! end
10371
10372 !! test
10373 Magic Word: serialize on separate line (parsoid)
10374 !! options
10375 parsoid=wt2wt,html2wt
10376 !! wikitext
10377 foo
10378 __NOTOC__
10379 bar
10380 !! html/parsoid
10381 foo<meta property="mw:PageProp/notoc"/>bar
10382 !! end
10383
10384 !! test
10385 Magic Word: rt non-english wikis
10386 !! options
10387 parsoid=wt2wt
10388 language=de
10389 !! wikitext
10390 __NOEDITSECTION__
10391 !! html/parsoid
10392 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
10393 !! end
10394
10395 !!test
10396 __proto__ is treated as normal wikitext (T105997)
10397 !!wikitext
10398 __proto__
10399 !!html
10400 <p>__proto__
10401 </p>
10402 !!end
10403
10404 ###
10405 ### Magic links
10406 ###
10407 !! test
10408 Magic links: internal link to RFC (bug 479)
10409 !! wikitext
10410 [[RFC 123]]
10411 !! html/php
10412 <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>
10413 </p>
10414 !! html/parsoid
10415 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
10416 !! end
10417
10418 !! test
10419 Magic links: RFC (bug 479)
10420 !! wikitext
10421 RFC 822
10422 !! html/php
10423 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10424 </p>
10425 !! html/parsoid
10426 <p><a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a></p>
10427 !! end
10428
10429 !! test
10430 Magic links: RFC (bug 65278)
10431 !! wikitext
10432 This is RFC 822 but thisRFC 822 is not RFC 822linked.
10433 !! html/php
10434 <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.
10435 </p>
10436 !! html/parsoid
10437 <p>This is <a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a> but thisRFC 822 is not RFC 822linked.</p>
10438 !! end
10439
10440 !! test
10441 Magic links: RFC (w/ non-newline whitespace, bug 28950/29025)
10442 !! wikitext
10443 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
10444 RFC
10445 822
10446 !! html/php
10447 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10448 RFC
10449 822
10450 </p>
10451 !! html/parsoid
10452 <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>
10453 RFC
10454 822</p>
10455 !! end
10456
10457 !! test
10458 Magic links: ISBN (bug 1937)
10459 !! wikitext
10460 ISBN 0-306-40615-2
10461 !! html/php
10462 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
10463 </p>
10464 !! html/parsoid
10465 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
10466 !! end
10467
10468 !! test
10469 Magic links: ISBN (bug 65278)
10470 !! wikitext
10471 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
10472 !! html/php
10473 <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.
10474 </p>
10475 !! html/parsoid
10476 <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>
10477 !! end
10478
10479 !! test
10480 Magic links: ISBN (w/ non-newline whitespace, bug 28950/29025)
10481 !! wikitext
10482 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
10483 ISBN
10484 9780316098113
10485 ISBN 978
10486 0316098113
10487 !! html/php
10488 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
10489 ISBN
10490 9780316098113
10491 ISBN 978
10492 0316098113
10493 </p>
10494 !! html/parsoid
10495 <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>
10496 ISBN
10497 9780316098113
10498 ISBN 978
10499 0316098113</p>
10500 !! end
10501
10502 !! test
10503 Magic links: PMID incorrectly converts space to underscore
10504 !! wikitext
10505 PMID 1234
10506 !! html/php
10507 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10508 </p>
10509 !! html/parsoid
10510 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a></p>
10511 !! end
10512
10513 !! test
10514 Magic links: PMID (bug 65278)
10515 !! wikitext
10516 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
10517 !! html/php
10518 <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.
10519 </p>
10520 !! html/parsoid
10521 <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>
10522 !! end
10523
10524 !! test
10525 Magic links: PMID (w/ non-newline whitespace, bug 28950/29025)
10526 !! wikitext
10527 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
10528 PMID
10529 1234
10530 !! html/php
10531 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10532 PMID
10533 1234
10534 </p>
10535 !! html/parsoid
10536 <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>
10537 PMID
10538 1234</p>
10539 !! end
10540
10541 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
10542 # since these are ExtLinkText, not MagicLinkText
10543 !! test
10544 Magic links: use appropriate serialization for "almost" magic links.
10545 !! wikitext
10546 X[[Special:BookSources/0978739256|foo]]
10547
10548 X[//tools.ietf.org/html/rfc1234 foo]
10549 !! html/php
10550 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
10551 </p><p>X<a rel="nofollow" class="external text" href="//tools.ietf.org/html/rfc1234">foo</a>
10552 </p>
10553 !! html/parsoid
10554 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
10555 <p>X<a rel="mw:ExtLink" href="//tools.ietf.org/html/rfc1234">foo</a></p>
10556 !! end
10557
10558 !! test
10559 Magic links: All disabled (T47942)
10560 !! options
10561 wgEnableMagicLinks={"ISBN":false, "PMID":false, "RFC":false}
10562 !! wikitext
10563 ISBN 0-306-40615-2
10564 PMID 1234
10565 RFC 4321
10566 !! html/php
10567 <p>ISBN 0-306-40615-2
10568 PMID 1234
10569 RFC 4321
10570 </p>
10571 !! end
10572
10573 ###
10574 ### Templates
10575 ####
10576
10577 !! test
10578 Nonexistent template
10579 !! wikitext
10580 {{thistemplatedoesnotexist}}
10581 !! html
10582 <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>
10583 </p>
10584 !! end
10585
10586 !! test
10587 Template with invalid target containing tags
10588 !! wikitext
10589 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10590 !! html
10591 <p>{{a<b>b</b>|foo|a=b|a = b}}
10592 </p>
10593 !! end
10594
10595 !! test
10596 Template with invalid target containing unclosed tag
10597 !! wikitext
10598 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10599 !! html
10600 <p>{{a<b>|foo|a=b|a = b}}</b>
10601 </p>
10602 !! end
10603
10604 !! test
10605 Template with invalid target containing wikilink
10606 !! wikitext
10607 {{[[Main Page]]}}
10608 !! html/php
10609 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
10610 </p>
10611 !! html/parsoid
10612 <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>
10613 !! end
10614
10615 !! test
10616 Template with just whitespace in it, bug #68421
10617 !! wikitext
10618 {{echo|{{ }}}}
10619 !! html/parsoid
10620 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{ }}"}},"i":0}}]}'>{{ }}</p>
10621 !! end
10622
10623 !! article
10624 Template:test
10625 !! text
10626 This is a test template
10627 !! endarticle
10628
10629 !! test
10630 Simple template
10631 !! wikitext
10632 {{test}}
10633 !! html
10634 <p>This is a test template
10635 </p>
10636 !! end
10637
10638 !! test
10639 Template with explicit namespace
10640 !! wikitext
10641 {{Template:test}}
10642 !! html
10643 <p>This is a test template
10644 </p>
10645 !! end
10646
10647
10648 !! article
10649 Template:paramtest
10650 !! text
10651 This is a test template with parameter {{{param}}}
10652 !! endarticle
10653
10654 !! test
10655 Template parameter
10656 !! wikitext
10657 {{paramtest|param=foo}}
10658 !! html
10659 <p>This is a test template with parameter foo
10660 </p>
10661 !! end
10662
10663 !! article
10664 Template:paramtestnum
10665 !! text
10666 [[{{{1}}}|{{{2}}}]]
10667 !! endarticle
10668
10669 !! test
10670 Template unnamed parameter
10671 !! wikitext
10672 {{paramtestnum|Main Page|the main page}}
10673 !! html
10674 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
10675 </p>
10676 !! end
10677
10678 !! article
10679 Template:templatesimple
10680 !! text
10681 (test)
10682 !! endarticle
10683
10684 !! article
10685 Template:templateredirect
10686 !! text
10687 #redirect [[Template:templatesimple]]
10688 !! endarticle
10689
10690 !! article
10691 Template:templateasargtestnum
10692 !! text
10693 {{{{{1}}}}}
10694 !! endarticle
10695
10696 !! article
10697 Template:templateasargtest
10698 !! text
10699 {{template{{{templ}}}}}
10700 !! endarticle
10701
10702 !! article
10703 Template:templateasargtest2
10704 !! text
10705 {{{{{templ}}}}}
10706 !! endarticle
10707
10708 !! test
10709 Template with template name as unnamed argument
10710 !! wikitext
10711 {{templateasargtestnum|templatesimple}}
10712 !! html
10713 <p>(test)
10714 </p>
10715 !! end
10716
10717 !! test
10718 Template with template name as argument
10719 !! wikitext
10720 {{templateasargtest|templ=simple}}
10721 !! html
10722 <p>(test)
10723 </p>
10724 !! end
10725
10726 !! test
10727 Template with template name as argument (2)
10728 !! wikitext
10729 {{templateasargtest2|templ=templatesimple}}
10730 !! html
10731 <p>(test)
10732 </p>
10733 !! end
10734
10735 !! article
10736 Template:templateasargtestdefault
10737 !! text
10738 {{{{{templ|templatesimple}}}}}
10739 !! endarticle
10740
10741 !! article
10742 Template:templa
10743 !! text
10744 '''templ'''
10745 !! endarticle
10746
10747 !! test
10748 Template with default value
10749 !! wikitext
10750 {{templateasargtestdefault}}
10751 !! html
10752 <p>(test)
10753 </p>
10754 !! end
10755
10756 !! test
10757 Template with default value (value set)
10758 !! wikitext
10759 {{templateasargtestdefault|templ=templa}}
10760 !! html
10761 <p><b>templ</b>
10762 </p>
10763 !! end
10764
10765 !! test
10766 Template redirect
10767 !! wikitext
10768 {{templateredirect}}
10769 !! html/php
10770 <p>(test)
10771 </p>
10772 !! html/parsoid
10773 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
10774 !! end
10775
10776 !! test
10777 Template with argument in separate line
10778 !! wikitext
10779 {{ templateasargtest |
10780 templ = simple }}
10781 !! html
10782 <p>(test)
10783 </p>
10784 !! end
10785
10786 !! test
10787 Template with complex template as argument
10788 !! wikitext
10789 {{paramtest|
10790 param ={{ templateasargtest |
10791 templ = simple }}}}
10792 !! html
10793 <p>This is a test template with parameter (test)
10794 </p>
10795 !! end
10796
10797 !! test
10798 Template with thumb image (with link in description)
10799 !! wikitext
10800 {{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
10801 !! html/php
10802 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>
10803
10804 !! html+tidy
10805 <p>This is a test template with parameter</p>
10806 <div class="thumb tright">
10807 <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>
10808 <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>
10809 </div>
10810 </div>
10811 !! html/parsoid
10812 <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>
10813 !! end
10814
10815 !! article
10816 Template:complextemplate
10817 !! text
10818 {{{1}}} {{paramtest|
10819 param ={{{param}}}}}
10820 !! endarticle
10821
10822 !! test
10823 Template with complex arguments
10824 !! wikitext
10825 {{complextemplate|
10826 param ={{ templateasargtest |
10827 templ = simple }}|[[Template:complextemplate|link]]}}
10828 !! html
10829 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
10830 </p>
10831 !! end
10832
10833 !! test
10834 BUG 553: link with two variables in a piped link
10835 !! wikitext
10836 {|
10837 |[[{{{1}}}|{{{2}}}]]
10838 |}
10839 !! html/php
10840 <table>
10841 <tr>
10842 <td>[[{{{1}}}|{{{2}}}]]
10843 </td></tr></table>
10844
10845 !! html/parsoid
10846 <table>
10847 <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>
10848 !! end
10849
10850 # See: T2553
10851 !! test
10852 Abort table cell attribute parsing on wikilink
10853 !! wikitext
10854 {|
10855 | testing [[one|two]] | three || four
10856 | testing one two | three || four
10857 | testing="[[one|two]]" | three || four
10858 |}
10859 !! html/php
10860 <table>
10861 <tr>
10862 <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>
10863 <td> four
10864 </td>
10865 <td> three </td>
10866 <td> four
10867 </td>
10868 <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>
10869 <td> four
10870 </td></tr></table>
10871
10872 !! html/parsoid
10873 <table>
10874 <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>
10875 <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>
10876 <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>
10877 </tbody></table>
10878 !! end
10879
10880 !! test
10881 Don't abort table cell attribute parsing if wikilink is found in template arg
10882 !! wikitext
10883 {|
10884 | Test {{#tag:ref|One two "[[three]]" four}}
10885 |}
10886 !! html/parsoid
10887 <table>
10888 <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>
10889 </tbody></table>
10890 !! end
10891
10892 !! test
10893 Magic variable as template parameter
10894 !! wikitext
10895 {{paramtest|param={{SITENAME}}}}
10896 !! html
10897 <p>This is a test template with parameter MediaWiki
10898 </p>
10899 !! end
10900
10901 !! article
10902 Template:linktest
10903 !! text
10904 [[{{{param}}}|link]]
10905 !! endarticle
10906
10907 !! test
10908 Template parameter as link source
10909 !! wikitext
10910 {{linktest|param=Main Page}}
10911 !! html
10912 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
10913 </p>
10914 !! end
10915
10916 !!article
10917 Template:paramtest2
10918 !! text
10919 including another template, {{paramtest|param={{{arg}}}}}
10920 !! endarticle
10921
10922 !! test
10923 Template passing argument to another template
10924 !! wikitext
10925 {{paramtest2|arg='hmm'}}
10926 !! html
10927 <p>including another template, This is a test template with parameter 'hmm'
10928 </p>
10929 !! end
10930
10931 !! article
10932 Template:Linktest2
10933 !! text
10934 Main Page
10935 !! endarticle
10936
10937 !! test
10938 Template as link source
10939 !! wikitext
10940 [[{{linktest2}}]]
10941
10942 [[{{linktest2}}|Main Page]]
10943
10944 [[{{linktest2}}]]Page
10945 !! html
10946 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10947 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10948 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
10949 </p>
10950 !! end
10951
10952
10953 !! article
10954 Template:loop1
10955 !! text
10956 {{loop2}}
10957 !! endarticle
10958
10959 !! article
10960 Template:loop2
10961 !! text
10962 {{loop1}}
10963 !! endarticle
10964
10965 !! test
10966 Template infinite loop
10967 !! wikitext
10968 {{loop1}}
10969 !! html
10970 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
10971 </p>
10972 !! end
10973
10974 !! test
10975 Template from main namespace
10976 !! wikitext
10977 {{:Main Page}}
10978 !! html
10979 <p>blah blah
10980 </p>
10981 !! end
10982
10983 !! article
10984 Template:table
10985 !! text
10986 {|
10987 | 1 || 2
10988 |-
10989 | 3 || 4
10990 |}
10991 !! endarticle
10992
10993 !! test
10994 BUG 529: Template with table, not included at beginning of line
10995 !! wikitext
10996 foo {{table}}
10997 !! html
10998 <p>foo
10999 </p>
11000 <table>
11001 <tr>
11002 <td> 1 </td>
11003 <td> 2
11004 </td></tr>
11005 <tr>
11006 <td> 3 </td>
11007 <td> 4
11008 </td></tr></table>
11009
11010 !! end
11011
11012 !! test
11013 BUG 523: Template shouldn't eat newline (or add an extra one before table)
11014 !! wikitext
11015 foo
11016 {{table}}
11017 !! html
11018 <p>foo
11019 </p>
11020 <table>
11021 <tr>
11022 <td> 1 </td>
11023 <td> 2
11024 </td></tr>
11025 <tr>
11026 <td> 3 </td>
11027 <td> 4
11028 </td></tr></table>
11029
11030 !! end
11031
11032 !! test
11033 BUG 41: Template parameters shown as broken links
11034 !! wikitext
11035 {{{parameter}}}
11036 !! html
11037 <p>{{{parameter}}}
11038 </p>
11039 !! end
11040
11041 !! test
11042 Template with targets containing wikilinks
11043 !! wikitext
11044 {{[[foo]]}}
11045
11046 {{[[{{echo|foo}}]]}}
11047
11048 {{{{echo|[[foo}}]]}}
11049 !! html
11050 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11051 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11052 </p><p>{{[[foo}}]]
11053 </p>
11054 !! end
11055
11056 !! article
11057 Template:''
11058 !! text
11059 bar
11060 !! endarticle
11061
11062 !! test
11063 Templates: Double quotes as template target
11064 !! wikitext
11065 foo {{''}} baz
11066 !! html/php
11067 <p>foo bar baz
11068 </p>
11069 !! html/parsoid
11070 <p>foo <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"&#39;&#39;","href":"./Template:&#39;&#39;"},"params":{},"i":0}}]}'>bar</span> baz
11071 </p>
11072 !! end
11073
11074 ## This test is about making sure Parsoid's data-mw is well formed in the
11075 ## face of multiple templates with intersecting and overlapping ranges. The
11076 ## wikitext itself is wretched.
11077 !! test
11078 Templates with intersecting and overlapping ranges
11079 !! wikitext
11080 {|{{echo|
11081 <p>ha</p>}}
11082 {|{{echo|
11083 <p>ho</p>}}
11084 {{echo|{{!}}hi}}
11085 |}
11086 !! html/php+tidy
11087 <p>ha</p>
11088 <p>ho</p>
11089 <table>
11090 <tr>
11091 <td></td>
11092 </tr>
11093 <tr>
11094 <td>hi</td>
11095 </tr>
11096 </table>
11097 <table>
11098 <tr>
11099 <td></td>
11100 </tr>
11101 </table>
11102 !! html/parsoid
11103 <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":""}]]}'>
11104
11105 </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
11106
11107 <tbody><tr><td>hi</td></tr>
11108 </tbody></table>
11109 !! end
11110
11111 !! article
11112 Template:MSGNW test
11113 !! text
11114 ''None'' of '''this''' should be
11115 * interpreted
11116 but rather passed unmodified
11117 {{test}}
11118 <gallery>
11119 File:Foobar.jpg
11120 </gallery>
11121 <!-- comment -->
11122 !! endarticle
11123
11124 # hmm, fix this or just deprecate msgnw and document its behavior?
11125 !! test
11126 msgnw keyword
11127 !! wikitext
11128 {{msgnw:MSGNW test}}
11129 !! html/php
11130 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
11131 &#42; interpreted
11132 &#32;but rather passed unmodified
11133 &#123;&#123;test&#125;&#125;
11134 &#60;gallery&#62;
11135 File:Foobar.jpg
11136 &#60;/gallery&#62;
11137 &#60;!-- comment --&#62;
11138 </p>
11139 !! end
11140
11141 !! test
11142 int keyword
11143 !! wikitext
11144 {{int:youhavenewmessages|lots of money|not!}}
11145 !! html
11146 <p>You have lots of money (not!).
11147 </p>
11148 !! end
11149
11150 !! test
11151 int keyword - non-existing message
11152 !! wikitext
11153 {{int:var}}
11154 !! html
11155 <p>⧼var⧽
11156 </p>
11157 !! end
11158
11159 !! article
11160 Template:Includes
11161 !! text
11162 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11163 !! endarticle
11164
11165 !! test
11166 <includeonly> and <noinclude> being included
11167 !! wikitext
11168 {{Includes}}
11169 !! html
11170 <p>Foobar
11171 </p>
11172 !! end
11173
11174 !! article
11175 Template:Includes2
11176 !! text
11177 <onlyinclude>Foo</onlyinclude>bar
11178 !! endarticle
11179
11180 !! test
11181 <onlyinclude> being included
11182 !! wikitext
11183 {{Includes2}}
11184 !! html
11185 <p>Foo
11186 </p>
11187 !! end
11188
11189
11190 !! article
11191 Template:Includes3
11192 !! text
11193 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
11194 !! endarticle
11195
11196 !! test
11197 <onlyinclude> and <includeonly> being included
11198 !! wikitext
11199 {{Includes3}}
11200 !! html
11201 <p>Foo
11202 </p>
11203 !! end
11204
11205 !! test
11206 <includeonly> and <noinclude> on a page
11207 !! wikitext
11208 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11209 !! html
11210 <p>Foozar
11211 </p>
11212 !! end
11213
11214 !! test
11215 Un-closed <noinclude>
11216 !! wikitext
11217 <noinclude>
11218 !! html
11219 !! end
11220
11221 !! test
11222 <onlyinclude> on a page
11223 !! wikitext
11224 <onlyinclude>Foo</onlyinclude>bar
11225 !! html
11226 <p>Foobar
11227 </p>
11228 !! end
11229
11230 !! test
11231 Un-closed <onlyinclude>
11232 !! wikitext
11233 <onlyinclude>
11234 !! html
11235 !! end
11236
11237 !!test
11238 Self-closed noinclude, includeonly, onlyinclude tags
11239 !! wikitext
11240 <noinclude />
11241 <includeonly />
11242 <onlyinclude />
11243 !! html
11244 <p><br />
11245 </p>
11246 !!end
11247
11248 !!test
11249 Unbalanced includeonly and noinclude tags
11250 !! wikitext
11251 {|
11252 |a</noinclude>
11253 |b</noinclude></noinclude>
11254 |c</noinclude></includeonly>
11255 |d</includeonly></includeonly>
11256 |}
11257 !! html
11258 <table>
11259 <tr>
11260 <td>a
11261 </td>
11262 <td>b
11263 </td>
11264 <td>c&lt;/includeonly&gt;
11265 </td>
11266 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
11267 </td></tr></table>
11268
11269 !!end
11270
11271 !! article
11272 Template:Includeonly section
11273 !! text
11274 <includeonly>
11275 ==Includeonly section==
11276 </includeonly>
11277 ==Section T-1==
11278 !!endarticle
11279
11280 !! test
11281 Bug 6563: Edit link generation for section shown by <includeonly>
11282 !! wikitext
11283 {{includeonly section}}
11284 !! html
11285 <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>
11286 <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>
11287
11288 !! end
11289
11290 # Uses same input as the contents of [[Template:Includeonly section]]
11291 !! test
11292 Bug 6563: Section extraction for section shown by <includeonly>
11293 !! options
11294 section=T-2
11295 !! wikitext
11296 <includeonly>
11297 ==Includeonly section==
11298 </includeonly>
11299 ==Section T-2==
11300 !! html
11301 ==Section T-2==
11302 !! end
11303
11304 !! test
11305 Bug 6563: Edit link generation for section suppressed by <includeonly>
11306 !! wikitext
11307 <includeonly>
11308 ==Includeonly section==
11309 </includeonly>
11310 ==Section 1==
11311 !! html
11312 <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>
11313
11314 !! end
11315
11316 !! test
11317 Bug 6563: Section extraction for section suppressed by <includeonly>
11318 !! options
11319 section=1
11320 !! wikitext
11321 <includeonly>
11322 ==Includeonly section==
11323 </includeonly>
11324 ==Section 1==
11325 !! html
11326 ==Section 1==
11327 !! end
11328
11329 !! test
11330 Un-closed <includeonly>
11331 !! wikitext
11332 <includeonly>
11333 !! html/php
11334 !! html/parsoid
11335 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>"}'/>
11336 !! end
11337
11338 ## We used to, but no longer wt2wt this test since the default serializer
11339 ## will normalize the include directives to serialize on their own line.
11340 ## Selser will take care of preserving formatting in scenarios where they
11341 ## intermingled with other wikitext.
11342 !! test
11343 Includes and comments at SOL
11344 !! options
11345 parsoid=wt2html,html2html
11346 !! wikitext
11347 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
11348
11349 <noinclude>
11350 some
11351 </noinclude>* stuff
11352 * here
11353
11354 <includeonly>can have stuff</includeonly>=== here ===
11355
11356 !! html/php
11357 <h2><span class="mw-headline" id="hu">hu</span></h2>
11358 <p>some
11359 </p>
11360 <ul><li> stuff</li>
11361 <li> here</li></ul>
11362 <h3><span class="mw-headline" id="here">here</span></h3>
11363
11364 !! html/parsoid
11365 <!-- 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>
11366
11367 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
11368 <p>some</p>
11369 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
11370 <li> here</li></ul>
11371
11372 <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>
11373
11374 !! end
11375
11376 # TODO: test with DOM fragment reuse!
11377 !! test
11378 Parsoid: DOM fragment reuse
11379 !! options
11380 parsoid=wt2wt,wt2html
11381 !! wikitext
11382 a{{echo|b<table></table>c}}d
11383
11384 a{{echo|b
11385 <table></table>
11386 c}}d
11387
11388 {{echo|a
11389
11390 <table></table>
11391
11392 b}}
11393 !! html
11394 <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>
11395
11396 <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">
11397 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
11398 </span><p about="#mwt2">cd</p>
11399
11400 <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">
11401
11402 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
11403
11404 </span><p about="#mwt3">b</p>
11405 !! end
11406
11407 !! test
11408 Parsoid: Merge double tds (T52603)
11409 !! options
11410 parsoid
11411 !! wikitext
11412 {|
11413 |{{echo|{{!}} foo}}
11414 |}
11415 !! html
11416 <table><tbody>
11417 <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>
11418 </tbody></table>
11419 !! end
11420
11421 !! test
11422 Parsoid: Merge double tds in nested transclusion content (T52603)
11423 !! options
11424 parsoid
11425 !! wikitext
11426 {{echo|<div>}}
11427 {|
11428 |{{echo|{{!}} foo}}
11429 |}
11430 {{echo|</div>}}
11431 !! html
11432 <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}}]}'>
11433 <table><tbody>
11434 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
11435 </tbody></table>
11436 </div>
11437 !! end
11438
11439 ###
11440 ### <includeonly> and <noinclude> in attributes
11441 ###
11442 !!test
11443 0. includeonly around the entire attribute
11444 !! wikitext
11445 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
11446 !! html
11447 <p><span id="v2">bar</span>
11448 </p>
11449 !!end
11450
11451 !!test
11452 1. includeonly in html attr key
11453 !! wikitext
11454 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
11455 !! html
11456 <p><span id="foo">bar</span>
11457 </p>
11458 !!end
11459
11460 !!test
11461 2. includeonly in html attr value
11462 !! wikitext
11463 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
11464 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
11465 !! html
11466 <p><span id="v1">bar</span>
11467 <span id="v1">bar</span>
11468 </p>
11469 !!end
11470
11471 !!test
11472 3. includeonly in part of an attr value
11473 !! wikitext
11474 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
11475 !! html
11476 <p><span style="color:red;">bar</span>
11477 </p>
11478 !!end
11479
11480 !!test
11481 4. includeonly in table attributes
11482 !! wikitext
11483 {|
11484 |- <noinclude>
11485 |-
11486 |a
11487 </noinclude>
11488 |- <includeonly>
11489 |-
11490 |b
11491 </includeonly>
11492 |}
11493 !! html
11494 <table>
11495
11496
11497 <tr>
11498 <td>a
11499 </td></tr>
11500 </table>
11501
11502 !!end
11503
11504 ###
11505 ### Token Stream Patcher tests
11506 ###
11507 ### These tests won't always pass wt2wt and other modes because
11508 ### on serialization, the table will be output on a new line.
11509 ### For now, we are blacklisting them, and using this to test selser.
11510 ###
11511
11512 !!test
11513 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
11514 !!options
11515 parsoid=wt2html,wt2wt
11516 !!wikitext
11517 {{echo|}}{| width = '100%'
11518 |foo
11519 |}
11520 !!html/parsoid
11521 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
11522 <tbody><tr><td>foo</td></tr>
11523 </tbody></table>
11524 !!end
11525
11526 ## We used to, but no longer wt2wt this test since the default serializer
11527 ## will normalize the include directives to serialize on their own line.
11528 ## Selser will take care of preserving formatting in scenarios where they
11529 ## intermingled with other wikitext.
11530 !!test
11531 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
11532 !!options
11533 parsoid=wt2html
11534 !!wikitext
11535 <includeonly>a</includeonly>{| {{{b}}}
11536 |c
11537 |}
11538 !!html/parsoid
11539 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>a&lt;/includeonly>"}'/><meta typeof="mw:Includes/IncludeOnly/End" data-parsoid='{"src":""}'/><table about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"a":{"{{{b}}}":null},"sa":{"{{{b}}}":""}}' data-mw='{"attribs":[[{"txt":"{{{b}}}","html":"&lt;span about=\"#mwt1\" typeof=\"mw:Param\" data-parsoid=&#39;{\"dsr\":[31,38,null,null],\"src\":\"{{{b}}}\"}&#39;>{{{b}}}&lt;/span>"},{"html":""}]]}'>
11540 <tbody><tr><td>c</td></tr>
11541 </tbody></table>
11542 !!end
11543
11544 !! test
11545 Table wikitext syntax outside wiki-tables
11546 !! wikitext
11547 a
11548 |+ not a caption
11549 ! not a table heading
11550 |- not a table row
11551 | not a table cell
11552 | class="foo bar" | baz
11553 b
11554 |}
11555 |-
11556 c
11557 !! html
11558 <p>a
11559 |+ not a caption
11560 ! not a table heading
11561 |- not a table row
11562 | not a table cell
11563 | class="foo bar" | baz
11564 b
11565 |}
11566 |-
11567 c
11568 </p>
11569 !! end
11570
11571 ###
11572 ### Testing parsing of templates where a template arg
11573 ### has the same name as the template itself.
11574 ###
11575
11576 !! article
11577 Template:quote
11578 !! text
11579 {{{quote|{{{1}}}}}}
11580 !! endarticle
11581
11582 !!test
11583 Templates: Template Name/Arg clash: 1. Use of positional param
11584 !! wikitext
11585 {{quote|foo}}
11586 !! html
11587 <p>foo
11588 </p>
11589 !!end
11590
11591 !!test
11592 Templates: Template Name/Arg clash: 2. Use of named param
11593 !! wikitext
11594 {{quote|quote=foo}}
11595 !! html
11596 <p>foo
11597 </p>
11598 !!end
11599
11600 !!test
11601 Templates: Template Name/Arg clash: 3. Use of named param with empty input
11602 !! wikitext
11603 {{quote|quote}}
11604 !! html
11605 <p>quote
11606 </p>
11607 !!end
11608
11609 ###
11610 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
11611 ###
11612
11613 !!test
11614 Templates: 1. Simple use
11615 !! wikitext
11616 {{echo|Foo}}
11617 !! html
11618 <p>Foo
11619 </p>
11620 !!end
11621
11622 !!test
11623 Templates: 2. Inside a block tag
11624 !! wikitext
11625 <div>{{echo|Foo}}</div>
11626 <blockquote>{{echo|Foo}}</blockquote>
11627 !! html
11628 <div>Foo</div>
11629 <blockquote>Foo</blockquote>
11630
11631 !! html+tidy
11632 <div>Foo</div>
11633 <blockquote>
11634 <p>Foo</p>
11635 </blockquote>
11636 !!end
11637
11638 !!test
11639 Templates: P-wrapping: 1a. Templates on consecutive lines
11640 !! wikitext
11641 {{echo|Foo}}
11642 {{echo|bar}}
11643 !! html
11644 <p>Foo
11645 bar
11646 </p>
11647 !!end
11648
11649 !!test
11650 Templates: P-wrapping: 1b. Templates on consecutive lines
11651 !! wikitext
11652 Foo
11653
11654 {{echo|bar}}
11655 {{echo|baz}}
11656 !! html
11657 <p>Foo
11658 </p><p>bar
11659 baz
11660 </p>
11661 !!end
11662
11663 !!test
11664 Templates: P-wrapping: 1c. Templates on consecutive lines
11665 !! wikitext
11666 {{echo|Foo}}
11667 {{echo|bar}} <div>baz</div>
11668 !! html
11669 <p>Foo
11670 </p>
11671 bar <div>baz</div>
11672
11673 !! html+tidy
11674 <p>Foo</p>
11675 <p>bar</p>
11676 <div>baz</div>
11677 !! end
11678
11679 !!test
11680 Templates: P-wrapping: 1d. Template preceded by comment-only line
11681 !!options
11682 parsoid
11683 !! wikitext
11684 <!-- foo -->
11685 {{echo|Bar}}
11686 !! html
11687 <!-- foo -->
11688
11689 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
11690 !!end
11691
11692 !!test
11693 Templates: Inline Text: 1. Multiple template uses
11694 !! wikitext
11695 {{echo|Foo}}bar{{echo|baz}}
11696 !! html
11697 <p>Foobarbaz
11698 </p>
11699 !!end
11700
11701 !!test
11702 Templates: Inline Text: 2. Back-to-back template uses
11703 !! wikitext
11704 {{echo|Foo}}{{echo|bar}}
11705 !! html
11706 <p>Foobar
11707 </p>
11708 !!end
11709
11710 !!test
11711 Templates: Block Tags: 1. Multiple template uses
11712 !! wikitext
11713 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
11714 !! html
11715 <div>Foo</div><div>bar</div><div>baz</div>
11716
11717 !!end
11718
11719 !!test
11720 Templates: Block Tags: 2. Back-to-back template uses
11721 !! wikitext
11722 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
11723 !! html
11724 <div>Foo</div><div>bar</div>
11725
11726 !!end
11727
11728 # This is an edge case relating to paragraph wrapping.
11729 !!test
11730 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
11731 !! wikitext
11732 {{echo|a
11733 b</p>}}
11734 !! html/parsoid
11735 <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
11736 b</p>
11737 !!end
11738
11739 !!test
11740 Templates: Links: 1. Simple example
11741 !! wikitext
11742 {{echo|[[Foo|bar]]}}
11743 !! html
11744 <p><a href="/wiki/Foo" title="Foo">bar</a>
11745 </p>
11746 !!end
11747
11748 !!test
11749 Templates: Links: 2. Generation of link href
11750 !! wikitext
11751 [[{{echo|Foo}}|bar]]
11752 !! html
11753 <p><a href="/wiki/Foo" title="Foo">bar</a>
11754 </p>
11755 !!end
11756
11757 !!test
11758 Templates: Links: 3. Generation of part of a link href
11759 !! wikitext
11760 [[Fo{{echo|o}}|bar]]
11761
11762 [[Foo{{echo|bar}}]]
11763
11764 [[Foo{{echo|bar}}baz]]
11765
11766 [[Foo{{echo|bar}}|bar]]
11767
11768 [[:Foo{{echo|bar}}]]
11769
11770 [[:Foo{{echo|bar}}|bar]]
11771 !! html
11772 <p><a href="/wiki/Foo" title="Foo">bar</a>
11773 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11774 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
11775 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11776 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11777 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11778 </p>
11779 !!end
11780
11781 !!test
11782 Templates: Links: 4. Multiple templates generating link href
11783 !! wikitext
11784 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
11785 !! html
11786 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11787 </p>
11788 !!end
11789
11790 !!test
11791 Templates: Links: 5. Generation of link text
11792 !! wikitext
11793 [[Foo|{{echo|bar}}]]
11794 !! html
11795 <p><a href="/wiki/Foo" title="Foo">bar</a>
11796 </p>
11797 !!end
11798
11799 !!test
11800 Templates: Links: 5. Nested templates (only outermost template should be marked)
11801 !! wikitext
11802 {{echo|[[{{echo|Foo}}|bar]]}}
11803 !! html
11804 <p><a href="/wiki/Foo" title="Foo">bar</a>
11805 </p>
11806 !!end
11807
11808 !!test
11809 Templates: HTML Tag: 1. Generation of HTML attr. key
11810 !! wikitext
11811 <div {{echo|style}}="color:red;">foo</div>
11812 !! html
11813 <div style="color:red;">foo</div>
11814
11815 !!end
11816
11817 !!test
11818 Templates: HTML Tag: 2. Generation of HTML attr. value
11819 !! wikitext
11820 <div style={{echo|'color:red;'}}>foo</div>
11821 !! html
11822 <div style="color:red;">foo</div>
11823
11824 !!end
11825
11826 !!test
11827 Templates: HTML Tag: 3. Generation of HTML attr key and value
11828 !! wikitext
11829 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
11830 !! html
11831 <div style="color:red;">foo</div>
11832
11833 !!end
11834
11835 !!test
11836 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
11837 !! wikitext
11838 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
11839 !! html
11840 <div title="This is a long title with just one piece templated">foo</div>
11841
11842 !!end
11843
11844 !!test
11845 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
11846 !! wikitext
11847 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
11848 !! html
11849 <div title="This is a long title with just one piece templated">foo</div>
11850
11851 !!end
11852
11853 !!test
11854 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
11855 !! wikitext
11856 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
11857 !! html
11858 <div title="This is a long title with just one piece templated">foo</div>
11859
11860 !!end
11861
11862 # SSS FIXME: While it is great we added support for all this,
11863 # do we want to make this part of the spec? Maybe we want to
11864 # deprecate this kind of usage in the future?
11865 !!test
11866 Templates: HTML Tag: 7. Generation of partial attribute key string
11867 !! wikitext
11868 <div st{{echo|yle}}="color:red;">foo</div>
11869 !! html
11870 <div style="color:red;">foo</div>
11871
11872 !!end
11873
11874 !! test
11875 Templates: HTML Tag: 8. Template-generated attribute (k=v)
11876 !! wikitext
11877 <div {{echo|1=id="v1"}}>bar</div>
11878 !! html
11879 <div id="v1">bar</div>
11880
11881 !!end
11882
11883 !! test
11884 Templates: HTML Tag: 9. Multiple template-generated attributes
11885 !! wikitext
11886 <div {{echo|1=id="v1" title="foo"}}>bar</div>
11887 !! html
11888 <div id="v1" title="foo">bar</div>
11889
11890 !!end
11891
11892 !! test
11893 Templates: Support for templates generating attributes and content
11894 !! wikitext
11895 {| {{mixed_attr_content_template}}
11896 |-
11897 |bar
11898 |}
11899 !! html/php
11900 <table style="color:red;" title="T48811">
11901
11902 <tr>
11903 <td>foo
11904 </td></tr>
11905 <tr>
11906 <td>bar
11907 </td></tr></table>
11908
11909 !! html/parsoid
11910 <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|}"]}'>
11911 <tbody><tr>
11912 <td>foo</td></tr>
11913 <tr>
11914 <td>bar</td></tr>
11915 </tbody></table>
11916 !!end
11917
11918 !! test
11919 1. Entities and nowikis inside templated attributes should be handled correctly
11920 !! wikitext
11921 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
11922 !! html/php
11923 <div style="background:#f9f9f9;">foo</div>
11924
11925 !! html/parsoid
11926 <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=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[5,49,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"style{{=}}\\\"background:&amp;amp;#35;f9f9f9;\\\"\"}},\"i\":0}}]}&#39;>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=&#39;{\"src\":\"&amp;amp;#35;\",\"srcContent\":\"#\"}&#39;>#&lt;/span>&lt;span about=\"#mwt1\" data-parsoid=\"{}\">f9f9f9;\"&lt;/span>"},{"html":""}]]}'>foo</div>
11927 !! end
11928
11929 !! test
11930 2. Entities and nowikis inside templated attributes should be handled correctly
11931 !! wikitext
11932 {|
11933 |{{table_attribs_3}}
11934 |}
11935 !! html/php
11936 <table>
11937 <tr>
11938 <td style="background:#f9f9f9;">Foo
11939 </td></tr></table>
11940
11941 !! html/parsoid
11942 <table>
11943 <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>
11944 </tbody></table>
11945 !! end
11946
11947 !! test
11948 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11949 !! wikitext
11950 {{tbl-start}}
11951 |{{table_attribs_3}}
11952 {{tbl-end}}
11953 !! html/php
11954 <table>
11955 <tr>
11956 <td style="background:#f9f9f9;">Foo
11957 </td></tr></table>
11958
11959 !! html/parsoid
11960 <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}}]}'>
11961 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
11962 </tbody></table>
11963 !! end
11964
11965 # T107622
11966 !! test
11967 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11968 !! wikitext
11969 {|
11970 | {{table_attribs_6}} hi
11971 |}
11972 !! html/php
11973 <table>
11974 <tr>
11975 <td style="background: red;"> hi
11976 </td></tr></table>
11977
11978 !! html/parsoid
11979 <table>
11980 <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>
11981 </tbody></table>
11982 !! end
11983
11984 !!test
11985 Templates: HTML Tables: 1. Generating start of a HTML table
11986 !! wikitext
11987 {{echo|<table><tr><td>foo</td>}}</tr></table>
11988 !! html
11989 <table><tr><td>foo</td></tr></table>
11990
11991 !!end
11992
11993 !!test
11994 Templates: HTML Tables: 2a. Generating middle of a HTML table
11995 !! wikitext
11996 <table><tr>{{echo|<td>foo</td>}}</tr></table>
11997 !! html
11998 <table><tr><td>foo</td></tr></table>
11999
12000 !!end
12001
12002 !!test
12003 Templates: HTML Tables: 2b. Generating middle of a HTML table
12004 !! wikitext
12005 <table>{{echo|<tr><td>foo</td></tr>}}</table>
12006 !! html
12007 <table><tr><td>foo</td></tr></table>
12008
12009 !!end
12010
12011 !!test
12012 Templates: HTML Tables: 3. Generating end of a HTML table
12013 !! wikitext
12014 <table><tr>{{echo|<td>foo</td></tr></table>}}
12015 !! html
12016 <table><tr><td>foo</td></tr></table>
12017
12018 !!end
12019
12020 !!test
12021 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
12022 !! wikitext
12023 {{echo|<table>}}<tr><td>foo</td></tr></table>
12024 !! html
12025 <table><tr><td>foo</td></tr></table>
12026
12027 !!end
12028
12029 !!test
12030 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
12031 !! wikitext
12032 <table>{{echo|<tr>}}<td>foo</td></tr></table>
12033 !! html
12034 <table><tr><td>foo</td></tr></table>
12035
12036 !!end
12037
12038 !!test
12039 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
12040 !! wikitext
12041 <table><tr>{{echo|<td>}}foo</td></tr></table>
12042 !! html
12043 <table><tr><td>foo</td></tr></table>
12044
12045 !!end
12046
12047 !!test
12048 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
12049 !! wikitext
12050 <table><tr><td>foo{{echo|</td>}}</tr></table>
12051 !! html
12052 <table><tr><td>foo</td></tr></table>
12053
12054 !!end
12055
12056 !!test
12057 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
12058 !! wikitext
12059 <table><tr><td>foo</td>{{echo|</tr>}}</table>
12060 !! html
12061 <table><tr><td>foo</td></tr></table>
12062
12063 !!end
12064
12065 !!test
12066 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
12067 !! wikitext
12068 <table><tr><td>foo</td></tr>{{echo|</table>}}
12069 !! html
12070 <table><tr><td>foo</td></tr></table>
12071
12072 !!end
12073
12074 !!test
12075 Templates: HTML Tables: 5. Proper fostering of categories from inside
12076 !!options
12077 parsoid=wt2html,wt2wt
12078 !! wikitext
12079 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
12080 <!--Two categories (Bug 50330)-->
12081 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
12082 !! html
12083 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
12084 <!--Two categories (Bug 50330)-->
12085 <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>
12086 !!end
12087
12088 !!test
12089 Templates: Wiki Tables: 1a. Fostering of entire template content
12090 !! wikitext
12091 {|
12092 {{echo|a}}
12093 |}
12094 !! html
12095 <table>
12096 a
12097 <tr><td></td></tr></table>
12098
12099 !! html+tidy
12100 <p>a</p>
12101 <table>
12102 <tr>
12103 <td></td>
12104 </tr>
12105 </table>
12106 !! end
12107
12108 !!test
12109 Templates: Wiki Tables: 1b. Fostering of entire template content
12110 !! wikitext
12111 {|
12112 {{echo|<div>}}
12113 foo
12114 {{echo|</div>}}
12115 |}
12116 !! html
12117 <table>
12118 <div>
12119 <p>foo
12120 </p>
12121 </div>
12122 <tr><td></td></tr></table>
12123
12124 !! html+tidy
12125 <div>
12126 <p>foo</p>
12127 </div>
12128 <table>
12129 <tr>
12130 <td></td>
12131 </tr>
12132 </table>
12133 !! end
12134
12135 !!test
12136 Templates: Wiki Tables: 2. Fostering of partial template content
12137 !! wikitext
12138 {|
12139 {{echo|a
12140 <div>b</div>}}
12141 |}
12142 !! html
12143 <table>
12144 a
12145 <div>b</div>
12146 <tr><td></td></tr></table>
12147
12148 !! html+tidy
12149 <p>a</p>
12150 <div>b</div>
12151 <table>
12152 <tr>
12153 <td></td>
12154 </tr>
12155 </table>
12156 !! end
12157
12158 !!test
12159 Templates: Wiki Tables: 3. td-content via multiple templates
12160 !! wikitext
12161 {|
12162 {{echo|{{pipe}}a}}{{echo|b}}
12163 |}
12164 !! html
12165 <table>
12166 <tr>
12167 <td>ab
12168 </td></tr></table>
12169
12170 !!end
12171
12172 !!test
12173 Templates: Wiki Tables: 4. Templated tags, no content
12174 !! wikitext
12175 {{tbl-start}}
12176 {{tbl-end}}
12177 !! html
12178 <table>
12179 <tr><td></td></tr></table>
12180
12181 !!end
12182
12183 !!test
12184 Templates: Wiki Tables: 5. Templated tags, regular td-tags
12185 !! wikitext
12186 {{tbl-start}}
12187 |foo
12188 {{tbl-end}}
12189 !! html
12190 <table>
12191 <tr>
12192 <td>foo
12193 </td></tr></table>
12194
12195 !!end
12196
12197 !!test
12198 Templates: Wiki Tables: 6. Templated tags, templated td-tags
12199 !! wikitext
12200 {{tbl-start}}
12201 {{!}}foo
12202 {{tbl-end}}
12203 !! html
12204 <table>
12205 <tr>
12206 <td>foo
12207 </td></tr></table>
12208
12209 !!end
12210
12211 ## This test case is very specific to Parsoid's internals
12212 ## and is hence only tested for Parsoid's code. Parsoid uses
12213 ## a <meta> marker tag for <ref> tags and they are expanded
12214 ## much later. We are verifying that this <meta> tag usage
12215 ## doesn't prevent foster parenting.
12216 !!test
12217 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
12218 !!wikitext
12219 {{PartialTable}}<ref>foo</ref>
12220 |}
12221
12222 <references />
12223 !!html/parsoid
12224 <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">
12225 <tbody>
12226 </tbody></table>
12227
12228 <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>
12229 !!end
12230
12231 !! test
12232 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
12233 !! wikitext
12234 {{echo|
12235 {{{!}}
12236 {{!}}-}}
12237 <onlyinclude>
12238 |foo
12239 </onlyinclude>
12240 {{!}}}
12241 !! html/parsoid
12242 <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{{!}}}"]}'>
12243 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
12244 <tbody><tr>
12245
12246 <td>foo
12247 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
12248 </tbody></table>
12249 !! end
12250
12251 !!test
12252 Templates: Lists: Multi-line list-items via templates
12253 !! wikitext
12254 *{{echo|a {{nonexistent|
12255 unused}}}}
12256 *{{echo|b {{nonexistent|
12257 unused}}}}
12258 !! html
12259 <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>
12260 <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>
12261
12262 !!end
12263
12264 !!test
12265 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
12266 !! wikitext
12267 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
12268 !! html
12269 <p><i>ab</i>c<i>d</i>e
12270 </p>
12271 !!end
12272
12273 !!test
12274 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
12275 (PHP parser generates misnested html)
12276 !! wikitext
12277 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
12278 !! html/parsoid
12279 <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>
12280 !!end
12281
12282 !!test
12283 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
12284 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
12285 !! options
12286 parsoid=wt2html,wt2wt
12287 !! wikitext
12288 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
12289 !! html
12290 <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>
12291 <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>
12292 <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>
12293 !!end
12294
12295 !!test
12296 Templates: Ugly nesting: 4. Divs opened/closed across templates
12297 !! wikitext
12298 a<div>b{{echo|c</div>d}}e
12299 !! html
12300 a<div>bc</div>de
12301
12302 !! html+tidy
12303 <p>a</p>
12304 <div>bc</div>
12305 <p>de</p>
12306 !! end
12307
12308 !!test
12309 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
12310 (Parsoid-centric)
12311 !! options
12312 parsoid
12313 !! wikitext
12314 {|
12315 |{{echo|foo</table>}}
12316 |bar
12317 |}
12318 !! html
12319 <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|}"]}'>
12320
12321 <tbody>
12322 <tr>
12323 <td>foo</td></tr></tbody></table><span about="#mwt1">
12324 </span><span about="#mwt1">|bar</span><span about="#mwt1">
12325 |}</span>
12326 !!end
12327
12328 !!test
12329 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
12330 (Parsoid-centric)
12331 !! options
12332 parsoid
12333 !! wikitext
12334 <table>
12335 <tr>
12336 <td>
12337 <table>
12338 <tr>
12339 <td>1. {{echo|foo </table>}}</td>
12340 <td> bar </td>
12341 <td>2. {{echo|baz </table>}}</td>
12342 </tr>
12343 <tr>
12344 <td>abc</td>
12345 </tr>
12346 </table>
12347 </td>
12348 </tr>
12349 <tr>
12350 <td>xyz</td>
12351 </tr>
12352 </table>
12353 !! html
12354 <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>"]}'>
12355 <tbody><tr>
12356 <td>
12357 <table>
12358 <tbody><tr>
12359 <td>1. foo </td></tr></tbody></table></td>
12360 <td> bar </td>
12361 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
12362 </span><span about="#mwt2">
12363 </span><span about="#mwt2">
12364 </span><span about="#mwt2">abc</span><span about="#mwt2">
12365 </span><span about="#mwt2">
12366 </span><span about="#mwt2">
12367 </span><span about="#mwt2">
12368 </span><span about="#mwt2">
12369 </span><span about="#mwt2">
12370 </span><span about="#mwt2">xyz</span><span about="#mwt2">
12371 </span><span about="#mwt2">
12372 </span>
12373 !!end
12374
12375 !! test
12376 Templates: Ugly templates: 3. newline-only template parameter
12377 !! wikitext
12378 foo {{echo|
12379 }}
12380 !! html
12381 <p>foo
12382 </p>
12383 !! end
12384
12385 # This looks like a bug: a single newline triggers p/br for some reason.
12386 !! test
12387 Templates: Ugly templates: 4. newline-only template parameter inconsistency
12388 !! wikitext
12389 {{echo|
12390 }}
12391 !! html
12392 <p><br />
12393 </p>
12394 !! end
12395
12396 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
12397 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
12398 !! test
12399 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
12400 !! wikitext
12401 {{echo|<table>}}
12402 {{echo|<div>foo}}
12403 {{echo|</table>}}
12404 !! html/parsoid
12405 <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
12406 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12407 </table>
12408 !! end
12409
12410 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
12411 # that are "identical" and generate nesting cycles in the algorithm
12412 !! test
12413 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
12414 !! wikitext
12415 {{echo|<table><tr><td><table>}}
12416 {{echo|<div>}}
12417 {{echo|</div>}}
12418 !! html/parsoid
12419 <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"}'>
12420 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12421 </table></td></tr></tbody></table>
12422 !! end
12423
12424 !! test
12425 Templates: Parameters substituted at the top-level
12426 !! wikitext
12427 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
12428 !! html/php
12429 <p><i>who</i> me? <b>never!</b>
12430 </p>
12431 !! html/parsoid
12432 <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>
12433 !! end
12434
12435 !!test
12436 Parser Functions: 1. Simple example
12437 !! wikitext
12438 {{uc:foo}}
12439 !! html
12440 <p>FOO
12441 </p>
12442 !!end
12443
12444 !!test
12445 Parser Functions: 2. Nested use (only outermost should be marked up)
12446 !! wikitext
12447 {{uc:{{lc:FOO}}}}
12448 !! html
12449 <p>FOO
12450 </p>
12451 !!end
12452
12453 ###
12454 ### Pre-save transform tests
12455 ###
12456 !! test
12457 pre-save transform: subst:
12458 !! options
12459 pst
12460 !! wikitext
12461 {{subst:test}}
12462 !! html/php
12463 This is a test template
12464 !! end
12465
12466 !! test
12467 pre-save transform: normal template
12468 !! options
12469 pst
12470 !! wikitext
12471 {{test}}
12472 !! html/php
12473 {{test}}
12474 !! end
12475
12476 !! test
12477 pre-save transform: nonexistent template
12478 !! options
12479 pst
12480 !! wikitext
12481 {{thistemplatedoesnotexist}}
12482 !! html/php
12483 {{thistemplatedoesnotexist}}
12484 !! end
12485
12486 !! test
12487 pre-save transform: subst magic variables
12488 !! options
12489 pst
12490 !! wikitext
12491 {{subst:SITENAME}}
12492 !! html/php
12493 MediaWiki
12494 !! end
12495
12496 # This is bug 89, which I fixed. -- wtm
12497 !! test
12498 pre-save transform: subst: templates with parameters
12499 !! options
12500 pst
12501 !! wikitext
12502 {{subst:paramtest|param="something else"}}
12503 !! html/php
12504 This is a test template with parameter "something else"
12505 !! end
12506
12507 !! article
12508 Template:nowikitest
12509 !! text
12510 <nowiki>'''not wiki'''</nowiki>
12511 !! endarticle
12512
12513 !! test
12514 pre-save transform: nowiki in subst (bug 1188)
12515 !! options
12516 pst
12517 !! wikitext
12518 {{subst:nowikitest}}
12519 !! html/php
12520 <nowiki>'''not wiki'''</nowiki>
12521 !! end
12522
12523 !! article
12524 Template:commenttest
12525 !! text
12526 This template has <!-- a comment --> in it.
12527 !! endarticle
12528
12529 !! test
12530 pre-save transform: comment in subst (bug 1936)
12531 !! options
12532 pst
12533 !! wikitext
12534 {{subst:commenttest}}
12535 !! html/php
12536 This template has <!-- a comment --> in it.
12537 !! end
12538
12539 !! test
12540 pre-save transform: unclosed tag
12541 !! options
12542 pst
12543 !! wikitext
12544 <nowiki>'''not wiki'''
12545 !! html/php
12546 <nowiki>'''not wiki'''
12547 !! end
12548
12549 !! test
12550 pre-save transform: mixed tag case
12551 !! options
12552 pst
12553 !! wikitext
12554 <NOwiki>'''not wiki'''</noWIKI>
12555 !! html/php
12556 <NOwiki>'''not wiki'''</noWIKI>
12557 !! end
12558
12559 !! test
12560 pre-save transform: unclosed comment in <nowiki>
12561 !! options
12562 pst
12563 !! wikitext
12564 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12565 !! html/php
12566 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12567 !!end
12568
12569 # Leading @ in this template definition works around a limitation
12570 # in parsoid's parserTests which otherwise strips the <span> from the
12571 # result (confusing it for a template wrapper)
12572 !! article
12573 Template:dangerous
12574 !!text
12575 @<span onmouseover="alert('crap')">Oh no</span>
12576 !!endarticle
12577
12578 !!test
12579 (confirming safety of fix for subst bug 1936)
12580 !! wikitext
12581 {{Template:dangerous}}
12582 !! html
12583 <p>@<span>Oh no</span>
12584 </p>
12585 !! end
12586
12587 !! test
12588 pre-save transform: comment containing gallery (bug 5024)
12589 !! options
12590 pst
12591 !! wikitext
12592 <!-- <gallery>data</gallery> -->
12593 !! html/php
12594 <!-- <gallery>data</gallery> -->
12595 !!end
12596
12597 !! test
12598 pre-save transform: comment containing extension
12599 !! options
12600 pst
12601 !! wikitext
12602 <!-- <tag>data</tag> -->
12603 !! html/php
12604 <!-- <tag>data</tag> -->
12605 !!end
12606
12607 !! test
12608 pre-save transform: comment containing nowiki
12609 !! options
12610 pst
12611 !! wikitext
12612 <!-- <nowiki>data</nowiki> -->
12613 !! html/php
12614 <!-- <nowiki>data</nowiki> -->
12615 !!end
12616
12617 !! test
12618 pre-save transform: <noinclude> in subst (bug 3298)
12619 !! options
12620 pst
12621 !! wikitext
12622 {{subst:Includes}}
12623 !! html/php
12624 Foobar
12625 !! end
12626
12627 !! test
12628 pre-save transform: <onlyinclude> in subst (bug 3298)
12629 !! options
12630 pst
12631 !! wikitext
12632 {{subst:Includes2}}
12633 !! html/php
12634 Foo
12635 !! end
12636
12637 !! article
12638 Template:SubstTest
12639 !!text
12640 {{<includeonly>subst:</includeonly>Includes}}
12641 !! endarticle
12642
12643 !! article
12644 Template:SafeSubstTest
12645 !! text
12646 {{<includeonly>safesubst:</includeonly>Includes}}
12647 !! endarticle
12648
12649 !! test
12650 bug 22297: safesubst: works during PST
12651 !! options
12652 pst
12653 !! wikitext
12654 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
12655 !! html/php
12656 FoobarFoobar
12657 !! end
12658
12659 !! test
12660 bug 22297: safesubst: works during normal parse
12661 !! wikitext
12662 {{SafeSubstTest}}
12663 !! html
12664 <p>Foobar
12665 </p>
12666 !! end
12667
12668 !! test
12669 subst: does not work during normal parse
12670 !! wikitext
12671 {{SubstTest}}
12672 !! html
12673 <p>{{subst:Includes}}
12674 </p>
12675 !! end
12676
12677 !! test
12678 pre-save transform: context links ("pipe trick")
12679 !! options
12680 pst
12681 !! wikitext
12682 [[Article (context)|]]
12683 [[Bar:Article|]]
12684 [[:Bar:Article|]]
12685 [[Bar:Article (context)|]]
12686 [[:Bar:Article (context)|]]
12687 [[|Article]]
12688 [[|Article (context)]]
12689 [[Bar:X (Y) Z|]]
12690 [[:Bar:X (Y) Z|]]
12691 !! html/php
12692 [[Article (context)|Article]]
12693 [[Bar:Article|Article]]
12694 [[:Bar:Article|Article]]
12695 [[Bar:Article (context)|Article]]
12696 [[:Bar:Article (context)|Article]]
12697 [[Article]]
12698 [[Article (context)]]
12699 [[Bar:X (Y) Z|X (Y) Z]]
12700 [[:Bar:X (Y) Z|X (Y) Z]]
12701 !! end
12702
12703 !! test
12704 pre-save transform: context links ("pipe trick") with interwiki prefix
12705 !! options
12706 pst
12707 !! wikitext
12708 [[interwiki:Article|]]
12709 [[:interwiki:Article|]]
12710 [[interwiki:Bar:Article|]]
12711 [[:interwiki:Bar:Article|]]
12712 !! html/php
12713 [[interwiki:Article|Article]]
12714 [[:interwiki:Article|Article]]
12715 [[interwiki:Bar:Article|Bar:Article]]
12716 [[:interwiki:Bar:Article|Bar:Article]]
12717 !! end
12718
12719 !! test
12720 pre-save transform: context links ("pipe trick") with parens in title
12721 !! options
12722 pst title=[[Somearticle (context)]]
12723 !! wikitext
12724 [[|Article]]
12725 !! html/php
12726 [[Article (context)|Article]]
12727 !! end
12728
12729 !! test
12730 pre-save transform: context links ("pipe trick") with comma in title
12731 !! options
12732 pst title=[[Someplace, Somewhere]]
12733 !! wikitext
12734 [[|Otherplace]]
12735 [[Otherplace, Elsewhere|]]
12736 [[Otherplace, Elsewhere, Anywhere|]]
12737 !! html/php
12738 [[Otherplace, Somewhere|Otherplace]]
12739 [[Otherplace, Elsewhere|Otherplace]]
12740 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
12741 !! end
12742
12743 !! test
12744 pre-save transform: context links ("pipe trick") with parens and comma
12745 !! options
12746 pst title=[[Someplace (IGNORED), Somewhere]]
12747 !! wikitext
12748 [[|Otherplace]]
12749 [[Otherplace (place), Elsewhere|]]
12750 !! html/php
12751 [[Otherplace, Somewhere|Otherplace]]
12752 [[Otherplace (place), Elsewhere|Otherplace]]
12753 !! end
12754
12755 !! test
12756 pre-save transform: context links ("pipe trick") with comma and parens
12757 !! options
12758 pst title=[[Who, me? (context)]]
12759 !! wikitext
12760 [[|Yes, you.]]
12761 [[Me, Myself, and I (1937 song)|]]
12762 !! html/php
12763 [[Yes, you. (context)|Yes, you.]]
12764 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
12765 !! end
12766
12767 !! test
12768 pre-save transform: context links ("pipe trick") with namespace
12769 !! options
12770 pst title=[[Ns:Somearticle]]
12771 !! wikitext
12772 [[|Article]]
12773 !! html/php
12774 [[Ns:Article|Article]]
12775 !! end
12776
12777 !! test
12778 pre-save transform: context links ("pipe trick") with namespace and parens
12779 !! options
12780 pst title=[[Ns:Somearticle (context)]]
12781 !! wikitext
12782 [[|Article]]
12783 !! html/php
12784 [[Ns:Article (context)|Article]]
12785 !! end
12786
12787 !! test
12788 pre-save transform: context links ("pipe trick") with namespace and comma
12789 !! options
12790 pst title=[[Ns:Somearticle, Context, Whatever]]
12791 !! wikitext
12792 [[|Article]]
12793 !! html/php
12794 [[Ns:Article, Context, Whatever|Article]]
12795 !! end
12796
12797 !! test
12798 pre-save transform: context links ("pipe trick") with namespace, comma and parens
12799 !! options
12800 pst title=[[Ns:Somearticle, Context (context)]]
12801 !! wikitext
12802 [[|Article]]
12803 !! html/php
12804 [[Ns:Article (context)|Article]]
12805 !! end
12806
12807 !! test
12808 pre-save transform: context links ("pipe trick") with namespace, parens and comma
12809 !! options
12810 pst title=[[Ns:Somearticle (IGNORED), Context]]
12811 !! wikitext
12812 [[|Article]]
12813 !! html/php
12814 [[Ns:Article, Context|Article]]
12815 !! end
12816
12817 !! test
12818 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
12819 !! options
12820 pst
12821 !! wikitext
12822 [[Article(context)|]]
12823 [[Bar:Article(context)|]]
12824 [[:Bar:Article(context)|]]
12825 [[|Article(context)]]
12826 [[Bar:X(Y)Z|]]
12827 [[:Bar:X(Y)Z|]]
12828 !! html/php
12829 [[Article(context)|Article]]
12830 [[Bar:Article(context)|Article]]
12831 [[:Bar:Article(context)|Article]]
12832 [[Article(context)]]
12833 [[Bar:X(Y)Z|X(Y)Z]]
12834 [[:Bar:X(Y)Z|X(Y)Z]]
12835 !! end
12836
12837 !! test
12838 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
12839 !! options
12840 pst
12841 !! wikitext
12842 [[Article (context)|]]
12843 [[Bar:Article (context)|]]
12844 [[:Bar:Article (context)|]]
12845 [[|Article (context)]]
12846 [[Bar:X (Y) Z|]]
12847 [[:Bar:X (Y) Z|]]
12848 !! html/php
12849 [[Article (context)|Article]]
12850 [[Bar:Article (context)|Article]]
12851 [[:Bar:Article (context)|Article]]
12852 [[Article (context)]]
12853 [[Bar:X (Y) Z|X (Y) Z]]
12854 [[:Bar:X (Y) Z|X (Y) Z]]
12855 !! end
12856
12857 !! test
12858 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
12859 !! options
12860 pst
12861 !! wikitext
12862 [[Article(context)|]]
12863 [[Bar:Article(context)|]]
12864 [[:Bar:Article(context)|]]
12865 [[|Article(context)]]
12866 [[Bar:X(Y)Z|]]
12867 [[:Bar:X(Y)Z|]]
12868 !! html/php
12869 [[Article(context)|Article]]
12870 [[Bar:Article(context)|Article]]
12871 [[:Bar:Article(context)|Article]]
12872 [[Article(context)]]
12873 [[Bar:X(Y)Z|X(Y)Z]]
12874 [[:Bar:X(Y)Z|X(Y)Z]]
12875 !! end
12876
12877 !! test
12878 pre-save transform: context links ("pipe trick") with commas (bug 21660)
12879 !! options
12880 pst
12881 !! wikitext
12882 [[Article (context), context|]]
12883 [[Article (context),context|]]
12884 [[Bar:Article (context), context|]]
12885 [[Bar:Article (context),context|]]
12886 [[:Bar:Article (context), context|]]
12887 [[:Bar:Article (context),context|]]
12888 !! html/php
12889 [[Article (context), context|Article]]
12890 [[Article (context),context|Article]]
12891 [[Bar:Article (context), context|Article]]
12892 [[Bar:Article (context),context|Article]]
12893 [[:Bar:Article (context), context|Article]]
12894 [[:Bar:Article (context),context|Article]]
12895 !! end
12896
12897 !! test
12898 pre-save transform: trim trailing empty lines
12899 !! options
12900 pst
12901 !! wikitext
12902 Empty lines are trimmed
12903
12904
12905
12906
12907 !! html/php
12908 Empty lines are trimmed
12909 !! end
12910
12911 !! test
12912 pre-save transform: Signature expansion
12913 !! options
12914 pst
12915 !! wikitext
12916 * ~~~
12917 * <noinclude>~~~</noinclude>
12918 * <includeonly>~~~</includeonly>
12919 * <onlyinclude>~~~</onlyinclude>
12920 !! html/php
12921 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
12922 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
12923 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
12924 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
12925 !! end
12926
12927
12928 !! test
12929 pre-save transform: Signature expansion in nowiki tags (bug 93)
12930 !! options
12931 pst disabled
12932 !! wikitext
12933 Shall not expand:
12934
12935 <nowiki>~~~~</nowiki>
12936
12937 <includeonly><nowiki>~~~~</nowiki></includeonly>
12938
12939 <noinclude><nowiki>~~~~</nowiki></noinclude>
12940
12941 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12942
12943 {{subst:Foo}} shall be converted to FOO
12944
12945 As well as inside noinclude/onlyinclude
12946 <noinclude>{{subst:Foo}}</noinclude>
12947 <onlyinclude>{{subst:Foo}}</onlyinclude>
12948
12949 But not inside includeonly
12950 <includeonly>{{subst:Foo}}</includeonly>
12951 !! html/php
12952 Shall not expand:
12953
12954 <nowiki>~~~~</nowiki>
12955
12956 <includeonly><nowiki>~~~~</nowiki></includeonly>
12957
12958 <noinclude><nowiki>~~~~</nowiki></noinclude>
12959
12960 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12961
12962 FOO shall be converted to FOO
12963
12964 As well as inside noinclude/onlyinclude
12965 <noinclude>FOO</noinclude>
12966 <onlyinclude>FOO</onlyinclude>
12967
12968 But not inside includeonly
12969 <includeonly>{{subst:Foo}}</includeonly>
12970 !! end
12971
12972 !! test
12973 Parsoid: Recognize nowiki with trailing space in tags
12974 !! options
12975 parsoid=wt2html
12976 !! wikitext
12977 <nowiki ><div>[[foo]]</nowiki >
12978
12979 a<nowiki / >b
12980
12981 c<nowiki />d
12982
12983 e<nowiki/ >f
12984 !! html
12985 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12986 <p>ab</p>
12987 <p>cd</p>
12988 <p>ef</p>
12989 !! end
12990
12991 !! test
12992 Parsoid: Recognize nowiki with odd capitalization
12993 !! options
12994 parsoid=wt2html
12995 !! wikitext
12996 <noWikI ><div>[[foo]]</Nowiki >
12997 !! html
12998 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12999 !! end
13000
13001
13002 !! test
13003 Parsoid: Escape nowiki with trailing space in tags
13004 !! options
13005 parsoid=html2wt
13006 !! html/parsoid
13007 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
13008 <p>a&lt;nowiki /&gt;b</p>
13009 <p>c&lt;nowiki/ &gt;d</p>
13010 !! wikitext
13011 &lt;nowiki &gt; foo &lt;/nowiki &gt;
13012
13013 a&lt;nowiki /&gt;b
13014
13015 c&lt;nowiki/ &gt;d
13016 !! end
13017
13018 !! test
13019 Parsoid: Escape weird noWikI capitalizations
13020 !! options
13021 parsoid=html2wt
13022 !! html/parsoid
13023 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
13024 !! wikitext
13025 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
13026 !! end
13027
13028 ###
13029 ### Message transform tests
13030 ###
13031 !! test
13032 message transform: magic variables
13033 !! options
13034 msg
13035 !! wikitext
13036 {{SITENAME}}
13037 !! html
13038 MediaWiki
13039 !! end
13040
13041 !! test
13042 message transform: should not transform wiki markup
13043 !! options
13044 msg
13045 !! wikitext
13046 ''test''
13047 !! html
13048 ''test''
13049 !! end
13050
13051 !! test
13052 message transform: <noinclude> in transcluded template (bug 4926)
13053 !! options
13054 msg
13055 !! wikitext
13056 {{Includes}}
13057 !! html
13058 Foobar
13059 !! end
13060
13061 !! test
13062 message transform: <onlyinclude> in transcluded template (bug 4926)
13063 !! options
13064 msg
13065 !! wikitext
13066 {{Includes2}}
13067 !! html
13068 Foo
13069 !! end
13070
13071 !! test
13072 {{#special:}} page name, known
13073 !! options
13074 msg
13075 !! wikitext
13076 {{#special:Recentchanges}}
13077 !! html
13078 Special:RecentChanges
13079 !! end
13080
13081 !! test
13082 {{#special:}} page name with subpage, known
13083 !! options
13084 msg
13085 !! wikitext
13086 {{#special:Recentchanges/param}}
13087 !! html
13088 Special:RecentChanges/param
13089 !! end
13090
13091 !! test
13092 {{#special:}} page name, unknown
13093 !! options
13094 msg
13095 !! wikitext
13096 {{#special:foobar nonexistent}}
13097 !! html
13098 Special:Foobar nonexistent
13099 !! end
13100
13101 !! test
13102 {{#speciale:}} page name, known
13103 !! options
13104 msg
13105 !! wikitext
13106 {{#speciale:Recentchanges}}
13107 !! html
13108 Special:RecentChanges
13109 !! end
13110
13111 !! test
13112 {{#speciale:}} page name with subpage, known
13113 !! options
13114 msg
13115 !! wikitext
13116 {{#speciale:Recentchanges/param}}
13117 !! html
13118 Special:RecentChanges/param
13119 !! end
13120
13121 !! test
13122 {{#speciale:}} page name, unknown
13123 !! options
13124 msg
13125 !! wikitext
13126 {{#speciale:foobar nonexistent}}
13127 !! html
13128 Special:Foobar_nonexistent
13129 !! end
13130
13131 ###
13132 ### Images
13133 ###
13134 ### For Parsoid-specific tests, see
13135 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
13136
13137 !! test
13138 Simple image
13139 !! options
13140 parsoid=wt2html,wt2wt,html2html
13141 !! wikitext
13142 [[Image:foobar.jpg]]
13143 !! html/php
13144 <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>
13145 </p>
13146 !! html/parsoid
13147 <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>
13148 !! end
13149
13150 !! test
13151 Simple image (using File: namespace, now canonical)
13152 !! wikitext
13153 [[File:Foobar.jpg]]
13154 !! html/php
13155 <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>
13156 </p>
13157 !! html/parsoid
13158 <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>
13159 !! end
13160
13161 !! test
13162 Right-aligned image
13163 !! wikitext
13164 [[File:Foobar.jpg|right]]
13165 !! html/php
13166 <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>
13167
13168 !! html/parsoid
13169 <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>
13170 !! end
13171
13172 !! test
13173 Image with caption
13174 !! wikitext
13175 [[File:Foobar.jpg|right|Caption text]]
13176 !! html/php
13177 <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>
13178
13179 !! html/parsoid
13180 <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>
13181 !! end
13182
13183 !! test
13184 Image with caption, bug 53312 #1
13185 !! wikitext
13186 [[File:Foobar.jpg|right|Caption page stuff]]
13187 !! html/php
13188 <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>
13189
13190 !! html/parsoid
13191 <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>
13192 !! end
13193
13194 !! test
13195 Image with caption, bug 53312 #2
13196 !! wikitext
13197 [[File:Foobar.jpg|right|Caption page=]]
13198 !! html/php
13199 <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>
13200
13201 !! html/parsoid
13202 <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>
13203 !! end
13204
13205 !! test
13206 Image with caption, bug 53312 #3
13207 !! wikitext
13208 [[File:Foobar.jpg|right|Caption page=stuff]]
13209 !! html/php
13210 <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>
13211
13212 !! html/parsoid
13213 <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>
13214 !! end
13215
13216 !! test
13217 Allow empty links in image captions (Bug 60753)
13218 !! options
13219 thumbsize=220
13220 !! wikitext
13221 [[File:Foobar.jpg|thumb|Caption [[Link1]]
13222 [[]]
13223 [[Link2]]
13224 ]]
13225 !! html/php
13226 <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>
13227
13228 !! html/parsoid
13229 <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>
13230 [[]]
13231 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
13232 </figcaption></figure>
13233 !! end
13234
13235 !! test
13236 Titles in unlinked images (T23454)
13237 !! wikitext
13238 [[File:Foobar.jpg|link=|stuff]]
13239 !! html/php
13240 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
13241 </p>
13242 !! end
13243
13244 !! test
13245 Link with empty target
13246 !! wikitext
13247 [[]]
13248 !! html
13249 <p>[[]]
13250 </p>
13251 !! end
13252
13253 !! test
13254 Image with link trail
13255 !! wikitext
13256 Linktrails should not work for images: [[File:Foobar.jpg]]s
13257 !! html/php
13258 <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
13259 </p>
13260 !! html/parsoid
13261 <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>
13262 !! end
13263
13264 !! test
13265 Image with empty attribute
13266 !! options
13267 parsoid=wt2html,wt2wt,html2html
13268 !! wikitext
13269 [[File:Foobar.jpg|right||Caption text]]
13270 !! html/php
13271 <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>
13272
13273 !! html/parsoid
13274 <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>
13275 !! end
13276
13277 !! test
13278 1. Block image with individual attributes from templates
13279 !! wikitext
13280 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
13281 !! html/php
13282 <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>
13283
13284 !! html/parsoid
13285 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt2" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"width","ak":"{{echo|137px}}"},{"ck":"caption","ak":"This is a caption"}]}' data-mw='{"attribs":[["thumbnail",{"html":"thumb"}],["width",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[24,38,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"137px\"}},\"i\":0}}]}&#39;>137px&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/137px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="16" width="137" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"16","width":"137"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>This is a caption</figcaption></figure>
13286 !! end
13287
13288 !! test
13289 2. Block Image with individual attributes from templates
13290 !! wikitext
13291 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
13292 !! html/php
13293 <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>
13294
13295 !! html/parsoid
13296 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt3" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"{{echo|thumb}}"},{"ck":"width","ak":"{{echo|137px}}"},{"ck":"caption","ak":"This is a caption"}]}' data-mw='{"attribs":[["thumbnail",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[18,32,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"thumb\"}},\"i\":0}}]}&#39;>thumb&lt;/span>"}],["width",{"html":"&lt;span about=\"#mwt2\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[33,47,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"137px\"}},\"i\":0}}]}&#39;>137px&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/137px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="16" width="137" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"16","width":"137"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>This is a caption</figcaption></figure>
13297 !! end
13298
13299 !! test
13300 3. Inline image with individual attributes from templates
13301 !! wikitext
13302 [[File:Foobar.jpg|{{echo|50px}}]]
13303 !! html/php
13304 <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>
13305 </p>
13306 !! html/parsoid
13307 <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=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[18,31,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"50px\"}},\"i\":0}}]}&#39;>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" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"6","width":"50"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
13308 !! end
13309
13310 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
13311 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
13312 !! test
13313 Image with multiple attributes from the same template
13314 !! wikitext
13315 [[File:Foobar.jpg|{{image_attribs}}]]
13316 !! html/php
13317 <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>
13318
13319 !! html/parsoid
13320 <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>
13321 !! end
13322
13323 !! test
13324 Image with link tails
13325 !! options
13326 thumbsize=220
13327 !! wikitext
13328 123[[File:Foobar.jpg]]456
13329 123[[File:Foobar.jpg|right]]456
13330 123[[File:Foobar.jpg|thumb]]456
13331 !! html/php
13332 <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
13333 </p>
13334 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
13335 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
13336
13337 !! html/php+tidy
13338 <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>
13339 <p>123</p>
13340 <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>
13341 <p>456 123</p>
13342 <div class="thumb tright">
13343 <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>
13344 <div class="thumbcaption">
13345 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
13346 </div>
13347 </div>
13348 </div>
13349 <p>456</p>
13350 !! html/parsoid
13351 <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>
13352 <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>
13353 <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>
13354 !! end
13355
13356 !! test
13357 Image with multiple captions -- only last one is accepted
13358 !! wikitext
13359 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
13360 !! html/php
13361 <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>
13362
13363 !! html/parsoid
13364 <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>
13365 !! end
13366
13367 !! test
13368 Image with multiple widths -- use last
13369 !! wikitext
13370 [[File:Foobar.jpg|200px|300px|caption]]
13371 !! html/php
13372 <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>
13373 </p>
13374 !! html/parsoid
13375 <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>
13376 !! end
13377
13378 !! test
13379 Image with multiple alignments -- use first (bug 48664)
13380 !! options
13381 thumbsize=220
13382 !! wikitext
13383 [[File:Foobar.jpg|thumb|left|right|center|caption]]
13384
13385 [[File:Foobar.jpg|middle|text-top|caption]]
13386 !! html/php
13387 <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>
13388 <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>
13389 </p>
13390 !! html/parsoid
13391 <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>
13392 <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>
13393 !! end
13394
13395 !! test
13396 Image with width attribute at different positions
13397 !! wikitext
13398 [[File:Foobar.jpg|200px|right|Caption]]
13399 [[File:Foobar.jpg|right|200px|Caption]]
13400 [[File:Foobar.jpg|right|Caption|200px]]
13401 !! html/php
13402 <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>
13403 <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>
13404 <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>
13405
13406 !! html/parsoid
13407 <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>
13408 <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>
13409 <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>
13410 !! end
13411
13412 # a sad bit of backward-compatibility
13413 !! test
13414 Image with size specified with pxpx (bug 13500, 51628)
13415 !! options
13416 parsoid=wt2html,wt2wt,html2html
13417 !! wikitext
13418 [[File:Foobar.jpg|20pxpx]]
13419 [[File:Foobar.jpg|200x20pxpx]]
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/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>
13422 <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>
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/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>
13426 !! end
13427
13428 !! test
13429 Image with link parameter, wiki target
13430 !! wikitext
13431 [[File:Foobar.jpg|link=Main Page]]
13432 !! html/php
13433 <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>
13434 </p>
13435 !! html/parsoid
13436 <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>
13437 !! end
13438
13439 # parsoid bug 49293 (part 1)
13440 !! test
13441 Image with link parameter, URL target
13442 !! wikitext
13443 [[File:Foobar.jpg|link=http://example.com/]]
13444 !! html/php
13445 <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>
13446 </p>
13447 !! html/parsoid
13448 <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>
13449 !! end
13450
13451 # parsoid bug 49293 (part 2)
13452 !! test
13453 Image with link parameter, protocol-less URL target
13454 !! wikitext
13455 [[File:Foobar.jpg|link=//example.com/]]
13456 !! html/php
13457 <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>
13458 </p>
13459 !! html/parsoid
13460 <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>
13461 !! end
13462
13463 !! test
13464 Escaping non-block captions (T107435)
13465 !! options
13466 parsoid={
13467 "modes": ["wt2wt"],
13468 "changes": [
13469 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
13470 ]
13471 }
13472 !! wikitext
13473 [[Image:Foobar.jpg|caption]]
13474 !! wikitext/edited
13475 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
13476 !! end
13477
13478 # wgExternalLinkTarget not supported by Parsoid
13479 !! test
13480 Image with link parameter, wgExternalLinkTarget
13481 !! wikitext
13482 [[Image:foobar.jpg|link=http://example.com/]]
13483 !! config
13484 wgExternalLinkTarget='foobar'
13485 !! html/php
13486 <p><a href="http://example.com/" target="foobar" rel="nofollow noreferrer noopener"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13487 </p>
13488 !! end
13489
13490 !! test
13491 Image with link parameter, wgNoFollowLinks set to false
13492 !! wikitext
13493 [[Image:foobar.jpg|link=http://example.com/]]
13494 !! config
13495 wgNoFollowLinks=false
13496 !! html
13497 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13498 </p>
13499 !! end
13500
13501 !! test
13502 Image with link parameter, wgNoFollowDomainExceptions
13503 !! wikitext
13504 [[Image:foobar.jpg|link=http://example.com/]]
13505 !! config
13506 wgNoFollowDomainExceptions='example.com'
13507 !! html
13508 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13509 </p>
13510 !! end
13511
13512 # wgExternalLinkTarget not supported by Parsoid
13513 !! test
13514 Image with link parameter, wgExternalLinkTarget, unnamed parameter
13515 !! wikitext
13516 [[Image:foobar.jpg|link=http://example.com/|Title]]
13517 !! config
13518 wgExternalLinkTarget='foobar'
13519 !! html/php
13520 <p><a href="http://example.com/" title="Title" target="foobar" rel="nofollow noreferrer noopener"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13521 </p>
13522 !! end
13523
13524 !! test
13525 Image with empty link parameter
13526 !! wikitext
13527 [[File:Foobar.jpg|link=]]
13528 !! html/php
13529 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
13530 </p>
13531 !! html/parsoid
13532 <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>
13533 !! end
13534
13535 !! test
13536 Image with link parameter (wiki target) and unnamed parameter
13537 !! wikitext
13538 [[File:Foobar.jpg|link=Main_Page|Title]]
13539 !! html/php
13540 <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>
13541 </p>
13542 !! html/parsoid
13543 <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>
13544 !! end
13545
13546 !! test
13547 Image with link parameter (URL target) and unnamed parameter
13548 !! wikitext
13549 [[File:Foobar.jpg|link=http://example.com/|Title]]
13550 !! html/php
13551 <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>
13552 </p>
13553 !! html/parsoid
13554 <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>
13555 !! end
13556
13557 !! test
13558 Thumbnail image with link parameter
13559 !! options
13560 thumbsize=220
13561 parsoid=wt2html,wt2wt,html2html
13562 !! wikitext
13563 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
13564 !! html/php
13565 <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>
13566
13567 !! html/parsoid
13568 <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>
13569 !! end
13570
13571 !! test
13572 Manually-specified thumbnail image
13573 !! options
13574 thumbsize=220
13575 !! wikitext
13576 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
13577 !! html/php
13578 <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>
13579
13580 !! html/parsoid
13581 <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>
13582 !! end
13583
13584 !! test
13585 Manually-specified thumbnail image with explicit link to wiki page
13586 !! options
13587 thumbsize=220
13588 parsoid=wt2html,wt2wt,html2html
13589 !! wikitext
13590 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
13591 !! html/php
13592 <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>
13593
13594 !! html/parsoid
13595 <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>
13596 !! end
13597
13598 !! test
13599 Manually-specified thumbnail image with explicit link to url
13600 !! options
13601 thumbsize=220
13602 parsoid=wt2html,wt2wt,html2html
13603 !! wikitext
13604 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
13605 !! html/php
13606 <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>
13607
13608 !! html/parsoid
13609 <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>
13610 !! end
13611
13612 !! test
13613 Manually-specified thumbnail image with explicit no link
13614 !! options
13615 thumbsize=220
13616 parsoid=wt2html,wt2wt,html2html
13617 !! wikitext
13618 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
13619 !! html/php
13620 <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>
13621
13622 !! html/parsoid
13623 <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>
13624 !! end
13625
13626 !! test
13627 Manually-specified thumbnail image with explicit link and alt text
13628 !! options
13629 thumbsize=220
13630 parsoid=wt2html,wt2wt,html2html
13631 !! wikitext
13632 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
13633 !! html/php
13634 <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>
13635
13636 !! html/parsoid
13637 <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>
13638 !! end
13639
13640 !! test
13641 Image with frame and link
13642 !! options
13643 parsoid=wt2html,wt2wt,html2html
13644 !! wikitext
13645 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
13646 !! html/php
13647 <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>
13648
13649 !! html/parsoid
13650 <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>
13651 !! end
13652
13653 !! test
13654 Image with frame and link and explicit alt
13655 !! options
13656 parsoid=wt2html,wt2wt,html2html
13657 !! wikitext
13658 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
13659 !! html/php
13660 <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>
13661
13662 !! html/parsoid
13663 <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>
13664 !! end
13665
13666 !! test
13667 Image with wiki markup in implicit alt
13668 !! wikitext
13669 [[Image:Foobar.jpg|testing '''bold''' in alt]]
13670
13671 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
13672 !! html/php
13673 <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>
13674 </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>
13675 </p>
13676 !! html/parsoid
13677 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"testing &#39;&#39;&#39;bold&#39;&#39;&#39; in alt"}]}' data-mw='{"caption":"testing &lt;b data-parsoid=&#39;{\"dsr\":[27,37,3,3]}&#39;>bold&lt;/b> in alt"}'><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":"Image:Foobar.jpg"}}'/></a></span></p>
13678
13679 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"alt","ak":"alt=testing &#39;&#39;&#39;bold&#39;&#39;&#39; in alt"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><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>
13680 !! end
13681
13682 !! test
13683 Alt image option should handle most kinds of wikitext without barfing
13684 !! wikitext
13685 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
13686 !! html/php
13687 <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>
13688
13689 !! html/parsoid
13690 <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=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./Link\"},\"sa\":{\"href\":\"link\"},\"dsr\":[65,73,2,2]}&#39;>link&lt;/a> and a &lt;i about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"dsr\":[80,106,null,null],\"pi\":[[{\"k\":\"1\"}]]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"&amp;#39;&amp;#39;bold template&amp;#39;&amp;#39;\"}},\"i\":0}}]}&#39;>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>
13691 !! end
13692
13693 ###################
13694 # Conflicting image format options.
13695 # First option specified should 'win'.
13696 # All three cases in each test should be identical.
13697
13698 !! test
13699 Image with 'frameless' first.
13700 !! options
13701 parsoid=wt2html,wt2wt,html2html
13702 !! wikitext
13703 [[File:Foobar.jpg|frameless|caption]]
13704
13705 [[File:Foobar.jpg|frameless|frame|caption]]
13706
13707 [[File:Foobar.jpg|frameless|thumb|caption]]
13708 !! html/php
13709 <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>
13710 </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>
13711 </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>
13712 </p>
13713 !! html/parsoid
13714 <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>
13715 <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>
13716 <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>
13717 !! end
13718
13719 !! test
13720 Image with 'frame' first.
13721 !! options
13722 parsoid=wt2html,wt2wt,html2html
13723 !! wikitext
13724 [[File:Foobar.jpg|frame|caption]]
13725 [[File:Foobar.jpg|frame|frameless|caption]]
13726 [[File:Foobar.jpg|frame|thumb|caption]]
13727 !! html/php
13728 <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>
13729 <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>
13730 <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>
13731
13732 !! html/parsoid
13733 <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>
13734 <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>
13735 <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>
13736 !! end
13737
13738 !! test
13739 Image with 'thumb' first.
13740 !! options
13741 parsoid=wt2html,wt2wt,html2html
13742 !! wikitext
13743 [[File:Foobar.jpg|thumb|caption]]
13744 [[File:Foobar.jpg|thumb|frameless|caption]]
13745 [[File:Foobar.jpg|thumb|frame|caption]]
13746 !! html/php
13747 <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>
13748 <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>
13749 <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>
13750
13751 !! html/parsoid
13752 <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>
13753 <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>
13754 <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>
13755 !! end
13756
13757 ###################
13758 # Image sizing.
13759 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
13760 # and https://phabricator.wikimedia.org/T64258
13761 # Foobar has actual size of 1941x220
13762 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
13763 # a scalable format.
13764 # 2. Framed images always ignore size options; always render at default size.
13765 # 3. "Unspecified format" and border are the only types which can be
13766 # enlarged.
13767
13768 !! test
13769 Image: "unspecified format" and border enlarge
13770 !! options
13771 parsoid=wt2html,wt2wt,html2html
13772 !! wikitext
13773 [[File:Foobar.jpg|2000px]]
13774
13775 [[File:Foobar.jpg|border|2000px]]
13776 !! html/php
13777 <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>
13778 </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>
13779 </p>
13780 !! html/parsoid
13781 <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>
13782 <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>
13783 !! end
13784
13785 !! test
13786 Image: "unspecified format" and border reduce
13787 !! options
13788 parsoid=wt2html,wt2wt,html2html
13789 !! wikitext
13790 [[File:Foobar.jpg|1000px]]
13791
13792 [[File:Foobar.jpg|border|1000px]]
13793 !! html/php
13794 <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>
13795 </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>
13796 </p>
13797 !! html/parsoid
13798 <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>
13799 <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>
13800 !! end
13801
13802 !! test
13803 Image: thumbs reduce
13804 !! options
13805 parsoid=wt2html,wt2wt,html2html
13806 !! wikitext
13807 [[File:Foobar.jpg|thumb|50px]]
13808 !! html/php
13809 <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>
13810
13811 !! html/parsoid
13812 <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>
13813 !! end
13814
13815 !! test
13816 Image: bitmap thumbs can't be enlarged past original size, but vector can.
13817 !! options
13818 parsoid=wt2html,wt2wt,html2html
13819 !! wikitext
13820 [[File:Foobar.jpg|thumb|2000px]]
13821
13822 [[File:Foobar.svg|thumb|2000px]]
13823 !! html/php
13824 <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>
13825 <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>
13826
13827 !! html/parsoid
13828 <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>
13829 <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>
13830 !! end
13831
13832 !! test
13833 Image: frameless can reduce in size
13834 !! options
13835 parsoid=wt2html,wt2wt,html2html
13836 !! wikitext
13837 [[File:Foobar.jpg|frameless|50px]]
13838 !! html/php
13839 <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>
13840 </p>
13841 !! html/parsoid
13842 <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>
13843 !! end
13844
13845 !! test
13846 Image: bitmap frameless can't be enlarged past original size, but vector can
13847 !! options
13848 parsoid=wt2html,wt2wt,html2html
13849 !! wikitext
13850 [[File:Foobar.jpg|frameless|2000px]]
13851
13852 [[File:Foobar.svg|frameless|2000px]]
13853 !! html/php
13854 <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>
13855 </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>
13856 </p>
13857 !! html/parsoid
13858 <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>
13859 <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>
13860 !! end
13861
13862 !! test
13863 Image: framed images are always unscaled.
13864 !! options
13865 parsoid=wt2html,wt2wt,html2html
13866 !! wikitext
13867 [[File:Foobar.jpg|frame]]
13868
13869 [[File:Foobar.jpg|frame|50px]]
13870
13871 [[File:Foobar.jpg|frame|50x50px]]
13872
13873 [[File:Foobar.jpg|frame|2000px]]
13874 !! html/php
13875 <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>
13876 <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>
13877 <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>
13878 <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>
13879
13880 !! html/parsoid
13881 <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>
13882 <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>
13883 <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>
13884 <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>
13885 !! end
13886
13887 ###################
13888
13889 !! test
13890 Link to image page- image page normally doesn't exists, hence edit link
13891 Add test with existing image page
13892 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
13893 !! wikitext
13894 [[:Image:test]]
13895 !! html
13896 <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>
13897 </p>
13898 !! end
13899
13900 !! test
13901 bug 18784 Link to non-existent image page with caption should use caption as link text
13902 !! wikitext
13903 [[:Image:test|caption]]
13904 !! html
13905 <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>
13906 </p>
13907 !! end
13908
13909 !! test
13910 Frameless image caption with a free URL
13911 !! wikitext
13912 [[File:Foobar.jpg|http://example.com]]
13913 !! html/php
13914 <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>
13915 </p>
13916 !! html/parsoid
13917 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"http://example.com"}]}' data-mw='{"caption":"&lt;a rel=\"mw:ExtLink\" href=\"http://example.com\" data-parsoid=&#39;{\"stx\":\"url\",\"dsr\":[18,36,0,0]}&#39;>http://example.com&lt;/a>"}'><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>
13918 !! end
13919
13920 !! test
13921 Thumbnail image caption with a free URL
13922 !! options
13923 thumbsize=220
13924 !! wikitext
13925 [[File:Foobar.jpg|thumb|http://example.com]]
13926 !! html/php
13927 <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>
13928
13929 !! html/parsoid
13930 <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>
13931 !! end
13932
13933 !! test
13934 Thumbnail image caption with a free URL and explicit alt
13935 !! options
13936 thumbsize=220
13937 parsoid=wt2html,wt2wt,html2html
13938 !! wikitext
13939 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
13940 !! html/php
13941 <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>
13942
13943 !! html/parsoid
13944 <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>
13945 !! end
13946
13947 !! test
13948 SVG thumbnails with no language set
13949 !! options
13950 !! wikitext
13951 [[File:Foobar.svg|thumb|caption]]
13952 !! html/php
13953 <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>
13954
13955 !! html/parsoid
13956 <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>
13957 !! end
13958
13959 !! test
13960 SVG thumbnails with language de
13961 !! options
13962 parsoid=wt2html,wt2wt,html2html
13963 !! wikitext
13964 [[File:Foobar.svg|thumb|caption|lang=de]]
13965 !! html/php
13966 <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>
13967
13968 !! html/parsoid
13969 <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>
13970 !! end
13971
13972 !! test
13973 SVG thumbnails with invalid language code
13974 !! options
13975 parsoid=wt2html,wt2wt,html2html
13976 !! wikitext
13977 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
13978 !! html/php
13979 <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>
13980
13981 !! html/parsoid
13982 <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>
13983 !! end
13984
13985 !! test
13986 BUG 1887: A ISBN with a thumbnail
13987 !! wikitext
13988 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
13989 !! html/php
13990 <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>
13991
13992 !! html/parsoid
13993 <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>
13994 !! end
13995
13996 !! test
13997 BUG 1887: A RFC with a thumbnail
13998 !! wikitext
13999 [[File:Foobar.jpg|thumb|This is RFC 12354]]
14000 !! html/php
14001 <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>
14002
14003 !! html/parsoid
14004 <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>
14005 !! end
14006
14007 !! test
14008 BUG 1887: A mailto link with a thumbnail
14009 !! wikitext
14010 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
14011 !! html/php
14012 <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>
14013
14014 !! html/parsoid
14015 <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>
14016 !! end
14017
14018 # Pending resolution to bug 368
14019 !! test
14020 BUG 648: Frameless image caption with a link
14021 !! wikitext
14022 [[File:Foobar.jpg|text with a [[link]] in it]]
14023 !! html/php
14024 <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>
14025 </p>
14026 !! html/parsoid
14027 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"text with a [[link]] in it"}]}' data-mw='{"caption":"text with a &lt;a rel=\"mw:WikiLink\" href=\"./Link\" title=\"Link\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./Link\"},\"sa\":{\"href\":\"link\"},\"dsr\":[30,38,2,2]}&#39;>link&lt;/a> in it"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
14028 !! end
14029
14030 !! test
14031 BUG 648: Frameless image caption with a link (suffix)
14032 !! wikitext
14033 [[File:Foobar.jpg|text with a [[link]]foo in it]]
14034 !! html/php
14035 <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>
14036 </p>
14037 !! html/parsoid
14038 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"text with a [[link]]foo in it"}]}' data-mw='{"caption":"text with a &lt;a rel=\"mw:WikiLink\" href=\"./Link\" title=\"Link\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./Link\"},\"sa\":{\"href\":\"link\"},\"dsr\":[30,41,2,5],\"tail\":\"foo\"}&#39;>linkfoo&lt;/a> in it"}'><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>
14039 !! end
14040
14041 !! test
14042 BUG 648: Frameless image caption with an interwiki link
14043 !! wikitext
14044 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
14045 !! html/php
14046 <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>
14047 </p>
14048 !! html/parsoid
14049 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"text with a [[MeatBall:Link]] in it"}]}' 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=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"http://www.usemod.com/cgi-bin/mb.pl?Link\"},\"sa\":{\"href\":\"MeatBall:Link\"},\"isIW\":true,\"dsr\":[30,47,2,2]}&#39;>MeatBall:Link&lt;/a> in it"}'><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>
14050 !! end
14051
14052 !! test
14053 BUG 648: Frameless image caption with a piped interwiki link
14054 !! wikitext
14055 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
14056 !! html/php
14057 <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>
14058 </p>
14059 !! html/parsoid
14060 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"text with a [[MeatBall:Link|link]] in it"}]}' 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=&#39;{\"stx\":\"piped\",\"a\":{\"href\":\"http://www.usemod.com/cgi-bin/mb.pl?Link\"},\"sa\":{\"href\":\"MeatBall:Link\"},\"isIW\":true,\"dsr\":[30,52,16,2]}&#39;>link&lt;/a> in it"}'><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>
14061 !! end
14062
14063 !! test
14064 T107474: Frameless image caption with <nowiki>
14065 !! wikitext
14066 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
14067 !! html/parsoid
14068 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&lt;nowiki>text with a [[MeatBall:Link|link]] in it&lt;/nowiki>"}]}' data-mw='{"caption":"&lt;span typeof=\"mw:Nowiki\" data-parsoid=&#39;{\"dsr\":[18,75,8,9]}&#39;>text with a [[MeatBall:Link|link]] in it&lt;/span>"}'><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>
14069 !! end
14070
14071 !! test
14072 Escape HTML special chars in image alt text
14073 !! wikitext
14074 [[File:Foobar.jpg|& < > "]]
14075 !! html/php
14076 <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>
14077 </p>
14078 !! html/parsoid
14079 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&amp; &lt; > \""}]}' data-mw='{"caption":"&amp;amp; &amp;lt; > \""}'><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>
14080 !! end
14081
14082 !! test
14083 Entities in file name and attributes
14084 !! wikitext
14085 [[File:7%25 solution.gif|manualthumb=7%25 solution.gif|link=7%25 solution|[[7%25 solution]]]]
14086 !! html/php
14087 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=7%25_solution.gif" class="new" title="File:7% solution.gif">7% solution</a>
14088 </p>
14089 !! html/parsoid
14090 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"bogus","ak":"manualthumb=7%25 solution.gif"},{"ck":"link","ak":"link=7%25 solution"},{"ck":"caption","ak":"[[7%25 solution]]"}]}' data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&lt;a rel=\"mw:WikiLink\" href=\"./7%25_solution\" title=\"7% solution\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./7%25_solution\"},\"sa\":{\"href\":\"7%25 solution\"},\"dsr\":[74,91,2,2]}&#39;>7% solution&lt;/a>"}'><a href="./7%25_solution" data-parsoid='{"a":{"href":"./7%25_solution"},"sa":{"href":"link=7%25 solution"}}'><img resource="./File:7%25_solution.gif" src="./Special:FilePath/7%25_solution.gif" height="220" width="220" data-parsoid='{"a":{"resource":"./File:7%25_solution.gif","height":"220","width":"220"},"sa":{"resource":"File:7%25 solution.gif"}}'/></a></span></p>
14091 !! end
14092
14093 !! test
14094 BUG 499: Alt text should have &#1234;, not &amp;1234;
14095 !! wikitext
14096 [[File:Foobar.jpg|&#9792;]]
14097 !! html/php
14098 <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>
14099 </p>
14100 !! html/parsoid
14101 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&amp;#9792;"}]}' data-mw='{"caption":"&lt;span typeof=\"mw:Entity\" data-parsoid=&#39;{\"src\":\"&amp;amp;#9792;\",\"srcContent\":\"♀\",\"dsr\":[18,25,null,null]}&#39;>♀&lt;/span>"}'><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>
14102 !! end
14103
14104 !! test
14105 Broken image caption with link
14106 !! options
14107 parsoid=wt2html,wt2wt,html2html
14108 !! wikitext
14109 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
14110 !! html/php
14111 <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.
14112 </p>
14113 !! html/parsoid
14114 <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>
14115 !! end
14116
14117 !! test
14118 Image caption containing another image
14119 !! wikitext
14120 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
14121 !! html/php
14122 <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>
14123
14124 !! html/parsoid
14125 <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>
14126 !! end
14127
14128 !! test
14129 Image: caption containing a newline
14130 !! wikitext
14131 [[File:Foobar.jpg|This
14132 *is some text]]
14133 !! html/php
14134 <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>
14135 </p>
14136 !! html/parsoid
14137 <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>
14138 !!end
14139
14140 !!test
14141 Image: caption containing leading space
14142 (The leading space should not trigger nowiki escaping in wt2wt mode)
14143 !! wikitext
14144 [[File:Foobar.jpg|thumb| bar]]
14145 !! html/php
14146 <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>
14147
14148 !! html/parsoid
14149 <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>
14150 !!end
14151
14152 !! test
14153 Image: caption containing a table
14154 !! options
14155 parsoid=wt2html,wt2wt,html2html
14156 !! wikitext
14157 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
14158 {|
14159 ! Foo !! Bar
14160 |-
14161 | Foo1 || Bar1
14162 |}
14163 and some more text.]]
14164 !! html/php
14165 <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>
14166
14167 !! html/parsoid
14168 <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
14169 <table>
14170 <tbody>
14171 <tr><th>Foo </th><th>Bar</th></tr>
14172 <tr>
14173 <td>Foo1 </td>
14174 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
14175 !! end
14176
14177 !! test
14178 Bug 3090: External links other than http: in image captions
14179 !! wikitext
14180 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
14181 !! html/php
14182 <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>
14183
14184 !! html/parsoid
14185 <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>
14186 !! end
14187
14188 !! test
14189 Custom class
14190 !! options
14191 parsoid=wt2html,wt2wt,html2html
14192 !! wikitext
14193 [[Image:foobar.jpg|a|class=b]]
14194 !! html/php
14195 <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>
14196 </p>
14197 !! html/parsoid
14198 <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>
14199 !! end
14200
14201 !! test
14202 Localized image handling (1).
14203 !! options
14204 parsoid=wt2html,wt2wt,html2html
14205 language=es
14206 !! wikitext
14207 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
14208 !! html/php
14209 <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>
14210
14211 !! html/parsoid
14212 <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>
14213 !! end
14214
14215 !! test
14216 Localized image handling (2).
14217 !! options
14218 thumbsize=220
14219 parsoid=wt2html,wt2wt,html2html
14220 language=es
14221 !! wikitext
14222 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
14223 !! html/php
14224 <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>
14225
14226 !! html/parsoid
14227 <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>
14228 !! end
14229
14230 !! test
14231 Localized image handling (3).
14232 !! options
14233 language=fa
14234 parsoid=html2wt
14235 !! html/parsoid
14236 <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>
14237 !! wikitext
14238 [[File:Foobar.jpg|بندانگشتی]]
14239 !! end
14240
14241 !! test
14242 "border", "frameless" and "class" attributes on an image.
14243 !! options
14244 thumbsize=220
14245 parsoid=wt2html,wt2wt,html2html
14246 !! wikitext
14247 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
14248 !! html/php
14249 <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>
14250 </p>
14251 !! html/parsoid
14252 <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>
14253 !! end
14254
14255 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
14256 !! test
14257 Invalid image attributes (bug 62500)
14258 !! options
14259 thumbsize=220
14260 parsoid=wt2html,wt2wt,html2html
14261 !! wikitext
14262 [[File:Foobar.jpg|thumb|float|left|caption]]
14263
14264 [[File:Foobar.jpg|thumb|righ|caption]]
14265
14266 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
14267 !! html/php
14268 <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>
14269 <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>
14270 <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>
14271
14272 !! html/parsoid
14273 <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>
14274 <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>
14275 <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>
14276 !! end
14277
14278 !! article
14279 File:Barfoo.jpg
14280 !! text
14281 #REDIRECT [[File:Barfoo.jpg]]
14282 !! endarticle
14283
14284 # FIXME: Parsoid should run this test -- but we'd need to teach the
14285 # mockAPI about the redirected Barfoo.jpg image.
14286 !! test
14287 Redirected image
14288 !! wikitext
14289 [[Image:Barfoo.jpg]]
14290 !! html/php
14291 <p><a href="/wiki/File:Barfoo.jpg" class="mw-redirect" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
14292 </p>
14293 !! end
14294
14295 !! test
14296 Missing image with uploads disabled
14297 !! options
14298 wgEnableUploads=0
14299 !! wikitext
14300 [[File:Foobaz.jpg]]
14301 !! html/php
14302 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
14303 </p>
14304 !! html/parsoid
14305 <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>
14306 !! end
14307
14308 # Parsoid-specific testing for images
14309 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
14310 # Currently imperfect due to a flaw in the Parsoid testrunner
14311 # Work in progress
14312 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
14313 # image tests.
14314
14315 !! test
14316 Parsoid-specific image handling - simple image with size and middle alignment
14317 !! wikitext
14318 [[File:Foobar.jpg|middle|50px]]
14319 !! html/parsoid
14320 <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>
14321 !! end
14322
14323 !! test
14324 Parsoid-specific image handling - simple image with size, middle alignment,
14325 non-standard namespace alias
14326 !! options
14327 parsoid=wt2wt,wt2html,html2html
14328 !! wikitext
14329 [[Image:Foobar.jpg|middle|50px]]
14330 !! html/parsoid
14331 <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>
14332 !! end
14333
14334 !! test
14335 Parsoid-specific image handling - simple image with size and middle alignment
14336 (existing content)
14337 !! wikitext
14338 [[File:Foobar.jpg|50px|middle]]
14339 !! html/parsoid
14340 <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>
14341 !! end
14342
14343 !! test
14344 Parsoid-specific image handling - simple image with size and middle alignment
14345 and non-standard namespace name
14346 !! options
14347 parsoid=wt2html,wt2wt,html2html
14348 !! wikitext
14349 [[Image:Foobar.jpg|50px|middle]]
14350 !! html/parsoid
14351 <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>
14352 !! end
14353
14354 !! test
14355 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
14356 !! wikitext
14357 [[File:Foobar.jpg|500x10px|baseline|caption]]
14358 !! html/parsoid
14359 <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>
14360 !! end
14361
14362 !! test
14363 Parsoid-specific image handling - simple image with border and size spec
14364 !! wikitext
14365 [[File:Foobar.jpg|50px|border|caption]]
14366 !! html/parsoid
14367 <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>
14368 !! end
14369
14370 !! test
14371 Parsoid-specific image handling - thumbnail with halign, valign, and caption
14372 !! wikitext
14373 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
14374 !! html/parsoid
14375 <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>
14376 !! end
14377
14378 !! test
14379 Parsoid-specific image handling - thumbnail with halign, valign, and caption
14380 (existing content)
14381 !! wikitext
14382 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
14383 !! html/parsoid
14384 <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>
14385 !! end
14386
14387 !! test
14388 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
14389 !! wikitext
14390 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
14391 !! html/parsoid
14392 <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>
14393 !! end
14394
14395 !! test
14396 Parsoid-specific image handling - thumbnail with specific size, halign,
14397 valign, and caption (existing content)
14398 !! wikitext
14399 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
14400 !! html/parsoid
14401 <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>
14402 !! end
14403
14404 !! test
14405 Parsoid-specific image handling - framed image with specific size and caption
14406 (size is ignored)
14407 !! options
14408 parsoid=wt2html,wt2wt,html2html
14409 !! wikitext
14410 [[File:Foobar.jpg|frame|500x50px|caption]]
14411 !! html/parsoid
14412 <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>
14413 !! end
14414
14415 !! test
14416 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
14417 (size is ignored)
14418 !! options
14419 parsoid=wt2html,wt2wt,html2html
14420 !! wikitext
14421 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
14422 !! html/parsoid
14423 <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>
14424 !! end
14425
14426 !! test
14427 Parsoid-specific image handling - frameless image with specific size, border, and caption
14428 !! wikitext
14429 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
14430 !! html/parsoid
14431 <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>
14432 !! end
14433
14434 !! test
14435 Parsoid-specific image handling - simple image with a formatted caption
14436 !! wikitext
14437 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
14438 !! html/parsoid
14439 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&lt;table>&lt;tr>&lt;td>a&lt;/td>&lt;td>b&lt;/td>&lt;/tr>&lt;tr>&lt;td>c&lt;/td>&lt;/tr>&lt;/table>"}]}' data-mw='{"caption":"&lt;table data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[18,81,7,8]}&#39;>&lt;tbody data-parsoid=&#39;{\"dsr\":[25,73,0,0]}&#39;>&lt;tr data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[25,54,4,5]}&#39;>&lt;td data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[29,39,4,5]}&#39;>a&lt;/td>&lt;td data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[39,49,4,5]}&#39;>b&lt;/td>&lt;/tr>&lt;tr data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[54,73,4,5]}&#39;>&lt;td data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[58,68,4,5]}&#39;>c&lt;/td>&lt;/tr>&lt;/tbody>&lt;/table>"}'><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>
14440 !! end
14441
14442 !! test
14443 Parsoid-specific image handling - caption with a template in it
14444 !! wikitext
14445 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
14446 !! html/parsoid
14447 <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>
14448 !! end
14449
14450 !! test
14451 Parsoid-specific image handling - caption with unbalanced tags in it
14452 !! options
14453 parsoid=wt2html,wt2wt,html2html
14454 !! wikitext
14455 foo
14456 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
14457 bar
14458 !! html/parsoid
14459 <p>foo</p>
14460 <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>
14461 <p>bar</p>
14462 !! end
14463
14464 !! test
14465 Parsoid-specific image handling - empty caption (1)
14466 !! options
14467 parsoid=wt2html,wt2wt
14468 !! wikitext
14469 [[File:Foobar.jpg|thumb|]]
14470 !! html/parsoid
14471 <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>
14472 !! end
14473
14474 # empty captions don't get serialized unless we're in the "round trip" case
14475 !! test
14476 Parsoid-specific image handling - empty caption (2)
14477 !! options
14478 parsoid=html2wt
14479 !! html/parsoid
14480 <figure class="mw-default-size" typeof="mw:Image/Thumb">
14481 <a href="./File:Foobar.jpg">
14482 <img resource="./File:Foobar.jpg"
14483 src="//example.com/images/3/3a/Foobar.jpg"
14484 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
14485 height="25" width="220"/>
14486 </a>
14487 <figcaption></figcaption>
14488 </figure>
14489 !! wikitext
14490 [[File:Foobar.jpg|thumb]]
14491 !! end
14492
14493 !! test
14494 Parsoid-specific image handling - whitespace caption
14495 !! wikitext
14496 [[File:Foobar.jpg|thumb| ]]
14497 !! html/parsoid
14498 <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>
14499 !! end
14500
14501 !! test
14502 Parsoid-specific image handling - lang option
14503 !! wikitext
14504 foo
14505 [[File:Foobar.svg|lang=de|caption]]
14506 bar
14507 !! html/parsoid
14508 <p>foo
14509 <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>
14510 bar</p>
14511 !! end
14512
14513 ## Edge case bugs in Parsoid from T93580
14514 !! test
14515 T93580: 1. Templated <ref> inside block images
14516 !! wikitext
14517 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
14518
14519 <references />
14520 !! html/parsoid
14521 <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>
14522
14523 <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>
14524 !! end
14525
14526 !! test
14527 T93580: 2. <ref> inside inline images
14528 !! wikitext
14529 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
14530
14531 <references />
14532 !! html/parsoid
14533 <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=&#39;{\"dsr\":[64,78,5,6]}&#39; data-mw=&#39;{\"name\":\"ref\",\"body\":{\"id\":\"mw-reference-text-cite_note-1\"},\"attrs\":{}}&#39;>&lt;a href=\"#cite_note-1\" style=\"counter-reset: mw-Ref 1;\" data-parsoid=\"{}\">&lt;span class=\"mw-reflink-text\" data-parsoid=\"{}\">[1]&lt;/span>&lt;/a>&lt;/span>&lt;meta typeof=\"mw:Extension/ref/Marker\" about=\"#mwt2\" data-parsoid=&#39;{\"group\":\"\",\"name\":\"\",\"content\":\"foo\",\"hasRefInRef\":false,\"dsr\":[64,78,5,6]}&#39;/>"}'><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>
14534
14535 <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>
14536 !! end
14537
14538 !! test
14539 T93580: 3. Templated <ref> inside inline images
14540 !! wikitext
14541 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
14542
14543 <references />
14544 !! html/parsoid
14545 <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=&#39;{\"dsr\":[64,96,null,null],\"pi\":[[{\"k\":\"1\"}]]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"&amp;lt;ref>{{echo|foo}}&amp;lt;/ref>\"}},\"i\":0}}]}&#39;>&lt;a href=\"#cite_note-1\" style=\"counter-reset: mw-Ref 1;\" data-parsoid=\"{}\">&lt;span class=\"mw-reflink-text\" data-parsoid=\"{}\">[1]&lt;/span>&lt;/a>&lt;/span>&lt;meta typeof=\"mw:Transclusion mw:Extension/ref/Marker\" about=\"#mwt2\" data-parsoid=&#39;{\"group\":\"\",\"name\":\"\",\"content\":\"foo\",\"hasRefInRef\":false,\"dsr\":[64,96,null,null],\"pi\":[[{\"k\":\"1\"}]]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"&amp;lt;ref>{{echo|foo}}&amp;lt;/ref>\"}},\"i\":0}}]}&#39;/>"}'><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>
14546
14547 <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>
14548 !! end
14549
14550 ###
14551 ### Subpages
14552 ###
14553 !! article
14554 Subpage test/subpage
14555 !! text
14556 foo
14557 !! endarticle
14558
14559 !! test
14560 Subpage link
14561 !! options
14562 subpage title=[[Subpage test]]
14563 !! wikitext
14564 [[/subpage]]
14565 !! html
14566 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
14567 </p>
14568 !! end
14569
14570 !! test
14571 Subpage noslash link
14572 !! options
14573 subpage title=[[Subpage test]]
14574 !! wikitext
14575 [[/subpage/]]
14576 !! html
14577 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
14578 </p>
14579 !! end
14580
14581 !! article
14582 Subpage test/1/2/subpage
14583 !! text
14584 blah
14585 !! endarticle
14586
14587 !! test
14588 Relative subpage noslash link
14589 !! options
14590 parsoid=wt2wt,wt2html,html2html
14591 subpage title=[[Subpage test/1/2/3/4]]
14592 !! wikitext
14593 [[../../subpage/]]
14594
14595 [[../../subpage]]
14596 !! html/php
14597 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
14598 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
14599 </p>
14600 !! html/parsoid
14601 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
14602 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
14603 !! end
14604
14605 !! test
14606 Parsoid: dot-slash prefixed wikilinks
14607 !! wikitext
14608 [[./foo]]
14609
14610 [[././bar]]
14611
14612 [[././baz/]]
14613 !! html/php
14614 <p>[[./foo]]
14615 </p><p>[[././bar]]
14616 </p><p>[[././baz/]]
14617 </p>
14618 !! html/parsoid
14619 <p>[[./foo]]
14620 </p><p>[[././bar]]
14621 </p><p>[[././baz/]]
14622 </p>
14623 !! end
14624
14625 !! test
14626 Render invalid page names as plain text (bug 51090)
14627 !! wikitext
14628 [[./../foo|bar]]
14629 [[foo�|bar]]
14630 [[foo/.|bar]]
14631 [[foo/..|bar]]
14632 [[foo~~~bar]]
14633 [[foo>bar]]
14634 [[foo[bar]]
14635 [[.]]
14636 [[..]]
14637 [[foo././bar]]
14638
14639 [[{{echo|./../foo}}|bar]]
14640 [[{{echo|foo/.}}|bar]]
14641 [[{{echo|foo/..}}|bar]]
14642 [[{{echo|foo~~~~bar}}]]
14643 [[{{echo|foo>bar}}]]
14644 [[{{echo|foo././bar}}]]
14645 [[{{echo|foo{bar}}]]
14646 [[{{echo|foo}bar}}]]
14647 [[{{echo|foo[bar}}]]
14648 [[{{echo|foo]bar}}]]
14649 [[{{echo|foo<bar}}]]
14650 !!html/php
14651 <p>[[./../foo|bar]]
14652 [[foo�|bar]]
14653 [[foo/.|bar]]
14654 [[foo/..|bar]]
14655 [[foo~~~bar]]
14656 [[foo&gt;bar]]
14657 [[foo[bar]]
14658 [[.]]
14659 [[..]]
14660 [[foo././bar]]
14661 </p><p>[[./../foo|bar]]
14662 [[foo/.|bar]]
14663 [[foo/..|bar]]
14664 [[foo~~~~bar]]
14665 [[foo&gt;bar]]
14666 [[foo././bar]]
14667 [[foo{bar]]
14668 [[foo}bar]]
14669 [[foo[bar]]
14670 [[foo]bar]]
14671 [[foo&lt;bar]]
14672 </p>
14673 !!html/parsoid
14674 <p>[[./../foo|bar]]
14675 [[foo�|bar]]
14676 [[foo/.|bar]]
14677 [[foo/..|bar]]
14678 [[foo~~~bar]]
14679 [[foo>bar]]
14680 [[foo[bar]]
14681 [[.]]
14682 [[..]]
14683 [[foo././bar]]</p>
14684
14685 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
14686 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
14687 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
14688 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
14689 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
14690 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
14691 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
14692 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
14693 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
14694 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
14695 [[<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>
14696 !!end
14697
14698 !! test
14699 Disabled subpages
14700 !! wikitext
14701 [[/subpage]]
14702 !! html
14703 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
14704 </p>
14705 !! end
14706
14707 !! test
14708 BUG 561: {{/Subpage}}
14709 !! options
14710 subpage title=[[Page]]
14711 !! wikitext
14712 {{/Subpage}}
14713 !! html
14714 <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>
14715 </p>
14716 !! end
14717
14718 ###
14719 ### Categories
14720 ###
14721 !! article
14722 Category:MediaWiki User's Guide
14723 !! text
14724 blah
14725 !! endarticle
14726
14727 !! test
14728 Link to category
14729 !! wikitext
14730 [[:Category:MediaWiki User's Guide]]
14731 !! html
14732 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
14733 </p>
14734 !! end
14735
14736 !! test
14737 Simple category
14738 !! options
14739 cat
14740 !! wikitext
14741 [[Category:MediaWiki User's Guide]]
14742 !! html/php
14743 cat=MediaWiki_User's_Guide sort=
14744 !! html/parsoid
14745 <link rel="mw:PageProp/Category" href="./Category:MediaWiki_User's_Guide" data-parsoid='{"stx":"simple","a":{"href":"./Category:MediaWiki_User&#39;s_Guide"},"sa":{"href":"Category:MediaWiki User&#39;s Guide"}}'/>
14746 !! end
14747
14748 !! test
14749 PAGESINCATEGORY invalid title fatal (r33546 fix)
14750 !! wikitext
14751 {{PAGESINCATEGORY:<bogus>}}
14752 !! html
14753 <p>0
14754 </p>
14755 !! end
14756
14757 !! test
14758 Category with different sort key
14759 !! options
14760 cat
14761 !! wikitext
14762 [[Category:MediaWiki User's Guide|Foo]]
14763 !! html/php
14764 cat=MediaWiki_User's_Guide sort=Foo
14765 !! html/parsoid
14766 <link rel="mw:PageProp/Category" href="./Category:MediaWiki_User's_Guide#Foo" data-parsoid='{"stx":"piped","a":{"href":"./Category:MediaWiki_User&#39;s_Guide"},"sa":{"href":"Category:MediaWiki User&#39;s Guide"}}'/>
14767 !! end
14768
14769 !! test
14770 Category with identical sort key
14771 !! options
14772 cat
14773 !! wikitext
14774 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14775 !! html/php
14776 cat=MediaWiki_User's_Guide sort=MediaWiki User's Guide
14777 !! html/parsoid
14778 <link rel="mw:PageProp/Category" href="./Category:MediaWiki_User's_Guide#MediaWiki%20User's%20Guide" data-parsoid='{"stx":"piped","a":{"href":"./Category:MediaWiki_User&#39;s_Guide"},"sa":{"href":"Category:MediaWiki User&#39;s Guide"}}'/>
14779 !! end
14780
14781 !! test
14782 Category with empty sort key
14783 !! options
14784 cat
14785 pst
14786 !! wikitext
14787 [[Category:MediaWiki User's Guide|]]
14788 !! html/php
14789 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14790 !! end
14791
14792 !! test
14793 Category with empty sort key and parentheses
14794 !! options
14795 cat
14796 pst
14797 !! wikitext
14798 [[Category:Foo (bar)|]]
14799 !! html/php
14800 [[Category:Foo (bar)|Foo]]
14801 !! end
14802
14803 !! test
14804 Category with link tail
14805 !! options
14806 cat
14807 pst
14808 !! wikitext
14809 123[[Category:Foo]]456
14810 !! html/php
14811 123[[Category:Foo]]456
14812 !! end
14813
14814 !! test
14815 Category with template
14816 !! options
14817 cat
14818 pst
14819 !! wikitext
14820 [[Category:{{echo|Foo}}]]
14821 !! html/php
14822 [[Category:{{echo|Foo}}]]
14823 !! end
14824
14825 !! test
14826 Category with template in sort key
14827 !! options
14828 cat
14829 pst
14830 !! wikitext
14831 [[Category:Foo|{{echo|Bar}}]]
14832 !! html/php
14833 [[Category:Foo|{{echo|Bar}}]]
14834 !! end
14835
14836 !! test
14837 Category with template in sort key and title
14838 !! options
14839 cat
14840 pst
14841 !! wikitext
14842 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14843 !! html/php
14844 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14845 !! end
14846
14847 ## We used to, but no longer wt2wt this test since the default serializer
14848 ## will normalize all categories to serialize on their own line.
14849 ## This wikitext usage is going to be fairly uncommon in production and
14850 ## selser will take care of preserving formatting in those scenarios.
14851 !! test
14852 Category / paragraph interactions
14853 !! options
14854 parsoid=wt2html
14855 !! wikitext
14856 Foo [[Category:Baz]] Bar
14857
14858 Foo [[Category:Baz]]
14859 Bar
14860
14861 Foo
14862 [[Category:Baz]]
14863 Bar
14864
14865 Foo
14866 [[Category:Baz]] Bar
14867
14868 Foo
14869 [[Category:Baz]]
14870 [[Category:Baz]]
14871 [[Category:Baz]]
14872 Bar
14873
14874 [[Category:Baz]]
14875 [[Category:Baz]]
14876 [[Category:Baz]]
14877
14878 [[Category:Baz]]
14879 {{echo|[[Category:Baz]]}}
14880 [[Category:Baz]]
14881 !! html/php
14882 <p>Foo Bar
14883 </p><p>Foo
14884 Bar
14885 </p><p>Foo
14886 Bar
14887 </p><p>Foo Bar
14888 </p><p>Foo
14889 Bar
14890 </p>
14891 !! html/parsoid
14892 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14893 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14894 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14895 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14896 <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>
14897 <link rel="mw:PageProp/Category" href="Category:Baz"/>
14898 !! end
14899
14900 ## We used to, but no longer wt2wt this test since the default serializer
14901 ## will normalize all categories to serialize on their own line.
14902 ## This wikitext usage is going to be fairly uncommon in production and
14903 ## selser will take care of preserving formatting in those scenarios.
14904 ##
14905 ## The whitespace on the empty line is part of the test. Please do not delete
14906 !! test
14907 1. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14908 !! options
14909 parsoid=wt2html
14910 !! wikitext
14911 This
14912
14913 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
14914
14915 {{echo|[[Category:Foo]] and so should this!}}
14916 !! html/php
14917 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
14918 </p>
14919 !! html/parsoid
14920 <p>This
14921
14922 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
14923
14924 <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>
14925 !! end
14926
14927 ## Parsoid will not try to wt2wt this while preserving newlines because
14928 ## it suppresses excess newlines within list items -- and we don't want to
14929 ## introduce a special case just for categories, which is, in reality somewhat
14930 ## odd behavior -- categories are unlikely to be used in list items like this
14931 ## in top-level pages and are only likely to show up in template-generated
14932 ## list items where this RT-ing is a non-issue.
14933 ##
14934 ## The whitespace on the empty line is part of the test. Please do not delete
14935 !! test
14936 2. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14937 !! options
14938 parsoid=wt2html
14939 !! wikitext
14940 * This
14941
14942 [[Category:Foo]] and this should be part of the same list item
14943 * So should this
14944
14945 {{echo|[[Category:Foo]] and this should be part of the same list item}}
14946 !! html
14947 <ul><li>This and this should be part of the same list item</li>
14948 <li>So should this and this should be part of the same list item</li></ul>
14949 !! html/parsoid
14950 <ul>
14951 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
14952 <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>
14953 </ul>
14954 !! end
14955
14956 ## Newlines and categories that follow the last item of a list
14957 ## are treated differently because this (list followed by categories)
14958 ## is an extremely common pattern on wikis.
14959 !! test
14960 3. Categories and newlines: newline suppression for last list item should RT properly
14961 !! wikitext
14962 * a
14963 * b
14964
14965 [[Category:Foo]]
14966
14967 [[Category:Bar]]
14968 [[Category:Baz]]
14969 !! html/parsoid
14970 <ul><li> a</li>
14971 <li> b</li></ul>
14972
14973 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14974
14975 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14976 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14977 !! end
14978
14979 !! test
14980 4. Categories and newlines: newline suppression for last list item should RT properly
14981 !! wikitext
14982 * a
14983 **** b
14984
14985 [[Category:Foo]]
14986 !! html/parsoid
14987 <ul><li> a
14988 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
14989
14990 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14991 !! end
14992
14993 ## only wt2html for this to make sure the algo only applies to the rightmost path
14994 !! test
14995 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
14996 !! options
14997 parsoid=wt2html
14998 !! wikitext
14999 * a
15000 ** b
15001 [[Category:Foo]]
15002 * c
15003 ** d
15004 [[Category:Foo]]
15005 !! html/parsoid
15006 <ul><li> a
15007 <ul><li> b
15008 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
15009 <li> c
15010 <ul><li> d</li></ul></li></ul>
15011 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15012 !! end
15013
15014 ## We used to, but no longer wt2wt this test since the default serializer
15015 ## will normalize all categories to serialize on their own line.
15016 ## This wikitext usage is going to be fairly uncommon in production and
15017 ## selser will take care of preserving formatting in those scenarios.
15018 !! test
15019 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
15020 !! options
15021 parsoid=wt2html
15022 !! wikitext
15023 * a [[Category:Foo]]
15024 !! html/parsoid
15025 <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>
15026 !! end
15027
15028 # This test also demonstrates because of newline+category tunneling
15029 # through the list hander, template wrapping doesn't expand to the
15030 # containing list when the list item swallows the category.
15031 !! test
15032 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
15033 !! wikitext
15034 * {{echo|a
15035 [[Category:Foo]]}}
15036 !! html/parsoid
15037 <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
15038 </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>
15039 !! end
15040
15041 !! test
15042 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
15043 !! wikitext
15044 * a
15045
15046 {{echo|[[Category:Foo]]
15047 [[Category:Bar]]}}
15048 [[Category:Baz]]
15049 !! html/parsoid
15050 <ul><li> a</li></ul>
15051
15052 <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">
15053 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
15054 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
15055 !! end
15056
15057 !! test
15058 Category links with multiple namespaces
15059 !! wikitext
15060 [[Category:Project:Foo]]
15061 !! html/parsoid
15062 <link rel="mw:PageProp/Category" href="./Category:Project:Foo" />
15063 !! end
15064
15065 !! test
15066 Parsoid: Serialize link to category page with colon escape
15067 !! options
15068 parsoid
15069 !! wikitext
15070
15071 [[:Category:Foo]]
15072 [[:Category:Foo|Bar]]
15073 !! html
15074 <p>
15075 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
15076 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
15077 </p>
15078 !! end
15079
15080 # We used to, but no longer wt2wt this test since the default serializer
15081 # will normalize all categories to serialize on their own line.
15082 # This wikitext usage is going to be fairly uncommon in production and
15083 # selser will take care of preventing whitespace insertion if this
15084 # occurs in an article.
15085 #
15086 # html2html disabled for the same reason (whitespace insertion between
15087 # x and y).
15088 #
15089 # html2wt disabled because it localizes the "Category" namespace.
15090 !! test
15091 Link prefix/suffixes aren't applied to category links
15092 !! options
15093 parsoid=wt2html
15094 language=is
15095 !! wikitext
15096 x[[Category:Foo]]y
15097 !! html/php
15098 <p>xy
15099 </p>
15100 !! html/parsoid
15101 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
15102 !! end
15103
15104 !! test
15105 Parsoid: Serialize link to file page with colon escape
15106 !! options
15107 parsoid
15108 !! wikitext
15109
15110 [[:File:Foo.png]]
15111 [[:File:Foo.png|Bar]]
15112 !! html
15113 <p>
15114 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
15115 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
15116 </p>
15117 !! end
15118
15119 !! test
15120 Parsoid: Serialize a genuine category link without colon escape
15121 !! options
15122 parsoid
15123 !! wikitext
15124 [[Category:Foo]]
15125 [[Category:Foo|Bar]]
15126 !! html
15127 <link rel="mw:PageProp/Category" href="./Category:Foo">
15128 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
15129 !! end
15130
15131 !! test
15132 Normalize hrefs properly before testing for invalid link targets (bug 70894)
15133 !! options
15134 parsoid=html2wt
15135 !! html/parsoid
15136 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
15137 !! wikitext
15138 [[Category:Toxine bactérienne]]
15139 !! end
15140
15141 !! test
15142 Parsoid: Defaultsort
15143 !! wikitext
15144 {{DEFAULTSORT:Foo}}
15145 !! html/parsoid
15146 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
15147 !! end
15148
15149 !! test
15150 Parsoid: Defaultsort (template-generated)
15151 !! wikitext
15152 {{{{echo|DEFAULTSORT}}:Foo}}
15153 !! html/parsoid
15154 <meta property="mw:PageProp/categorydefaultsort" content="Foo" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"{{echo|DEFAULTSORT}}:Foo"},"params":{},"i":0}}]}'/>
15155 !! end
15156
15157 ###
15158 ### Inter-language links
15159 ###
15160 !! test
15161 Interlanguage links
15162 !! options
15163 ill
15164 !! wikitext
15165 [[es:Alimento]]
15166 [[fr:Nourriture]]
15167 [[zh:食品]]
15168 !! html/php
15169 es:Alimento fr:Nourriture zh:食品
15170 !! html/parsoid
15171 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
15172 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
15173 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
15174 !! end
15175
15176 !! test
15177 Duplicate interlanguage links (bug 24502)
15178 !! options
15179 ill
15180 !! wikitext
15181 [[es:1]]
15182 [[es:2]]
15183 [[fr:1]]
15184 [[fr:2]]
15185 !! html/php
15186 es:1 fr:1
15187 !! html/parsoid
15188 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
15189 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
15190 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
15191 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
15192 !! end
15193
15194 ###
15195 ### Sections
15196 ###
15197 !! test
15198 Basic section headings
15199 !! wikitext
15200 == Headline 1 ==
15201 Some text
15202
15203 ==Headline 2==
15204 More
15205 ===Smaller headline===
15206 Blah blah
15207 !! html
15208 <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>
15209 <p>Some text
15210 </p>
15211 <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>
15212 <p>More
15213 </p>
15214 <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>
15215 <p>Blah blah
15216 </p>
15217 !! end
15218
15219 !! test
15220 Section headings with TOC
15221 !! wikitext
15222 == Headline 1 ==
15223 === Subheadline 1 ===
15224 ===== Skipping a level =====
15225 ====== Skipping a level ======
15226
15227 == Headline 2 ==
15228 Some text
15229 ===Another headline===
15230 !! html
15231 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15232 <ul>
15233 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
15234 <ul>
15235 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
15236 <ul>
15237 <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>
15238 <ul>
15239 <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>
15240 </ul>
15241 </li>
15242 </ul>
15243 </li>
15244 </ul>
15245 </li>
15246 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
15247 <ul>
15248 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
15249 </ul>
15250 </li>
15251 </ul>
15252 </div>
15253
15254 <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>
15255 <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>
15256 <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>
15257 <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>
15258 <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>
15259 <p>Some text
15260 </p>
15261 <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>
15262
15263 !! end
15264
15265 !! test
15266 TOC anchors don't collide
15267 !! wikitext
15268 __FORCETOC__
15269 == Headline 2 ==
15270 == Headline ==
15271 == Headline 2 ==
15272 == Headline ==
15273 !! html/php
15274 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15275 <ul>
15276 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
15277 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
15278 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
15279 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
15280 </ul>
15281 </div>
15282
15283 <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>
15284 <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>
15285 <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>
15286 <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>
15287
15288 !! end
15289
15290 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
15291 !! test
15292 Handling of sections up to level 6 and beyond
15293 !! wikitext
15294 = Level 1 Heading=
15295 == Level 2 Heading==
15296 === Level 3 Heading===
15297 ==== Level 4 Heading====
15298 ===== Level 5 Heading=====
15299 ====== Level 6 Heading======
15300 ======= Level 7 Heading=======
15301 ======== Level 8 Heading========
15302 ========= Level 9 Heading=========
15303 ========== Level 10 Heading==========
15304 !! html
15305 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15306 <ul>
15307 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
15308 <ul>
15309 <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>
15310 <ul>
15311 <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>
15312 <ul>
15313 <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>
15314 <ul>
15315 <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>
15316 <ul>
15317 <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>
15318 <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>
15319 <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>
15320 <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>
15321 <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>
15322 </ul>
15323 </li>
15324 </ul>
15325 </li>
15326 </ul>
15327 </li>
15328 </ul>
15329 </li>
15330 </ul>
15331 </li>
15332 </ul>
15333 </div>
15334
15335 <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>
15336 <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>
15337 <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>
15338 <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>
15339 <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>
15340 <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>
15341 <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>
15342 <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>
15343 <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>
15344 <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>
15345
15346 !! end
15347
15348 !! test
15349 TOC regression (T11764)
15350 !! wikitext
15351 == title 1 ==
15352 === title 1.1 ===
15353 ==== title 1.1.1 ====
15354 === title 1.2 ===
15355 == title 2 ==
15356 === title 2.1 ===
15357 !! html
15358 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15359 <ul>
15360 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15361 <ul>
15362 <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>
15363 <ul>
15364 <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>
15365 </ul>
15366 </li>
15367 <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>
15368 </ul>
15369 </li>
15370 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15371 <ul>
15372 <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>
15373 </ul>
15374 </li>
15375 </ul>
15376 </div>
15377
15378 <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>
15379 <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>
15380 <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>
15381 <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>
15382 <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>
15383 <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>
15384
15385 !! end
15386
15387 !! test
15388 TOC for heading containing <span id="..."></span> (T96153)
15389 !! wikitext
15390 __FORCETOC__
15391 ==<span id="old-anchor"></span>New title==
15392 !! html/php
15393 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15394 <ul>
15395 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
15396 </ul>
15397 </div>
15398
15399 <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>
15400
15401 !! end
15402
15403 !! test
15404 TOC with wgMaxTocLevel=3 (bug 6204)
15405 !! options
15406 wgMaxTocLevel=3
15407 !! wikitext
15408 == title 1 ==
15409 === title 1.1 ===
15410 ==== title 1.1.1 ====
15411 === title 1.2 ===
15412 == title 2 ==
15413 === title 2.1 ===
15414 !! html
15415 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15416 <ul>
15417 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15418 <ul>
15419 <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>
15420 <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>
15421 </ul>
15422 </li>
15423 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15424 <ul>
15425 <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>
15426 </ul>
15427 </li>
15428 </ul>
15429 </div>
15430
15431 <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>
15432 <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>
15433 <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>
15434 <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>
15435 <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>
15436 <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>
15437
15438 !! end
15439
15440 !! test
15441 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
15442 !! options
15443 wgMaxTocLevel=3
15444 !! wikitext
15445 ==Section 1==
15446 ===Section 1.1===
15447 ====Section 1.1.1====
15448 ====Section 1.1.1.1====
15449 ==Section 2==
15450 !! html
15451 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15452 <ul>
15453 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
15454 <ul>
15455 <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>
15456 </ul>
15457 </li>
15458 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
15459 </ul>
15460 </div>
15461
15462 <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>
15463 <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>
15464 <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>
15465 <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>
15466 <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>
15467
15468 !! end
15469
15470
15471 !! test
15472 Resolving duplicate section names
15473 !! wikitext
15474 == Foo bar ==
15475 == Foo bar ==
15476 !! html
15477 <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>
15478 <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>
15479
15480 !! end
15481
15482 !! test
15483 Resolving duplicate section names with differing case (bug 10721)
15484 !! wikitext
15485 == Foo bar ==
15486 == Foo Bar ==
15487 !! html
15488 <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>
15489 <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>
15490
15491 !! end
15492
15493 !! article
15494 Template:sections
15495 !! text
15496 ===Section 1===
15497 ==Section 2==
15498 !! endarticle
15499
15500 !! test
15501 Template with sections, __NOTOC__
15502 !! wikitext
15503 __NOTOC__
15504 ==Section 0==
15505 {{sections}}
15506 ==Section 4==
15507 !! html
15508 <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>
15509 <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>
15510 <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>
15511 <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>
15512
15513 !! end
15514
15515 !! test
15516 __NOEDITSECTION__ keyword
15517 !! wikitext
15518 __NOEDITSECTION__
15519 ==Section 1==
15520 ==Section 2==
15521 !! html
15522 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
15523 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
15524
15525 !! end
15526
15527 !! test
15528 Link inside a section heading
15529 !! wikitext
15530 ==Section with a [[Main Page|link]] in it==
15531 !! html
15532 <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>
15533
15534 !! end
15535
15536 !! test
15537 TOC regression (T14077)
15538 !! wikitext
15539 __TOC__
15540 == title 1 ==
15541 === title 1.1 ===
15542 == title 2 ==
15543 !! html
15544 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15545 <ul>
15546 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15547 <ul>
15548 <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>
15549 </ul>
15550 </li>
15551 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
15552 </ul>
15553 </div>
15554
15555 <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>
15556 <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>
15557 <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>
15558
15559 !! end
15560
15561 !! test
15562 BUG 1219 URL next to image (good)
15563 !! wikitext
15564 http://example.com [[File:Foobar.jpg]]
15565 !! html/php
15566 <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>
15567 </p>
15568 !! html/parsoid
15569 <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>
15570 !!end
15571
15572 !! test
15573 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
15574 !! wikitext
15575 ===
15576 The line above must have a trailing space!
15577 === <!--
15578 --> <!-- -->
15579 But just in case it doesn't...
15580 !! html
15581 <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>
15582 <p>The line above must have a trailing space!
15583 </p>
15584 <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>
15585 <p>But just in case it doesn't...
15586 </p>
15587 !! end
15588
15589 !! test
15590 Header with special characters (bug 25462)
15591 !! wikitext
15592 The tooltips shall not show entities to the user (ie. be double escaped)
15593
15594 == text > text ==
15595 section 1
15596
15597 == text < text ==
15598 section 2
15599
15600 == text & text ==
15601 section 3
15602
15603 == text ' text ==
15604 section 4
15605
15606 == text " text ==
15607 section 5
15608 !! html
15609 <p>The tooltips shall not show entities to the user (ie. be double escaped)
15610 </p>
15611 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15612 <ul>
15613 <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>
15614 <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>
15615 <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>
15616 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
15617 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
15618 </ul>
15619 </div>
15620
15621 <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>
15622 <p>section 1
15623 </p>
15624 <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>
15625 <p>section 2
15626 </p>
15627 <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>
15628 <p>section 3
15629 </p>
15630 <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>
15631 <p>section 4
15632 </p>
15633 <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>
15634 <p>section 5
15635 </p>
15636 !! end
15637
15638 !! test
15639 Header with space, plus and underscore as entity
15640 !! wikitext
15641 Id should not contain + for spaces
15642
15643 == Space between Text ==
15644 section 1
15645
15646 == Space-Entity&#32;between&#32;Text ==
15647 section 2
15648
15649 == Plus+between+Text ==
15650 section 3
15651
15652 == Plus-Entity&#43;between&#43;Text ==
15653 section 4
15654
15655 == Underscore_between_Text ==
15656 section 5
15657
15658 == Underscore-Entity&#95;between&#95;Text ==
15659 section 6
15660
15661 [[#Space between Text]]
15662 [[#Space-Entity&#32;between&#32;Text]]
15663 [[#Plus+between+Text]]
15664 [[#Plus-Entity&#43;between&#43;Text]]
15665 [[#Underscore_between_Text]]
15666 [[#Underscore-Entity&#95;between&#95;Text]]
15667 !! html
15668 <p>Id should not contain + for spaces
15669 </p>
15670 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15671 <ul>
15672 <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>
15673 <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>
15674 <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>
15675 <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>
15676 <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>
15677 <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>
15678 </ul>
15679 </div>
15680
15681 <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>
15682 <p>section 1
15683 </p>
15684 <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>
15685 <p>section 2
15686 </p>
15687 <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>
15688 <p>section 3
15689 </p>
15690 <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>
15691 <p>section 4
15692 </p>
15693 <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>
15694 <p>section 5
15695 </p>
15696 <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>
15697 <p>section 6
15698 </p><p><a href="#Space_between_Text">#Space between Text</a>
15699 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
15700 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
15701 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
15702 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
15703 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
15704 </p>
15705 !! end
15706
15707 !! test
15708 Headers with excess '=' characters
15709 (Are similar tests necessary beyond the 1st level?)
15710 !! wikitext
15711 =foo==
15712 ==foo=
15713 =''italic'' heading==
15714 ==''italic'' heading=
15715 !! html
15716 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15717 <ul>
15718 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
15719 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
15720 <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>
15721 <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>
15722 </ul>
15723 </div>
15724
15725 <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>
15726 <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>
15727 <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>
15728 <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>
15729
15730 !! end
15731
15732 !! test
15733 HTML headers vs TOC (bug 23393)
15734 (__NOEDITSECTION__ for clearer output, doesn't matter here)
15735 !! wikitext
15736 <h1>Header 1</h1>
15737 == Header 1.1 ==
15738 == Header 1.2 ==
15739
15740 <h1>Header 2
15741 </h1>
15742 == Header 2.1 ==
15743 == Header 2.2 ==
15744 __NOEDITSECTION__
15745 !! html
15746 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15747 <ul>
15748 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
15749 <ul>
15750 <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>
15751 <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>
15752 </ul>
15753 </li>
15754 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
15755 <ul>
15756 <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>
15757 <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>
15758 </ul>
15759 </li>
15760 </ul>
15761 </div>
15762
15763 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
15764 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
15765 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
15766 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
15767 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
15768 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
15769
15770 !! end
15771
15772 !! test
15773 Single-line or multiline-comments can follow headings
15774 !! options
15775 parsoid=wt2html,wt2wt
15776 !! wikitext
15777 ==foo==<!---->
15778 ==bar==<!--c1-->
15779 ==baz==<!--
15780 c2
15781 c3-->
15782 !! html
15783 <h2><span class="mw-headline" id="foo">foo</span></h2>
15784 <h2><span class="mw-headline" id="bar">bar</span></h2>
15785 <h2><span class="mw-headline" id="baz">baz</span></h2>
15786
15787 !! end
15788
15789 !! test
15790 BUG 1219 URL next to image (broken)
15791 !! wikitext
15792 http://example.com[[File:Foobar.jpg]]
15793 !! html/php
15794 <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>
15795 </p>
15796 !! html/parsoid
15797 <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>
15798 !!end
15799
15800 !! test
15801 Bug 1186 news: in the middle of text
15802 !! wikitext
15803 http://en.wikinews.org/wiki/Wikinews:Workplace
15804 !! html
15805 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
15806 </p>
15807 !!end
15808
15809
15810 !! test
15811 Namespaced link must have a title
15812 !! wikitext
15813 [[Project:]]
15814 !! html
15815 <p>[[Project:]]
15816 </p>
15817 !!end
15818
15819 !! test
15820 Namespaced link must have a title (bad fragment version)
15821 !! wikitext
15822 [[Project:#fragment]]
15823 !! html
15824 <p>[[Project:#fragment]]
15825 </p>
15826 !!end
15827
15828
15829 ###
15830 ### HTML tags and HTML attributes
15831 ###
15832
15833 !! test
15834 div with no attributes
15835 !! wikitext
15836 <div>HTML rocks</div>
15837 !! html
15838 <div>HTML rocks</div>
15839
15840 !! end
15841
15842 !! test
15843 div with double-quoted attribute
15844 !! wikitext
15845 <div id="rock">HTML rocks</div>
15846 !! html
15847 <div id="rock">HTML rocks</div>
15848
15849 !! end
15850
15851 !! test
15852 div with single-quoted attribute
15853 !! wikitext
15854 <div id='rock'>HTML rocks</div>
15855 !! html
15856 <div id="rock">HTML rocks</div>
15857
15858 !! end
15859
15860 !! test
15861 div with unquoted attribute
15862 !! wikitext
15863 <div id=rock>HTML rocks</div>
15864 !! html
15865 <div id="rock">HTML rocks</div>
15866
15867 !! end
15868
15869 !! test
15870 div with illegal double attributes
15871 !! wikitext
15872 <div id="a" id="b">HTML rocks</div>
15873 !! html
15874 <div id="b">HTML rocks</div>
15875
15876 !!end
15877
15878 !! test
15879 div with empty attribute value, space before equals
15880 !! options
15881 parsoid=wt2html,html2html
15882 !! wikitext
15883 <div class =>HTML rocks</div>
15884 !! html/php
15885 <div class="">HTML rocks</div>
15886
15887 !! html/parsoid
15888 <div class="" data-parsoid='{"stx":"html"}'>HTML rocks</div>
15889 !! end
15890
15891 !! test
15892 div with multiple empty attribute values
15893 !! options
15894 parsoid=wt2html,html2html
15895 !! wikitext
15896 <div id= title=>HTML rocks</div>
15897 !! html/php
15898 <div id="title.3D">HTML rocks</div>
15899
15900 !! html/parsoid
15901 <div id="title=" data-parsoid='{"stx":"html"}'>HTML rocks</div>
15902 !! end
15903
15904 !! test
15905 table with multiple empty attribute values
15906 !! options
15907 parsoid=wt2html,html2html
15908 !! wikitext
15909 {| title= id=
15910 | hi
15911 |}
15912 !! html/php
15913 <table title="id=">
15914 <tr>
15915 <td> hi
15916 </td></tr></table>
15917
15918 !! html/parsoid
15919 <table title="id=">
15920 <tbody><tr><td> hi</td></tr>
15921 </tbody></table>
15922 !! end
15923
15924 !! test
15925 div with braces in attribute value
15926 !! wikitext
15927 <div title="{}">Foo</div>
15928 !! html/php
15929 <div title="&#123;}">Foo</div>
15930
15931 !! html/parsoid
15932 <div title="{}">Foo</div>
15933 !! end
15934
15935 !! test
15936 div with empty attribute value, no space before equals
15937 !! options
15938 parsoid=wt2html,html2html
15939 !! wikitext
15940 <div class=>HTML rocks</div>
15941 !! html/php
15942 <div class="">HTML rocks</div>
15943
15944 !! html/parsoid
15945 <div class="">HTML rocks</div>
15946 !! end
15947
15948 !! test
15949 HTML multiple attributes correction
15950 !! wikitext
15951 <p class="error" class="awesome">Awesome!</p>
15952 !! html
15953 <p class="awesome">Awesome!</p>
15954
15955 !!end
15956
15957 !! test
15958 Table multiple attributes correction
15959 !! wikitext
15960 {|
15961 !+ class="error" class="awesome"| status
15962 |}
15963 !! html
15964 <table>
15965 <tr>
15966 <th class="awesome"> status
15967 </th></tr></table>
15968
15969 !!end
15970
15971 !! test
15972 DIV IN UPPERCASE
15973 !! wikitext
15974 <DIV ID="x">HTML ROCKS</DIV>
15975 !! html
15976 <div id="x">HTML ROCKS</div>
15977
15978 !!end
15979
15980 !! test
15981 Non-ASCII pseudo-tags are rendered as text
15982 !! wikitext
15983 <khyô>
15984 !! html
15985 <p>&lt;khyô&gt;
15986 </p>
15987 !! end
15988
15989 !! test
15990 Pseudo-tag with URL 'name' renders as url link
15991 !! wikitext
15992 <http://example.com/>
15993 !! html
15994 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
15995 </p>
15996 !! end
15997
15998 !! test
15999 text with amp in the middle of nowhere
16000 !! wikitext
16001 Remember AT&T?
16002 !! html
16003 <p>Remember AT&amp;T?
16004 </p>
16005 !! end
16006
16007 !! test
16008 text with character entity: eacute
16009 !! wikitext
16010 I always thought &eacute; was a cute letter.
16011 !! html
16012 <p>I always thought &#233; was a cute letter.
16013 </p>
16014 !! html+tidy
16015 <p>I always thought é was a cute letter.</p>
16016 !! end
16017
16018 !! test
16019 text with entity-escaped character entity-like string: eacute
16020 !! wikitext
16021 I always thought &amp;eacute; was a cute letter.
16022 !! html
16023 <p>I always thought &amp;eacute; was a cute letter.
16024 </p>
16025 !! end
16026
16027 !! test
16028 text with undefined character entity: xacute
16029 !! wikitext
16030 I always thought &xacute; was a cute letter.
16031 !! html
16032 <p>I always thought &amp;xacute; was a cute letter.
16033 </p>
16034 !! end
16035
16036 !! test
16037 HTML5 tags
16038 !! wikitext
16039 <data value="5">five</data>
16040 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
16041 <mark>This highlighted text</mark>
16042 !! html
16043 <p><data value="5">five</data>
16044 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
16045 <mark>This highlighted text</mark>
16046 </p>
16047 !! end
16048
16049 !! test
16050 HTML tag with leading space is parsed as text
16051 !! wikitext
16052 < div>foo< /div>
16053 !! html
16054 <p>&lt; div&gt;foo&lt; /div&gt;
16055 </p>
16056 !! end
16057
16058 ###
16059 ### Nesting tests (see bug 41545, 50604, 51081)
16060 ###
16061
16062 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
16063 # Note that html2wt is considerably more difficult if we use <b> in
16064 # the test case, instead of <big>
16065 !! test
16066 Ensure that HTML adoption agency algorithm is properly implemented.
16067 !! wikitext
16068 <big>X<big>Y</big>Z</big>
16069 !! html
16070 <p><big>X<big>Y</big>Z</big>
16071 </p>
16072 !! end
16073
16074 # This was bug 41545 in the PHP parser.
16075 # Note that tidy doesn't handle this correctly.
16076 !! test
16077 Nesting of <kbd>
16078 !! wikitext
16079 <kbd>X<kbd>Y</kbd>Z</kbd>
16080 !! html
16081 <p><kbd>X<kbd>Y</kbd>Z</kbd>
16082 </p>
16083 !! end
16084
16085 # The following cases were bug 51081 in the PHP parser.
16086 # Note that there are some other nestable tags (b, i, etc) which are
16087 # not covered; see bug 51081 for discussion.
16088
16089 # Note that tidy doesn't handle this correctly.
16090 !! test
16091 Nesting of <em>
16092 !! wikitext
16093 <em>X<em>Y</em>Z</em>
16094 !! html
16095 <p><em>X<em>Y</em>Z</em>
16096 </p>
16097 !! end
16098
16099 # Note that tidy doesn't handle this correctly.
16100 !! test
16101 Nesting of <strong>
16102 !! wikitext
16103 <strong>X<strong>Y</strong>Z</strong>
16104 !! html
16105 <p><strong>X<strong>Y</strong>Z</strong>
16106 </p>
16107 !! end
16108
16109 !! test
16110 Nesting of <q>
16111 !! wikitext
16112 <q>X<q>Y</q>Z</q>
16113 !! html+tidy
16114 <p><q>X<q>Y</q>Z</q></p>
16115 !! end
16116
16117 # Note that tidy doesn't handle this correctly.
16118 !! test
16119 Nesting of <ruby>
16120 !! wikitext
16121 <ruby>X<ruby>Y</ruby>Z</ruby>
16122 !! html
16123 <p><ruby>X<ruby>Y</ruby>Z</ruby>
16124 </p>
16125 !! end
16126
16127 # Note that tidy doesn't handle this correctly.
16128 !! test
16129 Nesting of <bdo>
16130 !! wikitext
16131 <bdo>X<bdo>Y</bdo>Z</bdo>
16132 !! html
16133 <p><bdo>X<bdo>Y</bdo>Z</bdo>
16134 </p>
16135 !! end
16136
16137
16138 ###
16139 ### Media links
16140 ###
16141
16142 !! test
16143 Media link
16144 !! wikitext
16145 [[Media:Foobar.jpg]]
16146 !! html
16147 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
16148 </p>
16149 !! end
16150
16151 !! test
16152 Media link with text
16153 !! wikitext
16154 [[Media:Foobar.jpg|A neat file to look at]]
16155 !! html
16156 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
16157 </p>
16158 !! end
16159
16160 # FIXME: this is still bad HTML tag nesting
16161 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
16162 !! test
16163 Media link with nasty text
16164 !! wikitext
16165 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
16166 !! html
16167 <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>
16168
16169 !! html+tidy
16170 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
16171 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
16172 !! end
16173
16174 !! test
16175 Media link to nonexistent file (bug 1702)
16176 !! wikitext
16177 [[Media:No such.jpg]]
16178 !! html
16179 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
16180 </p>
16181 !! end
16182
16183 !! test
16184 Image link to nonexistent file (bug 1850 - good)
16185 !! wikitext
16186 [[File:No_such.jpg]]
16187 !! html/php
16188 <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>
16189 </p>
16190 !! html/parsoid
16191 <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>
16192 !! end
16193
16194 !! test
16195 :Image link to nonexistent file (bug 1850 - bad)
16196 !! wikitext
16197 [[:Image:No such.jpg]]
16198 !! html/php
16199 <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>
16200 </p>
16201 !! html/parsoid
16202 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
16203 !! end
16204
16205
16206
16207 !! test
16208 Character reference normalization in link text (bug 1938)
16209 !! wikitext
16210 [[Main Page|this&that]]
16211 !! html
16212 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
16213 </p>
16214 !!end
16215
16216 !! article
16217 אַ
16218 !! text
16219 Test for unicode normalization
16220
16221 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
16222 !! endarticle
16223
16224 !! test
16225 (bug 19451) Links should refer to the normalized form.
16226 !! wikitext
16227 [[&#xFB2E;]]
16228 [[&#x5d0;&#x5b7;]]
16229 [[&#x5d0;ַ]]
16230 [[א&#x5b7;]]
16231 [[אַ]]
16232 !! html
16233 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
16234 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
16235 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
16236 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
16237 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
16238 </p>
16239 !! end
16240
16241 !! test
16242 Empty attribute crash test (bug 2067)
16243 !! wikitext
16244 <font color="">foo</font>
16245 !! html
16246 <p><font color="">foo</font>
16247 </p>
16248 !! end
16249
16250 !! test
16251 Empty attribute crash test single-quotes (bug 2067)
16252 !! wikitext
16253 <font color=''>foo</font>
16254 !! html
16255 <p><font color="">foo</font>
16256 </p>
16257 !! end
16258
16259 !! test
16260 Attribute test: equals, then nothing
16261 !! options
16262 parsoid=wt2html,html2html
16263 !! wikitext
16264 <font color=>foo</font>
16265 !! html/php
16266 <p><font color="">foo</font>
16267 </p>
16268 !! html/parsoid
16269 <p><font color="" data-parsoid='{"stx":"html"}'>foo</font></p>
16270 !! end
16271
16272 !! test
16273 Attribute test: unquoted value
16274 !! options
16275 parsoid=wt2html,html2html
16276 !! wikitext
16277 <font color=x>foo</font>
16278 !! html/php
16279 <p><font color="x">foo</font>
16280 </p>
16281 !! html/parsoid
16282 <p><font color="x" data-parsoid='{"stx":"html"}'>foo</font></p>
16283 !! end
16284
16285 !! test
16286 Attribute test: unquoted but illegal value (hash)
16287 !! wikitext
16288 <font color=#x>foo</font>
16289 !! html
16290 <p><font color="#x">foo</font>
16291 </p>
16292 !! end
16293
16294 # Parsoid does not serialize to empty attribute syntax,
16295 # so wt2wt and html2wt cases are skipped
16296 !! test
16297 Attribute test: no value (T54330)
16298 !! options
16299 parsoid=wt2html,html2html
16300 !! wikitext
16301 <font color>foo</font>
16302 !! html/php
16303 <p><font color="">foo</font>
16304 </p>
16305 !! html/parsoid
16306 <p><font color="">foo</font></p>
16307 !! end
16308
16309 !! test
16310 Bug 2095: link with three closing brackets
16311 !! wikitext
16312 [[Main Page]]]
16313 !! html/php
16314 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
16315 </p>
16316 !! html/parsoid
16317 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
16318 !! end
16319
16320 !! test
16321 Bug 2095: link with pipe and three closing brackets
16322 !! wikitext
16323 [[Main Page|link]]]
16324 !! html/php
16325 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
16326 </p>
16327 !! html/parsoid
16328 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
16329 !! end
16330
16331 !! test
16332 Bug 2095: link with pipe and three closing brackets, version 2
16333 !! wikitext
16334 [[Main Page|[http://example.com/]]]
16335 !! html/php
16336 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
16337 </p>
16338 !! html/parsoid
16339 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
16340 !! end
16341
16342
16343 ###
16344 ### Safety
16345 ###
16346
16347 !! article
16348 Template:Dangerous attribute
16349 !! text
16350 " onmouseover="alert(document.cookie)
16351 !! endarticle
16352
16353 !! article
16354 Template:Dangerous style attribute
16355 !! text
16356 border-size: expression(alert(document.cookie))
16357 !! endarticle
16358
16359 !! article
16360 Template:Div style
16361 !! text
16362 <div style="float: right; {{{1}}}">Magic div</div>
16363 !! endarticle
16364
16365 !! test
16366 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
16367 !! wikitext
16368 <div title="{{test}}"></div>
16369 !! html
16370 <div title="This is a test template"></div>
16371
16372 !! end
16373
16374 # Parsoid has enough context to handle this case
16375 !! test
16376 Bug 2304: HTML attribute safety (dangerous template; 2309)
16377 !! wikitext
16378 <div title="{{dangerous attribute}}"></div>
16379 !! html/php
16380 <div title=""></div>
16381
16382 !! html/parsoid
16383 <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=&#39;{\"pi\":[[]],\"dsr\":[12,35,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"dangerous attribute\",\"href\":\"./Template:Dangerous_attribute\"},\"params\":{},\"i\":0}}]}&#39;>\" onmouseover=\"alert(document.cookie)&lt;/span>"}]]}'></div>
16384 !! end
16385
16386 !! test
16387 Bug 2304: HTML attribute safety (dangerous style template; 2309)
16388 !! wikitext
16389 <div style="{{dangerous style attribute}}"></div>
16390 !! html
16391 <div style="/* insecure input */"></div>
16392
16393 !! end
16394
16395 !! test
16396 Bug 2304: HTML attribute safety (safe parameter; 2309)
16397 !! wikitext
16398 {{div style|width: 200px}}
16399 !! html
16400 <div style="float: right; width: 200px">Magic div</div>
16401
16402 !! end
16403
16404 !! test
16405 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
16406 !! wikitext
16407 {{div style|width: expression(alert(document.cookie))}}
16408 !! html
16409 <div style="/* insecure input */">Magic div</div>
16410
16411 !! end
16412
16413 !! test
16414 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
16415 !! wikitext
16416 {{div style|"><script>alert(document.cookie)</script>}}
16417 !! html
16418 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16419
16420 !! end
16421
16422 !! test
16423 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
16424 !! wikitext
16425 {{div style|" ><script>alert(document.cookie)</script>}}
16426 !! html
16427 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16428
16429 !! end
16430
16431 !! test
16432 Bug 2304: HTML attribute safety (link)
16433 !! wikitext
16434 <div title="[[Main Page]]"></div>
16435 !! html
16436 <div title="&#91;&#91;Main Page]]"></div>
16437
16438 !! end
16439
16440 !! test
16441 Bug 2304: HTML attribute safety (italics)
16442 !! wikitext
16443 <div title="''foobar''"></div>
16444 !! html
16445 <div title="&#39;&#39;foobar&#39;&#39;"></div>
16446
16447 !! end
16448
16449 !! test
16450 Bug 2304: HTML attribute safety (bold)
16451 !! wikitext
16452 <div title="'''foobar'''"></div>
16453 !! html
16454 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
16455
16456 !! end
16457
16458
16459 !! test
16460 Bug 2304: HTML attribute safety (ISBN)
16461 !! wikitext
16462 <div title="ISBN 1234567890"></div>
16463 !! html
16464 <div title="&#73;SBN 1234567890"></div>
16465
16466 !! end
16467
16468 !! test
16469 Bug 2304: HTML attribute safety (RFC)
16470 !! wikitext
16471 <div title="RFC 1234"></div>
16472 !! html
16473 <div title="&#82;FC 1234"></div>
16474
16475 !! end
16476
16477 !! test
16478 Bug 2304: HTML attribute safety (PMID)
16479 !! wikitext
16480 <div title="PMID 1234567890"></div>
16481 !! html
16482 <div title="&#80;MID 1234567890"></div>
16483
16484 !! end
16485
16486 !! test
16487 Bug 2304: HTML attribute safety (web link)
16488 !! wikitext
16489 <div title="http://example.com/"></div>
16490 !! html
16491 <div title="http&#58;//example.com/"></div>
16492
16493 !! end
16494
16495 !! test
16496 Bug 2304: HTML attribute safety (named web link)
16497 !! wikitext
16498 <div title="[http://example.com/ link]"></div>
16499 !! html
16500 <div title="&#91;http&#58;//example.com/ link]"></div>
16501
16502 !! end
16503
16504 !! test
16505 Bug 3244: HTML attribute safety (extension; safe)
16506 !! wikitext
16507 <div style="<nowiki>background:blue</nowiki>"></div>
16508 !! html
16509 <div style="background:blue"></div>
16510
16511 !! end
16512
16513 !! test
16514 Bug 3244: HTML attribute safety (extension; unsafe)
16515 !! wikitext
16516 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
16517 !! html
16518 <div style="/* insecure input */"></div>
16519
16520 !! end
16521
16522 # More MSIE fun discovered by Tom Gilder
16523
16524 !! test
16525 MSIE CSS safety test: spurious slash
16526 !! wikitext
16527 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
16528 !! html
16529 <div style="/* insecure input */">evil</div>
16530
16531 !! end
16532
16533 !! test
16534 MSIE CSS safety test: hex code
16535 !! wikitext
16536 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
16537 !! html
16538 <div style="/* insecure input */">evil</div>
16539
16540 !! end
16541
16542 !! test
16543 MSIE CSS safety test: comment in url
16544 !! wikitext
16545 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
16546 !! html
16547 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
16548
16549 !! end
16550
16551 !! test
16552 MSIE CSS safety test: comment in expression
16553 !! wikitext
16554 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
16555 !! html
16556 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
16557
16558 !! end
16559
16560 !! test
16561 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
16562 !! wikitext
16563 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
16564 !! html
16565 <p style="/* invalid control char */">A</p>
16566
16567 !! end
16568
16569 !! test
16570 MSIE 6 CSS safety test: Fullwidth (bug 55332)
16571 !! wikitext
16572 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
16573 <div style="top:EXPRESSION(alert())">B</div>
16574 !! html
16575 <p style="/* insecure input */">A</p>
16576 <div style="/* insecure input */">B</div>
16577
16578 !! end
16579
16580 !! test
16581 MSIE 6 CSS safety test: IPA extensions (bug 55332)
16582 !! wikitext
16583 <div style="background-image:uʀʟ(javascript:alert())">A</div>
16584 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
16585 !! html
16586 <div style="/* insecure input */">A</div>
16587 <p style="/* insecure input */">B</p>
16588
16589 !! end
16590
16591 !! test
16592 MSIE 6 CSS safety test: sup/sub script (bug 55332)
16593 !! wikitext
16594 <div style="background-image:url⁽javascript:alert())">A</div>
16595 <div style="background-image:url₍javascript:alert())">B</div>
16596 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
16597 !! html
16598 <div style="/* insecure input */">A</div>
16599 <div style="/* insecure input */">B</div>
16600 <p style="/* insecure input */">C</p>
16601
16602 !! end
16603
16604 # FIXME: Parsoid fails to sanitize this! See T58846.
16605 !! test
16606 Opera -o-link CSS
16607 !! wikitext
16608 <div
16609 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;"
16610 style="-o-link:attr(title);-o-link-source:current">X</div>
16611 !! html
16612 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
16613
16614 !! end
16615
16616 !! test
16617 MSIE 6 CSS safety test: Repetition markers (bug 55332)
16618 !! wikitext
16619 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
16620 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
16621 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
16622 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
16623 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
16624 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
16625 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
16626 !! html
16627 <p style="/* insecure input */">A</p>
16628 <p style="/* insecure input */">B</p>
16629 <p style="/* insecure input */">C</p>
16630 <p style="/* insecure input */">D</p>
16631 <p style="/* insecure input */">E</p>
16632 <p style="/* insecure input */">F</p>
16633 <p style="/* insecure input */">G</p>
16634
16635 !! end
16636
16637 !! test
16638 Table attribute legitimate extension
16639 !! wikitext
16640 {|
16641 !+ style="<nowiki>color:blue</nowiki>"| status
16642 |}
16643 !! html
16644 <table>
16645 <tr>
16646 <th style="color:blue"> status
16647 </th></tr></table>
16648
16649 !!end
16650
16651 !! test
16652 Table attribute safety
16653 !! wikitext
16654 {|
16655 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
16656 |}
16657 !! html
16658 <table>
16659 <tr>
16660 <th style="/* insecure input */"> status
16661 </th></tr></table>
16662
16663 !! end
16664
16665 !! test
16666 CSS line continuation 1
16667 !! wikitext
16668 <div style="background-image: u\&#10;rl(test.jpg);"></div>
16669 !! html
16670 <div style="/* insecure input */"></div>
16671
16672 !! end
16673
16674 !! test
16675 CSS line continuation 2
16676 !! wikitext
16677 <div style="background-image: u\&#13;rl(test.jpg); "></div>
16678 !! html
16679 <div style="/* invalid control char */"></div>
16680
16681 !! end
16682
16683 !! article
16684 Template:Identity
16685 !! text
16686 {{{1}}}
16687 !! endarticle
16688
16689 !! test
16690 Expansion of multi-line templates in attribute values (bug 6255)
16691 !! wikitext
16692 <div style="background: {{identity|#00FF00}}">-</div>
16693 !! html
16694 <div style="background: #00FF00">-</div>
16695
16696 !! end
16697
16698
16699 !! test
16700 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
16701 !! wikitext
16702 <div style="background:
16703 #00FF00">-</div>
16704 !! html/php
16705 <div style="background: #00FF00">-</div>
16706
16707 !! html/parsoid
16708 <div style="background:
16709 #00FF00">-</div>
16710 !! end
16711
16712 !! test
16713 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
16714 !! wikitext
16715 <div style="background: &#10;#00FF00">-</div>
16716 !! html
16717 <div style="background: &#10;#00FF00">-</div>
16718
16719 !! end
16720
16721 !! test
16722 Tags which are hidden from Tidy cannot pass through the Sanitizer
16723 !! wikitext
16724 <mw:toc><script>alert();</script></mw:toc>
16725 !! html+tidy
16726 <p>&lt;mw:toc&gt;&lt;script&gt;alert();&lt;/script&gt;&lt;/mw:toc&gt;</p>
16727 !! end
16728
16729 ###
16730 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
16731 ###
16732 !! test
16733 Parser hook: empty input
16734 !! wikitext
16735 <tag></tag>
16736 !! html/php
16737 <pre>
16738 ''
16739 array (
16740 )
16741 </pre>
16742
16743 !! html/parsoid
16744 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16745 !! end
16746
16747 ## Don't expect parsoid to rt this form.
16748 !! test
16749 Parser hook: empty input using terminated empty elements
16750 !! options
16751 parsoid=wt2html,html2html
16752 !! wikitext
16753 <tag/>
16754 !! html/php
16755 <pre>
16756 NULL
16757 array (
16758 )
16759 </pre>
16760
16761 !! html/parsoid
16762 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16763 !! end
16764
16765 !! test
16766 Parser hook: empty input using terminated empty elements (space before)
16767 !! wikitext
16768 <tag />
16769 !! html/php
16770 <pre>
16771 NULL
16772 array (
16773 )
16774 </pre>
16775
16776 !! html/parsoid
16777 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16778 !! end
16779
16780 !! test
16781 Parser hook: basic input
16782 !! wikitext
16783 <tag>input</tag>
16784 !! html/php
16785 <pre>
16786 'input'
16787 array (
16788 )
16789 </pre>
16790
16791 !! html/parsoid
16792 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16793 !! end
16794
16795 ## Don't expect parsoid to rt this form.
16796 !! test
16797 Parser hook: case insensitive
16798 !! options
16799 parsoid=wt2html,html2html
16800 !! wikitext
16801 <TAG>input</TAG>
16802 !! html/php
16803 <pre>
16804 'input'
16805 array (
16806 )
16807 </pre>
16808
16809 !! html/parsoid
16810 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16811 !! end
16812
16813 ## Don't expect parsoid to rt this form.
16814 !! test
16815 Parser hook: case insensitive, redux
16816 !! options
16817 parsoid=wt2html,html2html
16818 !! wikitext
16819 <TaG>input</TAg>
16820 !! html/php
16821 <pre>
16822 'input'
16823 array (
16824 )
16825 </pre>
16826
16827 !! html/parsoid
16828 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16829 !! end
16830
16831 !! test
16832 Parser hook: nested tags
16833 !! wikitext
16834 <tag><tag></tag></tag>
16835 !! html/php
16836 <pre>
16837 '<tag>'
16838 array (
16839 )
16840 </pre>&lt;/tag&gt;
16841
16842 !! html/parsoid
16843 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}' data-parsoid='{}' about="#mwt2"></pre>&lt;/tag>
16844 !! end
16845
16846 !! test
16847 Parser hook: basic arguments
16848 !! wikitext
16849 <tag width="200" height="100" depth="50" square=""></tag>
16850 !! html/php
16851 <pre>
16852 ''
16853 array (
16854 'width' => '200',
16855 'height' => '100',
16856 'depth' => '50',
16857 'square' => '',
16858 )
16859 </pre>
16860
16861 !! html/parsoid
16862 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16863 !! end
16864
16865 ## Don't expect parsoid to rt this form.
16866 !! test
16867 Parser hook: basic arguments, variations
16868 !! options
16869 parsoid=wt2html,html2html
16870 !! wikitext
16871 <tag width=200 height = "100" depth = '50' square></tag>
16872 !! html/php
16873 <pre>
16874 ''
16875 array (
16876 'width' => '200',
16877 'height' => '100',
16878 'depth' => '50',
16879 'square' => '',
16880 )
16881 </pre>
16882
16883 !! html/parsoid
16884 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16885 !! end
16886
16887 !! test
16888 Parser hook: argument containing a forward slash (bug 5344)
16889 !! wikitext
16890 <tag filename="/tmp/bla"></tag>
16891 !! html/php
16892 <pre>
16893 ''
16894 array (
16895 'filename' => '/tmp/bla',
16896 )
16897 </pre>
16898
16899 !! html/parsoid
16900 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16901 !! end
16902
16903 ## Don't expect parsoid to rt this form.
16904 !! test
16905 Parser hook: empty input using terminated empty elements (bug 2374)
16906 !! options
16907 parsoid=wt2html,html2html
16908 !! wikitext
16909 <tag foo=bar/>text
16910 !! html/php
16911 <pre>
16912 NULL
16913 array (
16914 'foo' => 'bar',
16915 )
16916 </pre>text
16917
16918 !! html/parsoid
16919 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"foo":"bar"},"body":null}' data-parsoid='{}' about="#mwt2"></pre>text
16920 !! end
16921
16922 ## </tag> should be output literally since there is no matching tag that begins it
16923 ## Don't expect parsoid to rt this form.
16924 !! test
16925 Parser hook: basic arguments using terminated empty elements (bug 2374)
16926 !! options
16927 parsoid=wt2html
16928 !! wikitext
16929 <tag width=200 height = "100" depth = '50' square/>
16930 other stuff
16931 </tag>
16932 !! html/php
16933 <pre>
16934 NULL
16935 array (
16936 'width' => '200',
16937 'height' => '100',
16938 'depth' => '50',
16939 'square' => '',
16940 )
16941 </pre>
16942 <p>other stuff
16943 &lt;/tag&gt;
16944 </p>
16945 !! html/parsoid
16946 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":null}' about="#mwt2"></pre><p>other stuff
16947 &lt;/tag></p>
16948 !! end
16949
16950 ## Don't expect parsoid to rt this form.
16951 !! test
16952 Parser hook: Don't allow unclosed extension tags
16953 !! options
16954 parsoid=wt2html
16955 !! wikitext
16956 test <tag>123
16957
16958 this is a '''test'''
16959 !! html/php
16960 <p>test &lt;tag&gt;123
16961 </p><p>this is a <b>test</b>
16962 </p>
16963 !! html/parsoid
16964 <p>test &lt;tag>123</p>
16965
16966 <p>this is a <b>test</b></p>
16967 !! end
16968
16969 ###
16970 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
16971 ###
16972
16973 !! test
16974 Parser hook: static parser hook not inside a comment
16975 !! wikitext
16976 <statictag>hello, world</statictag>
16977
16978 <statictag action="flush" />
16979 !! html/php
16980 <p><br />
16981 hello, world
16982 </p>
16983 !! html/parsoid
16984 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
16985 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt4">hello, world</p>
16986 !! end
16987
16988 !! test
16989 Parser hook: static parser hook inside a comment
16990 !! wikitext
16991 <!-- <statictag>hello, world</statictag> -->
16992 <statictag action="flush" />
16993 !! html/php
16994 <p><br />
16995 </p>
16996 !! html/parsoid
16997 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
16998 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt2"></p>
16999 !! end
17000
17001 # Nested template calls; this case was broken by Parser.php rev 1.506,
17002 # since reverted.
17003
17004 !! article
17005 Template:One-parameter
17006 !! text
17007 (My parameter is: {{{1}}})
17008 !! endarticle
17009
17010 !! article
17011 Template:Map-one-parameter
17012 !! text
17013 {{{{{1}}}|{{{2}}}}}
17014 !! endarticle
17015
17016 !! test
17017 Nested template calls
17018 !! wikitext
17019 {{Map-one-parameter|One-parameter|param}}
17020 !! html
17021 <p>(My parameter is: param)
17022 </p>
17023 !! end
17024
17025
17026 ###
17027 ### Sanitizer
17028 ###
17029
17030 # HTML+Tidy effectively strips out the empty tags completely
17031 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
17032 # which Tidy would have done for the PHP parser had there been content inside it.
17033 !! test
17034 Sanitizer: Closing of open tags
17035 !! wikitext
17036 <s></s><table></table>
17037 !! html
17038 <s></s><table></table>
17039
17040 !! html/parsoid
17041 <p><s></s></p><table></table>
17042 !! end
17043
17044 !! test
17045 Sanitizer: Closing of open but not closed tags
17046 !! wikitext
17047 <s>foo
17048 !! html
17049 <p><s>foo</s>
17050 </p>
17051 !! end
17052
17053 !! test
17054 Sanitizer: Closing of closed but not open tags
17055 !! options
17056 parsoid=wt2html
17057 !! wikitext
17058 </s>
17059 !! html/php+tidy
17060 !! html/parsoid
17061 !! end
17062
17063 !! test
17064 Sanitizer: Closing of closed but not open table tags
17065 !! options
17066 parsoid=wt2html
17067 !! wikitext
17068 Table not started</td></tr></table>
17069 !! html/php+tidy
17070 <p>Table not started</p>
17071 !! html/parsoid
17072 <p>Table not started</p>
17073 !! end
17074
17075 !! test
17076 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
17077 !! wikitext
17078 <span id="æ: v">byte</span>[[#æ: v|backlink]]
17079 !! html
17080 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
17081 </p>
17082 !! end
17083
17084 # In HTML5, the restrictions are that id must contain at least one character,
17085 # and must not contain any space characters.
17086 !! test
17087 Sanitizer: Validating the contents of the id attribute (bug 4515)
17088 !! options
17089 disabled
17090 !! wikitext
17091 <br id="" /><br id="a space" />
17092 !! html
17093 Something ...
17094 !! end
17095
17096 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
17097 !! test
17098 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
17099 !! options
17100 disabled
17101 !! wikitext
17102 <br id="foo" /><br id="foo" />
17103 !! html
17104 Something need to be done. foo-2 ?
17105 !! end
17106
17107 !! test
17108 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
17109 !! wikitext
17110 <div itemscope>
17111 <meta itemprop="hello" content="world">
17112 <meta http-equiv="refresh" content="5">
17113 <meta itemprop="hello" http-equiv="refresh" content="5">
17114 <link itemprop="hello" href="{{SERVER}}">
17115 <link rel="stylesheet" href="{{SERVER}}">
17116 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
17117 </div>
17118 !! html
17119 <div itemscope="">
17120 <p> <meta itemprop="hello" content="world" />
17121 &lt;meta http-equiv="refresh" content="5"&gt;
17122 <meta itemprop="hello" content="5" />
17123 </p>
17124 <link itemprop="hello" href="http&#58;//example.org" />
17125 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
17126 <link itemprop="hello" href="http&#58;//example.org" />
17127 </div>
17128
17129 !! end
17130
17131 !! test
17132 Language converter: output gets cut off unexpectedly (bug 5757)
17133 !! options
17134 language=zh
17135 !! wikitext
17136 this bit is safe: }-
17137
17138 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
17139
17140 then we get cut off here: }-
17141
17142 all additional text is vanished
17143 !! html
17144 <p>this bit is safe: }-
17145 </p><p>but if we add a conversion instance: xxx
17146 </p><p>then we get cut off here: }-
17147 </p><p>all additional text is vanished
17148 </p>
17149 !! end
17150
17151 !! test
17152 Self closed html pairs (bug 5487)
17153 !! options
17154 !! wikitext
17155 <center><font id="bug" />Centered text</center>
17156 <div><font id="bug2" />In div text</div>
17157 !! html
17158 <center>&lt;font id="bug" /&gt;Centered text</center>
17159 <div>&lt;font id="bug2" /&gt;In div text</div>
17160
17161 !! end
17162
17163 #
17164 #
17165 #
17166
17167 !! test
17168 Punctuation: nbsp before exclamation
17169 !! wikitext
17170 C'est grave !
17171 !! html
17172 <p>C'est grave&#160;!
17173 </p>
17174 !! end
17175
17176 !! test
17177 Punctuation: CSS !important (bug 11874)
17178 !! wikitext
17179 <div style="width:50% !important">important</div>
17180 !! html
17181 <div style="width:50% !important">important</div>
17182
17183 !!end
17184
17185 !! test
17186 Punctuation: CSS ! important (bug 11874; with space after)
17187 !! wikitext
17188 <div style="width:50% ! important">important</div>
17189 !! html
17190 <div style="width:50% ! important">important</div>
17191
17192 !!end
17193
17194 !! test
17195 HTML bullet list, closed tags (bug 5497)
17196 !! wikitext
17197 <ul>
17198 <li>One</li>
17199 <li>Two</li>
17200 </ul>
17201 !! html/php
17202 <ul>
17203 <li>One</li>
17204 <li>Two</li>
17205 </ul>
17206
17207 !! html/parsoid
17208 <ul data-parsoid='{"stx":"html"}'>
17209 <li data-parsoid='{"stx":"html"}'>One</li>
17210 <li data-parsoid='{"stx":"html"}'>Two</li>
17211 </ul>
17212
17213 !! end
17214
17215 !! test
17216 HTML bullet list, unclosed tags (bug 5497)
17217 !! wikitext
17218 <ul>
17219 <li>One
17220 <li>Two
17221 </ul>
17222 !! html/php+tidy
17223 <ul>
17224 <li>One</li>
17225 <li>Two</li>
17226 </ul>
17227 !! html/parsoid
17228 <ul data-parsoid='{"stx":"html"}'>
17229 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
17230 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
17231 </ul>
17232
17233 !! end
17234
17235 !! test
17236 HTML ordered list, closed tags (bug 5497)
17237 !! wikitext
17238 <ol>
17239 <li>One</li>
17240 <li>Two</li>
17241 </ol>
17242 !! html/php
17243 <ol>
17244 <li>One</li>
17245 <li>Two</li>
17246 </ol>
17247
17248 !! html/parsoid
17249 <ol data-parsoid='{"stx":"html"}'>
17250 <li data-parsoid='{"stx":"html"}'>One</li>
17251 <li data-parsoid='{"stx":"html"}'>Two</li>
17252 </ol>
17253
17254 !! end
17255
17256 !! test
17257 HTML ordered list, unclosed tags (bug 5497)
17258 !! options
17259 !! wikitext
17260 <ol>
17261 <li>One
17262 <li>Two
17263 </ol>
17264 !! html/php+tidy
17265 <ol>
17266 <li>One</li>
17267 <li>Two</li>
17268 </ol>
17269 !! html/parsoid
17270 <ol data-parsoid='{"stx":"html"}'>
17271 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
17272 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
17273 </ol>
17274
17275 !! end
17276
17277 !! test
17278 HTML nested bullet list, closed tags (bug 5497)
17279 !! wikitext
17280 <ul>
17281 <li>One</li>
17282 <li>Two:
17283 <ul>
17284 <li>Sub-one</li>
17285 <li>Sub-two</li>
17286 </ul>
17287 </li>
17288 </ul>
17289 !! html/php
17290 <ul>
17291 <li>One</li>
17292 <li>Two:
17293 <ul>
17294 <li>Sub-one</li>
17295 <li>Sub-two</li>
17296 </ul>
17297 </li>
17298 </ul>
17299
17300 !! html/parsoid
17301 <ul data-parsoid='{"stx":"html"}'>
17302 <li data-parsoid='{"stx":"html"}'>One</li>
17303 <li data-parsoid='{"stx":"html"}'>Two:
17304 <ul data-parsoid='{"stx":"html"}'>
17305 <li data-parsoid='{"stx":"html"}'>Sub-one</li>
17306 <li data-parsoid='{"stx":"html"}'>Sub-two</li>
17307 </ul>
17308 </li>
17309 </ul>
17310 !! end
17311
17312 !! test
17313 HTML nested bullet list, open tags (bug 5497)
17314 !! wikitext
17315 <ul>
17316 <li>One
17317 <li>Two:
17318 <ul>
17319 <li>Sub-one
17320 <li>Sub-two
17321 </ul>
17322 </ul>
17323 !! html/php+tidy
17324 <ul>
17325 <li>One</li>
17326 <li>Two:
17327 <ul>
17328 <li>Sub-one</li>
17329 <li>Sub-two</li>
17330 </ul>
17331 </li>
17332 </ul>
17333 !! html/parsoid
17334 <ul>
17335 <li>One
17336 </li>
17337 <li>Two:
17338 <ul>
17339 <li>Sub-one
17340 </li>
17341 <li>Sub-two
17342 </li>
17343 </ul>
17344 </li>
17345 </ul>
17346
17347 !! end
17348
17349 !! test
17350 HTML nested ordered list, closed tags (bug 5497)
17351 !! wikitext
17352 <ol>
17353 <li>One</li>
17354 <li>Two:
17355 <ol>
17356 <li>Sub-one</li>
17357 <li>Sub-two</li>
17358 </ol>
17359 </li>
17360 </ol>
17361 !! html
17362 <ol>
17363 <li>One</li>
17364 <li>Two:
17365 <ol>
17366 <li>Sub-one</li>
17367 <li>Sub-two</li>
17368 </ol>
17369 </li>
17370 </ol>
17371
17372 !! end
17373
17374 !! test
17375 HTML nested ordered list, open tags (bug 5497)
17376 !! wikitext
17377 <ol>
17378 <li>One
17379 <li>Two:
17380 <ol>
17381 <li>Sub-one
17382 <li>Sub-two
17383 </ol>
17384 </ol>
17385 !! html/php
17386 <ol>
17387 <li>One
17388 <li>Two:
17389 <ol>
17390 <li>Sub-one
17391 <li>Sub-two
17392 </ol>
17393 </ol>
17394
17395 !! html/parsoid
17396 <ol>
17397 <li>One
17398 </li>
17399 <li>Two:
17400 <ol>
17401 <li>Sub-one
17402 </li>
17403 <li>Sub-two
17404 </li>
17405 </ol>
17406 </li>
17407 </ol>
17408
17409 !! end
17410
17411 !! test
17412 HTML ordered list item with parameters oddity
17413 !! wikitext
17414 <ol><li id="fragment">One</li>
17415 </ol>
17416 !! html
17417 <ol><li id="fragment">One</li>
17418 </ol>
17419
17420 !! end
17421
17422 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
17423 !!test
17424 bug 5918: autonumbering
17425 !! wikitext
17426 [http://first/] [http://second] [ftp://ftp]
17427
17428 ftp://inlineftp
17429
17430 [mailto:enclosed@mail.tld With target]
17431
17432 [mailto:enclosed@mail.tld]
17433
17434 mailto:inline@mail.tld
17435 !! html/php
17436 <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>
17437 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
17438 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
17439 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
17440 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
17441 </p>
17442 !! html/parsoid
17443 <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>
17444 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
17445 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
17446 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
17447 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
17448 !! end
17449
17450
17451 #
17452 # Security and HTML correctness
17453 # From Nick Jenkins' fuzz testing
17454 #
17455
17456 !! test
17457 Fuzz testing: Parser13
17458 !! wikitext
17459 {|
17460 | http://a|
17461 !! html
17462 <table>
17463 <tr>
17464 <td>
17465 </td>
17466 </tr>
17467 </table>
17468
17469 !! end
17470
17471 !! test
17472 Fuzz testing: Parser14
17473 !! wikitext
17474 == onmouseover= ==
17475 http://__TOC__
17476 !! html
17477 <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>
17478 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17479 <ul>
17480 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17481 </ul>
17482 </div>
17483
17484
17485 !! html+tidy
17486 <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>
17487 <p>http://</p>
17488 <div id="toc" class="toc">
17489 <div id="toctitle">
17490 <h2>Contents</h2>
17491 </div>
17492 <ul>
17493 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17494 </ul>
17495 </div>
17496 <p></p>
17497 !! end
17498
17499 !! test
17500 Fuzz testing: Parser14-table
17501 !! options
17502 parsoid=wt2html,html2html
17503 !! wikitext
17504 ==a==
17505 {| STYLE=__TOC__
17506 !! html
17507 <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>
17508 <table style="&#95;_TOC&#95;_">
17509 <tr><td></td></tr>
17510 </table>
17511
17512 !! html+tidy
17513 <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>
17514 <table style="__TOC__">
17515 <tr>
17516 <td></td>
17517 </tr>
17518 </table>
17519 !! html/parsoid
17520 <h2>a</h2>
17521 <table style="__TOC__"></table>
17522 !! end
17523
17524 # Known to produce bogus xml (extra </td>)
17525 !! test
17526 Fuzz testing: Parser16
17527 !! wikitext
17528 {|
17529 !https://||||||
17530 !! html
17531 <table>
17532 <tr>
17533 <th>https://</th>
17534 <th></th>
17535 <th></th>
17536 <th>
17537 </td>
17538 </tr>
17539 </table>
17540
17541 !! html+tidy
17542 <table>
17543 <tr>
17544 <th>https://</th>
17545 <th></th>
17546 <th></th>
17547 <th></th>
17548 </tr>
17549 </table>
17550 !! end
17551
17552 !! test
17553 Fuzz testing: Parser21
17554 !! wikitext
17555 {|
17556 ! irc://{{ftp://a" onmouseover="alert('hello world');"
17557 |
17558 !! html
17559 <table>
17560 <tr>
17561 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
17562 </th>
17563 <td>
17564 </td>
17565 </tr>
17566 </table>
17567
17568 !! end
17569
17570 !! test
17571 Fuzz testing: Parser22
17572 !! wikitext
17573 http://===r:::https://b
17574
17575 {|
17576 !! html
17577 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
17578 </p>
17579 <table>
17580 <tr><td></td></tr>
17581 </table>
17582
17583 !! end
17584
17585 # Known to produce bad XML for now
17586 !! test
17587 Fuzz testing: Parser24
17588 !! wikitext
17589 {|
17590 {{{|
17591 <u CLASS=
17592 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
17593 <br style="onmouseover='alert(document.cookie);' " />
17594
17595 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17596 |
17597 !! html
17598 <table>
17599 {{{|
17600 <u class="&#124;">}}}} &gt;
17601 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
17602
17603 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17604 <tr>
17605 <td></u>
17606 </td>
17607 </tr>
17608 </table>
17609
17610 !! end
17611
17612 # Note: the current result listed for this is not what the original one was,
17613 # but the original bug was JavaScript injection, which is fixed in any case.
17614 # It's not clear that the original result listed was any more correct than the
17615 # current one. Original result:
17616 # <p>{{{|
17617 # </p>
17618 # <li class="&#124;&#124;">
17619 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17620 !!test
17621 Fuzz testing: Parser25 (bug 6055)
17622 !! wikitext
17623 {{{
17624 |
17625 <LI CLASS=||
17626 >
17627 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
17628 !! html
17629 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17630 </p>
17631 !! end
17632
17633 !!test
17634 Fuzz testing: URL adjacent extension (with space, clean)
17635 !! wikitext
17636 http://example.com <nowiki>junk</nowiki>
17637 !! html/php
17638 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
17639 </p>
17640 !! html/parsoid
17641 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
17642 !! end
17643
17644 !!test
17645 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
17646 !! wikitext
17647 http://example.com<nowiki>junk</nowiki>
17648 !! html/php
17649 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
17650 </p>
17651 !! html/parsoid
17652 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
17653 !! end
17654
17655 !!test
17656 Fuzz testing: URL adjacent extension (no space, dirty; pre)
17657 !! wikitext
17658 http://example.com<pre>junk</pre>
17659 !! html/php
17660 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
17661
17662 !! html/php+tidy
17663 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
17664 <pre>
17665 junk
17666 </pre>
17667 !! html/parsoid
17668 <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>
17669 !!end
17670
17671 !!test
17672 Fuzz testing: image with bogus manual thumbnail
17673 !! wikitext
17674 [[Image:foobar.jpg|thumbnail= ]]
17675 !! html/php
17676 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
17677
17678 !! html/parsoid
17679 <figure class="mw-default-size" typeof="mw:Error mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"manualthumb","ak":"thumbnail= "}]}' 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":{}}'><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>
17680 !!end
17681
17682 !! test
17683 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
17684 !! wikitext
17685 <pre dir="&#10;"></pre>
17686 !! html
17687 <pre dir="&#10;"></pre>
17688
17689 !! end
17690
17691 !! test
17692 Parsing optional HTML elements (Bug 6171)
17693 !! options
17694 !! wikitext
17695 <table>
17696 <tr>
17697 <td> Some tabular data</td>
17698 <td> More tabular data ...
17699 <td> And yet som tabular data</td>
17700 </tr>
17701 </table>
17702 !! html
17703 <table>
17704 <tr>
17705 <td> Some tabular data</td>
17706 <td> More tabular data ...
17707 </td><td> And yet som tabular data</td>
17708 </tr>
17709 </table>
17710
17711 !! end
17712
17713 !! test
17714 Correct handling of <td>, <tr> (Bug 6171)
17715 !! options
17716 !! wikitext
17717 <table>
17718 <tr>
17719 <td> Some tabular data</td>
17720 <td> More tabular data ...</td>
17721 <td> And yet som tabular data</td>
17722 </tr>
17723 </table>
17724 !! html
17725 <table>
17726 <tr>
17727 <td> Some tabular data</td>
17728 <td> More tabular data ...</td>
17729 <td> And yet som tabular data</td>
17730 </tr>
17731 </table>
17732
17733 !! end
17734
17735
17736 !! test
17737 Parsing crashing regression (fr:JavaScript)
17738 !! wikitext
17739 </body></x>
17740 !! html
17741 <p>&lt;/body&gt;&lt;/x&gt;
17742 </p>
17743 !! end
17744
17745 !! test
17746 Inline wiki vs wiki block nesting
17747 !! wikitext
17748 '''Bold paragraph
17749
17750 New wiki paragraph
17751 !! html
17752 <p><b>Bold paragraph</b>
17753 </p><p>New wiki paragraph
17754 </p>
17755 !! end
17756
17757 # FIXME: The current php output is documented
17758 # and desired output is the parsoid target.
17759 !! test
17760 Inline HTML vs wiki block nesting
17761 !! wikitext
17762 <b>Bold paragraph
17763
17764 New wiki paragraph
17765 !! html/php
17766 <p><b>Bold paragraph
17767 </p><p>New wiki paragraph</b>
17768 </p>
17769 !! html/parsoid
17770 <p><b>Bold paragraph</b>
17771 </p><p>New wiki paragraph
17772 </p>
17773 !! end
17774
17775 # Original result was this:
17776 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
17777 # </p>
17778 # While that might be marginally more intuitive, maybe, the six-apostrophe
17779 # construct is clearly pathological and the result stated here (which is what
17780 # the parser actually does) is about as reasonable as anything.
17781 !!test
17782 Mixing markup for italics and bold
17783 !! options
17784 !! wikitext
17785 '''bold''''''bold''bolditalics'''''
17786 !! html
17787 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
17788 </p>
17789 !! end
17790
17791
17792 !! article
17793 Xyzzyx
17794 !! text
17795 Article for special page transclusion test
17796 !! endarticle
17797
17798 !! test
17799 Special page transclusion
17800 !! options
17801 !! wikitext
17802 {{Special:Prefixindex/Xyzzyx}}
17803 !! html
17804 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17805 </ul>
17806
17807 !! end
17808
17809 !! test
17810 Special page transclusion twice (bug 5021)
17811 !! options
17812 !! wikitext
17813 {{Special:Prefixindex/Xyzzyx}}
17814 {{Special:Prefixindex/Xyzzyx}}
17815 !! html
17816 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17817 </ul>
17818 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17819 </ul>
17820
17821 !! end
17822
17823 !! test
17824 Transclusion of default MediaWiki message
17825 !! wikitext
17826 {{MediaWiki:Mainpage}}
17827 !! html
17828 <p>Main Page
17829 </p>
17830 !! end
17831
17832 !! test
17833 Transclusion of nonexistent MediaWiki message
17834 !! wikitext
17835 {{MediaWiki:Mainpagexxx}}
17836 !! html
17837 <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>
17838 </p>
17839 !! end
17840
17841 !! test
17842 Transclusion of MediaWiki message with underscore
17843 !! wikitext
17844 {{MediaWiki:history_short}}
17845 !! html
17846 <p>History
17847 </p>
17848 !! end
17849
17850 !! test
17851 Transclusion of MediaWiki message with space
17852 !! wikitext
17853 {{MediaWiki:history short}}
17854 !! html
17855 <p>History
17856 </p>
17857 !! end
17858
17859 !! test
17860 Invalid header with following text
17861 !! wikitext
17862 = x = y
17863 !! html
17864 <p>= x = y
17865 </p>
17866 !! end
17867
17868
17869 !! test
17870 Section extraction test (section 0)
17871 !! options
17872 section=0
17873 !! wikitext
17874 start
17875 ==a==
17876 ===aa===
17877 ====aaa====
17878 ==b==
17879 ===ba===
17880 ===bb===
17881 ====bba====
17882 ===bc===
17883 ==c==
17884 ===ca===
17885 !! html/php
17886 start
17887 !! end
17888
17889 !! test
17890 Section extraction test (section 1)
17891 !! options
17892 section=1
17893 !! wikitext
17894 start
17895 ==a==
17896 ===aa===
17897 ====aaa====
17898 ==b==
17899 ===ba===
17900 ===bb===
17901 ====bba====
17902 ===bc===
17903 ==c==
17904 ===ca===
17905 !! html/php
17906 ==a==
17907 ===aa===
17908 ====aaa====
17909 !! end
17910
17911 !! test
17912 Section extraction test (section 2)
17913 !! options
17914 section=2
17915 !! wikitext
17916 start
17917 ==a==
17918 ===aa===
17919 ====aaa====
17920 ==b==
17921 ===ba===
17922 ===bb===
17923 ====bba====
17924 ===bc===
17925 ==c==
17926 ===ca===
17927 !! html/php
17928 ===aa===
17929 ====aaa====
17930 !! end
17931
17932 !! test
17933 Section extraction test (section 3)
17934 !! options
17935 section=3
17936 !! wikitext
17937 start
17938 ==a==
17939 ===aa===
17940 ====aaa====
17941 ==b==
17942 ===ba===
17943 ===bb===
17944 ====bba====
17945 ===bc===
17946 ==c==
17947 ===ca===
17948 !! html/php
17949 ====aaa====
17950 !! end
17951
17952 !! test
17953 Section extraction test (section 4)
17954 !! options
17955 section=4
17956 !! wikitext
17957 start
17958 ==a==
17959 ===aa===
17960 ====aaa====
17961 ==b==
17962 ===ba===
17963 ===bb===
17964 ====bba====
17965 ===bc===
17966 ==c==
17967 ===ca===
17968 !! html/php
17969 ==b==
17970 ===ba===
17971 ===bb===
17972 ====bba====
17973 ===bc===
17974 !! end
17975
17976 !! test
17977 Section extraction test (section 5)
17978 !! options
17979 section=5
17980 !! wikitext
17981 start
17982 ==a==
17983 ===aa===
17984 ====aaa====
17985 ==b==
17986 ===ba===
17987 ===bb===
17988 ====bba====
17989 ===bc===
17990 ==c==
17991 ===ca===
17992 !! html/php
17993 ===ba===
17994 !! end
17995
17996 !! test
17997 Section extraction test (section 6)
17998 !! options
17999 section=6
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 ===bb===
18014 ====bba====
18015 !! end
18016
18017 !! test
18018 Section extraction test (section 7)
18019 !! options
18020 section=7
18021 !! wikitext
18022 start
18023 ==a==
18024 ===aa===
18025 ====aaa====
18026 ==b==
18027 ===ba===
18028 ===bb===
18029 ====bba====
18030 ===bc===
18031 ==c==
18032 ===ca===
18033 !! html/php
18034 ====bba====
18035 !! end
18036
18037 !! test
18038 Section extraction test (section 8)
18039 !! options
18040 section=8
18041 !! wikitext
18042 start
18043 ==a==
18044 ===aa===
18045 ====aaa====
18046 ==b==
18047 ===ba===
18048 ===bb===
18049 ====bba====
18050 ===bc===
18051 ==c==
18052 ===ca===
18053 !! html/php
18054 ===bc===
18055 !! end
18056
18057 !! test
18058 Section extraction test (section 9)
18059 !! options
18060 section=9
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 ==c==
18075 ===ca===
18076 !! end
18077
18078 !! test
18079 Section extraction test (section 10)
18080 !! options
18081 section=10
18082 !! wikitext
18083 start
18084 ==a==
18085 ===aa===
18086 ====aaa====
18087 ==b==
18088 ===ba===
18089 ===bb===
18090 ====bba====
18091 ===bc===
18092 ==c==
18093 ===ca===
18094 !! html/php
18095 ===ca===
18096 !! end
18097
18098 !! test
18099 Section extraction test (nonexistent section 11)
18100 !! options
18101 section=11
18102 !! wikitext
18103 start
18104 ==a==
18105 ===aa===
18106 ====aaa====
18107 ==b==
18108 ===ba===
18109 ===bb===
18110 ====bba====
18111 ===bc===
18112 ==c==
18113 ===ca===
18114 !! html/php
18115 !! end
18116
18117 !! test
18118 Section extraction test with bogus heading (section 1)
18119 !! options
18120 section=1
18121 !! wikitext
18122 ==a==
18123 ==bogus== not a legal section
18124 ==b==
18125 !! html/php
18126 ==a==
18127 ==bogus== not a legal section
18128 !! end
18129
18130 !! test
18131 Section extraction test with bogus heading (section 2)
18132 !! options
18133 section=2
18134 !! wikitext
18135 ==a==
18136 ==bogus== not a legal section
18137 ==b==
18138 !! html/php
18139 ==b==
18140 !! end
18141
18142 !! test
18143 Section extraction test with comment after heading (section 1)
18144 !! options
18145 section=1
18146 !! wikitext
18147 ==a==
18148 ==b== <!-- -->
18149 ==c==
18150 !! html/php
18151 ==a==
18152 !! end
18153
18154 !! test
18155 Section extraction test with comment after heading (section 2)
18156 !! options
18157 section=2
18158 !! wikitext
18159 ==a==
18160 ==b== <!-- -->
18161 ==c==
18162 !! html/php
18163 ==b== <!-- -->
18164 !! end
18165
18166 !! test
18167 Section extraction test with bogus <nowiki> heading (section 1)
18168 !! options
18169 section=1
18170 !! wikitext
18171 ==a==
18172 ==bogus== <nowiki>not a legal section</nowiki>
18173 ==b==
18174 !! html/php
18175 ==a==
18176 ==bogus== <nowiki>not a legal section</nowiki>
18177 !! end
18178
18179 !! test
18180 Section extraction test with bogus <nowiki> heading (section 2)
18181 !! options
18182 section=2
18183 !! wikitext
18184 ==a==
18185 ==bogus== <nowiki>not a legal section</nowiki>
18186 ==b==
18187 !! html/php
18188 ==b==
18189 !! end
18190
18191 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
18192 # instead of respecting commented sections
18193 !! test
18194 Section extraction prefixed by comment (section 1)
18195 !! options
18196 section=1
18197 !! wikitext
18198 <!-- -->==sec1==
18199 ==sec2==
18200 !! html/php
18201 ==sec2==
18202 !!end
18203
18204 !! test
18205 Section extraction prefixed by comment (section 2)
18206 !! options
18207 section=2
18208 !! wikitext
18209 <!-- -->==sec1==
18210 ==sec2==
18211 !! html/php
18212
18213 !!end
18214
18215 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
18216 # instead of respecting HTML-style headings
18217 !! test
18218 Section extraction, mixed wiki and html (section 1)
18219 !! options
18220 section=1
18221 !! wikitext
18222 <h2>unmarked</h2>
18223 unmarked
18224 ==1==
18225 one
18226 ==2==
18227 two
18228 !! html/php
18229 ==1==
18230 one
18231 !! end
18232
18233 !! test
18234 Section extraction, mixed wiki and html (section 2)
18235 !! options
18236 section=2
18237 !! wikitext
18238 <h2>unmarked</h2>
18239 unmarked
18240 ==1==
18241 one
18242 ==2==
18243 two
18244 !! html/php
18245 ==2==
18246 two
18247 !! end
18248
18249
18250 # Formerly testing for bug 3342
18251 !! test
18252 Section extraction, heading surrounded by <noinclude>
18253 !! options
18254 section=1
18255 !! wikitext
18256 <noinclude>==unmarked==</noinclude>
18257 ==marked==
18258 !! html/php
18259 ==marked==
18260 !!end
18261
18262 # Test behavior of bug 19910
18263 !! test
18264 Sectiion with all-equals
18265 !! options
18266 section=2
18267 !! wikitext
18268 ===
18269 The line above must have a trailing space
18270 === <!--
18271 --> <!-- -->
18272 But just in case it doesn't...
18273 !! html/php
18274 === <!--
18275 --> <!-- -->
18276 But just in case it doesn't...
18277 !! end
18278
18279 !! test
18280 Section replacement test (section 0)
18281 !! options
18282 replace=0,"xxx"
18283 !! wikitext
18284 start
18285 ==a==
18286 ===aa===
18287 ====aaa====
18288 ==b==
18289 ===ba===
18290 ===bb===
18291 ====bba====
18292 ===bc===
18293 ==c==
18294 ===ca===
18295 !! html/php
18296 xxx
18297
18298 ==a==
18299 ===aa===
18300 ====aaa====
18301 ==b==
18302 ===ba===
18303 ===bb===
18304 ====bba====
18305 ===bc===
18306 ==c==
18307 ===ca===
18308 !! end
18309
18310 !! test
18311 Section replacement test (section 1)
18312 !! options
18313 replace=1,"xxx"
18314 !! wikitext
18315 start
18316 ==a==
18317 ===aa===
18318 ====aaa====
18319 ==b==
18320 ===ba===
18321 ===bb===
18322 ====bba====
18323 ===bc===
18324 ==c==
18325 ===ca===
18326 !! html/php
18327 start
18328 xxx
18329
18330 ==b==
18331 ===ba===
18332 ===bb===
18333 ====bba====
18334 ===bc===
18335 ==c==
18336 ===ca===
18337 !! end
18338
18339 !! test
18340 Section replacement test (section 2)
18341 !! options
18342 replace=2,"xxx"
18343 !! wikitext
18344 start
18345 ==a==
18346 ===aa===
18347 ====aaa====
18348 ==b==
18349 ===ba===
18350 ===bb===
18351 ====bba====
18352 ===bc===
18353 ==c==
18354 ===ca===
18355 !! html/php
18356 start
18357 ==a==
18358 xxx
18359
18360 ==b==
18361 ===ba===
18362 ===bb===
18363 ====bba====
18364 ===bc===
18365 ==c==
18366 ===ca===
18367 !! end
18368
18369 !! test
18370 Section replacement test (section 3)
18371 !! options
18372 replace=3,"xxx"
18373 !! wikitext
18374 start
18375 ==a==
18376 ===aa===
18377 ====aaa====
18378 ==b==
18379 ===ba===
18380 ===bb===
18381 ====bba====
18382 ===bc===
18383 ==c==
18384 ===ca===
18385 !! html/php
18386 start
18387 ==a==
18388 ===aa===
18389 xxx
18390
18391 ==b==
18392 ===ba===
18393 ===bb===
18394 ====bba====
18395 ===bc===
18396 ==c==
18397 ===ca===
18398 !! end
18399
18400 !! test
18401 Section replacement test (section 4)
18402 !! options
18403 replace=4,"xxx"
18404 !! wikitext
18405 start
18406 ==a==
18407 ===aa===
18408 ====aaa====
18409 ==b==
18410 ===ba===
18411 ===bb===
18412 ====bba====
18413 ===bc===
18414 ==c==
18415 ===ca===
18416 !! html/php
18417 start
18418 ==a==
18419 ===aa===
18420 ====aaa====
18421 xxx
18422
18423 ==c==
18424 ===ca===
18425 !! end
18426
18427 !! test
18428 Section replacement test (section 5)
18429 !! options
18430 replace=5,"xxx"
18431 !! wikitext
18432 start
18433 ==a==
18434 ===aa===
18435 ====aaa====
18436 ==b==
18437 ===ba===
18438 ===bb===
18439 ====bba====
18440 ===bc===
18441 ==c==
18442 ===ca===
18443 !! html/php
18444 start
18445 ==a==
18446 ===aa===
18447 ====aaa====
18448 ==b==
18449 xxx
18450
18451 ===bb===
18452 ====bba====
18453 ===bc===
18454 ==c==
18455 ===ca===
18456 !! end
18457
18458 !! test
18459 Section replacement test (section 6)
18460 !! options
18461 replace=6,"xxx"
18462 !! wikitext
18463 start
18464 ==a==
18465 ===aa===
18466 ====aaa====
18467 ==b==
18468 ===ba===
18469 ===bb===
18470 ====bba====
18471 ===bc===
18472 ==c==
18473 ===ca===
18474 !! html/php
18475 start
18476 ==a==
18477 ===aa===
18478 ====aaa====
18479 ==b==
18480 ===ba===
18481 xxx
18482
18483 ===bc===
18484 ==c==
18485 ===ca===
18486 !! end
18487
18488 !! test
18489 Section replacement test (section 7)
18490 !! options
18491 replace=7,"xxx"
18492 !! wikitext
18493 start
18494 ==a==
18495 ===aa===
18496 ====aaa====
18497 ==b==
18498 ===ba===
18499 ===bb===
18500 ====bba====
18501 ===bc===
18502 ==c==
18503 ===ca===
18504 !! html/php
18505 start
18506 ==a==
18507 ===aa===
18508 ====aaa====
18509 ==b==
18510 ===ba===
18511 ===bb===
18512 xxx
18513
18514 ===bc===
18515 ==c==
18516 ===ca===
18517 !! end
18518
18519 !! test
18520 Section replacement test (section 8)
18521 !! options
18522 replace=8,"xxx"
18523 !! wikitext
18524 start
18525 ==a==
18526 ===aa===
18527 ====aaa====
18528 ==b==
18529 ===ba===
18530 ===bb===
18531 ====bba====
18532 ===bc===
18533 ==c==
18534 ===ca===
18535 !! html/php
18536 start
18537 ==a==
18538 ===aa===
18539 ====aaa====
18540 ==b==
18541 ===ba===
18542 ===bb===
18543 ====bba====
18544 xxx
18545
18546 ==c==
18547 ===ca===
18548 !!end
18549
18550 !! test
18551 Section replacement test (section 9)
18552 !! options
18553 replace=9,"xxx"
18554 !! wikitext
18555 start
18556 ==a==
18557 ===aa===
18558 ====aaa====
18559 ==b==
18560 ===ba===
18561 ===bb===
18562 ====bba====
18563 ===bc===
18564 ==c==
18565 ===ca===
18566 !! html/php
18567 start
18568 ==a==
18569 ===aa===
18570 ====aaa====
18571 ==b==
18572 ===ba===
18573 ===bb===
18574 ====bba====
18575 ===bc===
18576 xxx
18577 !! end
18578
18579 !! test
18580 Section replacement test (section 10)
18581 !! options
18582 replace=10,"xxx"
18583 !! wikitext
18584 start
18585 ==a==
18586 ===aa===
18587 ====aaa====
18588 ==b==
18589 ===ba===
18590 ===bb===
18591 ====bba====
18592 ===bc===
18593 ==c==
18594 ===ca===
18595 !! html/php
18596 start
18597 ==a==
18598 ===aa===
18599 ====aaa====
18600 ==b==
18601 ===ba===
18602 ===bb===
18603 ====bba====
18604 ===bc===
18605 ==c==
18606 xxx
18607 !! end
18608
18609 !! test
18610 Section replacement test with initial whitespace (bug 13728)
18611 !! options
18612 replace=2,"xxx"
18613 !! wikitext
18614 Preformatted initial line
18615 ==a==
18616 ===a===
18617 !! html/php
18618 Preformatted initial line
18619 ==a==
18620 xxx
18621 !! end
18622
18623
18624 !! test
18625 Section extraction, heading followed by pre with 20 spaces (bug 6398)
18626 !! options
18627 section=1
18628 !! wikitext
18629 ==a==
18630 a
18631 !! html/php
18632 ==a==
18633 a
18634 !! end
18635
18636 !! test
18637 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
18638 !! options
18639 section=1
18640 !! wikitext
18641 ==a==
18642 a
18643 !! html/php
18644 ==a==
18645 a
18646 !! end
18647
18648
18649 !! test
18650 Section extraction, <pre> around bogus header (bug 10309)
18651 !! options
18652 section=2
18653 !! wikitext
18654 == Section One ==
18655 <pre>
18656 =======
18657 </pre>
18658
18659 == Section Two ==
18660 stuff
18661 !! html/php
18662 == Section Two ==
18663 stuff
18664 !! end
18665
18666 !! test
18667 Section replacement, <pre> around bogus header (bug 10309)
18668 !! options
18669 replace=2,"xxx"
18670 !! wikitext
18671 == Section One ==
18672 <pre>
18673 =======
18674 </pre>
18675
18676 == Section Two ==
18677 stuff
18678 !! html/php
18679 == Section One ==
18680 <pre>
18681 =======
18682 </pre>
18683
18684 xxx
18685 !! end
18686
18687
18688 !! test
18689 Handling of &#x0A; in URLs
18690 !! wikitext
18691 ** irc://&#x0A;a
18692 !! html/php
18693 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18694
18695 !! html/parsoid
18696 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
18697 a">irc://
18698 a</a></li></ul></li></ul>
18699 !! end
18700
18701 !! test
18702 Handling of %0A in URLs
18703 !! wikitext
18704 ** irc://%0Aa
18705 !! html/php
18706 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18707
18708 !! html/parsoid
18709 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18710 !! end
18711
18712
18713 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
18714 !! test
18715 5 quotes, code coverage +1 line
18716 !! options
18717 parsoid=wt2html
18718 !! wikitext
18719 '''''
18720 !! html/php
18721 !! html/parsoid
18722 <p><b><i></i></b></p>
18723 !! end
18724
18725 # same html as previous, but wikitext adjusted to match parsoid html2wt
18726 # note that wt2html and html2html will put the <i> before the <b>
18727 !! test
18728 5 quotes, code coverage +1 line w/ nowiki (1)
18729 !! options
18730 parsoid=wt2wt,html2wt
18731 !! wikitext
18732 '''''<nowiki/>'''''
18733 !! html/php
18734 <p><i></i>
18735 </p>
18736 !! html/parsoid
18737 <p><b><i></i></b></p>
18738 !! end
18739
18740 # same as previous, just swapping the <i> and <b>
18741 !! test
18742 5 quotes, code coverage +1 line w/ nowiki (2)
18743 !! wikitext
18744 '''''<nowiki/>'''''
18745 !! html/php
18746 <p><i></i>
18747 </p>
18748 !! html/parsoid
18749 <p><i><b></b></i></p>
18750 !! end
18751
18752 !! test
18753 Special:Search page linking.
18754 !! wikitext
18755 {{Special:search}}
18756 !! html
18757 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
18758 </p>
18759 !! end
18760
18761 !! test
18762 {{!}} is a magic word
18763 !! wikitext
18764 {{!}} is a magic word there and {{!}} is still a magic word here
18765 | is not a magic word here but {{!}} is still a magic word here
18766 !! html/php
18767 <p>| is a magic word there and | is still a magic word here
18768 | is not a magic word here but | is still a magic word here
18769 </p>
18770 !! html/parsoid
18771 <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
18772 | 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>
18773
18774 !! end
18775
18776 !! test
18777 Say the magic word
18778 !! options
18779 title=[[Parser test]]
18780 !! wikitext
18781 * {{PAGENAME}}
18782 * {{PAGENAMEE}}
18783 * {{FULLPAGENAME}}
18784 * {{FULLPAGENAMEE}}
18785 * {{BASEPAGENAME}}
18786 * {{BASEPAGENAMEE}}
18787 * {{SUBPAGENAME}}
18788 * {{SUBPAGENAMEE}}
18789 * {{ROOTPAGENAME}}
18790 * {{ROOTPAGENAMEE}}
18791 * {{TALKPAGENAME}}
18792 * {{TALKPAGENAMEE}}
18793 * {{SUBJECTPAGENAME}}
18794 * {{SUBJECTPAGENAMEE}}
18795 * {{NAMESPACEE}}
18796 * {{NAMESPACE}}
18797 * {{NAMESPACENUMBER}}
18798 * {{TALKSPACE}}
18799 * {{TALKSPACEE}}
18800 * {{SUBJECTSPACE}}
18801 * {{SUBJECTSPACEE}}
18802 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
18803 !! html
18804 <ul><li> Parser test</li>
18805 <li> Parser_test</li>
18806 <li> Parser test</li>
18807 <li> Parser_test</li>
18808 <li> Parser test</li>
18809 <li> Parser_test</li>
18810 <li> Parser test</li>
18811 <li> Parser_test</li>
18812 <li> Parser test</li>
18813 <li> Parser_test</li>
18814 <li> Talk:Parser test</li>
18815 <li> Talk:Parser_test</li>
18816 <li> Parser test</li>
18817 <li> Parser_test</li>
18818 <li> </li>
18819 <li> </li>
18820 <li> 0</li>
18821 <li> Talk</li>
18822 <li> Talk</li>
18823 <li> </li>
18824 <li> </li>
18825 <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>
18826
18827 !! end
18828 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
18829
18830 !! test
18831 Gallery
18832 !! wikitext
18833 <gallery>
18834 image1.png |
18835 image2.gif|||||
18836
18837 image3|
18838 image4 |300px| centre
18839 image5.svg| http://///////
18840 [[x|xx]]]]
18841 * image6
18842 </gallery>
18843 !! html
18844 <ul class="gallery mw-gallery-traditional">
18845 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18846 <div class="thumb" style="height: 150px;">Image1.png</div>
18847 <div class="gallerytext">
18848 </div>
18849 </div></li>
18850 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18851 <div class="thumb" style="height: 150px;">Image2.gif</div>
18852 <div class="gallerytext">
18853 </div>
18854 </div></li>
18855 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18856 <div class="thumb" style="height: 150px;">Image3</div>
18857 <div class="gallerytext">
18858 </div>
18859 </div></li>
18860 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18861 <div class="thumb" style="height: 150px;">Image4</div>
18862 <div class="gallerytext">
18863 <pre>centre
18864 </pre>
18865 </div>
18866 </div></li>
18867 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18868 <div class="thumb" style="height: 150px;">Image5.svg</div>
18869 <div class="gallerytext">
18870 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
18871 </p>
18872 </div>
18873 </div></li>
18874 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18875 <div class="thumb" style="height: 150px;">* image6</div>
18876 <div class="gallerytext">
18877 </div>
18878 </div></li>
18879 </ul>
18880
18881 !! end
18882
18883 !! test
18884 Gallery (with options)
18885 !! wikitext
18886 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
18887 File:Nonexistent.jpg|caption
18888 File:Nonexistent.jpg
18889 image:foobar.jpg|some '''caption''' [[Main Page]]
18890 image:foobar.jpg
18891 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
18892 </gallery>
18893 !! html
18894 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
18895 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
18896 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18897 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18898 <div class="gallerytext">
18899 <p>caption
18900 </p>
18901 </div>
18902 </div></li>
18903 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18904 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18905 <div class="gallerytext">
18906 </div>
18907 </div></li>
18908 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18909 <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>
18910 <div class="gallerytext">
18911 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18912 </p>
18913 </div>
18914 </div></li>
18915 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18916 <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>
18917 <div class="gallerytext">
18918 </div>
18919 </div></li>
18920 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18921 <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>
18922 <div class="gallerytext">
18923 <p>blabla.
18924 </p>
18925 </div>
18926 </div></li>
18927 </ul>
18928
18929 !! end
18930
18931 !! test
18932 Gallery with link that has fragment
18933 !! wikitext
18934 <gallery>
18935 image:foobar.jpg|link=Main_Page
18936 image:foobar.jpg|link=Main_Page#section
18937 image:foobar.jpg|link=Main Page#section|caption
18938 </gallery>
18939 !! html
18940 <ul class="gallery mw-gallery-traditional">
18941 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18942 <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>
18943 <div class="gallerytext">
18944 </div>
18945 </div></li>
18946 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18947 <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>
18948 <div class="gallerytext">
18949 </div>
18950 </div></li>
18951 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18952 <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>
18953 <div class="gallerytext">
18954 <p>caption
18955 </p>
18956 </div>
18957 </div></li>
18958 </ul>
18959
18960 !! end
18961
18962 !! test
18963 Gallery with wikitext inside caption
18964 !! wikitext
18965 <gallery>
18966 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
18967 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
18968 </gallery>
18969 !! html
18970 <ul class="gallery mw-gallery-traditional">
18971 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18972 <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>
18973 <div class="gallerytext">
18974 <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>
18975 </p>
18976 </div>
18977 </div></li>
18978 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18979 <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>
18980 <div class="gallerytext">
18981 <p>This is a test template
18982 </p>
18983 </div>
18984 </div></li>
18985 </ul>
18986
18987 !! end
18988
18989 !! test
18990 gallery (with showfilename option)
18991 !! wikitext
18992 <gallery showfilename>
18993 File:Nonexistent.jpg|caption
18994 File:Nonexistent.jpg
18995 image:foobar.jpg|some '''caption''' [[Main Page]]
18996 File:Foobar.jpg
18997 </gallery>
18998 !! html
18999 <ul class="gallery mw-gallery-traditional">
19000 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19001 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19002 <div class="gallerytext">
19003 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
19004 caption
19005 </p>
19006 </div>
19007 </div></li>
19008 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19009 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19010 <div class="gallerytext">
19011 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
19012 </p>
19013 </div>
19014 </div></li>
19015 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19016 <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>
19017 <div class="gallerytext">
19018 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
19019 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19020 </p>
19021 </div>
19022 </div></li>
19023 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19024 <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>
19025 <div class="gallerytext">
19026 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
19027 </p>
19028 </div>
19029 </div></li>
19030 </ul>
19031
19032 !! end
19033
19034 !! test
19035 Gallery (with namespace-less filenames)
19036 !! wikitext
19037 <gallery>
19038 File:Nonexistent.jpg
19039 Nonexistent.jpg
19040 image:foobar.jpg
19041 foobar.jpg
19042 </gallery>
19043 !! html
19044 <ul class="gallery mw-gallery-traditional">
19045 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19046 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19047 <div class="gallerytext">
19048 </div>
19049 </div></li>
19050 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19051 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19052 <div class="gallerytext">
19053 </div>
19054 </div></li>
19055 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19056 <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>
19057 <div class="gallerytext">
19058 </div>
19059 </div></li>
19060 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19061 <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>
19062 <div class="gallerytext">
19063 </div>
19064 </div></li>
19065 </ul>
19066
19067 !! end
19068
19069 !! test
19070 HTML Hex character encoding (spells the word "JavaScript")
19071 !! options
19072 parsoid=wt2html,wt2wt,html2html
19073 !! wikitext
19074 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
19075 !! html/php
19076 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
19077 </p>
19078 !! html/php+tidy
19079 <p>JavaScript</p>
19080 !! html/parsoid
19081 <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>
19082 !! end
19083
19084 !! test
19085 HTML Hex character encoding bogus encoding (bug 26437 regression check)
19086 !! wikitext
19087 &#xsee;&#XSEE;
19088 !! html/php
19089 <p>&amp;#xsee;&amp;#XSEE;
19090 </p>
19091 !! html/parsoid
19092 <p>&amp;#xsee;&amp;#XSEE;</p>
19093 !! end
19094
19095 !! test
19096 HTML Hex character encoding mixed case
19097 !! options
19098 parsoid=wt2html,wt2wt,html2html
19099 !! wikitext
19100 &#xEE;&#Xee;
19101 !! html/php
19102 <p>&#xee;&#xee;
19103 </p>
19104 !! html/php+tidy
19105 <p>îî</p>
19106 !! html/parsoid
19107 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
19108 !! end
19109
19110 # See: https://www.w3.org/TR/html5/syntax.html#character-references
19111 # Note that U+000C (form feed) is not a valid XML character, so
19112 # it is banned even though allowed in HTML5.
19113 !! test
19114 Illegal character references (T106578)
19115 !! wikitext
19116 ; Null: &#00;
19117 ; FF: &#xC;
19118 ; CR: &#xD;
19119 ; Control (low): &#8;
19120 ; Control (high): &#x7F; &#x9F;
19121 ; Surrogate: &#xD83D;&#xDCA9;
19122 ; This is an okay astral character: &#x1F4A9;
19123 !! html+tidy
19124 <dl>
19125 <dt>Null</dt>
19126 <dd>&amp;#00;</dd>
19127 <dt>FF</dt>
19128 <dd>&amp;#xC;</dd>
19129 <dt>CR</dt>
19130 <dd>&amp;#xD;</dd>
19131 <dt>Control (low)</dt>
19132 <dd>&amp;#8;</dd>
19133 <dt>Control (high)</dt>
19134 <dd>&amp;#x7F; &amp;#x9F;</dd>
19135 <dt>Surrogate</dt>
19136 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
19137 <dt>This is an okay astral character</dt>
19138 <dd>💩</dd>
19139 </dl>
19140 !! end
19141
19142 !! test
19143 __FORCETOC__ override
19144 !! wikitext
19145 __NEWSECTIONLINK__
19146 __FORCETOC__
19147 !! html/php
19148 <p><br />
19149 </p>
19150 !! end
19151
19152 !! test
19153 ISBN code coverage
19154 !! wikitext
19155 ISBN 978-0-1234-56&#x20;789
19156 !! html
19157 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
19158 </p>
19159 !! html+tidy
19160 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
19161 !! html/parsoid
19162 <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>
19163 !! end
19164
19165 !! test
19166 ISBN followed by 5 spaces
19167 !! wikitext
19168 ISBN
19169 !! html
19170 <p>ISBN
19171 </p>
19172 !! end
19173
19174 !! test
19175 Double ISBN
19176 !! wikitext
19177 ISBN ISBN 1234567890
19178 !! html/php
19179 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19180 </p>
19181 !! html/parsoid
19182 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
19183 !! end
19184
19185 # Uppercase X and lowercase x as well
19186 !! test
19187 ISBN with an X
19188 !! wikitext
19189 ISBN 3-462-04561-X
19190 ISBN 3-462-04561-x
19191 ISBN 080442957X
19192 ISBN 080442957x
19193 ISBN 978080442957X
19194 ISBN 978080442957x
19195 !! html/php
19196 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
19197 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
19198 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
19199 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
19200 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
19201 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
19202 </p>
19203 !! html/parsoid
19204 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
19205 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
19206 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
19207 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
19208 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
19209 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
19210 !! end
19211
19212 !! test
19213 ISBN with empty prefix (parsoid test)
19214 !! wikitext
19215 ISBN 1234567890
19216 !! html/php
19217 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19218 </p>
19219 !! html/parsoid
19220 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
19221 !! end
19222
19223 !! test
19224 Bug 22905: <abbr> followed by ISBN followed by </a>
19225 !! wikitext
19226 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
19227 !! html/php
19228 <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>
19229 </p>
19230 !! html/parsoid
19231 <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>
19232 !! end
19233
19234 !! test
19235 Double RFC
19236 !! wikitext
19237 RFC RFC 1234
19238 !! html
19239 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
19240 </p>
19241 !! end
19242
19243 !! test
19244 Double RFC with a wiki link
19245 !! wikitext
19246 RFC [[RFC 1234]]
19247 !! html
19248 <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>
19249 </p>
19250 !! end
19251
19252 !! test
19253 RFC code coverage
19254 !! wikitext
19255 RFC 983&#x20;987
19256 !! html
19257 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
19258 </p>
19259 !! html+tidy
19260 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
19261 !! end
19262
19263 !! test
19264 Centre-aligned image
19265 !! wikitext
19266 [[Image:foobar.jpg|centre]]
19267 !! html
19268 <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>
19269
19270 !!end
19271
19272 !! test
19273 None-aligned image
19274 !! wikitext
19275 [[Image:foobar.jpg|none]]
19276 !! html
19277 <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>
19278
19279 !!end
19280
19281 !! test
19282 Width + Height sized image (using px) (height is ignored)
19283 !! wikitext
19284 [[Image:foobar.jpg|640x480px]]
19285 !! html
19286 <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>
19287 </p>
19288 !!end
19289
19290 !! test
19291 Width-sized image (using px, no following whitespace)
19292 !! wikitext
19293 [[Image:foobar.jpg|640px]]
19294 !! html
19295 <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>
19296 </p>
19297 !!end
19298
19299 !! test
19300 Width-sized image (using px, with following whitespace - test regression from r39467)
19301 !! wikitext
19302 [[Image:foobar.jpg|640px ]]
19303 !! html
19304 <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>
19305 </p>
19306 !!end
19307
19308 !! test
19309 Width-sized image (using px, with preceding whitespace - test regression from r39467)
19310 !! wikitext
19311 [[Image:foobar.jpg| 640px]]
19312 !! html
19313 <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>
19314 </p>
19315 !!end
19316
19317 !! test
19318 Image with page parameter
19319 !! options
19320 djvu
19321 !! wikitext
19322 [[File:LoremIpsum.djvu|page=2]]
19323 !! html/php
19324 <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>
19325 </p>
19326 !! html/parsoid
19327 <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>
19328 !! end
19329
19330 !! test
19331 Another italics / bold test
19332 !! wikitext
19333 ''' ''x'
19334 !! html
19335 <pre>'<i> </i>x'
19336 </pre>
19337 !!end
19338
19339 # FIXME: The php output seems broken. It's interleaving some open/close tags.
19340 !! test
19341 dt/dd/dl test
19342 !! wikitext
19343 :;;;::
19344 !! html/php
19345 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
19346
19347 !! html/parsoid
19348 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
19349
19350 !!end
19351
19352
19353 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
19354 !! test
19355 Images with the "|" character in the comment
19356 !! wikitext
19357 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
19358 !! html/php
19359 <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>
19360
19361 !! html/parsoid
19362 <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>
19363 !! end
19364
19365 !! test
19366 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
19367 !! wikitext
19368 <html><script>alert(1);</script></html>
19369 !! html
19370 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
19371 </p>
19372 !! end
19373
19374 !! test
19375 HTML with raw HTML ($wgRawHtml==true)
19376 !! options
19377 wgRawHtml=1
19378 !! wikitext
19379 <html><script>alert(1);</script></html>
19380 !! html
19381 <p><script>alert(1);</script>
19382 </p>
19383 !! end
19384
19385 !! test
19386 Parents of subpages, one level up
19387 !! options
19388 subpage title=[[Subpage test/L1/L2/L3]]
19389 !! wikitext
19390 [[../|L2]]
19391 !! html
19392 <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>
19393 </p>
19394 !! end
19395
19396
19397 !! test
19398 Parents of subpages, one level up, not named
19399 !! options
19400 subpage title=[[Subpage test/L1/L2/L3]]
19401 !! wikitext
19402 [[../]]
19403 !! html
19404 <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>
19405 </p>
19406 !! end
19407
19408
19409
19410 !! test
19411 Parents of subpages, two levels up
19412 !! options
19413 subpage title=[[Subpage test/L1/L2/L3]]
19414 !! wikitext
19415 [[../../|L1]]2
19416
19417 [[../../|L1]]l
19418 !! html
19419 <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
19420 </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>
19421 </p>
19422 !! end
19423
19424 !! test
19425 Parents of subpages, two levels up, without trailing slash or name.
19426 !! options
19427 subpage title=[[Subpage test/L1/L2/L3]]
19428 !! wikitext
19429 [[../..]]
19430 !! html
19431 <p>[[../..]]
19432 </p>
19433 !! end
19434
19435 !! test
19436 Parents of subpages, two levels up, with lots of extra trailing slashes.
19437 !! options
19438 subpage title=[[Subpage test/L1/L2/L3]]
19439 !! wikitext
19440 [[../../////]]
19441 !! html
19442 <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>
19443 </p>
19444 !! end
19445
19446 !! article
19447 Subpage test/L1/L2/L3Sibling
19448 !! text
19449 Sibling article
19450 !! endarticle
19451
19452 !! test
19453 Transclusion of a sibling page (one level up)
19454 !! options
19455 subpage title=[[Subpage test/L1/L2/L3]]
19456 !! wikitext
19457 {{../L3Sibling}}
19458 !! html
19459 <p>Sibling article
19460 </p>
19461 !! end
19462
19463 !! test
19464 Transclusion of a child page
19465 !! options
19466 subpage title=[[Subpage test/L1/L2]]
19467 !! wikitext
19468 {{/L3Sibling}}
19469 !! html
19470 <p>Sibling article
19471 </p>
19472 !! end
19473
19474 # This is wt2html only in Parsoid because we add <nowiki>
19475 # because of {{..}} and we don't expect to fix that to
19476 # eliminate the nowikis selective for {{..}} markup.
19477 !! test
19478 Non-transclusion because of too many up levels
19479 !! options
19480 subpage title=[[Subpage test/L1/L2/L3]]
19481 parsoid=wt2html
19482 !! wikitext
19483 {{../../../../More than parent}}
19484 !! html/php
19485 <p>{{../../../../More than parent}}
19486 </p>
19487 !! html/parsoid
19488 <p>{{../../../../More than parent}}</p>
19489 !! end
19490
19491 !! test
19492 Definition list code coverage
19493 !! wikitext
19494 ; title : def
19495 ; title : def
19496 ;title: def
19497 !! html/php
19498 <dl><dt> title &#160;</dt>
19499 <dd> def</dd>
19500 <dt> title&#160;</dt>
19501 <dd> def</dd>
19502 <dt>title</dt>
19503 <dd> def</dd></dl>
19504
19505 !! html/parsoid
19506 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
19507 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
19508 <dt>title</dt><dd> def</dd></dl>
19509 !! end
19510
19511 !! test
19512 Don't fall for the self-closing div
19513 !! wikitext
19514 <div>hello world</div/>
19515 !! html
19516 <div>hello world</div>
19517
19518 !! end
19519
19520 !! test
19521 MSGNW magic word
19522 !! wikitext
19523 {{MSGNW:msg}}
19524 !! html/php
19525 <p>&#91;&#91;:Template:Msg&#93;&#93;
19526 </p>
19527 !! end
19528
19529 !! test
19530 RAW magic word
19531 !! wikitext
19532 {{RAW:QUERTY}}
19533 !! html
19534 <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>
19535 </p>
19536 !! end
19537
19538 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
19539 !! test
19540 Always escape literal '>' in output, not just after '<'
19541 !! wikitext
19542 ><>
19543 !! html
19544 <p>&gt;&lt;&gt;
19545 </p>
19546 !! end
19547
19548 !! test
19549 Template caching
19550 !! wikitext
19551 {{Test}}
19552 {{Test}}
19553 !! html
19554 <p>This is a test template
19555 This is a test template
19556 </p>
19557 !! end
19558
19559
19560 !! article
19561 MediaWiki:Fake
19562 !! text
19563 ==header==
19564 !! endarticle
19565
19566 !! test
19567 Inclusion of !userCanEdit() content
19568 !! wikitext
19569 {{MediaWiki:Fake}}
19570 !! html
19571 <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>
19572
19573 !! end
19574
19575
19576 !! test
19577 Out-of-order TOC heading levels
19578 !! wikitext
19579 ==2==
19580 ======6======
19581 ===3===
19582 =1=
19583 =====5=====
19584 ==2==
19585 !! html
19586 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19587 <ul>
19588 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
19589 <ul>
19590 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
19591 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
19592 </ul>
19593 </li>
19594 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
19595 <ul>
19596 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
19597 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
19598 </ul>
19599 </li>
19600 </ul>
19601 </div>
19602
19603 <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>
19604 <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>
19605 <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>
19606 <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>
19607 <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>
19608 <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>
19609
19610 !! end
19611
19612
19613 !! test
19614 ISBN with a dummy number
19615 !! wikitext
19616 ISBN ---
19617 !! html
19618 <p>ISBN ---
19619 </p>
19620 !! end
19621
19622
19623 !! test
19624 ISBN with space-delimited number
19625 !! wikitext
19626 ISBN 92 9017 032 8
19627 !! html
19628 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
19629 </p>
19630 !! end
19631
19632
19633 !! test
19634 ISBN with multiple spaces, no number
19635 !! wikitext
19636 ISBN foo
19637 !! html
19638 <p>ISBN foo
19639 </p>
19640 !! end
19641
19642
19643 !! test
19644 ISBN length
19645 !! wikitext
19646 ISBN 123456789
19647
19648 ISBN 1234567890
19649
19650 ISBN 12345678901
19651 !! html
19652 <p>ISBN 123456789
19653 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19654 </p><p>ISBN 12345678901
19655 </p>
19656 !! end
19657
19658
19659 !! test
19660 ISBN with trailing year (bug 8110)
19661 !! wikitext
19662 ISBN 1-234-56789-0 - 2006
19663
19664 ISBN 1 234 56789 0 - 2006
19665 !! html
19666 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
19667 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
19668 </p>
19669 !! end
19670
19671
19672 !! test
19673 anchorencode
19674 !! wikitext
19675 {{anchorencode:foo bar©#%n}}
19676 !! html
19677 <p>foo_bar.C2.A9.23.25n
19678 </p>
19679 !! end
19680
19681 !! test
19682 anchorencode trims spaces
19683 !! wikitext
19684 {{anchorencode: __pretty__please__}}
19685 !! html
19686 <p>pretty_please
19687 </p>
19688 !! end
19689
19690 !! test
19691 anchorencode deals with links
19692 !! wikitext
19693 {{anchorencode: [[hello|world]] [[hi]]}}
19694 !! html
19695 <p>world_hi
19696 </p>
19697 !! end
19698
19699 !! test
19700 anchorencode deals with templates
19701 !! wikitext
19702 {{anchorencode: {{Foo}} }}
19703 !! html
19704 <p>FOO
19705 </p>
19706 !! end
19707
19708 !! test
19709 anchorencode encodes like the TOC generator: (bug 18431)
19710 !! wikitext
19711 === _ +:.3A%3A&&amp;]] ===
19712 {{anchorencode: _ +:.3A%3A&&amp;]] }}
19713 __NOEDITSECTION__
19714 !! html
19715 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
19716 <p>.2B:.3A.253A.26.26.5D.5D
19717 </p>
19718 !! end
19719
19720 !! test
19721 Bug 6200: blockquotes and paragraph formatting
19722 !! wikitext
19723 <blockquote>
19724 foo
19725 </blockquote>
19726
19727 bar
19728
19729 baz
19730 !! html
19731 <blockquote>
19732 <p>foo
19733 </p>
19734 </blockquote>
19735 <p>bar
19736 </p>
19737 <pre>baz
19738 </pre>
19739 !! end
19740
19741 !! test
19742 Bug 8293: Use of center tag ruins paragraph formatting
19743 !! wikitext
19744 <center>
19745 foo
19746 </center>
19747
19748 bar
19749
19750 baz
19751 !! html
19752 <center>
19753 <p>foo
19754 </p>
19755 </center>
19756 <p>bar
19757 </p>
19758 <pre>baz
19759 </pre>
19760 !! end
19761
19762 !!test
19763 Parsing of overlapping (improperly nested) inline html tags
19764 !! wikitext
19765 <span><s>x</span></s>
19766 !! html/php
19767 <p><span><s>x&lt;/span&gt;</s></span>
19768 </p>
19769 !! html/parsoid
19770 <p><span><s>x</s></span>
19771 </p>
19772 !!end
19773
19774 ###
19775 ### Language variants related tests
19776 ###
19777 !! test
19778 Self-link in language variants
19779 !! options
19780 title=[[Dunav]] language=sr
19781 !! wikitext
19782 Both [[Dunav]] and [[Дунав]] are names for this river.
19783 !! html
19784 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
19785 </p>
19786 !!end
19787
19788 !! article
19789 Дуна
19790 !! text
19791 content
19792 !! endarticle
19793
19794 !! test
19795 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
19796 !! options
19797 title=[[Duna]] language=sr
19798 !! wikitext
19799 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
19800 !! html
19801 <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.
19802 </p>
19803 !! end
19804
19805 !! test
19806 Link to a section of a variant of this title shouldn't be parsed as self-link
19807 !! options
19808 title=[[Duna]] language=sr
19809 !! wikitext
19810 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
19811 !! html
19812 <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.
19813 </p>
19814 !! end
19815
19816 !! test
19817 Link to pages in language variants
19818 !! options
19819 language=sr
19820 !! wikitext
19821 Main Page can be written as [[Маин Паге]]
19822 !! html
19823 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
19824 </p>
19825 !!end
19826
19827
19828 !! test
19829 Multiple links to pages in language variants
19830 !! options
19831 language=sr
19832 !! wikitext
19833 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
19834 !! html
19835 <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>.
19836 </p>
19837 !!end
19838
19839
19840 !! test
19841 Simple template in language variants
19842 !! options
19843 language=sr
19844 !! wikitext
19845 {{тест}}
19846 !! html
19847 <p>This is a test template
19848 </p>
19849 !! end
19850
19851
19852 !! test
19853 Template with explicit namespace in language variants
19854 !! options
19855 language=sr
19856 !! wikitext
19857 {{Template:тест}}
19858 !! html
19859 <p>This is a test template
19860 </p>
19861 !! end
19862
19863
19864 !! test
19865 Basic test for template parameter in language variants
19866 !! options
19867 language=sr
19868 !! wikitext
19869 {{парамтест|param=foo}}
19870 !! html
19871 <p>This is a test template with parameter foo
19872 </p>
19873 !! end
19874
19875 !! test
19876 Simple category in language variants
19877 !! options
19878 language=sr cat
19879 !! wikitext
19880 [[Category:МедиаWики Усер'с Гуиде]]
19881 !! html/php
19882 cat=МедиаWики_Усер'с_Гуиде sort=
19883 !! html/parsoid
19884 <link rel="mw:PageProp/Category" href="./Категорија:МедиаWики_Усер'с_Гуиде" data-parsoid='{"stx":"simple","a":{"href":"./Категорија:МедиаWики_Усер&#39;с_Гуиде"},"sa":{"href":"Category:МедиаWики Усер&#39;с Гуиде"}}'/>
19885 !! end
19886
19887 !! article
19888 Category:分类
19889 !! text
19890 blah
19891 !! endarticle
19892
19893 !! article
19894 Category:分類
19895 !! text
19896 blah
19897 !! endarticle
19898
19899 ## We used to, but no longer wt2wt this test since the default serializer
19900 ## will normalize all categories to serialize on their own line.
19901 ## This wikitext usage is going to be fairly uncommon in production and
19902 ## selser will take care of preserving formatting in those scenarios.
19903 !! test
19904 Don't convert blue categorylinks to another variant (bug 33210)
19905 !! options
19906 cat
19907 language=zh
19908 parsoid=wt2html
19909 !! wikitext
19910 [[A]][[Category:分类]]
19911 !! html/php
19912 cat=分类 sort=
19913 !! html/parsoid
19914 <p><a rel="mw:WikiLink" href="A" title="A">A</a></p>
19915 <link rel="mw:PageProp/Category" href="Category:分类"/>
19916 !! end
19917
19918 !! test
19919 Stripping -{}- tags (language variants)
19920 !! options
19921 language=sr
19922 !! wikitext
19923 Latin proverb: -{Ne nuntium necare}-
19924 !! html
19925 <p>Latin proverb: Ne nuntium necare
19926 </p>
19927 !! end
19928
19929
19930 !! test
19931 Prevent conversion with -{}- tags (language variants)
19932 !! options
19933 language=sr variant=sr-ec
19934 !! wikitext
19935 Latinski: -{Ne nuntium necare}-
19936 !! html
19937 <p>Латински: Ne nuntium necare
19938 </p>
19939 !! end
19940
19941
19942 !! test
19943 Prevent conversion of text with -{}- tags (language variants)
19944 !! options
19945 language=sr variant=sr-ec
19946 !! wikitext
19947 Latinski: -{Ne nuntium necare}-
19948 !! html
19949 <p>Латински: Ne nuntium necare
19950 </p>
19951 !! end
19952
19953
19954 !! test
19955 Prevent conversion of links with -{}- tags (language variants)
19956 !! options
19957 language=sr variant=sr-ec
19958 !! wikitext
19959 -{[[Main Page]]}-
19960 !! html
19961 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19962 </p>
19963 !! end
19964
19965
19966 !! test
19967 -{}- tags within headlines (within html for parserConvert())
19968 !! options
19969 language=sr variant=sr-ec
19970 !! wikitext
19971 == -{Naslov}- ==
19972 !! html
19973 <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>
19974
19975 !! end
19976
19977
19978 !! test
19979 Explicit definition of language variant alternatives
19980 !! options
19981 language=zh variant=zh-tw
19982 !! wikitext
19983 -{zh:China;zh-tw:Taiwan}-, not China
19984 !! html
19985 <p>Taiwan, not China
19986 </p>
19987 !! end
19988
19989
19990 !! test
19991 Conversion around HTML tags
19992 !! options
19993 language=sr variant=sr-ec
19994 !! wikitext
19995 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
19996 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
19997 !! html
19998 <p>
19999 <span title="ЛаCтин">ски</span>
20000 </p>
20001 !! end
20002
20003
20004 !! test
20005 Explicit session-wise language variant mapping (A flag and - flag)
20006 !! options
20007 language=zh variant=zh-tw
20008 !! wikitext
20009 Taiwan is not China.
20010 But -{A|zh:China;zh-tw:Taiwan}- is China,
20011 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
20012 and -{China}- is China.
20013 !! html
20014 <p>Taiwan is not China.
20015 But Taiwan is Taiwan,
20016 (This should be stripped!)
20017 and China is China.
20018 </p>
20019 !! end
20020
20021 !! test
20022 Explicit session-wise language variant mapping (H flag for hide)
20023 !! options
20024 language=zh variant=zh-tw
20025 !! wikitext
20026 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
20027 Taiwan is China.
20028 !! html
20029 <p>(This should be stripped!)
20030 Taiwan is Taiwan.
20031 </p>
20032 !! end
20033
20034 !! test
20035 Adding explicit conversion rule for title (T flag)
20036 !! options
20037 language=zh variant=zh-tw showtitle
20038 !! wikitext
20039 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20040 !! html
20041 Taiwan
20042 <p>Should be stripped!
20043 </p>
20044 !! end
20045
20046 !! test
20047 Testing that changing the language variant here in the tests actually works
20048 !! options
20049 language=zh variant=zh showtitle
20050 !! wikitext
20051 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20052 !! html
20053 China
20054 <p>Should be stripped!
20055 </p>
20056 !! end
20057
20058 !! test
20059 Recursive conversion of alt and title attrs shouldn't clear converter state
20060 !! options
20061 language=zh variant=zh-cn showtitle
20062 !! wikitext
20063 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
20064 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
20065 !! html
20066 China
20067 <p>
20068 Should be stripped<span title="Exclamation">!</span>
20069 </p>
20070 !! end
20071
20072 !! test
20073 Bug 24072: more test on conversion rule for title
20074 !! options
20075 language=zh variant=zh-tw showtitle
20076 !! wikitext
20077 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20078 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
20079 !! html
20080 Taiwan
20081 <p>This should be stripped!
20082 This won't take interferes with the title rule.
20083 </p>
20084 !! end
20085
20086 !! test
20087 Partly disable title conversion if variant == main language code
20088 !! options
20089 language=zh variant=zh title=[[ZH]] showtitle
20090 !! wikitext
20091 -{T|zh-cn:CN;zh-tw:TW}-
20092 !! html
20093 ZH
20094 <p>
20095 </p>
20096 !! end
20097
20098 !! test
20099 Partly disable title conversion if variant == main language code, more
20100 !! options
20101 language=zh variant=zh title=[[ZH]] showtitle
20102 !! wikitext
20103 -{T|TW}-
20104 !! html
20105 ZH
20106 <p>
20107 </p>
20108 !! end
20109
20110 !! test
20111 Raw output of variant escape tags (R flag)
20112 !! options
20113 language=zh variant=zh-tw
20114 !! wikitext
20115 Raw: -{R|zh:China;zh-tw:Taiwan}-
20116 !! html
20117 <p>Raw: zh:China;zh-tw:Taiwan
20118 </p>
20119 !! end
20120
20121 !! test
20122 Strings evaluating false shouldn't be ignored by Language converter (T51072)
20123 !! options
20124 language=zh variant=zh-cn
20125 !! input
20126 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
20127 !! result
20128 <p>0
20129 </p>
20130 !! end
20131
20132 !! test
20133 Conversion rules from [numeric-only string] to [something else] (T48634)
20134 !! options
20135 language=zh variant=zh-cn
20136 !! input
20137 -{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
20138 !! result
20139 <p>D12345EE12345
20140 </p>
20141 !! end
20142
20143 !! test
20144 Bidirectional converter rule entries with an empty value should be ignored (T53551)
20145 !! options
20146 language=zh variant=zh-cn
20147 !! input
20148 -{H|zh-cn:foo;zh-tw:;}-foobar
20149 !! result
20150 <p>foobar
20151 </p>
20152 !! end
20153
20154 !! test
20155 Unidirectional converter rule entries with an empty "from" string should be ignored (T53551)
20156 !! options
20157 language=zh variant=zh-cn
20158 !! input
20159 -{H|=>zh-cn:foo;}-foobar
20160 !! result
20161 <p>foobar
20162 </p>
20163 !! end
20164
20165 !! test
20166 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
20167 !! options
20168 language=zh variant=zh-cn
20169 !! input
20170 -{H|}-foobar
20171 !! result
20172 <p>foobar
20173 </p>
20174 !! end
20175
20176 !! test
20177 Nested using of manual convert syntax
20178 !! options
20179 language=zh variant=zh-hk
20180 !! wikitext
20181 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
20182 !! html
20183 <p>Nested: Hello Hong Kong!
20184 </p>
20185 !! end
20186
20187 # Since Parsoid is starting to emit canonical wikitext for links,
20188 # [http://example.com http://example.com] will not RT back to that
20189 # form anymore.
20190 !! test
20191 Proper conversion of text in external links
20192 !! options
20193 language=sr variant=sr-ec
20194 parsoid=wt2html
20195 !! wikitext
20196 http://www.google.com
20197 gopher://www.google.com
20198 [http://www.google.com http://www.google.com]
20199 [gopher://www.google.com gopher://www.google.com]
20200 [https://www.google.com irc://www.google.com]
20201 [ftp://www.google.com www.google.com/ftp://dir]
20202 [//www.google.com www.google.com]
20203 !! html/php
20204 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
20205 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
20206 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
20207 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
20208 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
20209 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
20210 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
20211 </p>
20212 !! html/parsoid
20213 <p><a rel="mw:ExtLink" href="http://www.google.com">http://www.google.com</a>
20214 <a rel="mw:ExtLink" href="gopher://www.google.com">gopher://www.google.com</a>
20215 <a rel="mw:ExtLink" href="http://www.google.com">http://www.google.com</a>
20216 <a rel="mw:ExtLink" href="gopher://www.google.com">gopher://www.google.com</a>
20217 <a rel="mw:ExtLink" href="https://www.google.com">irc://www.google.com</a>
20218 <a rel="mw:ExtLink" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
20219 <a rel="mw:ExtLink" href="//www.google.com">www.гоогле.цом</a></p>
20220 !! end
20221
20222 !! test
20223 Do not convert roman numbers to language variants
20224 !! options
20225 language=sr variant=sr-ec
20226 !! wikitext
20227 Fridrih IV je car.
20228 !! html
20229 <p>Фридрих IV је цар.
20230 </p>
20231 !! end
20232
20233 !! test
20234 Unclosed language converter markup "-{"
20235 !! options
20236 language=sr
20237 !! wikitext
20238 -{T|hello
20239 !! html
20240 <p>-{T|hello
20241 </p>
20242 !! end
20243
20244 !! test
20245 Don't convert raw rule "-{R|=&gt;}-" to "=>"
20246 !! options
20247 language=sr
20248 !! wikitext
20249 -{R|=&gt;}-
20250 !! html
20251 <p>=&gt;
20252 </p>
20253 !!end
20254
20255 !! test
20256 Don't break link parsing if language converter markup is in the caption.
20257 !! options
20258 language=sr variant=sr-ec
20259 !! wikitext
20260 [[Main Page|-{R|main page}-]]
20261 !! html
20262 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
20263 </p>
20264 !! end
20265
20266 # FIXME: This test is currently broken in the PHP parser (bug 52661)
20267 !! test
20268 Don't break image parsing if language converter markup is in the caption.
20269 !! options
20270 language=sr
20271 !! wikitext
20272 [[File:Foobar.jpg|-{R|caption}-]]
20273 !! html/parsoid
20274 <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>
20275 </p>
20276 !! end
20277
20278 # FIXME: This test is currently broken in the PHP parser (bug 52661)
20279 !! test
20280 Don't break list handling if language converter markup is in the item.
20281 !! options
20282 language=zh variant=zh-cn
20283 !! wikitext
20284 ;-{zh-cn:AAA;zh-tw:BBB}-
20285 !! html/php
20286 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
20287
20288 !! html/parsoid
20289 <dl><dt>AAA
20290 </dt></dl>
20291 !! end
20292
20293 # FIXME: This test is currently broken in the PHP parser (bug 52661)
20294 !! test
20295 Don't break table handling if language converter markup is in the cell.
20296 !! options
20297 language=sr variant=sr-ec
20298 !! wikitext
20299 {|
20300 |-
20301 | -{R|B}-
20302 |}
20303 !! html/php
20304 <table>
20305
20306 <tr>
20307 <td>Б}-
20308 </td></tr></table>
20309
20310 !! html/parsoid
20311 <table>
20312
20313 <tr>
20314 <td> B
20315 </td></tr></table>
20316
20317 !! end
20318
20319 !! test
20320 Bug 529: Uncovered bullet
20321 !! wikitext
20322 * Foo {{bullet}}
20323 !! html
20324 <ul><li> Foo </li>
20325 <li> Bar</li></ul>
20326
20327 !! end
20328
20329 # Plain MediaWiki does not remove empty lists, but tidy actually does.
20330 # Templates in Wikipedia rely on this behavior, as tidy has always been
20331 # enabled there. These tests are normally run *without* tidy, so specify the
20332 # full output here.
20333 # To test realistic parsing behavior, apply a tidy-like transformation to both
20334 # the expected output and your parser's output.
20335 !! test
20336 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
20337 !! wikitext
20338 ******* Foo {{bullet}}
20339 !! html
20340 <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>
20341 <li> Bar</li></ul>
20342
20343 !! end
20344
20345 !! test
20346 Bug 529: Uncovered table already at line-start
20347 !! wikitext
20348 x
20349
20350 {{table}}
20351 y
20352 !! html
20353 <p>x
20354 </p>
20355 <table>
20356 <tr>
20357 <td> 1 </td>
20358 <td> 2
20359 </td></tr>
20360 <tr>
20361 <td> 3 </td>
20362 <td> 4
20363 </td></tr></table>
20364 <p>y
20365 </p>
20366 !! end
20367
20368 !! test
20369 Bug 529: Uncovered bullet in parser function result
20370 !! wikitext
20371 * Foo {{lc:{{bullet}} }}
20372 !! html
20373 <ul><li> Foo </li>
20374 <li> bar</li></ul>
20375
20376 !! end
20377
20378 !! test
20379 Bug 5678: Double-parsed template argument
20380 !! wikitext
20381 {{lc:{{{1}}}|hello}}
20382 !! html
20383 <p>{{{1}}}
20384 </p>
20385 !! end
20386
20387 !! test
20388 Bug 5678: Double-parsed template invocation
20389 !! wikitext
20390 {{lc:{{paramtest {{!}} param = hello }} }}
20391 !! html
20392 <p>{{paramtest | param = hello }}
20393 </p>
20394 !! end
20395
20396 !! test
20397 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
20398 !! options
20399 language=cs
20400 title=[[Main Page]]
20401 !! wikitext
20402 {{PRVNÍVELKÉ:ěščř}}
20403 {{prvnívelké:ěščř}}
20404 {{PRVNÍMALÉ:ěščř}}
20405 {{prvnímalé:ěščř}}
20406 {{MALÁ:ěščř}}
20407 {{malá:ěščř}}
20408 {{VELKÁ:ěščř}}
20409 {{velká:ěščř}}
20410 !! html
20411 <p>Ěščř
20412 Ěščř
20413 ěščř
20414 ěščř
20415 ěščř
20416 ěščř
20417 ĚŠČŘ
20418 ĚŠČŘ
20419 </p>
20420 !! end
20421
20422 !! test
20423 Morwen/13: Unclosed link followed by heading
20424 !! wikitext
20425 [[link
20426 ==heading==
20427 !! html
20428 <p>[[link
20429 </p>
20430 <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>
20431
20432 !! end
20433
20434 !! test
20435 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
20436 !! wikitext
20437 {{foo|
20438 =heading=
20439 !! html
20440 <p>{{foo|
20441 </p>
20442 <h1><span class="mw-headline" id="heading">heading</span></h1>
20443
20444 !! end
20445
20446 !! test
20447 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
20448 !! wikitext
20449 {{foo|
20450 ==heading==
20451 !! html
20452 <p>{{foo|
20453 </p>
20454 <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>
20455
20456 !! end
20457
20458 !! test
20459 Tildes in comments
20460 !! options
20461 pst
20462 !! wikitext
20463 <!-- ~~~~ -->
20464 !! html/php
20465 <!-- ~~~~ -->
20466 !! end
20467
20468 !! test
20469 Paragraphs inside divs (no extra line breaks)
20470 !! wikitext
20471 <div>Line one
20472
20473 Line two</div>
20474 !! html
20475 <div>Line one
20476 Line two</div>
20477
20478 !! end
20479
20480 !! test
20481 Paragraphs inside divs (extra line break on open)
20482 !! wikitext
20483 <div>
20484 Line one
20485
20486 Line two</div>
20487 !! html
20488 <div>
20489 <p>Line one
20490 </p>
20491 Line two</div>
20492
20493 !! end
20494
20495 !! test
20496 Paragraphs inside divs (extra line break on close)
20497 !! wikitext
20498 <div>Line one
20499
20500 Line two
20501 </div>
20502 !! html
20503 <div>Line one
20504 <p>Line two
20505 </p>
20506 </div>
20507
20508 !! end
20509
20510 !! test
20511 Paragraphs inside divs (extra line break on open and close)
20512 !! wikitext
20513 <div>
20514 Line one
20515
20516 Line two
20517 </div>
20518 !! html
20519 <div>
20520 <p>Line one
20521 </p><p>Line two
20522 </p>
20523 </div>
20524
20525 !! end
20526
20527 !! test
20528 Nesting tags, paragraphs on lines which begin with <div>
20529 !! wikitext
20530 <div></div><strong>A
20531 B</strong>
20532 !! html/php+tidy
20533 <p><strong>A</strong></p>
20534 <p><strong>B</strong></p>
20535 !! html/parsoid
20536 <div></div>
20537 <p><strong>A
20538 B</strong>
20539 </p>
20540 !! end
20541
20542 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
20543 !! test
20544 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
20545 !! wikitext
20546 <blockquote>Line one
20547
20548 Line two</blockquote>
20549 !! html
20550 <blockquote>Line one
20551 Line two</blockquote>
20552
20553 !! html+tidy
20554 <blockquote>
20555 <p>Line one Line two</p>
20556 </blockquote>
20557 !! end
20558
20559 !! test
20560 Bug 6200: paragraphs inside blockquotes (extra line break on open)
20561 !! wikitext
20562 <blockquote>
20563 Line one
20564
20565 Line two</blockquote>
20566 !! html
20567 <blockquote>
20568 <p>Line one
20569 </p>
20570 Line two</blockquote>
20571
20572 !! html+tidy
20573 <blockquote>
20574 <p>Line one</p>
20575 Line two</blockquote>
20576 !! end
20577
20578 !! test
20579 Bug 6200: paragraphs inside blockquotes (extra line break on close)
20580 !! wikitext
20581 <blockquote>Line one
20582
20583 Line two
20584 </blockquote>
20585 !! html
20586 <blockquote>Line one
20587 <p>Line two
20588 </p>
20589 </blockquote>
20590
20591 !! html+tidy
20592 <blockquote>
20593 <p>Line one</p>
20594 <p>Line two</p>
20595 </blockquote>
20596 !! end
20597
20598 !! test
20599 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
20600 !! wikitext
20601 <blockquote>
20602 Line one
20603
20604 Line two
20605 </blockquote>
20606 !! html
20607 <blockquote>
20608 <p>Line one
20609 </p><p>Line two
20610 </p>
20611 </blockquote>
20612
20613 !! html+tidy
20614 <blockquote>
20615 <p>Line one</p>
20616 <p>Line two</p>
20617 </blockquote>
20618 !! end
20619
20620 !! test
20621 Paragraphs inside blockquotes/divs (no extra line breaks)
20622 !! wikitext
20623 <blockquote><div>Line one
20624
20625 Line two</div></blockquote>
20626 !! html
20627 <blockquote><div>Line one
20628 Line two</div></blockquote>
20629
20630 !! end
20631
20632 !! test
20633 Paragraphs inside blockquotes/divs (extra line break on open)
20634 !! wikitext
20635 <blockquote><div>
20636 Line one
20637
20638 Line two</div></blockquote>
20639 !! html
20640 <blockquote><div>
20641 <p>Line one
20642 </p>
20643 Line two</div></blockquote>
20644
20645 !! end
20646
20647 !! test
20648 Paragraphs inside blockquotes/divs (extra line break on close)
20649 !! wikitext
20650 <blockquote><div>Line one
20651
20652 Line two
20653 </div></blockquote>
20654 !! html
20655 <blockquote><div>Line one
20656 <p>Line two
20657 </p>
20658 </div></blockquote>
20659
20660 !! end
20661
20662 !! test
20663 Paragraphs inside blockquotes/divs (extra line break on open and close)
20664 !! wikitext
20665 <blockquote><div>
20666 Line one
20667
20668 Line two
20669 </div></blockquote>
20670 !! html
20671 <blockquote><div>
20672 <p>Line one
20673 </p><p>Line two
20674 </p>
20675 </div></blockquote>
20676
20677 !! end
20678
20679 !! test
20680 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
20681 !! options
20682 wgLinkHolderBatchSize=0
20683 !! wikitext
20684 [[meatball:1]]
20685 [[meatball:2]]
20686 [[meatball:3]]
20687 !! html
20688 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
20689 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
20690 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
20691 </p>
20692 !! end
20693
20694 !! test
20695 Free external link invading image caption
20696 !! wikitext
20697 [[Image:Foobar.jpg|thumb|http://x|hello]]
20698 !! html
20699 <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>
20700
20701 !! end
20702
20703 !! test
20704 Bug 15196: localised external link numbers
20705 !! options
20706 language=fa
20707 !! wikitext
20708 [http://en.wikipedia.org/]
20709 !! html/php
20710 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
20711 </p>
20712 !! html/parsoid
20713 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
20714 !! end
20715
20716 !! test
20717 Multibyte character in padleft
20718 !! wikitext
20719 {{padleft:-Hello|7|Æ}}
20720 !! html
20721 <p>Æ-Hello
20722 </p>
20723 !! end
20724
20725 !! test
20726 Multibyte character in padright
20727 !! wikitext
20728 {{padright:Hello-|7|Æ}}
20729 !! html
20730 <p>Hello-Æ
20731 </p>
20732 !! end
20733
20734 !!test
20735 formatdate parser function
20736 !! wikitext
20737 {{#formatdate:2009-03-24}}
20738 !! html
20739 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
20740 </p>
20741 !! end
20742
20743 !!test
20744 formatdate parser function, with default format
20745 !! wikitext
20746 {{#formatdate:2009-03-24|mdy}}
20747 !! html
20748 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
20749 </p>
20750 !! end
20751
20752 !! test
20753 Spacing of numbers in formatted dates
20754 !! wikitext
20755 {{#formatdate:January 15}}
20756 !! html
20757 <p><span class="mw-formatted-date" title="01-15">January 15</span>
20758 </p>
20759 !! end
20760
20761 !! test
20762 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
20763 !! options
20764 language=nl title=[[MediaWiki:Common.css]]
20765 !! wikitext
20766 {{#formatdate:2009-03-24|dmy}}
20767 !! html
20768 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
20769 </p>
20770 !! end
20771
20772 #
20773 #
20774 #
20775
20776 #
20777 # Edit comments
20778 #
20779
20780 !! test
20781 Edit comment with link
20782 !! options
20783 comment
20784 !! wikitext
20785 I like the [[Main Page]] a lot
20786 !! html/php
20787 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
20788 !!end
20789
20790 !! test
20791 Edit comment with link and link text
20792 !! options
20793 comment
20794 !! wikitext
20795 I like the [[Main Page|best pages]] a lot
20796 !! html/php
20797 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
20798 !!end
20799
20800 !! test
20801 Edit comment with link and link text with suffix
20802 !! options
20803 comment
20804 !! wikitext
20805 I like the [[Main Page|best page]]s a lot
20806 !! html/php
20807 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
20808 !!end
20809
20810 !! test
20811 Edit comment with section link (non-local, eg in history list)
20812 !! options
20813 comment title=[[Main Page]]
20814 !! wikitext
20815 /* External links */ removed bogus entries
20816 !! html/php
20817 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
20818 !!end
20819
20820 !! test
20821 Edit comment with section link and text before it (non-local, eg in history list)
20822 !! options
20823 comment title=[[Main Page]]
20824 !! wikitext
20825 pre-comment text /* External links */ removed bogus entries
20826 !! html/php
20827 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>
20828 !!end
20829
20830 !! test
20831 Edit comment with section link (local, eg in diff view)
20832 !! options
20833 comment local title=[[Main Page]]
20834 !! wikitext
20835 /* External links */ removed bogus entries
20836 !! html/php
20837 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
20838 !!end
20839
20840 !! test
20841 Edit comment with subpage link (bug 14080)
20842 !! options
20843 comment
20844 subpage
20845 title=[[Subpage test]]
20846 !! wikitext
20847 Poked at a [[/subpage]] here...
20848 !! html/php
20849 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
20850 !!end
20851
20852 !! test
20853 Edit comment with subpage link and link text (bug 14080)
20854 !! options
20855 comment
20856 subpage
20857 title=[[Subpage test]]
20858 !! wikitext
20859 Poked at a [[/subpage|neat little page]] here...
20860 !! html/php
20861 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
20862 !!end
20863
20864 !! test
20865 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
20866 !! options
20867 comment
20868 title=[[Subpage test]]
20869 !! wikitext
20870 Poked at a [[/subpage]] here...
20871 !! html/php
20872 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...
20873 !!end
20874
20875 !! test
20876 Edit comment with bare anchor link (local, as on diff)
20877 !! options
20878 comment
20879 local
20880 title=[[Main Page]]
20881 !! wikitext
20882 [[#section]]
20883 !! html/php
20884 <a href="#section">#section</a>
20885 !! end
20886
20887 !! test
20888 Edit comment with bare anchor link (non-local, as on history)
20889 !! options
20890 comment
20891 title=[[Main Page]]
20892 !! wikitext
20893 [[#section]]
20894 !! html/php
20895 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
20896 !! end
20897
20898 !! test
20899 Anchor starting with underscore
20900 !! options
20901 title=[[Foo]]
20902 !! wikitext
20903 [[#_ref|One]]
20904 !! html/php
20905 <p><a href="#_ref">One</a>
20906 </p>
20907 !! html/parsoid
20908 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
20909 !! end
20910
20911 !! test
20912 Id starting with underscore
20913 !! wikitext
20914 <div id="_ref"></div>
20915 !! html/*
20916 <div id="_ref"></div>
20917
20918 !! end
20919
20920 !! test
20921 Edit comment with link with more than one pipe (T99346)
20922 !! options
20923 comment
20924 !! wikitext
20925 [[Main Page|Many|pipes]]
20926 !! html
20927 <a href="/wiki/Main_Page" title="Main Page">Many|pipes</a>
20928 !! end
20929
20930 !! test
20931 Complex edit comment with link with more than one pipe (T99346)
20932 !! options
20933 comment
20934 !! wikitext
20935 Created page with "<noinclude>[[Category:Requests for permissions/Bot|{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}]]</noinclude> === [[User:MineoBot|]] 8=== {{Request for permissions/links|Mineo..."
20936 !! html
20937 Created page with &quot;&lt;noinclude&gt;<a href="/index.php?title=Category:Requests_for_permissions/Bot&amp;action=edit&amp;redlink=1" class="new" title="Category:Requests for permissions/Bot (page does not exist)">{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}</a>&lt;/noinclude&gt; === <a href="/index.php?title=User:MineoBot&amp;action=edit&amp;redlink=1" class="new" title="User:MineoBot (page does not exist)">User:MineoBot</a> 8=== {{Request for permissions/links|Mineo...&quot;
20938 !! end
20939
20940 !! test
20941 Space normalisation on autocomment (bug 22784)
20942 !! options
20943 comment
20944 title=[[Main Page]]
20945 !! wikitext
20946 /* __hello__world__ */
20947 !! html/php
20948 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
20949 !! end
20950
20951 !! test
20952 percent-encoding and + signs in comments (Bug 26410)
20953 !! options
20954 comment
20955 !! wikitext
20956 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
20957 !! html/php
20958 <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>
20959 !! end
20960
20961 # Parsoid doesn't support this yet: see bug 73581
20962 # but it *should* omit the 'src' attribute if the image is bad.
20963 # PHP side of tests was disabled in
20964 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
20965 # because of issues in the PHP parserTests infrastructure
20966 # (but the output below is indeed what the PHP side emits)
20967 !! test
20968 Bad images - basic functionality
20969 !! wikitext
20970 [[File:Bad.jpg]]
20971 !! DISABLED/html/php
20972 !! html/parsoid
20973 <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>
20974 !! end
20975
20976 !! test
20977 Bad images - bug 16039: text after bad image disappears
20978 !! wikitext
20979 Foo bar
20980 [[File:Bad.jpg]]
20981 Bar foo
20982 !! DISABLED/html/php
20983 <p>Foo bar
20984 </p><p>Bar foo
20985 </p>
20986 !! html/parsoid
20987 <p>Foo bar
20988 <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>
20989 Bar foo</p>
20990 !! end
20991
20992 !! test
20993 Verify that displaytitle works (bug #22501) no displaytitle
20994 !! options
20995 showtitle
20996 !! config
20997 wgAllowDisplayTitle=true
20998 wgRestrictDisplayTitle=false
20999 !! wikitext
21000 this is not the the title
21001 !! html/php
21002 Parser test
21003 <p>this is not the the title
21004 </p>
21005 !! end
21006
21007 !! test
21008 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
21009 !! options
21010 showtitle
21011 title=[[Screen]]
21012 !! config
21013 wgAllowDisplayTitle=true
21014 wgRestrictDisplayTitle=false
21015 !! wikitext
21016 this is not the the title
21017 {{DISPLAYTITLE:whatever}}
21018 !! html/php
21019 whatever
21020 <p>this is not the the title
21021 </p>
21022 !! end
21023
21024 !! test
21025 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
21026 !! options
21027 showtitle
21028 title=[[Screen]]
21029 !! config
21030 wgAllowDisplayTitle=true
21031 wgRestrictDisplayTitle=true
21032 !! wikitext
21033 this is not the the title
21034 {{DISPLAYTITLE:whatever}}
21035 !! html/php
21036 Screen
21037 <p>this is not the the title
21038 </p>
21039 !! end
21040
21041 !! test
21042 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
21043 !! options
21044 showtitle
21045 title=[[Screen]]
21046 !! config
21047 wgAllowDisplayTitle=true
21048 wgRestrictDisplayTitle=true
21049 !! wikitext
21050 this is not the the title
21051 {{DISPLAYTITLE:screen}}
21052 !! html/php
21053 screen
21054 <p>this is not the the title
21055 </p>
21056 !! end
21057
21058 !! test
21059 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
21060 !! options
21061 showtitle
21062 title=[[Screen]]
21063 !! config
21064 wgAllowDisplayTitle=false
21065 !! wikitext
21066 this is not the the title
21067 {{DISPLAYTITLE:screen}}
21068 !! html/php
21069 Screen
21070 <p>this is not the the title
21071 <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>
21072 </p>
21073 !! end
21074
21075 !! test
21076 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
21077 !! options
21078 showtitle
21079 title=[[Screen]]
21080 !! config
21081 wgAllowDisplayTitle=false
21082 !! wikitext
21083 this is not the the title
21084 !! html/php
21085 Screen
21086 <p>this is not the the title
21087 </p>
21088 !! end
21089
21090 !! test
21091 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
21092 !! options
21093 showtitle
21094 title=[[Screen]]
21095 !! config
21096 wgAllowDisplayTitle=true
21097 wgRestrictDisplayTitle=true
21098 !! wikitext
21099 this is not the the title
21100 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
21101 !! html/php
21102 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
21103 <p>this is not the the title
21104 </p>
21105 !! end
21106
21107 !! test
21108 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
21109 !! options
21110 showtitle
21111 title=[[Screen]]
21112 !! config
21113 wgAllowDisplayTitle=true
21114 wgRestrictDisplayTitle=true
21115 !! wikitext
21116 this is not the the title
21117 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
21118 !! html/php
21119 <span style="color: red;">s</span>creen
21120 <p>this is not the the title
21121 </p>
21122 !! end
21123
21124 !! test
21125 Page status indicators: Empty name is invalid
21126 !! options
21127 showindicators
21128 !! wikitext
21129 <indicator name=" "></indicator>
21130 <indicator></indicator>
21131 !! html
21132 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
21133 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
21134 </p>
21135 !! end
21136
21137 !! test
21138 Page status indicators: Weird syntaxes that are okay
21139 !! options
21140 showindicators
21141 !! wikitext
21142 <indicator name="empty" />
21143 <indicator name="name"></indicator>
21144 !! html
21145 empty=
21146 name=
21147 <p><br />
21148 </p>
21149 !! end
21150
21151 !! test
21152 Page status indicators: Torture test
21153 !! options
21154 showindicators
21155 !! wikitext
21156 <indicator name="01">hello world</indicator>
21157 <indicator name="02">[[Main Page]]</indicator>
21158 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
21159 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
21160 <indicator name="05">* foo
21161 * bar</indicator>
21162 <indicator name="06"><nowiki>foo</nowiki></indicator>
21163 <indicator name="07"> Preformatted</indicator>
21164 <indicator name="08"><div>Broken tag</indicator>
21165 <indicator name="09">{| class=wikitable
21166 | cell
21167 |}</indicator>
21168 <indicator name="10">Two
21169
21170 paragraphs</indicator>
21171 !! html
21172 01=hello world
21173 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
21174 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" />
21175 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>
21176 05=<ul><li> foo</li>
21177 <li> bar</li></ul>
21178
21179 06=foo
21180 07=<pre>Preformatted
21181 </pre>
21182 08=<div>Broken tag</div>
21183
21184 09=<table class="wikitable">
21185 <tr>
21186 <td> cell
21187 </td></tr></table>
21188
21189 10=<p>Two
21190 </p><p>paragraphs
21191 </p>
21192 <p><br />
21193 </p><p><br />
21194 </p><p><br />
21195 </p><p><br />
21196 </p><p><br />
21197 </p>
21198 !! end
21199
21200 !! test
21201 preload: check <noinclude> and <includeonly>
21202 !! options
21203 preload
21204 !! wikitext
21205 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
21206 !! html/php
21207 Hello kind world.
21208 !! end
21209
21210 !! test
21211 preload: check <onlyinclude>
21212 !! options
21213 preload
21214 !! wikitext
21215 Goodbye <onlyinclude>Hello world</onlyinclude>
21216 !! html/php
21217 Hello world
21218 !! end
21219
21220 !! test
21221 preload: can pass tags through if we want to
21222 !! options
21223 preload
21224 !! wikitext
21225 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
21226 !! html/php
21227 <includeonly>Hello world</includeonly>
21228 !! end
21229
21230 !! test
21231 preload: check that it doesn't try to do tricks
21232 !! options
21233 preload
21234 !! wikitext
21235 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
21236 !! html/php
21237 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
21238 !! end
21239
21240 !! test
21241 Play a bit with r67090 and bug 3158
21242 !! wikitext
21243 <div style="width:50% !important">&nbsp;</div>
21244 <div style="width:50%&nbsp;!important">&nbsp;</div>
21245 <div style="width:50%&#160;!important">&nbsp;</div>
21246 <div style="border : solid;">&nbsp;</div>
21247 !! html/php
21248 <div style="width:50% !important">&#160;</div>
21249 <div style="width:50% !important">&#160;</div>
21250 <div style="width:50% !important">&#160;</div>
21251 <div style="border&#160;: solid;">&#160;</div>
21252
21253 !! html/parsoid
21254 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
21255 <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>
21256 <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>
21257 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
21258
21259 !! end
21260
21261 !! test
21262 HTML5 data attributes
21263 !! wikitext
21264 <span data-foo="bar">Baz</span>
21265 <p data-abc-def_hij="">Quuz</p>
21266 !! html/php
21267 <p><span data-foo="bar">Baz</span>
21268 </p>
21269 <p data-abc-def_hij="">Quuz</p>
21270
21271 !! html/parsoid
21272 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
21273 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
21274 !! end
21275
21276 !! test
21277 Strip reserved data attributes
21278 !! wikitext
21279 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
21280 !! html/php
21281 <div data-ok="fred">d</div>
21282
21283 !! html/parsoid
21284 <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>
21285 !! end
21286
21287 !! test
21288 percent-encoding and + signs in internal links (Bug 26410)
21289 !! wikitext
21290 [[User:+%]] [[Page+title%]]
21291 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
21292 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
21293 [[%33%45]] [[%33%45+]]
21294 !! html/php
21295 <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>
21296 <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>
21297 <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>
21298 <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>
21299 </p>
21300 !! html/parsoid
21301 <p><a rel="mw:WikiLink" href="./User:+%25" title="User:+%" data-parsoid='{"stx":"simple","a":{"href":"./User:+%25"},"sa":{"href":"User:+%"}}'>User:+%</a> <a rel="mw:WikiLink" href="./Page+title%25" title="Page+title%" data-parsoid='{"stx":"simple","a":{"href":"./Page+title%25"},"sa":{"href":"Page+title%"}}'>Page+title%</a>
21302 <a rel="mw:WikiLink" href="./%25+" title="%+" data-parsoid='{"stx":"simple","a":{"href":"./%25+"},"sa":{"href":"%+"}}'>%+</a> <a rel="mw:WikiLink" href="./%25+" title="%+" data-parsoid='{"stx":"piped","a":{"href":"./%25+"},"sa":{"href":"%+"}}'>%20</a> <a rel="mw:WikiLink" href="./%25+" title="%+" data-parsoid='{"stx":"simple","a":{"href":"./%25+"},"sa":{"href":"%+ "}}'>%+ </a> <a rel="mw:WikiLink" href="./%25+r" title="%+r" data-parsoid='{"stx":"simple","a":{"href":"./%25+r"},"sa":{"href":"%+r"}}'>%+r</a>
21303 <a rel="mw:WikiLink" href="./%25" title="%" data-parsoid='{"stx":"simple","a":{"href":"./%25"},"sa":{"href":"%"}}'>%</a> <a rel="mw:WikiLink" href="./+" title="+" data-parsoid='{"stx":"simple","a":{"href":"./+"},"sa":{"href":"+"}}'>+</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=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./Bar\"},\"sa\":{\"href\":\"bar\"},\"dsr\":[94,101,2,2]}&#39;>bar&lt;/a>"}'><a href="./File:%25+abc9" data-parsoid='{"a":{"href":"./File:%25+abc9"},"sa":{}}'><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>
21304 <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>
21305 !! end
21306
21307 !! test
21308 Special characters in embedded file links (bug 27679)
21309 !! wikitext
21310 [[File:Contains & ampersand.jpg]]
21311 [[File:Does not exist.jpg|Title with & ampersand]]
21312 !! html/php
21313 <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>
21314 <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>
21315 </p>
21316 !! html/parsoid
21317 <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>
21318 <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>
21319 !! end
21320
21321 !! test
21322 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
21323 !! wikitext
21324 Text&apos;s been normalized?
21325 !! html
21326 <p>Text&#39;s been normalized?
21327 </p>
21328 !! end
21329
21330 !! test
21331 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
21332 !! wikitext
21333 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
21334 !! html
21335 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
21336 </p>
21337 !! end
21338
21339 !! test
21340 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
21341 !! wikitext
21342 [http://www.example.org/ ideograms]
21343 !! html
21344 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
21345 </p>
21346 !! end
21347
21348 !! test
21349 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
21350 !! wikitext
21351 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
21352 !! html
21353 <p><img src="http://www.example.org/pic.png" alt="pic.png"/> &lt;-- U+3000 (vim: ^Vu3000)
21354 </p>
21355 !! end
21356
21357 !! article
21358 Mediawiki:loop1
21359 !! text
21360 {{Identical|A}}
21361 !! endarticle
21362
21363 !! article
21364 Mediawiki:loop2
21365 !! text
21366 {{Identical|B}}
21367 !! endarticle
21368
21369 !! article
21370 Template:Identical
21371 !! text
21372 {{int:loop1}}
21373 {{int:loop2}}
21374 !! endarticle
21375
21376 !! test
21377 Bug 31098 Template which includes system messages which includes the template
21378 !! wikitext
21379 {{Identical}}
21380 !! html
21381 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
21382 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
21383 </p>
21384 !! end
21385
21386 !! test
21387 Bug31490 Turkish: ucfirst 'blah'
21388 !! options
21389 language=tr
21390 !! wikitext
21391 {{ucfirst:blah}}
21392 !! html
21393 <p>Blah
21394 </p>
21395 !! end
21396
21397 !! test
21398 Bug31490 Turkish: ucfirst 'ix'
21399 !! options
21400 language=tr
21401 !! wikitext
21402 {{ucfirst:ix}}
21403 !! html
21404 <p>İx
21405 </p>
21406 !! end
21407
21408 !! test
21409 Bug31490 Turkish: lcfirst 'BLAH'
21410 !! options
21411 language=tr
21412 !! wikitext
21413 {{lcfirst:BLAH}}
21414 !! html
21415 <p>bLAH
21416 </p>
21417 !! end
21418
21419 !! test
21420 Bug31490 Turkish: ucfırst (with a dotless i)
21421 !! options
21422 language=tr
21423 !! wikitext
21424 {{ucfırst:blah}}
21425 !! html
21426 <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>
21427 </p>
21428 !! end
21429
21430 !! test
21431 Bug31490 ucfırst (with a dotless i) with English language
21432 !! options
21433 language=en
21434 !! wikitext
21435 {{ucfırst:blah}}
21436 !! html
21437 <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>
21438 </p>
21439 !! end
21440
21441 !! test
21442 Bug 26375: TOC with italics
21443 !! options
21444 title=[[Main Page]]
21445 !! wikitext
21446 __TOC__
21447 == ''Lost'' episodes ==
21448 !! html
21449 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21450 <ul>
21451 <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>
21452 </ul>
21453 </div>
21454
21455 <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>
21456
21457 !! end
21458
21459 !! test
21460 Bug 26375: TOC with bold
21461 !! options
21462 title=[[Main Page]]
21463 !! wikitext
21464 __TOC__
21465 == '''should be bold''' then normal text ==
21466 !! html
21467 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21468 <ul>
21469 <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>
21470 </ul>
21471 </div>
21472
21473 <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>
21474
21475 !! end
21476
21477 !! test
21478 Bug 33845: Headings become cursive in TOC when they contain an image
21479 !! options
21480 title=[[Main Page]]
21481 !! wikitext
21482 __TOC__
21483 == Image [[Image:foobar.jpg]] ==
21484 !! html
21485 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21486 <ul>
21487 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
21488 </ul>
21489 </div>
21490
21491 <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>
21492
21493 !! end
21494
21495 !! test
21496 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
21497 !! options
21498 title=[[Main Page]]
21499 !! wikitext
21500 __TOC__
21501 == <blockquote>Quote</blockquote> ==
21502 !! html
21503 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21504 <ul>
21505 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
21506 </ul>
21507 </div>
21508
21509 <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>
21510
21511 !! html+tidy
21512 <p></p>
21513 <div id="toc" class="toc">
21514 <div id="toctitle">
21515 <h2>Contents</h2>
21516 </div>
21517 <ul>
21518 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
21519 </ul>
21520 </div>
21521 <p></p>
21522 <h2><span class="mw-headline" id="Quote"></span></h2>
21523 <blockquote>
21524 <p><span class="mw-headline" id="Quote">Quote</span></p>
21525 </blockquote>
21526 <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>
21527 !! end
21528
21529 !! test
21530 Unclosed tags in TOC
21531 !! options
21532 title=[[Main Page]]
21533 !! wikitext
21534 __TOC__
21535 == Proof: 2 < 3 ==
21536 <small>Hanc marginis exiguitas non caperet.</small>
21537 QED
21538 !! html
21539 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21540 <ul>
21541 <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>
21542 </ul>
21543 </div>
21544
21545 <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>
21546 <p><small>Hanc marginis exiguitas non caperet.</small>
21547 QED
21548 </p>
21549 !! end
21550
21551 !! test
21552 Multiple tags in TOC
21553 !! wikitext
21554 __TOC__
21555 == <i>Foo</i> <b>Bar</b> ==
21556
21557 == <i>Foo</i> <blockquote>Bar</blockquote> ==
21558 !! html
21559 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21560 <ul>
21561 <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>
21562 <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>
21563 </ul>
21564 </div>
21565
21566 <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>
21567 <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>
21568
21569 !! html+tidy
21570 <p></p>
21571 <div id="toc" class="toc">
21572 <div id="toctitle">
21573 <h2>Contents</h2>
21574 </div>
21575 <ul>
21576 <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>
21577 <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>
21578 </ul>
21579 </div>
21580 <p></p>
21581 <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>
21582 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
21583 <blockquote>
21584 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
21585 </blockquote>
21586 <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>
21587 !! end
21588
21589 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
21590 # html5 tag parsing.
21591 !! test
21592 Tags with parameters in TOC
21593 !! options
21594 parsoid=wt2html
21595 !! wikitext
21596 __TOC__
21597 == <sup class="in-h2">Hello</sup> ==
21598
21599 == <sup class="a > b">Evilbye</sup> ==
21600 !! html/php
21601 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21602 <ul>
21603 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
21604 <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>
21605 </ul>
21606 </div>
21607
21608 <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>
21609 <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>
21610
21611 !! html/parsoid
21612 <meta property="mw:PageProp/toc" />
21613 <h2> <sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup> </h2>
21614
21615 <h2> <sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup> </h2>
21616 !! end
21617
21618 !! test
21619 span tags with directionality in TOC
21620 !! wikitext
21621 __TOC__
21622 == <span dir="ltr">C++</span> ==
21623
21624 == <span dir="rtl">זבנג!</span> ==
21625
21626 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
21627
21628 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
21629
21630 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
21631 !! html
21632 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21633 <ul>
21634 <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>
21635 <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>
21636 <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>
21637 <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>
21638 <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>
21639 </ul>
21640 </div>
21641
21642 <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>
21643 <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>
21644 <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>
21645 <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>
21646 <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>
21647
21648 !! end
21649
21650 !! test
21651 Bug 72884: bdi element in ToC
21652 !! wikitext
21653 __TOC__
21654 == <bdi>test</bdi> ==
21655 !! html
21656 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21657 <ul>
21658 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
21659 </ul>
21660 </div>
21661
21662 <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>
21663
21664 !! end
21665
21666 !! test
21667 T35715: s/strike element in ToC
21668 !! wikitext
21669 __TOC__
21670 == <s>test</s> test <strike>test</strike> ==
21671 !! html
21672 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21673 <ul>
21674 <li class="toclevel-1 tocsection-1"><a href="#test_test_test"><span class="tocnumber">1</span> <span class="toctext"><s>test</s> test <strike>test</strike></span></a></li>
21675 </ul>
21676 </div>
21677
21678 <h2><span class="mw-headline" id="test_test_test"><s>test</s> test <strike>test</strike></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 test test">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
21679
21680 !! end
21681
21682 # Note that the html output does not have the <p></p>, but the
21683 # html+tidy output *does*. This is because the empty <p></p> is
21684 # removed by the sanitizer, but only when tidy is *not* enabled (!).
21685 !! test
21686 Empty <p> tag in TOC, removed by Sanitizer (T92892)
21687 !! wikitext
21688 __TOC__
21689 == x ==
21690 !! html
21691 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21692 <ul>
21693 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
21694 </ul>
21695 </div>
21696
21697 <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>
21698
21699 !! html+tidy
21700 <p></p>
21701 <div id="toc" class="toc">
21702 <div id="toctitle">
21703 <h2>Contents</h2>
21704 </div>
21705 <ul>
21706 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
21707 </ul>
21708 </div>
21709 <p></p>
21710 <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>
21711 !! end
21712
21713 !! article
21714 MediaWiki:Bug32057
21715 !! text
21716 == {{int:headline_sample}} ==
21717 !! endarticle
21718
21719 !! test
21720 Bug 32057: Title needed when expanding <h> nodes.
21721 !! options
21722 title=[[Main Page]]
21723 !! wikitext
21724 {{int:Bug32057}}
21725 !! html
21726 <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>
21727
21728 !! end
21729
21730 !! test
21731 Strip marker in urlencode
21732 !! wikitext
21733 {{urlencode:x<nowiki/>y}}
21734 {{urlencode:x<nowiki/>y|wiki}}
21735 {{urlencode:x<nowiki/>y|path}}
21736 {{urlencode:x<pre id="one">two</pre>y}}
21737 !! html
21738 <p>xy
21739 xy
21740 xy
21741 xy
21742 </p>
21743 !! end
21744
21745 !! test
21746 Strip marker in lc
21747 !! wikitext
21748 {{lc:x<nowiki/>y}}
21749 !! html
21750 <p>xy
21751 </p>
21752 !! end
21753
21754 !! test
21755 Strip marker in uc
21756 !! wikitext
21757 {{uc:x<nowiki/>y}}
21758 !! html
21759 <p>XY
21760 </p>
21761 !! end
21762
21763 !! test
21764 Strip marker in formatNum
21765 !! wikitext
21766 {{formatnum:1<nowiki/>2}}
21767 {{formatnum:1<nowiki/>2|R}}
21768 !! html
21769 <p>12
21770 12
21771 </p>
21772 !! end
21773
21774 !! test
21775 Check noCommafy in formatNum
21776 !! options
21777 language=be-tarask
21778 !! wikitext
21779 {{formatnum:123456.78}}
21780 {{formatnum:123456.78|NOSEP}}
21781 !! html
21782 <p>123 456,78
21783 123456.78
21784 </p>
21785 !! end
21786
21787 !! test
21788 Wrong option for formatNum (bug 56199)
21789 !! wikitext
21790 {{formatnum:1,234.56|Random}}
21791 {{formatnum:1,234.56|EVERYTHING}}
21792 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
21793 !! html
21794 <p>1,234.56
21795 1,234.56
21796 1,234.56
21797 </p>
21798 !! end
21799
21800 !! test
21801 Strip marker in grammar
21802 !! options
21803 language=fi
21804 !! wikitext
21805 {{grammar:elative|foo<nowiki/>bar}}
21806 !! html
21807 <p>foobarista
21808 </p>
21809 !! end
21810
21811 !! test
21812 Strip marker in padleft
21813 !! wikitext
21814 {{padleft:|2|x<nowiki/>y}}
21815 !! html
21816 <p>xy
21817 </p>
21818 !! end
21819
21820 !! test
21821 Strip marker in padright
21822 !! wikitext
21823 {{padright:|2|x<nowiki/>y}}
21824 !! html
21825 <p>xy
21826 </p>
21827 !! end
21828
21829 !! test
21830 Strip marker in anchorencode
21831 !! wikitext
21832 {{anchorencode:x<nowiki/>y}}
21833 !! html
21834 <p>xy
21835 </p>
21836 !! end
21837
21838 !! test
21839 nowiki inside link inside heading (bug 18295)
21840 !! wikitext
21841 ==[[foo|x<nowiki>y</nowiki>z]]==
21842 !! html
21843 <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>
21844
21845 !! end
21846
21847 !! test
21848 new support for bdi element (bug 31817)
21849 !! wikitext
21850 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
21851 !! html
21852 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
21853
21854 !!end
21855
21856 !! test
21857 Ignore pipe between table row attributes
21858 !! wikitext
21859 {|
21860 | quux
21861 |- id=foo | style='color: red'
21862 | bar
21863 |}
21864 !! html
21865 <table>
21866 <tr>
21867 <td> quux
21868 </td></tr>
21869 <tr id="foo" style="color: red">
21870 <td> bar
21871 </td></tr></table>
21872
21873 !! end
21874
21875 !!test
21876 Gallery override link with WikiLink (bug 34852)
21877 !! wikitext
21878 <gallery>
21879 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
21880 </gallery>
21881 !! html
21882 <ul class="gallery mw-gallery-traditional">
21883 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21884 <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>
21885 <div class="gallerytext">
21886 <p>caption
21887 </p>
21888 </div>
21889 </div></li>
21890 </ul>
21891
21892 !! end
21893
21894 !!test
21895 Gallery override link with absolute external link (bug 34852)
21896 !! wikitext
21897 <gallery>
21898 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
21899 </gallery>
21900 !! html
21901 <ul class="gallery mw-gallery-traditional">
21902 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21903 <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>
21904 <div class="gallerytext">
21905 <p>caption
21906 </p>
21907 </div>
21908 </div></li>
21909 </ul>
21910
21911 !! end
21912
21913 !!test
21914 Gallery override link with malicious javascript (bug 34852)
21915 !! wikitext
21916 <gallery>
21917 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
21918 </gallery>
21919 !! html
21920 <ul class="gallery mw-gallery-traditional">
21921 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21922 <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>
21923 <div class="gallerytext">
21924 <p>caption
21925 </p>
21926 </div>
21927 </div></li>
21928 </ul>
21929
21930 !! end
21931
21932 !!test
21933 Gallery with invalid title as link (bug 43964)
21934 !! wikitext
21935 <gallery>
21936 File:foobar.jpg|link=<
21937 </gallery>
21938 !! html
21939 <ul class="gallery mw-gallery-traditional">
21940 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21941 <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>
21942 <div class="gallerytext">
21943 </div>
21944 </div></li>
21945 </ul>
21946
21947 !! end
21948
21949 !!test
21950 Language parser function
21951 !! wikitext
21952 {{#language:ar}}
21953 !! html
21954 <p>العربية
21955 </p>
21956 !! end
21957
21958 !!test
21959 Padleft and padright as substr
21960 !! wikitext
21961 {{padleft:|3|abcde}}
21962 {{padright:|3|abcde}}
21963 !! html
21964 <p>abc
21965 abc
21966 </p>
21967 !! end
21968
21969 !!test
21970 Special parser function
21971 !! wikitext
21972 {{#special:RandomPage}}
21973 {{#special:BaDtItLe}}
21974 {{#special:Foobar}}
21975 !! html
21976 <p>Special:Random
21977 Special:Badtitle
21978 Special:Foobar
21979 </p>
21980 !! end
21981
21982 !!test
21983 Bug 34939 - Case insensitive link parsing ([HttP://])
21984 !! wikitext
21985 [HttP://MediaWiki.Org/]
21986 !! html/php
21987 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
21988 </p>
21989 !! html/parsoid
21990 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
21991 !! end
21992
21993 !!test
21994 Bug 34939 - Case insensitive link parsing ([HttP:// title])
21995 !! wikitext
21996 [HttP://MediaWiki.Org/ MediaWiki]
21997 !! html
21998 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
21999 </p>
22000 !! end
22001
22002 !!test
22003 Bug 34939 - Case insensitive link parsing (HttP://)
22004 !! wikitext
22005 HttP://MediaWiki.Org/
22006 !! html/php
22007 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
22008 </p>
22009 !! html/parsoid
22010 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
22011 !! end
22012
22013 !!test
22014 Disable TOC
22015 !! options
22016 notoc
22017 !! wikitext
22018 Lead
22019 == Section 1 ==
22020 == Section 2 ==
22021 == Section 3 ==
22022 == Section 4 ==
22023 == Section 5 ==
22024 !! html
22025 <p>Lead
22026 </p>
22027
22028 <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>
22029 <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>
22030 <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>
22031 <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>
22032 <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>
22033
22034 !! end
22035
22036
22037 ###
22038 ### Parsoid-specific tests
22039 ### Parsoid-PHP parser incompatibilities
22040 ###
22041 !!test
22042 1. SOL-sensitive wikitext tokens as template-args
22043 !!options
22044 parsoid=wt2html,wt2wt
22045 !! wikitext
22046 {{echo|*a}}
22047 {{echo|#a}}
22048 {{echo|:a}}
22049 !! html
22050 <span about="#mwt1" typeof="mw:Transclusion">
22051 </span><ul about="#mwt1"><li>a</li>
22052 </ul>
22053 <span about="#mwt2" typeof="mw:Transclusion">
22054 </span><ol about="#mwt2"><li>a</li>
22055 </ol>
22056 <span about="#mwt3" typeof="mw:Transclusion">
22057 </span><dl about="#mwt3"><dd>a</dd>
22058 </dl>
22059 !!end
22060
22061 #### -----------------------------------------------------------------
22062 #### Parsoid-specific functionality tests
22063 #### -----------------------------------------------------------------
22064
22065 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
22066 # We know wt2wt will fail, but we expect selser to pass.
22067 # Due to the nature of our testing, wt2wt and selser tests will enter the
22068 # blacklist and we'll catch selser regressions based on changes to the
22069 # blacklist entries for selser tests.
22070 !! test
22071 1. Bad treebuilder fixup of formatting elt is cleaned up
22072 !! options
22073 parsoid=wt2html,wt2wt
22074 !! wikitext
22075 {|
22076 |
22077 <small>
22078 [[Image:Foobar.jpg|right|Test]]
22079 </small>
22080 |}
22081 !! html/parsoid
22082 <table>
22083 <tbody><tr><td>
22084 <small>
22085 <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>
22086 </small>
22087 </td></tr>
22088 </tbody></table>
22089 !! end
22090
22091 !! test
22092 2. Bad treebuilder fixup of formatting elt is cleaned up
22093 !! options
22094 parsoid=wt2html,wt2wt
22095 !! wikitext
22096 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
22097
22098 <small>[[Image:Foobar.jpg|right|300px]]</small>
22099 !! html/parsoid
22100
22101 <p><b>foo</b></p>
22102 <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>
22103 <p><b>bar</b></p>
22104 <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>
22105 !! end
22106
22107 !! test
22108 3. Bad treebuilder fixup of formatting elt is cleaned up
22109 !! options
22110 parsoid=wt2html,wt2wt
22111 !! wikitext
22112 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
22113 !! html/parsoid
22114 <p><small><b>foo</b></small></p>
22115 <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>
22116 <p><small><b>bar</b></small></p>
22117 !! end
22118
22119 !! test
22120 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
22121 !! options
22122 parsoid=wt2html,wt2wt
22123 !! wikitext
22124 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
22125 !! html/parsoid
22126 <p><b><small></small></b></p>
22127 <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>
22128 <p></p>
22129 !! end
22130
22131 #### ----------------------------------------------------------------
22132 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
22133 #### tags. Parsoid's output for these tags differs from that of the
22134 #### PHP parser.
22135 #### ----------------------------------------------------------------
22136
22137 !!test
22138 Ref: 1. ref-location should be replaced with an index span
22139 !! wikitext
22140 A <ref>foo</ref>
22141 B <ref name="x">foo</ref>
22142 C <ref name="y" />
22143 <references />
22144 !! html/parsoid
22145 <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>
22146 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>
22147 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>
22148 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22149 <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>
22150 <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>
22151 <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>
22152 </ol>
22153 !!end
22154
22155 !!test
22156 Ref: 2. ref-tags with identical names should all get the same index
22157 !! wikitext
22158 A <ref name="x">foo</ref>
22159 B <ref name="x" />
22160 <references />
22161 !! html/parsoid
22162 <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>
22163 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>
22164 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22165 <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>
22166 </ol>
22167 !!end
22168
22169 !!test
22170 Ref: 3. spaces in ref-names should be ignored
22171 !! wikitext
22172 A <ref name="x">foo</ref>
22173 B <ref name=" x " />
22174 C <ref name= x />
22175 <references />
22176 !! html/parsoid
22177 <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>
22178 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>
22179 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>
22180 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22181 <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>
22182 </ol>
22183 !!end
22184
22185 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
22186 !!test
22187 Ref: 4. 'constructor' should be accepted as a valid ref-name
22188 !! wikitext
22189 A <ref name="constructor">foo</ref>
22190 <references />
22191 !! html/parsoid
22192 <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>
22193 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22194 <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>
22195 </ol>
22196 !!end
22197
22198 !!test
22199 Ref: 5. body should accept generic wikitext
22200 !! wikitext
22201 A <ref>
22202 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
22203 </ref>
22204
22205 <references />
22206 !! html/parsoid
22207 <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>
22208
22209 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
22210 <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>
22211 </span></li>
22212 </ol>
22213 !!end
22214
22215 !!test
22216 Ref: 6. indent-pres should not be output in ref-body
22217 !! wikitext
22218 A <ref>
22219 foo
22220 bar
22221 baz
22222 </ref>
22223
22224 <references />
22225 !! html/parsoid
22226 <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>
22227
22228 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22229 <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
22230 bar
22231 baz
22232 </span></li>
22233 </ol>
22234 !!end
22235
22236 !!test
22237 Ref: 7. No p-wrapping in ref-body
22238 !! wikitext
22239 A <ref>
22240 foo
22241
22242 bar
22243
22244
22245 baz
22246
22247
22248
22249 booz
22250 </ref>
22251
22252 <references />
22253 !! html/parsoid
22254 <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>
22255
22256 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22257 <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
22258
22259 bar
22260
22261
22262 baz
22263
22264
22265
22266 booz
22267 </span></li>
22268 </ol>
22269 !!end
22270
22271 !!test
22272 Ref: 8. transclusion wikitext has lower precedence
22273 !! wikitext
22274 A <ref> foo {{echo|</ref> B C}}
22275
22276 <references />
22277 !! html/parsoid
22278 <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>
22279 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22280 <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>
22281 </ol>
22282 !!end
22283
22284 !!test
22285 Ref: 9. unclosed comments should not leak out of ref-body
22286 !! wikitext
22287 A <ref> foo <!--</ref> B C
22288 <references />
22289 !! html/parsoid
22290 <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>
22291 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22292 <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>
22293 </ol>
22294 !!end
22295
22296 !!test
22297 Ref: 10. Unclosed HTML tags should not leak out of ref-body
22298 !! wikitext
22299 A <ref> <b> foo </ref> B C
22300
22301 <references />
22302 !! html/parsoid
22303 <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>
22304
22305
22306 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22307 <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>
22308 </ol>
22309 !!end
22310
22311 !!test
22312 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
22313 !! wikitext
22314 A <ref>foo</ref> B
22315 C <ref>bar</ref> D
22316 <references />
22317 !! html/parsoid
22318 <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
22319 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>
22320 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22321 <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>
22322 <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>
22323 </ol>
22324 !!end
22325
22326 !!test
22327 Ref: 12. ref-tags act as trailing newline migration barrier
22328 !! wikitext
22329 <!--the newline at the end of this line moves out of the p tag-->a
22330
22331 b<!--the newline at the end of this line stays inside the p tag--> <ref />
22332 <ref />
22333
22334 c
22335 <references />
22336 !! html/parsoid
22337 <!--the newline at the end of this line moves out of the p tag--><p>a</p>
22338
22339
22340 <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>
22341 <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>
22342
22343 <p>c</p>
22344 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22345 <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>
22346 <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>
22347 !!end
22348
22349 !!test
22350 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
22351 !! wikitext
22352 <ref>foo</ref> A
22353 <ref>bar
22354 </ref> B
22355 <references />
22356 !! html/parsoid
22357 <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
22358 <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>
22359 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22360 <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>
22361 <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
22362 </span></li>
22363 </ol>
22364 !!end
22365
22366 !!test
22367 Ref: 14. A nested ref-tag should be emitted as plain text
22368 !! wikitext
22369 <ref>foo <ref>bar</ref> baz</ref>
22370
22371 <references />
22372 !! html/parsoid
22373 <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>
22374 </p>
22375 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
22376 <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>
22377 </ol>
22378 !!end
22379
22380 !!test
22381 Ref: 15. ref-tags with identical names should get identical indexes
22382 !! wikitext
22383 A1 <ref name="a">foo</ref> A2 <ref name="a" />
22384 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
22385
22386 <references />
22387 !! html/parsoid
22388 <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>
22389 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>
22390
22391 <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>
22392 </ol>
22393 !!end
22394
22395 ## We don't bother wt2wt-ing non-standard whitespace
22396 !!test
22397 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
22398 !!options
22399 parsoid=wt2html
22400 !! wikitext
22401 A <ref >foo</ref >
22402
22403 <references />
22404 !! html/parsoid
22405 <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>
22406 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22407 <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>
22408 !!end
22409
22410 !!test
22411 Ref: 17. Generate valid HTML5 id/about attributes
22412 !!wikitext
22413 <ref name="a b">foo</ref>
22414
22415 <references />
22416 !!html/parsoid
22417 <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>
22418 </p>
22419
22420 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22421 <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>
22422 </ol>
22423 !!end
22424
22425 !!test
22426 Ref: 18. T58916: Extension attributes should be parsed as plain text
22427 !!wikitext
22428 <ref name="{{echo|a}}">foo</ref>
22429
22430 <references />
22431 !!html/parsoid
22432 <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>
22433 </p>
22434
22435 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22436 <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>
22437 </ol>
22438 !!end
22439
22440 !!test
22441 Ref: 19. ref-tags with identical name encodings should get identical indexes
22442 !! wikitext
22443 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
22444
22445 <references />
22446 !! html/parsoid
22447 <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>
22448 </p>
22449 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22450 <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>
22451 </ol>
22452 !!end
22453
22454 !!test
22455 Ref: 20. ref-tags with identical names but different content should keep it
22456 !! wikitext
22457 A <ref name="foo">Foo one</ref>
22458 B <ref name="foo">Foo two</ref>
22459 C <ref name="foo" />
22460
22461 <references />
22462 !! html/parsoid
22463 <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>
22464 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>
22465 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>
22466
22467 <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>
22468 </ol>
22469 !!end
22470
22471 !!test
22472 References: 1. references tag without any refs should be handled properly
22473 !! wikitext
22474 <references />
22475 !! html/parsoid
22476 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
22477 !!end
22478
22479 !!test
22480 References: 2. references tag with group only outputs references from that group
22481 !! wikitext
22482 A <ref group="a">foo</ref>
22483 B <ref group="b">bar</ref>
22484 C <ref>baz</ref>
22485
22486 <references group="a" />
22487 <references />
22488 <references group="b" />
22489 !! html/parsoid
22490 <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>
22491 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>
22492 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>
22493
22494 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="a" data-mw='{"name":"references","attrs":{"group":"a"}}'>
22495 <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>
22496 </ol>
22497 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'>
22498 <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>
22499 </ol>
22500 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt12" data-mw-group="b" data-mw='{"name":"references","attrs":{"group":"b"}}'>
22501 <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>
22502 </ol>
22503 !!end
22504
22505 !!test
22506 References: 3. ref list should be cleared after processing references
22507 !! wikitext
22508 A <ref>foo</ref>
22509
22510 <references />
22511
22512 B <ref>bar</ref>
22513
22514 <references />
22515 !! html/parsoid
22516 <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>
22517
22518 <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>
22519 </ol>
22520
22521 <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>
22522
22523 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22524 <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>
22525 </ol>
22526 !!end
22527
22528 !!test
22529 References: 4. only referenced group should be cleared after processing references
22530 !! wikitext
22531 A <ref group="a">afoo</ref>
22532 B <ref>bfoo</ref>
22533
22534 <references group="a" />
22535
22536 C <ref>cfoo</ref>
22537
22538 <references />
22539 !! html/parsoid
22540 <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>
22541 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>
22542
22543 <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>
22544 </ol>
22545
22546 <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>
22547
22548 <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>
22549 </ol>
22550 !!end
22551
22552 ## Don't expect this to rt since we're dropping content
22553 !! test
22554 References: 5. ref tags in references should be processed while ignoring all other content
22555 !! options
22556 parsoid=wt2html,html2html
22557 !! wikitext
22558 A <ref name="a" />
22559 B <ref name="b">bar</ref>
22560
22561 <references>
22562 <ref name="a">foo</ref>
22563 This should just get lost.
22564 </references>
22565 !! html/parsoid
22566 <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>
22567 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>
22568
22569
22570 <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;\" data-parsoid=\"{}\">&lt;span class=\"mw-reflink-text\" data-parsoid=\"{}\">[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>
22571 </ol>
22572 !! end
22573
22574 !! test
22575 References: 6. <references /> from a transclusion
22576 !! wikitext
22577 <ref>Foo</ref> {{echo|<references />}}
22578 !! html/parsoid
22579 <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>
22580 </ol>
22581 !! end
22582
22583 !! test
22584 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
22585 !! wikitext
22586 A <ref>foo bar for a</ref>
22587 B <ref group="X" name="b" />
22588
22589 <references />
22590
22591 <references group="X">
22592 <ref name="b">foo</ref>
22593 </references>
22594 !! html/parsoid
22595 <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>
22596 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>
22597 </p>
22598
22599 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22600 <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>
22601 </ol>
22602
22603 <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\" data-parsoid=\"{}\">&lt;span class=\"mw-reflink-text\" data-parsoid=\"{}\">[X 1]&lt;/span>&lt;/a>&lt;/span>\n"}}'>
22604 <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>
22605 </ol>
22606 !! end
22607
22608 !! test
22609 References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
22610 !! wikitext
22611 X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
22612 <references />
22613 !! html/parsoid
22614 <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>
22615 <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>
22616 </ol>
22617 !!end
22618
22619 # This test only works in wt2html now as the <references /> are always generated
22620 # unless selser is active. Once T72722 is fixed, we should add a changes test
22621 # here to ensure that unrelated changes don't add the new <references />
22622 # when selser is active.
22623 !! test
22624 References: 9. Generate missing references list at the end
22625 !! wikitext
22626 A <ref>foo</ref>
22627 B <ref group="inexistent">bar</ref>
22628 !! html/parsoid
22629 <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>
22630 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{},"autoGenerated":true}'>
22631 <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>
22632 </ol>
22633 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="inexistent" data-mw='{"name":"references","attrs":{"group":"inexistent"},"autoGenerated":true}'>
22634 <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>
22635 </ol>
22636 !! end
22637
22638 !! test
22639 References: 10. New <references/> shouldn't be added for unrelated edits.
22640 !! options
22641 parsoid={
22642 "modes": ["selser"],
22643 "changes": [["#x", "remove"]],
22644 "selser": "noauto"
22645 }
22646 !! wikitext
22647 Unrelated text<span id="x"> that's going to disappear</span>.
22648 A <ref>foo</ref>
22649 !! wikitext/edited
22650 Unrelated text.
22651 A <ref>foo</ref>
22652 !!end
22653
22654 !! test
22655 Entities in ref name
22656 !! wikitext
22657 <ref name="test &amp; me">hi</ref>
22658 <references />
22659 !! html/parsoid
22660 <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>
22661 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22662 <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>
22663 </ol>
22664 !! end
22665
22666 ## The output here may look funny, but it's what the php parser will do. The
22667 ## unclosed references tag becomes escaped text, and then a new references
22668 ## tag is auto-generated. The test is wt2html only because it roundtrips with
22669 ## nowiki tags, and the auto-generated references tag is only dropped in
22670 ## rtTestMode.
22671 !! test
22672 Generate references for unclosed references tag
22673 !! options
22674 parsoid=wt2html
22675 !! wikitext
22676 a<ref>foo</ref>
22677
22678 <references>
22679 !! html/parsoid
22680 <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" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span></p>
22681
22682 <p>&lt;references></p>
22683 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{},"autoGenerated":true}'><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>
22684 !! end
22685
22686 !! test
22687 New reference serializes on its own line
22688 !! options
22689 parsoid=wt2wt,html2wt
22690 !! wikitext
22691 foo
22692 <references />
22693 !! html/parsoid
22694 foo<ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
22695 !! end
22696
22697 #### ----------------------------------------------------------------
22698 #### Parsoid-only testing of Parsoid's impl of LST
22699 #### Not implemented yet, see
22700 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
22701 #### ----------------------------------------------------------------
22702
22703 !! test
22704 LST Sections: 1. Simple section start and end
22705 !! options
22706 parsoid={ "suppressErrors": true }
22707 !! wikitext
22708 <section begin="2011-05-16" />
22709 <section end="2014-04-10 (MW 1.23wmf22)" />
22710 !! html/parsoid
22711 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
22712 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
22713 !! end
22714
22715 #--------- Test stripping of empty nodes in template content ----------
22716 !!test
22717 Empty LI and TR nodes should be stripped from template content
22718 !!wikitext
22719 {{EmptyLITest}}
22720 {{EmptyTRTest}}
22721 !!html/parsoid
22722 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
22723 <li>a</li>
22724 <li>b</li>
22725 </ul>
22726 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
22727 <tbody>
22728 <tr>
22729 <td>foo</td>
22730 </tr>
22731 <tr>
22732 <td>bar</td>
22733 </tr>
22734 </tbody>
22735 </table>
22736 !!end
22737
22738 !!test
22739 Empty LI and TR nodes should not be stripped from top-level content
22740 !!wikitext
22741 * a
22742 *
22743 * b
22744 {|
22745 |-
22746 |-
22747 |foo
22748 |}
22749 !!html/parsoid
22750 <ul>
22751 <li> a</li>
22752 <li></li>
22753 <li> b</li>
22754 </ul>
22755 <table>
22756 <tbody>
22757 <tr></tr>
22758 <tr>
22759 <td>foo</td>
22760 </tr>
22761 </tbody>
22762 </table>
22763 !!end
22764
22765 !!test
22766 Empty TR nodes should not be stripped if they have any attributes set
22767 !!wikitext
22768 {{EmptyTRWithHTMLAttrTest}}
22769 !!html/parsoid
22770 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
22771 <tr align="center"></tr>
22772 <tr><td>foo</td></tr>
22773 <tr align="center"></tr>
22774 <tr><td>bar</td></tr>
22775 </table>
22776 !!end
22777
22778 #### ----------------------------------------------------------------
22779 #### The following section of tests are primarily to test
22780 #### wikitext escaping capabilities of Parsoid. Given that
22781 #### escaping can be done any number of ways, the wikitext (input)
22782 #### is always adjusted to reflect how Parsoid adds nowiki
22783 #### escape tags.
22784 ####
22785 #### We are marking several tests as parsoid-only since the
22786 #### HTML in the result section is different from what the
22787 #### PHP parser generates for it.
22788 #### ----------------------------------------------------------------
22789
22790
22791 #### --------------- Headings ---------------
22792 #### 0. Unnested
22793 #### 1. Nested inside html <h1>=foo=</h1>
22794 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
22795 #### 3. Nested inside html with wikitext split by html tags
22796 #### 4. No escape needed
22797 #### 5. Empty headings <h1></h1>
22798 #### 6. Heading chars in SOL context
22799 #### ----------------------------------------
22800 !! test
22801 Headings: 0. Unnested
22802 !! options
22803 parsoid=html2wt
22804 !! html/parsoid
22805 <p>=foo=</p>
22806
22807 <p> =foo=
22808 <!--cmt-->
22809 =foo=</p>
22810
22811 <p>=foo<i>a</i>=</p>
22812 !! wikitext
22813 <nowiki>=foo=</nowiki>
22814
22815 <nowiki> </nowiki>=foo=
22816 <!--cmt-->
22817 <nowiki>=foo=</nowiki>
22818
22819 =foo''a''<nowiki>=</nowiki>
22820 !!end
22821
22822 # New headings and existing headings are handled differently
22823 !! test
22824 Headings: 1. Nested inside html
22825 !! options
22826 parsoid=html2wt
22827 !! html/parsoid
22828 <h1>=foo=</h1>
22829 <h2>=foo=</h2>
22830 <h3>=foo=</h3>
22831
22832 <h1 data-parsoid=''>=foo=</h1>
22833 <h2 data-parsoid=''>=foo=</h2>
22834 <h3 data-parsoid=''>=foo=</h3>
22835 <h4 data-parsoid=''>=foo=</h4>
22836 <h5 data-parsoid=''>=foo=</h5>
22837 <h6 data-parsoid=''>=foo=</h6>
22838 !! wikitext
22839 = =foo= =
22840
22841 == =foo= ==
22842
22843 === =foo= ===
22844
22845 =<nowiki>=foo=</nowiki>=
22846 ==<nowiki>=foo=</nowiki>==
22847 ===<nowiki>=foo=</nowiki>===
22848 ====<nowiki>=foo=</nowiki>====
22849 =====<nowiki>=foo=</nowiki>=====
22850 ======<nowiki>=foo=</nowiki>======
22851
22852 !!end
22853
22854 !! test
22855 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
22856 !! options
22857 parsoid=html2wt
22858 !! html/parsoid
22859 <h1>foo</h1>*bar
22860 <h1>foo</h1>=bar
22861 <h1>foo</h1>=bar=
22862 !! wikitext
22863 = foo =
22864 <nowiki>*</nowiki>bar
22865
22866 = foo =
22867 =bar
22868
22869 = foo =
22870 <nowiki>=bar=</nowiki>
22871 !!end
22872
22873 !! test
22874 Headings: 3. Nested inside html with wikitext split by html tags
22875 !! options
22876 parsoid=html2wt
22877 !! html/parsoid
22878 <h1>=<b>bold</b>foo=</h1>
22879 !! wikitext
22880 = ='''bold'''foo= =
22881 !!end
22882
22883 !! test
22884 Headings: 4a. No escaping needed (testing just h1 and h2)
22885 !! options
22886 parsoid=html2wt
22887 !! html/parsoid
22888 <h1>=foo</h1>
22889 <h1>foo=</h1>
22890 <h1> =foo= </h1>
22891 <h1>=foo= bar</h1>
22892 <h2>=foo</h2>
22893 <h2>foo=</h2>
22894 <h1>=</h1>
22895 <h1><i>=</i>foo=</h1>
22896 !! wikitext
22897 = =foo =
22898
22899 = foo= =
22900
22901 = =foo= =
22902
22903 = =foo= bar =
22904
22905 == =foo ==
22906
22907 == foo= ==
22908
22909 = = =
22910
22911 = ''=''foo= =
22912 !!end
22913
22914 !! test
22915 Headings: 4b. No escaping needed (inside p-tags)
22916 !! options
22917 parsoid=html2wt
22918 !! html/parsoid
22919 <p>===
22920 =foo= x
22921 =foo= <s></s>
22922 </p>
22923 !! wikitext
22924 ===
22925 =foo= x
22926 =foo= <s></s>
22927 !!end
22928
22929 !! test
22930 Headings: 5. Empty headings
22931 !! options
22932 parsoid=html2wt
22933 !! html/parsoid
22934 <h1 data-parsoid='{}'></h1>
22935
22936 <h2 data-parsoid='{}'></h2>
22937
22938 <h3 data-parsoid='{}'></h3>
22939
22940 <h4 data-parsoid='{}'></h4>
22941
22942 <h5 data-parsoid='{}'></h5>
22943
22944 <h6 data-parsoid='{}'></h6>
22945 !! wikitext
22946 =<nowiki/>=
22947
22948 ==<nowiki/>==
22949
22950 ===<nowiki/>===
22951
22952 ====<nowiki/>====
22953
22954 =====<nowiki/>=====
22955
22956 ======<nowiki/>======
22957 !!end
22958
22959 !! test
22960 Headings: 6a. Heading chars in SOL context (with trailing spaces)
22961 !! options
22962 parsoid=html2wt
22963 !! html/parsoid
22964 <p>=a=</p>
22965
22966 <p>=a=</p>
22967
22968 <p>=a=</p>
22969 !! wikitext
22970 <nowiki>=a=</nowiki>
22971
22972 <nowiki>=a=</nowiki>
22973
22974 <nowiki>=a=</nowiki>
22975 !!end
22976
22977 !! test
22978 Headings: 6b. Heading chars in SOL context (with trailing newlines)
22979 !! options
22980 parsoid=html2wt
22981 !! html/parsoid
22982 <p>=a=
22983 b</p>
22984
22985 <p>=a=
22986 b</p>
22987
22988 <p>=a=
22989 b</p>
22990 !! wikitext
22991 <nowiki>=a=</nowiki>
22992 b
22993
22994 <nowiki>=a=</nowiki>
22995 b
22996
22997 <nowiki>=a=</nowiki>
22998 b
22999 !!end
23000
23001 !! test
23002 Headings: 6c. Heading chars in SOL context (leading newline break)
23003 !! options
23004 parsoid=html2wt
23005 !! html/parsoid
23006 <p>a
23007 =b=</p>
23008 !! wikitext
23009 a
23010 <nowiki>=b=</nowiki>
23011 !!end
23012
23013 !! test
23014 Headings: 6d. Heading chars in SOL context (with interspersed comments)
23015 !! options
23016 parsoid=html2wt
23017 !! html/parsoid
23018 <!--c0--><p>=a=</p>
23019
23020 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
23021 !! wikitext
23022 <!--c0--><nowiki>=a=</nowiki>
23023
23024 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
23025 !!end
23026
23027 !! test
23028 Headings: 6d. Heading chars in SOL context (No escaping needed)
23029 !! options
23030 parsoid=html2wt
23031 !! html/parsoid
23032 =a=<div>b</div>
23033 !! wikitext
23034 =a=<div>b</div>
23035 !!end
23036
23037 !! test
23038 Headings: 7. Insert a newline between new content and headings
23039 !! options
23040 parsoid=html2wt
23041 !! html/parsoid
23042 <h2>NEW</h2>
23043 <p>new</p>
23044 <h2 data-parsoid='{}'>A</h2>
23045 <p data-parsoid='{}'>a</p>
23046 !! wikitext
23047 == NEW ==
23048 new
23049
23050 ==A==
23051 a
23052
23053 !! end
23054
23055 #### --------------- Lists ---------------
23056 #### 0. Outside nests (*foo, etc.)
23057 #### 1. Nested inside html <ul><li>*foo</li></ul>
23058 #### 2. Inside definition lists
23059 #### 3. Only bullets at start should be escaped
23060 #### 4. No escapes needed
23061 #### 5. No unnecessary escapes
23062 #### 6. Escape bullets in SOL position
23063 #### 7. Escape bullets in a multi-line context
23064 #### ----------------------------------------
23065
23066 !! test
23067 Lists: 0. Outside nests
23068 !! options
23069 parsoid=html2wt
23070 !! html/parsoid
23071 <p>*foo</p>
23072
23073 <p>#foo</p>
23074
23075 <p>;Foo:bar</p>
23076 !! wikitext
23077 <nowiki>*</nowiki>foo
23078
23079 <nowiki>#</nowiki>foo
23080
23081 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
23082 !!end
23083
23084 ## Making these next 3 tests Parsoid-only since they are html2wt tests
23085 ## to test wikitext escaping, and insignificant whitespace diffs
23086 ## cause PHP parser tests to barf
23087 !! test
23088 Lists: 1. Nested inside html (No unnecessary escapes)
23089 !! options
23090 parsoid=html2wt
23091 !! html/parsoid
23092 <ul>
23093 <li>*foo</li>
23094 <li>#foo</li>
23095 <li>:foo</li>
23096 <li>;foo</li>
23097 <li data-parsoid='{}'>*foo</li>
23098 <li data-parsoid='{}'>#foo</li>
23099 <li data-parsoid='{}'>:foo</li>
23100 <li data-parsoid='{}'>;foo</li>
23101 </ul>
23102
23103 <ol>
23104 <li>*foo</li>
23105 <li>#foo</li>
23106 <li>:foo</li>
23107 <li>;foo</li>
23108 <li data-parsoid='{}'>*foo</li>
23109 <li data-parsoid='{}'>#foo</li>
23110 <li data-parsoid='{}'>:foo</li>
23111 <li data-parsoid='{}'>;foo</li>
23112 </ol>
23113 !! wikitext
23114 * *foo
23115 * #foo
23116 * :foo
23117 * ;foo
23118 *<nowiki>*foo</nowiki>
23119 *<nowiki>#foo</nowiki>
23120 *<nowiki>:foo</nowiki>
23121 *<nowiki>;foo</nowiki>
23122
23123 # *foo
23124 # #foo
23125 # :foo
23126 # ;foo
23127 #<nowiki>*foo</nowiki>
23128 #<nowiki>#foo</nowiki>
23129 #<nowiki>:foo</nowiki>
23130 #<nowiki>;foo</nowiki>
23131 !!end
23132
23133 !! test
23134 Lists: 2. Inside definition lists
23135 !! options
23136 parsoid=html2wt
23137 !! html/parsoid
23138 <dl><dt>;foo</dt></dl>
23139 <dl><dt>:foo</dt></dl>
23140 <dl><dt>:foo</dt>
23141 <dd>bar</dd></dl>
23142 <dl><dd>:foo</dd></dl>
23143 !! wikitext
23144 ; ;foo
23145
23146 ; <nowiki>:foo</nowiki>
23147
23148 ; <nowiki>:foo</nowiki>
23149 : bar
23150
23151 : :foo
23152 !!end
23153
23154 !! test
23155 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
23156 !! options
23157 parsoid=html2wt
23158 !! html/parsoid
23159 <ul>
23160 <li>*foo*bar</li>
23161 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
23162 </ul>
23163 !! wikitext
23164 * *foo*bar
23165 *<nowiki>*foo</nowiki>''it''*bar
23166 !!end
23167
23168 !! test
23169 Lists: 4. No escapes needed
23170 !! options
23171 parsoid=html2wt
23172 !! html/parsoid
23173 <ul>
23174 <li>foo*bar
23175 </li>
23176 </ul>
23177 <ul>
23178 <li><i>foo</i>*bar
23179 </li>
23180 </ul>
23181 <ul>
23182 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
23183 </li>
23184 </ul>
23185 <ul>
23186 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
23187 </li>
23188 </ul>
23189 !! wikitext
23190 *foo*bar
23191
23192 *''foo''*bar
23193
23194 *[[Foo]]: bar
23195
23196 *[[Foo]]*bar
23197 !!end
23198
23199 !! test
23200 Lists: 5. No unnecessary escapes
23201 !! options
23202 parsoid=html2wt
23203 !! html/parsoid
23204 <ul><li> bar <span>[[foo]]</span></li></ul>
23205 <ul><li> =bar <span>[[foo]]</span></li></ul>
23206 <ul><li> [[bar <span>[[foo]]</span></li></ul>
23207 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
23208 <ul><li> =bar <span>foo]]</span>=</li></ul>
23209 <ul><li> <s></s>: a</li></ul>
23210 <ul><li> <i>* foo</i></li></ul>
23211
23212 !! wikitext
23213 * bar <span><nowiki>[[foo]]</nowiki></span>
23214
23215 * =bar <span><nowiki>[[foo]]</nowiki></span>
23216
23217 * [[bar <span><nowiki>[[foo]]</nowiki></span>
23218
23219 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
23220
23221 * =bar <span>foo]]</span>=
23222
23223 * <s></s>: a
23224
23225 * ''* foo''
23226 !!end
23227
23228 !! test
23229 Lists: 6. Escape bullets in SOL position
23230 !! options
23231 parsoid=html2wt
23232 !! html/parsoid
23233 <p><!--cmt-->*foo</p>
23234 !! wikitext
23235 <!--cmt--><nowiki>*</nowiki>foo
23236 !!end
23237
23238 !! test
23239 Lists: 7. Escape bullets in a multi-line context
23240 !! options
23241 parsoid=html2wt
23242 !! html/parsoid
23243 <p>a
23244 *b
23245 </p>
23246 !! wikitext
23247 a
23248 <nowiki>*</nowiki>b
23249 !!end
23250
23251 !! test
23252 Lists: 8. Escape colons only if not present in tags
23253 !! options
23254 parsoid=html2wt
23255 !! html/parsoid
23256 <dl><dt>a:b<i>c:d</i></dt></dl>
23257 !! wikitext
23258 ; <nowiki>a:b</nowiki>''c:d''
23259 !! end
23260
23261 #### --------------- HRs ---------------
23262 #### 1. Single line
23263 #### -----------------------------------
23264
23265 !! test
23266 HRs: 1. Single line
23267 !! options
23268 parsoid=html2wt
23269 !! html/parsoid
23270 <hr />----
23271 <hr />=foo=
23272 <hr />*foo
23273 !! wikitext
23274 ----<nowiki>----</nowiki>
23275 ----=foo=
23276 ----*foo
23277 !! end
23278
23279 #### --------------- Tables ---------------
23280 #### 1a. Simple example
23281 #### 1b. No escaping needed (!foo)
23282 #### 1c. No escaping needed (|foo)
23283 #### 1d. No escaping needed (|}foo)
23284 ####
23285 #### 2a. Nested in td (<td>foo|bar</td>)
23286 #### 2b. Nested in td (<td>foo||bar</td>)
23287 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
23288 ####
23289 #### 3a. Nested in th (<th>foo!bar</th>)
23290 #### 3b. Nested in th (<th>foo!!bar</th>)
23291 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
23292 ####
23293 #### 4a. Escape -
23294 #### 4b. Escape +
23295 #### 4c. No escaping needed
23296 #### --------------------------------------
23297
23298 !! test
23299 Tables: 1a. Simple example
23300 !! options
23301 parsoid=html2wt
23302 !! html/parsoid
23303 <p>{|
23304 |}
23305 </p>
23306 !! wikitext
23307 <nowiki>{|</nowiki>
23308 |}
23309 !! end
23310
23311 !! test
23312 Tables: 1b. No escaping needed
23313 !! options
23314 parsoid=html2wt
23315 !! html/parsoid
23316 <p>!foo
23317 </p>
23318 !! wikitext
23319 !foo
23320 !! end
23321
23322 !! test
23323 Tables: 1c. No escaping needed
23324 !! options
23325 parsoid=html2wt
23326 !! html/parsoid
23327 <p>|foo
23328 </p>
23329 !! wikitext
23330 |foo
23331 !! end
23332
23333 !! test
23334 Tables: 1d. No escaping needed
23335 !! options
23336 parsoid=html2wt
23337 !! html/parsoid
23338 <p>|}foo
23339 </p>
23340 !! wikitext
23341 |}foo
23342 !! end
23343
23344 !! test
23345 Tables: 2a. Nested in td
23346 !! options
23347 parsoid=html2wt
23348 !! html/parsoid
23349 <table><tbody><tr>
23350 <td>foo|bar</td></tr>
23351 <tr><td>x<div>a|b</div></td>
23352 </tbody></table>
23353 !! wikitext
23354 {|
23355 |<nowiki>foo|bar</nowiki>
23356 |-
23357 |x<div><nowiki>a|b</nowiki></div>
23358 |}
23359 !! html/php+tidy
23360 <table>
23361 <tr>
23362 <td>foo|bar</td>
23363 </tr>
23364 <tr>
23365 <td>x
23366 <div>a|b</div>
23367 </td>
23368 </tr>
23369 </table>
23370 !! end
23371
23372 !! test
23373 Tables: 2b. Nested in td
23374 !! options
23375 parsoid=html2wt
23376 !! html/parsoid
23377 <table><tbody><tr>
23378 <td>foo||bar</td>
23379 <td>a<i>b||c</i></td>
23380 <td>a<i><div>b||c</div></i></td>
23381 </tr></tbody></table>
23382 !! wikitext
23383 {|
23384 |<nowiki>foo||bar</nowiki>
23385 |a''<nowiki>b||c</nowiki>''
23386 |a''<div><nowiki>b||c</nowiki></div>''
23387 |}
23388 !! html/php
23389 <table>
23390 <tr>
23391 <td>foo||bar
23392 </td>
23393 <td>a<i>b||c</i>
23394 </td>
23395 <td>a<i><div>b||c</div></i>
23396 </td></tr></table>
23397
23398 !! end
23399
23400 !! test
23401 Tables: 2c. Nested in td -- no escaping needed
23402 !! options
23403 parsoid=html2wt
23404 !! html/*
23405 <table>
23406 <tr>
23407 <td>foo!!bar
23408 </td></tr></table>
23409
23410 !! wikitext
23411 {|
23412 |foo!!bar
23413 |}
23414 !! end
23415
23416 !! test
23417 Tables: 3a. Nested in th
23418 !! options
23419 parsoid=html2wt
23420 !! html/*
23421 <table>
23422 <tr>
23423 <th>foo!bar
23424 </th></tr></table>
23425
23426 !! wikitext
23427 {|
23428 !foo!bar
23429 |}
23430 !! end
23431
23432 !! test
23433 Tables: 3b. Nested in th
23434 !! options
23435 parsoid=html2wt
23436 !! html/parsoid
23437 <table><tbody>
23438 <tr><th>foo!!bar</th>
23439 <th><i>foo|bar</i></th>
23440 <th><i>foo!!bar</i></th>
23441 <th><i><span>foo!!bar</span></i></th>
23442 </tr></tbody></table>
23443 !! wikitext
23444 {|
23445 !<nowiki>foo!!bar</nowiki>
23446 !''<nowiki>foo|bar</nowiki>''
23447 !''<nowiki>foo!!bar</nowiki>''
23448 !''<span><nowiki>foo!!bar</nowiki></span>''
23449 |}
23450 !! html/php
23451 <table>
23452 <tr>
23453 <th>foo!!bar
23454 </th>
23455 <th><i>foo|bar</i>
23456 </th>
23457 <th><i>foo!!bar</i>
23458 </th>
23459 <th><i><span>foo!!bar</span></i>
23460 </th></tr></table>
23461
23462 !! end
23463
23464 !! test
23465 Tables: 3c. Nested in th
23466 !! options
23467 parsoid=html2wt
23468 !! html/parsoid
23469 <table><tbody>
23470 <tr><th>foo||bar</th>
23471 <th><span typeof="mw:Nowiki">foo||bar</span></th>
23472 </tr></tbody></table>
23473 !! wikitext
23474 {|
23475 !<nowiki>foo||bar</nowiki>
23476 !<nowiki>foo||bar</nowiki>
23477 |}
23478 !! html/php
23479 <table>
23480 <tr>
23481 <th>foo||bar
23482 </th>
23483 <th>foo||bar
23484 </th></tr></table>
23485
23486 !! end
23487
23488 !! test
23489 Tables: 4a. Escape -
23490 !! options
23491 parsoid=html2wt
23492 !! html/*
23493 <table>
23494 <tr>
23495 <th>-bar
23496 </th></tr>
23497 <tr>
23498 <td>-bar
23499 </td></tr></table>
23500
23501 !! wikitext
23502 {|
23503 !-bar
23504 |-
23505 |<nowiki>-bar</nowiki>
23506 |}
23507 !! end
23508
23509 !! test
23510 Tables: 4b. Escape +
23511 !! options
23512 parsoid=html2wt
23513 !! html/*
23514 <table>
23515 <tr>
23516 <th>+bar
23517 </th></tr>
23518 <tr>
23519 <td>+bar
23520 </td></tr></table>
23521
23522 !! wikitext
23523 {|
23524 !+bar
23525 |-
23526 |<nowiki>+bar</nowiki>
23527 |}
23528 !! end
23529
23530 !! test
23531 Tables: 4c. No escaping needed
23532 !! options
23533 parsoid=html2wt
23534 !! html/parsoid
23535 <table><tbody>
23536 <tr><td>foo-bar</td><td>foo+bar</td></tr>
23537 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
23538 <tr><td>foo
23539 <p>bar|baz
23540 +bar
23541 -bar</p></td></tr>
23542 <tr><td>x
23543 <div>a|b</div></td>
23544 </tbody></table>
23545 !! wikitext
23546 {|
23547 |foo-bar
23548 |foo+bar
23549 |-
23550 |''foo''-bar
23551 |''foo''+bar
23552 |-
23553 |foo
23554 bar|baz
23555 +bar
23556 -bar
23557 |-
23558 |x
23559 <div>a|b</div>
23560 |}
23561 !! html/php
23562 <table>
23563 <tr>
23564 <td>foo-bar
23565 </td>
23566 <td>foo+bar
23567 </td></tr>
23568 <tr>
23569 <td><i>foo</i>-bar
23570 </td>
23571 <td><i>foo</i>+bar
23572 </td></tr>
23573 <tr>
23574 <td>foo
23575 <p>bar|baz
23576 +bar
23577 -bar
23578 </p>
23579 </td></tr>
23580 <tr>
23581 <td>x
23582 <div>a|b</div>
23583 </td></tr></table>
23584
23585 !! end
23586
23587 !! test
23588 Tables: 4d. No escaping needed
23589 !! options
23590 parsoid=html2wt
23591 !! html/parsoid
23592 <table>
23593 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
23594 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
23595 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
23596 </tbody></table>
23597 !! wikitext
23598 {|
23599 |[[Foo]]-bar
23600 ||+1
23601 ||-2
23602 |}
23603 !! html/php
23604 <table>
23605 <tr>
23606 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
23607 </td>
23608 <td>+1
23609 </td>
23610 <td>-2
23611 </td></tr></table>
23612
23613 !! end
23614
23615 !! test
23616 T97430: Don't emit empty nowiki pairs around marker meta tags
23617 !! options
23618 parsoid=html2wt
23619 !! html/parsoid
23620 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
23621 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
23622 !! wikitext
23623 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
23624 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
23625 !! end
23626
23627 !! test
23628 Unclosed xmlish element in table line shouldn't eat end delimiters
23629 !! options
23630 parsoid=html2wt
23631 !! html/parsoid
23632 <table>
23633 <tbody><tr><td> &lt;foo</td>
23634 <td> bar></td></tr>
23635 </tbody></table>
23636 !! wikitext
23637 {|
23638 | <foo
23639 | bar>
23640 |}
23641 !! html/php
23642 <table>
23643 <tr>
23644 <td> &lt;foo
23645 </td>
23646 <td> bar&gt;
23647 </td></tr></table>
23648
23649 !! end
23650
23651 #### --------------- Links ----------------
23652 #### 1. Quote marks in link text
23653 #### 2. Wikilinks: Escapes needed
23654 #### 3. Wikilinks: No escapes needed
23655 #### 4. Extlinks: Escapes needed
23656 #### 5. Extlinks: No escapes needed
23657 #### --------------------------------------
23658 !! test
23659 Links 1. WikiLinks: No escapes needed
23660 !! options
23661 parsoid=html2wt
23662 !! html/parsoid
23663 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
23664 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
23665 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
23666 !! wikitext
23667 [[Foo|Foo''boo'']]
23668 [[Foo|[Foobar]]]
23669 [[Foo|x [Foobar] x]]
23670 !! html/php
23671 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
23672 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
23673 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
23674 </p>
23675 !! end
23676
23677 !! test
23678 Links 2. WikiLinks: Escapes needed
23679 !! options
23680 parsoid=html2wt
23681 !! html/parsoid
23682 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
23683 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
23684 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
23685 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
23686 <a href="Foo" rel="mw:WikiLink">|Bar</a>
23687 <a href="Foo" rel="mw:WikiLink">]]bar</a>
23688 <a href="Foo" rel="mw:WikiLink">[[bar</a>
23689 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
23690 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
23691 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
23692 !! wikitext
23693 [[Foo|<nowiki>Foobar]</nowiki>]]
23694 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
23695 [[Foo|<nowiki>[[Bar]]</nowiki>]]
23696 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
23697 [[Foo|<nowiki>|Bar</nowiki>]]
23698 [[Foo|<nowiki>]]bar</nowiki>]]
23699 [[Foo|<nowiki>[[bar</nowiki>]]
23700 [[Foo|<nowiki>x [[ y</nowiki>]]
23701 [[Foo|<nowiki>x ]] y</nowiki>]]
23702 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
23703 !! html/php
23704 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
23705 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
23706 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
23707 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
23708 <a href="/wiki/Foo" title="Foo">|Bar</a>
23709 <a href="/wiki/Foo" title="Foo">]]bar</a>
23710 <a href="/wiki/Foo" title="Foo">[[bar</a>
23711 <a href="/wiki/Foo" title="Foo">x [[ y</a>
23712 <a href="/wiki/Foo" title="Foo">x ]] y</a>
23713 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
23714 </p>
23715 !! end
23716
23717 !! test
23718 Links 3. WikiLinks: No escapes needed
23719 !! options
23720 parsoid=html2wt
23721 !! html/parsoid
23722 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
23723 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
23724 !! wikitext
23725 [[Foo|[Foobar]]
23726 [[Foo|foo|bar]]
23727 !! html/php
23728 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
23729 <a href="/wiki/Foo" title="Foo">foo|bar</a>
23730 </p>
23731 !! end
23732
23733 !! test
23734 Links 4. ExtLinks: Escapes needed
23735 !! options
23736 parsoid=html2wt
23737 !! html/parsoid
23738 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
23739 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
23740 <p>[http://google.com]</p>
23741 <p>[http://google.com google]</p>
23742 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
23743 <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>
23744 !! wikitext
23745 [http://google.com <nowiki>[google]</nowiki>]
23746 [http://google.com <nowiki>google]</nowiki>]
23747
23748 <nowiki>[http://google.com]</nowiki>
23749
23750 <nowiki>[http://google.com google]</nowiki>
23751
23752 [http://google.com<nowiki>]</nowiki>
23753
23754 [{{echo|http://google.com}}<nowiki>]</nowiki>
23755 !! html/php
23756 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
23757 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
23758 </p><p>[http://google.com]
23759 </p><p>[http://google.com google]
23760 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
23761 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
23762 </p>
23763 !! end
23764
23765 !! test
23766 Links 5. ExtLinks: No escapes needed
23767 !! options
23768 parsoid=html2wt
23769 !! html/parsoid
23770 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
23771 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
23772 !! wikitext
23773 [http://google.com [google]
23774
23775 [[http://google.com]]
23776 !! html/php
23777 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
23778 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
23779 </p>
23780 !! end
23781
23782 !! test
23783 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
23784 !! options
23785 parsoid=html2wt
23786 !! html/parsoid
23787 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
23788 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
23789 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
23790 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
23791 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
23792 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
23793 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
23794 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
23795 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
23796 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
23797 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
23798 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
23799 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
23800 </p>
23801 !! wikitext
23802 x<nowiki/>http://example.com<nowiki/>y
23803 http://example.com<nowiki/>?x
23804 http://example.com<nowiki/>&x
23805 http://example.com<nowiki/>'x
23806 http://example.com<nowiki/>,x
23807 http://example.com<nowiki/>.x
23808 http://example.com<nowiki/>;x
23809 http://example.com<nowiki/>:x
23810 http://example.com<nowiki/>;x
23811 http://example.com<nowiki/>!x
23812 http://example.com<nowiki/>=x
23813 http://example.com<nowiki/>(x)
23814 http://example.com(x<nowiki/>)
23815 !! end
23816
23817 !! test
23818 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
23819 !! options
23820 parsoid=html2wt
23821 !! html/parsoid
23822 <p>x
23823 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
23824 y
23825 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
23826 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
23827 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
23828 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
23829 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
23830 </p>
23831 !! wikitext
23832 x
23833 http://example.com
23834 y
23835 "http://example.com"
23836 (http://example.com)
23837 (http://example.com) foo
23838 http://example.com,
23839 http://example.com, foo
23840 !! html/php
23841 <p>x
23842 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
23843 y
23844 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
23845 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
23846 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
23847 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
23848 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
23849 </p>
23850 !! end
23851
23852 !! test
23853 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
23854 !! options
23855 parsoid=html2wt
23856 !! html/parsoid
23857 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
23858 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
23859 !! wikitext
23860 http://example.com.,;:!?\
23861 -http://example.com:
23862 !! html/php
23863 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
23864 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
23865 </p>
23866 !! end
23867
23868 !! test
23869 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
23870 !! options
23871 parsoid=html2wt
23872 !! html/parsoid
23873 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
23874 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
23875 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
23876 !! wikitext
23877 RFC 123<nowiki/>4
23878 RFC 123<nowiki/>y
23879 X<nowiki/>RFC 123<nowiki/>y
23880 !! end
23881
23882 !! test
23883 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
23884 !! options
23885 parsoid=html2wt
23886 !! html/parsoid
23887 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
23888 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
23889 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
23890 </p>
23891 !! wikitext
23892 RFC 123?foo
23893 RFC 123&foo
23894 -RFC 123-
23895 !! html/php
23896 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
23897 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
23898 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
23899 </p>
23900 !! end
23901
23902 !! test
23903 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
23904 !! options
23905 parsoid=html2wt
23906 !! html/parsoid
23907 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
23908 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
23909 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
23910 !! wikitext
23911 PMID 123<nowiki/>4
23912 PMID 123<nowiki/>y
23913 X<nowiki/>PMID 123<nowiki/>y
23914 !! end
23915
23916 !! test
23917 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
23918 !! options
23919 parsoid=html2wt
23920 !! html/parsoid
23921 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
23922 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
23923 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
23924 </p>
23925 !! wikitext
23926 PMID 123?foo
23927 PMID 123&foo
23928 -PMID 123-
23929 !! html/php
23930 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
23931 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
23932 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
23933 </p>
23934 !! end
23935
23936 !! test
23937 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
23938 !! options
23939 parsoid=html2wt
23940 !! html/parsoid
23941 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
23942 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
23943 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
23944 </p>
23945 !! wikitext
23946 ISBN 1234567890<nowiki/>1
23947 ISBN 1234567890<nowiki/>x
23948 a<nowiki/>ISBN 1234567890<nowiki/>b
23949 !! end
23950
23951 !! test
23952 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
23953 !! options
23954 parsoid=html2wt
23955 !! html/parsoid
23956 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
23957 !! wikitext
23958 -ISBN 1234567890's
23959 !! html/php
23960 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
23961 </p>
23962 !! end
23963
23964 !! test
23965 Links 14. Protect link-like plain text. (Parsoid bug T78425)
23966 !! options
23967 parsoid=html2wt
23968 !! html/*
23969 <p>this is not a link: http://example.com
23970 </p>
23971 !! wikitext
23972 this is not a link: <nowiki>http://example.com</nowiki>
23973 !! end
23974
23975 !! test
23976 Links 15. Link trails can't become link prefixes.
23977 !! options
23978 language=is
23979 parsoid=html2wt
23980 !! html/parsoid
23981 <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>
23982 !! wikitext
23983 [[Söfnuður]]-[[00]]
23984 !! html/php
23985 <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>
23986 </p>
23987 !! end
23988
23989 #### --------------- Quotes ---------------
23990 #### 1. Quotes inside <b> and <i>
23991 #### 2. Link fragments separated by <i> and <b> tags
23992 #### 3. Link fragments inside <i> and <b>
23993 #### 4. No escaping needed
23994 #### --------------------------------------
23995 !! test
23996 1a. Quotes inside <b> and <i>
23997 !! options
23998 parsoid=html2wt
23999 !! html/*
24000 <p><i>'foo'</i>
24001 <i>''foo''</i>
24002 <i>'''foo'''</i>
24003 <i>foo</i>'s
24004 <b>'foo'</b>
24005 <b>''foo''</b>
24006 <b>'''foo'''</b>
24007 <b>foo'<i>bar'</i>baz</b>
24008 <b>foo</b>'s
24009 '<i>foo</i>
24010 <i>foo</i>'
24011 <i>foo'</i>'
24012 '<i>foo</i>'
24013 '<b>foo</b>
24014 <b>foo</b>'
24015 '<b>foo</b>'
24016 <i>fools'<span> errand</span></i>
24017 <i><span>fool</span>'s errand</i>
24018 '<i>foo</i> bar '<i>baz</i>
24019 a|!*#-:;+-~[]{}b'<i>x</i>
24020 </p>
24021 !! wikitext
24022 ''<nowiki/>'foo'''
24023 ''<nowiki>''foo''</nowiki>''
24024 ''<nowiki>'''foo'''</nowiki>''
24025 ''foo''<nowiki/>'s
24026 '''<nowiki/>'foo''''
24027 '''<nowiki>''foo''</nowiki>'''
24028 '''<nowiki>'''foo'''</nowiki>'''
24029 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
24030 '''foo'''<nowiki/>'s
24031 '''foo''
24032 ''foo''<nowiki/>'
24033 ''foo'''<nowiki/>'
24034 '''foo''<nowiki/>'
24035 ''''foo'''
24036 '''foo'''<nowiki/>'
24037 ''''foo'''<nowiki/>'
24038 ''fools'<span> errand</span>''
24039 ''<span>fool</span>'s errand''
24040 '<nowiki/>''foo'' bar '''baz''
24041 a|!*#-:;+-~[]{}b'''x''
24042 !! end
24043
24044 !! test
24045 1b. Quotes inside <b> and <i> with other tags on same line
24046 !! options
24047 parsoid=html2wt
24048 !! html/parsoid
24049 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
24050 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
24051 <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>
24052 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
24053 '<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>
24054 '<i>foo</i> <div title="name">test</div>
24055 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
24056 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
24057 <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>
24058 </ol>
24059 !! wikitext
24060 '''a'' foo ''[[bar]]''
24061 ''a''' foo ''[[bar]]''
24062 ''a''' foo '''{{echo|[[bar]]}}'''
24063 [[foo]] x'''[[bar]]''
24064 '''foo'' <ref>test</ref>
24065 '''foo'' <div title="name">test</div>
24066 '''foo'' and <br> bar
24067 <references />
24068 !! end
24069
24070 !! test
24071 2. Link fragments separated by <i> and <b> tags
24072 !! options
24073 parsoid=html2wt
24074 !! html/parsoid
24075 <p>[[<i>foo</i>hello]]</p>
24076 <p>[[<b>foo</b>hello]]</p>
24077 !! wikitext
24078 [[''foo''<nowiki>hello]]</nowiki>
24079
24080 [['''foo'''<nowiki>hello]]</nowiki>
24081 !! end
24082
24083 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
24084 # this is one of the shortcomings of this format
24085 !! test
24086 3. Link fragments inside <i> and <b>
24087 !! options
24088 parsoid=html2wt
24089 !! html/parsoid
24090 <p><i>[[foo</i>]]</p>
24091 <p><b>[[foo</b>]]</p>
24092 !! wikitext
24093 ''[[foo''<nowiki>]]</nowiki>
24094
24095 '''[[foo'''<nowiki>]]</nowiki>
24096 !! end
24097
24098 !! test
24099 4. No escaping needed
24100 !! options
24101 options=html2wt
24102 !! html/parsoid
24103 <p>'<span><i>bar</i></span>'
24104 '<span><b>bar</b></span>'
24105 'a:b'foo
24106 </p>
24107 !! wikitext
24108 '<span>''bar''</span>'
24109 '<span>'''bar'''</span>'
24110 'a:b'foo
24111 !! end
24112
24113 #### ----------- Paragraphs ---------------
24114 #### 1. No unnecessary escapes
24115 #### --------------------------------------
24116
24117 !! test
24118 1. No unnecessary escapes
24119 !! options
24120 parsoid=html2wt
24121 !! html/parsoid
24122 <p>bar <span>[[foo]]</span>
24123 </p><p>=bar <span>[[foo]]</span>
24124 </p><p>[[bar <span>[[foo]]</span>
24125 </p><p>]]bar <span>[[foo]]</span>
24126 </p><p>=bar <span>foo]]</span>=
24127 </p>
24128 !! wikitext
24129 bar <span><nowiki>[[foo]]</nowiki></span>
24130
24131 =bar <span><nowiki>[[foo]]</nowiki></span>
24132
24133 [[bar <span><nowiki>[[foo]]</nowiki></span>
24134
24135 ]]bar <span><nowiki>[[foo]]</nowiki></span>
24136
24137 =bar <span>foo]]</span><nowiki>=</nowiki>
24138 !!end
24139
24140 #### ----------------------- PRE --------------------------
24141 #### 1. Leading whitespace in SOL context should be escaped
24142 #### ------------------------------------------------------
24143 !! test
24144 1. Leading whitespace in SOL context should be escaped
24145 !! options
24146 parsoid=html2wt
24147 !! html/parsoid
24148 <p> a</p>
24149
24150 <p> a</p>
24151
24152 <p> a(tab)</p>
24153
24154 <p> a
24155 <!--cmt-->
24156 a</p>
24157
24158 <p>a
24159 b</p>
24160
24161 <p>a
24162 b</p>
24163
24164 <p>a
24165 b</p>
24166 !! wikitext
24167 <nowiki> </nowiki>a
24168
24169 <nowiki> </nowiki> a
24170
24171 a(tab)
24172
24173 <nowiki> </nowiki> a
24174 <!--cmt-->
24175 <nowiki> </nowiki>a
24176
24177 a
24178 <nowiki> </nowiki>b
24179
24180 a
24181 b
24182
24183 a
24184 b
24185 !! html/php
24186 <p> a
24187 </p><p> a
24188 </p><p> a(tab)
24189 </p><p> a
24190 a
24191 </p><p>a
24192 b
24193 </p><p>a
24194 b
24195 </p><p>a
24196 b
24197 </p>
24198 !! end
24199
24200 !! test
24201 2. Leading whitespace in non-indent-pre contexts should not be escaped
24202 !! options
24203 parsoid=html2wt
24204 !! html/parsoid
24205 <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>
24206 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
24207 <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>a</i>
24208 b</span></li>
24209 </ol>
24210 !! wikitext
24211 foo <ref>''a''
24212 b</ref>
24213 <references />
24214 !! end
24215
24216 !! test
24217 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
24218 !! options
24219 parsoid=html2wt
24220 !! html/parsoid
24221 <blockquote>
24222 <p>
24223 a
24224 <span>b</span>
24225 c</p>
24226 </blockquote>
24227 !! wikitext
24228 <blockquote>
24229 a
24230 <span>b</span>
24231 c
24232 </blockquote>
24233 !! end
24234
24235 !! test
24236 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
24237 !! options
24238 options=html2wt
24239 !! html/parsoid
24240 <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>
24241 !! wikitext
24242 [[File:Foobar.jpg|thumb|caption]]
24243 !! end
24244
24245 !! test
24246 5. Nowiki escaping should account for indent-pres
24247 !! options
24248 parsoid=html2wt
24249 !! html/parsoid
24250 <pre>==foo==</pre>
24251 !! wikitext
24252 ==foo==
24253 !! end
24254
24255 !!test
24256 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
24257 !! options
24258 parsoid=html2wt
24259 !! html/parsoid
24260 <pre>
24261 * foo
24262 * bar
24263 </pre>
24264 !! wikitext
24265 * foo
24266 * bar
24267 !! end
24268
24269 #### --------------- Behavior Switches --------------------
24270
24271 !! test
24272 1. Valid behavior switches should be escaped
24273 !! options
24274 parsoid=html2wt
24275 !! html/parsoid
24276 __TOC__
24277 <i>__TOC__</i>
24278 !! wikitext
24279 <nowiki>__TOC__</nowiki>
24280 ''<nowiki>__TOC__</nowiki>''
24281 !! end
24282
24283 !! test
24284 2. Invalid behavior switches should not be escaped
24285 !! options
24286 parsoid=html2wt
24287 !! html/parsoid
24288 __TOO__
24289 __|__
24290 !! wikitext
24291 __TOO__
24292 __|__
24293 !! end
24294
24295 # We use indent-pre as an indirect way to test for sol-transparent behavior.
24296 !! test
24297 Behavior switches should be SOL-transparent
24298 !! options
24299 parsoid=html2wt
24300 !! html/parsoid
24301 <meta property="mw:PageProp/toc" />
24302
24303 <!-- this one's bogus -->
24304 <pre>__TOO__</pre>
24305
24306 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
24307
24308 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
24309 !! wikitext
24310 __TOC__
24311
24312 <!-- this one's bogus -->
24313 __TOO__
24314
24315 __TOC__ foo
24316
24317 __TOC__
24318 bar
24319 !! end
24320
24321 #### --------------- HTML tags ---------------
24322 #### 1. a tags
24323 #### 2. other tags
24324 #### 3. multi-line html tag
24325 #### 4. extension tags
24326 #### -----------------------------------------
24327 !! test
24328 1. a tags
24329 !! options
24330 parsoid=html2wt
24331 !! html/parsoid
24332 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
24333 !! wikitext
24334 <a href="http://google.com">google</a>
24335 !! end
24336
24337 !! test
24338 2. other tags
24339 !! options
24340 parsoid=html2wt
24341 !! html/parsoid
24342 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
24343 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
24344 <li> &lt;td&gt;</li></ul>
24345
24346 !! wikitext
24347 * <nowiki><div>foo</div></nowiki>
24348 * <nowiki><div style="color:red">foo</div></nowiki>
24349 * <nowiki><td></nowiki>
24350 !! end
24351
24352 !! test
24353 3. multi-line html tag
24354 !! options
24355 parsoid=html2wt
24356 !! html/parsoid
24357 <p>&lt;div
24358 &gt;foo&lt;/div
24359 &gt;
24360 </p>
24361 !! wikitext
24362 <nowiki><div
24363 >foo</div
24364 ></nowiki>
24365 !! end
24366
24367 !! test
24368 4. extension tags
24369 !! options
24370 parsoid=html2wt
24371 !! html/parsoid
24372 <p>&lt;ref&gt;foo&lt;/ref&gt;
24373 </p><p>&lt;ref&gt;bar
24374 </p><p>baz&lt;/ref&gt;
24375 </p>
24376 !! wikitext
24377 <nowiki><ref>foo</ref></nowiki>
24378
24379 <nowiki><ref>bar</nowiki>
24380
24381 baz<nowiki></ref></nowiki>
24382 !! end
24383
24384 #### --------------- Others ---------------
24385 !! test
24386 Escaping nowikis
24387 !! options
24388 parsoid=html2wt
24389 !! html/parsoid
24390 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
24391 </p>
24392 !! wikitext
24393 &lt;nowiki&gt;foo&lt;/nowiki&gt;
24394 !! end
24395
24396 ## The quote-char in the input is necessary for triggering the bug
24397 !! test
24398 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
24399 !! options
24400 parsoid=html2wt
24401 !! html/parsoid
24402 <p>foo's bar :</p>
24403 !! wikitext
24404 foo's bar :
24405 !! end
24406
24407 #----------- End of wikitext escaping tests --------------
24408
24409 !! test
24410
24411 Tag-like HTML structures are passed through as text
24412 !! wikitext
24413 <x y>
24414
24415 <x.y>
24416
24417 <x-y>
24418
24419 1>2
24420
24421 x<y
24422
24423 a>b
24424
24425 1<d e>f
24426 !! html
24427 <p>&lt;x y&gt;
24428 </p><p>&lt;x.y&gt;
24429 </p><p>&lt;x-y&gt;
24430 </p><p>1&gt;2
24431 </p><p>x&lt;y
24432 </p><p>a&gt;b
24433 </p><p>1&lt;d e&gt;f
24434 </p>
24435 !! end
24436
24437 !! test
24438 HTML tag with necessary entities in attributes
24439 !! wikitext
24440 <span title="&amp;amp;">foo</span>
24441 !! html
24442 <p><span title="&amp;amp;">foo</span>
24443 </p>
24444 !! end
24445
24446 !! test
24447 HTML tag with 'unnecessary' entity encoding in attributes
24448 !! wikitext
24449 <span title="&amp;">foo</span>
24450 !! html
24451 <p><span title="&amp;">foo</span>
24452 </p>
24453 !! end
24454
24455 !! test
24456 HTML tag with broken attribute value quoting
24457 !! options
24458 parsoid=wt2html,html2html
24459 !! wikitext
24460 <span title="Hello world>Foo</span>
24461 !! html/php
24462 <p><span title="Hello world">Foo</span>
24463 </p>
24464 !! html/parsoid
24465 <p><span title="Hello world">Foo</span></p>
24466 !! end
24467
24468 !! test
24469 Self-closed tag with broken attribute value quoting
24470 !! options
24471 parsoid=wt2html,html2html
24472 !! wikitext
24473 <div title="Hello world />Foo
24474 !! html/php+tidy
24475 <div title="Hello world"></div>
24476 <p>Foo</p>
24477 !! html/parsoid
24478 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
24479 !! end
24480
24481 !! test
24482 Table with broken attribute value quoting
24483 !! options
24484 parsoid=wt2html,html2html
24485 !! wikitext
24486 {|
24487 | title="Hello world|Foo
24488 |}
24489 !! html/php
24490 <table>
24491 <tr>
24492 <td title="Hello world">Foo
24493 </td></tr></table>
24494
24495 !! html/parsoid
24496 <table>
24497 <tr>
24498 <td title="Hello world">Foo
24499 </td></tr></table>
24500
24501 !! end
24502
24503 !! test
24504 Table with broken attribute value quoting on consecutive lines
24505 !! options
24506 parsoid=wt2html,html2html
24507 !! wikitext
24508 {|
24509 | title="Hello world|Foo
24510 | style="color:red|Bar
24511 |}
24512 !! html/php
24513 <table>
24514 <tr>
24515 <td title="Hello world">Foo
24516 </td>
24517 <td style="color:red">Bar
24518 </td></tr></table>
24519
24520 !! html/parsoid
24521 <table><tbody>
24522 <tr>
24523 <td title="Hello world">Foo
24524 </td><td style="color: red">Bar
24525 </td></tr></tbody></table>
24526
24527 !! end
24528
24529 !!test
24530 Accept empty td cell attribute
24531 !! wikitext
24532 {|
24533 | align="center" | foo || |
24534 |}
24535 !! html
24536 <table>
24537 <tr>
24538 <td align="center"> foo </td>
24539 <td>
24540 </td></tr></table>
24541
24542 !!end
24543
24544 !!test
24545 Non-empty attributes in th-cells
24546 !! wikitext
24547 {|
24548 ! Foo !! style="color: red" | Bar
24549 |}
24550 !! html
24551 <table>
24552 <tr>
24553 <th> Foo </th>
24554 <th style="color: red"> Bar
24555 </th></tr></table>
24556
24557 !!end
24558
24559 !!test
24560 Accept empty attributes in th-cells
24561 !! wikitext
24562 {|
24563 !| foo !!| bar
24564 |}
24565 !! html
24566 <table>
24567 <tr>
24568 <th> foo </th>
24569 <th> bar
24570 </th></tr></table>
24571
24572 !!end
24573
24574 !!test
24575 Empty table rows go away
24576 !! wikitext
24577 {|
24578 | Hello
24579 | there
24580 |- class="foo"
24581 |-
24582 |}
24583 !! html
24584 <table>
24585 <tr>
24586 <td> Hello
24587 </td>
24588 <td> there
24589 </td></tr>
24590
24591 </table>
24592
24593 !! end
24594
24595 ###
24596 ### Parsoid-centric tests for testing RTing of inter-element separators
24597 ### Edge cases not tested by existing parser tests and specific to
24598 ### Parsoid-specific serialization strategies.
24599 ###
24600
24601 !!test
24602 RT-ed inter-element separators should be valid separators
24603 !! wikitext
24604 {|
24605 |- [[foo]]
24606 |}
24607 !! html/php
24608 <table>
24609
24610 </table>
24611
24612 !! html/parsoid
24613 <table>
24614 <tbody><tr data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
24615 </tbody></table>
24616 !!end
24617
24618 # Parsoid-only since PHP parser relies on Tidy for correct output
24619 !!test
24620 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
24621 !!options
24622 parsoid
24623 !! wikitext
24624 {|
24625 |<small>foo
24626 bar
24627 |}
24628
24629 {|
24630 |<small>foo<small>
24631 |}
24632 !! html
24633 <table>
24634 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
24635 <p>bar</p></small></td></tr>
24636 </tbody></table>
24637
24638 <table>
24639 <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>
24640 </tbody></table>
24641 !!end
24642
24643 # Note that the "style" attribute is really a template parameter here.
24644 # The = would have to be {{=}} if you wanted the literal.
24645 !!test
24646 Empty TD followed by TD with tpl-generated attribute
24647 !! wikitext
24648 {|
24649 |-
24650 |
24651 |{{echo|style='color:red'}}|foo
24652 |}
24653 !! html
24654 <table>
24655
24656 <tr>
24657 <td>
24658 </td>
24659 <td>foo
24660 </td></tr></table>
24661
24662 !!end
24663
24664 !!test
24665 Indented table with an empty td
24666 !! wikitext
24667 {|
24668 |-
24669 |
24670 |foo
24671 |}
24672 !! html
24673 <table>
24674
24675 <tr>
24676 <td>
24677 </td>
24678 <td>foo
24679 </td></tr></table>
24680
24681 !!end
24682
24683 ## We have some newline diffs RT-ing this edge case
24684 ## and it is not important enough -- we seem to be emitting
24685 ## at most 2 newlines after a </tr> and this is unrelated to
24686 ## the issue from T85627 that this is testing.
24687 !!test
24688 Indented table with blank lines in between (T85627)
24689 !! options
24690 parsoid=wt2html
24691 !! wikitext
24692 {|
24693 |foo
24694
24695
24696 |}
24697 !! html
24698 <table>
24699
24700 <tr>
24701 <td>foo
24702 </td></tr></table>
24703
24704 !!end
24705
24706 !!test
24707 Indented block & table
24708 !! wikitext
24709 <div>foo</div>
24710 {|
24711 |foo
24712 |}
24713 !! html/php
24714 <div>foo</div>
24715 <table>
24716 <tr>
24717 <td>foo
24718 </td></tr></table>
24719
24720 !! html/parsoid
24721 <div data-parsoid='{"stx":"html"}'>foo</div>
24722 <table><tbody>
24723 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
24724 </tbody></table>
24725 !!end
24726
24727 !! test
24728 Indent and comment before table row
24729 !! wikitext
24730 {|
24731 <!--hi-->|-
24732 | there
24733 |}
24734 !! html/php
24735 <table>
24736
24737 <tr>
24738 <td> there
24739 </td></tr></table>
24740
24741 !! html/parsoid
24742 <table>
24743 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
24744 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
24745 </tbody></table>
24746 !! end
24747
24748 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
24749 !!test
24750 Empty TR followed by a template-generated TR
24751 !!options
24752 parsoid
24753 !! wikitext
24754 {|
24755 |-
24756 {{echo|<tr><td>foo</td></tr>}}
24757 |}
24758 !! html
24759 <table>
24760 <tbody>
24761 <tr></tr>
24762 <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}}]}'>
24763 <td>foo</td></tr>
24764 </tbody></table>
24765 !!end
24766
24767 ## PHP and parsoid output differ for this, and since this is primarily
24768 ## for testing Parsoid's serializer, marking this Parsoid only
24769 !!test
24770 Empty TR followed by mixed-ws-comment line should RT correctly
24771 !!options
24772 parsoid
24773 !! wikitext
24774 {|
24775 |-
24776 <!--c-->
24777 |-
24778 <!--c--> <!--d-->
24779 |}
24780 !! html
24781 <table>
24782 <tbody>
24783 <tr></tr>
24784 <!--c-->
24785 <tr>
24786 <!--c--> </tr><!--d-->
24787 </tbody></table>
24788
24789 !!end
24790
24791 !!test
24792 Multi-line image caption generated by templates with/without trailing newlines
24793 !! wikitext
24794 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
24795 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
24796 !! html/parsoid
24797 <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>
24798 <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>
24799 !!end
24800
24801 !! test
24802 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
24803 !! options
24804 parsoid=html2wt
24805 !! html/parsoid
24806 <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>
24807
24808 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
24809 !! wikitext
24810 <includeonly>foo</includeonly>
24811 new para
24812
24813 [[Category:Foo]]
24814
24815 = new heading =
24816 !! end
24817
24818 ## PHP emits broken html for this, and since this is primarily
24819 ## a Parsoid serializer test, marking this Parsoid only
24820 !!test
24821 Improperly nested inline or quotes tags with whitespace in between
24822 !! wikitext
24823 <span> <s>x</span> </s>
24824 ''' ''x''' ''
24825 !! html/parsoid
24826 <p><span> <s>x</s></span><s> </s>
24827 <b> <i>x</i></b><i> </i>
24828 </p>
24829 !!end
24830
24831 !!test
24832 Encapsulate protected attributes from wt
24833 !! wikitext
24834 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
24835
24836 {| typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true"
24837 | ok
24838 |}
24839 !! html/parsoid
24840 <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>
24841
24842 <table 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">
24843 <tbody><tr><td data-parsoid='{"autoInsertedEnd":true}'> ok</td></tr>
24844 </tbody></table>
24845 !!end
24846
24847 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
24848 ## Having nested or stray pre tags results in the attempt to add duplicates,
24849 ## causing an assertion fail. This test tries to prevent that situation.
24850 !!test
24851 Ensure ParagraphWrapper can deal with stray closing pre tags
24852 !!options
24853 parsoid=wt2html
24854 !! wikitext
24855 plain text</pre>
24856 !! html/parsoid
24857 plain text
24858 !!end
24859
24860 !!test
24861 1. Ensure fostered text content is wrapped in element nodes
24862 !!options
24863 parsoid=wt2html
24864 !! wikitext
24865 <table>hi</table><table>ho</table>
24866 !! html/parsoid
24867 <p>hi</p>
24868 <table></table>
24869 <p>ho</p>
24870 <table></table>
24871 !!end
24872
24873 !!test
24874 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
24875 !!options
24876 parsoid=wt2html,wt2wt
24877 !! wikitext
24878 <table>
24879 <tr> || ||
24880 <td> a
24881 </table>
24882 !! html/parsoid
24883 <p> || ||
24884 </p><table>
24885 <tbody><tr><td> a</td></tr>
24886 </tbody></table>
24887 !!end
24888
24889 !!test
24890 Encapsulation properly handles null DSR information from foster box
24891 !!options
24892 parsoid=wt2html,wt2wt
24893 !! wikitext
24894 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
24895 !! html/parsoid
24896 <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>
24897 !!end
24898
24899 !!test
24900 1. Encapsulate foster-parented transclusion content
24901 !!options
24902 parsoid=wt2wt,wt2html
24903 !! wikitext
24904 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
24905 !! html/parsoid
24906 <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>
24907 <tbody>
24908 <tr>
24909 <td>bar</td>
24910 </tr>
24911 </tbody>
24912 </table>
24913 !!end
24914
24915 !!test
24916 2. Encapsulate foster-parented transclusion content
24917 !!options
24918 parsoid=wt2wt,wt2html
24919 !! wikitext
24920 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
24921 !! html/parsoid
24922 <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>
24923 <table>
24924 <tbody>
24925 <tr>
24926 <td>bar</td>
24927 </tr>
24928 </tbody>
24929 </table>
24930 !!end
24931
24932 !!test
24933 3. Encapsulate foster-parented transclusion content
24934 !!options
24935 parsoid=wt2wt,wt2html
24936 !! wikitext
24937 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
24938 !! html/parsoid
24939 <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;]}">
24940 <p>foo</p>
24941 </div>
24942 <table>
24943 <tbody>
24944 <tr>
24945 <td>bar</td>
24946 </tr>
24947 </tbody>
24948 </table>
24949 !!end
24950
24951 !!test
24952 4. Encapsulate foster-parented transclusion content
24953 !!options
24954 parsoid=wt2wt,wt2html
24955 !! wikitext
24956 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
24957 !! html/parsoid
24958 <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;]}">
24959 <p>foo</p>
24960 </div>
24961 <table>
24962 <tbody>
24963 <tr>
24964 <td>bar</td>
24965 </tr>
24966 </tbody>
24967 </table>
24968 !!end
24969
24970 !!test
24971 5. Encapsulate foster-parented transclusion content
24972 !!options
24973 parsoid=wt2wt,wt2html
24974 !! wikitext
24975 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
24976 !! html/parsoid
24977 <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>
24978 <table>
24979 <tbody>
24980 <tr>
24981 <td>
24982 <div>
24983 <p>foo</p>
24984 </div>
24985 </td>
24986 </tr>
24987 </tbody>
24988 </table>
24989 !!end
24990
24991 !!test
24992 6. Encapsulate foster-parented transclusion content
24993 !!options
24994 parsoid=wt2wt,wt2html
24995 !! wikitext
24996 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
24997 !! html/parsoid
24998 <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>
24999 <table>
25000 <tbody>
25001 <tr>
25002 <td>
25003 <div>
25004 <p>foo</p>
25005 </div>
25006 </td>
25007 </tr>
25008 </tbody>
25009 </table>
25010 <p>ok</p>
25011 !!end
25012
25013 !!test
25014 7. Encapsulate foster-parented transclusion content
25015 !!options
25016 parsoid=wt2wt,wt2html
25017 !! wikitext
25018 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
25019 !! html/parsoid
25020 <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>
25021 <table>
25022 <tbody>
25023 <tr>
25024 <td>bar</td>
25025 </tr>
25026 </tbody>
25027 </table>
25028 !!end
25029
25030 # Note that the wt is broken on purpose: the = should be {{=}} if you
25031 # don't want it to be a template parameter key.
25032 !!test
25033 8. Encapsulate foster-parented transclusion content
25034 !!options
25035 parsoid=wt2wt,wt2html
25036 !! wikitext
25037 {{echo|a
25038 }}{|{{echo|style='color:red'}}
25039 |-
25040 |b
25041 |}
25042 !! html/parsoid
25043 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
25044 <span> </span>
25045 <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>
25046 <table>
25047 <tbody>
25048 <tr>
25049 <td>b</td>
25050 </tr>
25051 </tbody>
25052 </table>
25053 !!end
25054
25055 !!test
25056 9. Encapsulate foster-parented transclusion content
25057 !!options
25058 parsoid=wt2wt,wt2html
25059 !! wikitext
25060 <table>{{echo|hi</table>hello}}
25061 !! html/parsoid
25062 <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>
25063 !!end
25064
25065 !!test
25066 Table in fosterable position
25067 !!options
25068 parsoid=wt2html
25069 !! wikitext
25070 {{OpenTable}}
25071 <div>
25072 {|
25073 |}
25074 </div>
25075 |}
25076 !! html/parsoid
25077 <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">
25078 </span>
25079 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
25080
25081 <table>
25082 </table>
25083 !!end
25084
25085 # Parsoid only for bug 64747
25086 !! test
25087 Properly encapsulate empty-content transclusions in fosterable positions
25088 !! wikitext
25089 <table>
25090 {{#if:|
25091 <td>foo</td>
25092 }}
25093 </table>
25094 !! html/parsoid
25095 <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"}]]}'>
25096
25097 </table>
25098 !! end
25099
25100 !! test
25101 Always encapsulate foster box when template range is expanded to table
25102 !! options
25103 parsoid=wt2wt
25104 !! wikitext
25105 {|
25106 hello
25107 {{OpenTable}}
25108 |}
25109 !! html/parsoid
25110
25111 !! end
25112
25113 !! test
25114 T115289: Unclosed table
25115 !! wikitext
25116 {{echo|<table>}}<!--c-->[[Category:Two]]
25117 !! html/parsoid
25118 <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>
25119 !! end
25120
25121 !! test
25122 T115289: Don't migrate newlines out of tables with fostered content
25123 !! wikitext
25124 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
25125 !! html/parsoid
25126 <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}'><tbody><tr><td></td></tr><tr><!--c--></tr></tbody></table>
25127 !! end
25128
25129 !! test
25130 T73074: More fostering fun
25131 !! wikitext
25132 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
25133 !! html/parsoid
25134 <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>
25135 !! end
25136
25137 !!test
25138 Support <object> element with .data attribute
25139 !!options
25140 parsoid=html2wt
25141 !! html/parsoid
25142 <object data="test.swf"></object>
25143 !! wikitext
25144 <object data="test.swf"></object>
25145 !!end
25146
25147 !! test
25148 Don't block XML namespace declaration
25149 !! wikitext
25150 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
25151 !! html/php
25152 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
25153 </p>
25154 !! html/parsoid
25155 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
25156 !! end
25157
25158 # -----------------------------------------------------------------
25159 # The following section of tests are primarily to spec requirements
25160 # around Parsoid's serialization (old, new, edited content)
25161 #
25162 # All these tests are marked Parsoid html2wt and html2html only
25163 # ----------------------------------------------------------------
25164
25165 !! test
25166 Ignore rel attribute in a-tags during serialization to url-links
25167 !! options
25168 parsoid=html2wt
25169 !! html/parsoid
25170 <a href='http://en.wikipedia.org/wiki/Foobar'>http://en.wikipedia.org/wiki/Foobar</a>
25171 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:ExtLink'>http://en.wikipedia.org/wiki/Foobar</a>
25172 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:WikiLink'>http://en.wikipedia.org/wiki/Foobar</a>
25173 !! wikitext
25174 http://en.wikipedia.org/wiki/Foobar
25175 http://en.wikipedia.org/wiki/Foobar
25176 http://en.wikipedia.org/wiki/Foobar
25177 !! end
25178
25179 # 'mi' is a localinterwiki prefix as well as a language
25180 !! test
25181 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
25182 !! options
25183 parsoid=html2wt
25184 !! html/parsoid
25185 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
25186 !! wikitext
25187 [[Foo]]
25188 !! end
25189
25190 # See T93839
25191 !! test
25192 New wikilinks should be serialized properly
25193 !! options
25194 parsoid=html2wt
25195 !! html/parsoid
25196 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
25197 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
25198 <a href="//en.wikipedia.org/wiki/Foo">//en.wikipedia.org/wiki/Foo</a>
25199 <a href="http://en.wikipedia.org/wiki/Foo">http://en.wikipedia.org/wiki/Foo</a>
25200 <a href="//en.wikipedia.org/wiki/Foo_bar">//en.wikipedia.org/wiki/Foo bar</a>
25201 !! wikitext
25202 [[Foo]]
25203 [[Foo]]
25204 [[:en:Foo|//en.wikipedia.org/wiki/Foo]]
25205 http://en.wikipedia.org/wiki/Foo
25206 [[:en:Foo_bar|//en.wikipedia.org/wiki/Foo bar]]
25207 !! end
25208
25209 !! test
25210 New wiki links (href variations)
25211 !! options
25212 parsoid=html2wt
25213 !! html/parsoid
25214 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
25215 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
25216 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
25217 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
25218 !! wikitext
25219 [[Foo_bar]]
25220 [[Foo_bar]]
25221 [[Foo_bar]]
25222 [[Toxine bactérienne]]
25223 !! end
25224
25225 !! test
25226 New wiki links (content string variations)
25227 !! options
25228 parsoid=html2wt
25229 !! html/parsoid
25230 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
25231 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
25232 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
25233 !! wikitext
25234 [[Foo_bar]]
25235 [[Foo bar]]
25236 [[Foo_bar|./Foo_bar]]
25237 !! end
25238
25239 !! test
25240 New category links (href variations)
25241 !! options
25242 parsoid=html2wt
25243 !! html/parsoid
25244 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
25245 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
25246 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
25247 !! wikitext
25248 [[Category:Toxine bactérienne]]
25249 [[Category:Toxine bactérienne]]
25250 [[Category:Toxine bactérienne]]
25251 !! end
25252
25253 !! test
25254 New sol transparent links don't need indent-pre nowiki protection
25255 !! options
25256 parsoid=html2wt
25257 language=de
25258 !! html/parsoid
25259 <link rel="mw:PageProp/redirect" href="./Main_Page">
25260 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
25261 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
25262 !! wikitext
25263 #WEITERLEITUNG [[Main Page]]
25264 <!-- this is good --> [[Category:Good]]
25265 <!-- this is great --> [[Kategorie:Great]]
25266 !! end
25267
25268 !! test
25269 New interlanguage links (href variations)
25270 !! options
25271 parsoid=html2wt
25272 !! html/parsoid
25273 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
25274 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
25275 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
25276 !! wikitext
25277 [[es:Toxine bactérienne]]
25278 [[es:Toxine_bactérienne]]
25279 [[es:Toxine_bactérienne]]
25280 !! end
25281
25282 !! test
25283 Image: Modifying size of an image (1)
25284 !! options
25285 parsoid={
25286 "modes": ["wt2wt"],
25287 "changes": [
25288 ["img[height]", "attr", "height", "22"],
25289 ["img[width]", "attr", "width", "200"]
25290 ]
25291 }
25292 !! wikitext
25293 [[Image:Foobar.jpg|230x230px]]
25294 !! wikitext/edited
25295 [[Image:Foobar.jpg|200x200px]]
25296 !!end
25297
25298 !! test
25299 Image: Modifying size of an image (2)
25300 !! options
25301 parsoid={
25302 "modes": ["wt2wt"],
25303 "changes": [
25304 ["img[height]", "attr", "height", "100"],
25305 ["img[width]", "attr", "width", "500"]
25306 ]
25307 }
25308 !! wikitext
25309 [[Image:Foobar.jpg|230x230px]]
25310 !! wikitext/edited
25311 [[Image:Foobar.jpg|500x500px]]
25312 !!end
25313
25314 # Change in size is ignored so long as class='mw-default-size'
25315 !! test
25316 Image: Modifying size of an image (3)
25317 !! options
25318 parsoid={
25319 "modes": ["wt2wt"],
25320 "changes": [
25321 ["figure[class]", "removeClass", "mw-default-size"],
25322 ["figure img", "attr", "height", "19"],
25323 ["figure img", "attr", "width", "170"]
25324 ]
25325 }
25326 !! wikitext
25327 [[Image:Foobar.jpg|thumb]]
25328 !! wikitext/edited
25329 [[Image:Foobar.jpg|thumb|170x170px]]
25330 !!end
25331
25332 !! test
25333 Image: Modifying alignment of an image (bug 48665)
25334 !! options
25335 parsoid={
25336 "modes": ["wt2wt"],
25337 "changes": [
25338 ["figure[class]", "removeClass", "mw-halign-right"],
25339 ["figure[class]", "addClass", "mw-halign-left"]
25340 ]
25341 }
25342 !! wikitext
25343 [[Image:Foobar.jpg|thumb|caption|right]]
25344 !! wikitext/edited
25345 [[Image:Foobar.jpg|thumb|caption|left]]
25346 !! end
25347
25348 !! test
25349 Image: Modifying mw-default-size of an frameless image (bug 62805)
25350 !! options
25351 parsoid={
25352 "modes": ["wt2wt"],
25353 "changes": [
25354 ["figure.mw-default-size", "removeClass", "mw-default-size"]
25355 ]
25356 }
25357 !! wikitext
25358 [[Image:Foobar.jpg|frameless|right]]
25359 !! wikitext/edited
25360 [[Image:Foobar.jpg|frameless|right|220x220px]]
25361 !! end
25362
25363 !! test
25364 Image: Modifying valign of an image (bug 49221)
25365 !! options
25366 parsoid={
25367 "modes": ["wt2wt"],
25368 "changes": [
25369 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
25370 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
25371 ]
25372 }
25373 !! wikitext
25374 [[File:Foobar.jpg|20px|middle]]
25375 !! wikitext/edited
25376 [[File:Foobar.jpg|20px|text-top]]
25377 !! end
25378
25379 !! test
25380 Image: Modifying alt attribute of an image (bug 56400)
25381 !! options
25382 parsoid={
25383 "modes": ["wt2wt"],
25384 "changes": [
25385 ["img[alt]", "attr", "alt", "some alternate edited text"]
25386 ]
25387 }
25388 !! wikitext
25389 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
25390 !! wikitext/edited
25391 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
25392 !!end
25393
25394 !! test
25395 Image: Modifying caption of an image
25396 !! options
25397 parsoid={
25398 "modes": ["wt2wt"],
25399 "changes": [
25400 ["figcaption", "text", "new caption"]
25401 ]
25402 }
25403 !! wikitext
25404 [[Image:Foobar.jpg|thumb|original caption]]
25405 !! wikitext/edited
25406 [[Image:Foobar.jpg|thumb|new caption]]
25407 !!end
25408
25409 !! test
25410 Image: empty alt attribute (bug 48924)
25411 !! options
25412 parsoid
25413 !! wikitext
25414 [[File:Foobar.jpg|thumb|alt=|bar]]
25415 !! html
25416 <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>
25417 !! end
25418
25419 !! test
25420 Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
25421 !! options
25422 parsoid=html2wt
25423 language=ar
25424 disabled
25425 !! html/parsoid
25426 <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>
25427 !! wikitext
25428 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
25429 !! end
25430
25431 !! test
25432 Image: Block level image should have \n before and after
25433 !! wikitext
25434 123
25435 [[File:Foobar.jpg|right|thumb|150x150px]]
25436 456
25437 !! html/parsoid
25438 <p>123</p>
25439 <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>
25440 <p>456</p>
25441 !!end
25442
25443 !! test
25444 Image: New block level image should have \n before and after (existing content)
25445 !! wikitext
25446 123
25447 [[File:Foobar.jpg|right|thumb|150x150px]]
25448 456
25449 !! html/parsoid
25450 <p>123</p>
25451 <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>
25452 <p>456</p>
25453 !!end
25454
25455 !! test
25456 Image: upright option (parsoid)
25457 !! wikitext
25458 [[File:Foobar.jpg|thumb|upright|caption]]
25459 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
25460 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
25461 !! html/parsoid
25462 <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>
25463 <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>
25464 <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>
25465 !!end
25466
25467 !! test
25468 Image: upright option is ignored on inline and frame images (parsoid)
25469 !! wikitext
25470 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
25471 !! html/parsoid
25472 <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>
25473 !!end
25474
25475 !! test
25476 Image: from basic HTML (1)
25477 !! options
25478 parsoid=html2wt
25479 !! html/parsoid
25480 <span typeof="mw:Image">
25481 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
25482 </span>
25483 !! wikitext
25484 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
25485 !! end
25486
25487 !! test
25488 Image: from basic HTML (2)
25489 !! options
25490 parsoid=html2wt
25491 !! html/parsoid
25492 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
25493 !! wikitext
25494 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
25495 !! end
25496
25497 !! test
25498 Image: from basic HTML (3)
25499 !! options
25500 parsoid=html2wt
25501 !! html/parsoid
25502 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
25503 !! wikitext
25504 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
25505 !! end
25506
25507 !! test
25508 Image: from basic HTML (4)
25509 !! options
25510 parsoid=html2wt
25511 !! html/parsoid
25512 <img src="./File:Foobar.jpg">
25513 !! wikitext
25514 [[File:Foobar.jpg|link=]]
25515 !! end
25516
25517 !! test
25518 Image: Invalid title as link
25519 !! wikitext
25520 [[File:Foobar.jpg|link=<]]
25521 !! html/php
25522 <p><a href="/wiki/File:Foobar.jpg" class="image" title="link=&lt;"><img alt="link=&lt;" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
25523 </p>
25524 !! html/parsoid
25525 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"link","ak":"link=&lt;"}]}' data-mw='{"caption":"link=&amp;lt;"}'><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>
25526 !! end
25527
25528 !! test
25529 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
25530 !! options
25531 parsoid=html2wt
25532 !! html/parsoid
25533 <ul>
25534 <li><p>foo</p></li>
25535 </ul>
25536 !! wikitext
25537 * foo
25538 !! end
25539
25540 !! test
25541 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
25542 !! options
25543 parsoid=html2wt
25544 !! html/parsoid
25545 <ul> <li>foo</li></ul>
25546 !! wikitext
25547 * foo
25548 !! end
25549
25550 !! test
25551 Don't strip leading whitespace when handling indent-pre suppressing tags
25552 !! options
25553 parsoid=html2wt
25554 !! html/parsoid
25555 <table>
25556 <tr><td> indented row</td></tr>
25557 </table>
25558 <blockquote><p>
25559 <b>This is very bold of you!</b>
25560 </p>
25561 <table><tr><td>
25562 indented cell (no pre-wrapping!)
25563 </td></tr></table>
25564 </blockquote>
25565 <p>foo</p>
25566 <div>bar</div>
25567 !! wikitext
25568 {|
25569 | indented row
25570 |}
25571 <blockquote>
25572 '''This is very bold of you!'''
25573
25574 {|
25575 |
25576 indented cell (no pre-wrapping!)
25577 |}
25578 </blockquote>
25579 foo
25580 <div>bar</div>
25581 !! end
25582
25583 !! test
25584 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
25585 !! options
25586 parsoid=html2wt
25587 !! html/parsoid
25588 <p>foo</p>
25589 <span>bar</span>
25590
25591 <span>foo2
25592 </span>bar2
25593
25594 <div>foo</div>
25595 <span>bar</span>
25596
25597 <div>
25598 <span>foo</span>
25599 </div>
25600 !! wikitext
25601 foo
25602
25603 <span>bar</span>
25604
25605 <span>foo2
25606 <nowiki> </nowiki></span>bar2
25607
25608 <div>foo</div>
25609 <nowiki> </nowiki><span>bar</span>
25610
25611 <div>
25612 <nowiki> </nowiki><span>foo</span>
25613 </div>
25614 !! end
25615
25616 !! test
25617 Lists: Dont insert newlines in a serialized list item.
25618 !! options
25619 parsoid=html2wt
25620 !! html/parsoid
25621 <ul><li>a<br>b</li><li>c</li></ul>
25622 !! wikitext
25623 * a<br>b
25624 * c
25625 !! end
25626
25627 !! test
25628 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
25629 !! options
25630 parsoid={
25631 "modes": ["html2wt"],
25632 "scrubWikitext": false
25633 }
25634 !! html/parsoid
25635 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
25636 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
25637
25638 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
25639 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
25640
25641 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
25642
25643 <h2><meta property="mw:PageProp/toc" /> ok</h2>
25644 !! wikitext
25645 == hello there [[Category:A1]] ==
25646
25647 == [[Category:A2]] hi pal ==
25648
25649 == <!--foo--> [[Category:A3]] how goes it ==
25650
25651 == it goes well [[Category:A4]] <!--bar--> ==
25652
25653 ==howdy [[Category:A5]]==
25654
25655 == __TOC__ ok ==
25656 !! end
25657
25658 !! test
25659 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
25660 !! options
25661 parsoid={
25662 "modes": ["html2wt"],
25663 "scrubWikitext": true
25664 }
25665 !! html/parsoid
25666 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
25667 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
25668
25669 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
25670 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
25671
25672 <h2><meta property="mw:PageProp/toc" /> ok</h2>
25673 !! wikitext
25674 == hello there ==
25675 [[Category:A1]]
25676 [[Category:A2]]
25677
25678 == hi pal ==
25679
25680 <!--foo--> [[Category:A3]]
25681
25682 == how goes it ==
25683
25684 == it goes well ==
25685 [[Category:A4]] <!--bar-->
25686
25687 __TOC__
25688
25689 == ok ==
25690 !! end
25691
25692 !! test
25693 Headings: Don't hoist metas that come from templates
25694 !! options
25695 parsoid={
25696 "modes": ["html2wt"],
25697 "scrubWikitext": true
25698 }
25699 !! html/parsoid
25700 <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>
25701 !! wikitext
25702 == {{echo|foo [[Category:Foo]]}} ==
25703 !! end
25704
25705 !! test
25706 Headings: Category in ref isn't hoisted
25707 !! options
25708 parsoid={
25709 "modes": ["html2wt"],
25710 "scrubWikitext": true
25711 }
25712 !! html/parsoid
25713 <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>
25714
25715 <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>
25716 !! wikitext
25717 == foo <ref>bar
25718 [[Category:Baz]] </ref> ==
25719
25720 <references />
25721 !! end
25722
25723 !! test
25724 Parsoid: Serialize positional parameters with = in them as named parameter
25725 !! options
25726 parsoid=html2wt
25727 !! html/parsoid
25728 <p about="#mwt1" typeof="mw:Transclusion"
25729 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
25730
25731 <p about="#mwt1" typeof="mw:Transclusion"
25732 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
25733
25734 <!--Orig params with data-parsoid has heuristics for handling = chars-->
25735 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
25736 <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>
25737 !! wikitext
25738 {{echo|1=f=oo}}
25739
25740 {{echo|1=f=oo|2=bar}}
25741
25742 <!--Orig params with data-parsoid has heuristics for handling = chars-->
25743 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
25744 {{echo|<nowiki>f=oo</nowiki>|bar}}
25745 !! end
25746
25747 !! test
25748 Parsoid: Serialize positional parameters with = in extlink as named parameter
25749 !! options
25750 parsoid=html2wt
25751 !! html/parsoid
25752 <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>
25753 !! wikitext
25754 {{echo|1=http://stuff?is=ok}}
25755 !! end
25756
25757 !! test
25758 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
25759 !! options
25760 parsoid=html2wt
25761 !! html/parsoid
25762 <div>a<p>b</p></div>
25763 <div>a
25764 <p>b</p></div>
25765 <div>
25766 a
25767 <p>b</p></div>
25768 !! wikitext
25769 <div>a
25770 b
25771 </div>
25772 <div>a
25773 b
25774 </div>
25775 <div>
25776 a
25777
25778 b
25779 </div>
25780 !! end
25781
25782 !! test
25783 Substrings resembling wikitext in hrefs should not get nowiki escapes
25784 !! options
25785 parsoid=html2wt
25786 !! html/parsoid
25787 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
25788 !! wikitext
25789 [[Foo''bar''baz]]
25790 !! end
25791
25792 !! test
25793 Enforce single-line context in the serializer
25794 !! options
25795 parsoid=html2wt
25796 !! html/parsoid
25797 <h2>testing
25798 123</h2>
25799
25800 <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">
25801 </span><span about="#mwt1">you</span> </h2>
25802
25803 <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>
25804
25805 <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
25806 there</span></li></ol>
25807
25808 <ul><li>asd
25809 sdf</li></ul>
25810
25811 <ul><li>foo
25812 bar
25813 baz</li>
25814 <li>foo <b>bar</b>
25815 baz</li></ul>
25816
25817 <dl><dt>hi
25818 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
25819 ho</dd></dl>
25820
25821 <dl><dd> <table>
25822 <tbody><tr><td> ha
25823 ha
25824 ha</td></tr>
25825 </tbody></table></dd></dl>
25826 !! wikitext
25827 == testing 123 ==
25828
25829 == hi {{bogus|there
25830 you}} ==
25831
25832 == foo <ref>hello
25833 there</ref> ==
25834
25835 <references />
25836
25837 * asd sdf
25838
25839 * foo bar baz
25840 * foo '''bar''' baz
25841
25842 ; hi ho : hi ho
25843
25844 : {|
25845 | ha
25846 ha
25847 ha
25848 |}
25849 !! end
25850
25851 !! test
25852 Serialize new placeholder space without spans
25853 !! options
25854 parsoid=html2wt
25855 !! html/parsoid
25856 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
25857
25858 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
25859
25860 <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>
25861 !! wikitext
25862 foo : bar
25863
25864 foo : bar
25865
25866 <ref>foo : bar</ref>ok
25867 !! end
25868
25869
25870 #-----------------------
25871 # Tag minimization tests
25872 #-----------------------
25873
25874 !! test
25875 1. I/B quote minimization: wikitext-only tags should be combined
25876 !! options
25877 parsoid=html2wt
25878 !! html/parsoid
25879 <p><i>A</i><i>B</i></p>
25880 <p><b>A</b><b>B</b></p>
25881 <p><i>A</i><b><i>B</i></b></p>
25882 <p><b>A</b><i><b>B</b></i></p>
25883 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
25884 <p><i><b>A</b></i><i><b>B</b></i></p>
25885 <p><i><b>A</b></i><b><i>B</i></b></p>
25886 <p><b><i>A</i></b><i><b>B</b></i></p>
25887 !! wikitext
25888 ''AB''
25889
25890 '''AB'''
25891
25892 ''A'''B'''''
25893
25894 '''A''B'''''
25895
25896 '''A''BC''D'''
25897
25898 '''''AB'''''
25899
25900 '''''AB'''''
25901
25902 '''''AB'''''
25903 !! end
25904
25905 !! test
25906 2. I/B quote minimization: wikitext and html tags should not be combined
25907 !! options
25908 parsoid=html2wt
25909 !! html/parsoid
25910 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
25911 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
25912 !! wikitext
25913 ''A''<i>B</i>
25914
25915 ''A''<nowiki/>'''<i>B</i>'''
25916 !! end
25917
25918 !! test
25919 3. I/B quote minimization: templated content stops minimization
25920 !! options
25921 parsoid=html2wt
25922 !! html/parsoid
25923 <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>
25924 <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>
25925 !! wikitext
25926 ''A''{{echo|''B''}}
25927
25928 ''A''{{echo|'''''B'''''}}
25929 !! end
25930
25931 !! test
25932 4. I/B quote minimization: new content should be mimimized with adjacent old content
25933 !! options
25934 parsoid=html2wt
25935 !! html/parsoid
25936 <p><i>A</i><i>B</i></p>
25937 <p><b>A</b><b>B</b></p>
25938 <p><i>A</i><b><i>B</i></b></p>
25939 !! wikitext
25940 ''AB''
25941
25942 '''AB'''
25943
25944 ''A'''B'''''
25945 !! end
25946
25947 !! test
25948 5a. Merge adjacent quote nodes if they've been edited
25949 !! options
25950 parsoid={
25951 "modes": ["wt2wt", "selser"],
25952 "changes": [
25953 ["p", "contents", "remove", ":contains('b')"]
25954 ]
25955 }
25956 !! wikitext
25957 ''a''b''c''
25958 !! wikitext/edited
25959 ''ac''
25960 !! end
25961
25962 !! test
25963 5b. Merge adjacent quote nodes if they've been edited
25964 !! options
25965 parsoid={
25966 "modes": ["wt2wt", "selser"],
25967 "changes": [
25968 ["#x", "remove"]
25969 ]
25970 }
25971 !! wikitext
25972 ''a''<span id="x">b</span>''c''
25973 !! wikitext/edited
25974 ''ac''
25975 !! end
25976
25977 !! test
25978 1. Merge adjacent link nodes as long as at least one element is new
25979 !! options
25980 parsoid={
25981 "modes": ["html2wt"],
25982 "scrubWikitext": true
25983 }
25984 !! html/parsoid
25985 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25986 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25987 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
25988 !! wikitext
25989 [[Football]]
25990 [[Football]]
25991 [[Football|Foot]][[Football|ball]]
25992 !! end
25993
25994 !! test
25995 2. Merge adjacent link nodes and enable additional normalizations
25996 !! options
25997 parsoid={
25998 "modes": ["html2wt"],
25999 "scrubWikitext": true
26000 }
26001 !! html/parsoid
26002 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
26003 !! wikitext
26004 [[Football|''Football'']]
26005 !! end
26006
26007 !! test
26008 3. Don't merge adjacent link nodes if scrubWikitext is false
26009 !! options
26010 parsoid={
26011 "modes": ["html2wt"],
26012 "scrubWikitext": false
26013 }
26014 !! html/parsoid
26015 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26016 !! wikitext
26017 [[Football|Foot]][[Football|ball]]
26018 !! end
26019
26020 #------------------------------
26021 # End of tag minimization tests
26022 #------------------------------
26023
26024 !!test
26025 Bug 54262: New entities
26026 !! options
26027 parsoid=html2wt
26028 !! html/parsoid
26029 <span typeof="mw:Entity">&nbsp;</span>
26030 !! wikitext
26031 &nbsp;
26032 !! end
26033
26034 ## Note that there is no wikitext output for 'unknownproperty' ##
26035 ## Unknown magic words are silently dropped ##
26036
26037 !! test
26038 Magic words
26039 !! options
26040 parsoid=html2wt
26041 !! html/parsoid
26042 <meta property='mw:PageProp/toc' />
26043 <meta property='mw:PageProp/notoc' />
26044 <meta property='mw:PageProp/forcetoc' />
26045 <meta property='mw:PageProp/index' />
26046 <meta property='mw:PageProp/noindex' />
26047 <meta property='mw:PageProp/nogallery' />
26048 <meta property='mw:PageProp/noeditsection' />
26049 <meta property='mw:PageProp/notitleconvert' />
26050 <meta property='mw:PageProp/nocontentconvert' />
26051 <meta property='mw:PageProp/unknownproperty' />
26052 !! wikitext
26053 __TOC__
26054 __NOTOC__
26055 __FORCETOC__
26056 __INDEX__
26057 __NOINDEX__
26058 __NOGALLERY__
26059 __NOEDITSECTION__
26060 __NOTITLECONVERT__
26061 __NOCONTENTCONVERT__
26062 !! end
26063
26064 !! test
26065 Consecutive <pre>s should not get merged
26066 !! options
26067 parsoid=html2wt,html2html
26068 !! html/parsoid
26069 <pre>a</pre><pre>b</pre>
26070
26071 <pre>c
26072 </pre><pre>
26073 d</pre>
26074
26075 <pre>e
26076
26077 </pre><pre>
26078
26079 f</pre>
26080 !! wikitext
26081 a
26082
26083 b
26084
26085 c
26086
26087 d
26088
26089 e
26090
26091
26092
26093 f
26094 !! end
26095
26096 !! test
26097 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
26098 !! options
26099 parsoid=html2wt
26100 !! html/parsoid
26101 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
26102 !! wikitext
26103 [[Special:BookSources/1234567890|ISBN 1234567895]]
26104 !! end
26105
26106 !! test
26107 Edited RFC links not serializable as RFC links should serialize as extlinks
26108 !! options
26109 parsoid=html2wt
26110 !! html/parsoid
26111 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
26112 !! wikitext
26113 [//tools.ietf.org/html/rfc123 New RFC]
26114 !! end
26115
26116 !! test
26117 Edited PMID links not serializable as PMID links should serialize as extlinks
26118 !! options
26119 parsoid=html2wt
26120 !! html/parsoid
26121 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
26122 !! wikitext
26123 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
26124 !! end
26125
26126 !! test
26127 WTS of autolinks with trailing/surrounding context
26128 !! options
26129 parsoid=html2wt
26130 !! html/parsoid
26131 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
26132 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
26133 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
26134 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
26135 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
26136 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
26137 !! wikitext
26138 http://cscott.net'''foo'''
26139
26140 http://cscott.net<b>foo</b>
26141
26142 '''http://cscott.net'''
26143
26144 '''http://cscott.net '''
26145
26146 '''http://cscott.net<nowiki/>x'''
26147
26148 http://cscott.net<nowiki/>x
26149 !! end
26150
26151 !! test
26152 WTS of autolinks with nowikis (round-trip)
26153 !! wikitext
26154 x<nowiki/>http://cscott.net<nowiki/>x
26155 !! html/parsoid
26156 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
26157 !! end
26158
26159 # this is the "easy" test because it leaves in place all the
26160 # data-parsoid information indicating this is an autolink
26161 !! test
26162 WTS of autolinks with escapes (editing)
26163 !! options
26164 parsoid={
26165 "modes": ["wt2wt"],
26166 "changes": [
26167 [ "meta", "remove" ]
26168 ]
26169 }
26170 !! wikitext
26171 x<nowiki/>http://cscott.net<nowiki/>x
26172 !! wikitext/edited
26173 x<nowiki/>http://cscott.net<nowiki/>x
26174 !! end
26175
26176 !! test
26177 WTS of edited autolink-like text (T103364)
26178 !! options
26179 parsoid={
26180 "modes": ["wt2wt"],
26181 "changes": [
26182 [ "span[typeof]", "removeAttr", "typeof" ]
26183 ]
26184 }
26185 !! wikitext
26186 Not a link: <nowiki>http://example.com</nowiki>.
26187 !! wikitext/edited
26188 Not a link: <span><nowiki>http://example.com</nowiki></span>.
26189 !! end
26190
26191 !! test
26192 WTS of newly-authored autolink-like text (T103364)
26193 !! options
26194 parsoid=html2wt
26195 !! html/parsoid
26196 <p>http://example.com is not a link.</p>
26197 !! wikitext
26198 <nowiki>http://example.com</nowiki> is not a link.
26199 !! end
26200
26201 !! test
26202 WTS of autolink-like text after an autolink (T108563)
26203 !! options
26204 parsoid=html2wt
26205 !! html/parsoid
26206 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
26207 !! wikitext
26208 http://example.com <nowiki>http://example.com</nowiki> is not a link.
26209 !! end
26210
26211 !! test
26212 Magic links inside links (not autolinked)
26213 !! wikitext
26214 [[Foo|http://example.com]]
26215 [[Foo|RFC 1234]]
26216 [[Foo|PMID 1234]]
26217 [[Foo|ISBN 123456789x]]
26218
26219 [http://foo.com http://example.com]
26220 [http://foo.com RFC 1234]
26221 [http://foo.com PMID 1234]
26222 [http://foo.com ISBN 123456789x]
26223 !! html+tidy
26224 <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>
26225 <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>
26226 !! html/parsoid
26227 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
26228 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
26229 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
26230 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
26231
26232 <p><a rel="mw:ExtLink" href="http://foo.com">http://example.com</a>
26233 <a rel="mw:ExtLink" href="http://foo.com">RFC 1234</a>
26234 <a rel="mw:ExtLink" href="http://foo.com">PMID 1234</a>
26235 <a rel="mw:ExtLink" href="http://foo.com">ISBN 123456789x</a></p>
26236 !! end
26237
26238 !! test
26239 Magic links inside image captions (autolinked)
26240 !! wikitext
26241 [[File:Foobar.jpg|thumb|http://example.com]]
26242 [[File:Foobar.jpg|thumb|RFC 1234]]
26243 [[File:Foobar.jpg|thumb|PMID 1234]]
26244 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
26245 !! html+tidy
26246 <div class="thumb tright">
26247 <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>
26248 <div class="thumbcaption">
26249 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26250 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div>
26251 </div>
26252 </div>
26253 <div class="thumb tright">
26254 <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>
26255 <div class="thumbcaption">
26256 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26257 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a></div>
26258 </div>
26259 </div>
26260 <div class="thumb tright">
26261 <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>
26262 <div class="thumbcaption">
26263 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26264 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a></div>
26265 </div>
26266 </div>
26267 <div class="thumb tright">
26268 <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>
26269 <div class="thumbcaption">
26270 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26271 <a href="/wiki/Special:BookSources/123456789X" class="internal mw-magiclink-isbn">ISBN 123456789x</a></div>
26272 </div>
26273 </div>
26274 !! html/parsoid
26275 <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>
26276 <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>
26277 <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>
26278 <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>
26279 !! end
26280
26281 !! test
26282 WTS of magic word text (T109371)
26283 !! options
26284 parsoid=html2wt
26285 !! html/parsoid
26286 <p>RFC 1234</p>
26287 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
26288 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
26289 !! wikitext
26290 <nowiki>RFC 1234</nowiki>
26291
26292 [http://foo.com RFC 1234]
26293
26294 [[Foo|RFC 1234]]
26295 !! end
26296
26297 !! test
26298 Edited Redirect link should emit a non-piped wikitext link
26299 !! options
26300 parsoid=html2wt
26301 !! html/parsoid
26302 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
26303 !! wikitext
26304 #REDIRECT [[Bar]]
26305 !! end
26306
26307 !! test
26308 T75121: Infer extension name from typeOf if data-mw is not present
26309 !! options
26310 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26311 !! html/parsoid
26312 <div typeOf="mw:Extension/foo"></div>
26313 !! wikitext
26314 <foo />
26315 !! end
26316
26317 # Note that the <p> wrapping isn't present in PHP parser output
26318 # The important thing for this test is that P-wrapping doesn't
26319 # interfere with the <nowiki> protection for leading - in <td>
26320 # (which isn't necessary for <th>).
26321 !! test
26322 T88318: p-wrapped dash in table.
26323 !! options
26324 parsoid=html2wt,wt2wt
26325 !! html/parsoid
26326 <table><tbody>
26327 <tr><th><p>-</p></th><th><p>- </p></th></tr>
26328 <tr><td><p>-</p></td><td><p>- </p></td></tr>
26329 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
26330 </tbody></table>
26331 !! wikitext
26332 {|
26333 !-
26334 !-
26335 |-
26336 |<nowiki>-</nowiki>
26337 |<nowiki>- </nowiki>
26338 |-
26339 |<small>-</small>
26340 |<br>
26341 -
26342 |<br>
26343 -
26344 |}
26345 !! html/php+tidy
26346 <table>
26347 <tr>
26348 <th>-</th>
26349 <th>-</th>
26350 </tr>
26351 <tr>
26352 <td>-</td>
26353 <td>-</td>
26354 </tr>
26355 <tr>
26356 <td><small>-</small></td>
26357 <td><br />
26358 <p>-</p>
26359 </td>
26360 <td><br />
26361 <p>-</p>
26362 </td>
26363 </tr>
26364 </table>
26365 !! end
26366
26367 !! test
26368 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
26369 !! options
26370 parsoid=html2wt
26371 !! html/parsoid
26372 <table id='mwAb'>
26373 <td id='mwAc'>foo</td>
26374 <td id='serialize-this'>bar</td>
26375 </table>
26376 !! wikitext
26377 {|
26378 |foo
26379 | id="serialize-this" |bar
26380 |}
26381 !! end
26382
26383 !! test
26384 Parsoid-like element ids should not be serialized to wikitext unless shadowed
26385 !! options
26386 parsoid=html2wt
26387 !! html/parsoid
26388 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
26389 !! wikitext
26390 <div id="hello">ok</div>
26391 !! end
26392
26393 !! test
26394 WTS change modes
26395 !! options
26396 parsoid={
26397 "modes": ["wt2wt"],
26398 "changes": [
26399 [ "#xyz", "before", "<b>before</b> stuff " ],
26400 [ "#xyz", "after", " stuff <i>after</i>" ],
26401 [ "#xyz", "html", "x <b>y</b> z" ]
26402 ]
26403 }
26404 !! wikitext
26405 <span id="xyz">hello</span>
26406 !! wikitext/edited
26407 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
26408 !! end
26409
26410 !! test
26411 Never serialize a-tag as html, regardless of what data-parsoid has to say
26412 !! options
26413 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26414 !! html/parsoid
26415 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
26416 !! wikitext
26417 [[Foo]]
26418 !! end
26419
26420 ## SSS FIXME: This is broken output nevertheless.
26421 ## What might be a reasonable non-broken output for this?
26422 ## This is an edge case unlikely to be seen in production
26423 ## that I am not wasting more time on this right now.
26424 !! test
26425 Never serialize a-tag as html, no matter what attributes it has
26426 !! options
26427 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26428 !! html/parsoid
26429 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
26430 !! wikitext
26431 [http://boo.org http://boohoo.org]
26432 !! end
26433
26434 # Misnested is an indication that selser can reuse the source but these have
26435 # shown to sneak through on occasion. See T101768.
26436 # The original wikitext here is: [http://test.com [[one]] two three]
26437 !! test
26438 Strip span tags added to mark misnested links
26439 !! options
26440 parsoid=html2wt
26441 !! html/parsoid
26442 <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>
26443 !! wikitext
26444 [http://test.com][[one]] two three
26445 !! end
26446
26447 !! test
26448 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
26449 !! options
26450 parsoid=html2wt
26451 !! html/parsoid
26452 <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|}"]}'>
26453 <tbody><tr><td>d
26454 </td></tr>
26455 </tbody></table>
26456 !! wikitext
26457 {{echo|a}}
26458 {|{{echo|c
26459 {{!}}d
26460 }}
26461 |}
26462 !! end
26463
26464 ## This test verifies the presence and computation of this attribute indirectly
26465 ## by making an edit and ensuring that the serialization is correct (which it would be
26466 ## only if firstWikitextNode is properly set).
26467 !! test
26468 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
26469 !! options
26470 parsoid= {
26471 "modes": ["wt2wt"],
26472 "changes": [
26473 [ "div#x", "remove" ],
26474 [ "div", "before", "<div>new</div>" ]
26475 ]
26476 }
26477 !! wikitext
26478 <div id="x">foo</div>
26479 {|
26480 {{echo|<div>boo</div>
26481 {{!}}b}}
26482 |c
26483 |}
26484 !! wikitext/edited
26485
26486 <div>new</div>
26487 {|
26488 {{echo|<div>boo</div>
26489 {{!}}b}}
26490 |c
26491 |}
26492 !! end
26493
26494 # --------------------------------------------
26495 # Tests spec'ing wikitext serialization norms |
26496 # --------------------------------------------
26497
26498 !! test
26499 1. Categories should always be serialized on their own line
26500 !! options
26501 parsoid=html2wt
26502 !! html/parsoid
26503 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
26504 !! wikitext
26505 foo
26506 [[Category:Foo]]
26507 bar
26508 !! end
26509
26510 !! test
26511 2. Categories that are part of templates should not introduce a line break
26512 !! wikitext
26513 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
26514 !! html/parsoid
26515 <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>
26516 !! end
26517
26518 # Careful while editing these next 2 tests. There are \u200f characters
26519 # before and after the <link> tags in the HTML and following some
26520 # of the categories in wikitext
26521 # Do not remove these characters in edits.
26522 #
26523 # As part of the serialization, these bidi characters will get stripped.
26524 !! test
26525 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
26526 !! options
26527 parsoid={
26528 "modes": ["html2wt"],
26529 "scrubWikitext": true
26530 }
26531 !! html/parsoid
26532 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
26533 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
26534 !! wikitext
26535 [[קטגוריה:טקסים]]
26536 [[קטגוריה: שיטות משפט]]
26537 !! end
26538
26539 !! test
26540 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
26541 !! options
26542 parsoid={
26543 "modes": ["html2wt"],
26544 "scrubWikitext": true
26545 }
26546 !! html/parsoid
26547 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
26548 !! wikitext
26549 [[קטגוריה:טקסים]]
26550 ‏y
26551 !! end
26552
26553 !! test
26554 Lists: Add space after bullets
26555 !! options
26556 parsoid=html2wt
26557 !! html/parsoid
26558 <ul>
26559 <li>foo</li>
26560 <li> bar</li>
26561 <li><span> baz</span></li>
26562 </ul>
26563 !! wikitext
26564 * foo
26565 * bar
26566 * <span> baz</span>
26567 !! end
26568
26569 !! test
26570 1. Headings: Add space before/after == (T53744)
26571 !! options
26572 parsoid=html2wt
26573 !! html/parsoid
26574 <h2>foo</h2>
26575 <h2> bar</h2>
26576 <h2>baz </h2>
26577 <h2><span> baz</span></h2>
26578 !! wikitext
26579 == foo ==
26580
26581 == bar ==
26582
26583 == baz ==
26584
26585 == <span> baz</span> ==
26586 !! end
26587
26588 !! test
26589 2. Headings: Add space before/after == even after hoisted content
26590 !! options
26591 parsoid={
26592 "modes": ["html2wt"],
26593 "scrubWikitext": true
26594 }
26595 !! html/parsoid
26596 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
26597 !! wikitext
26598 [[Category:A2]]
26599
26600 == ok ==
26601 !! end
26602
26603 !! test
26604 1. Headings: suppress newly created empty headings
26605 !! options
26606 parsoid={
26607 "modes": ["html2wt"],
26608 "scrubWikitext": true
26609 }
26610 !! html/parsoid
26611 <h2></h2>
26612 !! wikitext
26613 !! end
26614
26615 !! test
26616 2. Headings: don't suppress empty headings if scrubWikitext is false
26617 !! options
26618 parsoid=html2wt
26619 !! html/parsoid
26620 <h2></h2>
26621 !! wikitext
26622 ==<nowiki/>==
26623 !! end
26624
26625 !! test
26626 3. Headings: suppress empty headings on edits
26627 !! options
26628 parsoid={
26629 "modes": ["selser"],
26630 "scrubWikitext": true,
26631 "changes": [
26632 [ "#x", "remove"]
26633 ]
26634 }
26635 !! wikitext
26636 ==<span id="x">foo</span>==
26637 !! wikitext/edited
26638 !! end
26639
26640 !! test
26641 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
26642 !! options
26643 parsoid={
26644 "modes": ["html2wt"],
26645 "scrubWikitext": true
26646 }
26647 !! html/parsoid
26648 <h2>foo<br/>bar</h2>
26649 <h2>foo <span><br/>bar</span> baz</h2>
26650 !! wikitext
26651 == foo bar ==
26652
26653 == foo <span> bar</span> baz ==
26654 !! end
26655
26656 !! test
26657 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
26658 !! options
26659 parsoid={
26660 "modes": ["html2wt"],
26661 "scrubWikitext": false
26662 }
26663 !! html/parsoid
26664 <h2>foo<br/>bar</h2>
26665 !! wikitext
26666 == foo<br> bar ==
26667 !! end
26668
26669 !! test
26670 1. WT Quote Tags: suppress newly created empty style tags
26671 !! options
26672 parsoid={
26673 "modes": ["html2wt"],
26674 "scrubWikitext": true
26675 }
26676 !! html/parsoid
26677 <i></i><b></b>
26678 !! wikitext
26679 !! end
26680
26681 !! test
26682 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
26683 !! options
26684 parsoid=html2wt
26685 !! html/parsoid
26686 <i></i><b></b>
26687 !! wikitext
26688 ''<nowiki/>'''''<nowiki/>'''
26689 !! end
26690
26691 !! test
26692 3. WT Quote Tags: suppress empty style tags on edits
26693 !! options
26694 parsoid={
26695 "modes": ["selser"],
26696 "scrubWikitext": true,
26697 "changes": [
26698 [ "#x", "remove"]
26699 ]
26700 }
26701 !! wikitext
26702 '''<span id="x">foo</span>'''
26703 !! wikitext/edited
26704 !! end
26705
26706 !! test
26707 1. Anchors: suppress newly created empty anchors
26708 !! options
26709 parsoid={
26710 "modes": ["html2wt"],
26711 "scrubWikitext": true
26712 }
26713 !! html/parsoid
26714 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
26715 !! wikitext
26716 !! end
26717
26718 !! test
26719 2. Anchors: don't suppress empty anchors if scrubWikitext is false
26720 !! options
26721 parsoid={
26722 "modes": ["html2wt"],
26723 "scrubWikitext": false
26724 }
26725 !! html/parsoid
26726 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
26727 !! wikitext
26728 [[Test|<nowiki/>]]
26729 !! end
26730
26731 !! test
26732 3. Anchors: suppress empty anchors on edits
26733 !! options
26734 parsoid={
26735 "modes": ["selser"],
26736 "scrubWikitext": true,
26737 "changes": [
26738 [ "#x", "remove"]
26739 ]
26740 }
26741 !! wikitext
26742 [[Test|<span id="x">foo</span>]]
26743 !! wikitext/edited
26744 !! end
26745
26746 !! test
26747 3a. Anchors: do not suppress numbered extlinks
26748 !! options
26749 parsoid={
26750 "modes": ["wt2wt"],
26751 "scrubWikitext": true
26752 }
26753 !! wikitext
26754 [http://foo.com]
26755 !! html/parsoid
26756 <a rel="mw:ExtLink" href="http://foo.com"></a>
26757 !! end
26758
26759 !! test
26760 3b. Anchors: do not suppress numbered extlinks
26761 !! options
26762 parsoid={
26763 "modes": ["wt2wt"],
26764 "scrubWikitext": true,
26765 "changes": [
26766 [ "#x", "remove"]
26767 ]
26768 }
26769 !! wikitext
26770 [http://foo.com <span id="x">foo</span>]
26771 !! wikitext/edited
26772 [http://foo.com]
26773 !! end
26774
26775 !!test
26776 Normalizations should be restricted to edited content
26777 !!options
26778 parsoid={
26779 "modes": ["selser"],
26780 "scrubWikitext": true,
26781 "changes": [
26782 [ "h1", "before", "<i></i>"]
26783 ]
26784 }
26785 !!wikitext
26786 a
26787 = =
26788 b
26789 !!wikitext/edited
26790 a
26791 = =
26792 b
26793 !!end
26794
26795 !! test
26796 1. Multiple normalizations (html2wt)
26797 !! options
26798 parsoid={
26799 "modes": ["html2wt"],
26800 "scrubWikitext": true
26801 }
26802 !! html
26803 <h2><i></i></h2>
26804 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
26805 </a><b><i></i></b>x</p>
26806 !! wikitext
26807
26808 [[foo]]
26809 x
26810
26811 !! end
26812
26813 !! test
26814 2. Multiple normalizations (selser)
26815 !! options
26816 parsoid={
26817 "modes": ["selser"],
26818 "scrubWikitext": true,
26819 "changes": [
26820 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
26821 ]
26822 }
26823 !! wikitext
26824 <span id="x">foo</span>
26825 !! wikitext/edited
26826 <span id="x">foo</span>
26827
26828 x
26829 !! end
26830
26831 !! test
26832 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
26833 !! options
26834 parsoid={
26835 "modes": ["html2wt"],
26836 "scrubWikitext": true
26837 }
26838 !! html/parsoid
26839 <p> hi</p>
26840 <p> hello</p>
26841 !! wikitext
26842 hi
26843
26844 hello
26845 !! end
26846
26847 !! test
26848 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
26849 !! options
26850 parsoid=html2wt
26851 !! html/parsoid
26852 <p> hi</p>
26853 <p> hello</p>
26854 !! wikitext
26855 <nowiki> </nowiki>hi
26856
26857 <nowiki> </nowiki> hello
26858 !! end
26859
26860 !! test
26861 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
26862 !! options
26863 parsoid={
26864 "modes": ["html2wt"],
26865 "scrubWikitext": true
26866 }
26867 !! html/parsoid
26868 <p>Foo
26869 bar
26870 baz</p>
26871
26872 <table><tr><td>Foo
26873 bar
26874 baz bang</td></tr></table>
26875
26876 <p><!--boo--> foo
26877 bar</p>
26878
26879 <p> foo
26880 bar<span>boo</span></p>
26881 !! wikitext
26882 Foo
26883 bar
26884 baz
26885
26886 {|
26887 |Foo
26888 bar
26889 baz bang
26890 |}
26891
26892 <!--boo-->foo
26893 bar
26894
26895 foo
26896 bar<span>boo</span>
26897 !! end
26898
26899 !! test
26900 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
26901 !! options
26902 parsoid={
26903 "modes": ["selser"],
26904 "scrubWikitext": true,
26905 "changes": [
26906 [ "p", "html", " a\n b" ]
26907 ]
26908 }
26909 !! wikitext
26910 xyz
26911 !! wikitext/edited
26912 a
26913 b
26914 !! end
26915
26916 !! test
26917 1. New links that end in spaces
26918 !! options
26919 parsoid={
26920 "modes": ["html2wt"],
26921 "scrubWikitext": false
26922 }
26923 !! html/parsoid
26924 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
26925 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
26926 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
26927 !! wikitext
26928 [[Berlin ]]<nowiki/>is the capital of Germany.
26929
26930 [[Foo ]]'''bar'''
26931
26932 [[Boston ]] is a city.
26933 !! end
26934
26935 !! test
26936 2. New links that end in spaces
26937 !! options
26938 parsoid={
26939 "modes": ["html2wt"],
26940 "scrubWikitext": true
26941 }
26942 !! html/parsoid
26943 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
26944 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
26945 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
26946 !! wikitext
26947 [[Berlin]] is the capital of Germany.
26948
26949 [[Foo]] '''bar'''
26950
26951 [[Boston]] is a city.
26952 !! end
26953
26954 !! test
26955 1. Table cells with escapable prefixes
26956 !! options
26957 parsoid={
26958 "modes": ["html2wt"],
26959 "scrubWikitext": false
26960 }
26961 !! html
26962 <table>
26963 <tr><td>a</td></tr>
26964 <tr><td>-</td></tr>
26965 <tr><td>+</td></tr>
26966 </table>
26967 !! wikitext
26968 {|
26969 |a
26970 |-
26971 |<nowiki>-</nowiki>
26972 |-
26973 |<nowiki>+</nowiki>
26974 |}
26975 !! end
26976
26977 !! test
26978 2. Table cells with escapable prefixes
26979 !! options
26980 parsoid={
26981 "modes": ["html2wt"],
26982 "scrubWikitext": true
26983 }
26984 !! html
26985 <table>
26986 <tr><td>a</td></tr>
26987 <tr><td>-</td></tr>
26988 <tr><td>+</td></tr>
26989 </table>
26990 !! wikitext
26991 {|
26992 |a
26993 |-
26994 | -
26995 |-
26996 | +
26997 |}
26998 !! end
26999
27000 !! test
27001 3a. Table cells with escapable prefixes after edits
27002 !! options
27003 parsoid={
27004 "modes": ["selser"],
27005 "scrubWikitext": true,
27006 "changes": [
27007 [ "table tbody tr:first-child td:first-child", "remove"]
27008 ]
27009 }
27010 !! wikitext
27011 {|
27012 |a||-
27013 |}
27014 !! wikitext/edited
27015 {|
27016 | -
27017 |}
27018 !! end
27019
27020 !! test
27021 3b. Table cells with escapable prefixes after edits
27022 !! options
27023 parsoid={
27024 "modes": ["selser"],
27025 "scrubWikitext": true,
27026 "changes": [
27027 [ "table tbody tr:first-child td:first-child", "html", "-" ],
27028 [ "#x", "remove" ]
27029 ]
27030 }
27031 !! wikitext
27032 {|
27033 |pqr
27034 |<span id="x">foo</span>+
27035 |}
27036 !! wikitext/edited
27037 {|
27038 | -
27039 | +
27040 |}
27041 !! end
27042
27043 # FIXME: This test will fail because
27044 # normalization doesn't realize that the id attribute
27045 # will eliminate the escapable scenario
27046 !! test
27047 4a. Table cells without escapable prefixes after edits
27048 !! options
27049 parsoid={
27050 "modes": ["selser"],
27051 "scrubWikitext": true,
27052 "changes": [
27053 [ "#x", "html", "-" ]
27054 ]
27055 }
27056 !! wikitext
27057 {|
27058 | id="x" |abcd
27059 |}
27060 !! wikitext/edited
27061 {|
27062 | id="x" |-
27063 |}
27064 !! end
27065
27066 ## This tests normalizer's ability to discriminate between
27067 ## cells having identical content.
27068 !! test
27069 4b. Table cells without escapable prefixes after edits
27070 !! options
27071 parsoid={
27072 "modes": ["selser"],
27073 "scrubWikitext": true,
27074 "changes": [
27075 [ "td", "html", "-" ]
27076 ]
27077 }
27078 !! wikitext
27079 {|
27080 |a||b
27081 |}
27082 !! wikitext/edited
27083 {|
27084 | -||-
27085 |}
27086 !! end
27087
27088 ## This tests normalizer's ability to not be tripped by
27089 ## comments (and whitespace)
27090 !! test
27091 4c. Table cells without escapable prefixes after edits
27092 !! options
27093 parsoid={
27094 "modes": ["selser"],
27095 "scrubWikitext": true,
27096 "changes": [
27097 [ "table tbody tr td:first-child", "remove" ]
27098 ]
27099 }
27100 !! wikitext
27101 {|
27102 |-
27103 <!--foo--> |a||-
27104 |}
27105 !! wikitext/edited
27106 {|
27107 |-
27108 <!--foo--> | -
27109 |}
27110 !! end
27111
27112 ## This tests normalizer's ability to handle HTML cells
27113 !! test
27114 4d. Table cells without escapable prefixes after edits
27115 !! options
27116 parsoid={
27117 "modes": ["selser"],
27118 "scrubWikitext": true,
27119 "changes": [
27120 [ "td", "html", "-" ]
27121 ]
27122 }
27123 !! wikitext
27124 <table>
27125 <tr><td>a</td></tr>
27126 </table>
27127 !! wikitext/edited
27128 <table>
27129 <tr><td>-</td></tr>
27130 </table>
27131 !! end
27132
27133 ## T111151 Remove font elements without attributes
27134 !! test
27135 5a. font tags without attributes should be dropped in scrubWikitext mode
27136 !! options
27137 parsoid={
27138 "modes": ["html2wt"],
27139 "scrubWikitext": true
27140 }
27141 !! html
27142 <font>foo</font>
27143 <font><font>bar</font></font>
27144 <font class="x">boo</font>
27145 !! wikitext
27146 foo
27147 bar
27148 <font class="x">boo</font>
27149 !! end
27150
27151 !! test
27152 5b. font tags should not be dropped without scrubWikitext being enabled
27153 !! options
27154 parsoid={
27155 "modes": ["html2wt"],
27156 "scrubWikitext": false
27157 }
27158 !! html
27159 <font>foo</font>
27160 !! wikitext
27161 <font>foo</font>
27162 !! end
27163
27164 !! test
27165 Escape nowiki DOM elements
27166 !! options
27167 parsoid=html2wt
27168 !! html/parsoid
27169 <nowiki><i>foo</i></nowiki>
27170 !! wikitext
27171 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
27172 !! end
27173
27174 # This is meant to be an interim fix while we go about figuring out
27175 # how to not introduce these trailing <nowiki/>s in the first place.
27176 !! test
27177 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
27178 !! options
27179 parsoid=html2wt
27180 !! html/parsoid
27181 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
27182 y</p>
27183 <p><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"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>
27184 <p><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"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>
27185 !! wikitext
27186 x
27187 y
27188
27189 {{echo|
27190 1 = <nowiki/>}}
27191
27192 {{echo|
27193 1 = <nowiki/>
27194 }}
27195 !! end
27196
27197 # ---------------------------------------------------
27198 # End of tests spec'ing wikitext serialization norms |
27199 # ---------------------------------------------------
27200
27201 # T104032
27202 !! test
27203 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
27204 !! options
27205 parsoid=html2wt
27206 !! html/parsoid
27207 a<p>b</p>
27208 <b>c</b><p>d</p>
27209 <table><tr>
27210 <td>a<p>b</p></td>
27211 <td><b>c</b><p>d</p></td>
27212 </tr></table>
27213 !! wikitext
27214 a
27215
27216 b
27217
27218 '''c'''
27219
27220 d
27221 {|
27222 |a
27223 b
27224 |'''c'''
27225 d
27226 |}
27227 !! end
27228
27229 # -----------------------------------------------------------------
27230 # End of section for Parsoid-only html2wt tests for serialization
27231 # of new content
27232 # -----------------------------------------------------------------
27233
27234 # -----------------------------------------------------------------
27235 # The following section of tests are primarily to spec behavior of
27236 # the selective serializer. All these tests have manual selser
27237 # changes. The automated selser changes for all tests handle the
27238 # wide variation of changes, but these tests here capture specs
27239 # deterministically.
27240 # ----------------------------------------------------------------
27241
27242 ## T90517
27243 !! test
27244 Selser: New comments should not be lost
27245 !! options
27246 parsoid={
27247 "modes": ["selser"],
27248 "changes": [
27249 [ "#a", "after", "<!--c1-->" ],
27250 [ "#b", "before", "<!--c2-->" ]
27251 ]
27252 }
27253 !! wikitext
27254 <span id="a">a</span>
27255
27256 <span id="b">b</span>
27257 !! wikitext/edited
27258 <span id="a">a</span><!--c1-->
27259
27260 <!--c2--><span id="b">b</span>
27261 !! end
27262
27263 ## T89383
27264 !! test
27265 Selser: Check for validity of DSR before using it
27266 !! options
27267 parsoid={
27268 "modes": ["selser"],
27269 "changes": [
27270 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
27271 ]
27272 }
27273 !! wikitext
27274 <span id="a">a</span>
27275 !! wikitext/edited
27276 {{DISPLAYTITLE:foo}}
27277 <span id="a">a</span>
27278 !! end
27279
27280 !! test
27281 1. DOMDiff: Changes to <ref> content should be looked up using id
27282 !! options
27283 parsoid={
27284 "modes": ["selser"],
27285 "changes": [
27286 ["#X", "after", "bar"],
27287 ["#Y", "after", "baz"]
27288 ]
27289 }
27290 !! wikitext
27291 X <ref><span id="X">foo</span></ref>
27292 Y <ref name="a" />
27293 <references>
27294 <ref name="a"><span id="Y">foo</span></ref>
27295 </references>
27296 !! wikitext/edited
27297 X <ref><span id="X">foo</span>bar</ref>
27298 Y <ref name="a" />
27299 <references>
27300 <ref name="a"><span id="Y">foo</span>baz</ref>
27301 </references>
27302 !! end
27303
27304 !! test
27305 2. DOMDiff: Changes to <ref> content should be looked up using id
27306 !! options
27307 parsoid={
27308 "modes": ["selser"],
27309 "changes": [
27310 ["#Z", "after", "bar"]
27311 ]
27312 }
27313 !! wikitext
27314 A <ref>foo bar for a</ref>
27315 B <ref group="X" name="b" />
27316
27317 <references />
27318
27319 <references group="X">
27320 <ref name="b"><span id="Z">foo</span></ref>
27321 </references>
27322 !! wikitext/edited
27323 A <ref>foo bar for a</ref>
27324 B <ref group="X" name="b" />
27325
27326 <references />
27327
27328 <references group="X">
27329 <ref name="b"><span id="Z">foo</span>bar</ref>
27330 </references>
27331 !! end
27332
27333 !! test
27334 DOMDiff: Edits to content nested in elements with templated attributes should not be lost (T139388)
27335 !! options
27336 parsoid={
27337 "modes": ["selser"],
27338 "changes": [
27339 [ "div:first-child", "text", "bar" ]
27340 ]
27341 }
27342 !! wikitext
27343 <div style="{{1x|color:red;}}%">foo</div>
27344 !! wikitext/edited
27345 <div style="{{1x|color:red;}}%">bar</div>
27346 !! end
27347
27348 !! test
27349 Empty LI (T49673)
27350 !! wikitext
27351 * a
27352 *
27353 *
27354 * b
27355 !! html/php+tidy
27356 <ul>
27357 <li>a</li>
27358 <li class="mw-empty-elt"></li>
27359 <li class="mw-empty-elt"></li>
27360 <li>b</li>
27361 </ul>
27362 !! end
27363
27364 !! test
27365 Thumbnail output
27366 !! wikitext
27367 [[File:Thumb.png|thumb]]
27368 !! html/php+tidy
27369 <div class="thumb tright">
27370 <div class="thumbinner" style="width:137px;"><a href="/wiki/File:Thumb.png" class="image"><img alt="Thumb.png" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a>
27371 <div class="thumbcaption">
27372 <div class="magnify"><a href="/wiki/File:Thumb.png" class="internal" title="Enlarge"></a></div>
27373 </div>
27374 </div>
27375 </div>
27376 !! end
27377
27378 !! test
27379 unclosed internal link XSS (T137264)
27380 !! wikitext
27381 [[#%3Cscript%3Ealert(1)%3C/script%3E|
27382 !! html/php
27383 <p>[[#&lt;script&gt;alert(1)&lt;/script&gt;|
27384 </p>
27385 !! html/parsoid
27386 <p>[[#%3Cscript%3Ealert(1)%3C/script%3E|</p>
27387 !! end