9fe30291c9b7ed00eb045c079adc7e4a6101f8e0
[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/php
2716 <p>foo
2717 bar
2718 </p>
2719 !! html/parsoid
2720 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo\n&lt;!--should be ignored-->\n &lt;!--should be ignored as well-->\nbar"}},"i":0}}]}'>foo <!--should be ignored--> <!--should be ignored as well--> bar</p>
2721 !! end
2722
2723 !! test
2724 Templates: Handle comments in the target
2725 !! wikitext
2726 {{echo
2727 <!-- should be ignored -->
2728 |foo}}
2729
2730 {{echo<!-- should be ignored -->
2731 |foo}}
2732
2733 {{echo<!-- should be ignored -->|foo}}
2734
2735 {{<!-- should be ignored -->echo|foo}}
2736 !! html/php
2737 <p>foo
2738 </p><p>foo
2739 </p><p>foo
2740 </p><p>foo
2741 </p>
2742 !! html/parsoid
2743 <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>
2744
2745 <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>
2746
2747 <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>
2748
2749 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2750 !!end
2751
2752 !! test
2753 Templates: Handle comments in parameter names (bug 67657)
2754 !! wikitext
2755 {{echo|1
2756 <!-- should be ignored -->
2757 =foo}}
2758
2759 {{echo|
2760 <!-- should be ignored -->
2761 1 = foo}}
2762
2763 {{echo|1<!-- should be ignored -->=foo}}
2764
2765 {{echo|<!-- should be ignored -->1=foo}}
2766 !! html/php
2767 <p>foo
2768 </p><p>foo
2769 </p><p>foo
2770 </p><p>foo
2771 </p>
2772 !! html/parsoid
2773 <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>
2774
2775 <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>
2776
2777 <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>
2778
2779 <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>
2780 !!end
2781
2782 !! test
2783 Templates: Other wikitext in parameter names (bug 67657)
2784 !! wikitext
2785 {{echo|''1''=foo}}
2786 !! html/php
2787 <p>{{{1}}}
2788 </p>
2789 !! html/parsoid
2790 <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>
2791 !!end
2792
2793 #--------------------------------------------------------------------
2794 # Transclusion parameter escaping tests
2795 #--------------------------------------------------------------------
2796 !! test
2797 Templates: Parsoid parameter escaping test 1
2798 !! wikitext
2799 {{echo|[foo]|{{echo|[bar]}}}}
2800 !! html/php+tidy
2801 <p>[foo]</p>
2802 !! html/parsoid
2803 <p about="#mwt1" typeof="mw:Transclusion"
2804 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2805 !! end
2806
2807 !! test
2808 Parsoid: Pipes in external links in template parameter
2809 !! wikitext
2810 {{echo|[{{echo|http://example.com}} link]}}
2811 !! html/php+tidy
2812 <p><a rel="nofollow" class="external text" href="http://example.com">link</a></p>
2813 !! html/parsoid
2814 <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>
2815 !! end
2816
2817 !! test
2818 Parsoid: pipe in transclusion parameter
2819 !! wikitext
2820 {{echo|http://foo.com/a&#124;b}}
2821 !! html/php+tidy
2822 <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</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"},"params":{"1":{"wt":"http://foo.com/a&amp;#124;b"}},"i":0}}]}'>http://foo.com/a|b</a></p>
2827 !! end
2828
2829 !! test
2830 Parsoid: Pipe in external link target and content in template parameter
2831 !! options
2832 parsoid=html2wt,wt2wt
2833 !! wikitext
2834 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2835 !! html/php+tidy
2836 <p><a rel="nofollow" class="external text" href="http://foo.com/a%7Cb">a|b</a></p>
2837 !! html/parsoid
2838 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2839 typeof="mw:Transclusion"
2840 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2841 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2842 !! end
2843
2844 !! test
2845 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2846 !! options
2847 parsoid
2848 !! wikitext
2849 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2850 !! html
2851 <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>
2852 !! end
2853
2854 !! test
2855 Templates: Don't escape already nowiki-escaped text in template parameters
2856 !! options
2857 parsoid=html2wt,wt2wt
2858 !! wikitext
2859 {{echo|foo<nowiki>|</nowiki>bar}}
2860 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2861 {{echo|<nowiki></nowiki>}}
2862 !! html/php+tidy
2863 <p>foo|bar &lt;div&gt;</p>
2864 !! html/parsoid
2865 <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>
2866 <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>
2867 <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>
2868 </p>
2869 !! end
2870
2871 ## Bug 52824
2872 !! test
2873 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2874 !! options
2875 parsoid=html2wt,wt2wt
2876 !! wikitext
2877 {{echo|{{echo|1=bar}}}}
2878 !! html/php+tidy
2879 <p>bar</p>
2880 !! html/parsoid
2881 <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>
2882 !! end
2883
2884 ## Bug 56733
2885 !! test
2886 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2887 !! wikitext
2888 {{echo|a : b}}
2889 !! html/php+tidy
2890 <p>a&#160;: b</p>
2891 !! html/parsoid
2892 <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>
2893 !! end
2894
2895 ## Bug T73412
2896 !! test
2897 Templates: Preserve blank parameter names
2898 !! wikitext
2899 {{echo|=foo}}
2900 !! html/php+tidy
2901 <p>{{{1}}}</p>
2902 !! html/parsoid
2903 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2904 !! end
2905
2906 !! test
2907 Templates: Preserve blank parameter names in other positions
2908 !! wikitext
2909 {{blank_param|bar|=foo}}
2910 !! html/php+tidy
2911 <p>bar foo</p>
2912 !! html/parsoid
2913 <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
2914 foo</p>
2915 !! end
2916
2917 ###
2918 ### Parsoid-centric tests for testing RT edge cases for pre
2919 ###
2920
2921 !!test
2922 1a. Indent-Pre and Comments
2923 !! wikitext
2924 a
2925 <!--a-->
2926 c
2927 !! html
2928 <pre>a
2929 </pre>
2930 <p>c
2931 </p>
2932 !!end
2933
2934 !!test
2935 1b. Indent-Pre and Comments
2936 !! wikitext
2937 a
2938 <!--a-->
2939 c
2940 !! html
2941 <pre>a
2942 </pre>
2943 <p>c
2944 </p>
2945 !!end
2946
2947 !!test
2948 1c. Indent-Pre and Comments
2949 !! wikitext
2950 <!--a--> a
2951
2952 <!--a--> a
2953 !! html
2954 <pre> a
2955 </pre>
2956 <pre> a
2957 </pre>
2958 !!end
2959
2960 !!test
2961 1d. Indent-Pre and Comments
2962 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2963 !! wikitext
2964 <!--a--> a
2965
2966 <!--b-->b
2967 !! html
2968 <pre>a
2969 </pre>
2970 <pre>b
2971 </pre>
2972 !!end
2973
2974 !!test
2975 2a. Indent-Pre and tables
2976 !! wikitext
2977 {|
2978 |-
2979 !h1!!h2
2980 |foo||bar
2981 |}
2982 !! html
2983 <table>
2984
2985 <tr>
2986 <th>h1</th>
2987 <th>h2
2988 </th>
2989 <td>foo</td>
2990 <td>bar
2991 </td></tr></table>
2992
2993 !!end
2994
2995 !!test
2996 2b. Indent-Pre and tables
2997 !! wikitext
2998 {|
2999 |-
3000 |foo
3001 |}
3002 !! html
3003 <table>
3004
3005 <tr>
3006 <td>foo
3007 </td></tr></table>
3008
3009 !!end
3010
3011 !!test
3012 2c. Indent-Pre and tables (bug 42252)
3013 !! wikitext
3014 {|
3015 |+ foo
3016 ! | bar
3017 |}
3018 !! html
3019 <table>
3020 <caption> foo
3021 </caption>
3022 <tr>
3023 <th> bar
3024 </th></tr></table>
3025
3026 !!end
3027
3028 !!test
3029 2d. Indent-Pre and tables
3030 !! wikitext
3031 a
3032 {|
3033 | b
3034 |}
3035 !! html/php
3036 <pre>a
3037 </pre>
3038 <table>
3039 <tr>
3040 <td> b
3041 </td></tr></table>
3042
3043 !! html/parsoid
3044 <pre>a</pre>
3045 <table>
3046 <tbody><tr><td> b</td></tr>
3047 </tbody></table>
3048 !!end
3049
3050 !!test
3051 2e. Indent-Pre and table-line syntax
3052 !! wikitext
3053 a
3054 | b
3055 | c
3056 !! html/php
3057 <pre>a
3058 | b
3059 | c
3060 </pre>
3061 !!end
3062
3063 !!test
3064 2f. Indent-pre started by table-line syntax
3065 !! wikitext
3066 a
3067 | b
3068 | c
3069 !! html/php
3070 <p>a
3071 </p>
3072 <pre>| b
3073 | c
3074 </pre>
3075 !! html/parsoid
3076 <p>a</p>
3077 <pre>
3078 | b
3079 | c</pre>
3080 !!end
3081
3082 !! test
3083 2g. Indented table markup mixed with indented pre content (proposed in bug 6200)
3084 !! wikitext
3085 <table>
3086 <tr>
3087 <td>
3088 Text that should be rendered preformatted
3089 </td>
3090 </tr>
3091 </table>
3092 !! html
3093 <table>
3094 <tr>
3095 <td>
3096 <pre>Text that should be rendered preformatted
3097 </pre>
3098 </td>
3099 </tr>
3100 </table>
3101
3102 !! end
3103
3104 !!test
3105 3a. Indent-Pre and block tags (single-line html)
3106 !! wikitext
3107 a <p> foo </p>
3108 b <div> foo </div>
3109 c <blockquote> foo </blockquote>
3110 <span> foo </span>
3111 !! html
3112 a <p> foo </p>
3113 b <div> foo </div>
3114 c <blockquote> foo </blockquote>
3115 <pre><span> foo </span>
3116 </pre>
3117 !! html/parsoid
3118 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
3119 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3120 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
3121 <pre><span> foo </span>
3122 </pre>
3123 !! html+tidy
3124 <p>a</p>
3125 <p>foo</p>
3126 <p>b</p>
3127 <div>foo</div>
3128 <p>c</p>
3129 <blockquote>
3130 <p>foo</p>
3131 </blockquote>
3132 <pre>
3133 <span> foo </span>
3134 </pre>
3135 !! end
3136
3137 !!test
3138 3b. Indent-Pre and block tags (multi-line html)
3139 !! wikitext
3140 a <span>foo</span>
3141 b <div> foo </div>
3142 !! html
3143 <pre>a <span>foo</span>
3144 </pre>
3145 b <div> foo </div>
3146
3147 !! html/parsoid
3148 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3149 b <div data-parsoid='{"stx":"html"}'> foo </div>
3150 !! html+tidy
3151 <pre>
3152 a <span>foo</span>
3153 </pre>
3154 <p>b</p>
3155 <div>foo</div>
3156 !!end
3157
3158 !!test
3159 3c. Indent-Pre and block tags (pre-content on separate line)
3160 !! wikitext
3161 <p>
3162 foo
3163 </p>
3164
3165 <div>
3166 foo
3167 </div>
3168
3169 <center>
3170 foo
3171 </center>
3172
3173 <blockquote>
3174 foo
3175 </blockquote>
3176
3177 <blockquote>
3178 <pre>
3179 foo
3180 </pre>
3181 </blockquote>
3182
3183 <table><tr><td>
3184 foo
3185 </td></tr></table>
3186
3187 <ul><li>
3188 foo
3189 </li></ul>
3190
3191 !! html
3192 <p>
3193 foo
3194 </p>
3195 <div>
3196 <pre>foo
3197 </pre>
3198 </div>
3199 <center>
3200 <pre>foo
3201 </pre>
3202 </center>
3203 <blockquote>
3204 <p> foo
3205 </p>
3206 </blockquote>
3207 <blockquote>
3208 <pre>
3209 foo
3210 </pre>
3211 </blockquote>
3212 <table><tr><td>
3213 <pre>foo
3214 </pre>
3215 </td></tr></table>
3216 <ul><li>
3217 foo
3218 </li></ul>
3219
3220 !!end
3221
3222 !! test
3223 4. Indent-Pre and extension tags
3224 !! wikitext
3225 a <tag />
3226 !! html/php
3227 a <pre>
3228 NULL
3229 array (
3230 )
3231 </pre>
3232
3233 !! html/parsoid
3234 a <pre typeof="mw:Extension/tag" about="#mwt2" data-parsoid='{}' data-mw='{"name":"tag","attrs":{},"body":null}'></pre>
3235 !! end
3236
3237 !!test
3238 Render paragraphs when indent-pre is suppressed in blocklevels
3239 !! wikitext
3240 <blockquote>
3241 foo
3242
3243 bar
3244 </blockquote>
3245 !! html
3246 <blockquote>
3247 <p> foo
3248 </p><p> bar
3249 </p>
3250 </blockquote>
3251
3252 !!end
3253
3254 !!test
3255 4. Multiple spaces at start-of-line
3256 !! wikitext
3257 <p> foo </p>
3258 foo
3259 {|
3260 |foo
3261 |}
3262 !! html
3263 <p> foo </p>
3264 <pre> foo
3265 </pre>
3266 <table>
3267 <tr>
3268 <td>foo
3269 </td></tr></table>
3270
3271 !!end
3272
3273 ## NOTE: the leading white-space chars on empty line are significant
3274 !! test
3275 5a. White-space in indent-pre
3276 !! wikitext
3277 a<br />
3278
3279 b
3280 !! html
3281 <pre>a<br />
3282
3283 b
3284 </pre>
3285 !! end
3286
3287 ## NOTE: the leading white-space chars on empty line are significant
3288 !! test
3289 5b. White-space in indent-pre
3290 !! wikitext
3291 a
3292
3293 b
3294
3295
3296 c
3297 !! html
3298 <pre>a
3299
3300 b
3301
3302
3303 c
3304 </pre>
3305 !! end
3306
3307 !! test
3308 5c. White-space in indent-pre
3309 !! wikitext
3310 ''a''
3311 ''b''
3312 ''c''
3313 !! html
3314 <pre><i>a</i>
3315 <i>b</i>
3316 <i>c</i>
3317 </pre>
3318 !! end
3319
3320 !! test
3321 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3322 !! wikitext
3323 a
3324
3325 <!-- continue -->
3326 b
3327
3328 c
3329
3330 d
3331 !! html
3332 <pre>a
3333
3334 b
3335 </pre>
3336 <pre>c
3337
3338 </pre>
3339 <p>d
3340 </p>
3341 !! end
3342
3343 !! test
3344 7a. Indent-pre and category links
3345 !! options
3346 parsoid=wt2html,wt2wt
3347 !! wikitext
3348 [[Category:foo]] <!-- No pre-wrapping -->
3349 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3350 !! html/php+tidy
3351 !! html/parsoid
3352 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3353 <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 -->
3354 !! end
3355
3356 ## We used to, but no longer wt2wt this test since the default serializer
3357 ## will normalize all categories to serialize on their own line.
3358 ## This wikitext usage is going to be fairly uncommon in production and
3359 ## selser will take care of preserving formatting in those scenarios.
3360 !! test
3361 7b. Indent-pre and category links
3362 !! options
3363 parsoid=wt2html
3364 !! wikitext
3365 [[Category:foo]] a
3366 [[Category:foo]] {{echo|b}}
3367 !! html/parsoid
3368 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3369 <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>
3370 !! end
3371
3372 !! test
3373 Indent-Pre: Newlines in comments shouldn't affect sol state
3374 !! wikitext
3375 a <!--
3376 foo
3377 --> b
3378 !! html/php+tidy
3379 <p>a b</p>
3380 !! html/parsoid
3381 <p>a <!--
3382 foo
3383 --> b</p>
3384 !! end
3385
3386 ###
3387 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3388 ###
3389
3390 !!test
3391 HTML-pre: 1. embedded newlines
3392 !! wikitext
3393 <pre>foo</pre>
3394
3395 <pre>
3396 foo
3397 </pre>
3398
3399 <pre>
3400
3401 foo
3402 </pre>
3403
3404 <pre>
3405
3406
3407 foo
3408 </pre>
3409 !! html/php+tidy
3410 <pre>
3411 foo
3412 </pre>
3413 <pre>
3414 foo
3415 </pre>
3416 <pre>
3417
3418 foo
3419 </pre>
3420 <pre>
3421
3422
3423 foo
3424 </pre>
3425 !! html/parsoid
3426 <pre data-parsoid='{"stx":"html"}'>foo</pre>
3427
3428 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
3429 foo
3430 </pre>
3431
3432 <pre data-parsoid='{"stx":"html"}'>
3433
3434 foo
3435 </pre>
3436
3437 <pre data-parsoid='{"stx":"html"}'>
3438
3439
3440 foo
3441 </pre>
3442 !!end
3443
3444 !! test
3445 HTML-pre: big spaces
3446 !! wikitext
3447 <pre>
3448
3449
3450
3451
3452 haha
3453
3454
3455
3456
3457 haha
3458
3459
3460
3461
3462 </pre>
3463 !! html/php+tidy
3464 <pre>
3465
3466
3467
3468
3469 haha
3470
3471
3472
3473
3474 haha
3475
3476
3477
3478
3479 </pre>
3480 !! html/parsoid
3481 <pre data-parsoid='{"stx":"html"}'>
3482
3483
3484
3485
3486 haha
3487
3488
3489
3490
3491 haha
3492
3493
3494
3495
3496 </pre>
3497 !! end
3498
3499 !!test
3500 HTML-pre: 2: indented text
3501 !! wikitext
3502 <pre>
3503 foo
3504 </pre>
3505 !! html
3506 <pre>
3507 foo
3508 </pre>
3509
3510 !!end
3511
3512 !!test
3513 HTML-pre: 3: other wikitext
3514 !! wikitext
3515 <pre>
3516 * foo
3517 # bar
3518 = no-h =
3519 '' no-italic ''
3520 [[ NoLink ]]
3521 </pre>
3522 !! html/php
3523 <pre>
3524 * foo
3525 # bar
3526 = no-h =
3527 '' no-italic ''
3528 [[ NoLink ]]
3529 </pre>
3530
3531 !! html/parsoid
3532 <pre data-parsoid='{"stx":"html","strippedNL":true}'>* foo
3533 # bar
3534 = no-h =
3535 '' no-italic ''
3536 [[ NoLink ]]
3537 </pre>
3538 !!end
3539
3540 ###
3541 ### Definition lists
3542 ###
3543 !! test
3544 Simple definition
3545 !! wikitext
3546 ; name : Definition
3547 !! html
3548 <dl><dt> name&#160;</dt>
3549 <dd> Definition</dd></dl>
3550
3551 !! end
3552
3553 !! test
3554 Definition list for indentation only
3555 !! wikitext
3556 : Indented text
3557 !! html
3558 <dl><dd> Indented text</dd></dl>
3559
3560 !! end
3561
3562 !! test
3563 Definition list with no space
3564 !! wikitext
3565 ;name:Definition
3566 !! html
3567 <dl><dt>name</dt>
3568 <dd>Definition</dd></dl>
3569
3570 !!end
3571
3572 !! test
3573 Definition list with URL link
3574 !! wikitext
3575 ; http://example.com/ : definition
3576 !! html
3577 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3578 <dd> definition</dd></dl>
3579
3580 !! end
3581
3582 !! test
3583 Definition list with bracketed URL link
3584 !! wikitext
3585 ;[http://www.example.com/ Example]:Something about it
3586 !! html
3587 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3588 <dd>Something about it</dd></dl>
3589
3590 !! end
3591
3592 !! test
3593 Definition list with wikilink containing colon
3594 !! wikitext
3595 ; [[Help:FAQ]]: The least-read page on Wikipedia
3596 !! html
3597 <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>
3598 <dd> The least-read page on Wikipedia</dd></dl>
3599
3600 !! end
3601
3602 # At Brion's and JeLuF's insistence... :)
3603 !! test
3604 Definition list with news link containing colon
3605 !! wikitext
3606 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
3607 !! html/php
3608 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3609 <dd> This isn't even a real newsgroup!</dd></dl>
3610
3611 !! html/parsoid
3612 <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>
3613 !! end
3614
3615 !! test
3616 Malformed definition list with colon
3617 !! wikitext
3618 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3619 !! html
3620 <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>
3621
3622 !! end
3623
3624 !! test
3625 Definition lists: colon in external link text
3626 !! wikitext
3627 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3628 !! html
3629 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3630 <dd> OK, I made that up</dd></dl>
3631
3632 !! end
3633
3634 !! test
3635 Definition lists: colon in HTML attribute
3636 !! wikitext
3637 ;<b style="display: inline">bold</b>
3638 !! html
3639 <dl><dt><b style="display: inline">bold</b></dt></dl>
3640
3641 !! end
3642
3643 !! test
3644 Definition lists: self-closed tag
3645 !! wikitext
3646 ;one<br/>two : two-line fun
3647 !! html
3648 <dl><dt>one<br />two&#160;</dt>
3649 <dd> two-line fun</dd></dl>
3650
3651 !! end
3652
3653 !! test
3654 Bug 11748: Literal closing tags
3655 !! wikitext
3656 <dl>
3657 <dt>test 1</dt>
3658 <dd>test test test test test</dd>
3659 <dt>test 2</dt>
3660 <dd>test test test test test</dd>
3661 </dl>
3662 !! html
3663 <dl>
3664 <dt>test 1</dt>
3665 <dd>test test test test test</dd>
3666 <dt>test 2</dt>
3667 <dd>test test test test test</dd>
3668 </dl>
3669
3670 !! end
3671
3672 !! test
3673 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3674 !! wikitext
3675 <ul><li>
3676 ; term : description
3677 * unordered
3678 </li></ul>
3679 !! html
3680 <ul><li>
3681 <dl><dt> term&#160;</dt>
3682 <dd> description</dd></dl>
3683 <ul><li> unordered</li></ul>
3684 </li></ul>
3685
3686 !! end
3687
3688 !! test
3689
3690 Definition list with empty definition and following paragraph
3691 !! wikitext
3692 ; term:
3693 Paragraph text
3694 !! html
3695 <dl><dt> term</dt>
3696 <dd></dd></dl>
3697 <p>Paragraph text
3698 </p>
3699 !! end
3700
3701 !! test
3702 Nested definition lists using html syntax
3703 !! wikitext
3704 <dl><dt>x</dt>
3705 <dd>a</dd>
3706 <dd>b</dd></dl>
3707 !! html
3708 <dl><dt>x</dt>
3709 <dd>a</dd>
3710 <dd>b</dd></dl>
3711
3712 !! end
3713
3714 !! test
3715 Definition Lists: No nesting: Multiple dd's
3716 !! wikitext
3717 ;x
3718 :a
3719 :b
3720 !! html
3721 <dl><dt>x</dt>
3722 <dd>a</dd>
3723 <dd>b</dd></dl>
3724
3725 !! end
3726
3727 !! test
3728 Definition Lists: Indentation: Regular
3729 !! wikitext
3730 :i1
3731 ::i2
3732 :::i3
3733 !! html
3734 <dl><dd>i1
3735 <dl><dd>i2
3736 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3737
3738 !! end
3739
3740 !! test
3741 Definition Lists: Indentation: Missing 1st level
3742 !! wikitext
3743 ::i2
3744 :::i3
3745 !! html
3746 <dl><dd><dl><dd>i2
3747 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3748
3749 !! end
3750
3751 !! test
3752 Definition Lists: Indentation: Multi-level indent
3753 !! wikitext
3754 :::i3
3755 !! html
3756 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3757
3758 !! end
3759
3760 !! test
3761 Definition Lists: Hacky use to indent tables
3762 !! wikitext
3763 ::{|
3764 |foo
3765 |bar
3766 |}
3767 this text
3768 should be left alone
3769 !! html
3770 <dl><dd><dl><dd><table>
3771 <tr>
3772 <td>foo
3773 </td>
3774 <td>bar
3775 </td></tr></table></dd></dl></dd></dl>
3776 <p>this text
3777 should be left alone
3778 </p>
3779 !! end
3780
3781 !! test
3782 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3783 !! wikitext
3784 <!-- foo -->
3785 ::{|
3786 |foo
3787 |bar
3788 |}<!-- bar -->
3789 this text
3790 should be left alone
3791 !! html/parsoid
3792 <!-- foo -->
3793 <dl><dd><dl><dd><table><tr>
3794 <td>foo</td>
3795 <td>bar</td>
3796 </tr></table><!-- bar --></dd></dl></dd></dl>
3797 <p>this text
3798 should be left alone</p>
3799 !! end
3800
3801 !! test
3802 Definition Lists: Hacky use to indent tables, with comment before table
3803 !! wikitext
3804 ::<!-- foo -->{|
3805 |foo
3806 |}
3807 !! html/parsoid
3808 <dl><dd><dl><dd><!-- foo --><table><tr>
3809 <td>foo</td>
3810 </tr></table></dd></dl></dd></dl>
3811 !! end
3812
3813 # The trailing whitespace in this test is to catch a regression in
3814 # Parsoid after T54473.
3815 !! test
3816 Definition Lists: Hacky use to indent tables (WS-insensitive)
3817 !! wikitext
3818 : {|
3819 |a
3820 |}
3821 !! html/php
3822 <dl><dd><table>
3823 <tr>
3824 <td>a
3825 </td></tr></table></dd></dl>
3826
3827 !! html/parsoid
3828 <dl><dd> <table>
3829 <tbody><tr><td>a</td></tr>
3830 </tbody></table> </dd></dl>
3831 !! end
3832
3833 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3834 ## as an empty dt item. It also ignores all but the last ";" when followed
3835 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3836 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3837 ## ";"s.
3838 ##
3839 ## Ex: ";;t2 ::d2" is transformed into:
3840 ##
3841 ## <dl>
3842 ## <dt>t2 </dt>
3843 ## <dd>
3844 ## <dl>
3845 ## <dt></dt>
3846 ## <dd>d2</dd>
3847 ## </dl>
3848 ## </dd>
3849 ## </dl>
3850 ##
3851 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3852 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3853 ##
3854 ## <dl>
3855 ## <dt>
3856 ## <dl>
3857 ## <dt>t2 </dt>
3858 ## <dd>:d2</dd>
3859 ## </dl>
3860 ## </dt>
3861 ## </dl>
3862 ##
3863 ## All Parsoid only definition list tests have this difference.
3864 ##
3865 ## See also: https://phabricator.wikimedia.org/T8569
3866 ## and https://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3867
3868 !! test
3869 Table / list interaction: indented table with lists in table contents
3870 !! wikitext
3871 :{|
3872 |-
3873 | a
3874 * b
3875 |-
3876 | c
3877 * d
3878 |}
3879 !! html
3880 <dl><dd><table>
3881
3882 <tr>
3883 <td> a
3884 <ul><li> b</li></ul>
3885 </td></tr>
3886 <tr>
3887 <td> c
3888 <ul><li> d</li></ul>
3889 </td></tr></table></dd></dl>
3890
3891 !! end
3892
3893 !!test
3894 Table / list interaction: lists nested in tables nested in indented lists
3895 !! wikitext
3896 :{|
3897 |
3898 :a
3899 :b
3900 |
3901 *c
3902 *d
3903 |}
3904
3905 *e
3906 *f
3907 !! html
3908 <dl><dd><table>
3909 <tr>
3910 <td>
3911 <dl><dd>a</dd>
3912 <dd>b</dd></dl>
3913 </td>
3914 <td>
3915 <ul><li>c</li>
3916 <li>d</li></ul>
3917 </td></tr></table></dd></dl>
3918 <ul><li>e</li>
3919 <li>f</li></ul>
3920
3921 !!end
3922
3923 !! test
3924 Definition Lists: Nesting: Multi-level (Parsoid only)
3925 !! options
3926 parsoid
3927 !! wikitext
3928 ;t1 :d1
3929 ;;t2 ::d2
3930 ;;;t3 :::d3
3931 !! html
3932 <dl>
3933 <dt>t1 </dt>
3934 <dd>d1</dd>
3935 <dt>
3936 <dl>
3937 <dt>t2 </dt>
3938 <dd>:d2</dd>
3939 <dt>
3940 <dl>
3941 <dt>t3 </dt>
3942 <dd>::d3</dd>
3943 </dl>
3944 </dt>
3945 </dl>
3946 </dt>
3947 </dl>
3948
3949
3950 !! end
3951
3952
3953 !! test
3954 Definition Lists: Nesting: Test 2 (Parsoid only)
3955 !! wikitext
3956 ;t1
3957 ::d2
3958 !! html/php+tidy
3959 <dl>
3960 <dt>t1</dt>
3961 <dd>
3962 <dl>
3963 <dd>d2</dd>
3964 </dl>
3965 </dd>
3966 </dl>
3967 !! html/parsoid
3968 <dl>
3969 <dt>t1</dt>
3970 <dd>
3971 <dl>
3972 <dd>d2</dd>
3973 </dl>
3974 </dd>
3975 </dl>
3976
3977 !! end
3978
3979
3980 !! test
3981 Definition Lists: Nesting: Test 3 (Parsoid only)
3982 !! wikitext
3983 :;t1
3984 ::::d2
3985 !! html/php+tidy
3986 <dl>
3987 <dd>
3988 <dl>
3989 <dt>t1</dt>
3990 <dd>
3991 <dl>
3992 <dd>
3993 <dl>
3994 <dd>d2</dd>
3995 </dl>
3996 </dd>
3997 </dl>
3998 </dd>
3999 </dl>
4000 </dd>
4001 </dl>
4002 !! html/parsoid
4003 <dl>
4004 <dd>
4005 <dl>
4006 <dt>t1</dt>
4007 <dd>
4008 <dl>
4009 <dd>
4010 <dl>
4011 <dd>d2</dd>
4012 </dl>
4013 </dd>
4014 </dl>
4015 </dd>
4016 </dl>
4017 </dd>
4018 </dl>
4019
4020 !! end
4021
4022
4023 !! test
4024 Definition Lists: Nesting: Test 4
4025 !! wikitext
4026 ::;t3
4027 :::d3
4028 !! html
4029 <dl><dd><dl><dd><dl><dt>t3</dt>
4030 <dd>d3</dd></dl></dd></dl></dd></dl>
4031
4032 !! end
4033
4034
4035 ## The Parsoid team believes the following three test exposes a
4036 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
4037 ## wrong to close the <dl> after the <dt> containing the <ul>.)
4038 ## It also exposes a "misfeature" in tidy, which doesn't like
4039 ## <dl> tags with a single <dt> child; it converts the <dt> into
4040 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
4041 !! test
4042 Definition Lists: Mixed Lists: Test 1
4043 !! wikitext
4044 :;* foo
4045 ::* bar
4046 :; baz
4047 !! html/php
4048 <dl><dd><dl><dt><ul><li> foo</li>
4049 <li> bar</li></ul></dt></dl>
4050 <dl><dt> baz</dt></dl></dd></dl>
4051
4052 !! html/php+tidy
4053 <dl>
4054 <dd>
4055 <dl>
4056 <dd>
4057 <ul>
4058 <li>foo</li>
4059 <li>bar</li>
4060 </ul>
4061 </dd>
4062 </dl>
4063 <dl>
4064 <dt>baz</dt>
4065 </dl>
4066 </dd>
4067 </dl>
4068 !! html/parsoid
4069 <dl>
4070 <dd><dl>
4071 <dt><ul>
4072 <li> foo
4073 </li>
4074 </ul></dt>
4075 <dd><ul>
4076 <li> bar
4077 </li>
4078 </ul></dd>
4079 <dt> baz</dt>
4080 </dl></dd>
4081 </dl>
4082 !! end
4083
4084 !! test
4085 Definition Lists: Mixed Lists: Test 2
4086 !! wikitext
4087 *: d1
4088 *: d2
4089 !! html
4090 <ul><li><dl><dd> d1</dd>
4091 <dd> d2</dd></dl></li></ul>
4092
4093 !! end
4094
4095
4096 !! test
4097 Definition Lists: Mixed Lists: Test 3
4098 !! wikitext
4099 *::: d1
4100 *::: d2
4101 !! html
4102 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
4103 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
4104
4105 !! end
4106
4107
4108 !! test
4109 Definition Lists: Mixed Lists: Test 4
4110 !! wikitext
4111 *;d1 :d2
4112 *;d3 :d4
4113 !! html
4114 <ul><li><dl><dt>d1&#160;</dt>
4115 <dd>d2</dd>
4116 <dt>d3&#160;</dt>
4117 <dd>d4</dd></dl></li></ul>
4118
4119 !! end
4120
4121
4122 !! test
4123 Definition Lists: Mixed Lists: Test 5
4124 !! wikitext
4125 *:d1
4126 *:: d2
4127 !! html
4128 <ul><li><dl><dd>d1
4129 <dl><dd> d2</dd></dl></dd></dl></li></ul>
4130
4131 !! end
4132
4133
4134 !! test
4135 Definition Lists: Mixed Lists: Test 6
4136 !! wikitext
4137 #*:d1
4138 #*::: d3
4139 !! html
4140 <ol><li><ul><li><dl><dd>d1
4141 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4142
4143 !! end
4144
4145
4146 !! test
4147 Definition Lists: Mixed Lists: Test 7
4148 !! wikitext
4149 :* d1
4150 :* d2
4151 !! html
4152 <dl><dd><ul><li> d1</li>
4153 <li> d2</li></ul></dd></dl>
4154
4155 !! end
4156
4157
4158 !! test
4159 Definition Lists: Mixed Lists: Test 8
4160 !! wikitext
4161 :* d1
4162 ::* d2
4163 !! html
4164 <dl><dd><ul><li> d1</li></ul>
4165 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
4166
4167 !! end
4168
4169
4170 !! test
4171 Definition Lists: Mixed Lists: Test 9
4172 !! wikitext
4173 *;foo :bar
4174 !! html
4175 <ul><li><dl><dt>foo&#160;</dt>
4176 <dd>bar</dd></dl></li></ul>
4177
4178 !! end
4179
4180
4181 !! test
4182 Definition Lists: Mixed Lists: Test 10
4183 !! wikitext
4184 *#;foo :bar
4185 !! html
4186 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4187 <dd>bar</dd></dl></li></ol></li></ul>
4188
4189 !! end
4190
4191 # The Parsoid team disagrees with the PHP parser's seemingly-random
4192 # rules regarding dd/dt on the next two tests. Parsoid is more
4193 # consistent, and recognizes the shared nesting and keeps the
4194 # still-open tags around until the nesting is complete.
4195 # (And tidy again converts <dt> to <dd> before 'bar'.)
4196
4197 !! test
4198 Definition Lists: Mixed Lists: Test 11
4199 !! wikitext
4200 *#*#;*;;foo :bar
4201 *#*#;boo :baz
4202 !! html/php
4203 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4204 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4205 <dl><dt>boo&#160;</dt>
4206 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4207
4208 !! html/php+tidy
4209 <ul>
4210 <li>
4211 <ol>
4212 <li>
4213 <ul>
4214 <li>
4215 <ol>
4216 <li>
4217 <dl>
4218 <dt>foo&#160;</dt>
4219 <dd>
4220 <ul>
4221 <li>
4222 <dl>
4223 <dd>
4224 <dl>
4225 <dt>bar</dt>
4226 </dl>
4227 </dd>
4228 </dl>
4229 </li>
4230 </ul>
4231 </dd>
4232 </dl>
4233 <dl>
4234 <dt>boo&#160;</dt>
4235 <dd>baz</dd>
4236 </dl>
4237 </li>
4238 </ol>
4239 </li>
4240 </ul>
4241 </li>
4242 </ol>
4243 </li>
4244 </ul>
4245 !! html/parsoid
4246 <ul>
4247 <li>
4248 <ol>
4249 <li>
4250 <ul>
4251 <li>
4252 <ol>
4253 <li>
4254 <dl>
4255 <dt>
4256 <ul>
4257 <li>
4258 <dl>
4259 <dt>
4260 <dl>
4261 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4262 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4263 </dl></dt>
4264 </dl></li>
4265 </ul></dt>
4266 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4267 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4268 </dl></li>
4269 </ol></li>
4270 </ul></li>
4271 </ol></li>
4272 </ul>
4273 !! end
4274
4275
4276 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
4277 # From whitelist:
4278 # * The test is wrong, there are two colons where there should be :;
4279 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4280 !! test
4281 Definition Lists: Weird Ones: Test 1
4282 !! wikitext
4283 *#;*::;; foo : bar (who uses this?)
4284 !! html/php
4285 <ul><li><ol><li><dl><dt> foo&#160;</dt>
4286 <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>
4287
4288 !! html/php+tidy
4289 <ul>
4290 <li>
4291 <ol>
4292 <li>
4293 <dl>
4294 <dt>foo&#160;</dt>
4295 <dd>
4296 <ul>
4297 <li>
4298 <dl>
4299 <dd>
4300 <dl>
4301 <dd>
4302 <dl>
4303 <dd>
4304 <dl>
4305 <dt>bar (who uses this?)</dt>
4306 </dl>
4307 </dd>
4308 </dl>
4309 </dd>
4310 </dl>
4311 </dd>
4312 </dl>
4313 </li>
4314 </ul>
4315 </dd>
4316 </dl>
4317 </li>
4318 </ol>
4319 </li>
4320 </ul>
4321 !! html/parsoid
4322 <ul>
4323 <li>
4324 <ol>
4325 <li>
4326 <dl>
4327 <dt>
4328 <ul>
4329 <li>
4330 <dl>
4331 <dd>
4332 <dl>
4333 <dd>
4334 <dl>
4335 <dt>
4336 <dl>
4337 <dt> foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span></dt>
4338 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
4339 </dl></dt>
4340 </dl></dd>
4341 </dl></dd>
4342 </dl></li>
4343 </ul></dt>
4344 </dl></li>
4345 </ol></li>
4346 </ul>
4347 !! end
4348
4349 !! test
4350 Definition Lists: colons occurring in tags
4351 !! wikitext
4352 ;a:b
4353 ;'''a:b'''
4354 ;<i>a:b</i>
4355 ;<span>a:b</span>
4356 ;<div>a:b</div>
4357 ;<div>a
4358 :b</div>
4359 ;{{echo|a:b}}
4360 ;{{echo|''a:b''}}
4361 ;;;''a:b''
4362 !! html+tidy
4363 <dl>
4364 <dt>a</dt>
4365 <dd>b</dd>
4366 <dt><b>a:b</b></dt>
4367 <dt><i>a:b</i></dt>
4368 <dt><span>a:b</span></dt>
4369 <dd>
4370 <div>a:b</div>
4371 </dd>
4372 <dd>
4373 <div>a
4374 <dl>
4375 <dd>b</dd>
4376 </dl>
4377 </div>
4378 </dd>
4379 <dt>a</dt>
4380 <dd>b</dd>
4381 <dt><i>a:b</i></dt>
4382 </dl>
4383 <dl>
4384 <dd>
4385 <dl>
4386 <dd>
4387 <dl>
4388 <dt><i>a:b</i></dt>
4389 </dl>
4390 </dd>
4391 </dl>
4392 </dd>
4393 </dl>
4394 !! html/parsoid
4395 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4396 <dt><b>a:b</b></dt>
4397 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4398 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4399 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4400 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4401 <dd>b</dd>
4402 <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>
4403 <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>
4404 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4405 !! end
4406
4407 !! test
4408 Definition Lists: colons and tables 1
4409 !! wikitext
4410 :{|
4411 | x
4412 |}
4413 :{|
4414 | y
4415 |}
4416 !! html
4417 <dl><dd><table>
4418 <tr>
4419 <td> x
4420 </td></tr></table></dd></dl>
4421 <dl><dd><table>
4422 <tr>
4423 <td> y
4424 </td></tr></table></dd></dl>
4425
4426 !! end
4427
4428 # Parsoid's output (as documented below) differs from php's in this case.
4429 # This is probably a bug. If we fixup parsoid to match php's output, the
4430 # above test should pass and the below test case can be removed. It is
4431 # unclear which output is more desirable.
4432
4433 !! test
4434 Definition Lists: colons and tables 2
4435 !! wikitext
4436 :{|
4437 | x
4438 |}
4439 :{|
4440 | y
4441 |}
4442 !! html/parsoid
4443 <dl><dd><table>
4444 <tr>
4445 <td> x
4446 </td></tr></table></dd>
4447 <dd><table>
4448 <tr>
4449 <td> y
4450 </td></tr></table></dd></dl>
4451 !! end
4452
4453 !! test
4454 Definition Lists: template interaction
4455 !! wikitext
4456 ::{{definition_list}}
4457
4458 :one
4459 ::{{definition_list}}
4460 :::two
4461 :::three
4462 ::four
4463 !! html/parsoid
4464 <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">
4465 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4466
4467 <dl><dd data-parsoid='{}'>one
4468 <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">
4469 </span><dd about="#mwt2">two
4470 <dl><dd>two</dd>
4471 <dd>three</dd></dl></dd>
4472 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4473 !! end
4474
4475
4476 ###
4477 ### External links
4478 ###
4479 !! test
4480 External links: non-bracketed
4481 !! wikitext
4482 Non-bracketed: http://example.com
4483 !! html
4484 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4485 </p>
4486 !! end
4487
4488 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4489 !! test
4490 External links: numbered
4491 !! wikitext
4492 Numbered: [http://example.com]
4493 Numbered: [http://example.net]
4494 Numbered: [http://example.com]
4495 !! html/php
4496 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4497 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4498 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4499 </p>
4500 !! html/parsoid
4501 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
4502 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
4503 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
4504 !!end
4505
4506 !! test
4507 External links: specified text
4508 !! wikitext
4509 Specified text: [http://example.com link]
4510 !! html
4511 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4512 </p>
4513 !!end
4514
4515 !! test
4516 External links: trail
4517 !! wikitext
4518 Linktrails should not work for external links: [http://example.com link]s
4519 !! html
4520 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4521 </p>
4522 !! end
4523
4524 !! test
4525 External links: dollar sign in URL
4526 !! wikitext
4527 http://example.com/1$2345
4528 !! html
4529 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4530 </p>
4531 !! end
4532
4533 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4534 !! test
4535 External links: dollar sign in URL (autonumber)
4536 !! wikitext
4537 [http://example.com/1$2345]
4538 !! html/php
4539 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4540 </p>
4541 !! html/parsoid
4542 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4543 !!end
4544
4545 !! test
4546 External links: open square bracket forbidden in URL (bug 4377)
4547 !! options
4548 parsoid=wt2html,wt2wt,html2html
4549 !! wikitext
4550 http://example.com/1[2345
4551 !! html/php
4552 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4553 </p>
4554 !! html/parsoid
4555 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4556 !! end
4557
4558 !! test
4559 External links: open square bracket forbidden in URL (named) (bug 4377)
4560 !! options
4561 parsoid=wt2html,html2html
4562 !! wikitext
4563 [http://example.com/1[2345]
4564 !! html/php
4565 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4566 </p>
4567 !! html/parsoid
4568 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4569 !!end
4570
4571 # parsoid adds a space before the link name
4572 !! test
4573 External links: open square bracket forbidden in URL (named) (bug 4377)
4574 Parsoid variant.
4575 !! wikitext
4576 [http://example.com/1 [2345]
4577 !! html
4578 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4579 </p>
4580 !!end
4581
4582 !! test
4583 External links: nowiki in URL link text (bug 6230)
4584 !! wikitext
4585 [http://example.com/ <nowiki>''example site''</nowiki>]
4586 !! html
4587 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4588 </p>
4589 !! end
4590
4591 !! test
4592 External links: newline forbidden in text (bug 6230 regression check)
4593 !! wikitext
4594 [http://example.com/ first
4595 second]
4596 !! html
4597 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4598 second]
4599 </p>
4600 !!end
4601
4602 !! test
4603 External links: Pipe char between url and text
4604 !! wikitext
4605 [http://example.com | link]
4606 !! html
4607 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4608 </p>
4609 !!end
4610
4611 !! test
4612 External links: protocol-relative URL in brackets
4613 !! wikitext
4614 [//example.com/ Test]
4615 !! html
4616 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4617 </p>
4618 !! end
4619
4620 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4621 !! test
4622 External links: protocol-relative URL in brackets without text
4623 !! wikitext
4624 [//example.com]
4625 !! html/php
4626 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4627 </p>
4628 !! html/parsoid
4629 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4630 !! end
4631
4632 !! test
4633 External links: protocol-relative URL in free text is left alone
4634 !! wikitext
4635 //example.com/Foo
4636 !! html
4637 <p>//example.com/Foo
4638 </p>
4639 !!end
4640
4641 !! test
4642 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
4643 !! wikitext
4644 foo//example.com/Foo
4645 !! html
4646 <p>foo//example.com/Foo
4647 </p>
4648 !! end
4649
4650 !! test
4651 External links: with no contents
4652 !! wikitext
4653 [http://en.wikipedia.org/wiki/Foo]
4654
4655 [[wikipedia:Foo|Bar]]
4656
4657 [[wikipedia:Foo|<span>Bar</span>]]
4658 !! html/php
4659 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4660 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4661 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4662 </p>
4663 !! html/parsoid
4664 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4665 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4666 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4667 !! end
4668
4669 !! test
4670 External links: Free with trailing punctuation
4671 !! wikitext
4672 http://example.com,
4673 http://example.com;
4674 http://example.com\
4675 http://example.com.
4676 http://example.com:
4677 http://example.com!
4678 http://example.com?
4679 http://example.com)
4680 http://example.com/url_with_(brackets)
4681 (http://example.com/url_without_brackets)
4682 http://example.com/url_with_entity&amp;
4683 http://example.com/url_with_entity&#x26;
4684 http://example.com/url_with_entity&#038;
4685 http://example.com/url_with_entity&nbsp;
4686 http://example.com/url_with_entity&#xA0;
4687 http://example.com/url_with_entity&#160;
4688 http://example.com/url_with_entity&lt;
4689 http://example.com/url_with_entity&#x3C;
4690 http://example.com/url_with_entity&#60;
4691 !! html/php
4692 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4693 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4694 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4695 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4696 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4697 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4698 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4699 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4700 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4701 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4702 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4703 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4704 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4705 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4706 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#xa0;
4707 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4708 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4709 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#x3c;
4710 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#60;
4711 </p>
4712 !! html/parsoid
4713 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>,
4714 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>;
4715 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>\
4716 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>.
4717 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:
4718 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>!
4719 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>?
4720 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)
4721 <a rel="mw:ExtLink" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4722 (<a rel="mw:ExtLink" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4723 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4724 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4725 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4726 <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>
4727 <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>
4728 <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>
4729 <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>
4730 <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>
4731 <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>
4732 !! end
4733
4734 !! test
4735 External links: tricky Parsoid html2html case
4736 !! options
4737 parsoid=wt2html,wt2wt,html2html
4738 !! wikitext
4739 http://example.com/url_with_entity&amp;amp;
4740 !! html/php
4741 <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>;
4742 </p>
4743 !! html/parsoid
4744 <p><a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;amp">http://example.com/url_with_entity&amp;amp</a>;</p>
4745 !! end
4746
4747 !! test
4748 External links: Free with trailing quotes (T113666)
4749 !! wikitext
4750 '''News:''' Stuff here
4751
4752 news:'a'b''c''d e
4753 !! html/php
4754 <p><b>News:</b> Stuff here
4755 </p><p><a rel="nofollow" class="external free" href="news:'a'b">news:'a'b</a><i>c</i>d e
4756 </p>
4757 !! html/parsoid
4758 <p><b>News:</b> Stuff here</p>
4759 <p><a rel="mw:ExtLink" href="news:'a'b">news:'a'b</a><i>c</i>d e</p>
4760 !! end
4761
4762 !! test
4763 External links: Lone protocols are never linked (T105697)
4764 !! wikitext
4765 http://
4766 http://;
4767 (http://)
4768 bitcoin:
4769 bitcoin:;
4770 (bitcoin:)
4771 !! html
4772 <p>http://
4773 http://;
4774 (http://)
4775 bitcoin:
4776 bitcoin:;
4777 (bitcoin:)
4778 </p>
4779 !! end
4780
4781 !! test
4782 External links: No preceding word characters allowed (bug 65278)
4783 !! wikitext
4784 NOPEhttp://example.com
4785 N0http://example.com
4786 ok:http://example.com
4787 ok-http://example.com
4788 !! html
4789 <p>NOPEhttp://example.com
4790 N0http://example.com
4791 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4792 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4793 </p>
4794 !! end
4795
4796 !! test
4797 External links: nofollow domain exception
4798 !! wikitext
4799 A [https://no-nofollow.org/foobar link], and another [https://example.org link].
4800 !! html
4801 <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>.
4802 </p>
4803 !!end
4804
4805 !! test
4806 External image
4807 !! wikitext
4808 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4809 !! html
4810 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4811 </p>
4812 !! end
4813
4814 !! test
4815 External image from https
4816 !! wikitext
4817 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4818 !! html
4819 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4820 </p>
4821 !! end
4822
4823 !! test
4824 External image (when not allowed)
4825 !! options
4826 wgAllowExternalImages=0
4827 !! wikitext
4828 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4829 !! html
4830 <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>
4831 </p>
4832 !! end
4833
4834 !! test
4835 Link to non-http image, no img tag
4836 !! wikitext
4837 Link to non-http image, no img tag: ftp://example.com/test.jpg
4838 !! html
4839 <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>
4840 </p>
4841 !! end
4842
4843 !! test
4844 External links: terminating separator
4845 !! wikitext
4846 Terminating separator: http://example.com/thing,
4847 !! html
4848 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4849 </p>
4850 !! end
4851
4852 !! test
4853 External links: intervening separator
4854 !! wikitext
4855 Intervening separator: http://example.com/1,2,3
4856 !! html
4857 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4858 </p>
4859 !! end
4860
4861 !! test
4862 External links: old bug with URL in query
4863 !! wikitext
4864 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4865 !! html
4866 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4867 </p>
4868 !! end
4869
4870 !! test
4871 External links: old URL-in-URL bug, mixed protocols
4872 !! wikitext
4873 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4874 !! html
4875 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4876 </p>
4877 !!end
4878
4879 # Since Parsoid is starting to emit canonical wikitext for links,
4880 # [http://example.com http://example.com] will not RT back to that
4881 # form anymore.
4882 !! test
4883 External links: URL in text
4884 !! options
4885 parsoid=wt2html
4886 !! wikitext
4887 URL in text: [http://example.com http://example.com]
4888 !! html/php
4889 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4890 </p>
4891 !! html/parsoid
4892 <p>URL in text: <a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
4893 !! end
4894
4895 !! test
4896 External links: Clickable images
4897 !! wikitext
4898 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4899 !! html/php
4900 <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>
4901 </p>
4902 !! html/parsoid
4903 <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>
4904 !! end
4905
4906 !! test
4907 External links: raw ampersand
4908 !! wikitext
4909 Old &amp; use: http://x&y
4910 !! html
4911 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4912 </p>
4913 !! end
4914
4915 !! test
4916 External links: encoded ampersand
4917 !! wikitext
4918 Old &amp; use: http://x&amp;y
4919 !! html/php
4920 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4921 </p>
4922 !! html/parsoid
4923 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4924 !! end
4925
4926 !! test
4927 External links: encoded equals (bug 6102)
4928 !! wikitext
4929 http://example.com/?foo&#61;bar
4930 !! html/php
4931 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4932 </p>
4933 !! html/parsoid
4934 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4935 !! end
4936
4937 ##
4938 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4939 ## does it number them. As discussed in bug 53505, we can identify
4940 ## autonumbered links via CSS.
4941 ##
4942
4943 !! test
4944 External links: [raw ampersand]
4945 !! wikitext
4946 Old &amp; use: [http://x&y]
4947 !! html/php
4948 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4949 </p>
4950 !! html/parsoid
4951 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4952 !! end
4953
4954 # note that parsoid html is identical to [raw ampersand] case; so html2wt
4955 # mode will return the [raw ampersand] wikitext
4956 !! test
4957 External links: [encoded ampersand]
4958 !! options
4959 parsoid=wt2html,wt2wt,html2html
4960 !! wikitext
4961 Old &amp; use: [http://x&amp;y]
4962 !! html/php
4963 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4964 </p>
4965 !! html/parsoid
4966 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4967 !! end
4968
4969 !! test
4970 External links: [raw equals]
4971 !! wikitext
4972 [http://example.com/?foo=bar]
4973 !! html/php
4974 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4975 </p>
4976 !! html/parsoid
4977 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4978 !! end
4979
4980 # note that parsoid html is identical to [raw equals] case; so html2wt
4981 # mode will return the [raw equals] wikitext
4982 !! test
4983 External links: [encoded equals] (bug 6102)
4984 !! options
4985 parsoid=wt2html,wt2wt,html2html
4986 !! wikitext
4987 [http://example.com/?foo&#61;bar]
4988 !! html/php
4989 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4990 </p>
4991 !! html/parsoid
4992 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4993 !! end
4994
4995 # xxx parsoid strips the IDN character, so the round-trip tests will
4996 # obviously fail and are disabled. --cscott
4997 !! test
4998 External links: [IDN ignored character reference in hostname; strip it right off]
4999 !! options
5000 parsoid=wt2html,wt2wt,html2html
5001 !! wikitext
5002 [http://e&zwnj;xample.com/]
5003 !! html/php
5004 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
5005 </p>
5006 !! html/parsoid
5007 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
5008 !! end
5009
5010 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
5011 # Where an external link could easily circumvent the sanitization of the text of
5012 # a link like this (where an IDN-ignore character is in the URL somewhere), this
5013 # test demands a higher standard. That's a bit strange.
5014 #
5015 # Example:
5016 #
5017 # http://e‌xample.com -> [http://example.com|http://example.com]
5018 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
5019 #
5020 # The first example is sanitized, but the second is not. Any security benefits
5021 # from this production are trivial to circumvent. Either remove this test and
5022 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
5023 # the test accordingly.
5024 #
5025 # All our love,
5026 # The Parsoid team.
5027 # xxx parsoid strips the IDN character, so the round-trip tests will
5028 # obviously fail and are disabled. --cscott
5029 !! test
5030 External links: IDN ignored character reference in hostname; strip it right off
5031 !! options
5032 parsoid=wt2html,html2html
5033 !! wikitext
5034 http://e&zwnj;xample.com/
5035 !! html/php
5036 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
5037 </p>
5038 !! html/parsoid
5039 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
5040 !! end
5041
5042 !! test
5043 External links: www.jpeg.org (bug 554)
5044 !! wikitext
5045 http://www.jpeg.org
5046 !! html
5047 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
5048 </p>
5049 !! end
5050
5051 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
5052 !! test
5053 External links: URL within URL (original bug 2)
5054 !! wikitext
5055 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
5056 !! html/php
5057 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
5058 </p>
5059 !! html/parsoid
5060 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
5061 !! end
5062
5063 !! test
5064 BUG 361: URL inside bracketed URL
5065 !! wikitext
5066 [http://www.example.com/foo http://www.example.com/bar]
5067 !! html
5068 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
5069 </p>
5070 !! end
5071
5072 !! test
5073 BUG 361: URL within URL, not bracketed
5074 !! wikitext
5075 http://www.example.com/foo?=http://www.example.com/bar
5076 !! html
5077 <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>
5078 </p>
5079 !! end
5080
5081 !! test
5082 BUG 289: ">"-token in URL-tail
5083 !! wikitext
5084 http://www.example.com/<hello>
5085 !! html
5086 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
5087 </p>
5088 !!end
5089
5090 !! test
5091 BUG 289: literal ">"-token in URL-tail
5092 !! wikitext
5093 http://www.example.com/<b>html</b>
5094 !! html/php
5095 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
5096 </p>
5097 !! html/parsoid
5098 <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>
5099 !! end
5100
5101 !! test
5102 BUG 289: ">"-token in bracketed URL
5103 !! wikitext
5104 [http://www.example.com/<hello> stuff]
5105 !! html
5106 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
5107 </p>
5108 !!end
5109
5110 !! test
5111 BUG 289: literal ">"-token in bracketed URL
5112 !! wikitext
5113 [http://www.example.com/<b>html</b> stuff]
5114 !! html
5115 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
5116 </p>
5117 !!end
5118
5119 !! test
5120 BUG 289: literal double quote at end of URL
5121 !! wikitext
5122 http://www.example.com/"hello"
5123 !! html
5124 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
5125 </p>
5126 !!end
5127
5128 !! test
5129 BUG 289: literal double quote in bracketed URL
5130 !! wikitext
5131 [http://www.example.com/"hello" stuff]
5132 !! html
5133 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
5134 </p>
5135 !!end
5136
5137 !! test
5138 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
5139 !! wikitext
5140 [http://www.example.com test]
5141 !! html
5142 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
5143 </p>
5144 !! end
5145
5146 !! test
5147 External links: link text with spaces
5148 !! wikitext
5149 [http://www.example.com a b c]
5150 [http://www.example.com ''a'' ''b'']
5151 !! html
5152 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5153 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5154 </p>
5155 !! end
5156
5157 !! test
5158 External links: wiki links within external link (Bug 3695)
5159 !! options
5160 parsoid=wt2html,html2html
5161 !! wikitext
5162 [http://example.com [[wikilink]] embedded in ext link]
5163 !! html/php
5164 <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>
5165 </p>
5166 !! html/parsoid
5167 <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>
5168 !! end
5169
5170 !! test
5171 BUG 787: Links with one slash after the url protocol are invalid
5172 !! wikitext
5173 http:/example.com
5174
5175 [http:/example.com title]
5176 !! html
5177 <p>http:/example.com
5178 </p><p>[http:/example.com title]
5179 </p>
5180 !! end
5181
5182 !! test
5183 Bracketed external links with template-generated invalid target
5184 !! wikitext
5185 [{{echo|http:/example.com}} title]
5186 !! html
5187 <p>[http:/example.com title]
5188 </p>
5189 !! end
5190
5191 !! test
5192 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
5193 !! wikitext
5194 ''[http://example.com text'']
5195 [http://example.com '''text]'''
5196 ''Something [http://example.com in italic'']
5197 ''Something [http://example.com mixed''''', even bold]'''
5198 '''''Now [http://example.com both''''']
5199 !! html
5200 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5201 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5202 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5203 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5204 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5205 </p>
5206 !! end
5207
5208
5209 !! test
5210 Bug 4781: %26 in URL
5211 !! wikitext
5212 http://www.example.com/?title=AT%26T
5213 !! html/php
5214 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5215 </p>
5216 !! html/parsoid
5217 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
5218 !! end
5219
5220 # According to https://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5221 # % is actually legal in HTML5. Any change in output would need testing though.
5222 !! test
5223 Bug 4781, 5267: %25 in URL
5224 !! wikitext
5225 http://www.example.com/?title=100%25_Bran
5226 !! html/php
5227 <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>
5228 </p>
5229 !! html/parsoid
5230 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
5231 !! end
5232
5233 !! test
5234 Bug 4781, 5267: %28, %29 in URL
5235 !! wikitext
5236 http://www.example.com/?title=Ben-Hur_%281959_film%29
5237 !! html/php
5238 <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>
5239 </p>
5240 !! html/parsoid
5241 <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>
5242 !! end
5243
5244
5245 !! test
5246 Bug 4781: %26 in autonumber URL
5247 !! wikitext
5248 [http://www.example.com/?title=AT%26T]
5249 !! html/php
5250 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5251 </p>
5252 !! html/parsoid
5253 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
5254 !! end
5255
5256 !! test
5257 Bug 4781, 5267: %26 in autonumber URL
5258 !! wikitext
5259 [http://www.example.com/?title=100%25_Bran]
5260 !! html/php
5261 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5262 </p>
5263 !! html/parsoid
5264 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
5265 !! end
5266
5267 !! test
5268 Bug 4781, 5267: %28, %29 in autonumber URL
5269 !! wikitext
5270 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5271 !! html/php
5272 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5273 </p>
5274 !! html/parsoid
5275 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5276 !! end
5277
5278
5279 !! test
5280 Bug 4781: %26 in bracketed URL
5281 !! wikitext
5282 [http://www.example.com/?title=AT%26T link]
5283 !! html/php
5284 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5285 </p>
5286 !! html/parsoid
5287 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
5288 !! end
5289
5290 !! test
5291 Bug 4781, 5267: %25 in bracketed URL
5292 !! wikitext
5293 [http://www.example.com/?title=100%25_Bran link]
5294 !! html
5295 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5296 </p>
5297 !! end
5298
5299 !! test
5300 Bug 4781, 5267: %28, %29 in bracketed URL
5301 !! wikitext
5302 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5303 !! html/php
5304 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5305 </p>
5306 !! html/parsoid
5307 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5308 !! end
5309
5310 !! test
5311 External link containing a period in the anchor. (bug 63947)
5312 !! wikitext
5313 [//foo.org/bar#baz. bang]
5314
5315 [//foo.org/bar. bang]
5316 !! html/php
5317 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5318 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5319 </p>
5320 !! html/parsoid
5321 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
5322 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
5323 !! end
5324
5325 !! test
5326 External link containing a single quote. (bug 63947)
5327 !! wikitext
5328 [//foo.org/bar'baz]
5329
5330 [//foo.org/bar'baz bang]
5331 !! html/php
5332 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
5333 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
5334 </p>
5335 !! html/parsoid
5336 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
5337 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
5338 !! end
5339
5340 !! test
5341 External link containing double-single-quotes in text '' (bug 4598 sanity check)
5342 !! wikitext
5343 Some [http://example.com/ pretty ''italics'' and stuff]!
5344 !! html
5345 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5346 </p>
5347 !! end
5348
5349 !! test
5350 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
5351 !! wikitext
5352 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5353 !! html
5354 <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>
5355 </p>
5356 !! end
5357
5358 !! test
5359 External link containing double-single-quotes with no space separating the url from text in italics
5360 !! wikitext
5361 [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]].]
5362 !! html/php
5363 <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>
5364 </p>
5365 !! html/php+tidy
5366 <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>
5367 !! html/parsoid
5368 <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>
5369 !! end
5370
5371 !! test
5372 External link with comments in link text
5373 !! wikitext
5374 [http://www.google.com Google <!-- comment -->]
5375 !! html/php
5376 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5377 </p>
5378 !! html/parsoid
5379 <p><a rel="mw:ExtLink" href="http://www.google.com">Google <!-- comment --></a></p>
5380 !! end
5381
5382 !! test
5383 External link to bare IPv4 address
5384 !! wikitext
5385 [http://192.168.0.1 Link]
5386 !! html/php
5387 <p><a rel="nofollow" class="external text" href="http://192.168.0.1">Link</a>
5388 </p>
5389 !! html/parsoid
5390 <p><a rel="mw:ExtLink" href="http://192.168.0.1">Link</a></p>
5391 !! end
5392
5393 !! test
5394 URL-encoding in URL functions (single parameter)
5395 !! wikitext
5396 {{localurl:Some page|amp=&}}
5397 !! html
5398 <p>/index.php?title=Some_page&amp;amp=&amp;
5399 </p>
5400 !! end
5401
5402 !! test
5403 URL-encoding in URL functions (multiple parameters)
5404 !! wikitext
5405 {{localurl:Some page|q=?&amp=&}}
5406 !! html
5407 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5408 </p>
5409 !! end
5410
5411 !! test
5412 Brackets in urls
5413 !! wikitext
5414 http://example.com/index.php?foozoid%5B%5D=bar
5415
5416 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5417 !! html/php
5418 <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>
5419 </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>
5420 </p>
5421 !! html/parsoid
5422 <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>
5423
5424 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
5425 !! end
5426
5427 !! test
5428 IPv6 urls, autolink format (T23261)
5429 !! wikitext
5430 http://[2404:130:0:1000::187:2]/index.php
5431
5432 Examples from RFC 2373, section 2.2:
5433 * http://[1080::8:800:200C:417A]/unicast
5434 * http://[FF01::101]/multicast
5435 * http://[::1]/loopback
5436 * http://[::]/unspecified
5437 * http://[::13.1.68.3]/ipv4compat
5438 * http://[::FFFF:129.144.52.38]/ipv4compat
5439
5440 Examples from RFC 2732, section 2:
5441 * http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5442 * http://[1080:0:0:0:8:800:200C:417A]/index.html
5443 * http://[3ffe:2a00:100:7031::1]
5444 * http://[1080::8:800:200C:417A]/foo
5445 * http://[::192.9.5.5]/ipng
5446 * http://[::FFFF:129.144.52.38]:80/index.html
5447 * http://[2010:836B:4179::836B:4179]
5448
5449 !! html/php
5450 <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>
5451 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5452 </p>
5453 <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>
5454 <li> <a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5455 <li> <a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5456 <li> <a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5457 <li> <a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5458 <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>
5459 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5460 </p>
5461 <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>
5462 <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>
5463 <li> <a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5464 <li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5465 <li> <a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5466 <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>
5467 <li> <a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5468
5469 !! html/parsoid
5470 <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>
5471
5472 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5473 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5474 <li> <a rel="mw:ExtLink" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5475 <li> <a rel="mw:ExtLink" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5476 <li> <a rel="mw:ExtLink" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5477 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5478 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5479
5480 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5481 <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>
5482 <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>
5483 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5484 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5485 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5486 <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>
5487 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5488 !! end
5489
5490 !! test
5491 IPv6 urls, bracketed format (T23261)
5492 !! wikitext
5493 [http://[2404:130:0:1000::187:2]/index.php test]
5494
5495 Examples from RFC 2373, section 2.2:
5496 * [http://[1080::8:800:200C:417A] unicast]
5497 * [http://[FF01::101] multicast]
5498 * [http://[::1]/ loopback]
5499 * [http://[::] unspecified]
5500 * [http://[::13.1.68.3] ipv4compat]
5501 * [http://[::FFFF:129.144.52.38] ipv4compat]
5502
5503 Examples from RFC 2732, section 2:
5504 * [http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5505 * [http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5506 * [http://[3ffe:2a00:100:7031::1] 3]
5507 * [http://[1080::8:800:200C:417A]/foo 4]
5508 * [http://[::192.9.5.5]/ipng 5]
5509 * [http://[::FFFF:129.144.52.38]:80/index.html 6]
5510 * [http://[2010:836B:4179::836B:4179] 7]
5511
5512 !! html/php
5513 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5514 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5515 </p>
5516 <ul><li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5517 <li> <a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5518 <li> <a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5519 <li> <a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5520 <li> <a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5521 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5522 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5523 </p>
5524 <ul><li> <a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5525 <li> <a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5526 <li> <a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5527 <li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5528 <li> <a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5529 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5530 <li> <a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5531
5532 !! html/parsoid
5533 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php">test</a></p>
5534
5535 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5536 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5537 <li> <a rel="mw:ExtLink" href="http://[FF01::101]">multicast</a></li>
5538 <li> <a rel="mw:ExtLink" href="http://[::1]/">loopback</a></li>
5539 <li> <a rel="mw:ExtLink" href="http://[::]">unspecified</a></li>
5540 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]">ipv4compat</a></li>
5541 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5542
5543 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5544 <ul><li> <a rel="mw:ExtLink" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5545 <li> <a rel="mw:ExtLink" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5546 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5547 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5548 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">5</a></li>
5549 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5550 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5551 !! end
5552
5553 !! test
5554 Non-extlinks in brackets
5555 !! wikitext
5556 [foo]
5557 [foo bar]
5558 [foo ''bar'']
5559 [fool's] errand
5560 [fool's errand]
5561 [{{echo|foo}}]
5562 [{{echo|foo}} bar]
5563 [{{echo|foo}} ''bar'']
5564 [{{echo|foo}}l's] errand
5565 [{{echo|foo}}l's errand]
5566 [url={{echo|foo}}]
5567 [url=http://example.com]
5568 [http:// bare protocols don't count]
5569 !! html/php
5570 <p>[foo]
5571 [foo bar]
5572 [foo <i>bar</i>]
5573 [fool's] errand
5574 [fool's errand]
5575 [foo]
5576 [foo bar]
5577 [foo <i>bar</i>]
5578 [fool's] errand
5579 [fool's errand]
5580 [url=foo]
5581 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5582 [http:// bare protocols don't count]
5583 </p>
5584 !! html/parsoid
5585 <p>[foo]
5586 [foo bar]
5587 [foo <i>bar</i>]
5588 [fool's] errand
5589 [fool's errand]
5590 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span>]
5591 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> bar]
5592 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> <i>bar</i>]
5593 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span>] errand
5594 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span> errand]
5595 [<span typeof="mw:Placeholder" data-parsoid='{"src":"url={{echo|foo}}"}'>url=foo</span>]
5596 [url=<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>]
5597 [http:// bare protocols don't count]</p>
5598 !! end
5599
5600 !! test
5601 Percent encoding in external links
5602 !! wikitext
5603 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
5604 !! html/php
5605 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
5606 </p>
5607 !! html/parsoid
5608 <p><a rel="mw:ExtLink"
5609 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
5610 !! end
5611
5612 !! test
5613 Use url link syntax for links where the content is equal the link target
5614 !! wikitext
5615 http://example.com
5616 !! html/php
5617 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5618 </p>
5619 !! html/parsoid
5620 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5621 !! end
5622
5623 !! test
5624 Parenthesis in external links, especially URL links
5625 !! wikitext
5626 http://example.com)
5627
5628 http://example.com/test)
5629
5630 http://example.com/(test)
5631
5632 http://example.com/((test)
5633
5634 (http://example.com/(test))
5635
5636 (http://example.com/(test)))))
5637
5638 http://example.com/a)b
5639
5640 [http://example.com) foo]
5641 !! html/php
5642 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5643 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
5644 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
5645 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
5646 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
5647 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
5648 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
5649 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5650 </p>
5651 !! html/parsoid
5652 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
5653 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
5654 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
5655 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
5656 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
5657 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
5658 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
5659 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
5660 !! end
5661
5662 !! test
5663 Parenthesis in external links, w/ transclusion or comment
5664 !! wikitext
5665 (http://example.com/{{echo|hi}})
5666
5667 (http://example.com<!-- hi -->)
5668 !! html/php
5669 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5670 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5671 </p>
5672 !! html/parsoid
5673 <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>
5674
5675 <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>
5676 !! end
5677
5678 !! test
5679 Serialize <a> tags with invalid link targets as plain text
5680 !! options
5681 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
5682 !! html/parsoid
5683 <a rel="mw:WikiLink" href="[[foo]]">text</a>
5684 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
5685 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
5686 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
5687 !! wikitext
5688 text
5689 <nowiki>*</nowiki>text
5690 <nowiki>[[foo]]</nowiki>
5691 <nowiki>*</nowiki>a <nowiki>[[foo]]</nowiki>
5692 !! end
5693
5694 !! test
5695 mw:ExtLink -vs- mw:WikiLink (T94723)
5696 !! options
5697 parsoid=html2wt
5698 !! html/parsoid
5699 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>Bar</a>
5700 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
5701 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5702 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5703 <p>
5704 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5705 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5706 </p>
5707 !! wikitext
5708 [[Foo|Bar]]
5709 [[Foo|Bar]]
5710 [[wikipedia:Foo|Bar]]
5711 [[wikipedia:Foo|Bar]]
5712
5713 [[wikipedia:European_Robin|European Robin]]
5714 [[wikipedia:European_Robin|European Robin]]
5715 !! end
5716
5717 !! test
5718 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
5719 !! options
5720 parsoid=wt2wt
5721 !! wikitext
5722 [http://en.wikipedia.org/wiki/European_Robin European Robin]
5723 !! html/parsoid
5724 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
5725 !! end
5726
5727
5728 ###
5729 ### Quotes
5730 ###
5731
5732 !! test
5733 Quotes
5734 !! wikitext
5735 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5736
5737 Normal text. '''''Bold italic text.''''' Normal text.
5738 !! html
5739 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5740 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5741 </p>
5742 !! end
5743
5744
5745 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5746 # parser strips. The wikitext contains just the first half of the bold
5747 # quote pair.
5748 !! test
5749 Unclosed and unmatched quotes
5750 !! wikitext
5751 '''''Bold italic text '''with bold deactivated''' in between.'''''
5752
5753 '''''Bold italic text ''with italic deactivated'' in between.'''''
5754
5755 '''Bold text..
5756
5757 ..spanning two paragraphs (should not work).'''
5758
5759 '''Bold tag left open
5760
5761 ''Italic tag left open
5762
5763 Normal text.
5764
5765 <!-- Unmatching number of opening, closing tags: -->
5766 '''This year''''s election ''should'' beat '''last year''''s.
5767
5768 ''Tom'''s car is bigger than ''Susan'''s.
5769
5770 Plain ''italic'''s plain
5771 !! html/php
5772 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5773 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5774 </p><p><b>Bold text..</b>
5775 </p><p>..spanning two paragraphs (should not work).
5776 </p><p><b>Bold tag left open</b>
5777 </p><p><i>Italic tag left open</i>
5778 </p><p>Normal text.
5779 </p><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 !! html/parsoid
5784 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5785 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5786 </p><p><b>Bold text..</b>
5787 </p><p>..spanning two paragraphs (should not work).<b></b>
5788 </p><p><b>Bold tag left open</b>
5789 </p><p><i>Italic tag left open</i>
5790 </p><p>Normal text.
5791 </p>
5792 <!-- Unmatching number of opening, closing tags: -->
5793 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5794 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5795 </p><p>Plain <i>italic'</i>s plain
5796 </p>
5797 !! end
5798
5799 ###
5800 ### Tables
5801 ###
5802 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5803 ###
5804
5805 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5806 # is the bare minimum required by the spec, see:
5807 # https://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5808 # Parsoid team replies: empty table tags are legal in HTML5
5809 !! test
5810 A table with no data.
5811 !! options
5812 parsoid=wt2html
5813 !! wikitext
5814 {||}
5815 !! html/php
5816
5817 !! html/parsoid
5818 <table></table>
5819
5820 !! end
5821
5822 !! test
5823 A table with stray table end tags on start tag line (wt2html)
5824 !! options
5825 parsoid=wt2html
5826 !! wikitext
5827 {|style="color: red;"|}
5828
5829 {|style="color: red;" |}
5830 |foo
5831 |}
5832
5833 {|style="color: red;"|} id="foo"
5834 |foo
5835 |}
5836
5837 {|style="color: red;" |} id="foo"
5838 |foo
5839 |}
5840 !! html
5841 <table style="color: red;"></table>
5842
5843 <table style="color: red;">
5844 <tbody><tr>
5845 <td>foo</td>
5846 </tr></tbody>
5847 </table>
5848
5849 <table style="color: red;" id="foo">
5850 <tbody><tr>
5851 <td>foo</td>
5852 </tr></tbody>
5853 </table>
5854
5855 <table style="color: red;" id="foo">
5856 <tbody><tr>
5857 <td>foo</td>
5858 </tr></tbody>
5859 </table>
5860
5861 !! end
5862
5863 !! test
5864 A table with no data (take 2)
5865 !! wikitext
5866 {|
5867 |}
5868 !! html/parsoid
5869 <table></table>
5870 !! end
5871
5872 # A table with nothing but a caption is invalid XHTML, we might want to render
5873 # this as <p>caption</p>
5874 # Parsoid team replies: table with only a caption is legal in HTML5
5875 !! test
5876 A table with nothing but a caption
5877 !! wikitext
5878 {|
5879 |+ caption
5880 |}
5881 !! html/php
5882 <table>
5883 <caption> caption
5884 </caption><tr><td></td></tr></table>
5885
5886 !! html/parsoid
5887 <table><caption> caption</caption></table>
5888 !! end
5889
5890 !! test
5891 A table with caption with default-spaced attributes and a table row
5892 !! wikitext
5893 {|
5894 |+ style="color: red;" | caption1
5895 |-
5896 | foo
5897 |}
5898 !! html
5899 <table>
5900 <caption style="color: red;"> caption1
5901 </caption>
5902 <tr>
5903 <td> foo
5904 </td></tr></table>
5905
5906 !! end
5907
5908 !! test
5909 A table with captions with non-default spaced attributes and a table row
5910 !! wikitext
5911 {|
5912 |+style="color: red;"|caption2
5913 |+ style="color: red;"| caption3
5914 |-
5915 | foo
5916 |}
5917 !! html
5918 <table>
5919 <caption style="color: red;">caption2
5920 </caption>
5921 <caption style="color: red;"> caption3
5922 </caption>
5923 <tr>
5924 <td> foo
5925 </td></tr></table>
5926
5927 !! end
5928
5929 !! test
5930 Table td-cell syntax variations
5931 !! wikitext
5932 {|
5933 | foo bar foo | baz
5934 | foo bar foo || baz
5935 | style='color:red;' | baz
5936 | style='color:red;' || baz
5937 |}
5938 !! html
5939 <table>
5940 <tr>
5941 <td> baz
5942 </td>
5943 <td> foo bar foo </td>
5944 <td> baz
5945 </td>
5946 <td style="color:red;"> baz
5947 </td>
5948 <td> style='color:red;' </td>
5949 <td> baz
5950 </td></tr></table>
5951
5952 !! end
5953
5954 !! test
5955 Simple table
5956 !! wikitext
5957 {|
5958 | 1 || 2
5959 |-
5960 | 3 || 4
5961 |}
5962 !! html
5963 <table>
5964 <tr>
5965 <td> 1 </td>
5966 <td> 2
5967 </td></tr>
5968 <tr>
5969 <td> 3 </td>
5970 <td> 4
5971 </td></tr></table>
5972
5973 !! end
5974
5975 !! test
5976 Simple table but with multiple dashes for row wikitext
5977 !! wikitext
5978 {|
5979 | foo
5980 |-----
5981 | bar
5982 |}
5983 !! html
5984 <table>
5985 <tr>
5986 <td> foo
5987 </td></tr>
5988 <tr>
5989 <td> bar
5990 </td></tr></table>
5991
5992 !! end
5993
5994 !! test
5995 Multiplication table
5996 !! wikitext
5997 {| border="1" cellpadding="2"
5998 |+Multiplication table
5999 |-
6000 ! &times; !! 1 !! 2 !! 3
6001 |-
6002 ! 1
6003 | 1 || 2 || 3
6004 |-
6005 ! 2
6006 | 2 || 4 || 6
6007 |-
6008 ! 3
6009 | 3 || 6 || 9
6010 |-
6011 ! 4
6012 | 4 || 8 || 12
6013 |-
6014 ! 5
6015 | 5 || 10 || 15
6016 |}
6017 !! html
6018 <table border="1" cellpadding="2">
6019 <caption>Multiplication table
6020 </caption>
6021 <tr>
6022 <th> &#215; </th>
6023 <th> 1 </th>
6024 <th> 2 </th>
6025 <th> 3
6026 </th></tr>
6027 <tr>
6028 <th> 1
6029 </th>
6030 <td> 1 </td>
6031 <td> 2 </td>
6032 <td> 3
6033 </td></tr>
6034 <tr>
6035 <th> 2
6036 </th>
6037 <td> 2 </td>
6038 <td> 4 </td>
6039 <td> 6
6040 </td></tr>
6041 <tr>
6042 <th> 3
6043 </th>
6044 <td> 3 </td>
6045 <td> 6 </td>
6046 <td> 9
6047 </td></tr>
6048 <tr>
6049 <th> 4
6050 </th>
6051 <td> 4 </td>
6052 <td> 8 </td>
6053 <td> 12
6054 </td></tr>
6055 <tr>
6056 <th> 5
6057 </th>
6058 <td> 5 </td>
6059 <td> 10 </td>
6060 <td> 15
6061 </td></tr></table>
6062
6063 !! end
6064
6065 !! test
6066 Accept "||" in table headings
6067 !! wikitext
6068 {|
6069 !h1 || h2
6070 |}
6071 !! html
6072 <table>
6073 <tr>
6074 <th>h1 </th>
6075 <th> h2
6076 </th></tr></table>
6077
6078 !! end
6079
6080 !! test
6081 Accept "!!" in table data
6082 !! wikitext
6083 {|
6084 | Foo!! ||
6085 |}
6086 !! html
6087 <table>
6088 <tr>
6089 <td> Foo!! </td>
6090 <td>
6091 </td></tr></table>
6092
6093 !! html/parsoid
6094 <table>
6095 <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>
6096 </tbody></table>
6097 !! end
6098
6099 !! test
6100 Accept "||" in indented table headings
6101 !! wikitext
6102 :{|
6103 !h1 || h2
6104 |}
6105 !! html
6106 <dl><dd><table>
6107 <tr>
6108 <th>h1 </th>
6109 <th> h2
6110 </th></tr></table></dd></dl>
6111
6112 !! end
6113
6114 !! test
6115 Accept "!!" in templates
6116 !! wikitext
6117 {|
6118 !a {{echo|b!!c}}
6119 |}
6120 !! html/php
6121 <table>
6122 <tr>
6123 <th>a b</th>
6124 <th>c
6125 </th></tr></table>
6126
6127 !! html/parsoid
6128 <table>
6129 <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>
6130 !! end
6131
6132 !! test
6133 Accept "!!" in table headings after newline
6134 !! wikitext
6135 {|
6136 !a
6137 b!!c
6138 |}
6139 !! html/php
6140 <table>
6141 <tr>
6142 <th>a
6143 <p>b!!c
6144 </p>
6145 </th></tr></table>
6146
6147 !! html/parsoid
6148 <table>
6149 <tbody><tr><th>a
6150 <p>b!!c</p></th></tr>
6151 </tbody></table>
6152 !! end
6153
6154 !! test
6155 Accept "!!" in table data of mixed wikitext / html syntax
6156 !! wikitext
6157 {|
6158 !a
6159 <tr><td>b!!c</td></tr>
6160 |}
6161 !! html+tidy
6162 <table>
6163 <tr>
6164 <th>a</th>
6165 </tr>
6166 <tr>
6167 <td>b!!c</td>
6168 </tr>
6169 </table>
6170 !! html/parsoid
6171 <table>
6172 <tbody><tr><th>a</th></tr>
6173 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6174 </tbody></table>
6175 !! end
6176
6177 !! test
6178 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6179 !! wikitext
6180 {|
6181 !| h1
6182 || a
6183 |}
6184 !! html
6185 <table>
6186 <tr>
6187 <th> h1
6188 </th>
6189 <td> a
6190 </td></tr></table>
6191
6192 !! end
6193
6194 !!test
6195 Accept "| !" at start of line in tables (ignore !-attribute)
6196 !! wikitext
6197 {|
6198 |-
6199 | !style="color:red" | bar
6200 |}
6201 !! html
6202 <table>
6203
6204 <tr>
6205 <td> bar
6206 </td></tr></table>
6207
6208 !!end
6209
6210 !!test
6211 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 +/-
6212 !! wikitext
6213 {|
6214 |-
6215 |style='color:red;'|+1
6216 |style='color:blue;'|-1
6217 |-
6218 | 1 || 2 || 3
6219 | 1 ||+2 ||-3
6220 |-
6221 | +1
6222 | -1
6223 |}
6224 !! html
6225 <table>
6226
6227 <tr>
6228 <td style="color:red;">+1
6229 </td>
6230 <td style="color:blue;">-1
6231 </td></tr>
6232 <tr>
6233 <td> 1 </td>
6234 <td> 2 </td>
6235 <td> 3
6236 </td>
6237 <td> 1 </td>
6238 <td>+2 </td>
6239 <td>-3
6240 </td></tr>
6241 <tr>
6242 <td> +1
6243 </td>
6244 <td> -1
6245 </td></tr></table>
6246
6247 !!end
6248
6249 !! test
6250 Table rowspan
6251 !! wikitext
6252 {| border=1
6253 | Cell 1, row 1
6254 |rowspan=2| Cell 2, row 1 (and 2)
6255 | Cell 3, row 1
6256 |-
6257 | Cell 1, row 2
6258 | Cell 3, row 2
6259 |}
6260 !! html
6261 <table border="1">
6262 <tr>
6263 <td> Cell 1, row 1
6264 </td>
6265 <td rowspan="2"> Cell 2, row 1 (and 2)
6266 </td>
6267 <td> Cell 3, row 1
6268 </td></tr>
6269 <tr>
6270 <td> Cell 1, row 2
6271 </td>
6272 <td> Cell 3, row 2
6273 </td></tr></table>
6274
6275 !! end
6276
6277 !! test
6278 Nested table
6279 !! wikitext
6280 {| border=1
6281 | &alpha;
6282 |
6283 {| bgcolor=#ABCDEF border=2
6284 |nested
6285 |-
6286 |table
6287 |}
6288 |the original table again
6289 |}
6290 !! html
6291 <table border="1">
6292 <tr>
6293 <td> &#945;
6294 </td>
6295 <td>
6296 <table bgcolor="#ABCDEF" border="2">
6297 <tr>
6298 <td>nested
6299 </td></tr>
6300 <tr>
6301 <td>table
6302 </td></tr></table>
6303 </td>
6304 <td>the original table again
6305 </td></tr></table>
6306
6307 !! end
6308
6309 !! test
6310 Invalid attributes in table cell (bug 1830)
6311 !! wikitext
6312 {|
6313 |Cell:|broken
6314 |}
6315 !! html
6316 <table>
6317 <tr>
6318 <td>broken
6319 </td></tr></table>
6320
6321 !! end
6322
6323 !! test
6324 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6325 !! wikitext
6326 {|
6327 | title="foo" |bar
6328 | title="foo<nowiki>|</nowiki>" |bar
6329 | title="foo<nowiki>|</nowiki>" bar
6330 |}
6331 !! html/php
6332 <table>
6333 <tr>
6334 <td title="foo">bar
6335 </td>
6336 <td title="foo&#124;">bar
6337 </td>
6338 <td> title="foo|" bar
6339 </td></tr></table>
6340
6341 !! html/parsoid
6342 <table>
6343 <tbody><tr><td title="foo">bar</td>
6344 <td title="foo|" data-parsoid='{"a":{"title":"foo|"},"sa":{"title":"foo&lt;nowiki>|&lt;/nowiki>"},"autoInsertedEnd":true}'>bar</td>
6345 <td> title="foo<span typeof="mw:Nowiki">|</span>" bar</td></tr>
6346 </tbody></table>
6347 !! end
6348
6349 # See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
6350 # N.B. The "|}" to close the table is missing from the input, so parsoid's
6351 # *2wt modes will fail.
6352 !! test
6353 Table security: embedded pipes
6354 !! options
6355 parsoid=wt2html,html2html
6356 !! wikitext
6357 {|
6358 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6359 !! html/php
6360 <table>
6361 <tr>
6362 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6363 <td>]" onmouseover="alert(document.cookie)"&gt;test
6364 </td>
6365 </tr>
6366 </table>
6367
6368 !! html/parsoid
6369 <table><tbody>
6370 <tr>
6371 <td data-parsoid='{"startTagSrc":"| ","attrSepSrc":"|","autoInsertedEnd":true}'><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
6372 !! end
6373
6374 !! test
6375 Element attributes with double ! should not be broken up by <th>
6376 !! wikitext
6377 {|
6378 ! hi <div class="!!">ha</div> ho
6379 |}
6380 !! html/php
6381 <table>
6382 <tr>
6383 <th> hi <div class="!!">ha</div> ho
6384 </th></tr></table>
6385
6386 !! html/parsoid
6387 <table>
6388 <tbody><tr><th> hi <div class="!!" data-parsoid='{"stx":"html"}'>ha</div> ho</th></tr>
6389 </tbody></table>
6390 !! end
6391
6392 !! test
6393 ! and || in element attributes should not be parsed as <th>/<td>
6394 !! wikitext
6395 {|
6396 | <div style="color: red !important;" data-contrived="put this here ||">hi</div>
6397 |}
6398 !! html/php
6399 <table>
6400 <tr>
6401 <td> <div style="color: red !important;" data-contrived="put this here &#124;&#124;">hi</div>
6402 </td></tr></table>
6403
6404 !! html/parsoid
6405 <table>
6406 <tbody><tr><td> <div style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"stx":"html"}'>hi</div></td></tr>
6407 </tbody></table>
6408 !! end
6409
6410 # FIXME: The output seems broken. Filed as T110268.
6411 !! test
6412 ! and || in td attributes should not be parsed as <th>/<td>
6413 !! options
6414 parsoid=wt2html
6415 !! wikitext
6416 {|
6417 | style="color: red !important;" data-contrived="put this here ||" | foo
6418 |}
6419 !! html/php
6420 <table>
6421 <tr>
6422 <td> style="color: red !important;" data-contrived="put this here </td>
6423 <td> foo
6424 </td></tr></table>
6425
6426 !! html/parsoid
6427 <table>
6428 <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>
6429 </tbody></table>
6430 !! end
6431
6432 !! test
6433 Break on | in element attribute in template
6434 !! options
6435 parsoid=wt2html,html2html
6436 !! wikitext
6437 {{echo|1=<div class="hi|ho">ha</div>}}
6438 !! html/php
6439 <p>ho"&gt;ha&lt;/div&gt;
6440 </p>
6441 !! html/parsoid
6442 <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>
6443 !! end
6444
6445 ## We don't support roundtripping of these attributes in Parsoid.
6446 ## Selective serialization takes care of preventing dirty diffs.
6447 ## But, on edits, we dirty-diff the invalid attribute text.
6448 !! test
6449 Invalid text in table attributes should be discarded
6450 !! options
6451 parsoid=wt2html
6452 !! wikitext
6453 {| <span>boo</span> style='border:1px solid black'
6454 | <span>boo</span> style='color:blue' | 1
6455 |<span>boo</span> style='color:blue'| 2
6456 |}
6457 !! html/php
6458 <table style="border:1px solid black">
6459 <tr>
6460 <td style="color:blue"> 1
6461 </td>
6462 <td style="color:blue"> 2
6463 </td></tr></table>
6464
6465 !! html/parsoid
6466 <table style="border:1px solid black">
6467 <tr>
6468 <td style="color:blue"> 1</td>
6469 <td style="color:blue"> 2</td>
6470 </tr>
6471 </table>
6472 !! end
6473
6474 !! test
6475 Invalid text in table attributes should be preserved by selective serializer
6476 !! options
6477 parsoid={
6478 "modes": ["selser"],
6479 "changes": [
6480 ["td:first-child", "text", "abc"],
6481 ["td + td", "text", "xyz"]
6482 ]
6483 }
6484 !! wikitext
6485 {| <span>boo</span> style='border:1px solid black'
6486 | <span>boo</span> style='color:blue' | 1
6487 |<span>boo</span> style='color:blue'| 2
6488 |}
6489 !! wikitext/edited
6490 {| <span>boo</span> style='border:1px solid black'
6491 | <span>boo</span> style='color:blue' |abc
6492 |<span>boo</span> style='color:blue'|xyz
6493 |}
6494 !! end
6495
6496 !! test
6497 1. Template-generated table cell attributes and cell content
6498 !! wikitext
6499 {|
6500 |{{table_attribs}}
6501 | {{table_attribs}}
6502 || {{table_attribs_5}}
6503 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6504 |align=center {{table_attribs}}
6505 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6506 |}
6507 !! html
6508 <table>
6509 <tr>
6510 <td style="color:red;">Foo
6511 </td>
6512 <td style="color:red;">Foo
6513 </td>
6514 <td> style="color:red;"</td>
6515 <td>Bar
6516 </td>
6517 <td style="color:red;">Foo
6518 </td>
6519 <td align="center" style="color:red;">Foo
6520 </td>
6521 <td align="center" style="color:red;">Foo
6522 </td></tr></table>
6523
6524 !! end
6525
6526 !! test
6527 2. Template-generated table cell attributes and cell content
6528 !! wikitext
6529 {|
6530 |{{table_attribs_2}}
6531 |}
6532 !! html/php
6533 <table>
6534 <tr>
6535 <td style="color:red;">Foo
6536 </td>
6537 <td>Bar</td>
6538 <td>Baz
6539 </td></tr></table>
6540
6541 !! html/parsoid
6542 <table>
6543 <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>
6544 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6545 </tbody></table>
6546 !! end
6547
6548 !! test
6549 3. Template-generated table cell attributes and cell content
6550 !! wikitext
6551 {|
6552 !align=center {{table_header_cells}}
6553 |-
6554 |align=center {{table_cells}}
6555 |}
6556 !! html/php
6557 <table>
6558 <tr>
6559 <th align="center" style="color:red;">Foo</th>
6560 <th style="color:red;"><i>Bar</i></th>
6561 <th style="color:brown;"><i>Foo</i> and Baz
6562 </th></tr>
6563 <tr>
6564 <td align="center" style="color:red;">Foo</td>
6565 <td style="color:red;"><i>Bar</i></td>
6566 <td style="color:brown;"><i>Foo</i> and Baz
6567 </td></tr></table>
6568
6569 !! html/parsoid
6570 <table>
6571 <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>
6572 <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>
6573 </tbody></table>
6574 !! end
6575
6576 !! test
6577 4. Template-generated table cell attributes and cell content inside a templated table
6578 !! wikitext
6579 {{tbl-start}}
6580 !align=center {{table_header_cells}}
6581 |-
6582 |align=center {{table_cells}}
6583 {{tbl-end}}
6584 !! html/php
6585 <table>
6586 <tr>
6587 <th align="center" style="color:red;">Foo</th>
6588 <th style="color:red;"><i>Bar</i></th>
6589 <th style="color:brown;"><i>Foo</i> and Baz
6590 </th></tr>
6591 <tr>
6592 <td align="center" style="color:red;">Foo</td>
6593 <td style="color:red;"><i>Bar</i></td>
6594 <td style="color:brown;"><i>Foo</i> and Baz
6595 </td></tr></table>
6596
6597 !! html/parsoid
6598 <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}}]}'>
6599 <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>
6600 <tr>
6601 <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>
6602 </tbody></table>
6603 !! end
6604
6605 ## Edge case fix to prevent future regressions
6606 !! test
6607 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
6608 !! wikitext
6609 {|
6610 |{{table_attribs_7}}
6611 |}
6612 <references />
6613 !! html/parsoid
6614 <table>
6615 <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>
6616 </tbody></table>
6617 <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>
6618 !! end
6619
6620 !! test
6621 Table with row followed by newlines and table heading
6622 !! options
6623 parsoid=wt2html,html2html
6624 !! wikitext
6625 {|
6626 |-
6627
6628 ! foo
6629 |}
6630 !! html/*
6631 <table>
6632
6633
6634 <tr>
6635 <th> foo
6636 </th></tr></table>
6637
6638 !! end
6639
6640 !! test
6641 Table with empty line following the start tag
6642 !! options
6643 parsoid=wt2html,html2html
6644 !! wikitext
6645 {|
6646
6647 |-
6648 | foo
6649 |}
6650 !! html/*
6651 <table>
6652
6653
6654 <tr>
6655 <td> foo
6656 </td></tr></table>
6657
6658 !! end
6659
6660 !! test
6661 Table attributes with empty value
6662 !! options
6663 parsoid=wt2html,html2html
6664 !! wikitext
6665 {|
6666 | style=| hello
6667 |}
6668 !! html/php
6669 <table>
6670 <tr>
6671 <td style=""> hello
6672 </td></tr></table>
6673
6674 !! html/parsoid
6675 <table>
6676 <tbody><tr><td style=""> hello</td></tr>
6677 </tbody></table>
6678 !! end
6679
6680 !! test
6681 Wikitext table with a lot of comments
6682 !! wikitext
6683 {|
6684 <!-- c0 -->
6685 | foo
6686 <!-- c1 -->
6687 |-<!-- c2 -->
6688 <!-- c3 -->
6689 |<!-- c4 -->
6690 <!-- c5 -->
6691 |}
6692 !! html
6693 <table>
6694 <tr>
6695 <td> foo
6696 </td></tr>
6697 <tr>
6698 <td>
6699 </td></tr></table>
6700
6701 !! end
6702
6703 !! test
6704 Wikitext table comments represented in parsoid dom
6705 !! wikitext
6706 {|<!--c1--><!--c2-->
6707 |-<!--c3-->
6708 | x
6709 |}
6710 !! html/php+tidy
6711 <table>
6712 <tr>
6713 <td>x</td>
6714 </tr>
6715 </table>
6716 !! html/parsoid
6717 <table><!--c1--><!--c2-->
6718 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
6719 <td data-parsoid='{"autoInsertedEnd":true}'> x</td></tr>
6720 </tbody></table>
6721 !! end
6722
6723 !! test
6724 Wikitext table with double-line table cell
6725 !! wikitext
6726 {|
6727 |a
6728 b
6729 |}
6730 !! html
6731 <table>
6732 <tr>
6733 <td>a
6734 <p>b
6735 </p>
6736 </td></tr></table>
6737
6738 !! end
6739
6740 !! test
6741 Table cell with a single comment
6742 !! wikitext
6743 {|
6744 | <!-- c1 -->
6745 | a
6746 |}
6747 !! html
6748 <table>
6749 <tr>
6750 <td>
6751 </td>
6752 <td> a
6753 </td></tr></table>
6754
6755 !! end
6756
6757 !! test
6758 Table-cell after a comment-only-empty-line
6759 !! wikitext
6760 {|
6761 |a
6762 <!--c1-->
6763 <!--c2-->| b
6764 |}
6765 !! html
6766 <table>
6767 <tr>
6768 <td>a
6769 </td>
6770 <td> b
6771 </td></tr></table>
6772
6773 !! html/parsoid
6774 <table>
6775 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
6776 <!--c1-->
6777 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
6778 </tbody></table>
6779
6780 !! end
6781
6782 !! test
6783 Build table with {{!}}
6784 !! wikitext
6785 {{{!}} class="wikitable"
6786 ! header
6787 ! second header
6788 {{!}}- style="color:red;"
6789 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
6790 {{!}}}
6791 !! html
6792 <table class="wikitable">
6793 <tr>
6794 <th> header
6795 </th>
6796 <th> second header
6797 </th></tr>
6798 <tr style="color:red;">
6799 <td> data </td>
6800 <td style="color:red;"> second data
6801 </td></tr></table>
6802
6803 !! end
6804
6805 !! test
6806 Build table with pipe as data
6807 !! wikitext
6808 {| class="wikitable"
6809 ! header
6810 ! second header
6811 |- style="color:red;"
6812 | data || style="color:red;" | second data
6813 |-
6814 | style="color:red;" | data with | || style="color:red;" | second data with |
6815 |-
6816 || data with | ||| second data with |
6817 |}
6818 !! html
6819 <table class="wikitable">
6820 <tr>
6821 <th> header
6822 </th>
6823 <th> second header
6824 </th></tr>
6825 <tr style="color:red;">
6826 <td> data </td>
6827 <td style="color:red;"> second data
6828 </td></tr>
6829 <tr>
6830 <td style="color:red;"> data with | </td>
6831 <td style="color:red;"> second data with |
6832 </td></tr>
6833 <tr>
6834 <td> data with | </td>
6835 <td> second data with |
6836 </td></tr></table>
6837
6838 !! end
6839
6840 !! test
6841 Build table with wikilink
6842 !! wikitext
6843 {| class="wikitable"
6844 ! header || second header
6845 |- style="color:red;"
6846 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
6847 |-
6848 | data || second data [[Main Page|link|text with pipe]]
6849 |}
6850 !! html
6851 <table class="wikitable">
6852 <tr>
6853 <th> header </th>
6854 <th> second header
6855 </th></tr>
6856 <tr style="color:red;">
6857 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
6858 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
6859 </td></tr>
6860 <tr>
6861 <td> data </td>
6862 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
6863 </td></tr></table>
6864
6865 !! end
6866
6867 # The expected HTML structure in this test is debatable. The PHP parser does
6868 # not parse this kind of table at all. The main focus for Parsoid is on
6869 # round-tripping, so this output is ok for now. TODO: revisit!
6870 !! test
6871 Wikitext table with html-syntax row
6872 !! wikitext
6873 {|
6874 |-
6875 <td>foo</td>
6876 |}
6877 !! html/parsoid
6878 <table>
6879 <tbody>
6880 <tr>
6881 <td>foo</td></tr></tbody></table>
6882 !! end
6883
6884 ## Note that Parsoid output differs from PHP and PHP+tidy here.
6885 ## The lack of <tr> tags in the PHP output is arguably a bug in the
6886 ## PHP parser, which tidy then compounds by fostering the content
6887 ## entirely out of the table. Parsoid recognizes the table context
6888 ## and generates <tr> and <td> wrappers as needed. Hopefully nobody
6889 ## depends on PHP's treatment of broken table markup!
6890 !! test
6891 Implicit <td> after a |-
6892 !! options
6893 parsoid=wt2html,html2html
6894 !! wikitext
6895 {|
6896 |-
6897 a
6898 |}
6899 !! html/php
6900 <table>
6901
6902 a
6903 </table>
6904
6905 !! html/php+tidy
6906 <p>a</p>
6907 !! html/parsoid
6908 <table>
6909 <tr><td>a</td></tr>
6910 </table>
6911 !! end
6912
6913 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
6914 !! test
6915 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
6916 !! options
6917 parsoid=wt2html,html2html
6918 !! wikitext
6919 {|
6920 |-
6921 |
6922 a
6923 |-
6924 b
6925 |}
6926 !! html/php
6927 <table>
6928
6929 <tr>
6930 <td>
6931 <pre>a
6932 </pre>
6933 </td></tr>
6934 b
6935 </table>
6936
6937 !! html/php+tidy
6938 <p>b</p>
6939 <table>
6940 <tr>
6941 <td>
6942 <pre>
6943 a
6944 </pre></td>
6945 </tr>
6946 </table>
6947 !! html/parsoid
6948 <table>
6949 <tbody>
6950 <tr><td><pre>a</pre></td></tr>
6951 <tr><td> b</td></tr>
6952 </tbody>
6953 </table>
6954 !! end
6955
6956 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
6957 # Parsoid generates the missing <td>, so wt2wt won't succeed.
6958 !! test
6959 Lists should be recognized in an implicit <td> context
6960 !! options
6961 parsoid=wt2html,html2html
6962 !! wikitext
6963 {|
6964 |-
6965 *a
6966 |}
6967 !! html/php
6968 <table>
6969
6970 <ul><li>a</li></ul>
6971 </table>
6972
6973 !! html/php+tidy
6974 <ul>
6975 <li>a</li>
6976 </ul>
6977 !! html/parsoid
6978 <table>
6979 <tr>
6980 <td><ul>
6981 <li>a</li>
6982 </ul></td>
6983 </tr>
6984 </table>
6985 !! end
6986
6987 !! test
6988 Table cells not properly parsed in an implicit-td context
6989 !! wikitext
6990 {|
6991 |-
6992 {{table_attribs_4}} || a || b
6993 |}
6994 !! html/php+tidy
6995 <table>
6996 <tr>
6997 <td style="background-color:#DC241f;" width="10px"></td>
6998 <td>a</td>
6999 <td>b</td>
7000 </tr>
7001 </table>
7002 !! html/parsoid
7003 <table>
7004 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7005 <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>
7006 </tbody></table>
7007 !! end
7008
7009 !! test
7010 Parsoid: Round-trip tables directly followed by content (bug 51219)
7011 !! options
7012 parsoid=wt2html,wt2wt
7013 !! wikitext
7014 {|
7015 |foo
7016 |} bar
7017
7018 {|
7019 |baz
7020 |}<b>quux</b>
7021 !! html+tidy
7022 <table>
7023 <tr>
7024 <td>foo</td>
7025 </tr>
7026 </table>
7027 <p>bar</p>
7028 <table>
7029 <tr>
7030 <td>baz</td>
7031 </tr>
7032 </table>
7033 <p><b>quux</b></p>
7034 !! end
7035
7036 !! test
7037 Parsoid: Default to a newline after tables in new content (bug 51219)
7038 !! options
7039 parsoid=html2wt
7040 !! html/parsoid
7041 <table><tbody>
7042 <tr><td>foo</td></tr></tbody></table> bar
7043 <table><tbody>
7044 <tr><td>baz</td></tr></tbody></table><b>quux</b>
7045 !! wikitext
7046 {|
7047 |foo
7048 |}
7049 <nowiki> </nowiki>bar
7050 {|
7051 |baz
7052 |}
7053 '''quux'''
7054 !! end
7055
7056 !! test
7057 Parsoid: newline inducing block nodes don't suppress <nowiki>
7058 !! options
7059 parsoid=html2wt
7060 !! html/parsoid
7061 a<h1>foo</h1>
7062 !! wikitext
7063 <nowiki> </nowiki>a
7064
7065 = foo =
7066 !! end
7067
7068 !! test
7069 Parsoid: Row-syntax table headings followed by comment & table cells
7070 !! options
7071 parsoid=wt2html,wt2wt
7072 !! wikitext
7073 {|
7074 ! foo || bar
7075 <!-- foo --> || baz || quux
7076 |}
7077 !! html/php
7078 <table>
7079 <tr>
7080 <th> foo </th>
7081 <th> bar
7082 </th>
7083 <td> baz </td>
7084 <td> quux
7085 </td></tr></table>
7086
7087 !! html/parsoid
7088 <table>
7089 <tbody><tr><th> foo </th><th> bar
7090 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
7091 </tbody></table>
7092 !! end
7093
7094 !!test
7095 Parsoid: Recover better from broken table attributes
7096 !!options
7097 parsoid=wt2html
7098 !!wikitext
7099 {| class="foo
7100 | class="bar" |
7101 foo
7102 |}
7103 !!html/php+tidy
7104 <table class="foo">
7105 <tr>
7106 <td class="bar">
7107 <p>foo</p>
7108 </td>
7109 </tr>
7110 </table>
7111 !!html/parsoid
7112 <table class="foo">
7113 <tr>
7114 <td class="bar">
7115 <p>foo</p></td></tr>
7116 </tbody></table>
7117 !!end
7118
7119 !! test
7120 Tables: Digest broken attributes on table and tr tag
7121 !! options
7122 parsoid=wt2html
7123 !! wikitext
7124 {| || |} ++
7125 |- || || ++ --
7126 |- > [
7127 |}
7128 !! html
7129 <table>
7130 <tbody>
7131 <tr></tr>
7132 <tr></tr>
7133 </tbody></table>
7134 !! end
7135
7136 # T137406: Whitespace in the HTML
7137 !! test
7138 1. Generate correct wikitext for tables with thead/tbody/tfoot
7139 !! options
7140 parsoid=html2wt
7141 !! html/parsoid
7142 <table>
7143 <caption>Test</caption>
7144 <thead>
7145 <tr>
7146 <th>Month</th>
7147 <th>Savings</th>
7148 </tr>
7149 </thead>
7150 <tbody>
7151 <tr>
7152 <td>January</td>
7153 <td>$100</td>
7154 </tr>
7155 <tr>
7156 <td>February</td>
7157 <td>$80</td>
7158 </tr>
7159 </tbody>
7160 <tfoot>
7161 <tr>
7162 <td>Sum</td>
7163 <td>$180</td>
7164 </tr>
7165 </tfoot>
7166 </table>
7167 !! wikitext
7168 {|
7169 |+Test
7170 !Month
7171 !Savings
7172 |-
7173 |January
7174 |$100
7175 |-
7176 |February
7177 |$80
7178 |-
7179 |Sum
7180 |$180
7181 |}
7182 !! html/php+tidy
7183 <table>
7184 <caption>Test</caption>
7185 <tr>
7186 <th>Month</th>
7187 <th>Savings</th>
7188 </tr>
7189 <tr>
7190 <td>January</td>
7191 <td>$100</td>
7192 </tr>
7193 <tr>
7194 <td>February</td>
7195 <td>$80</td>
7196 </tr>
7197 <tr>
7198 <td>Sum</td>
7199 <td>$180</td>
7200 </tr>
7201 </table>
7202 !! end
7203
7204 # T137406: No whitespace in the HTML
7205 !! test
7206 2. Generate correct wikitext for tables with thead/tbody/tfoot
7207 !! options
7208 parsoid=html2wt
7209 !! html/parsoid
7210 <table><thead><tr><th>heading</th></tr></thead><tbody><tr><td>foo</td></tr></tbody></table>
7211 !! wikitext
7212 {|
7213 !heading
7214 |-
7215 |foo
7216 |}
7217 !! end
7218
7219 !! test
7220 Testing serialization after deletion in references
7221 !! options
7222 parsoid={
7223 "modes": ["wt2wt"],
7224 "changes": [
7225 ["#x", "remove"]
7226 ]
7227 }
7228 !! wikitext
7229 hi <ref><div id="x">ho</div></ref>
7230
7231 <references />
7232 !! wikitext/edited
7233 hi <ref></ref>
7234
7235 <references />
7236 !! end
7237
7238 !!test
7239 Testing serialization after deletion of table cells
7240 !!options
7241 parsoid={
7242 "modes": ["wt2wt", "selser"],
7243 "changes": [
7244 ["#x", "remove"]
7245 ]
7246 }
7247 !!wikitext
7248 {|
7249 !h1 !!h2 !!h3
7250 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
7251 |}
7252 !! wikitext/edited
7253 {|
7254 !h1 !!h2 !!h3
7255 |c2 |||c3
7256 |}
7257 !!end
7258
7259 !! test
7260 Testing selser after addition of new row before first row (T125419)
7261 !! options
7262 parsoid={
7263 "modes": ["wt2wt", "selser"],
7264 "changes": [
7265 [ "tr", "before", "<tr><td>X</td></tr>" ]
7266 ]
7267 }
7268 !! wikitext
7269 {|
7270 |a
7271 |}
7272 !! wikitext/edited
7273 {|
7274 |X
7275 |-
7276 |a
7277 |}
7278 !! end
7279
7280 !! test
7281 Serialize new table rows in a HTML table using HTML tags
7282 !! options
7283 parsoid={
7284 "modes": ["wt2wt", "selser"],
7285 "changes": [
7286 [ "tr", "before", "<tr><td>X</td></tr>" ]
7287 ]
7288 }
7289 !! wikitext
7290 <table><tr><td>a</td></tr></table>
7291 !! wikitext/edited
7292 <table><tr><td>X</td></tr><tr><td>a</td></tr></table>
7293 !! end
7294
7295 !! test
7296 Serialize new table cells in a HTML row using HTML tags
7297 !! options
7298 parsoid={
7299 "modes": ["wt2wt", "selser"],
7300 "changes": [
7301 [ "td", "before", "<td>X</td>" ]
7302 ]
7303 }
7304 !! wikitext
7305 <table><tr><td>a</td></tr></table>
7306 !! wikitext/edited
7307 <table><tr><td>X</td><td>a</td></tr></table>
7308 !! end
7309
7310 !! test
7311 Wikitext tables can be nested inside HTML tables
7312 !! options
7313 parsoid=html2wt
7314 !! html
7315 <table data-parsoid='{"stx":"html"}'>
7316 <tr><td>
7317 <table>
7318 <tr><td>foo</td></tr>
7319 </table>
7320 </td></tr>
7321 </table>
7322 !! wikitext
7323 <table>
7324 <tr><td>
7325 {|
7326 |foo
7327 |}
7328 </td></tr>
7329 </table>
7330 !! end
7331
7332 !! test
7333 Serialize wikitext list items as HTML list items when embedded in a HTML list
7334 !! options
7335 parsoid=html2wt
7336 !! html
7337 <ul data-parsoid='{"stx": "html"}'>
7338 <li data-parsoid='{}'>a</li>
7339 <li>b</li>
7340 </ul>
7341 !! wikitext
7342 <ul>
7343 <li>a</li>
7344 <li>b</li>
7345 </ul>
7346 !! end
7347
7348 # SSS FIXME: Is this actually a good thing given the
7349 # odd nested list output that is generated by MW?
7350 # <ul><li>foo<ul>..</ul></li></ul> instead of
7351 # <ul><li>foo</li><ul>..</ul></ul>
7352 !! test
7353 Wikitext lists can be nested inside HTML lists
7354 !! options
7355 parsoid=html2wt
7356 !! html
7357 <ul data-parsoid='{"stx": "html"}'>
7358 <li data-parsoid='{"stx": "html"}'>a
7359 <ul><li>b</li></ul>
7360 </li>
7361 </ul>
7362
7363 <ul data-parsoid='{"stx": "html"}'>
7364 <li>x
7365 <ul><li>y</li></ul>
7366 </li>
7367 </ul>
7368 !! wikitext
7369 <ul>
7370 <li>a
7371 * b
7372 </li>
7373 </ul>
7374
7375 <ul>
7376 <li>x
7377 * y
7378 </li>
7379 </ul>
7380 !! end
7381
7382 ###
7383 ### Internal links
7384 ###
7385 !! test
7386 Plain link, capitalized
7387 !! wikitext
7388 [[Main Page]]
7389 !! html
7390 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7391 </p>
7392 !! end
7393
7394 !! test
7395 Plain link, uncapitalized
7396 !! wikitext
7397 [[main Page]]
7398 !! html
7399 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
7400 </p>
7401 !! end
7402
7403 !! test
7404 Piped link
7405 !! wikitext
7406 [[Main Page|The Main Page]]
7407 !! html
7408 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7409 </p>
7410 !! end
7411
7412 !! test
7413 Piped link with comment in link text
7414 !! wikitext
7415 [[Main Page|The Main<!--front--> Page]]
7416 !! html
7417 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7418 </p>
7419 !! end
7420
7421 !! test
7422 Piped link with multiple pipe characters in link text
7423 !! wikitext
7424 [[Main Page||The|Main|Page|]]
7425 !! html/php
7426 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7427 </p>
7428 !! html/parsoid
7429 <p><a rel="mw:WikiLink" href="Main_Page" title="Main Page">|The|Main|Page|</a></p>
7430 !! end
7431
7432 !! test
7433 Piped link with no link text
7434 !! wikitext
7435 [[Thomas Bek (bishop of St David's)|]]
7436 !! html/php
7437 <p>[[Thomas Bek (bishop of St David's)|]]
7438 </p>
7439 !! html/parsoid
7440 <p>[[Thomas Bek (bishop of St David's)|]]</p>
7441 !! end
7442
7443 !! test
7444 Broken link
7445 !! wikitext
7446 [[Zigzagzogzagzig]]
7447 !! html
7448 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7449 </p>
7450 !! end
7451
7452 !! test
7453 Broken link with fragment
7454 !! wikitext
7455 [[Zigzagzogzagzig#zug]]
7456 !! html
7457 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7458 </p>
7459 !! end
7460
7461 !! test
7462 Special page link with fragment
7463 !! wikitext
7464 [[Special:Version#anchor]]
7465 !! html
7466 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7467 </p>
7468 !! end
7469
7470 !! test
7471 Nonexistent special page link with fragment
7472 !! wikitext
7473 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7474 !! html
7475 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7476 </p>
7477 !! end
7478
7479 !! test
7480 Link with prefix
7481 !! wikitext
7482 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7483 !! html
7484 <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>
7485 </p>
7486 !! end
7487
7488 !! test
7489 Link with suffix
7490 !! wikitext
7491 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7492 !! html
7493 <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>!!!
7494 </p>
7495 !! end
7496
7497 !! article
7498 prefixed article
7499 !! text
7500 Some text
7501 !! endarticle
7502
7503 !! test
7504 Bug 43661: Piped links with identical prefixes
7505 !! wikitext
7506 [[prefixed article|prefixed articles with spaces]]
7507
7508 [[prefixed article|prefixed articlesaoeu]]
7509
7510 [[Main Page|Main Page test]]
7511 !! html
7512 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7513 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7514 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7515 </p>
7516 !! end
7517
7518
7519 !! test
7520 Link with HTML entity in suffix / tail
7521 !! wikitext
7522 [[Main Page]]&quot;, [[Main Page]]&#97;
7523 !! html/php
7524 <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;
7525 </p>
7526 !! html/parsoid
7527 <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>
7528 !! end
7529
7530 !! test
7531 Link with 3 brackets
7532 !! wikitext
7533 [[[Main Page]]]
7534 Foo [[[Main Page]]]
7535 !! html
7536 <p>[[[Main Page]]]
7537 Foo [[[Main Page]]]
7538 </p>
7539 !! end
7540
7541 !! test
7542 Link with 4 brackets
7543 !! wikitext
7544 [[[[Main Page]]]]
7545 !! html
7546 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7547 </p>
7548 !! end
7549
7550 !! test
7551 Piped link with 3 brackets
7552 !! wikitext
7553 [[[main page|the main page]]]
7554 !! html
7555 <p>[[[main page|the main page]]]
7556 </p>
7557 !! end
7558
7559 !! test
7560 Piped link with extlink-like text
7561 !! wikitext
7562 [[Main Page|[bar]]]
7563 [[Main Page|This is a [bar]]]
7564 !! html/php
7565 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7566 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7567 </p>
7568 !! html/parsoid
7569 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7570 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a></p>
7571 !! end
7572
7573 !! test
7574 Link with multiple pipes
7575 !! wikitext
7576 [[Main Page|The|Main|Page]]
7577 !! html
7578 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7579 </p>
7580 !! end
7581
7582 # Note that parsoid does not munge anchor text; all non-space
7583 # characters are valid in HTML5 ids.
7584 !! test
7585 Anchor containing a #. (bug 63430)
7586 !! wikitext
7587 [[Main Page#And#Link]]
7588 !! html/php
7589 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
7590 </p>
7591 !! html/parsoid
7592 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link" title="Main Page">Main Page#And#Link</a></p>
7593 !! end
7594
7595 !! test
7596 Link to namespaces
7597 !! wikitext
7598 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7599 !! html
7600 <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>
7601 </p>
7602 !! end
7603
7604 !! test
7605 Link with space in namespace
7606 !! wikitext
7607 [[User talk:Foo bar]]
7608 !! html
7609 <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>
7610 </p>
7611 !! end
7612
7613 !! article
7614 MemoryAlpha:AlphaTest
7615 !! text
7616 This is an article in the MemoryAlpha namespace
7617 (which shadows the memoryalpha interwiki link).
7618 !! endarticle
7619
7620 !! test
7621 Namespace takes precedence over interwiki link (bug 51680)
7622 !! wikitext
7623 [[MemoryAlpha:AlphaTest]]
7624 !! html
7625 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7626 </p>
7627 !! end
7628
7629 # The previous test doesn't work correctly in html2*, due to not recognizing the
7630 # link as an internal one. This one checks for the correct behavior.
7631 !! test
7632 Link to namespace preferred over interwiki with correct rel attribute
7633 !! options
7634 parsoid=html2wt,html2html
7635 !! html/parsoid
7636 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7637 !! wikitext
7638 [[MemoryAlpha:AlphaTest]]
7639 !! end
7640
7641 !! test
7642 Piped link to namespace
7643 !! wikitext
7644 [[Meta:Disclaimers|The disclaimers]]
7645 !! html
7646 <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>
7647 </p>
7648 !! end
7649
7650 !! test
7651 Link containing }
7652 !! wikitext
7653 [[Usually caused by a typo (oops}]]
7654 !! html
7655 <p>[[Usually caused by a typo (oops}]]
7656 </p>
7657 !! end
7658
7659 !! article
7660 7% Solution
7661 !! text
7662 Just a test of an article title containing a percent.
7663 !! endarticle
7664
7665 !! test
7666 Link containing % (not as a hex sequence)
7667 !! wikitext
7668 [[7% Solution]]
7669 [[7% Solution|7%25 Solution]]
7670 !! html/php
7671 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7672 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7673 </p>
7674 !! html/parsoid
7675 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7676 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7677 !! end
7678
7679 # note that the parsoid HTML is identical to the previous test output,
7680 # so the previous test ensures that the html2wt mode will generate the
7681 # "not as a hex sequence" wikitext.
7682 !! test
7683 Link containing % as a single hex sequence interpreted to char
7684 !! options
7685 parsoid=wt2wt,wt2html,html2html
7686 !! wikitext
7687 [[7%25 Solution]]
7688 [[7%25 Solution|7%25 Solution]]
7689 !! html/php
7690 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7691 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7692 </p>
7693 !! html/parsoid
7694 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7695 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7696 !!end
7697
7698 !! test
7699 Link containing % as a double hex sequence interpreted to hex sequence
7700 !! wikitext
7701 [[7%2525 Solution]]
7702 !! html
7703 <p>[[7%2525 Solution]]
7704 </p>
7705 !!end
7706
7707 # note that parsoid does not munge anchor text; all non-space
7708 # characters are valid in HTML5 anchors.
7709 !! test
7710 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7711 Example for such a section: == < ==
7712 !! wikitext
7713 [[%23%3c]][[%23%3e]]
7714 !! html/php
7715 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7716 </p>
7717 !! html/parsoid
7718 <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>
7719 !! end
7720
7721 !! test
7722 Link containing "<#" and ">#" as a hex sequences
7723 !! wikitext
7724 [[%3c%23]][[%3e%23]]
7725 !! html
7726 <p>[[%3c%23]][[%3e%23]]
7727 </p>
7728 !! end
7729
7730 !! test
7731 Link containing an equals sign
7732 !! wikitext
7733 [[Special:BookSources/isbn=4-00-026157-6]]
7734 !! html/php
7735 <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>
7736 </p>
7737 !! html/parsoid
7738 <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>
7739 !! end
7740
7741 !! article
7742 Foo~bar
7743 !! text
7744 Just a test of an article title containing a tilde.
7745 !! endarticle
7746
7747 # note that links containing signatures, like [[Foo~~~~]], are
7748 # massaged by the pre-save transform (PST) and so the tildes are never
7749 # seen by the parser.
7750 !! test
7751 Link containing a tilde
7752 !! wikitext
7753 [[Foo~bar]]
7754 !! html/php
7755 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
7756 </p>
7757 !! html/parsoid
7758 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
7759 !! end
7760
7761 !! test
7762 Link containing double-single-quotes '' (bug 4598)
7763 !! wikitext
7764 [[Lista d''e paise d''o munno]]
7765 !! html/php
7766 <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>
7767 </p>
7768 !! html/parsoid
7769 <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>
7770 !! end
7771
7772 !! test
7773 Link containing double-single-quotes '' in text (bug 4598 sanity check)
7774 !! wikitext
7775 Some [[Link|pretty ''italics'' and stuff]]!
7776 !! html/php
7777 <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>!
7778 </p>
7779 !! html/parsoid
7780 <p>Some <a rel="mw:WikiLink" href="Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
7781 !! end
7782
7783 !! test
7784 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
7785 !! wikitext
7786 ''Some [[Link|pretty ''italics'' and stuff]]!''
7787 !! html
7788 <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>
7789 </p>
7790 !! end
7791
7792 !! test
7793 Link with double quotes in title part (literal) and alternate part (interpreted)
7794 !! wikitext
7795 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
7796
7797 [[''Pentecoste'']]
7798
7799 [[''Pentecoste''|Pentecoste]]
7800
7801 [[''Pentecoste''|''Pentecoste'']]
7802 !! html/php
7803 <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>
7804 </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>
7805 </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>
7806 </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>
7807 </p>
7808 !! html/parsoid
7809 <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>
7810 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
7811 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
7812 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
7813 !! end
7814
7815 !! test
7816 Broken image links with HTML captions (bug 39700)
7817 !! wikitext
7818 [[File:Nonexistent|<script></script>]]
7819 [[File:Nonexistent|100x100px|<script></script>]]
7820 [[File:Nonexistent|&lt;]]
7821 [[File:Nonexistent|a<i>b</i>c]]
7822 !! html/php
7823 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7824 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7825 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
7826 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
7827 </p>
7828 !! html/parsoid
7829 <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>
7830 <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>
7831 <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>
7832 <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>
7833 !! end
7834
7835 !! test
7836 Plain link to URL
7837 !! wikitext
7838 [[http://www.example.com]]
7839 !! html/php
7840 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
7841 </p>
7842 !! html/parsoid
7843 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
7844 !! end
7845
7846 !! test
7847 Plain link to URL with link text
7848 !! wikitext
7849 [[http://www.example.com Link text]]
7850 !! html
7851 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
7852 </p>
7853 !! end
7854
7855 !! test
7856 Plain link to protocol-relative URL
7857 !! wikitext
7858 [[//www.example.com]]
7859 !! html/php
7860 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
7861 </p>
7862 !! html/parsoid
7863 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
7864 !! end
7865
7866 !! test
7867 Plain link to protocol-relative URL with link text
7868 !! wikitext
7869 [[//www.example.com Link text]]
7870 !! html
7871 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
7872 </p>
7873 !! end
7874
7875 !! test
7876 Plain link to page with question mark in title
7877 !! wikitext
7878 [[A?b]]
7879
7880 [[A?b|Baz]]
7881 !! html
7882 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
7883 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
7884 </p>
7885 !! end
7886
7887
7888 # I'm fairly sure the expected result here is wrong.
7889 # We want these to be URL links, not pseudo-pages with URLs for titles....
7890 # However the current output is also pretty screwy.
7891 #
7892 # ----
7893 # I'm changing it to match the current output--it arguably makes more
7894 # sense in the light of the test above. Old expected result was:
7895 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
7896 #</p>
7897 # But I think this test is bordering on "garbage in, garbage out" anyway.
7898 # -- wtm
7899 !! test
7900 Piped link to URL
7901 !! wikitext
7902 Piped link to URL: [[http://www.example.com|an example URL]]
7903 !! html/php
7904 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
7905 </p>
7906 !! html/parsoid
7907 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
7908 !! end
7909
7910 !! test
7911 BUG 2: [[page|http://url/]] should link to page, not http://url/
7912 !! wikitext
7913 [[Main Page|http://url/]]
7914 !! html/php
7915 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
7916 </p>
7917 !! html/parsoid
7918 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
7919 !! end
7920
7921 # Parsoid does not mark self-links, by design.
7922 !! test
7923 BUG 337: Escaped self-links should be bold
7924 !! options
7925 title=[[Bug462]]
7926 !! wikitext
7927 [[Bu&#103;462]] [[Bug462]]
7928 !! html/php
7929 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
7930 </p>
7931 !! html/php+tidy
7932 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
7933 !! html/parsoid
7934 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
7935 !! end
7936
7937 !! test
7938 Self-link to section should not be bold
7939 !! options
7940 title=[[Main Page]]
7941 !! wikitext
7942 [[Main Page#section]]
7943 !! html
7944 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
7945 </p>
7946 !! end
7947
7948 !! article
7949 00
7950 !! text
7951 This is 00.
7952 !! endarticle
7953
7954 !!test
7955 Self-link to numeric title
7956 !!options
7957 title=[[0]]
7958 !! wikitext
7959 [[0]]
7960 !! html
7961 <p><strong class="selflink">0</strong>
7962 </p>
7963 !!end
7964
7965 !!test
7966 Link to numeric-equivalent title
7967 !!options
7968 title=[[0]]
7969 !! wikitext
7970 [[00]]
7971 !! html
7972 <p><a href="/wiki/00" title="00">00</a>
7973 </p>
7974 !!end
7975
7976 !! test
7977 <nowiki> inside a link
7978 !! wikitext
7979 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
7980 !! html
7981 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
7982 </p>
7983 !! end
7984
7985 !! test
7986 Non-breaking spaces in title
7987 !! wikitext
7988 [[&nbsp; Main &nbsp; Page &nbsp;]]
7989 !! html
7990 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
7991 </p>
7992 !!end
7993
7994 !! test
7995 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
7996 !! options
7997 language=ca
7998 !! wikitext
7999 '''[[Main Page]]'''
8000 !! html
8001 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
8002 </p>
8003 !! end
8004
8005 !! test
8006 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
8007 !! options
8008 language=ca
8009 !! wikitext
8010 ''[[Main Page]]''
8011 !! html
8012 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
8013 </p>
8014 !! end
8015
8016 !! test
8017 Internal link with en linktrail: no apostrophes (bug 27473)
8018 !! options
8019 language=en
8020 !! wikitext
8021 [[Something]]'nice
8022 !! html
8023 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
8024 </p>
8025 !! end
8026
8027 !! test
8028 Internal link with ca linktrail with apostrophes (bug 27473)
8029 !! options
8030 language=ca
8031 !! wikitext
8032 [[Something]]'nice
8033 !! html
8034 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
8035 </p>
8036 !! end
8037
8038 !! test
8039 Internal link with kaa linktrail with apostrophes (bug 27473)
8040 !! options
8041 language=kaa
8042 !! wikitext
8043 [[Something]]'nice
8044 !! html
8045 <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>
8046 </p>
8047 !! end
8048
8049 !! test
8050 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
8051 !! wikitext
8052 [[User:Foo/Test/63636:Bar|Test]]
8053 !! html/php
8054 <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>
8055 </p>
8056 !! html/parsoid
8057 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
8058 !! end
8059
8060 ## Mainly a sanity check for Parsoid
8061 !! test
8062 Handle title parsing for subpages
8063 !! options
8064 title=[[/123123]]
8065 !! wikitext
8066 123
8067 !! html/parsoid
8068 <p>123</p>
8069 !! end
8070
8071 ## FIXME: Add a working php section here
8072 !! test
8073 Link to a subpage from a namespace other than main
8074 !! options
8075 title=[[User:test]]
8076 !! wikitext
8077 [[/123]]
8078 !! html/parsoid
8079 <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>
8080 !! end
8081
8082 !! test
8083 Ensure that transclusion titles are not url-decoded
8084 !! options
8085 subpage title=[[Test]]
8086 parsoid=wt2html
8087 !! wikitext
8088 {{Bar%C3%A9}} {{/Bar%C3%A9}}
8089 !! html/php
8090 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}
8091 </p>
8092 !! html/parsoid
8093 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}</p>
8094 !! end
8095
8096 !! test
8097 Purely hash wikilink
8098 !! options
8099 title=[[User:test/123]]
8100 !! wikitext
8101 [[#a|b]]
8102 !! html/php
8103 <p><a href="#a">b</a>
8104 </p>
8105 !! html/parsoid
8106 <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>
8107 !! end
8108
8109 !! test
8110 1. Interaction of linktrail and template encapsulation
8111 !! options
8112 parsoid
8113 !! wikitext
8114 {{echo|[[Foo]]}}l
8115 !! html
8116 <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>
8117 !! end
8118
8119 !! test
8120 2. Interaction of linktrail and template encapsulation
8121 !! options
8122 parsoid
8123 !! wikitext
8124 {{echo|Some [[Fool]]}}s
8125 !! html
8126 <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>
8127 !! end
8128
8129 !! test
8130 3. Interaction of linktrail and template encapsulation
8131 !! options
8132 parsoid
8133 !! wikitext
8134 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
8135 !! html
8136 <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>
8137 !! end
8138
8139 !! article
8140 Söfnuður
8141 !! text
8142 Test.
8143 !! endarticle
8144
8145 !! test
8146 Internal link with is link prefix
8147 !! options
8148 language=is
8149 !! wikitext
8150 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
8151 !! html
8152 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
8153 </p>
8154 !! end
8155
8156 !! article
8157 Mótmælendatrú
8158 !! text
8159 Test.
8160 !! endarticle
8161
8162 !! test
8163 Internal link with is link trail and link prefix
8164 !! options
8165 language=is
8166 !! wikitext
8167 [[mótmælendatrú|xxx]]ar
8168 [[mótmælendatrú]]ar
8169 mótmælenda[[söfnuður]]
8170 mótmælenda[[söfnuður|söfnuðir]]
8171 mótmælenda[[söfnuður|söfnuðir]]xxx
8172 !! html
8173 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
8174 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
8175 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
8176 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
8177 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
8178 </p>
8179 !! end
8180
8181 !! test
8182 Parsoid link trail escaping
8183 !! options
8184 parsoid=html2wt,html2html
8185 !! html/parsoid
8186 <p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p>
8187 !! wikitext
8188 [[apple]]<nowiki/>s
8189 !! end
8190
8191 !! test
8192 Parsoid link prefix escaping
8193 !! options
8194 language=is
8195 parsoid=html2wt,html2html
8196 !! html/parsoid
8197 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p>
8198 !! wikitext
8199 Aðrir mótmælenda<nowiki/>[[söfnuður]]
8200 !! end
8201
8202 !! test
8203 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
8204 !! wikitext
8205 [[Foo| bar]]
8206
8207 [[Foo| ''bar'']]
8208
8209 [http://wp.org foo]
8210
8211 [http://wp.org ''foo'']
8212 !! html
8213 <p><a href="/wiki/Foo" title="Foo"> bar</a>
8214 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
8215 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
8216 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
8217 </p>
8218 !! end
8219
8220 !! test
8221 Parsoid: Scoped parsing should handle mixed transclusions and plain text
8222 !! options
8223 parsoid
8224 !! wikitext
8225 [[Foo|{{echo|a}} b {{echo|c}}]]
8226 !! html
8227 <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>
8228 !! end
8229
8230 !! test
8231 Link with angle bracket after anchor
8232 !! wikitext
8233 [[Foo#<bar>]]
8234 !! html/php
8235 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
8236 </p>
8237 !! html/parsoid
8238 <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>
8239 !! end
8240
8241 ###
8242 ### Interwiki links (see maintenance/interwiki.sql)
8243 ###
8244
8245 !! test
8246 Inline interwiki link
8247 !! options
8248 parsoid=wt2html,wt2wt,html2html
8249 !! wikitext
8250 [[MeatBall:SoftSecurity]]
8251 !! html/php
8252 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
8253 </p>
8254 !! html/parsoid
8255 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
8256 !! end
8257
8258 !! test
8259 Inline interwiki link with empty title (bug 2372)
8260 !! options
8261 parsoid=wt2html,wt2wt,html2html
8262 !! wikitext
8263 [[MeatBall:]]
8264 !! html/php
8265 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
8266 </p>
8267 !! html/parsoid
8268 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
8269 !! end
8270
8271 !! test
8272 Interwiki link encoding conversion (bug 1636)
8273 !! wikitext
8274 *[[Wikipedia:ro:Olteni&#0355;a]]
8275 *[[Wikipedia:ro:Olteni&#355;a]]
8276 !! html
8277 <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>
8278 <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>
8279
8280 !! html+tidy
8281 <ul>
8282 <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>
8283 <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>
8284 </ul>
8285 !! end
8286
8287 !! test
8288 Interwiki link with fragment (bug 2130)
8289 !! wikitext
8290 [[MeatBall:SoftSecurity#foo]]
8291 !! html
8292 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
8293 </p>
8294 !! end
8295
8296 # Ideally the wikipedia: prefix here should be proto-relative too
8297 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
8298 # define the 'en' prefix, and originally the test used 'wikipedia',
8299 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
8300 # article.
8301 !! test
8302 Different interwiki prefixes mapping to the same URL
8303 !! wikitext
8304 [[:en:Foo]]
8305
8306 [[:en:Foo|Foo]]
8307
8308 [[wikipedia:Foo]]
8309
8310 [[:wikipedia:Foo|Foo]]
8311
8312 [[wikipedia:en:Foo]]
8313
8314 [[:wikipedia:en:Foo]]
8315
8316 [[ wikiPEdia :Foo]]
8317 !! html/parsoid
8318 <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>
8319
8320 <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>
8321
8322 <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>
8323
8324 <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>
8325
8326 <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>
8327
8328 <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>
8329
8330 <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>
8331 !! end
8332
8333 !! test
8334 Interwiki links that cannot be represented in wiki syntax
8335 !! wikitext
8336 [[meatball:ok]]
8337 [[meatball:ok#foo|ok with fragment]]
8338 [[meatball:ok_as_well?|ok ending with ? mark]]
8339 [http://de.wikipedia.org/wiki/Foo?action=history has query]
8340 [http://de.wikipedia.org/wiki/#foo is just fragment]
8341
8342 !! html/php
8343 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
8344 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
8345 <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>
8346 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8347 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
8348 </p>
8349 !! html/parsoid
8350 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
8351 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
8352 <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>
8353 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8354 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
8355 !! end
8356
8357 !! test
8358 Interwiki links: trail
8359 !! wikitext
8360 [[wikipedia:Foo|Ba]]r
8361 !! html/php
8362 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
8363 </p>
8364 !! html/parsoid
8365 <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>
8366 !! end
8367
8368 !! test
8369 Local interwiki link
8370 !! options
8371 parsoid=wt2html,wt2wt,html2html
8372 !! wikitext
8373 [[local:Template:Foo]]
8374 !! html/php
8375 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
8376 </p>
8377 !! html/parsoid
8378 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
8379 !! end
8380
8381 # Parsoid does not mark self-links, by design.
8382 !! test
8383 Local interwiki link: self-link to current page
8384 !! options
8385 title=[[Main Page]]
8386 parsoid=wt2html,wt2wt,html2html
8387 !! wikitext
8388 [[local:Main Page]]
8389 !! html/php
8390 <p><strong class="selflink">local:Main Page</strong>
8391 </p>
8392 !! html/parsoid
8393 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
8394 !! end
8395
8396 !! test
8397 Local interwiki link: prefix only (bug 64167)
8398 !! options
8399 parsoid=wt2html,wt2wt,html2html
8400 !! wikitext
8401 [[local:]]
8402 !! html/php
8403 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
8404 </p>
8405 !! html/parsoid
8406 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
8407 !! end
8408
8409 !! test
8410 Local interwiki link: with additional interwiki prefix (bug 61357)
8411 !! options
8412 parsoid=wt2html,wt2wt,html2html
8413 !! wikitext
8414 [[local:meatball:Hello]]
8415 !! html/php
8416 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8417 </p>
8418 !! html/parsoid
8419 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8420 !! end
8421
8422 !! test
8423 Multiple local interwiki link prefixes
8424 !! wikitext
8425 [[local:local:local:local:mi:local:Foo]]
8426 !! options
8427 parsoid=wt2html,wt2wt,html2html
8428 !! html/php
8429 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8430 </p>
8431 !! html/parsoid
8432 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8433 !! end
8434
8435 ###
8436 ### Interlanguage links
8437 ### Language links (so that searching for '### language' matches..)
8438 ###
8439
8440 !! test
8441 Interlanguage link
8442 !! wikitext
8443 Blah blah blah
8444 [[zh:Chinese]]
8445 !! html/php
8446 <p>Blah blah blah
8447 </p>
8448 !! html/parsoid
8449 <p>Blah blah blah</p>
8450 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8451 !! end
8452
8453 ## parsoid html2wt will lose the space variations
8454 !! test
8455 Interlanguage link with spacing
8456 !! options
8457 parsoid=wt2html,wt2wt,html2html
8458 !! wikitext
8459 Blah blah blah
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://zh.wikipedia.org/wiki/Chinese"/>
8467 !! end
8468
8469 !! test
8470 Double interlanguage link
8471 !! wikitext
8472 Blah blah blah
8473 [[es:Spanish]]
8474 [[zh:Chinese]]
8475 !! html/php
8476 <p>Blah blah blah
8477 </p>
8478 !! html/parsoid
8479 <p>Blah blah blah</p>
8480 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8481 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8482 !! end
8483
8484 ## parsoid html2wt will lose the space variations
8485 !! test
8486 Interlanguage link variations
8487 !! options
8488 parsoid=wt2html,wt2wt,html2html
8489 !! wikitext
8490 Blah blah blah
8491 [[ es :Spanish]]
8492 [[ ZH :Chinese]]
8493 [[es:Foo_bar]]
8494 !! html/php
8495 <p>Blah blah blah
8496 </p>
8497 !! html/parsoid
8498 <p>Blah blah blah</p>
8499 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
8500 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
8501 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
8502 !! end
8503
8504 ## parsoid html2wt will normalize the space to _
8505 !! test
8506 Space and question mark encoding in interlanguage links (T95473)
8507 !! options
8508 parsoid=wt2html,wt2wt,html2html
8509 !! wikitext
8510 Blah blah blah
8511 [[es:Foo bar?]]
8512 !! html/php
8513 <p>Blah blah blah
8514 </p>
8515 !! html/parsoid
8516 <p>Blah blah blah</p>
8517 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
8518 !! end
8519
8520 !! test
8521 Interlanguage link, with prefix links
8522 !! options
8523 language=ln
8524 !! wikitext
8525 Blah blah blah
8526 [[zh:Chinese]]
8527 !! html/php
8528 <p>Blah blah blah
8529 </p>
8530 !! html/parsoid
8531 <p>Blah blah blah</p>
8532 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8533 !! end
8534
8535 !! test
8536 Double interlanguage link, with prefix links (bug 8897)
8537 !! options
8538 language=ln
8539 !! wikitext
8540 Blah blah blah
8541 [[es:Spanish]]
8542 [[zh:Chinese]]
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" href="http://es.wikipedia.org/wiki/Spanish"/>
8549 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8550 !! end
8551
8552 !! test
8553 "Extra" interlanguage links (bug 32189 / gerrit 111390)
8554 !! wikitext
8555 Blah blah blah
8556 [[mul:Article]]
8557 !! html/php
8558 <p>Blah blah blah
8559 </p>
8560 !! html/parsoid
8561 <p>Blah blah blah</p>
8562 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
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 if $wgInterwikiMagic=false
8569 !! options
8570 wgInterwikiMagic=false
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 ## PHP parser tests script needs an update
8580 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
8581 !! test
8582 Language links render as inline links in the Talk namespace
8583 !! options
8584 title=Talk:Foo
8585 parsoid=wt2html,wt2wt,html2html
8586 !! wikitext
8587 Blah blah blah
8588 [[zh:Chinese]]
8589 !! html/parsoid
8590 <p>Blah blah blah <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
8591 !! end
8592
8593 !! test
8594 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
8595 !! options
8596 language=ln
8597 !! wikitext
8598 [[WW&nbsp;II]]
8599 !! html
8600 <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>
8601 </p>
8602 !! end
8603
8604 !! test
8605 Parsoid bug 53221: Wikilinks should be properly entity-escaped
8606 !! options
8607 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
8608 !! html/parsoid
8609 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8610 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8611 !! wikitext
8612 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
8613
8614 He&amp;nbsp;llo He&amp;nbsp;llo
8615 !! html/php
8616 <p>He&amp;nbsp;llo <a href="/wiki/Foo" title="Foo">He&amp;nbsp;llo</a>
8617 </p><p>He&amp;nbsp;llo He&amp;nbsp;llo
8618 </p>
8619 !! end
8620
8621 # html2wt will fail because of title normalization without data-parsoid
8622 !! test
8623 Parsoid: handle constructor well
8624 !! options
8625 parsoid=wt2html,wt2wt
8626 !! wikitext
8627 [[constructor]]
8628
8629 [[constructor:foo]]
8630 !! html/php
8631 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
8632 </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>
8633 </p>
8634 !! html/parsoid
8635 <p><a rel="mw:WikiLink" href="./Constructor" title="Constructor" data-parsoid='{"stx":"simple","a":{"href":"./Constructor"},"sa":{"href":"constructor"}}'>constructor</a></p>
8636
8637 <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>
8638 !! end
8639
8640 !! article
8641 ko:
8642 !! text
8643 Test.
8644 !! endarticle
8645
8646 # Note that `ko` isn't a known interlanguage prefix
8647 !! test
8648 Parsoid: recognize interlanguage links without a target page
8649 !! options
8650 ill
8651 !! wikitext
8652 [[es:]]
8653
8654 [[ko:]]
8655 !! html/php
8656 es:
8657 !! html/parsoid
8658 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
8659
8660 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8661 !! end
8662
8663 # Note that `ko` isn't a known interwiki prefix
8664 !! test
8665 Parsoid: recognize interwiki links without a target page
8666 !! options
8667 parsoid=wt2html,wt2wt,html2html
8668 !! wikitext
8669 [[:es:]]
8670
8671 [[:ko:]]
8672 !! html/php
8673 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
8674 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
8675 </p>
8676 !! html/parsoid
8677 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
8678 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8679 !! end
8680
8681 !! test
8682 Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
8683 !! wikitext
8684 [[mi:Foo]]
8685 !! html/php
8686 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
8687 </p>
8688 !! html/parsoid
8689 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
8690 !! end
8691
8692 !! test
8693 Interlanguage link with preceding local interwiki link (bug 68085)
8694 !! options
8695 parsoid=wt2html,wt2wt,html2html
8696 !! wikitext
8697 Blah blah blah
8698 [[local:es:Spanish]]
8699 !! html/php
8700 <p>Blah blah blah
8701 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
8702 </p>
8703 !! html/parsoid
8704 <p>Blah blah blah
8705 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
8706 !! end
8707
8708 !! test
8709 Looks like an interlanguage link, but is actually a local interwiki
8710 !! options
8711 parsoid=wt2html,wt2wt,html2html
8712 !! wikitext
8713 Blah blah blah
8714 [[mi:Template:Foo]]
8715 !! html/php
8716 <p>Blah blah blah
8717 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
8718 </p>
8719 !! html/parsoid
8720 <p>Blah blah blah
8721 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
8722 !! end
8723
8724 ###
8725 ### Redirects, Parsoid-only
8726 ###
8727
8728 !! test
8729 1. Simple redirect to page
8730 !! wikitext
8731 #REDIRECT [[Main Page]]
8732 !! html/parsoid
8733 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8734 !! end
8735
8736 !! test
8737 2. Other redirect variants
8738 !! wikitext
8739 #REDIRECT [[Main_Page]]
8740 !! html/parsoid
8741 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
8742 !! end
8743
8744 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
8745 # This tests the Parsoid bail-out code.
8746 !! test
8747 3. Other redirect variants
8748 !! wikitext
8749 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
8750 !! html/parsoid
8751 <ol><li data-parsoid>REDIRECT [[[[Bar]]]]</li></ol>
8752 !! end
8753
8754 !! test
8755 4. Redirect to a templated destination
8756 !! wikitext
8757 #REDIRECT [[{{echo|Foo}}bar]]
8758 !! html/parsoid
8759 <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"}]]}'/>
8760 !! end
8761
8762 !! test
8763 Empty redirect
8764 !! options
8765 parsoid=wt2html,wt2wt
8766 !! wikitext
8767 #REDIRECT [[]]
8768 !! html/parsoid
8769 <ol>
8770 <li>REDIRECT [[]]</li></ol>
8771 !! end
8772
8773 !! test
8774 Optional colon in #REDIRECT
8775 !! options
8776 # the colon is archaic syntax. we support it for wt2html, but we
8777 # don't care that it roundtrips back to the modern syntax.
8778 parsoid=wt2html,html2html
8779 !! wikitext
8780 #REDIRECT:[[Main Page]]
8781 !! html/parsoid
8782 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8783 !! end
8784
8785 !! test
8786 Whitespace in #REDIRECT with optional colon
8787 !! options
8788 # the colon and gratuitous whitespace is archaic syntax. we support
8789 # it for wt2html, but we don't care that it roundtrips back to the
8790 # modern syntax (without extra whitespace)
8791 parsoid=wt2html,html2html
8792 !! wikitext
8793
8794 #REDIRECT
8795 :
8796 [[Main Page]]
8797 !! html/parsoid
8798 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8799 !! end
8800
8801 !! test
8802 Piped link in #REDIRECT
8803 !! options
8804 # content after piped link is ignored. we support this syntax,
8805 # but don't care that the piped link is lost when we roundtrip this.
8806 parsoid=wt2html
8807 !! wikitext
8808 #REDIRECT [[Main Page|bar]]
8809 !! html/parsoid
8810 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8811 !! end
8812
8813 !! test
8814 Redirect to category (T104502)
8815 !! options
8816 parsoid=wt2html,wt2wt
8817 !! wikitext
8818 #REDIRECT [[Category:Foo]]
8819 !! html/parsoid
8820 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8821 !! end
8822
8823 !! test
8824 Redirect to category with URL encoding (T104502)
8825 !! options
8826 parsoid=wt2html
8827 !! wikitext
8828 #REDIRECT [[Category%3AFoo]]
8829 !! html/parsoid
8830 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8831 !! end
8832
8833 !! test
8834 Redirect to category page
8835 !! wikitext
8836 #REDIRECT [[:Category:Foo]]
8837 !! html/parsoid
8838 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8839 !! end
8840
8841 !! test
8842 Redirect to image page (1)
8843 !! wikitext
8844 #REDIRECT [[File:Wiki.png]]
8845 !! html/parsoid
8846 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
8847 !! end
8848
8849 !! test
8850 Redirect to image page (2)
8851 !! wikitext
8852 #REDIRECT [[Image:Wiki.png]]
8853 !! html/parsoid
8854 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
8855 !! end
8856
8857 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
8858 # Next test confirms this.
8859 !! test
8860 Redirect to language (1) (T104918)
8861 !! options
8862 parsoid=wt2html,wt2wt,html2html
8863 !! wikitext
8864 #REDIRECT [[en:File:Wiki.png]]
8865 !! html/parsoid
8866 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8867 !! end
8868
8869 !! test
8870 Redirect to language (2) (T104918)
8871 !! wikitext
8872 #REDIRECT [[:en:File:Wiki.png]]
8873 !! html/parsoid
8874 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8875 !! end
8876
8877 !! test
8878 Redirect to interwiki (T104918)
8879 !! wikitext
8880 #REDIRECT [[meatball:File:Wiki.png]]
8881 !! html/parsoid
8882 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
8883 !! end
8884
8885 !! test
8886 Non-English #REDIRECT
8887 !! options
8888 language=is
8889 !! wikitext
8890 #TILVÍSUN [[Main Page]]
8891 !! html/parsoid
8892 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
8893 !! end
8894
8895 !! test
8896 Redirect syntax under text isn't considered a redirect
8897 !! wikitext
8898 some text
8899 #redirect [[Main Page]]
8900 !! html/parsoid
8901 <p>some text</p>
8902 <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>
8903 !! end
8904
8905 # FIXME: Should hoist the redirect to the top of the page and ensure there
8906 # is only one.
8907 !! test
8908 New redirect
8909 !! options
8910 parsoid=html2wt
8911 !! html/parsoid
8912 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
8913 !! wikitext
8914 Foo
8915 #REDIRECT [[Foo]]
8916 !! end
8917
8918 ##
8919 ## XHTML tidiness
8920 ###
8921
8922 !! test
8923 <br> to <br />
8924 !! wikitext
8925 1<br>2<br />3
8926 !! html
8927 <p>1<br />2<br />3
8928 </p>
8929 !! end
8930
8931 !! test
8932 Broken br tag sanitization
8933 !! wikitext
8934 </br>
8935 !! html/php
8936 <p>&lt;/br&gt;
8937 </p>
8938 !! end
8939
8940 # TODO: Fix html2html mode (bug 51055)!
8941 !! test
8942 Parsoid: Broken br tag recognition
8943 !! options
8944 parsoid=wt2html
8945 !! wikitext
8946 </br>
8947
8948 <br/ >
8949 !! html+tidy
8950 <p><br /></p>
8951 <p><br /></p>
8952 !! end
8953
8954 !! test
8955 Incorrecly removing closing slashes from correctly formed XHTML
8956 !! wikitext
8957 <br style="clear:both;" />
8958 !! html
8959 <p><br style="clear:both;" />
8960 </p>
8961 !! end
8962
8963 !! test
8964 Failing to transform badly formed HTML into correct XHTML
8965 !! wikitext
8966 <br style="clear: left;">
8967 <br style="clear: right;">
8968 <br style="clear: both;">
8969 !! html
8970 <p><br style="clear: left;" />
8971 <br style="clear: right;" />
8972 <br style="clear: both;" />
8973 </p>
8974 !!end
8975
8976 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
8977 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
8978 !! test
8979 Handling html with a div self-closing tag
8980 !! wikitext
8981 <div title />
8982 <div title/>
8983 <div title/ >
8984 <div title=bar />
8985 <div title=bar/>
8986 <div title=bar/ >
8987 !! html/php
8988 <p>&lt;div title /&gt;
8989 &lt;div title/&gt;
8990 </p>
8991 <div>
8992 <p>&lt;div title=bar /&gt;
8993 &lt;div title=bar/&gt;
8994 </p>
8995 <div title="bar/"></div>
8996 </div>
8997
8998 !! html/parsoid
8999 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9000 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9001 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
9002 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9003 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9004 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
9005 !! end
9006
9007 !! test
9008 Handling html with a br self-closing tag
9009 !! wikitext
9010 <br title />
9011 <br title/>
9012 <br title/ >
9013 <br title=bar />
9014 <br title=bar/>
9015 <br title=bar/ >
9016 !! html/php
9017 <p><br title="" />
9018 <br title="" />
9019 <br />
9020 <br title="bar" />
9021 <br title="bar" />
9022 <br title="bar/" />
9023 </p>
9024 !! html/parsoid
9025 <p><br title="" />
9026 <br title="" />
9027 <br title="" />
9028 <br title="bar" />
9029 <br title="bar" />
9030 <br title="bar/" />
9031 </p>
9032 !! end
9033
9034 !! test
9035 Horizontal ruler (should it add that extra space?)
9036 !! wikitext
9037 <hr>
9038 <hr >
9039 foo <hr
9040 > bar
9041 !! html+tidy
9042 <hr />
9043 <hr />
9044 <p>foo</p>
9045 <hr />
9046 <p>bar</p>
9047 !! end
9048
9049 !! test
9050 Horizontal ruler -- 4+ dashes render hr
9051 !! wikitext
9052 ----
9053 !! html
9054 <hr />
9055
9056 !! end
9057
9058 !! test
9059 Horizontal ruler -- eats additional dashes on the same line
9060 !! wikitext
9061 ---------
9062 !! html
9063 <hr />
9064
9065 !! end
9066
9067 !! test
9068 Horizontal ruler -- does not collapse dashes on consecutive lines
9069 !! wikitext
9070 ----
9071 ----
9072 !! html
9073 <hr />
9074 <hr />
9075
9076 !! end
9077
9078 !! test
9079 Horizontal ruler -- <4 dashes render as plain text
9080 !! wikitext
9081 ---
9082 !! html
9083 <p>---
9084 </p>
9085 !! end
9086
9087 !! test
9088 Horizontal ruler -- Supports content following dashes on same line
9089 !! wikitext
9090 ---- Foo
9091 !! html
9092 <hr /> Foo
9093
9094 !! html+tidy
9095 <hr />
9096 <p>Foo</p>
9097 !! end
9098
9099 ###
9100 ### Block-level elements
9101 ###
9102 !! test
9103 Common list
9104 !! wikitext
9105 *Common list
9106 * item 2
9107 *item 3
9108 !! html
9109 <ul><li>Common list</li>
9110 <li> item 2</li>
9111 <li>item 3</li></ul>
9112
9113 !! end
9114
9115 !! test
9116 Numbered list
9117 !! wikitext
9118 #Numbered list
9119 #item 2
9120 # item 3
9121 !! html
9122 <ol><li>Numbered list</li>
9123 <li>item 2</li>
9124 <li> item 3</li></ol>
9125
9126 !! end
9127
9128 !! test
9129 Mixed list
9130 !! wikitext
9131 *Mixed list
9132 *# with numbers
9133 ** and bullets
9134 *# and numbers
9135 *bullets again
9136 **bullet level 2
9137 ***bullet level 3
9138 ***#Number on level 4
9139 **bullet level 2
9140 **#Number on level 3
9141 **#Number on level 3
9142 *#number level 2
9143 *Level 1
9144 *** Level 3
9145 #** Level 3, but ordered
9146 !! html
9147 <ul><li>Mixed list
9148 <ol><li> with numbers</li></ol>
9149 <ul><li> and bullets</li></ul>
9150 <ol><li> and numbers</li></ol></li>
9151 <li>bullets again
9152 <ul><li>bullet level 2
9153 <ul><li>bullet level 3
9154 <ol><li>Number on level 4</li></ol></li></ul></li>
9155 <li>bullet level 2
9156 <ol><li>Number on level 3</li>
9157 <li>Number on level 3</li></ol></li></ul>
9158 <ol><li>number level 2</li></ol></li>
9159 <li>Level 1
9160 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
9161 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
9162
9163 !! end
9164
9165 !! test
9166 1. Nested mixed wikitext and html list
9167 !! wikitext
9168 * hi
9169 * <ul><li>ho</li></ul>
9170 * hi
9171 ** ho
9172 !! html/php
9173 <ul><li> hi</li>
9174 <li> <ul><li>ho</li></ul></li>
9175 <li> hi
9176 <ul><li> ho</li></ul></li></ul>
9177
9178 !! html/parsoid
9179 <ul><li> hi</li>
9180 <li> <ul data-parsoid='{"stx":"html"}'><li data-parsoid='{"stx":"html"}'>ho</li></ul></li>
9181 <li> hi
9182 <ul><li> ho</li></ul></li></ul>
9183 !! end
9184
9185 !! test
9186 2. Nested mixed wikitext and html list (incompatible)
9187 !! wikitext
9188 ; hi
9189 : {{echo|<li>ho</li>}}
9190 !! html/php
9191 <dl><dt> hi</dt>
9192 <dd> <li>ho</li></dd></dl>
9193
9194 !! html/parsoid
9195 <dl><dt> hi</dt>
9196 <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>
9197 !! end
9198
9199 !! test
9200 Nested lists 1
9201 !! wikitext
9202 *foo
9203 **bar
9204 !! html
9205 <ul><li>foo
9206 <ul><li>bar</li></ul></li></ul>
9207
9208 !! end
9209
9210 !! test
9211 Nested lists 2
9212 !! wikitext
9213 **foo
9214 *bar
9215 !! html
9216 <ul><li><ul><li>foo</li></ul></li>
9217 <li>bar</li></ul>
9218
9219 !! end
9220
9221 !! test
9222 Nested lists 3 (first element empty)
9223 !! wikitext
9224 *
9225 **bar
9226 !! html
9227 <ul><li>
9228 <ul><li>bar</li></ul></li></ul>
9229
9230 !! end
9231
9232 !! test
9233 Nested lists 4 (first element empty)
9234 !! wikitext
9235 **
9236 *bar
9237 !! html
9238 <ul><li><ul><li></li></ul></li>
9239 <li>bar</li></ul>
9240
9241 !! end
9242
9243 !! test
9244 Nested lists 5 (both elements empty)
9245 !! wikitext
9246 **
9247 *
9248 !! html
9249 <ul><li><ul><li></li></ul></li>
9250 <li></li></ul>
9251
9252 !! end
9253
9254 !! test
9255 Nested lists 6 (both elements empty)
9256 !! wikitext
9257 *
9258 **
9259 !! html
9260 <ul><li>
9261 <ul><li></li></ul></li></ul>
9262
9263 !! end
9264
9265 !! test
9266 Nested lists 7 (skip initial nesting levels)
9267 !! wikitext
9268 *** foo
9269 !! html
9270 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
9271
9272 !! end
9273
9274 !! test
9275 Nested lists 8 (multiple nesting transitions)
9276 !! wikitext
9277 * foo
9278 *** bar
9279 ** baz
9280 * boo
9281 !! html
9282 <ul><li> foo
9283 <ul><li><ul><li> bar</li></ul></li>
9284 <li> baz</li></ul></li>
9285 <li> boo</li></ul>
9286
9287 !! end
9288
9289 !! test
9290 Nested lists 9 (extension interaction)
9291 !! options
9292 parsoid
9293 !! wikitext
9294 *<references />
9295 !! html/parsoid
9296 <ul><li data-parsoid='{}'><ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
9297 !! end
9298
9299 !! test
9300 1. Lists with start-of-line-transparent tokens before bullets: Comments
9301 !! wikitext
9302 *foo
9303 *<!--cmt-->bar
9304 <!--cmt-->*baz
9305 !! html
9306 <ul><li>foo</li>
9307 <li>bar</li>
9308 <li>baz</li></ul>
9309
9310 !! end
9311
9312 !! test
9313 2. Lists with start-of-line-transparent tokens before bullets: Template close
9314 !! wikitext
9315 *foo {{echo|bar
9316 }}*baz
9317 !! html
9318 <ul><li>foo bar</li>
9319 <li>baz</li></ul>
9320
9321 !! end
9322
9323 !! test
9324 List items are not parsed correctly following a <pre> block (bug 785)
9325 !! wikitext
9326 * <pre>foo</pre>
9327 * <pre>bar</pre>
9328 * zar
9329 !! html/php
9330 <ul><li> <pre>foo</pre></li>
9331 <li> <pre>bar</pre></li>
9332 <li> zar</li></ul>
9333
9334 !! html/parsoid
9335 <ul><li> <pre data-parsoid='{"stx":"html"}'>foo</pre></li>
9336 <li> <pre data-parsoid='{"stx":"html"}'>bar</pre></li>
9337 <li> zar</li></ul>
9338 !! end
9339
9340 !! test
9341 List items from template
9342 !! wikitext
9343
9344 {{inner list}}
9345 * item 2
9346
9347 * item 0
9348 {{inner list}}
9349 * item 2
9350
9351 * item 0
9352 * notSOL{{inner list}}
9353 * item 2
9354 !! html
9355 <ul><li> item 1</li>
9356 <li> item 2</li></ul>
9357 <ul><li> item 0</li>
9358 <li> item 1</li>
9359 <li> item 2</li></ul>
9360 <ul><li> item 0</li>
9361 <li> notSOL</li>
9362 <li> item 1</li>
9363 <li> item 2</li></ul>
9364
9365 !! end
9366
9367 !! test
9368 List interrupted by empty line or heading
9369 !! wikitext
9370 * foo
9371
9372 ** bar
9373 == A heading ==
9374 * Another list item
9375 !! html
9376 <ul><li> foo</li></ul>
9377 <ul><li><ul><li> bar</li></ul></li></ul>
9378 <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>
9379 <ul><li> Another list item</li></ul>
9380
9381 !!end
9382
9383 !!test
9384 Multiple list tags generated by templates
9385 !! wikitext
9386 {{echo|<li>}}a
9387 {{echo|<li>}}b
9388 {{echo|<li>}}c
9389 !! html
9390 <li>a
9391 <li>b
9392 <li>c</li>
9393 </li>
9394 </li>
9395
9396 !! html+tidy
9397 <ul>
9398 <li>a</li>
9399 <li>b</li>
9400 <li>c</li>
9401 </ul>
9402 !!end
9403
9404 !!test
9405 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
9406 !! wikitext
9407 *a
9408 <!--This line will NOT split the list-->
9409 *b
9410 <!--This line will NOT split the list either-->
9411 *c
9412 <!--foo--> <!----> <!--This line NOT split the list either-->
9413 *d
9414 !! html
9415 <ul><li>a</li>
9416 <li>b</li>
9417 <li>c</li>
9418 <li>d</li></ul>
9419
9420 !!end
9421
9422 !!test
9423 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
9424 !! wikitext
9425 *a
9426 <!--This line will NOT split the list-->
9427 *b
9428 <!--This line will NOT split the list either-->
9429 *c
9430 <!--foo--> <!----> <!--This line NOT split the list
9431 either-->
9432 *d
9433 !! html
9434 <ul><li>a</li>
9435 <li>b</li>
9436 <li>c</li>
9437 <li>d</li></ul>
9438
9439 !!end
9440
9441 !!test
9442 Test the li-hack
9443 (The PHP parser relies on Tidy for the hack)
9444 !!options
9445 parsoid=wt2html,wt2wt
9446 !! wikitext
9447 * foo
9448 * <li>li-hack
9449 * {{echo|<li>templated li-hack}}
9450 * <!--foo--> <li> unsupported li-hack with preceding comments
9451
9452 <ul>
9453 <li><li>not a li-hack
9454 </li>
9455 </ul>
9456 !! html+tidy
9457 <ul>
9458 <li>foo</li>
9459 <li>li-hack</li>
9460 <li>templated li-hack</li>
9461 <li>unsupported li-hack with preceding comments</li>
9462 </ul>
9463 <ul>
9464 <li>not a li-hack</li>
9465 </ul>
9466 !!end
9467
9468 !! test
9469 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
9470 !! options
9471 parsoid
9472 !! wikitext
9473 # foo
9474 ## bar
9475 * foo
9476 ** bar
9477 : foo
9478 :: bar
9479 !! html
9480 <ol>
9481 <li> foo<ol>
9482 <li> bar</li>
9483 </ol></li>
9484 </ol><ul>
9485 <li> foo<ul>
9486 <li> bar</li>
9487 </ul></li>
9488 </ul><dl>
9489 <dd> foo<dl>
9490 <dd> bar</dd>
9491 </dl></dd>
9492 </dl>
9493 !! end
9494
9495 !! test
9496 Parsoid: Test of whitespace serialization with Templated bullets
9497 !! options
9498 parsoid
9499 !! wikitext
9500 * {{bullet}}
9501 !! html
9502 <ul>
9503 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
9504 </ul>
9505 !! end
9506
9507 # ------------------------------------------------------------------------
9508 # The next set of tests are about Parsoid's ability to handle badly nested
9509 # tags (parse, minimize scope of fixup, and roundtrip back)
9510 # ------------------------------------------------------------------------
9511
9512 !! test
9513 Unbalanced closing block tags break a list
9514 (php parser relies on Tidy to fix up)
9515 !! wikitext
9516 <div>
9517 *a</div><div>
9518 *b</div>
9519 !! html+tidy
9520 <div>
9521 <ul>
9522 <li>a</li>
9523 </ul>
9524 </div>
9525 <div>
9526 <ul>
9527 <li>b</li>
9528 </ul>
9529 </div>
9530 !! end
9531
9532 # Parsoid fails this test, but it might be tricky to support properly.
9533 # See bug 68395.
9534 !! test
9535 Unbalanced closing non-block tags don't break a list
9536 (php parser relies on Tidy to fix up)
9537 !! wikitext
9538 <span>
9539 *a</span><span>
9540 *b</span>
9541 !! html/php+tidy
9542 <ul>
9543 <li><span>a</span></li>
9544 <li><span>b</span></li>
9545 </ul>
9546 !! html/parsoid
9547 <span>
9548 <ul>
9549 <li>a<span></span>
9550 </li>
9551 <li>b
9552 </li>
9553 </ul>
9554 </span>
9555 !! end
9556
9557 !! test
9558 Unclosed formatting tags that straddle lists are closed and reopened
9559 (php parser relies on Tidy to fix up)
9560 !! options
9561 parsoid=wt2html,wt2wt,html2html
9562 !! wikitext
9563 # <s> a
9564 # b </s>
9565 !! html/php+tidy
9566 <ol>
9567 <li><s>a</s></li>
9568 <li><s>b</s></li>
9569 </ol>
9570 !! html/parsoid
9571 <ol><li> <s> a</s></li>
9572 <li><s> b </s></li></ol>
9573 !! end
9574
9575 # See bug 68395.
9576 !!test
9577 1. List embedded in a formatting tag
9578 !! wikitext
9579 <small>
9580 * foo
9581 </small>
9582 !! html/php+tidy
9583 <ul>
9584 <li><small>foo</small></li>
9585 </ul>
9586 !! html/parsoid
9587 <small>
9588 <ul>
9589 <li> foo</li>
9590 </ul>
9591 </small>
9592 !!end
9593
9594 ## Ugly Parsoid output here
9595 ## Not sure what the right output is.
9596 !!test
9597 2. List embedded in a formatting tag
9598 !! wikitext
9599 <small>
9600 *a
9601 *b</small>
9602 !! html/php+tidy
9603 <ul>
9604 <li><small>a</small></li>
9605 <li><small>b</small></li>
9606 </ul>
9607 !! html/parsoid
9608 <small></small>
9609 <ul><small>
9610 <li>a</li>
9611 </small>
9612 <li><small>b</small></li>
9613 </ul>
9614 !!end
9615
9616 # Ugly Parsoid and PHP parser output here
9617 # Not sure if we want to make this a test!
9618 #
9619 ## !!test
9620 ## 3. Unclosed formatting tags in list elements
9621 ## !! wikitext
9622 ## *<small>a
9623 ## *<small>b
9624 ## !! html/php+tidy
9625 ## <ul>
9626 ## <li><small>a</small></li>
9627 ## <li><small><small>b</small></small></li>
9628 ## </ul>
9629 ## !! html/parsoid
9630 ## <ul>
9631 ## <li><small>a</small></li>
9632 ## <small>
9633 ## <li><small>b</small></li>
9634 ## </small></ul>
9635 ## !!end
9636
9637 # This is a bug in the PHP parser + tidy combination.
9638 # (The </tr> tag gets parsed as text and html-escaped by PHP,
9639 # and then fostered out of the table by tidy.)
9640 # We believe the Parsoid output to be correct.
9641 !! test
9642 Table with missing opening <tr> tag
9643 !! options
9644 parsoid=wt2html,wt2wt
9645 !! wikitext
9646 <table>
9647 <td>foo</td>
9648 </tr>
9649 </table>
9650 !! html+tidy
9651 <table>
9652 <tr>
9653 <td>foo</td>
9654 </tr>
9655 </table>
9656 !! end
9657
9658 ###
9659 ### Magic Words
9660 ###
9661
9662 # Note that the current date is hard-coded as
9663 # 1970-01-01T00:02:03Z (a Thursday)
9664 # when running parser tests. The timezone is also fixed to GMT, so
9665 # local date will be identical to current date.
9666
9667 !! test
9668 Magic Word: {{CURRENTDAY}}
9669 !! wikitext
9670 {{CURRENTDAY}}
9671 !! html
9672 <p>1
9673 </p>
9674 !! end
9675
9676 !! test
9677 Magic Word: {{CURRENTDAY2}}
9678 !! wikitext
9679 {{CURRENTDAY2}}
9680 !! html
9681 <p>01
9682 </p>
9683 !! end
9684
9685 !! test
9686 Magic Word: {{CURRENTDAYNAME}}
9687 !! wikitext
9688 {{CURRENTDAYNAME}}
9689 !! html
9690 <p>Thursday
9691 </p>
9692 !! end
9693
9694 !! test
9695 Magic Word: {{CURRENTDOW}}
9696 !! wikitext
9697 {{CURRENTDOW}}
9698 !! html
9699 <p>4
9700 </p>
9701 !! end
9702
9703 !! test
9704 Magic Word: {{CURRENTMONTH}}
9705 !! wikitext
9706 {{CURRENTMONTH}}
9707 !! html
9708 <p>01
9709 </p>
9710 !! end
9711
9712 !! test
9713 Magic Word: {{CURRENTMONTH1}}
9714 !! wikitext
9715 {{CURRENTMONTH1}}
9716 !! html
9717 <p>1
9718 </p>
9719 !! end
9720
9721 !! test
9722 Magic Word: {{CURRENTMONTHABBREV}}
9723 !! wikitext
9724 {{CURRENTMONTHABBREV}}
9725 !! html
9726 <p>Jan
9727 </p>
9728 !! end
9729
9730 !! test
9731 Magic Word: {{CURRENTMONTHNAME}}
9732 !! wikitext
9733 {{CURRENTMONTHNAME}}
9734 !! html
9735 <p>January
9736 </p>
9737 !! end
9738
9739 !! test
9740 Magic Word: {{CURRENTMONTHNAMEGEN}}
9741 !! wikitext
9742 {{CURRENTMONTHNAMEGEN}}
9743 !! html
9744 <p>January
9745 </p>
9746 !! end
9747
9748 !! test
9749 Magic Word: {{CURRENTTIME}}
9750 !! wikitext
9751 {{CURRENTTIME}}
9752 !! html
9753 <p>00:02
9754 </p>
9755 !! end
9756
9757 !! test
9758 Magic Word: {{CURRENTHOUR}}
9759 !! wikitext
9760 {{CURRENTHOUR}}
9761 !! html
9762 <p>00
9763 </p>
9764 !! end
9765
9766 !! test
9767 Magic Word: {{CURRENTWEEK}} (@bug 4594)
9768 !! wikitext
9769 {{CURRENTWEEK}}
9770 !! html
9771 <p>1
9772 </p>
9773 !! end
9774
9775 !! test
9776 Magic Word: {{CURRENTYEAR}}
9777 !! wikitext
9778 {{CURRENTYEAR}}
9779 !! html
9780 <p>1970
9781 </p>
9782 !! end
9783
9784 !! test
9785 Magic Word: {{CURRENTTIMESTAMP}}
9786 !! wikitext
9787 {{CURRENTTIMESTAMP}}
9788 !! html
9789 <p>19700101000203
9790 </p>
9791 !! end
9792
9793 !! test
9794 Magic Words LOCAL (UTC)
9795 !! wikitext
9796 * {{LOCALMONTH}}
9797 * {{LOCALMONTH1}}
9798 * {{LOCALMONTHNAME}}
9799 * {{LOCALMONTHNAMEGEN}}
9800 * {{LOCALMONTHABBREV}}
9801 * {{LOCALDAY}}
9802 * {{LOCALDAY2}}
9803 * {{LOCALDAYNAME}}
9804 * {{LOCALYEAR}}
9805 * {{LOCALTIME}}
9806 * {{LOCALHOUR}}
9807 * {{LOCALWEEK}}
9808 * {{LOCALDOW}}
9809 * {{LOCALTIMESTAMP}}
9810 !! html
9811 <ul><li> 01</li>
9812 <li> 1</li>
9813 <li> January</li>
9814 <li> January</li>
9815 <li> Jan</li>
9816 <li> 1</li>
9817 <li> 01</li>
9818 <li> Thursday</li>
9819 <li> 1970</li>
9820 <li> 00:02</li>
9821 <li> 00</li>
9822 <li> 1</li>
9823 <li> 4</li>
9824 <li> 19700101000203</li></ul>
9825
9826 !! end
9827
9828 !! test
9829 Magic Word: {{FULLPAGENAME}}
9830 !! options
9831 title=[[User:Ævar Arnfjörð Bjarmason]]
9832 !! wikitext
9833 {{FULLPAGENAME}}
9834 !! html
9835 <p>User:Ævar Arnfjörð Bjarmason
9836 </p>
9837 !! end
9838
9839 !! test
9840 Magic Word: {{FULLPAGENAMEE}}
9841 !! options
9842 title=[[User:Ævar Arnfjörð Bjarmason]]
9843 !! wikitext
9844 {{FULLPAGENAMEE}}
9845 !! html
9846 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9847 </p>
9848 !! end
9849
9850 !! test
9851 Magic Word: {{TALKSPACE}}
9852 !! options
9853 title=[[User:Ævar Arnfjörð Bjarmason]]
9854 !! wikitext
9855 {{TALKSPACE}}
9856 !! html
9857 <p>User talk
9858 </p>
9859 !! end
9860
9861 !! test
9862 Magic Word: {{TALKSPACE}}, same namespace
9863 !! options
9864 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9865 !! wikitext
9866 {{TALKSPACE}}
9867 !! html
9868 <p>User talk
9869 </p>
9870 !! end
9871
9872 !! test
9873 Magic Word: {{TALKSPACE}}, main namespace
9874 !! options
9875 title=[[Parser Test]]
9876 !! wikitext
9877 {{TALKSPACE}}
9878 !! html
9879 <p>Talk
9880 </p>
9881 !! end
9882
9883 !! test
9884 Magic Word: {{TALKSPACEE}}
9885 !! options
9886 title=[[User:Ævar Arnfjörð Bjarmason]]
9887 !! wikitext
9888 {{TALKSPACEE}}
9889 !! html
9890 <p>User_talk
9891 </p>
9892 !! end
9893
9894 !! test
9895 Magic Word: {{SUBJECTSPACE}}
9896 !! options
9897 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9898 !! wikitext
9899 {{SUBJECTSPACE}}
9900 !! html
9901 <p>User
9902 </p>
9903 !! end
9904
9905 !! test
9906 Magic Word: {{SUBJECTSPACE}}, same namespace
9907 !! options
9908 title=[[User:Ævar Arnfjörð Bjarmason]]
9909 !! wikitext
9910 {{SUBJECTSPACE}}
9911 !! html
9912 <p>User
9913 </p>
9914 !! end
9915
9916 !! test
9917 Magic Word: {{SUBJECTSPACE}}, main namespace
9918 !! options
9919 title=[[Parser Test]]
9920 !! wikitext
9921 {{SUBJECTSPACE}}
9922 !! html
9923
9924 !! end
9925
9926 !! test
9927 Magic Word: {{SUBJECTSPACEE}}
9928 !! options
9929 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9930 !! wikitext
9931 {{SUBJECTSPACEE}}
9932 !! html
9933 <p>User
9934 </p>
9935 !! end
9936
9937 !! test
9938 Magic Word: {{NAMESPACE}}
9939 !! options
9940 title=[[User:Ævar Arnfjörð Bjarmason]]
9941 !! wikitext
9942 {{NAMESPACE}}
9943 !! html
9944 <p>User
9945 </p>
9946 !! end
9947
9948 !! test
9949 Magic Word: {{NAMESPACEE}}
9950 !! options
9951 title=[[User:Ævar Arnfjörð Bjarmason]]
9952 !! wikitext
9953 {{NAMESPACEE}}
9954 !! html
9955 <p>User
9956 </p>
9957 !! end
9958
9959 !! test
9960 Magic Word: {{NAMESPACENUMBER}}
9961 !! options
9962 title=[[User:Ævar Arnfjörð Bjarmason]]
9963 !! wikitext
9964 {{NAMESPACENUMBER}}
9965 !! html
9966 <p>2
9967 </p>
9968 !! end
9969
9970 !! test
9971 Magic Word: {{SUBPAGENAME}}
9972 !! options
9973 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9974 !! wikitext
9975 {{SUBPAGENAME}}
9976 !! html
9977 <p>sub ö
9978 </p>
9979 !! end
9980
9981 !! test
9982 Magic Word: {{SUBPAGENAMEE}}
9983 !! options
9984 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9985 !! wikitext
9986 {{SUBPAGENAMEE}}
9987 !! html
9988 <p>sub_%C3%B6
9989 </p>
9990 !! end
9991
9992 !! test
9993 Magic Word: {{ROOTPAGENAME}}
9994 !! options
9995 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9996 !! wikitext
9997 {{ROOTPAGENAME}}
9998 !! html
9999 <p>Ævar Arnfjörð Bjarmason
10000 </p>
10001 !! end
10002
10003 !! test
10004 Magic Word: {{ROOTPAGENAMEE}}
10005 !! options
10006 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10007 !! wikitext
10008 {{ROOTPAGENAMEE}}
10009 !! html
10010 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10011 </p>
10012 !! end
10013
10014 !! test
10015 Magic Word: {{BASEPAGENAME}}
10016 !! options
10017 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10018 !! wikitext
10019 {{BASEPAGENAME}}
10020 !! html
10021 <p>Ævar Arnfjörð Bjarmason
10022 </p>
10023 !! end
10024
10025 !! test
10026 Magic Word: {{BASEPAGENAMEE}}
10027 !! options
10028 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10029 !! wikitext
10030 {{BASEPAGENAMEE}}
10031 !! html
10032 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10033 </p>
10034 !! end
10035
10036 !! test
10037 Magic Word: {{TALKPAGENAME}}
10038 !! options
10039 title=[[User:Ævar Arnfjörð Bjarmason]]
10040 !! wikitext
10041 {{TALKPAGENAME}}
10042 !! html
10043 <p>User talk:Ævar Arnfjörð Bjarmason
10044 </p>
10045 !! end
10046
10047 !! test
10048 Magic Word: {{TALKPAGENAMEE}}
10049 !! options
10050 title=[[User:Ævar Arnfjörð Bjarmason]]
10051 !! wikitext
10052 {{TALKPAGENAMEE}}
10053 !! html
10054 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10055 </p>
10056 !! end
10057
10058 !! test
10059 Magic Word: {{SUBJECTPAGENAME}}
10060 !! options
10061 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10062 !! wikitext
10063 {{SUBJECTPAGENAME}}
10064 !! html
10065 <p>User:Ævar Arnfjörð Bjarmason
10066 </p>
10067 !! end
10068
10069 !! test
10070 Magic Word: {{SUBJECTPAGENAMEE}}
10071 !! options
10072 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10073 !! wikitext
10074 {{SUBJECTPAGENAMEE}}
10075 !! html
10076 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10077 </p>
10078 !! end
10079
10080 !! test
10081 Magic Word: {{NUMBEROFFILES}}
10082 !! wikitext
10083 {{NUMBEROFFILES}}
10084 !! html
10085 <p>7
10086 </p>
10087 !! end
10088
10089 !! test
10090 Magic Word: {{PAGENAME}}
10091 !! options
10092 title=[[User:Ævar Arnfjörð Bjarmason]]
10093 !! wikitext
10094 {{PAGENAME}}
10095 !! html
10096 <p>Ævar Arnfjörð Bjarmason
10097 </p>
10098 !! end
10099
10100 !! test
10101 Magic Word: {{PAGENAME}} with metacharacters
10102 !! options
10103 title=[['foo & bar = baz']]
10104 !! wikitext
10105 ''{{PAGENAME}}''
10106 !! html/php
10107 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
10108 </p>
10109 !! html+tidy
10110 <p><i>'foo &amp; bar = baz'</i></p>
10111 !! end
10112
10113 !! test
10114 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
10115 !! options
10116 title=[[*RFC 1234 http://example.com/]]
10117 !! wikitext
10118 {{PAGENAME}}
10119 !! html/php
10120 <p>&#42;RFC&#32;1234 http&#58;//example.com/
10121 </p>
10122 !! html+tidy
10123 <p>*RFC 1234 http://example.com/</p>
10124 !! end
10125
10126 !! test
10127 Magic Word: {{PAGENAMEE}}
10128 !! options
10129 title=[[User:Ævar Arnfjörð Bjarmason]]
10130 !! wikitext
10131 {{PAGENAMEE}}
10132 !! html
10133 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10134 </p>
10135 !! end
10136
10137 !! test
10138 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
10139 !! options
10140 title=[[*RFC 1234 http://example.com/]]
10141 !! wikitext
10142 {{PAGENAMEE}}
10143 !! html/php
10144 <p>&#42;RFC_1234_http&#58;//example.com/
10145 </p>
10146 !! html+tidy
10147 <p>*RFC_1234_http://example.com/</p>
10148 !! end
10149
10150 !! test
10151 Magic Word: {{REVISIONID}}
10152 !! wikitext
10153 {{REVISIONID}}
10154 !! html
10155 <p>1337
10156 </p>
10157 !! end
10158
10159 !! test
10160 Magic Word: {{SCRIPTPATH}}
10161 !! wikitext
10162 {{SCRIPTPATH}}
10163 !! html
10164
10165 !! end
10166
10167 !! test
10168 Magic Word: {{STYLEPATH}}
10169 !! wikitext
10170 {{STYLEPATH}}
10171 !! html
10172 <p>/skins
10173 </p>
10174 !! end
10175
10176 !! test
10177 Magic Word: {{SERVER}}
10178 !! wikitext
10179 {{SERVER}}
10180 !! html
10181 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10182 </p>
10183 !! end
10184
10185 !! test
10186 Magic Word: {{SERVERNAME}}
10187 !! wikitext
10188 {{SERVERNAME}}
10189 !! html
10190 <p>example.org
10191 </p>
10192 !! end
10193
10194 !! test
10195 Magic Word: {{SITENAME}}
10196 !! wikitext
10197 {{SITENAME}}
10198 !! html
10199 <p>MediaWiki
10200 </p>
10201 !! end
10202
10203 !! test
10204 Case-sensitive magic words, when cased differently, should just be template transclusions
10205 !! wikitext
10206 {{CurrentMonth}}
10207 {{currentday}}
10208 {{cURreNTweEK}}
10209 {{currentHour}}
10210 !! html
10211 <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>
10212 <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>
10213 <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>
10214 <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>
10215 </p>
10216 !! end
10217
10218 !! test
10219 Case-insensitive magic words should still work with weird casing.
10220 !! wikitext
10221 {{sErVeRNaMe}}
10222 {{LCFirst:AOEU}}
10223 {{ucFIRST:aoeu}}
10224 {{SERver}}
10225 !! html
10226 <p>example.org
10227 aOEU
10228 Aoeu
10229 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10230 </p>
10231 !! end
10232
10233 # From plwiki:PLOS_ONE
10234 !! test
10235 Parsoid: Page property magic word with magic word contents
10236 !! wikitext
10237 {{DISPLAYTITLE:''{{PAGENAME}}''}}
10238 !! html/parsoid
10239 <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>"}]]}'/>
10240 !! end
10241
10242 !! test
10243 Parsoid: Template-generated DISPLAYTITLE
10244 !! wikitext
10245 {{{{echo|DISPLAYTITLE}}:Foo}}
10246 !! html/parsoid
10247 <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}}]}'/>
10248 !! end
10249
10250 !! test
10251 Namespace 1 {{ns:1}}
10252 !! wikitext
10253 {{ns:1}}
10254 !! html
10255 <p>Talk
10256 </p>
10257 !! end
10258
10259 !! test
10260 Namespace 1 {{ns:01}}
10261 !! wikitext
10262 {{ns:01}}
10263 !! html
10264 <p>Talk
10265 </p>
10266 !! end
10267
10268 !! test
10269 Namespace 0 {{ns:0}} (bug 4783)
10270 !! wikitext
10271 {{ns:0}}
10272 !! html
10273
10274 !! end
10275
10276 !! test
10277 Namespace 0 {{ns:00}} (bug 4783)
10278 !! wikitext
10279 {{ns:00}}
10280 !! html
10281
10282 !! end
10283
10284 !! test
10285 Namespace -1 {{ns:-1}}
10286 !! wikitext
10287 {{ns:-1}}
10288 !! html
10289 <p>Special
10290 </p>
10291 !! end
10292
10293 !! test
10294 Namespace User {{ns:User}}
10295 !! wikitext
10296 {{ns:User}}
10297 !! html
10298 <p>User
10299 </p>
10300 !! end
10301
10302 !! test
10303 Namespace User talk {{ns:User_talk}}
10304 !! wikitext
10305 {{ns:User_talk}}
10306 !! html
10307 <p>User talk
10308 </p>
10309 !! end
10310
10311 !! test
10312 Namespace User talk {{ns:uSeR tAlK}}
10313 !! wikitext
10314 {{ns:uSeR tAlK}}
10315 !! html
10316 <p>User talk
10317 </p>
10318 !! end
10319
10320 !! test
10321 Namespace File {{ns:File}}
10322 !! wikitext
10323 {{ns:File}}
10324 !! html
10325 <p>File
10326 </p>
10327 !! end
10328
10329 !! test
10330 Namespace File {{ns:Image}}
10331 !! wikitext
10332 {{ns:Image}}
10333 !! html
10334 <p>File
10335 </p>
10336 !! end
10337
10338 !! test
10339 Namespace (lang=de) Benutzer {{ns:User}}
10340 !! options
10341 language=de
10342 !! wikitext
10343 {{ns:User}}
10344 !! html
10345 <p>Benutzer
10346 </p>
10347 !! end
10348
10349 !! test
10350 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
10351 !! options
10352 language=de
10353 !! wikitext
10354 {{ns:3}}
10355 !! html
10356 <p>Benutzer Diskussion
10357 </p>
10358 !! end
10359
10360
10361 !! test
10362 Urlencode
10363 !! wikitext
10364 {{urlencode:hi world?!}}
10365 {{urlencode:hi world?!|WIKI}}
10366 {{urlencode:hi world?!|PATH}}
10367 {{urlencode:hi world?!|QUERY}}
10368 !! html
10369 <p>hi+world%3F%21
10370 hi_world%3F!
10371 hi%20world%3F%21
10372 hi+world%3F%21
10373 </p>
10374 !! end
10375
10376 !! test
10377 Magic Word: prioritize type info over data-parsoid
10378 !! options
10379 parsoid=html2wt
10380 !! html/parsoid
10381 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
10382 !! wikitext
10383 __FORCETOC__
10384 !! end
10385
10386 !! test
10387 Magic Word: serialize on separate line (parsoid)
10388 !! options
10389 parsoid=wt2wt,html2wt
10390 !! wikitext
10391 foo
10392 __NOTOC__
10393 bar
10394 !! html/parsoid
10395 foo<meta property="mw:PageProp/notoc"/>bar
10396 !! end
10397
10398 !! test
10399 Magic Word: rt non-english wikis
10400 !! options
10401 parsoid=wt2wt
10402 language=de
10403 !! wikitext
10404 __NOEDITSECTION__
10405 !! html/parsoid
10406 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
10407 !! end
10408
10409 !!test
10410 __proto__ is treated as normal wikitext (T105997)
10411 !!wikitext
10412 __proto__
10413 !!html
10414 <p>__proto__
10415 </p>
10416 !!end
10417
10418 ###
10419 ### Magic links
10420 ###
10421 !! test
10422 Magic links: internal link to RFC (bug 479)
10423 !! wikitext
10424 [[RFC 123]]
10425 !! html/php
10426 <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>
10427 </p>
10428 !! html/parsoid
10429 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
10430 !! end
10431
10432 !! test
10433 Magic links: RFC (bug 479)
10434 !! wikitext
10435 RFC 822
10436 !! html/php
10437 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10438 </p>
10439 !! html/parsoid
10440 <p><a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a></p>
10441 !! end
10442
10443 !! test
10444 Magic links: RFC (bug 65278)
10445 !! wikitext
10446 This is RFC 822 but thisRFC 822 is not RFC 822linked.
10447 !! html/php
10448 <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.
10449 </p>
10450 !! html/parsoid
10451 <p>This is <a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a> but thisRFC 822 is not RFC 822linked.</p>
10452 !! end
10453
10454 !! test
10455 Magic links: RFC (w/ non-newline whitespace, bug 28950/29025)
10456 !! wikitext
10457 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
10458 RFC
10459 822
10460 !! html/php
10461 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10462 RFC
10463 822
10464 </p>
10465 !! html/parsoid
10466 <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>
10467 RFC
10468 822</p>
10469 !! end
10470
10471 !! test
10472 Magic links: ISBN (bug 1937)
10473 !! wikitext
10474 ISBN 0-306-40615-2
10475 !! html/php
10476 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
10477 </p>
10478 !! html/parsoid
10479 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
10480 !! end
10481
10482 !! test
10483 Magic links: ISBN (bug 65278)
10484 !! wikitext
10485 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
10486 !! html/php
10487 <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.
10488 </p>
10489 !! html/parsoid
10490 <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>
10491 !! end
10492
10493 !! test
10494 Magic links: ISBN (w/ non-newline whitespace, bug 28950/29025)
10495 !! wikitext
10496 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
10497 ISBN
10498 9780316098113
10499 ISBN 978
10500 0316098113
10501 !! html/php
10502 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
10503 ISBN
10504 9780316098113
10505 ISBN 978
10506 0316098113
10507 </p>
10508 !! html/parsoid
10509 <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>
10510 ISBN
10511 9780316098113
10512 ISBN 978
10513 0316098113</p>
10514 !! end
10515
10516 !! test
10517 Magic links: PMID incorrectly converts space to underscore
10518 !! wikitext
10519 PMID 1234
10520 !! html/php
10521 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10522 </p>
10523 !! html/parsoid
10524 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a></p>
10525 !! end
10526
10527 !! test
10528 Magic links: PMID (bug 65278)
10529 !! wikitext
10530 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
10531 !! html/php
10532 <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.
10533 </p>
10534 !! html/parsoid
10535 <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>
10536 !! end
10537
10538 !! test
10539 Magic links: PMID (w/ non-newline whitespace, bug 28950/29025)
10540 !! wikitext
10541 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
10542 PMID
10543 1234
10544 !! html/php
10545 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10546 PMID
10547 1234
10548 </p>
10549 !! html/parsoid
10550 <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>
10551 PMID
10552 1234</p>
10553 !! end
10554
10555 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
10556 # since these are ExtLinkText, not MagicLinkText
10557 !! test
10558 Magic links: use appropriate serialization for "almost" magic links.
10559 !! wikitext
10560 X[[Special:BookSources/0978739256|foo]]
10561
10562 X[//tools.ietf.org/html/rfc1234 foo]
10563 !! html/php
10564 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
10565 </p><p>X<a rel="nofollow" class="external text" href="//tools.ietf.org/html/rfc1234">foo</a>
10566 </p>
10567 !! html/parsoid
10568 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
10569 <p>X<a rel="mw:ExtLink" href="//tools.ietf.org/html/rfc1234">foo</a></p>
10570 !! end
10571
10572 !! test
10573 Magic links: All disabled (T47942)
10574 !! options
10575 wgEnableMagicLinks={"ISBN":false, "PMID":false, "RFC":false}
10576 !! wikitext
10577 ISBN 0-306-40615-2
10578 PMID 1234
10579 RFC 4321
10580 !! html/php
10581 <p>ISBN 0-306-40615-2
10582 PMID 1234
10583 RFC 4321
10584 </p>
10585 !! end
10586
10587 ###
10588 ### Templates
10589 ####
10590
10591 !! test
10592 Nonexistent template
10593 !! wikitext
10594 {{thistemplatedoesnotexist}}
10595 !! html
10596 <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>
10597 </p>
10598 !! end
10599
10600 !! test
10601 Template with invalid target containing tags
10602 !! wikitext
10603 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10604 !! html
10605 <p>{{a<b>b</b>|foo|a=b|a = b}}
10606 </p>
10607 !! end
10608
10609 !! test
10610 Template with invalid target containing unclosed tag
10611 !! wikitext
10612 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10613 !! html
10614 <p>{{a<b>|foo|a=b|a = b}}</b>
10615 </p>
10616 !! end
10617
10618 !! test
10619 Template with invalid target containing wikilink
10620 !! wikitext
10621 {{[[Main Page]]}}
10622 !! html/php
10623 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
10624 </p>
10625 !! html/parsoid
10626 <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>
10627 !! end
10628
10629 !! test
10630 Template with just whitespace in it, bug #68421
10631 !! wikitext
10632 {{echo|{{ }}}}
10633 !! html/parsoid
10634 <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>
10635 !! end
10636
10637 !! article
10638 Template:test
10639 !! text
10640 This is a test template
10641 !! endarticle
10642
10643 !! test
10644 Simple template
10645 !! wikitext
10646 {{test}}
10647 !! html
10648 <p>This is a test template
10649 </p>
10650 !! end
10651
10652 !! test
10653 Template with explicit namespace
10654 !! wikitext
10655 {{Template:test}}
10656 !! html
10657 <p>This is a test template
10658 </p>
10659 !! end
10660
10661
10662 !! article
10663 Template:paramtest
10664 !! text
10665 This is a test template with parameter {{{param}}}
10666 !! endarticle
10667
10668 !! test
10669 Template parameter
10670 !! wikitext
10671 {{paramtest|param=foo}}
10672 !! html
10673 <p>This is a test template with parameter foo
10674 </p>
10675 !! end
10676
10677 !! article
10678 Template:paramtestnum
10679 !! text
10680 [[{{{1}}}|{{{2}}}]]
10681 !! endarticle
10682
10683 !! test
10684 Template unnamed parameter
10685 !! wikitext
10686 {{paramtestnum|Main Page|the main page}}
10687 !! html
10688 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
10689 </p>
10690 !! end
10691
10692 !! article
10693 Template:templatesimple
10694 !! text
10695 (test)
10696 !! endarticle
10697
10698 !! article
10699 Template:templateredirect
10700 !! text
10701 #redirect [[Template:templatesimple]]
10702 !! endarticle
10703
10704 !! article
10705 Template:templateasargtestnum
10706 !! text
10707 {{{{{1}}}}}
10708 !! endarticle
10709
10710 !! article
10711 Template:templateasargtest
10712 !! text
10713 {{template{{{templ}}}}}
10714 !! endarticle
10715
10716 !! article
10717 Template:templateasargtest2
10718 !! text
10719 {{{{{templ}}}}}
10720 !! endarticle
10721
10722 !! test
10723 Template with template name as unnamed argument
10724 !! wikitext
10725 {{templateasargtestnum|templatesimple}}
10726 !! html
10727 <p>(test)
10728 </p>
10729 !! end
10730
10731 !! test
10732 Template with template name as argument
10733 !! wikitext
10734 {{templateasargtest|templ=simple}}
10735 !! html
10736 <p>(test)
10737 </p>
10738 !! end
10739
10740 !! test
10741 Template with template name as argument (2)
10742 !! wikitext
10743 {{templateasargtest2|templ=templatesimple}}
10744 !! html
10745 <p>(test)
10746 </p>
10747 !! end
10748
10749 !! article
10750 Template:templateasargtestdefault
10751 !! text
10752 {{{{{templ|templatesimple}}}}}
10753 !! endarticle
10754
10755 !! article
10756 Template:templa
10757 !! text
10758 '''templ'''
10759 !! endarticle
10760
10761 !! test
10762 Template with default value
10763 !! wikitext
10764 {{templateasargtestdefault}}
10765 !! html
10766 <p>(test)
10767 </p>
10768 !! end
10769
10770 !! test
10771 Template with default value (value set)
10772 !! wikitext
10773 {{templateasargtestdefault|templ=templa}}
10774 !! html
10775 <p><b>templ</b>
10776 </p>
10777 !! end
10778
10779 !! test
10780 Template redirect
10781 !! wikitext
10782 {{templateredirect}}
10783 !! html/php
10784 <p>(test)
10785 </p>
10786 !! html/parsoid
10787 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
10788 !! end
10789
10790 !! test
10791 Template with argument in separate line
10792 !! wikitext
10793 {{ templateasargtest |
10794 templ = simple }}
10795 !! html
10796 <p>(test)
10797 </p>
10798 !! end
10799
10800 !! test
10801 Template with complex template as argument
10802 !! wikitext
10803 {{paramtest|
10804 param ={{ templateasargtest |
10805 templ = simple }}}}
10806 !! html
10807 <p>This is a test template with parameter (test)
10808 </p>
10809 !! end
10810
10811 !! test
10812 Template with thumb image (with link in description)
10813 !! wikitext
10814 {{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
10815 !! html/php
10816 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>
10817
10818 !! html+tidy
10819 <p>This is a test template with parameter</p>
10820 <div class="thumb tright">
10821 <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>
10822 <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>
10823 </div>
10824 </div>
10825 !! html/parsoid
10826 <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>
10827 !! end
10828
10829 !! article
10830 Template:complextemplate
10831 !! text
10832 {{{1}}} {{paramtest|
10833 param ={{{param}}}}}
10834 !! endarticle
10835
10836 !! test
10837 Template with complex arguments
10838 !! wikitext
10839 {{complextemplate|
10840 param ={{ templateasargtest |
10841 templ = simple }}|[[Template:complextemplate|link]]}}
10842 !! html
10843 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
10844 </p>
10845 !! end
10846
10847 !! test
10848 BUG 553: link with two variables in a piped link
10849 !! wikitext
10850 {|
10851 |[[{{{1}}}|{{{2}}}]]
10852 |}
10853 !! html/php
10854 <table>
10855 <tr>
10856 <td>[[{{{1}}}|{{{2}}}]]
10857 </td></tr></table>
10858
10859 !! html/parsoid
10860 <table>
10861 <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>
10862 !! end
10863
10864 # See: T2553
10865 !! test
10866 Abort table cell attribute parsing on wikilink
10867 !! wikitext
10868 {|
10869 | testing [[one|two]] | three || four
10870 | testing one two | three || four
10871 | testing="[[one|two]]" | three || four
10872 |}
10873 !! html/php
10874 <table>
10875 <tr>
10876 <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>
10877 <td> four
10878 </td>
10879 <td> three </td>
10880 <td> four
10881 </td>
10882 <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>
10883 <td> four
10884 </td></tr></table>
10885
10886 !! html/parsoid
10887 <table>
10888 <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>
10889 <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>
10890 <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>
10891 </tbody></table>
10892 !! end
10893
10894 !! test
10895 Don't abort table cell attribute parsing if wikilink is found in template arg
10896 !! wikitext
10897 {|
10898 | Test {{#tag:ref|One two "[[three]]" four}}
10899 |}
10900 !! html/parsoid
10901 <table>
10902 <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>
10903 </tbody></table>
10904 !! end
10905
10906 !! test
10907 Magic variable as template parameter
10908 !! wikitext
10909 {{paramtest|param={{SITENAME}}}}
10910 !! html
10911 <p>This is a test template with parameter MediaWiki
10912 </p>
10913 !! end
10914
10915 !! article
10916 Template:linktest
10917 !! text
10918 [[{{{param}}}|link]]
10919 !! endarticle
10920
10921 !! test
10922 Template parameter as link source
10923 !! wikitext
10924 {{linktest|param=Main Page}}
10925 !! html
10926 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
10927 </p>
10928 !! end
10929
10930 !!article
10931 Template:paramtest2
10932 !! text
10933 including another template, {{paramtest|param={{{arg}}}}}
10934 !! endarticle
10935
10936 !! test
10937 Template passing argument to another template
10938 !! wikitext
10939 {{paramtest2|arg='hmm'}}
10940 !! html
10941 <p>including another template, This is a test template with parameter 'hmm'
10942 </p>
10943 !! end
10944
10945 !! article
10946 Template:Linktest2
10947 !! text
10948 Main Page
10949 !! endarticle
10950
10951 !! test
10952 Template as link source
10953 !! wikitext
10954 [[{{linktest2}}]]
10955
10956 [[{{linktest2}}|Main Page]]
10957
10958 [[{{linktest2}}]]Page
10959 !! html
10960 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10961 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10962 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
10963 </p>
10964 !! end
10965
10966
10967 !! article
10968 Template:loop1
10969 !! text
10970 {{loop2}}
10971 !! endarticle
10972
10973 !! article
10974 Template:loop2
10975 !! text
10976 {{loop1}}
10977 !! endarticle
10978
10979 !! test
10980 Template infinite loop
10981 !! wikitext
10982 {{loop1}}
10983 !! html
10984 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
10985 </p>
10986 !! end
10987
10988 !! test
10989 Template from main namespace
10990 !! wikitext
10991 {{:Main Page}}
10992 !! html
10993 <p>blah blah
10994 </p>
10995 !! end
10996
10997 !! article
10998 Template:table
10999 !! text
11000 {|
11001 | 1 || 2
11002 |-
11003 | 3 || 4
11004 |}
11005 !! endarticle
11006
11007 !! test
11008 BUG 529: Template with table, not included at beginning of line
11009 !! wikitext
11010 foo {{table}}
11011 !! html
11012 <p>foo
11013 </p>
11014 <table>
11015 <tr>
11016 <td> 1 </td>
11017 <td> 2
11018 </td></tr>
11019 <tr>
11020 <td> 3 </td>
11021 <td> 4
11022 </td></tr></table>
11023
11024 !! end
11025
11026 !! test
11027 BUG 523: Template shouldn't eat newline (or add an extra one before table)
11028 !! wikitext
11029 foo
11030 {{table}}
11031 !! html
11032 <p>foo
11033 </p>
11034 <table>
11035 <tr>
11036 <td> 1 </td>
11037 <td> 2
11038 </td></tr>
11039 <tr>
11040 <td> 3 </td>
11041 <td> 4
11042 </td></tr></table>
11043
11044 !! end
11045
11046 !! test
11047 BUG 41: Template parameters shown as broken links
11048 !! wikitext
11049 {{{parameter}}}
11050 !! html
11051 <p>{{{parameter}}}
11052 </p>
11053 !! end
11054
11055 !! test
11056 Template with targets containing wikilinks
11057 !! wikitext
11058 {{[[foo]]}}
11059
11060 {{[[{{echo|foo}}]]}}
11061
11062 {{{{echo|[[foo}}]]}}
11063 !! html
11064 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11065 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11066 </p><p>{{[[foo}}]]
11067 </p>
11068 !! end
11069
11070 !! article
11071 Template:''
11072 !! text
11073 bar
11074 !! endarticle
11075
11076 !! test
11077 Templates: Double quotes as template target
11078 !! wikitext
11079 foo {{''}} baz
11080 !! html/php
11081 <p>foo bar baz
11082 </p>
11083 !! html/parsoid
11084 <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
11085 </p>
11086 !! end
11087
11088 ## This test is about making sure Parsoid's data-mw is well formed in the
11089 ## face of multiple templates with intersecting and overlapping ranges. The
11090 ## wikitext itself is wretched.
11091 !! test
11092 Templates with intersecting and overlapping ranges
11093 !! wikitext
11094 {|{{echo|
11095 <p>ha</p>}}
11096 {|{{echo|
11097 <p>ho</p>}}
11098 {{echo|{{!}}hi}}
11099 |}
11100 !! html/php+tidy
11101 <p>ha</p>
11102 <p>ho</p>
11103 <table>
11104 <tr>
11105 <td></td>
11106 </tr>
11107 <tr>
11108 <td>hi</td>
11109 </tr>
11110 </table>
11111 <table>
11112 <tr>
11113 <td></td>
11114 </tr>
11115 </table>
11116 !! html/parsoid
11117 <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":""}]]}'>
11118
11119 </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
11120
11121 <tbody><tr><td>hi</td></tr>
11122 </tbody></table>
11123 !! end
11124
11125 !! article
11126 Template:MSGNW test
11127 !! text
11128 ''None'' of '''this''' should be
11129 * interpreted
11130 but rather passed unmodified
11131 {{test}}
11132 <gallery>
11133 File:Foobar.jpg
11134 </gallery>
11135 <!-- comment -->
11136 !! endarticle
11137
11138 # hmm, fix this or just deprecate msgnw and document its behavior?
11139 !! test
11140 msgnw keyword
11141 !! wikitext
11142 {{msgnw:MSGNW test}}
11143 !! html/php
11144 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
11145 &#42; interpreted
11146 &#32;but rather passed unmodified
11147 &#123;&#123;test&#125;&#125;
11148 &#60;gallery&#62;
11149 File:Foobar.jpg
11150 &#60;/gallery&#62;
11151 &#60;!-- comment --&#62;
11152 </p>
11153 !! end
11154
11155 !! test
11156 int keyword
11157 !! wikitext
11158 {{int:youhavenewmessages|lots of money|not!}}
11159 !! html
11160 <p>You have lots of money (not!).
11161 </p>
11162 !! end
11163
11164 !! test
11165 int keyword - non-existing message
11166 !! wikitext
11167 {{int:var}}
11168 !! html
11169 <p>⧼var⧽
11170 </p>
11171 !! end
11172
11173 !! article
11174 Template:Includes
11175 !! text
11176 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11177 !! endarticle
11178
11179 !! test
11180 <includeonly> and <noinclude> being included
11181 !! wikitext
11182 {{Includes}}
11183 !! html
11184 <p>Foobar
11185 </p>
11186 !! end
11187
11188 !! article
11189 Template:Includes2
11190 !! text
11191 <onlyinclude>Foo</onlyinclude>bar
11192 !! endarticle
11193
11194 !! test
11195 <onlyinclude> being included
11196 !! wikitext
11197 {{Includes2}}
11198 !! html
11199 <p>Foo
11200 </p>
11201 !! end
11202
11203
11204 !! article
11205 Template:Includes3
11206 !! text
11207 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
11208 !! endarticle
11209
11210 !! test
11211 <onlyinclude> and <includeonly> being included
11212 !! wikitext
11213 {{Includes3}}
11214 !! html
11215 <p>Foo
11216 </p>
11217 !! end
11218
11219 !! test
11220 <includeonly> and <noinclude> on a page
11221 !! wikitext
11222 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11223 !! html
11224 <p>Foozar
11225 </p>
11226 !! end
11227
11228 !! test
11229 Un-closed <noinclude>
11230 !! wikitext
11231 <noinclude>
11232 !! html
11233 !! end
11234
11235 !! test
11236 <onlyinclude> on a page
11237 !! wikitext
11238 <onlyinclude>Foo</onlyinclude>bar
11239 !! html
11240 <p>Foobar
11241 </p>
11242 !! end
11243
11244 !! test
11245 Un-closed <onlyinclude>
11246 !! wikitext
11247 <onlyinclude>
11248 !! html
11249 !! end
11250
11251 !!test
11252 Self-closed noinclude, includeonly, onlyinclude tags
11253 !! wikitext
11254 <noinclude />
11255 <includeonly />
11256 <onlyinclude />
11257 !! html
11258 <p><br />
11259 </p>
11260 !!end
11261
11262 !!test
11263 Unbalanced includeonly and noinclude tags
11264 !! wikitext
11265 {|
11266 |a</noinclude>
11267 |b</noinclude></noinclude>
11268 |c</noinclude></includeonly>
11269 |d</includeonly></includeonly>
11270 |}
11271 !! html
11272 <table>
11273 <tr>
11274 <td>a
11275 </td>
11276 <td>b
11277 </td>
11278 <td>c&lt;/includeonly&gt;
11279 </td>
11280 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
11281 </td></tr></table>
11282
11283 !!end
11284
11285 !! article
11286 Template:Includeonly section
11287 !! text
11288 <includeonly>
11289 ==Includeonly section==
11290 </includeonly>
11291 ==Section T-1==
11292 !!endarticle
11293
11294 !! test
11295 Bug 6563: Edit link generation for section shown by <includeonly>
11296 !! wikitext
11297 {{includeonly section}}
11298 !! html
11299 <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>
11300 <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>
11301
11302 !! end
11303
11304 # Uses same input as the contents of [[Template:Includeonly section]]
11305 !! test
11306 Bug 6563: Section extraction for section shown by <includeonly>
11307 !! options
11308 section=T-2
11309 !! wikitext
11310 <includeonly>
11311 ==Includeonly section==
11312 </includeonly>
11313 ==Section T-2==
11314 !! html
11315 ==Section T-2==
11316 !! end
11317
11318 !! test
11319 Bug 6563: Edit link generation for section suppressed by <includeonly>
11320 !! wikitext
11321 <includeonly>
11322 ==Includeonly section==
11323 </includeonly>
11324 ==Section 1==
11325 !! html
11326 <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>
11327
11328 !! end
11329
11330 !! test
11331 Bug 6563: Section extraction for section suppressed by <includeonly>
11332 !! options
11333 section=1
11334 !! wikitext
11335 <includeonly>
11336 ==Includeonly section==
11337 </includeonly>
11338 ==Section 1==
11339 !! html
11340 ==Section 1==
11341 !! end
11342
11343 !! test
11344 Un-closed <includeonly>
11345 !! wikitext
11346 <includeonly>
11347 !! html/php
11348 !! html/parsoid
11349 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>"}'/>
11350 !! end
11351
11352 ## We used to, but no longer wt2wt this test since the default serializer
11353 ## will normalize the include directives to serialize on their own line.
11354 ## Selser will take care of preserving formatting in scenarios where they
11355 ## intermingled with other wikitext.
11356 !! test
11357 Includes and comments at SOL
11358 !! options
11359 parsoid=wt2html,html2html
11360 !! wikitext
11361 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
11362
11363 <noinclude>
11364 some
11365 </noinclude>* stuff
11366 * here
11367
11368 <includeonly>can have stuff</includeonly>=== here ===
11369
11370 !! html/php
11371 <h2><span class="mw-headline" id="hu">hu</span></h2>
11372 <p>some
11373 </p>
11374 <ul><li> stuff</li>
11375 <li> here</li></ul>
11376 <h3><span class="mw-headline" id="here">here</span></h3>
11377
11378 !! html/parsoid
11379 <!-- 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>
11380
11381 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
11382 <p>some</p>
11383 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
11384 <li> here</li></ul>
11385
11386 <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>
11387
11388 !! end
11389
11390 # TODO: test with DOM fragment reuse!
11391 !! test
11392 Parsoid: DOM fragment reuse
11393 !! options
11394 parsoid=wt2wt,wt2html
11395 !! wikitext
11396 a{{echo|b<table></table>c}}d
11397
11398 a{{echo|b
11399 <table></table>
11400 c}}d
11401
11402 {{echo|a
11403
11404 <table></table>
11405
11406 b}}
11407 !! html
11408 <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>
11409
11410 <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">
11411 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
11412 </span><p about="#mwt2">cd</p>
11413
11414 <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">
11415
11416 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
11417
11418 </span><p about="#mwt3">b</p>
11419 !! end
11420
11421 !! test
11422 Parsoid: Merge double tds (T52603)
11423 !! options
11424 parsoid
11425 !! wikitext
11426 {|
11427 |{{echo|{{!}} foo}}
11428 |}
11429 !! html
11430 <table><tbody>
11431 <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>
11432 </tbody></table>
11433 !! end
11434
11435 !! test
11436 Parsoid: Merge double tds in nested transclusion content (T52603)
11437 !! options
11438 parsoid
11439 !! wikitext
11440 {{echo|<div>}}
11441 {|
11442 |{{echo|{{!}} foo}}
11443 |}
11444 {{echo|</div>}}
11445 !! html
11446 <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}}]}'>
11447 <table><tbody>
11448 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
11449 </tbody></table>
11450 </div>
11451 !! end
11452
11453 ###
11454 ### <includeonly> and <noinclude> in attributes
11455 ###
11456 !!test
11457 0. includeonly around the entire attribute
11458 !! wikitext
11459 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
11460 !! html
11461 <p><span id="v2">bar</span>
11462 </p>
11463 !!end
11464
11465 !!test
11466 1. includeonly in html attr key
11467 !! wikitext
11468 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
11469 !! html
11470 <p><span id="foo">bar</span>
11471 </p>
11472 !!end
11473
11474 !!test
11475 2. includeonly in html attr value
11476 !! wikitext
11477 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
11478 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
11479 !! html
11480 <p><span id="v1">bar</span>
11481 <span id="v1">bar</span>
11482 </p>
11483 !!end
11484
11485 !!test
11486 3. includeonly in part of an attr value
11487 !! wikitext
11488 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
11489 !! html
11490 <p><span style="color:red;">bar</span>
11491 </p>
11492 !!end
11493
11494 !!test
11495 4. includeonly in table attributes
11496 !! wikitext
11497 {|
11498 |- <noinclude>
11499 |-
11500 |a
11501 </noinclude>
11502 |- <includeonly>
11503 |-
11504 |b
11505 </includeonly>
11506 |}
11507 !! html
11508 <table>
11509
11510
11511 <tr>
11512 <td>a
11513 </td></tr>
11514 </table>
11515
11516 !!end
11517
11518 ###
11519 ### Token Stream Patcher tests
11520 ###
11521 ### These tests won't always pass wt2wt and other modes because
11522 ### on serialization, the table will be output on a new line.
11523 ### For now, we are blacklisting them, and using this to test selser.
11524 ###
11525
11526 !!test
11527 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
11528 !!options
11529 parsoid=wt2html,wt2wt
11530 !!wikitext
11531 {{echo|}}{| width = '100%'
11532 |foo
11533 |}
11534 !!html/parsoid
11535 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
11536 <tbody><tr><td>foo</td></tr>
11537 </tbody></table>
11538 !!end
11539
11540 ## We used to, but no longer wt2wt this test since the default serializer
11541 ## will normalize the include directives to serialize on their own line.
11542 ## Selser will take care of preserving formatting in scenarios where they
11543 ## intermingled with other wikitext.
11544 !!test
11545 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
11546 !!options
11547 parsoid=wt2html
11548 !!wikitext
11549 <includeonly>a</includeonly>{| {{{b}}}
11550 |c
11551 |}
11552 !!html/parsoid
11553 <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":""}]]}'>
11554 <tbody><tr><td>c</td></tr>
11555 </tbody></table>
11556 !!end
11557
11558 !! test
11559 Table wikitext syntax outside wiki-tables
11560 !! wikitext
11561 a
11562 |+ not a caption
11563 ! not a table heading
11564 |- not a table row
11565 | not a table cell
11566 | class="foo bar" | baz
11567 b
11568 |}
11569 |-
11570 c
11571 !! html
11572 <p>a
11573 |+ not a caption
11574 ! not a table heading
11575 |- not a table row
11576 | not a table cell
11577 | class="foo bar" | baz
11578 b
11579 |}
11580 |-
11581 c
11582 </p>
11583 !! end
11584
11585 ###
11586 ### Testing parsing of templates where a template arg
11587 ### has the same name as the template itself.
11588 ###
11589
11590 !! article
11591 Template:quote
11592 !! text
11593 {{{quote|{{{1}}}}}}
11594 !! endarticle
11595
11596 !!test
11597 Templates: Template Name/Arg clash: 1. Use of positional param
11598 !! wikitext
11599 {{quote|foo}}
11600 !! html
11601 <p>foo
11602 </p>
11603 !!end
11604
11605 !!test
11606 Templates: Template Name/Arg clash: 2. Use of named param
11607 !! wikitext
11608 {{quote|quote=foo}}
11609 !! html
11610 <p>foo
11611 </p>
11612 !!end
11613
11614 !!test
11615 Templates: Template Name/Arg clash: 3. Use of named param with empty input
11616 !! wikitext
11617 {{quote|quote}}
11618 !! html
11619 <p>quote
11620 </p>
11621 !!end
11622
11623 ###
11624 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
11625 ###
11626
11627 !!test
11628 Templates: 1. Simple use
11629 !! wikitext
11630 {{echo|Foo}}
11631 !! html
11632 <p>Foo
11633 </p>
11634 !!end
11635
11636 !!test
11637 Templates: 2. Inside a block tag
11638 !! wikitext
11639 <div>{{echo|Foo}}</div>
11640 <blockquote>{{echo|Foo}}</blockquote>
11641 !! html
11642 <div>Foo</div>
11643 <blockquote>Foo</blockquote>
11644
11645 !! html+tidy
11646 <div>Foo</div>
11647 <blockquote>
11648 <p>Foo</p>
11649 </blockquote>
11650 !!end
11651
11652 !!test
11653 Templates: P-wrapping: 1a. Templates on consecutive lines
11654 !! wikitext
11655 {{echo|Foo}}
11656 {{echo|bar}}
11657 !! html
11658 <p>Foo
11659 bar
11660 </p>
11661 !!end
11662
11663 !!test
11664 Templates: P-wrapping: 1b. Templates on consecutive lines
11665 !! wikitext
11666 Foo
11667
11668 {{echo|bar}}
11669 {{echo|baz}}
11670 !! html
11671 <p>Foo
11672 </p><p>bar
11673 baz
11674 </p>
11675 !!end
11676
11677 !!test
11678 Templates: P-wrapping: 1c. Templates on consecutive lines
11679 !! wikitext
11680 {{echo|Foo}}
11681 {{echo|bar}} <div>baz</div>
11682 !! html
11683 <p>Foo
11684 </p>
11685 bar <div>baz</div>
11686
11687 !! html+tidy
11688 <p>Foo</p>
11689 <p>bar</p>
11690 <div>baz</div>
11691 !! end
11692
11693 !!test
11694 Templates: P-wrapping: 1d. Template preceded by comment-only line
11695 !!options
11696 parsoid
11697 !! wikitext
11698 <!-- foo -->
11699 {{echo|Bar}}
11700 !! html
11701 <!-- foo -->
11702
11703 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
11704 !!end
11705
11706 !!test
11707 Templates: Inline Text: 1. Multiple template uses
11708 !! wikitext
11709 {{echo|Foo}}bar{{echo|baz}}
11710 !! html
11711 <p>Foobarbaz
11712 </p>
11713 !!end
11714
11715 !!test
11716 Templates: Inline Text: 2. Back-to-back template uses
11717 !! wikitext
11718 {{echo|Foo}}{{echo|bar}}
11719 !! html
11720 <p>Foobar
11721 </p>
11722 !!end
11723
11724 !!test
11725 Templates: Block Tags: 1. Multiple template uses
11726 !! wikitext
11727 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
11728 !! html
11729 <div>Foo</div><div>bar</div><div>baz</div>
11730
11731 !!end
11732
11733 !!test
11734 Templates: Block Tags: 2. Back-to-back template uses
11735 !! wikitext
11736 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
11737 !! html
11738 <div>Foo</div><div>bar</div>
11739
11740 !!end
11741
11742 # This is an edge case relating to paragraph wrapping.
11743 !!test
11744 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
11745 !! wikitext
11746 {{echo|a
11747 b</p>}}
11748 !! html/parsoid
11749 <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
11750 b</p>
11751 !!end
11752
11753 !!test
11754 Templates: Links: 1. Simple example
11755 !! wikitext
11756 {{echo|[[Foo|bar]]}}
11757 !! html
11758 <p><a href="/wiki/Foo" title="Foo">bar</a>
11759 </p>
11760 !!end
11761
11762 !!test
11763 Templates: Links: 2. Generation of link href
11764 !! wikitext
11765 [[{{echo|Foo}}|bar]]
11766 !! html
11767 <p><a href="/wiki/Foo" title="Foo">bar</a>
11768 </p>
11769 !!end
11770
11771 !!test
11772 Templates: Links: 3. Generation of part of a link href
11773 !! wikitext
11774 [[Fo{{echo|o}}|bar]]
11775
11776 [[Foo{{echo|bar}}]]
11777
11778 [[Foo{{echo|bar}}baz]]
11779
11780 [[Foo{{echo|bar}}|bar]]
11781
11782 [[:Foo{{echo|bar}}]]
11783
11784 [[:Foo{{echo|bar}}|bar]]
11785 !! html
11786 <p><a href="/wiki/Foo" title="Foo">bar</a>
11787 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11788 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
11789 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11790 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11791 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11792 </p>
11793 !!end
11794
11795 !!test
11796 Templates: Links: 4. Multiple templates generating link href
11797 !! wikitext
11798 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
11799 !! html
11800 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11801 </p>
11802 !!end
11803
11804 !!test
11805 Templates: Links: 5. Generation of link text
11806 !! wikitext
11807 [[Foo|{{echo|bar}}]]
11808 !! html
11809 <p><a href="/wiki/Foo" title="Foo">bar</a>
11810 </p>
11811 !!end
11812
11813 !!test
11814 Templates: Links: 5. Nested templates (only outermost template should be marked)
11815 !! wikitext
11816 {{echo|[[{{echo|Foo}}|bar]]}}
11817 !! html
11818 <p><a href="/wiki/Foo" title="Foo">bar</a>
11819 </p>
11820 !!end
11821
11822 !!test
11823 Templates: HTML Tag: 1. Generation of HTML attr. key
11824 !! wikitext
11825 <div {{echo|style}}="color:red;">foo</div>
11826 !! html
11827 <div style="color:red;">foo</div>
11828
11829 !!end
11830
11831 !!test
11832 Templates: HTML Tag: 2. Generation of HTML attr. value
11833 !! wikitext
11834 <div style={{echo|'color:red;'}}>foo</div>
11835 !! html
11836 <div style="color:red;">foo</div>
11837
11838 !!end
11839
11840 !!test
11841 Templates: HTML Tag: 3. Generation of HTML attr key and value
11842 !! wikitext
11843 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
11844 !! html
11845 <div style="color:red;">foo</div>
11846
11847 !!end
11848
11849 !!test
11850 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
11851 !! wikitext
11852 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
11853 !! html
11854 <div title="This is a long title with just one piece templated">foo</div>
11855
11856 !!end
11857
11858 !!test
11859 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
11860 !! wikitext
11861 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
11862 !! html
11863 <div title="This is a long title with just one piece templated">foo</div>
11864
11865 !!end
11866
11867 !!test
11868 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
11869 !! wikitext
11870 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
11871 !! html
11872 <div title="This is a long title with just one piece templated">foo</div>
11873
11874 !!end
11875
11876 # SSS FIXME: While it is great we added support for all this,
11877 # do we want to make this part of the spec? Maybe we want to
11878 # deprecate this kind of usage in the future?
11879 !!test
11880 Templates: HTML Tag: 7. Generation of partial attribute key string
11881 !! wikitext
11882 <div st{{echo|yle}}="color:red;">foo</div>
11883 !! html
11884 <div style="color:red;">foo</div>
11885
11886 !!end
11887
11888 !! test
11889 Templates: HTML Tag: 8. Template-generated attribute (k=v)
11890 !! wikitext
11891 <div {{echo|1=id="v1"}}>bar</div>
11892 !! html
11893 <div id="v1">bar</div>
11894
11895 !!end
11896
11897 !! test
11898 Templates: HTML Tag: 9. Multiple template-generated attributes
11899 !! wikitext
11900 <div {{echo|1=id="v1" title="foo"}}>bar</div>
11901 !! html
11902 <div id="v1" title="foo">bar</div>
11903
11904 !!end
11905
11906 !! test
11907 Templates: Support for templates generating attributes and content
11908 !! wikitext
11909 {| {{mixed_attr_content_template}}
11910 |-
11911 |bar
11912 |}
11913 !! html/php
11914 <table style="color:red;" title="T48811">
11915
11916 <tr>
11917 <td>foo
11918 </td></tr>
11919 <tr>
11920 <td>bar
11921 </td></tr></table>
11922
11923 !! html/parsoid
11924 <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|}"]}'>
11925 <tbody><tr>
11926 <td>foo</td></tr>
11927 <tr>
11928 <td>bar</td></tr>
11929 </tbody></table>
11930 !!end
11931
11932 !! test
11933 1. Entities and nowikis inside templated attributes should be handled correctly
11934 !! wikitext
11935 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
11936 !! html/php
11937 <div style="background:#f9f9f9;">foo</div>
11938
11939 !! html/parsoid
11940 <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>
11941 !! end
11942
11943 !! test
11944 2. Entities and nowikis inside templated attributes should be handled correctly
11945 !! wikitext
11946 {|
11947 |{{table_attribs_3}}
11948 |}
11949 !! html/php
11950 <table>
11951 <tr>
11952 <td style="background:#f9f9f9;">Foo
11953 </td></tr></table>
11954
11955 !! html/parsoid
11956 <table>
11957 <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>
11958 </tbody></table>
11959 !! end
11960
11961 !! test
11962 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11963 !! wikitext
11964 {{tbl-start}}
11965 |{{table_attribs_3}}
11966 {{tbl-end}}
11967 !! html/php
11968 <table>
11969 <tr>
11970 <td style="background:#f9f9f9;">Foo
11971 </td></tr></table>
11972
11973 !! html/parsoid
11974 <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}}]}'>
11975 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
11976 </tbody></table>
11977 !! end
11978
11979 # T107622
11980 !! test
11981 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11982 !! wikitext
11983 {|
11984 | {{table_attribs_6}} hi
11985 |}
11986 !! html/php
11987 <table>
11988 <tr>
11989 <td style="background: red;"> hi
11990 </td></tr></table>
11991
11992 !! html/parsoid
11993 <table>
11994 <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>
11995 </tbody></table>
11996 !! end
11997
11998 !!test
11999 Templates: HTML Tables: 1. Generating start of a HTML table
12000 !! wikitext
12001 {{echo|<table><tr><td>foo</td>}}</tr></table>
12002 !! html
12003 <table><tr><td>foo</td></tr></table>
12004
12005 !!end
12006
12007 !!test
12008 Templates: HTML Tables: 2a. Generating middle of a HTML table
12009 !! wikitext
12010 <table><tr>{{echo|<td>foo</td>}}</tr></table>
12011 !! html
12012 <table><tr><td>foo</td></tr></table>
12013
12014 !!end
12015
12016 !!test
12017 Templates: HTML Tables: 2b. Generating middle of a HTML table
12018 !! wikitext
12019 <table>{{echo|<tr><td>foo</td></tr>}}</table>
12020 !! html
12021 <table><tr><td>foo</td></tr></table>
12022
12023 !!end
12024
12025 !!test
12026 Templates: HTML Tables: 3. Generating end of a HTML table
12027 !! wikitext
12028 <table><tr>{{echo|<td>foo</td></tr></table>}}
12029 !! html
12030 <table><tr><td>foo</td></tr></table>
12031
12032 !!end
12033
12034 !!test
12035 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
12036 !! wikitext
12037 {{echo|<table>}}<tr><td>foo</td></tr></table>
12038 !! html
12039 <table><tr><td>foo</td></tr></table>
12040
12041 !!end
12042
12043 !!test
12044 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
12045 !! wikitext
12046 <table>{{echo|<tr>}}<td>foo</td></tr></table>
12047 !! html
12048 <table><tr><td>foo</td></tr></table>
12049
12050 !!end
12051
12052 !!test
12053 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
12054 !! wikitext
12055 <table><tr>{{echo|<td>}}foo</td></tr></table>
12056 !! html
12057 <table><tr><td>foo</td></tr></table>
12058
12059 !!end
12060
12061 !!test
12062 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
12063 !! wikitext
12064 <table><tr><td>foo{{echo|</td>}}</tr></table>
12065 !! html
12066 <table><tr><td>foo</td></tr></table>
12067
12068 !!end
12069
12070 !!test
12071 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
12072 !! wikitext
12073 <table><tr><td>foo</td>{{echo|</tr>}}</table>
12074 !! html
12075 <table><tr><td>foo</td></tr></table>
12076
12077 !!end
12078
12079 !!test
12080 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
12081 !! wikitext
12082 <table><tr><td>foo</td></tr>{{echo|</table>}}
12083 !! html
12084 <table><tr><td>foo</td></tr></table>
12085
12086 !!end
12087
12088 !!test
12089 Templates: HTML Tables: 5. Proper fostering of categories from inside
12090 !!options
12091 parsoid=wt2html,wt2wt
12092 !! wikitext
12093 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
12094 <!--Two categories (Bug 50330)-->
12095 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
12096 !! html
12097 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
12098 <!--Two categories (Bug 50330)-->
12099 <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>
12100 !!end
12101
12102 !!test
12103 Templates: Wiki Tables: 1a. Fostering of entire template content
12104 !! wikitext
12105 {|
12106 {{echo|a}}
12107 |}
12108 !! html
12109 <table>
12110 a
12111 <tr><td></td></tr></table>
12112
12113 !! html+tidy
12114 <p>a</p>
12115 <table>
12116 <tr>
12117 <td></td>
12118 </tr>
12119 </table>
12120 !! end
12121
12122 !!test
12123 Templates: Wiki Tables: 1b. Fostering of entire template content
12124 !! wikitext
12125 {|
12126 {{echo|<div>}}
12127 foo
12128 {{echo|</div>}}
12129 |}
12130 !! html
12131 <table>
12132 <div>
12133 <p>foo
12134 </p>
12135 </div>
12136 <tr><td></td></tr></table>
12137
12138 !! html+tidy
12139 <div>
12140 <p>foo</p>
12141 </div>
12142 <table>
12143 <tr>
12144 <td></td>
12145 </tr>
12146 </table>
12147 !! end
12148
12149 !!test
12150 Templates: Wiki Tables: 2. Fostering of partial template content
12151 !! wikitext
12152 {|
12153 {{echo|a
12154 <div>b</div>}}
12155 |}
12156 !! html
12157 <table>
12158 a
12159 <div>b</div>
12160 <tr><td></td></tr></table>
12161
12162 !! html+tidy
12163 <p>a</p>
12164 <div>b</div>
12165 <table>
12166 <tr>
12167 <td></td>
12168 </tr>
12169 </table>
12170 !! end
12171
12172 !!test
12173 Templates: Wiki Tables: 3. td-content via multiple templates
12174 !! wikitext
12175 {|
12176 {{echo|{{pipe}}a}}{{echo|b}}
12177 |}
12178 !! html
12179 <table>
12180 <tr>
12181 <td>ab
12182 </td></tr></table>
12183
12184 !!end
12185
12186 !!test
12187 Templates: Wiki Tables: 4. Templated tags, no content
12188 !! wikitext
12189 {{tbl-start}}
12190 {{tbl-end}}
12191 !! html
12192 <table>
12193 <tr><td></td></tr></table>
12194
12195 !!end
12196
12197 !!test
12198 Templates: Wiki Tables: 5. Templated tags, regular 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 !!test
12212 Templates: Wiki Tables: 6. Templated tags, templated td-tags
12213 !! wikitext
12214 {{tbl-start}}
12215 {{!}}foo
12216 {{tbl-end}}
12217 !! html
12218 <table>
12219 <tr>
12220 <td>foo
12221 </td></tr></table>
12222
12223 !!end
12224
12225 ## This test case is very specific to Parsoid's internals
12226 ## and is hence only tested for Parsoid's code. Parsoid uses
12227 ## a <meta> marker tag for <ref> tags and they are expanded
12228 ## much later. We are verifying that this <meta> tag usage
12229 ## doesn't prevent foster parenting.
12230 !!test
12231 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
12232 !!wikitext
12233 {{PartialTable}}<ref>foo</ref>
12234 |}
12235
12236 <references />
12237 !!html/parsoid
12238 <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">
12239 <tbody>
12240 </tbody></table>
12241
12242 <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>
12243 !!end
12244
12245 !! test
12246 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
12247 !! wikitext
12248 {{echo|
12249 {{{!}}
12250 {{!}}-}}
12251 <onlyinclude>
12252 |foo
12253 </onlyinclude>
12254 {{!}}}
12255 !! html/parsoid
12256 <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{{!}}}"]}'>
12257 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
12258 <tbody><tr>
12259
12260 <td>foo
12261 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
12262 </tbody></table>
12263 !! end
12264
12265 !!test
12266 Templates: Lists: Multi-line list-items via templates
12267 !! wikitext
12268 *{{echo|a {{nonexistent|
12269 unused}}}}
12270 *{{echo|b {{nonexistent|
12271 unused}}}}
12272 !! html
12273 <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>
12274 <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>
12275
12276 !!end
12277
12278 !!test
12279 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
12280 !! wikitext
12281 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
12282 !! html
12283 <p><i>ab</i>c<i>d</i>e
12284 </p>
12285 !!end
12286
12287 !!test
12288 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
12289 (PHP parser generates misnested html)
12290 !! wikitext
12291 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
12292 !! html/parsoid
12293 <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>
12294 !!end
12295
12296 !!test
12297 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
12298 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
12299 !! options
12300 parsoid=wt2html,wt2wt
12301 !! wikitext
12302 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
12303 !! html
12304 <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>
12305 <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>
12306 <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>
12307 !!end
12308
12309 !!test
12310 Templates: Ugly nesting: 4. Divs opened/closed across templates
12311 !! wikitext
12312 a<div>b{{echo|c</div>d}}e
12313 !! html
12314 a<div>bc</div>de
12315
12316 !! html+tidy
12317 <p>a</p>
12318 <div>bc</div>
12319 <p>de</p>
12320 !! end
12321
12322 !!test
12323 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
12324 (Parsoid-centric)
12325 !! options
12326 parsoid
12327 !! wikitext
12328 {|
12329 |{{echo|foo</table>}}
12330 |bar
12331 |}
12332 !! html
12333 <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|}"]}'>
12334
12335 <tbody>
12336 <tr>
12337 <td>foo</td></tr></tbody></table><span about="#mwt1">
12338 </span><span about="#mwt1">|bar</span><span about="#mwt1">
12339 |}</span>
12340 !!end
12341
12342 !!test
12343 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
12344 (Parsoid-centric)
12345 !! options
12346 parsoid
12347 !! wikitext
12348 <table>
12349 <tr>
12350 <td>
12351 <table>
12352 <tr>
12353 <td>1. {{echo|foo </table>}}</td>
12354 <td> bar </td>
12355 <td>2. {{echo|baz </table>}}</td>
12356 </tr>
12357 <tr>
12358 <td>abc</td>
12359 </tr>
12360 </table>
12361 </td>
12362 </tr>
12363 <tr>
12364 <td>xyz</td>
12365 </tr>
12366 </table>
12367 !! html
12368 <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>"]}'>
12369 <tbody><tr>
12370 <td>
12371 <table>
12372 <tbody><tr>
12373 <td>1. foo </td></tr></tbody></table></td>
12374 <td> bar </td>
12375 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
12376 </span><span about="#mwt2">
12377 </span><span about="#mwt2">
12378 </span><span about="#mwt2">abc</span><span about="#mwt2">
12379 </span><span about="#mwt2">
12380 </span><span about="#mwt2">
12381 </span><span about="#mwt2">
12382 </span><span about="#mwt2">
12383 </span><span about="#mwt2">
12384 </span><span about="#mwt2">xyz</span><span about="#mwt2">
12385 </span><span about="#mwt2">
12386 </span>
12387 !!end
12388
12389 !! test
12390 Templates: Ugly templates: 3. newline-only template parameter
12391 !! wikitext
12392 foo {{echo|
12393 }}
12394 !! html
12395 <p>foo
12396 </p>
12397 !! end
12398
12399 # This looks like a bug: a single newline triggers p/br for some reason.
12400 !! test
12401 Templates: Ugly templates: 4. newline-only template parameter inconsistency
12402 !! wikitext
12403 {{echo|
12404 }}
12405 !! html
12406 <p><br />
12407 </p>
12408 !! end
12409
12410 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
12411 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
12412 !! test
12413 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
12414 !! wikitext
12415 {{echo|<table>}}
12416 {{echo|<div>foo}}
12417 {{echo|</table>}}
12418 !! html/parsoid
12419 <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
12420 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12421 </table>
12422 !! end
12423
12424 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
12425 # that are "identical" and generate nesting cycles in the algorithm
12426 !! test
12427 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
12428 !! wikitext
12429 {{echo|<table><tr><td><table>}}
12430 {{echo|<div>}}
12431 {{echo|</div>}}
12432 !! html/parsoid
12433 <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"}'>
12434 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12435 </table></td></tr></tbody></table>
12436 !! end
12437
12438 !! test
12439 Templates: Parameters substituted at the top-level
12440 !! wikitext
12441 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
12442 !! html/php
12443 <p><i>who</i> me? <b>never!</b>
12444 </p>
12445 !! html/parsoid
12446 <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>
12447 !! end
12448
12449 !!test
12450 Parser Functions: 1. Simple example
12451 !! wikitext
12452 {{uc:foo}}
12453 !! html
12454 <p>FOO
12455 </p>
12456 !!end
12457
12458 !!test
12459 Parser Functions: 2. Nested use (only outermost should be marked up)
12460 !! wikitext
12461 {{uc:{{lc:FOO}}}}
12462 !! html
12463 <p>FOO
12464 </p>
12465 !!end
12466
12467 ###
12468 ### Pre-save transform tests
12469 ###
12470 !! test
12471 pre-save transform: subst:
12472 !! options
12473 pst
12474 !! wikitext
12475 {{subst:test}}
12476 !! html/php
12477 This is a test template
12478 !! end
12479
12480 !! test
12481 pre-save transform: normal template
12482 !! options
12483 pst
12484 !! wikitext
12485 {{test}}
12486 !! html/php
12487 {{test}}
12488 !! end
12489
12490 !! test
12491 pre-save transform: nonexistent template
12492 !! options
12493 pst
12494 !! wikitext
12495 {{thistemplatedoesnotexist}}
12496 !! html/php
12497 {{thistemplatedoesnotexist}}
12498 !! end
12499
12500 !! test
12501 pre-save transform: subst magic variables
12502 !! options
12503 pst
12504 !! wikitext
12505 {{subst:SITENAME}}
12506 !! html/php
12507 MediaWiki
12508 !! end
12509
12510 # This is bug 89, which I fixed. -- wtm
12511 !! test
12512 pre-save transform: subst: templates with parameters
12513 !! options
12514 pst
12515 !! wikitext
12516 {{subst:paramtest|param="something else"}}
12517 !! html/php
12518 This is a test template with parameter "something else"
12519 !! end
12520
12521 !! article
12522 Template:nowikitest
12523 !! text
12524 <nowiki>'''not wiki'''</nowiki>
12525 !! endarticle
12526
12527 !! test
12528 pre-save transform: nowiki in subst (bug 1188)
12529 !! options
12530 pst
12531 !! wikitext
12532 {{subst:nowikitest}}
12533 !! html/php
12534 <nowiki>'''not wiki'''</nowiki>
12535 !! end
12536
12537 !! article
12538 Template:commenttest
12539 !! text
12540 This template has <!-- a comment --> in it.
12541 !! endarticle
12542
12543 !! test
12544 pre-save transform: comment in subst (bug 1936)
12545 !! options
12546 pst
12547 !! wikitext
12548 {{subst:commenttest}}
12549 !! html/php
12550 This template has <!-- a comment --> in it.
12551 !! end
12552
12553 !! test
12554 pre-save transform: unclosed tag
12555 !! options
12556 pst
12557 !! wikitext
12558 <nowiki>'''not wiki'''
12559 !! html/php
12560 <nowiki>'''not wiki'''
12561 !! end
12562
12563 !! test
12564 pre-save transform: mixed tag case
12565 !! options
12566 pst
12567 !! wikitext
12568 <NOwiki>'''not wiki'''</noWIKI>
12569 !! html/php
12570 <NOwiki>'''not wiki'''</noWIKI>
12571 !! end
12572
12573 !! test
12574 pre-save transform: unclosed comment in <nowiki>
12575 !! options
12576 pst
12577 !! wikitext
12578 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12579 !! html/php
12580 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12581 !!end
12582
12583 # Leading @ in this template definition works around a limitation
12584 # in parsoid's parserTests which otherwise strips the <span> from the
12585 # result (confusing it for a template wrapper)
12586 !! article
12587 Template:dangerous
12588 !!text
12589 @<span onmouseover="alert('crap')">Oh no</span>
12590 !!endarticle
12591
12592 !!test
12593 (confirming safety of fix for subst bug 1936)
12594 !! wikitext
12595 {{Template:dangerous}}
12596 !! html
12597 <p>@<span>Oh no</span>
12598 </p>
12599 !! end
12600
12601 !! test
12602 pre-save transform: comment containing gallery (bug 5024)
12603 !! options
12604 pst
12605 !! wikitext
12606 <!-- <gallery>data</gallery> -->
12607 !! html/php
12608 <!-- <gallery>data</gallery> -->
12609 !!end
12610
12611 !! test
12612 pre-save transform: comment containing extension
12613 !! options
12614 pst
12615 !! wikitext
12616 <!-- <tag>data</tag> -->
12617 !! html/php
12618 <!-- <tag>data</tag> -->
12619 !!end
12620
12621 !! test
12622 pre-save transform: comment containing nowiki
12623 !! options
12624 pst
12625 !! wikitext
12626 <!-- <nowiki>data</nowiki> -->
12627 !! html/php
12628 <!-- <nowiki>data</nowiki> -->
12629 !!end
12630
12631 !! test
12632 pre-save transform: <noinclude> in subst (bug 3298)
12633 !! options
12634 pst
12635 !! wikitext
12636 {{subst:Includes}}
12637 !! html/php
12638 Foobar
12639 !! end
12640
12641 !! test
12642 pre-save transform: <onlyinclude> in subst (bug 3298)
12643 !! options
12644 pst
12645 !! wikitext
12646 {{subst:Includes2}}
12647 !! html/php
12648 Foo
12649 !! end
12650
12651 !! article
12652 Template:SubstTest
12653 !!text
12654 {{<includeonly>subst:</includeonly>Includes}}
12655 !! endarticle
12656
12657 !! article
12658 Template:SafeSubstTest
12659 !! text
12660 {{<includeonly>safesubst:</includeonly>Includes}}
12661 !! endarticle
12662
12663 !! test
12664 bug 22297: safesubst: works during PST
12665 !! options
12666 pst
12667 !! wikitext
12668 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
12669 !! html/php
12670 FoobarFoobar
12671 !! end
12672
12673 !! test
12674 bug 22297: safesubst: works during normal parse
12675 !! wikitext
12676 {{SafeSubstTest}}
12677 !! html
12678 <p>Foobar
12679 </p>
12680 !! end
12681
12682 !! test
12683 subst: does not work during normal parse
12684 !! wikitext
12685 {{SubstTest}}
12686 !! html
12687 <p>{{subst:Includes}}
12688 </p>
12689 !! end
12690
12691 !! test
12692 pre-save transform: context links ("pipe trick")
12693 !! options
12694 pst
12695 !! wikitext
12696 [[Article (context)|]]
12697 [[Bar:Article|]]
12698 [[:Bar:Article|]]
12699 [[Bar:Article (context)|]]
12700 [[:Bar:Article (context)|]]
12701 [[|Article]]
12702 [[|Article (context)]]
12703 [[Bar:X (Y) Z|]]
12704 [[:Bar:X (Y) Z|]]
12705 !! html/php
12706 [[Article (context)|Article]]
12707 [[Bar:Article|Article]]
12708 [[:Bar:Article|Article]]
12709 [[Bar:Article (context)|Article]]
12710 [[:Bar:Article (context)|Article]]
12711 [[Article]]
12712 [[Article (context)]]
12713 [[Bar:X (Y) Z|X (Y) Z]]
12714 [[:Bar:X (Y) Z|X (Y) Z]]
12715 !! end
12716
12717 !! test
12718 pre-save transform: context links ("pipe trick") with interwiki prefix
12719 !! options
12720 pst
12721 !! wikitext
12722 [[interwiki:Article|]]
12723 [[:interwiki:Article|]]
12724 [[interwiki:Bar:Article|]]
12725 [[:interwiki:Bar:Article|]]
12726 !! html/php
12727 [[interwiki:Article|Article]]
12728 [[:interwiki:Article|Article]]
12729 [[interwiki:Bar:Article|Bar:Article]]
12730 [[:interwiki:Bar:Article|Bar:Article]]
12731 !! end
12732
12733 !! test
12734 pre-save transform: context links ("pipe trick") with parens in title
12735 !! options
12736 pst title=[[Somearticle (context)]]
12737 !! wikitext
12738 [[|Article]]
12739 !! html/php
12740 [[Article (context)|Article]]
12741 !! end
12742
12743 !! test
12744 pre-save transform: context links ("pipe trick") with comma in title
12745 !! options
12746 pst title=[[Someplace, Somewhere]]
12747 !! wikitext
12748 [[|Otherplace]]
12749 [[Otherplace, Elsewhere|]]
12750 [[Otherplace, Elsewhere, Anywhere|]]
12751 !! html/php
12752 [[Otherplace, Somewhere|Otherplace]]
12753 [[Otherplace, Elsewhere|Otherplace]]
12754 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
12755 !! end
12756
12757 !! test
12758 pre-save transform: context links ("pipe trick") with parens and comma
12759 !! options
12760 pst title=[[Someplace (IGNORED), Somewhere]]
12761 !! wikitext
12762 [[|Otherplace]]
12763 [[Otherplace (place), Elsewhere|]]
12764 !! html/php
12765 [[Otherplace, Somewhere|Otherplace]]
12766 [[Otherplace (place), Elsewhere|Otherplace]]
12767 !! end
12768
12769 !! test
12770 pre-save transform: context links ("pipe trick") with comma and parens
12771 !! options
12772 pst title=[[Who, me? (context)]]
12773 !! wikitext
12774 [[|Yes, you.]]
12775 [[Me, Myself, and I (1937 song)|]]
12776 !! html/php
12777 [[Yes, you. (context)|Yes, you.]]
12778 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
12779 !! end
12780
12781 !! test
12782 pre-save transform: context links ("pipe trick") with namespace
12783 !! options
12784 pst title=[[Ns:Somearticle]]
12785 !! wikitext
12786 [[|Article]]
12787 !! html/php
12788 [[Ns:Article|Article]]
12789 !! end
12790
12791 !! test
12792 pre-save transform: context links ("pipe trick") with namespace and parens
12793 !! options
12794 pst title=[[Ns:Somearticle (context)]]
12795 !! wikitext
12796 [[|Article]]
12797 !! html/php
12798 [[Ns:Article (context)|Article]]
12799 !! end
12800
12801 !! test
12802 pre-save transform: context links ("pipe trick") with namespace and comma
12803 !! options
12804 pst title=[[Ns:Somearticle, Context, Whatever]]
12805 !! wikitext
12806 [[|Article]]
12807 !! html/php
12808 [[Ns:Article, Context, Whatever|Article]]
12809 !! end
12810
12811 !! test
12812 pre-save transform: context links ("pipe trick") with namespace, comma and parens
12813 !! options
12814 pst title=[[Ns:Somearticle, Context (context)]]
12815 !! wikitext
12816 [[|Article]]
12817 !! html/php
12818 [[Ns:Article (context)|Article]]
12819 !! end
12820
12821 !! test
12822 pre-save transform: context links ("pipe trick") with namespace, parens and comma
12823 !! options
12824 pst title=[[Ns:Somearticle (IGNORED), Context]]
12825 !! wikitext
12826 [[|Article]]
12827 !! html/php
12828 [[Ns:Article, Context|Article]]
12829 !! end
12830
12831 !! test
12832 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
12833 !! options
12834 pst
12835 !! wikitext
12836 [[Article(context)|]]
12837 [[Bar:Article(context)|]]
12838 [[:Bar:Article(context)|]]
12839 [[|Article(context)]]
12840 [[Bar:X(Y)Z|]]
12841 [[:Bar:X(Y)Z|]]
12842 !! html/php
12843 [[Article(context)|Article]]
12844 [[Bar:Article(context)|Article]]
12845 [[:Bar:Article(context)|Article]]
12846 [[Article(context)]]
12847 [[Bar:X(Y)Z|X(Y)Z]]
12848 [[:Bar:X(Y)Z|X(Y)Z]]
12849 !! end
12850
12851 !! test
12852 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
12853 !! options
12854 pst
12855 !! wikitext
12856 [[Article (context)|]]
12857 [[Bar:Article (context)|]]
12858 [[:Bar:Article (context)|]]
12859 [[|Article (context)]]
12860 [[Bar:X (Y) Z|]]
12861 [[:Bar:X (Y) Z|]]
12862 !! html/php
12863 [[Article (context)|Article]]
12864 [[Bar:Article (context)|Article]]
12865 [[:Bar:Article (context)|Article]]
12866 [[Article (context)]]
12867 [[Bar:X (Y) Z|X (Y) Z]]
12868 [[:Bar:X (Y) Z|X (Y) Z]]
12869 !! end
12870
12871 !! test
12872 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
12873 !! options
12874 pst
12875 !! wikitext
12876 [[Article(context)|]]
12877 [[Bar:Article(context)|]]
12878 [[:Bar:Article(context)|]]
12879 [[|Article(context)]]
12880 [[Bar:X(Y)Z|]]
12881 [[:Bar:X(Y)Z|]]
12882 !! html/php
12883 [[Article(context)|Article]]
12884 [[Bar:Article(context)|Article]]
12885 [[:Bar:Article(context)|Article]]
12886 [[Article(context)]]
12887 [[Bar:X(Y)Z|X(Y)Z]]
12888 [[:Bar:X(Y)Z|X(Y)Z]]
12889 !! end
12890
12891 !! test
12892 pre-save transform: context links ("pipe trick") with commas (bug 21660)
12893 !! options
12894 pst
12895 !! wikitext
12896 [[Article (context), context|]]
12897 [[Article (context),context|]]
12898 [[Bar:Article (context), context|]]
12899 [[Bar:Article (context),context|]]
12900 [[:Bar:Article (context), context|]]
12901 [[:Bar:Article (context),context|]]
12902 !! html/php
12903 [[Article (context), context|Article]]
12904 [[Article (context),context|Article]]
12905 [[Bar:Article (context), context|Article]]
12906 [[Bar:Article (context),context|Article]]
12907 [[:Bar:Article (context), context|Article]]
12908 [[:Bar:Article (context),context|Article]]
12909 !! end
12910
12911 !! test
12912 pre-save transform: trim trailing empty lines
12913 !! options
12914 pst
12915 !! wikitext
12916 Empty lines are trimmed
12917
12918
12919
12920
12921 !! html/php
12922 Empty lines are trimmed
12923 !! end
12924
12925 !! test
12926 pre-save transform: Signature expansion
12927 !! options
12928 pst
12929 !! wikitext
12930 * ~~~
12931 * <noinclude>~~~</noinclude>
12932 * <includeonly>~~~</includeonly>
12933 * <onlyinclude>~~~</onlyinclude>
12934 !! html/php
12935 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
12936 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
12937 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
12938 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
12939 !! end
12940
12941
12942 !! test
12943 pre-save transform: Signature expansion in nowiki tags (bug 93)
12944 !! options
12945 pst disabled
12946 !! wikitext
12947 Shall not expand:
12948
12949 <nowiki>~~~~</nowiki>
12950
12951 <includeonly><nowiki>~~~~</nowiki></includeonly>
12952
12953 <noinclude><nowiki>~~~~</nowiki></noinclude>
12954
12955 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12956
12957 {{subst:Foo}} shall be converted to FOO
12958
12959 As well as inside noinclude/onlyinclude
12960 <noinclude>{{subst:Foo}}</noinclude>
12961 <onlyinclude>{{subst:Foo}}</onlyinclude>
12962
12963 But not inside includeonly
12964 <includeonly>{{subst:Foo}}</includeonly>
12965 !! html/php
12966 Shall not expand:
12967
12968 <nowiki>~~~~</nowiki>
12969
12970 <includeonly><nowiki>~~~~</nowiki></includeonly>
12971
12972 <noinclude><nowiki>~~~~</nowiki></noinclude>
12973
12974 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12975
12976 FOO shall be converted to FOO
12977
12978 As well as inside noinclude/onlyinclude
12979 <noinclude>FOO</noinclude>
12980 <onlyinclude>FOO</onlyinclude>
12981
12982 But not inside includeonly
12983 <includeonly>{{subst:Foo}}</includeonly>
12984 !! end
12985
12986 !! test
12987 Parsoid: Recognize nowiki with trailing space in tags
12988 !! options
12989 parsoid=wt2html
12990 !! wikitext
12991 <nowiki ><div>[[foo]]</nowiki >
12992
12993 a<nowiki / >b
12994
12995 c<nowiki />d
12996
12997 e<nowiki/ >f
12998 !! html
12999 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
13000 <p>ab</p>
13001 <p>cd</p>
13002 <p>ef</p>
13003 !! end
13004
13005 !! test
13006 Parsoid: Recognize nowiki with odd capitalization
13007 !! options
13008 parsoid=wt2html
13009 !! wikitext
13010 <noWikI ><div>[[foo]]</Nowiki >
13011 !! html
13012 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
13013 !! end
13014
13015
13016 !! test
13017 Parsoid: Escape nowiki with trailing space in tags
13018 !! options
13019 parsoid=html2wt
13020 !! html/parsoid
13021 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
13022 <p>a&lt;nowiki /&gt;b</p>
13023 <p>c&lt;nowiki/ &gt;d</p>
13024 !! wikitext
13025 &lt;nowiki &gt; foo &lt;/nowiki &gt;
13026
13027 a&lt;nowiki /&gt;b
13028
13029 c&lt;nowiki/ &gt;d
13030 !! end
13031
13032 !! test
13033 Parsoid: Escape weird noWikI capitalizations
13034 !! options
13035 parsoid=html2wt
13036 !! html/parsoid
13037 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
13038 !! wikitext
13039 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
13040 !! end
13041
13042 ###
13043 ### Message transform tests
13044 ###
13045 !! test
13046 message transform: magic variables
13047 !! options
13048 msg
13049 !! wikitext
13050 {{SITENAME}}
13051 !! html
13052 MediaWiki
13053 !! end
13054
13055 !! test
13056 message transform: should not transform wiki markup
13057 !! options
13058 msg
13059 !! wikitext
13060 ''test''
13061 !! html
13062 ''test''
13063 !! end
13064
13065 !! test
13066 message transform: <noinclude> in transcluded template (bug 4926)
13067 !! options
13068 msg
13069 !! wikitext
13070 {{Includes}}
13071 !! html
13072 Foobar
13073 !! end
13074
13075 !! test
13076 message transform: <onlyinclude> in transcluded template (bug 4926)
13077 !! options
13078 msg
13079 !! wikitext
13080 {{Includes2}}
13081 !! html
13082 Foo
13083 !! end
13084
13085 !! test
13086 {{#special:}} page name, known
13087 !! options
13088 msg
13089 !! wikitext
13090 {{#special:Recentchanges}}
13091 !! html
13092 Special:RecentChanges
13093 !! end
13094
13095 !! test
13096 {{#special:}} page name with subpage, known
13097 !! options
13098 msg
13099 !! wikitext
13100 {{#special:Recentchanges/param}}
13101 !! html
13102 Special:RecentChanges/param
13103 !! end
13104
13105 !! test
13106 {{#special:}} page name, unknown
13107 !! options
13108 msg
13109 !! wikitext
13110 {{#special:foobar nonexistent}}
13111 !! html
13112 Special:Foobar nonexistent
13113 !! end
13114
13115 !! test
13116 {{#speciale:}} page name, known
13117 !! options
13118 msg
13119 !! wikitext
13120 {{#speciale:Recentchanges}}
13121 !! html
13122 Special:RecentChanges
13123 !! end
13124
13125 !! test
13126 {{#speciale:}} page name with subpage, known
13127 !! options
13128 msg
13129 !! wikitext
13130 {{#speciale:Recentchanges/param}}
13131 !! html
13132 Special:RecentChanges/param
13133 !! end
13134
13135 !! test
13136 {{#speciale:}} page name, unknown
13137 !! options
13138 msg
13139 !! wikitext
13140 {{#speciale:foobar nonexistent}}
13141 !! html
13142 Special:Foobar_nonexistent
13143 !! end
13144
13145 ###
13146 ### Images
13147 ###
13148 ### For Parsoid-specific tests, see
13149 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
13150
13151 !! test
13152 Simple image
13153 !! options
13154 parsoid=wt2html,wt2wt,html2html
13155 !! wikitext
13156 [[Image:foobar.jpg]]
13157 !! html/php
13158 <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>
13159 </p>
13160 !! html/parsoid
13161 <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>
13162 !! end
13163
13164 !! test
13165 Simple image (using File: namespace, now canonical)
13166 !! wikitext
13167 [[File:Foobar.jpg]]
13168 !! html/php
13169 <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>
13170 </p>
13171 !! html/parsoid
13172 <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>
13173 !! end
13174
13175 !! test
13176 Right-aligned image
13177 !! wikitext
13178 [[File:Foobar.jpg|right]]
13179 !! html/php
13180 <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>
13181
13182 !! html/parsoid
13183 <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>
13184 !! end
13185
13186 !! test
13187 Image with caption
13188 !! wikitext
13189 [[File:Foobar.jpg|right|Caption text]]
13190 !! html/php
13191 <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>
13192
13193 !! html/parsoid
13194 <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>
13195 !! end
13196
13197 !! test
13198 Image with caption, bug 53312 #1
13199 !! wikitext
13200 [[File:Foobar.jpg|right|Caption page stuff]]
13201 !! html/php
13202 <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>
13203
13204 !! html/parsoid
13205 <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>
13206 !! end
13207
13208 !! test
13209 Image with caption, bug 53312 #2
13210 !! wikitext
13211 [[File:Foobar.jpg|right|Caption page=]]
13212 !! html/php
13213 <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>
13214
13215 !! html/parsoid
13216 <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>
13217 !! end
13218
13219 !! test
13220 Image with caption, bug 53312 #3
13221 !! wikitext
13222 [[File:Foobar.jpg|right|Caption page=stuff]]
13223 !! html/php
13224 <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>
13225
13226 !! html/parsoid
13227 <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>
13228 !! end
13229
13230 !! test
13231 Allow empty links in image captions (Bug 60753)
13232 !! options
13233 thumbsize=220
13234 !! wikitext
13235 [[File:Foobar.jpg|thumb|Caption [[Link1]]
13236 [[]]
13237 [[Link2]]
13238 ]]
13239 !! html/php
13240 <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>
13241
13242 !! html/parsoid
13243 <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>
13244 [[]]
13245 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
13246 </figcaption></figure>
13247 !! end
13248
13249 !! test
13250 Titles in unlinked images (T23454)
13251 !! wikitext
13252 [[File:Foobar.jpg|link=|stuff]]
13253 !! html/php
13254 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
13255 </p>
13256 !! end
13257
13258 !! test
13259 Link with empty target
13260 !! wikitext
13261 [[]]
13262 !! html
13263 <p>[[]]
13264 </p>
13265 !! end
13266
13267 !! test
13268 Image with link trail
13269 !! wikitext
13270 Linktrails should not work for images: [[File:Foobar.jpg]]s
13271 !! html/php
13272 <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
13273 </p>
13274 !! html/parsoid
13275 <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>
13276 !! end
13277
13278 !! test
13279 Image with empty attribute
13280 !! options
13281 parsoid=wt2html,wt2wt,html2html
13282 !! wikitext
13283 [[File:Foobar.jpg|right||Caption text]]
13284 !! html/php
13285 <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>
13286
13287 !! html/parsoid
13288 <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>
13289 !! end
13290
13291 !! test
13292 1. Block image with individual attributes from templates
13293 !! wikitext
13294 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
13295 !! html/php
13296 <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>
13297
13298 !! html/parsoid
13299 <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>
13300 !! end
13301
13302 !! test
13303 2. Block Image with individual attributes from templates
13304 !! wikitext
13305 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
13306 !! html/php
13307 <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>
13308
13309 !! html/parsoid
13310 <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>
13311 !! end
13312
13313 !! test
13314 3. Inline image with individual attributes from templates
13315 !! wikitext
13316 [[File:Foobar.jpg|{{echo|50px}}]]
13317 !! html/php
13318 <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>
13319 </p>
13320 !! html/parsoid
13321 <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>
13322 !! end
13323
13324 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
13325 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
13326 !! test
13327 Image with multiple attributes from the same template
13328 !! wikitext
13329 [[File:Foobar.jpg|{{image_attribs}}]]
13330 !! html/php
13331 <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>
13332
13333 !! html/parsoid
13334 <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>
13335 !! end
13336
13337 !! test
13338 Image with link tails
13339 !! options
13340 thumbsize=220
13341 !! wikitext
13342 123[[File:Foobar.jpg]]456
13343 123[[File:Foobar.jpg|right]]456
13344 123[[File:Foobar.jpg|thumb]]456
13345 !! html/php
13346 <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
13347 </p>
13348 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
13349 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
13350
13351 !! html/php+tidy
13352 <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>
13353 <p>123</p>
13354 <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>
13355 <p>456 123</p>
13356 <div class="thumb tright">
13357 <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>
13358 <div class="thumbcaption">
13359 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
13360 </div>
13361 </div>
13362 </div>
13363 <p>456</p>
13364 !! html/parsoid
13365 <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>
13366 <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>
13367 <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>
13368 !! end
13369
13370 !! test
13371 Image with multiple captions -- only last one is accepted
13372 !! wikitext
13373 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
13374 !! html/php
13375 <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>
13376
13377 !! html/parsoid
13378 <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>
13379 !! end
13380
13381 !! test
13382 Image with multiple widths -- use last
13383 !! wikitext
13384 [[File:Foobar.jpg|200px|300px|caption]]
13385 !! html/php
13386 <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>
13387 </p>
13388 !! html/parsoid
13389 <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>
13390 !! end
13391
13392 !! test
13393 Image with multiple alignments -- use first (bug 48664)
13394 !! options
13395 thumbsize=220
13396 !! wikitext
13397 [[File:Foobar.jpg|thumb|left|right|center|caption]]
13398
13399 [[File:Foobar.jpg|middle|text-top|caption]]
13400 !! html/php
13401 <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>
13402 <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>
13403 </p>
13404 !! html/parsoid
13405 <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>
13406 <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>
13407 !! end
13408
13409 !! test
13410 Image with width attribute at different positions
13411 !! wikitext
13412 [[File:Foobar.jpg|200px|right|Caption]]
13413 [[File:Foobar.jpg|right|200px|Caption]]
13414 [[File:Foobar.jpg|right|Caption|200px]]
13415 !! html/php
13416 <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>
13417 <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>
13418 <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>
13419
13420 !! html/parsoid
13421 <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>
13422 <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>
13423 <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>
13424 !! end
13425
13426 # a sad bit of backward-compatibility
13427 !! test
13428 Image with size specified with pxpx (bug 13500, 51628)
13429 !! options
13430 parsoid=wt2html,wt2wt,html2html
13431 !! wikitext
13432 [[File:Foobar.jpg|20pxpx]]
13433 [[File:Foobar.jpg|200x20pxpx]]
13434 !! html/php
13435 <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>
13436 <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>
13437 </p>
13438 !! html/parsoid
13439 <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>
13440 !! end
13441
13442 !! test
13443 Image with link parameter, wiki target
13444 !! wikitext
13445 [[File:Foobar.jpg|link=Main Page]]
13446 !! html/php
13447 <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>
13448 </p>
13449 !! html/parsoid
13450 <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>
13451 !! end
13452
13453 # parsoid bug 49293 (part 1)
13454 !! test
13455 Image with link parameter, URL target
13456 !! wikitext
13457 [[File:Foobar.jpg|link=http://example.com/]]
13458 !! html/php
13459 <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>
13460 </p>
13461 !! html/parsoid
13462 <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>
13463 !! end
13464
13465 # parsoid bug 49293 (part 2)
13466 !! test
13467 Image with link parameter, protocol-less URL target
13468 !! wikitext
13469 [[File:Foobar.jpg|link=//example.com/]]
13470 !! html/php
13471 <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>
13472 </p>
13473 !! html/parsoid
13474 <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>
13475 !! end
13476
13477 !! test
13478 Escaping non-block captions (T107435)
13479 !! options
13480 parsoid={
13481 "modes": ["wt2wt"],
13482 "changes": [
13483 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
13484 ]
13485 }
13486 !! wikitext
13487 [[Image:Foobar.jpg|caption]]
13488 !! wikitext/edited
13489 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
13490 !! end
13491
13492 # wgExternalLinkTarget not supported by Parsoid
13493 !! test
13494 Image with link parameter, wgExternalLinkTarget
13495 !! wikitext
13496 [[Image:foobar.jpg|link=http://example.com/]]
13497 !! config
13498 wgExternalLinkTarget='foobar'
13499 !! html/php
13500 <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>
13501 </p>
13502 !! end
13503
13504 !! test
13505 Image with link parameter, wgNoFollowLinks set to false
13506 !! wikitext
13507 [[Image:foobar.jpg|link=http://example.com/]]
13508 !! config
13509 wgNoFollowLinks=false
13510 !! html
13511 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13512 </p>
13513 !! end
13514
13515 !! test
13516 Image with link parameter, wgNoFollowDomainExceptions
13517 !! wikitext
13518 [[Image:foobar.jpg|link=http://example.com/]]
13519 !! config
13520 wgNoFollowDomainExceptions='example.com'
13521 !! html
13522 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13523 </p>
13524 !! end
13525
13526 # wgExternalLinkTarget not supported by Parsoid
13527 !! test
13528 Image with link parameter, wgExternalLinkTarget, unnamed parameter
13529 !! wikitext
13530 [[Image:foobar.jpg|link=http://example.com/|Title]]
13531 !! config
13532 wgExternalLinkTarget='foobar'
13533 !! html/php
13534 <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>
13535 </p>
13536 !! end
13537
13538 !! test
13539 Image with empty link parameter
13540 !! wikitext
13541 [[File:Foobar.jpg|link=]]
13542 !! html/php
13543 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
13544 </p>
13545 !! html/parsoid
13546 <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>
13547 !! end
13548
13549 !! test
13550 Image with link parameter (wiki target) and unnamed parameter
13551 !! wikitext
13552 [[File:Foobar.jpg|link=Main_Page|Title]]
13553 !! html/php
13554 <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>
13555 </p>
13556 !! html/parsoid
13557 <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>
13558 !! end
13559
13560 !! test
13561 Image with link parameter (URL target) and unnamed parameter
13562 !! wikitext
13563 [[File:Foobar.jpg|link=http://example.com/|Title]]
13564 !! html/php
13565 <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>
13566 </p>
13567 !! html/parsoid
13568 <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>
13569 !! end
13570
13571 !! test
13572 Thumbnail image with link parameter
13573 !! options
13574 thumbsize=220
13575 parsoid=wt2html,wt2wt,html2html
13576 !! wikitext
13577 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
13578 !! html/php
13579 <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>
13580
13581 !! html/parsoid
13582 <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>
13583 !! end
13584
13585 !! test
13586 Manually-specified thumbnail image
13587 !! options
13588 thumbsize=220
13589 !! wikitext
13590 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
13591 !! html/php
13592 <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>
13593
13594 !! html/parsoid
13595 <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>
13596 !! end
13597
13598 !! test
13599 Manually-specified thumbnail image with explicit link to wiki page
13600 !! options
13601 thumbsize=220
13602 parsoid=wt2html,wt2wt,html2html
13603 !! wikitext
13604 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
13605 !! html/php
13606 <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>
13607
13608 !! html/parsoid
13609 <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>
13610 !! end
13611
13612 !! test
13613 Manually-specified thumbnail image with explicit link to url
13614 !! options
13615 thumbsize=220
13616 parsoid=wt2html,wt2wt,html2html
13617 !! wikitext
13618 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
13619 !! html/php
13620 <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>
13621
13622 !! html/parsoid
13623 <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>
13624 !! end
13625
13626 !! test
13627 Manually-specified thumbnail image with explicit no link
13628 !! options
13629 thumbsize=220
13630 parsoid=wt2html,wt2wt,html2html
13631 !! wikitext
13632 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
13633 !! html/php
13634 <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>
13635
13636 !! html/parsoid
13637 <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>
13638 !! end
13639
13640 !! test
13641 Manually-specified thumbnail image with explicit link and alt text
13642 !! options
13643 thumbsize=220
13644 parsoid=wt2html,wt2wt,html2html
13645 !! wikitext
13646 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
13647 !! html/php
13648 <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>
13649
13650 !! html/parsoid
13651 <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>
13652 !! end
13653
13654 !! test
13655 Image with frame and link
13656 !! options
13657 parsoid=wt2html,wt2wt,html2html
13658 !! wikitext
13659 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
13660 !! html/php
13661 <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>
13662
13663 !! html/parsoid
13664 <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>
13665 !! end
13666
13667 !! test
13668 Image with frame and link and explicit alt
13669 !! options
13670 parsoid=wt2html,wt2wt,html2html
13671 !! wikitext
13672 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
13673 !! html/php
13674 <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>
13675
13676 !! html/parsoid
13677 <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>
13678 !! end
13679
13680 !! test
13681 Image with wiki markup in implicit alt
13682 !! wikitext
13683 [[Image:Foobar.jpg|testing '''bold''' in alt]]
13684
13685 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
13686 !! html/php
13687 <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>
13688 </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>
13689 </p>
13690 !! html/parsoid
13691 <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>
13692
13693 <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>
13694 !! end
13695
13696 !! test
13697 Alt image option should handle most kinds of wikitext without barfing
13698 !! wikitext
13699 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
13700 !! html/php
13701 <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>
13702
13703 !! html/parsoid
13704 <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>
13705 !! end
13706
13707 ###################
13708 # Conflicting image format options.
13709 # First option specified should 'win'.
13710 # All three cases in each test should be identical.
13711
13712 !! test
13713 Image with 'frameless' first.
13714 !! options
13715 parsoid=wt2html,wt2wt,html2html
13716 !! wikitext
13717 [[File:Foobar.jpg|frameless|caption]]
13718
13719 [[File:Foobar.jpg|frameless|frame|caption]]
13720
13721 [[File:Foobar.jpg|frameless|thumb|caption]]
13722 !! html/php
13723 <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>
13724 </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>
13725 </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>
13726 </p>
13727 !! html/parsoid
13728 <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>
13729 <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>
13730 <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>
13731 !! end
13732
13733 !! test
13734 Image with 'frame' first.
13735 !! options
13736 parsoid=wt2html,wt2wt,html2html
13737 !! wikitext
13738 [[File:Foobar.jpg|frame|caption]]
13739 [[File:Foobar.jpg|frame|frameless|caption]]
13740 [[File:Foobar.jpg|frame|thumb|caption]]
13741 !! html/php
13742 <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>
13743 <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>
13744 <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>
13745
13746 !! html/parsoid
13747 <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>
13748 <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>
13749 <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>
13750 !! end
13751
13752 !! test
13753 Image with 'thumb' first.
13754 !! options
13755 parsoid=wt2html,wt2wt,html2html
13756 !! wikitext
13757 [[File:Foobar.jpg|thumb|caption]]
13758 [[File:Foobar.jpg|thumb|frameless|caption]]
13759 [[File:Foobar.jpg|thumb|frame|caption]]
13760 !! html/php
13761 <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>
13762 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
13763 <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>
13764
13765 !! html/parsoid
13766 <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>
13767 <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>
13768 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
13769 !! end
13770
13771 ###################
13772 # Image sizing.
13773 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
13774 # and https://phabricator.wikimedia.org/T64258
13775 # Foobar has actual size of 1941x220
13776 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
13777 # a scalable format.
13778 # 2. Framed images always ignore size options; always render at default size.
13779 # 3. "Unspecified format" and border are the only types which can be
13780 # enlarged.
13781
13782 !! test
13783 Image: "unspecified format" and border enlarge
13784 !! options
13785 parsoid=wt2html,wt2wt,html2html
13786 !! wikitext
13787 [[File:Foobar.jpg|2000px]]
13788
13789 [[File:Foobar.jpg|border|2000px]]
13790 !! html/php
13791 <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>
13792 </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>
13793 </p>
13794 !! html/parsoid
13795 <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>
13796 <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>
13797 !! end
13798
13799 !! test
13800 Image: "unspecified format" and border reduce
13801 !! options
13802 parsoid=wt2html,wt2wt,html2html
13803 !! wikitext
13804 [[File:Foobar.jpg|1000px]]
13805
13806 [[File:Foobar.jpg|border|1000px]]
13807 !! html/php
13808 <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>
13809 </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>
13810 </p>
13811 !! html/parsoid
13812 <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>
13813 <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>
13814 !! end
13815
13816 !! test
13817 Image: thumbs reduce
13818 !! options
13819 parsoid=wt2html,wt2wt,html2html
13820 !! wikitext
13821 [[File:Foobar.jpg|thumb|50px]]
13822 !! html/php
13823 <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>
13824
13825 !! html/parsoid
13826 <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>
13827 !! end
13828
13829 !! test
13830 Image: bitmap thumbs can't be enlarged past original size, but vector can.
13831 !! options
13832 parsoid=wt2html,wt2wt,html2html
13833 !! wikitext
13834 [[File:Foobar.jpg|thumb|2000px]]
13835
13836 [[File:Foobar.svg|thumb|2000px]]
13837 !! html/php
13838 <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>
13839 <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>
13840
13841 !! html/parsoid
13842 <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>
13843 <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>
13844 !! end
13845
13846 !! test
13847 Image: frameless can reduce in size
13848 !! options
13849 parsoid=wt2html,wt2wt,html2html
13850 !! wikitext
13851 [[File:Foobar.jpg|frameless|50px]]
13852 !! html/php
13853 <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>
13854 </p>
13855 !! html/parsoid
13856 <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>
13857 !! end
13858
13859 !! test
13860 Image: bitmap frameless can't be enlarged past original size, but vector can
13861 !! options
13862 parsoid=wt2html,wt2wt,html2html
13863 !! wikitext
13864 [[File:Foobar.jpg|frameless|2000px]]
13865
13866 [[File:Foobar.svg|frameless|2000px]]
13867 !! html/php
13868 <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>
13869 </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>
13870 </p>
13871 !! html/parsoid
13872 <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>
13873 <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>
13874 !! end
13875
13876 !! test
13877 Image: framed images are always unscaled.
13878 !! options
13879 parsoid=wt2html,wt2wt,html2html
13880 !! wikitext
13881 [[File:Foobar.jpg|frame]]
13882
13883 [[File:Foobar.jpg|frame|50px]]
13884
13885 [[File:Foobar.jpg|frame|50x50px]]
13886
13887 [[File:Foobar.jpg|frame|2000px]]
13888 !! html/php
13889 <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>
13890 <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>
13891 <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>
13892 <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>
13893
13894 !! html/parsoid
13895 <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>
13896 <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>
13897 <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>
13898 <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>
13899 !! end
13900
13901 ###################
13902
13903 !! test
13904 Link to image page- image page normally doesn't exists, hence edit link
13905 Add test with existing image page
13906 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
13907 !! wikitext
13908 [[:Image:test]]
13909 !! html
13910 <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>
13911 </p>
13912 !! end
13913
13914 !! test
13915 bug 18784 Link to non-existent image page with caption should use caption as link text
13916 !! wikitext
13917 [[:Image:test|caption]]
13918 !! html
13919 <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>
13920 </p>
13921 !! end
13922
13923 !! test
13924 Frameless image caption with a free URL
13925 !! wikitext
13926 [[File:Foobar.jpg|http://example.com]]
13927 !! html/php
13928 <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>
13929 </p>
13930 !! html/parsoid
13931 <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>
13932 !! end
13933
13934 !! test
13935 Thumbnail image caption with a free URL
13936 !! options
13937 thumbsize=220
13938 !! wikitext
13939 [[File:Foobar.jpg|thumb|http://example.com]]
13940 !! html/php
13941 <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>
13942
13943 !! html/parsoid
13944 <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>
13945 !! end
13946
13947 !! test
13948 Thumbnail image caption with a free URL and explicit alt
13949 !! options
13950 thumbsize=220
13951 parsoid=wt2html,wt2wt,html2html
13952 !! wikitext
13953 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
13954 !! html/php
13955 <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>
13956
13957 !! html/parsoid
13958 <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>
13959 !! end
13960
13961 !! test
13962 SVG thumbnails with no language set
13963 !! options
13964 !! wikitext
13965 [[File:Foobar.svg|thumb|caption]]
13966 !! html/php
13967 <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>
13968
13969 !! html/parsoid
13970 <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>
13971 !! end
13972
13973 !! test
13974 SVG thumbnails with language de
13975 !! options
13976 parsoid=wt2html,wt2wt,html2html
13977 !! wikitext
13978 [[File:Foobar.svg|thumb|caption|lang=de]]
13979 !! html/php
13980 <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>
13981
13982 !! html/parsoid
13983 <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>
13984 !! end
13985
13986 !! test
13987 SVG thumbnails with invalid language code
13988 !! options
13989 parsoid=wt2html,wt2wt,html2html
13990 !! wikitext
13991 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
13992 !! html/php
13993 <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>
13994
13995 !! html/parsoid
13996 <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>
13997 !! end
13998
13999 !! test
14000 BUG 1887: A ISBN with a thumbnail
14001 !! wikitext
14002 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
14003 !! html/php
14004 <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>
14005
14006 !! html/parsoid
14007 <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>
14008 !! end
14009
14010 !! test
14011 BUG 1887: A RFC with a thumbnail
14012 !! wikitext
14013 [[File:Foobar.jpg|thumb|This is RFC 12354]]
14014 !! html/php
14015 <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>
14016
14017 !! html/parsoid
14018 <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>
14019 !! end
14020
14021 !! test
14022 BUG 1887: A mailto link with a thumbnail
14023 !! wikitext
14024 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
14025 !! html/php
14026 <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>
14027
14028 !! html/parsoid
14029 <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>
14030 !! end
14031
14032 # Pending resolution to bug 368
14033 !! test
14034 BUG 648: Frameless image caption with a link
14035 !! wikitext
14036 [[File:Foobar.jpg|text with a [[link]] in it]]
14037 !! html/php
14038 <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>
14039 </p>
14040 !! html/parsoid
14041 <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>
14042 !! end
14043
14044 !! test
14045 BUG 648: Frameless image caption with a link (suffix)
14046 !! wikitext
14047 [[File:Foobar.jpg|text with a [[link]]foo in it]]
14048 !! html/php
14049 <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>
14050 </p>
14051 !! html/parsoid
14052 <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>
14053 !! end
14054
14055 !! test
14056 BUG 648: Frameless image caption with an interwiki link
14057 !! wikitext
14058 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
14059 !! html/php
14060 <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>
14061 </p>
14062 !! html/parsoid
14063 <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>
14064 !! end
14065
14066 !! test
14067 BUG 648: Frameless image caption with a piped interwiki link
14068 !! wikitext
14069 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
14070 !! html/php
14071 <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>
14072 </p>
14073 !! html/parsoid
14074 <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>
14075 !! end
14076
14077 !! test
14078 T107474: Frameless image caption with <nowiki>
14079 !! wikitext
14080 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
14081 !! html/parsoid
14082 <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>
14083 !! end
14084
14085 !! test
14086 Escape HTML special chars in image alt text
14087 !! wikitext
14088 [[File:Foobar.jpg|& < > "]]
14089 !! html/php
14090 <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>
14091 </p>
14092 !! html/parsoid
14093 <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>
14094 !! end
14095
14096 !! test
14097 Entities in file name and attributes
14098 !! wikitext
14099 [[File:7%25 solution.gif|manualthumb=7%25 solution.gif|link=7%25 solution|[[7%25 solution]]]]
14100 !! html/php
14101 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=7%25_solution.gif" class="new" title="File:7% solution.gif">7% solution</a>
14102 </p>
14103 !! html/parsoid
14104 <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>
14105 !! end
14106
14107 !! test
14108 BUG 499: Alt text should have &#1234;, not &amp;1234;
14109 !! wikitext
14110 [[File:Foobar.jpg|&#9792;]]
14111 !! html/php
14112 <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>
14113 </p>
14114 !! html/parsoid
14115 <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>
14116 !! end
14117
14118 !! test
14119 Broken image caption with link
14120 !! options
14121 parsoid=wt2html,wt2wt,html2html
14122 !! wikitext
14123 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
14124 !! html/php
14125 <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.
14126 </p>
14127 !! html/parsoid
14128 <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>
14129 !! end
14130
14131 !! test
14132 Image caption containing another image
14133 !! wikitext
14134 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
14135 !! html/php
14136 <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>
14137
14138 !! html/parsoid
14139 <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>
14140 !! end
14141
14142 !! test
14143 Image: caption containing a newline
14144 !! wikitext
14145 [[File:Foobar.jpg|This
14146 *is some text]]
14147 !! html/php
14148 <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>
14149 </p>
14150 !! html/parsoid
14151 <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>
14152 !!end
14153
14154 !!test
14155 Image: caption containing leading space
14156 (The leading space should not trigger nowiki escaping in wt2wt mode)
14157 !! wikitext
14158 [[File:Foobar.jpg|thumb| bar]]
14159 !! html/php
14160 <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>
14161
14162 !! html/parsoid
14163 <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>
14164 !!end
14165
14166 !! test
14167 Image: caption containing a table
14168 !! options
14169 parsoid=wt2html,wt2wt,html2html
14170 !! wikitext
14171 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
14172 {|
14173 ! Foo !! Bar
14174 |-
14175 | Foo1 || Bar1
14176 |}
14177 and some more text.]]
14178 !! html/php
14179 <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>
14180
14181 !! html/parsoid
14182 <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
14183 <table>
14184 <tbody>
14185 <tr><th>Foo </th><th>Bar</th></tr>
14186 <tr>
14187 <td>Foo1 </td>
14188 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
14189 !! end
14190
14191 !! test
14192 Bug 3090: External links other than http: in image captions
14193 !! wikitext
14194 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
14195 !! html/php
14196 <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>
14197
14198 !! html/parsoid
14199 <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>
14200 !! end
14201
14202 !! test
14203 Custom class
14204 !! options
14205 parsoid=wt2html,wt2wt,html2html
14206 !! wikitext
14207 [[Image:foobar.jpg|a|class=b]]
14208 !! html/php
14209 <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>
14210 </p>
14211 !! html/parsoid
14212 <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>
14213 !! end
14214
14215 !! test
14216 Localized image handling (1).
14217 !! options
14218 parsoid=wt2html,wt2wt,html2html
14219 language=es
14220 !! wikitext
14221 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
14222 !! html/php
14223 <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>
14224
14225 !! html/parsoid
14226 <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>
14227 !! end
14228
14229 !! test
14230 Localized image handling (2).
14231 !! options
14232 thumbsize=220
14233 parsoid=wt2html,wt2wt,html2html
14234 language=es
14235 !! wikitext
14236 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
14237 !! html/php
14238 <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>
14239
14240 !! html/parsoid
14241 <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>
14242 !! end
14243
14244 !! test
14245 Localized image handling (3).
14246 !! options
14247 language=fa
14248 parsoid=html2wt
14249 !! html/parsoid
14250 <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>
14251 !! wikitext
14252 [[File:Foobar.jpg|بندانگشتی]]
14253 !! end
14254
14255 !! test
14256 "border", "frameless" and "class" attributes on an image.
14257 !! options
14258 thumbsize=220
14259 parsoid=wt2html,wt2wt,html2html
14260 !! wikitext
14261 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
14262 !! html/php
14263 <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>
14264 </p>
14265 !! html/parsoid
14266 <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>
14267 !! end
14268
14269 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
14270 !! test
14271 Invalid image attributes (bug 62500)
14272 !! options
14273 thumbsize=220
14274 parsoid=wt2html,wt2wt,html2html
14275 !! wikitext
14276 [[File:Foobar.jpg|thumb|float|left|caption]]
14277
14278 [[File:Foobar.jpg|thumb|righ|caption]]
14279
14280 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
14281 !! html/php
14282 <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>
14283 <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>
14284 <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>
14285
14286 !! html/parsoid
14287 <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>
14288 <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>
14289 <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>
14290 !! end
14291
14292 !! article
14293 File:Barfoo.jpg
14294 !! text
14295 #REDIRECT [[File:Barfoo.jpg]]
14296 !! endarticle
14297
14298 # FIXME: Parsoid should run this test -- but we'd need to teach the
14299 # mockAPI about the redirected Barfoo.jpg image.
14300 !! test
14301 Redirected image
14302 !! wikitext
14303 [[Image:Barfoo.jpg]]
14304 !! html/php
14305 <p><a href="/wiki/File:Barfoo.jpg" class="mw-redirect" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
14306 </p>
14307 !! end
14308
14309 !! test
14310 Missing image with uploads disabled
14311 !! options
14312 wgEnableUploads=0
14313 !! wikitext
14314 [[File:Foobaz.jpg]]
14315 !! html/php
14316 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
14317 </p>
14318 !! html/parsoid
14319 <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>
14320 !! end
14321
14322 # Parsoid-specific testing for images
14323 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
14324 # Currently imperfect due to a flaw in the Parsoid testrunner
14325 # Work in progress
14326 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
14327 # image tests.
14328
14329 !! test
14330 Parsoid-specific image handling - simple image with size and middle alignment
14331 !! wikitext
14332 [[File:Foobar.jpg|middle|50px]]
14333 !! html/parsoid
14334 <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>
14335 !! end
14336
14337 !! test
14338 Parsoid-specific image handling - simple image with size, middle alignment,
14339 non-standard namespace alias
14340 !! options
14341 parsoid=wt2wt,wt2html,html2html
14342 !! wikitext
14343 [[Image:Foobar.jpg|middle|50px]]
14344 !! html/parsoid
14345 <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>
14346 !! end
14347
14348 !! test
14349 Parsoid-specific image handling - simple image with size and middle alignment
14350 (existing content)
14351 !! wikitext
14352 [[File:Foobar.jpg|50px|middle]]
14353 !! html/parsoid
14354 <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>
14355 !! end
14356
14357 !! test
14358 Parsoid-specific image handling - simple image with size and middle alignment
14359 and non-standard namespace name
14360 !! options
14361 parsoid=wt2html,wt2wt,html2html
14362 !! wikitext
14363 [[Image:Foobar.jpg|50px|middle]]
14364 !! html/parsoid
14365 <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>
14366 !! end
14367
14368 !! test
14369 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
14370 !! wikitext
14371 [[File:Foobar.jpg|500x10px|baseline|caption]]
14372 !! html/parsoid
14373 <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>
14374 !! end
14375
14376 !! test
14377 Parsoid-specific image handling - simple image with border and size spec
14378 !! wikitext
14379 [[File:Foobar.jpg|50px|border|caption]]
14380 !! html/parsoid
14381 <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>
14382 !! end
14383
14384 !! test
14385 Parsoid-specific image handling - thumbnail with halign, valign, and caption
14386 !! wikitext
14387 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
14388 !! html/parsoid
14389 <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>
14390 !! end
14391
14392 !! test
14393 Parsoid-specific image handling - thumbnail with halign, valign, and caption
14394 (existing content)
14395 !! wikitext
14396 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
14397 !! html/parsoid
14398 <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>
14399 !! end
14400
14401 !! test
14402 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
14403 !! wikitext
14404 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
14405 !! html/parsoid
14406 <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>
14407 !! end
14408
14409 !! test
14410 Parsoid-specific image handling - thumbnail with specific size, halign,
14411 valign, and caption (existing content)
14412 !! wikitext
14413 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
14414 !! html/parsoid
14415 <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>
14416 !! end
14417
14418 !! test
14419 Parsoid-specific image handling - framed image with specific size and caption
14420 (size is ignored)
14421 !! options
14422 parsoid=wt2html,wt2wt,html2html
14423 !! wikitext
14424 [[File:Foobar.jpg|frame|500x50px|caption]]
14425 !! html/parsoid
14426 <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>
14427 !! end
14428
14429 !! test
14430 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
14431 (size is ignored)
14432 !! options
14433 parsoid=wt2html,wt2wt,html2html
14434 !! wikitext
14435 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
14436 !! html/parsoid
14437 <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>
14438 !! end
14439
14440 !! test
14441 Parsoid-specific image handling - frameless image with specific size, border, and caption
14442 !! wikitext
14443 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
14444 !! html/parsoid
14445 <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>
14446 !! end
14447
14448 !! test
14449 Parsoid-specific image handling - simple image with a formatted caption
14450 !! wikitext
14451 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
14452 !! html/parsoid
14453 <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>
14454 !! end
14455
14456 !! test
14457 Parsoid-specific image handling - caption with a template in it
14458 !! wikitext
14459 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
14460 !! html/parsoid
14461 <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>
14462 !! end
14463
14464 !! test
14465 Parsoid-specific image handling - caption with unbalanced tags in it
14466 !! options
14467 parsoid=wt2html,wt2wt,html2html
14468 !! wikitext
14469 foo
14470 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
14471 bar
14472 !! html/parsoid
14473 <p>foo</p>
14474 <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>
14475 <p>bar</p>
14476 !! end
14477
14478 !! test
14479 Parsoid-specific image handling - empty caption (1)
14480 !! options
14481 parsoid=wt2html,wt2wt
14482 !! wikitext
14483 [[File:Foobar.jpg|thumb|]]
14484 !! html/parsoid
14485 <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>
14486 !! end
14487
14488 # empty captions don't get serialized unless we're in the "round trip" case
14489 !! test
14490 Parsoid-specific image handling - empty caption (2)
14491 !! options
14492 parsoid=html2wt
14493 !! html/parsoid
14494 <figure class="mw-default-size" typeof="mw:Image/Thumb">
14495 <a href="./File:Foobar.jpg">
14496 <img resource="./File:Foobar.jpg"
14497 src="//example.com/images/3/3a/Foobar.jpg"
14498 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
14499 height="25" width="220"/>
14500 </a>
14501 <figcaption></figcaption>
14502 </figure>
14503 !! wikitext
14504 [[File:Foobar.jpg|thumb]]
14505 !! end
14506
14507 !! test
14508 Parsoid-specific image handling - whitespace caption
14509 !! wikitext
14510 [[File:Foobar.jpg|thumb| ]]
14511 !! html/parsoid
14512 <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>
14513 !! end
14514
14515 !! test
14516 Parsoid-specific image handling - lang option
14517 !! wikitext
14518 foo
14519 [[File:Foobar.svg|lang=de|caption]]
14520 bar
14521 !! html/parsoid
14522 <p>foo
14523 <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>
14524 bar</p>
14525 !! end
14526
14527 ## Edge case bugs in Parsoid from T93580
14528 !! test
14529 T93580: 1. Templated <ref> inside block images
14530 !! wikitext
14531 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
14532
14533 <references />
14534 !! html/parsoid
14535 <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>
14536
14537 <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>
14538 !! end
14539
14540 !! test
14541 T93580: 2. <ref> inside inline images
14542 !! wikitext
14543 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
14544
14545 <references />
14546 !! html/parsoid
14547 <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>
14548
14549 <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>
14550 !! end
14551
14552 !! test
14553 T93580: 3. Templated <ref> inside inline images
14554 !! wikitext
14555 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
14556
14557 <references />
14558 !! html/parsoid
14559 <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>
14560
14561 <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>
14562 !! end
14563
14564 ###
14565 ### Subpages
14566 ###
14567 !! article
14568 Subpage test/subpage
14569 !! text
14570 foo
14571 !! endarticle
14572
14573 !! test
14574 Subpage link
14575 !! options
14576 subpage title=[[Subpage test]]
14577 !! wikitext
14578 [[/subpage]]
14579 !! html
14580 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
14581 </p>
14582 !! end
14583
14584 !! test
14585 Subpage noslash link
14586 !! options
14587 subpage title=[[Subpage test]]
14588 !! wikitext
14589 [[/subpage/]]
14590 !! html
14591 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
14592 </p>
14593 !! end
14594
14595 !! article
14596 Subpage test/1/2/subpage
14597 !! text
14598 blah
14599 !! endarticle
14600
14601 !! test
14602 Relative subpage noslash link
14603 !! options
14604 parsoid=wt2wt,wt2html,html2html
14605 subpage title=[[Subpage test/1/2/3/4]]
14606 !! wikitext
14607 [[../../subpage/]]
14608
14609 [[../../subpage]]
14610 !! html/php
14611 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
14612 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
14613 </p>
14614 !! html/parsoid
14615 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
14616 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
14617 !! end
14618
14619 !! test
14620 Parsoid: dot-slash prefixed wikilinks
14621 !! wikitext
14622 [[./foo]]
14623
14624 [[././bar]]
14625
14626 [[././baz/]]
14627 !! html/php
14628 <p>[[./foo]]
14629 </p><p>[[././bar]]
14630 </p><p>[[././baz/]]
14631 </p>
14632 !! html/parsoid
14633 <p>[[./foo]]
14634 </p><p>[[././bar]]
14635 </p><p>[[././baz/]]
14636 </p>
14637 !! end
14638
14639 !! test
14640 Render invalid page names as plain text (bug 51090)
14641 !! wikitext
14642 [[./../foo|bar]]
14643 [[foo�|bar]]
14644 [[foo/.|bar]]
14645 [[foo/..|bar]]
14646 [[foo~~~bar]]
14647 [[foo>bar]]
14648 [[foo[bar]]
14649 [[.]]
14650 [[..]]
14651 [[foo././bar]]
14652
14653 [[{{echo|./../foo}}|bar]]
14654 [[{{echo|foo/.}}|bar]]
14655 [[{{echo|foo/..}}|bar]]
14656 [[{{echo|foo~~~~bar}}]]
14657 [[{{echo|foo>bar}}]]
14658 [[{{echo|foo././bar}}]]
14659 [[{{echo|foo{bar}}]]
14660 [[{{echo|foo}bar}}]]
14661 [[{{echo|foo[bar}}]]
14662 [[{{echo|foo]bar}}]]
14663 [[{{echo|foo<bar}}]]
14664 !!html/php
14665 <p>[[./../foo|bar]]
14666 [[foo�|bar]]
14667 [[foo/.|bar]]
14668 [[foo/..|bar]]
14669 [[foo~~~bar]]
14670 [[foo&gt;bar]]
14671 [[foo[bar]]
14672 [[.]]
14673 [[..]]
14674 [[foo././bar]]
14675 </p><p>[[./../foo|bar]]
14676 [[foo/.|bar]]
14677 [[foo/..|bar]]
14678 [[foo~~~~bar]]
14679 [[foo&gt;bar]]
14680 [[foo././bar]]
14681 [[foo{bar]]
14682 [[foo}bar]]
14683 [[foo[bar]]
14684 [[foo]bar]]
14685 [[foo&lt;bar]]
14686 </p>
14687 !!html/parsoid
14688 <p>[[./../foo|bar]]
14689 [[foo�|bar]]
14690 [[foo/.|bar]]
14691 [[foo/..|bar]]
14692 [[foo~~~bar]]
14693 [[foo>bar]]
14694 [[foo[bar]]
14695 [[.]]
14696 [[..]]
14697 [[foo././bar]]</p>
14698
14699 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
14700 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
14701 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
14702 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
14703 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
14704 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
14705 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
14706 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
14707 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
14708 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
14709 [[<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>
14710 !!end
14711
14712 !! test
14713 Disabled subpages
14714 !! wikitext
14715 [[/subpage]]
14716 !! html
14717 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
14718 </p>
14719 !! end
14720
14721 !! test
14722 BUG 561: {{/Subpage}}
14723 !! options
14724 subpage title=[[Page]]
14725 !! wikitext
14726 {{/Subpage}}
14727 !! html
14728 <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>
14729 </p>
14730 !! end
14731
14732 ###
14733 ### Categories
14734 ###
14735 !! article
14736 Category:MediaWiki User's Guide
14737 !! text
14738 blah
14739 !! endarticle
14740
14741 !! test
14742 Link to category
14743 !! wikitext
14744 [[:Category:MediaWiki User's Guide]]
14745 !! html
14746 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
14747 </p>
14748 !! end
14749
14750 !! test
14751 Simple category
14752 !! options
14753 cat
14754 !! wikitext
14755 [[Category:MediaWiki User's Guide]]
14756 !! html/php
14757 cat=MediaWiki_User's_Guide sort=
14758 !! html/parsoid
14759 <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"}}'/>
14760 !! end
14761
14762 !! test
14763 PAGESINCATEGORY invalid title fatal (r33546 fix)
14764 !! wikitext
14765 {{PAGESINCATEGORY:<bogus>}}
14766 !! html
14767 <p>0
14768 </p>
14769 !! end
14770
14771 !! test
14772 Category with different sort key
14773 !! options
14774 cat
14775 !! wikitext
14776 [[Category:MediaWiki User's Guide|Foo]]
14777 !! html/php
14778 cat=MediaWiki_User's_Guide sort=Foo
14779 !! html/parsoid
14780 <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"}}'/>
14781 !! end
14782
14783 !! test
14784 Category with identical sort key
14785 !! options
14786 cat
14787 !! wikitext
14788 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14789 !! html/php
14790 cat=MediaWiki_User's_Guide sort=MediaWiki User's Guide
14791 !! html/parsoid
14792 <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"}}'/>
14793 !! end
14794
14795 !! test
14796 Category with empty sort key
14797 !! options
14798 cat
14799 pst
14800 !! wikitext
14801 [[Category:MediaWiki User's Guide|]]
14802 !! html/php
14803 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14804 !! end
14805
14806 !! test
14807 Category with empty sort key and parentheses
14808 !! options
14809 cat
14810 pst
14811 !! wikitext
14812 [[Category:Foo (bar)|]]
14813 !! html/php
14814 [[Category:Foo (bar)|Foo]]
14815 !! end
14816
14817 !! test
14818 Category with link tail
14819 !! options
14820 cat
14821 pst
14822 !! wikitext
14823 123[[Category:Foo]]456
14824 !! html/php
14825 123[[Category:Foo]]456
14826 !! end
14827
14828 !! test
14829 Category with template
14830 !! options
14831 cat
14832 pst
14833 !! wikitext
14834 [[Category:{{echo|Foo}}]]
14835 !! html/php
14836 [[Category:{{echo|Foo}}]]
14837 !! end
14838
14839 !! test
14840 Category with template in sort key
14841 !! options
14842 cat
14843 pst
14844 !! wikitext
14845 [[Category:Foo|{{echo|Bar}}]]
14846 !! html/php
14847 [[Category:Foo|{{echo|Bar}}]]
14848 !! end
14849
14850 !! test
14851 Category with template in sort key and title
14852 !! options
14853 cat
14854 pst
14855 !! wikitext
14856 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14857 !! html/php
14858 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14859 !! end
14860
14861 ## We used to, but no longer wt2wt this test since the default serializer
14862 ## will normalize all categories to serialize on their own line.
14863 ## This wikitext usage is going to be fairly uncommon in production and
14864 ## selser will take care of preserving formatting in those scenarios.
14865 !! test
14866 Category / paragraph interactions
14867 !! options
14868 parsoid=wt2html
14869 !! wikitext
14870 Foo [[Category:Baz]] Bar
14871
14872 Foo [[Category:Baz]]
14873 Bar
14874
14875 Foo
14876 [[Category:Baz]]
14877 Bar
14878
14879 Foo
14880 [[Category:Baz]] Bar
14881
14882 Foo
14883 [[Category:Baz]]
14884 [[Category:Baz]]
14885 [[Category:Baz]]
14886 Bar
14887
14888 [[Category:Baz]]
14889 [[Category:Baz]]
14890 [[Category:Baz]]
14891
14892 [[Category:Baz]]
14893 {{echo|[[Category:Baz]]}}
14894 [[Category:Baz]]
14895 !! html/php
14896 <p>Foo Bar
14897 </p><p>Foo
14898 Bar
14899 </p><p>Foo
14900 Bar
14901 </p><p>Foo Bar
14902 </p><p>Foo
14903 Bar
14904 </p>
14905 !! html/parsoid
14906 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14907 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14908 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14909 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14910 <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>
14911 <link rel="mw:PageProp/Category" href="Category:Baz"/>
14912 !! end
14913
14914 ## We used to, but no longer wt2wt this test since the default serializer
14915 ## will normalize all categories to serialize on their own line.
14916 ## This wikitext usage is going to be fairly uncommon in production and
14917 ## selser will take care of preserving formatting in those scenarios.
14918 ##
14919 ## The whitespace on the empty line is part of the test. Please do not delete
14920 !! test
14921 1. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14922 !! options
14923 parsoid=wt2html
14924 !! wikitext
14925 This
14926
14927 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
14928
14929 {{echo|[[Category:Foo]] and so should this!}}
14930 !! html/php
14931 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
14932 </p>
14933 !! html/parsoid
14934 <p>This
14935
14936 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
14937
14938 <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>
14939 !! end
14940
14941 ## Parsoid will not try to wt2wt this while preserving newlines because
14942 ## it suppresses excess newlines within list items -- and we don't want to
14943 ## introduce a special case just for categories, which is, in reality somewhat
14944 ## odd behavior -- categories are unlikely to be used in list items like this
14945 ## in top-level pages and are only likely to show up in template-generated
14946 ## list items where this RT-ing is a non-issue.
14947 ##
14948 ## The whitespace on the empty line is part of the test. Please do not delete
14949 !! test
14950 2. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14951 !! options
14952 parsoid=wt2html
14953 !! wikitext
14954 * This
14955
14956 [[Category:Foo]] and this should be part of the same list item
14957 * So should this
14958
14959 {{echo|[[Category:Foo]] and this should be part of the same list item}}
14960 !! html
14961 <ul><li>This and this should be part of the same list item</li>
14962 <li>So should this and this should be part of the same list item</li></ul>
14963 !! html/parsoid
14964 <ul>
14965 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
14966 <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>
14967 </ul>
14968 !! end
14969
14970 ## Newlines and categories that follow the last item of a list
14971 ## are treated differently because this (list followed by categories)
14972 ## is an extremely common pattern on wikis.
14973 !! test
14974 3. Categories and newlines: newline suppression for last list item should RT properly
14975 !! wikitext
14976 * a
14977 * b
14978
14979 [[Category:Foo]]
14980
14981 [[Category:Bar]]
14982 [[Category:Baz]]
14983 !! html/parsoid
14984 <ul><li> a</li>
14985 <li> b</li></ul>
14986
14987 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14988
14989 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14990 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14991 !! end
14992
14993 !! test
14994 4. Categories and newlines: newline suppression for last list item should RT properly
14995 !! wikitext
14996 * a
14997 **** b
14998
14999 [[Category:Foo]]
15000 !! html/parsoid
15001 <ul><li> a
15002 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
15003
15004 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15005 !! end
15006
15007 ## only wt2html for this to make sure the algo only applies to the rightmost path
15008 !! test
15009 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
15010 !! options
15011 parsoid=wt2html
15012 !! wikitext
15013 * a
15014 ** b
15015 [[Category:Foo]]
15016 * c
15017 ** d
15018 [[Category:Foo]]
15019 !! html/parsoid
15020 <ul><li> a
15021 <ul><li> b
15022 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
15023 <li> c
15024 <ul><li> d</li></ul></li></ul>
15025 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15026 !! end
15027
15028 ## We used to, but no longer wt2wt this test since the default serializer
15029 ## will normalize all categories to serialize on their own line.
15030 ## This wikitext usage is going to be fairly uncommon in production and
15031 ## selser will take care of preserving formatting in those scenarios.
15032 !! test
15033 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
15034 !! options
15035 parsoid=wt2html
15036 !! wikitext
15037 * a [[Category:Foo]]
15038 !! html/parsoid
15039 <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>
15040 !! end
15041
15042 # This test also demonstrates because of newline+category tunneling
15043 # through the list hander, template wrapping doesn't expand to the
15044 # containing list when the list item swallows the category.
15045 !! test
15046 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
15047 !! wikitext
15048 * {{echo|a
15049 [[Category:Foo]]}}
15050 !! html/parsoid
15051 <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
15052 </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>
15053 !! end
15054
15055 !! test
15056 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
15057 !! wikitext
15058 * a
15059
15060 {{echo|[[Category:Foo]]
15061 [[Category:Bar]]}}
15062 [[Category:Baz]]
15063 !! html/parsoid
15064 <ul><li> a</li></ul>
15065
15066 <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">
15067 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
15068 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
15069 !! end
15070
15071 !! test
15072 Category links with multiple namespaces
15073 !! wikitext
15074 [[Category:Project:Foo]]
15075 !! html/parsoid
15076 <link rel="mw:PageProp/Category" href="./Category:Project:Foo" />
15077 !! end
15078
15079 !! test
15080 Parsoid: Serialize link to category page with colon escape
15081 !! options
15082 parsoid
15083 !! wikitext
15084
15085 [[:Category:Foo]]
15086 [[:Category:Foo|Bar]]
15087 !! html
15088 <p>
15089 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
15090 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
15091 </p>
15092 !! end
15093
15094 # We used to, but no longer wt2wt this test since the default serializer
15095 # will normalize all categories to serialize on their own line.
15096 # This wikitext usage is going to be fairly uncommon in production and
15097 # selser will take care of preventing whitespace insertion if this
15098 # occurs in an article.
15099 #
15100 # html2html disabled for the same reason (whitespace insertion between
15101 # x and y).
15102 #
15103 # html2wt disabled because it localizes the "Category" namespace.
15104 !! test
15105 Link prefix/suffixes aren't applied to category links
15106 !! options
15107 parsoid=wt2html
15108 language=is
15109 !! wikitext
15110 x[[Category:Foo]]y
15111 !! html/php
15112 <p>xy
15113 </p>
15114 !! html/parsoid
15115 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
15116 !! end
15117
15118 !! test
15119 Parsoid: Serialize link to file page with colon escape
15120 !! options
15121 parsoid
15122 !! wikitext
15123
15124 [[:File:Foo.png]]
15125 [[:File:Foo.png|Bar]]
15126 !! html
15127 <p>
15128 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
15129 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
15130 </p>
15131 !! end
15132
15133 !! test
15134 Parsoid: Serialize a genuine category link without colon escape
15135 !! options
15136 parsoid
15137 !! wikitext
15138 [[Category:Foo]]
15139 [[Category:Foo|Bar]]
15140 !! html
15141 <link rel="mw:PageProp/Category" href="./Category:Foo">
15142 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
15143 !! end
15144
15145 !! test
15146 Normalize hrefs properly before testing for invalid link targets (bug 70894)
15147 !! options
15148 parsoid=html2wt
15149 !! html/parsoid
15150 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
15151 !! wikitext
15152 [[Category:Toxine bactérienne]]
15153 !! end
15154
15155 !! test
15156 Parsoid: Defaultsort
15157 !! wikitext
15158 {{DEFAULTSORT:Foo}}
15159 !! html/parsoid
15160 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
15161 !! end
15162
15163 !! test
15164 Parsoid: Defaultsort (template-generated)
15165 !! wikitext
15166 {{{{echo|DEFAULTSORT}}:Foo}}
15167 !! html/parsoid
15168 <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}}]}'/>
15169 !! end
15170
15171 ###
15172 ### Inter-language links
15173 ###
15174 !! test
15175 Interlanguage links
15176 !! options
15177 ill
15178 !! wikitext
15179 [[es:Alimento]]
15180 [[fr:Nourriture]]
15181 [[zh:食品]]
15182 !! html/php
15183 es:Alimento fr:Nourriture zh:食品
15184 !! html/parsoid
15185 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
15186 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
15187 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
15188 !! end
15189
15190 !! test
15191 Duplicate interlanguage links (bug 24502)
15192 !! options
15193 ill
15194 !! wikitext
15195 [[es:1]]
15196 [[es:2]]
15197 [[fr:1]]
15198 [[fr:2]]
15199 !! html/php
15200 es:1 fr:1
15201 !! html/parsoid
15202 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
15203 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
15204 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
15205 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
15206 !! end
15207
15208 ###
15209 ### Sections
15210 ###
15211 !! test
15212 Basic section headings
15213 !! wikitext
15214 == Headline 1 ==
15215 Some text
15216
15217 ==Headline 2==
15218 More
15219 ===Smaller headline===
15220 Blah blah
15221 !! html
15222 <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>
15223 <p>Some text
15224 </p>
15225 <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>
15226 <p>More
15227 </p>
15228 <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>
15229 <p>Blah blah
15230 </p>
15231 !! end
15232
15233 !! test
15234 Section headings with TOC
15235 !! wikitext
15236 == Headline 1 ==
15237 === Subheadline 1 ===
15238 ===== Skipping a level =====
15239 ====== Skipping a level ======
15240
15241 == Headline 2 ==
15242 Some text
15243 ===Another headline===
15244 !! html
15245 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15246 <ul>
15247 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
15248 <ul>
15249 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
15250 <ul>
15251 <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>
15252 <ul>
15253 <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>
15254 </ul>
15255 </li>
15256 </ul>
15257 </li>
15258 </ul>
15259 </li>
15260 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
15261 <ul>
15262 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
15263 </ul>
15264 </li>
15265 </ul>
15266 </div>
15267
15268 <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>
15269 <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>
15270 <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>
15271 <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>
15272 <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>
15273 <p>Some text
15274 </p>
15275 <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>
15276
15277 !! end
15278
15279 !! test
15280 TOC anchors don't collide
15281 !! wikitext
15282 __FORCETOC__
15283 == Headline 2 ==
15284 == Headline ==
15285 == Headline 2 ==
15286 == Headline ==
15287 !! html/php
15288 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15289 <ul>
15290 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
15291 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
15292 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
15293 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
15294 </ul>
15295 </div>
15296
15297 <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>
15298 <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>
15299 <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>
15300 <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>
15301
15302 !! end
15303
15304 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
15305 !! test
15306 Handling of sections up to level 6 and beyond
15307 !! wikitext
15308 = Level 1 Heading=
15309 == Level 2 Heading==
15310 === Level 3 Heading===
15311 ==== Level 4 Heading====
15312 ===== Level 5 Heading=====
15313 ====== Level 6 Heading======
15314 ======= Level 7 Heading=======
15315 ======== Level 8 Heading========
15316 ========= Level 9 Heading=========
15317 ========== Level 10 Heading==========
15318 !! html
15319 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15320 <ul>
15321 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
15322 <ul>
15323 <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>
15324 <ul>
15325 <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>
15326 <ul>
15327 <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>
15328 <ul>
15329 <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>
15330 <ul>
15331 <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>
15332 <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>
15333 <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>
15334 <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>
15335 <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>
15336 </ul>
15337 </li>
15338 </ul>
15339 </li>
15340 </ul>
15341 </li>
15342 </ul>
15343 </li>
15344 </ul>
15345 </li>
15346 </ul>
15347 </div>
15348
15349 <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>
15350 <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>
15351 <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>
15352 <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>
15353 <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>
15354 <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>
15355 <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>
15356 <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>
15357 <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>
15358 <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>
15359
15360 !! end
15361
15362 !! test
15363 TOC regression (T11764)
15364 !! wikitext
15365 == title 1 ==
15366 === title 1.1 ===
15367 ==== title 1.1.1 ====
15368 === title 1.2 ===
15369 == title 2 ==
15370 === title 2.1 ===
15371 !! html
15372 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15373 <ul>
15374 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15375 <ul>
15376 <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>
15377 <ul>
15378 <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>
15379 </ul>
15380 </li>
15381 <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>
15382 </ul>
15383 </li>
15384 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15385 <ul>
15386 <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>
15387 </ul>
15388 </li>
15389 </ul>
15390 </div>
15391
15392 <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>
15393 <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>
15394 <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>
15395 <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>
15396 <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>
15397 <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>
15398
15399 !! end
15400
15401 !! test
15402 TOC for heading containing <span id="..."></span> (T96153)
15403 !! wikitext
15404 __FORCETOC__
15405 ==<span id="old-anchor"></span>New title==
15406 !! html/php
15407 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15408 <ul>
15409 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
15410 </ul>
15411 </div>
15412
15413 <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>
15414
15415 !! end
15416
15417 !! test
15418 TOC with wgMaxTocLevel=3 (bug 6204)
15419 !! options
15420 wgMaxTocLevel=3
15421 !! wikitext
15422 == title 1 ==
15423 === title 1.1 ===
15424 ==== title 1.1.1 ====
15425 === title 1.2 ===
15426 == title 2 ==
15427 === title 2.1 ===
15428 !! html
15429 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15430 <ul>
15431 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15432 <ul>
15433 <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>
15434 <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>
15435 </ul>
15436 </li>
15437 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15438 <ul>
15439 <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>
15440 </ul>
15441 </li>
15442 </ul>
15443 </div>
15444
15445 <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>
15446 <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>
15447 <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>
15448 <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>
15449 <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>
15450 <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>
15451
15452 !! end
15453
15454 !! test
15455 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
15456 !! options
15457 wgMaxTocLevel=3
15458 !! wikitext
15459 ==Section 1==
15460 ===Section 1.1===
15461 ====Section 1.1.1====
15462 ====Section 1.1.1.1====
15463 ==Section 2==
15464 !! html
15465 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15466 <ul>
15467 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
15468 <ul>
15469 <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>
15470 </ul>
15471 </li>
15472 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
15473 </ul>
15474 </div>
15475
15476 <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>
15477 <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>
15478 <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>
15479 <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>
15480 <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>
15481
15482 !! end
15483
15484
15485 !! test
15486 Resolving duplicate section names
15487 !! wikitext
15488 == Foo bar ==
15489 == Foo bar ==
15490 !! html
15491 <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>
15492 <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>
15493
15494 !! end
15495
15496 !! test
15497 Resolving duplicate section names with differing case (bug 10721)
15498 !! wikitext
15499 == Foo bar ==
15500 == Foo Bar ==
15501 !! html
15502 <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>
15503 <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>
15504
15505 !! end
15506
15507 !! article
15508 Template:sections
15509 !! text
15510 ===Section 1===
15511 ==Section 2==
15512 !! endarticle
15513
15514 !! test
15515 Template with sections, __NOTOC__
15516 !! wikitext
15517 __NOTOC__
15518 ==Section 0==
15519 {{sections}}
15520 ==Section 4==
15521 !! html
15522 <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>
15523 <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>
15524 <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>
15525 <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>
15526
15527 !! end
15528
15529 !! test
15530 __NOEDITSECTION__ keyword
15531 !! wikitext
15532 __NOEDITSECTION__
15533 ==Section 1==
15534 ==Section 2==
15535 !! html
15536 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
15537 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
15538
15539 !! end
15540
15541 !! test
15542 Link inside a section heading
15543 !! wikitext
15544 ==Section with a [[Main Page|link]] in it==
15545 !! html
15546 <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>
15547
15548 !! end
15549
15550 !! test
15551 TOC regression (T14077)
15552 !! wikitext
15553 __TOC__
15554 == title 1 ==
15555 === title 1.1 ===
15556 == title 2 ==
15557 !! html
15558 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15559 <ul>
15560 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15561 <ul>
15562 <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>
15563 </ul>
15564 </li>
15565 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
15566 </ul>
15567 </div>
15568
15569 <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>
15570 <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>
15571 <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>
15572
15573 !! end
15574
15575 !! test
15576 BUG 1219 URL next to image (good)
15577 !! wikitext
15578 http://example.com [[File:Foobar.jpg]]
15579 !! html/php
15580 <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>
15581 </p>
15582 !! html/parsoid
15583 <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>
15584 !!end
15585
15586 !! test
15587 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
15588 !! wikitext
15589 ===
15590 The line above must have a trailing space!
15591 === <!--
15592 --> <!-- -->
15593 But just in case it doesn't...
15594 !! html
15595 <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>
15596 <p>The line above must have a trailing space!
15597 </p>
15598 <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>
15599 <p>But just in case it doesn't...
15600 </p>
15601 !! end
15602
15603 !! test
15604 Header with special characters (bug 25462)
15605 !! wikitext
15606 The tooltips shall not show entities to the user (ie. be double escaped)
15607
15608 == text > text ==
15609 section 1
15610
15611 == text < text ==
15612 section 2
15613
15614 == text & text ==
15615 section 3
15616
15617 == text ' text ==
15618 section 4
15619
15620 == text " text ==
15621 section 5
15622 !! html
15623 <p>The tooltips shall not show entities to the user (ie. be double escaped)
15624 </p>
15625 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15626 <ul>
15627 <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>
15628 <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>
15629 <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>
15630 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
15631 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
15632 </ul>
15633 </div>
15634
15635 <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>
15636 <p>section 1
15637 </p>
15638 <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>
15639 <p>section 2
15640 </p>
15641 <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>
15642 <p>section 3
15643 </p>
15644 <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>
15645 <p>section 4
15646 </p>
15647 <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>
15648 <p>section 5
15649 </p>
15650 !! end
15651
15652 !! test
15653 Header with space, plus and underscore as entity
15654 !! wikitext
15655 Id should not contain + for spaces
15656
15657 == Space between Text ==
15658 section 1
15659
15660 == Space-Entity&#32;between&#32;Text ==
15661 section 2
15662
15663 == Plus+between+Text ==
15664 section 3
15665
15666 == Plus-Entity&#43;between&#43;Text ==
15667 section 4
15668
15669 == Underscore_between_Text ==
15670 section 5
15671
15672 == Underscore-Entity&#95;between&#95;Text ==
15673 section 6
15674
15675 [[#Space between Text]]
15676 [[#Space-Entity&#32;between&#32;Text]]
15677 [[#Plus+between+Text]]
15678 [[#Plus-Entity&#43;between&#43;Text]]
15679 [[#Underscore_between_Text]]
15680 [[#Underscore-Entity&#95;between&#95;Text]]
15681 !! html
15682 <p>Id should not contain + for spaces
15683 </p>
15684 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15685 <ul>
15686 <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>
15687 <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>
15688 <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>
15689 <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>
15690 <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>
15691 <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>
15692 </ul>
15693 </div>
15694
15695 <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>
15696 <p>section 1
15697 </p>
15698 <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>
15699 <p>section 2
15700 </p>
15701 <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>
15702 <p>section 3
15703 </p>
15704 <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>
15705 <p>section 4
15706 </p>
15707 <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>
15708 <p>section 5
15709 </p>
15710 <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>
15711 <p>section 6
15712 </p><p><a href="#Space_between_Text">#Space between Text</a>
15713 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
15714 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
15715 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
15716 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
15717 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
15718 </p>
15719 !! end
15720
15721 !! test
15722 Headers with excess '=' characters
15723 (Are similar tests necessary beyond the 1st level?)
15724 !! wikitext
15725 =foo==
15726 ==foo=
15727 =''italic'' heading==
15728 ==''italic'' heading=
15729 !! html
15730 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15731 <ul>
15732 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
15733 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
15734 <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>
15735 <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>
15736 </ul>
15737 </div>
15738
15739 <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>
15740 <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>
15741 <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>
15742 <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>
15743
15744 !! end
15745
15746 !! test
15747 HTML headers vs TOC (bug 23393)
15748 (__NOEDITSECTION__ for clearer output, doesn't matter here)
15749 !! wikitext
15750 <h1>Header 1</h1>
15751 == Header 1.1 ==
15752 == Header 1.2 ==
15753
15754 <h1>Header 2
15755 </h1>
15756 == Header 2.1 ==
15757 == Header 2.2 ==
15758 __NOEDITSECTION__
15759 !! html
15760 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15761 <ul>
15762 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
15763 <ul>
15764 <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>
15765 <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>
15766 </ul>
15767 </li>
15768 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
15769 <ul>
15770 <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>
15771 <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>
15772 </ul>
15773 </li>
15774 </ul>
15775 </div>
15776
15777 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
15778 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
15779 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
15780 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
15781 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
15782 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
15783
15784 !! end
15785
15786 !! test
15787 Single-line or multiline-comments can follow headings
15788 !! options
15789 parsoid=wt2html,wt2wt
15790 !! wikitext
15791 ==foo==<!---->
15792 ==bar==<!--c1-->
15793 ==baz==<!--
15794 c2
15795 c3-->
15796 !! html
15797 <h2><span class="mw-headline" id="foo">foo</span></h2>
15798 <h2><span class="mw-headline" id="bar">bar</span></h2>
15799 <h2><span class="mw-headline" id="baz">baz</span></h2>
15800
15801 !! end
15802
15803 !! test
15804 BUG 1219 URL next to image (broken)
15805 !! wikitext
15806 http://example.com[[File:Foobar.jpg]]
15807 !! html/php
15808 <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>
15809 </p>
15810 !! html/parsoid
15811 <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>
15812 !!end
15813
15814 !! test
15815 Bug 1186 news: in the middle of text
15816 !! wikitext
15817 http://en.wikinews.org/wiki/Wikinews:Workplace
15818 !! html
15819 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
15820 </p>
15821 !!end
15822
15823
15824 !! test
15825 Namespaced link must have a title
15826 !! wikitext
15827 [[Project:]]
15828 !! html
15829 <p>[[Project:]]
15830 </p>
15831 !!end
15832
15833 !! test
15834 Namespaced link must have a title (bad fragment version)
15835 !! wikitext
15836 [[Project:#fragment]]
15837 !! html
15838 <p>[[Project:#fragment]]
15839 </p>
15840 !!end
15841
15842
15843 ###
15844 ### HTML tags and HTML attributes
15845 ###
15846
15847 !! test
15848 div with no attributes
15849 !! wikitext
15850 <div>HTML rocks</div>
15851 !! html
15852 <div>HTML rocks</div>
15853
15854 !! end
15855
15856 !! test
15857 div with double-quoted attribute
15858 !! wikitext
15859 <div id="rock">HTML rocks</div>
15860 !! html
15861 <div id="rock">HTML rocks</div>
15862
15863 !! end
15864
15865 !! test
15866 div with single-quoted attribute
15867 !! wikitext
15868 <div id='rock'>HTML rocks</div>
15869 !! html
15870 <div id="rock">HTML rocks</div>
15871
15872 !! end
15873
15874 !! test
15875 div with unquoted attribute
15876 !! wikitext
15877 <div id=rock>HTML rocks</div>
15878 !! html
15879 <div id="rock">HTML rocks</div>
15880
15881 !! end
15882
15883 !! test
15884 div with illegal double attributes
15885 !! wikitext
15886 <div id="a" id="b">HTML rocks</div>
15887 !! html
15888 <div id="b">HTML rocks</div>
15889
15890 !!end
15891
15892 !! test
15893 div with empty attribute value, space before equals
15894 !! options
15895 parsoid=wt2html,html2html
15896 !! wikitext
15897 <div class =>HTML rocks</div>
15898 !! html/php
15899 <div class="">HTML rocks</div>
15900
15901 !! html/parsoid
15902 <div class="" data-parsoid='{"stx":"html"}'>HTML rocks</div>
15903 !! end
15904
15905 !! test
15906 div with multiple empty attribute values
15907 !! options
15908 parsoid=wt2html,html2html
15909 !! wikitext
15910 <div id= title=>HTML rocks</div>
15911 !! html/php
15912 <div id="title.3D">HTML rocks</div>
15913
15914 !! html/parsoid
15915 <div id="title=" data-parsoid='{"stx":"html"}'>HTML rocks</div>
15916 !! end
15917
15918 !! test
15919 table with multiple empty attribute values
15920 !! options
15921 parsoid=wt2html,html2html
15922 !! wikitext
15923 {| title= id=
15924 | hi
15925 |}
15926 !! html/php
15927 <table title="id=">
15928 <tr>
15929 <td> hi
15930 </td></tr></table>
15931
15932 !! html/parsoid
15933 <table title="id=">
15934 <tbody><tr><td> hi</td></tr>
15935 </tbody></table>
15936 !! end
15937
15938 !! test
15939 div with braces in attribute value
15940 !! wikitext
15941 <div title="{}">Foo</div>
15942 !! html/php
15943 <div title="&#123;}">Foo</div>
15944
15945 !! html/parsoid
15946 <div title="{}">Foo</div>
15947 !! end
15948
15949 !! test
15950 div with empty attribute value, no space before equals
15951 !! options
15952 parsoid=wt2html,html2html
15953 !! wikitext
15954 <div class=>HTML rocks</div>
15955 !! html/php
15956 <div class="">HTML rocks</div>
15957
15958 !! html/parsoid
15959 <div class="">HTML rocks</div>
15960 !! end
15961
15962 !! test
15963 HTML multiple attributes correction
15964 !! wikitext
15965 <p class="error" class="awesome">Awesome!</p>
15966 !! html
15967 <p class="awesome">Awesome!</p>
15968
15969 !!end
15970
15971 !! test
15972 Table multiple attributes correction
15973 !! wikitext
15974 {|
15975 !+ class="error" class="awesome"| status
15976 |}
15977 !! html
15978 <table>
15979 <tr>
15980 <th class="awesome"> status
15981 </th></tr></table>
15982
15983 !!end
15984
15985 !! test
15986 DIV IN UPPERCASE
15987 !! wikitext
15988 <DIV ID="x">HTML ROCKS</DIV>
15989 !! html
15990 <div id="x">HTML ROCKS</div>
15991
15992 !!end
15993
15994 !! test
15995 Non-ASCII pseudo-tags are rendered as text
15996 !! wikitext
15997 <khyô>
15998 !! html
15999 <p>&lt;khyô&gt;
16000 </p>
16001 !! end
16002
16003 !! test
16004 Pseudo-tag with URL 'name' renders as url link
16005 !! wikitext
16006 <http://example.com/>
16007 !! html
16008 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
16009 </p>
16010 !! end
16011
16012 !! test
16013 text with amp in the middle of nowhere
16014 !! wikitext
16015 Remember AT&T?
16016 !! html
16017 <p>Remember AT&amp;T?
16018 </p>
16019 !! end
16020
16021 !! test
16022 text with character entity: eacute
16023 !! wikitext
16024 I always thought &eacute; was a cute letter.
16025 !! html
16026 <p>I always thought &#233; was a cute letter.
16027 </p>
16028 !! html+tidy
16029 <p>I always thought é was a cute letter.</p>
16030 !! end
16031
16032 !! test
16033 text with entity-escaped character entity-like string: eacute
16034 !! wikitext
16035 I always thought &amp;eacute; was a cute letter.
16036 !! html
16037 <p>I always thought &amp;eacute; was a cute letter.
16038 </p>
16039 !! end
16040
16041 !! test
16042 text with undefined character entity: xacute
16043 !! wikitext
16044 I always thought &xacute; was a cute letter.
16045 !! html
16046 <p>I always thought &amp;xacute; was a cute letter.
16047 </p>
16048 !! end
16049
16050 !! test
16051 HTML5 tags
16052 !! wikitext
16053 <data value="5">five</data>
16054 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
16055 <mark>This highlighted text</mark>
16056 !! html
16057 <p><data value="5">five</data>
16058 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
16059 <mark>This highlighted text</mark>
16060 </p>
16061 !! end
16062
16063 !! test
16064 HTML tag with leading space is parsed as text
16065 !! wikitext
16066 < div>foo< /div>
16067 !! html
16068 <p>&lt; div&gt;foo&lt; /div&gt;
16069 </p>
16070 !! end
16071
16072 ###
16073 ### Nesting tests (see bug 41545, 50604, 51081)
16074 ###
16075
16076 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
16077 # Note that html2wt is considerably more difficult if we use <b> in
16078 # the test case, instead of <big>
16079 !! test
16080 Ensure that HTML adoption agency algorithm is properly implemented.
16081 !! wikitext
16082 <big>X<big>Y</big>Z</big>
16083 !! html
16084 <p><big>X<big>Y</big>Z</big>
16085 </p>
16086 !! end
16087
16088 # This was bug 41545 in the PHP parser.
16089 # Note that tidy doesn't handle this correctly.
16090 !! test
16091 Nesting of <kbd>
16092 !! wikitext
16093 <kbd>X<kbd>Y</kbd>Z</kbd>
16094 !! html
16095 <p><kbd>X<kbd>Y</kbd>Z</kbd>
16096 </p>
16097 !! end
16098
16099 # The following cases were bug 51081 in the PHP parser.
16100 # Note that there are some other nestable tags (b, i, etc) which are
16101 # not covered; see bug 51081 for discussion.
16102
16103 # Note that tidy doesn't handle this correctly.
16104 !! test
16105 Nesting of <em>
16106 !! wikitext
16107 <em>X<em>Y</em>Z</em>
16108 !! html
16109 <p><em>X<em>Y</em>Z</em>
16110 </p>
16111 !! end
16112
16113 # Note that tidy doesn't handle this correctly.
16114 !! test
16115 Nesting of <strong>
16116 !! wikitext
16117 <strong>X<strong>Y</strong>Z</strong>
16118 !! html
16119 <p><strong>X<strong>Y</strong>Z</strong>
16120 </p>
16121 !! end
16122
16123 !! test
16124 Nesting of <q>
16125 !! wikitext
16126 <q>X<q>Y</q>Z</q>
16127 !! html+tidy
16128 <p><q>X<q>Y</q>Z</q></p>
16129 !! end
16130
16131 # Note that tidy doesn't handle this correctly.
16132 !! test
16133 Nesting of <ruby>
16134 !! wikitext
16135 <ruby>X<ruby>Y</ruby>Z</ruby>
16136 !! html
16137 <p><ruby>X<ruby>Y</ruby>Z</ruby>
16138 </p>
16139 !! end
16140
16141 # Note that tidy doesn't handle this correctly.
16142 !! test
16143 Nesting of <bdo>
16144 !! wikitext
16145 <bdo>X<bdo>Y</bdo>Z</bdo>
16146 !! html
16147 <p><bdo>X<bdo>Y</bdo>Z</bdo>
16148 </p>
16149 !! end
16150
16151
16152 ###
16153 ### Media links
16154 ###
16155
16156 !! test
16157 Media link
16158 !! wikitext
16159 [[Media:Foobar.jpg]]
16160 !! html
16161 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
16162 </p>
16163 !! end
16164
16165 !! test
16166 Media link with text
16167 !! wikitext
16168 [[Media:Foobar.jpg|A neat file to look at]]
16169 !! html
16170 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
16171 </p>
16172 !! end
16173
16174 # FIXME: this is still bad HTML tag nesting
16175 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
16176 !! test
16177 Media link with nasty text
16178 !! wikitext
16179 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
16180 !! html
16181 <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>
16182
16183 !! html+tidy
16184 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
16185 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
16186 !! end
16187
16188 !! test
16189 Media link to nonexistent file (bug 1702)
16190 !! wikitext
16191 [[Media:No such.jpg]]
16192 !! html
16193 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
16194 </p>
16195 !! end
16196
16197 !! test
16198 Image link to nonexistent file (bug 1850 - good)
16199 !! wikitext
16200 [[File:No_such.jpg]]
16201 !! html/php
16202 <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>
16203 </p>
16204 !! html/parsoid
16205 <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>
16206 !! end
16207
16208 !! test
16209 :Image link to nonexistent file (bug 1850 - bad)
16210 !! wikitext
16211 [[:Image:No such.jpg]]
16212 !! html/php
16213 <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>
16214 </p>
16215 !! html/parsoid
16216 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
16217 !! end
16218
16219
16220
16221 !! test
16222 Character reference normalization in link text (bug 1938)
16223 !! wikitext
16224 [[Main Page|this&that]]
16225 !! html
16226 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
16227 </p>
16228 !!end
16229
16230 !! article
16231 אַ
16232 !! text
16233 Test for unicode normalization
16234
16235 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
16236 !! endarticle
16237
16238 !! test
16239 (bug 19451) Links should refer to the normalized form.
16240 !! wikitext
16241 [[&#xFB2E;]]
16242 [[&#x5d0;&#x5b7;]]
16243 [[&#x5d0;ַ]]
16244 [[א&#x5b7;]]
16245 [[אַ]]
16246 !! html
16247 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
16248 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
16249 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
16250 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
16251 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
16252 </p>
16253 !! end
16254
16255 !! test
16256 Empty attribute crash test (bug 2067)
16257 !! wikitext
16258 <font color="">foo</font>
16259 !! html
16260 <p><font color="">foo</font>
16261 </p>
16262 !! end
16263
16264 !! test
16265 Empty attribute crash test single-quotes (bug 2067)
16266 !! wikitext
16267 <font color=''>foo</font>
16268 !! html
16269 <p><font color="">foo</font>
16270 </p>
16271 !! end
16272
16273 !! test
16274 Attribute test: equals, then nothing
16275 !! options
16276 parsoid=wt2html,html2html
16277 !! wikitext
16278 <font color=>foo</font>
16279 !! html/php
16280 <p><font color="">foo</font>
16281 </p>
16282 !! html/parsoid
16283 <p><font color="" data-parsoid='{"stx":"html"}'>foo</font></p>
16284 !! end
16285
16286 !! test
16287 Attribute test: unquoted value
16288 !! options
16289 parsoid=wt2html,html2html
16290 !! wikitext
16291 <font color=x>foo</font>
16292 !! html/php
16293 <p><font color="x">foo</font>
16294 </p>
16295 !! html/parsoid
16296 <p><font color="x" data-parsoid='{"stx":"html"}'>foo</font></p>
16297 !! end
16298
16299 !! test
16300 Attribute test: unquoted but illegal value (hash)
16301 !! wikitext
16302 <font color=#x>foo</font>
16303 !! html
16304 <p><font color="#x">foo</font>
16305 </p>
16306 !! end
16307
16308 # Parsoid does not serialize to empty attribute syntax,
16309 # so wt2wt and html2wt cases are skipped
16310 !! test
16311 Attribute test: no value (T54330)
16312 !! options
16313 parsoid=wt2html,html2html
16314 !! wikitext
16315 <font color>foo</font>
16316 !! html/php
16317 <p><font color="">foo</font>
16318 </p>
16319 !! html/parsoid
16320 <p><font color="">foo</font></p>
16321 !! end
16322
16323 !! test
16324 Bug 2095: link with three closing brackets
16325 !! wikitext
16326 [[Main Page]]]
16327 !! html/php
16328 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
16329 </p>
16330 !! html/parsoid
16331 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
16332 !! end
16333
16334 !! test
16335 Bug 2095: link with pipe and three closing brackets
16336 !! wikitext
16337 [[Main Page|link]]]
16338 !! html/php
16339 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
16340 </p>
16341 !! html/parsoid
16342 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
16343 !! end
16344
16345 !! test
16346 Bug 2095: link with pipe and three closing brackets, version 2
16347 !! wikitext
16348 [[Main Page|[http://example.com/]]]
16349 !! html/php
16350 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
16351 </p>
16352 !! html/parsoid
16353 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
16354 !! end
16355
16356
16357 ###
16358 ### Safety
16359 ###
16360
16361 !! article
16362 Template:Dangerous attribute
16363 !! text
16364 " onmouseover="alert(document.cookie)
16365 !! endarticle
16366
16367 !! article
16368 Template:Dangerous style attribute
16369 !! text
16370 border-size: expression(alert(document.cookie))
16371 !! endarticle
16372
16373 !! article
16374 Template:Div style
16375 !! text
16376 <div style="float: right; {{{1}}}">Magic div</div>
16377 !! endarticle
16378
16379 !! test
16380 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
16381 !! wikitext
16382 <div title="{{test}}"></div>
16383 !! html
16384 <div title="This is a test template"></div>
16385
16386 !! end
16387
16388 # Parsoid has enough context to handle this case
16389 !! test
16390 Bug 2304: HTML attribute safety (dangerous template; 2309)
16391 !! wikitext
16392 <div title="{{dangerous attribute}}"></div>
16393 !! html/php
16394 <div title=""></div>
16395
16396 !! html/parsoid
16397 <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>
16398 !! end
16399
16400 !! test
16401 Bug 2304: HTML attribute safety (dangerous style template; 2309)
16402 !! wikitext
16403 <div style="{{dangerous style attribute}}"></div>
16404 !! html
16405 <div style="/* insecure input */"></div>
16406
16407 !! end
16408
16409 !! test
16410 Bug 2304: HTML attribute safety (safe parameter; 2309)
16411 !! wikitext
16412 {{div style|width: 200px}}
16413 !! html
16414 <div style="float: right; width: 200px">Magic div</div>
16415
16416 !! end
16417
16418 !! test
16419 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
16420 !! wikitext
16421 {{div style|width: expression(alert(document.cookie))}}
16422 !! html
16423 <div style="/* insecure input */">Magic div</div>
16424
16425 !! end
16426
16427 !! test
16428 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
16429 !! wikitext
16430 {{div style|"><script>alert(document.cookie)</script>}}
16431 !! html
16432 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16433
16434 !! end
16435
16436 !! test
16437 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
16438 !! wikitext
16439 {{div style|" ><script>alert(document.cookie)</script>}}
16440 !! html
16441 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16442
16443 !! end
16444
16445 !! test
16446 Bug 2304: HTML attribute safety (link)
16447 !! wikitext
16448 <div title="[[Main Page]]"></div>
16449 !! html
16450 <div title="&#91;&#91;Main Page]]"></div>
16451
16452 !! end
16453
16454 !! test
16455 Bug 2304: HTML attribute safety (italics)
16456 !! wikitext
16457 <div title="''foobar''"></div>
16458 !! html
16459 <div title="&#39;&#39;foobar&#39;&#39;"></div>
16460
16461 !! end
16462
16463 !! test
16464 Bug 2304: HTML attribute safety (bold)
16465 !! wikitext
16466 <div title="'''foobar'''"></div>
16467 !! html
16468 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
16469
16470 !! end
16471
16472
16473 !! test
16474 Bug 2304: HTML attribute safety (ISBN)
16475 !! wikitext
16476 <div title="ISBN 1234567890"></div>
16477 !! html
16478 <div title="&#73;SBN 1234567890"></div>
16479
16480 !! end
16481
16482 !! test
16483 Bug 2304: HTML attribute safety (RFC)
16484 !! wikitext
16485 <div title="RFC 1234"></div>
16486 !! html
16487 <div title="&#82;FC 1234"></div>
16488
16489 !! end
16490
16491 !! test
16492 Bug 2304: HTML attribute safety (PMID)
16493 !! wikitext
16494 <div title="PMID 1234567890"></div>
16495 !! html
16496 <div title="&#80;MID 1234567890"></div>
16497
16498 !! end
16499
16500 !! test
16501 Bug 2304: HTML attribute safety (web link)
16502 !! wikitext
16503 <div title="http://example.com/"></div>
16504 !! html
16505 <div title="http&#58;//example.com/"></div>
16506
16507 !! end
16508
16509 !! test
16510 Bug 2304: HTML attribute safety (named web link)
16511 !! wikitext
16512 <div title="[http://example.com/ link]"></div>
16513 !! html
16514 <div title="&#91;http&#58;//example.com/ link]"></div>
16515
16516 !! end
16517
16518 !! test
16519 Bug 3244: HTML attribute safety (extension; safe)
16520 !! wikitext
16521 <div style="<nowiki>background:blue</nowiki>"></div>
16522 !! html
16523 <div style="background:blue"></div>
16524
16525 !! end
16526
16527 !! test
16528 Bug 3244: HTML attribute safety (extension; unsafe)
16529 !! wikitext
16530 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
16531 !! html
16532 <div style="/* insecure input */"></div>
16533
16534 !! end
16535
16536 # More MSIE fun discovered by Tom Gilder
16537
16538 !! test
16539 MSIE CSS safety test: spurious slash
16540 !! wikitext
16541 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
16542 !! html
16543 <div style="/* insecure input */">evil</div>
16544
16545 !! end
16546
16547 !! test
16548 MSIE CSS safety test: hex code
16549 !! wikitext
16550 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
16551 !! html
16552 <div style="/* insecure input */">evil</div>
16553
16554 !! end
16555
16556 !! test
16557 MSIE CSS safety test: comment in url
16558 !! wikitext
16559 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
16560 !! html
16561 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
16562
16563 !! end
16564
16565 !! test
16566 MSIE CSS safety test: comment in expression
16567 !! wikitext
16568 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
16569 !! html
16570 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
16571
16572 !! end
16573
16574 !! test
16575 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
16576 !! wikitext
16577 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
16578 !! html
16579 <p style="/* invalid control char */">A</p>
16580
16581 !! end
16582
16583 !! test
16584 MSIE 6 CSS safety test: Fullwidth (bug 55332)
16585 !! wikitext
16586 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
16587 <div style="top:EXPRESSION(alert())">B</div>
16588 !! html
16589 <p style="/* insecure input */">A</p>
16590 <div style="/* insecure input */">B</div>
16591
16592 !! end
16593
16594 !! test
16595 MSIE 6 CSS safety test: IPA extensions (bug 55332)
16596 !! wikitext
16597 <div style="background-image:uʀʟ(javascript:alert())">A</div>
16598 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
16599 !! html
16600 <div style="/* insecure input */">A</div>
16601 <p style="/* insecure input */">B</p>
16602
16603 !! end
16604
16605 !! test
16606 MSIE 6 CSS safety test: sup/sub script (bug 55332)
16607 !! wikitext
16608 <div style="background-image:url⁽javascript:alert())">A</div>
16609 <div style="background-image:url₍javascript:alert())">B</div>
16610 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
16611 !! html
16612 <div style="/* insecure input */">A</div>
16613 <div style="/* insecure input */">B</div>
16614 <p style="/* insecure input */">C</p>
16615
16616 !! end
16617
16618 # FIXME: Parsoid fails to sanitize this! See T58846.
16619 !! test
16620 Opera -o-link CSS
16621 !! wikitext
16622 <div
16623 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;"
16624 style="-o-link:attr(title);-o-link-source:current">X</div>
16625 !! html
16626 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
16627
16628 !! end
16629
16630 !! test
16631 MSIE 6 CSS safety test: Repetition markers (bug 55332)
16632 !! wikitext
16633 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
16634 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
16635 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
16636 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
16637 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
16638 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
16639 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
16640 !! html
16641 <p style="/* insecure input */">A</p>
16642 <p style="/* insecure input */">B</p>
16643 <p style="/* insecure input */">C</p>
16644 <p style="/* insecure input */">D</p>
16645 <p style="/* insecure input */">E</p>
16646 <p style="/* insecure input */">F</p>
16647 <p style="/* insecure input */">G</p>
16648
16649 !! end
16650
16651 !! test
16652 Table attribute legitimate extension
16653 !! wikitext
16654 {|
16655 !+ style="<nowiki>color:blue</nowiki>"| status
16656 |}
16657 !! html
16658 <table>
16659 <tr>
16660 <th style="color:blue"> status
16661 </th></tr></table>
16662
16663 !!end
16664
16665 !! test
16666 Table attribute safety
16667 !! wikitext
16668 {|
16669 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
16670 |}
16671 !! html
16672 <table>
16673 <tr>
16674 <th style="/* insecure input */"> status
16675 </th></tr></table>
16676
16677 !! end
16678
16679 !! test
16680 CSS line continuation 1
16681 !! wikitext
16682 <div style="background-image: u\&#10;rl(test.jpg);"></div>
16683 !! html
16684 <div style="/* insecure input */"></div>
16685
16686 !! end
16687
16688 !! test
16689 CSS line continuation 2
16690 !! wikitext
16691 <div style="background-image: u\&#13;rl(test.jpg); "></div>
16692 !! html
16693 <div style="/* invalid control char */"></div>
16694
16695 !! end
16696
16697 !! article
16698 Template:Identity
16699 !! text
16700 {{{1}}}
16701 !! endarticle
16702
16703 !! test
16704 Expansion of multi-line templates in attribute values (bug 6255)
16705 !! wikitext
16706 <div style="background: {{identity|#00FF00}}">-</div>
16707 !! html
16708 <div style="background: #00FF00">-</div>
16709
16710 !! end
16711
16712
16713 !! test
16714 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
16715 !! wikitext
16716 <div style="background:
16717 #00FF00">-</div>
16718 !! html/php
16719 <div style="background: #00FF00">-</div>
16720
16721 !! html/parsoid
16722 <div style="background:
16723 #00FF00">-</div>
16724 !! end
16725
16726 !! test
16727 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
16728 !! wikitext
16729 <div style="background: &#10;#00FF00">-</div>
16730 !! html
16731 <div style="background: &#10;#00FF00">-</div>
16732
16733 !! end
16734
16735 !! test
16736 Tags which are hidden from Tidy cannot pass through the Sanitizer
16737 !! wikitext
16738 <mw:toc><script>alert();</script></mw:toc>
16739 !! html+tidy
16740 <p>&lt;mw:toc&gt;&lt;script&gt;alert();&lt;/script&gt;&lt;/mw:toc&gt;</p>
16741 !! end
16742
16743 ###
16744 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
16745 ###
16746 !! test
16747 Parser hook: empty input
16748 !! wikitext
16749 <tag></tag>
16750 !! html/php
16751 <pre>
16752 ''
16753 array (
16754 )
16755 </pre>
16756
16757 !! html/parsoid
16758 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16759 !! end
16760
16761 ## Don't expect parsoid to rt this form.
16762 !! test
16763 Parser hook: empty input using terminated empty elements
16764 !! options
16765 parsoid=wt2html,html2html
16766 !! wikitext
16767 <tag/>
16768 !! html/php
16769 <pre>
16770 NULL
16771 array (
16772 )
16773 </pre>
16774
16775 !! html/parsoid
16776 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16777 !! end
16778
16779 !! test
16780 Parser hook: empty input using terminated empty elements (space before)
16781 !! wikitext
16782 <tag />
16783 !! html/php
16784 <pre>
16785 NULL
16786 array (
16787 )
16788 </pre>
16789
16790 !! html/parsoid
16791 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16792 !! end
16793
16794 !! test
16795 Parser hook: basic input
16796 !! wikitext
16797 <tag>input</tag>
16798 !! html/php
16799 <pre>
16800 'input'
16801 array (
16802 )
16803 </pre>
16804
16805 !! html/parsoid
16806 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16807 !! end
16808
16809 ## Don't expect parsoid to rt this form.
16810 !! test
16811 Parser hook: case insensitive
16812 !! options
16813 parsoid=wt2html,html2html
16814 !! wikitext
16815 <TAG>input</TAG>
16816 !! html/php
16817 <pre>
16818 'input'
16819 array (
16820 )
16821 </pre>
16822
16823 !! html/parsoid
16824 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16825 !! end
16826
16827 ## Don't expect parsoid to rt this form.
16828 !! test
16829 Parser hook: case insensitive, redux
16830 !! options
16831 parsoid=wt2html,html2html
16832 !! wikitext
16833 <TaG>input</TAg>
16834 !! html/php
16835 <pre>
16836 'input'
16837 array (
16838 )
16839 </pre>
16840
16841 !! html/parsoid
16842 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16843 !! end
16844
16845 !! test
16846 Parser hook: nested tags
16847 !! wikitext
16848 <tag><tag></tag></tag>
16849 !! html/php
16850 <pre>
16851 '<tag>'
16852 array (
16853 )
16854 </pre>&lt;/tag&gt;
16855
16856 !! html/parsoid
16857 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}' data-parsoid='{}' about="#mwt2"></pre>&lt;/tag>
16858 !! end
16859
16860 !! test
16861 Parser hook: basic arguments
16862 !! wikitext
16863 <tag width="200" height="100" depth="50" square=""></tag>
16864 !! html/php
16865 <pre>
16866 ''
16867 array (
16868 'width' => '200',
16869 'height' => '100',
16870 'depth' => '50',
16871 'square' => '',
16872 )
16873 </pre>
16874
16875 !! html/parsoid
16876 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16877 !! end
16878
16879 ## Don't expect parsoid to rt this form.
16880 !! test
16881 Parser hook: basic arguments, variations
16882 !! options
16883 parsoid=wt2html,html2html
16884 !! wikitext
16885 <tag width=200 height = "100" depth = '50' square></tag>
16886 !! html/php
16887 <pre>
16888 ''
16889 array (
16890 'width' => '200',
16891 'height' => '100',
16892 'depth' => '50',
16893 'square' => '',
16894 )
16895 </pre>
16896
16897 !! html/parsoid
16898 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16899 !! end
16900
16901 !! test
16902 Parser hook: argument containing a forward slash (bug 5344)
16903 !! wikitext
16904 <tag filename="/tmp/bla"></tag>
16905 !! html/php
16906 <pre>
16907 ''
16908 array (
16909 'filename' => '/tmp/bla',
16910 )
16911 </pre>
16912
16913 !! html/parsoid
16914 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16915 !! end
16916
16917 ## Don't expect parsoid to rt this form.
16918 !! test
16919 Parser hook: empty input using terminated empty elements (bug 2374)
16920 !! options
16921 parsoid=wt2html,html2html
16922 !! wikitext
16923 <tag foo=bar/>text
16924 !! html/php
16925 <pre>
16926 NULL
16927 array (
16928 'foo' => 'bar',
16929 )
16930 </pre>text
16931
16932 !! html/parsoid
16933 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"foo":"bar"},"body":null}' data-parsoid='{}' about="#mwt2"></pre>text
16934 !! end
16935
16936 ## </tag> should be output literally since there is no matching tag that begins it
16937 ## Don't expect parsoid to rt this form.
16938 !! test
16939 Parser hook: basic arguments using terminated empty elements (bug 2374)
16940 !! options
16941 parsoid=wt2html
16942 !! wikitext
16943 <tag width=200 height = "100" depth = '50' square/>
16944 other stuff
16945 </tag>
16946 !! html/php
16947 <pre>
16948 NULL
16949 array (
16950 'width' => '200',
16951 'height' => '100',
16952 'depth' => '50',
16953 'square' => '',
16954 )
16955 </pre>
16956 <p>other stuff
16957 &lt;/tag&gt;
16958 </p>
16959 !! html/parsoid
16960 <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
16961 &lt;/tag></p>
16962 !! end
16963
16964 ## Don't expect parsoid to rt this form.
16965 !! test
16966 Parser hook: Don't allow unclosed extension tags
16967 !! options
16968 parsoid=wt2html
16969 !! wikitext
16970 test <tag>123
16971
16972 this is a '''test'''
16973 !! html/php
16974 <p>test &lt;tag&gt;123
16975 </p><p>this is a <b>test</b>
16976 </p>
16977 !! html/parsoid
16978 <p>test &lt;tag>123</p>
16979
16980 <p>this is a <b>test</b></p>
16981 !! end
16982
16983 ###
16984 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
16985 ###
16986
16987 !! test
16988 Parser hook: static parser hook not inside a comment
16989 !! wikitext
16990 <statictag>hello, world</statictag>
16991
16992 <statictag action="flush" />
16993 !! html/php
16994 <p><br />
16995 hello, world
16996 </p>
16997 !! html/parsoid
16998 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
16999 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt4">hello, world</p>
17000 !! end
17001
17002 !! test
17003 Parser hook: static parser hook inside a comment
17004 !! wikitext
17005 <!-- <statictag>hello, world</statictag> -->
17006 <statictag action="flush" />
17007 !! html/php
17008 <p><br />
17009 </p>
17010 !! html/parsoid
17011 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
17012 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt2"></p>
17013 !! end
17014
17015 # Nested template calls; this case was broken by Parser.php rev 1.506,
17016 # since reverted.
17017
17018 !! article
17019 Template:One-parameter
17020 !! text
17021 (My parameter is: {{{1}}})
17022 !! endarticle
17023
17024 !! article
17025 Template:Map-one-parameter
17026 !! text
17027 {{{{{1}}}|{{{2}}}}}
17028 !! endarticle
17029
17030 !! test
17031 Nested template calls
17032 !! wikitext
17033 {{Map-one-parameter|One-parameter|param}}
17034 !! html
17035 <p>(My parameter is: param)
17036 </p>
17037 !! end
17038
17039
17040 ###
17041 ### Sanitizer
17042 ###
17043
17044 # HTML+Tidy effectively strips out the empty tags completely
17045 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
17046 # which Tidy would have done for the PHP parser had there been content inside it.
17047 !! test
17048 Sanitizer: Closing of open tags
17049 !! wikitext
17050 <s></s><table></table>
17051 !! html
17052 <s></s><table></table>
17053
17054 !! html/parsoid
17055 <p><s></s></p><table></table>
17056 !! end
17057
17058 !! test
17059 Sanitizer: Closing of open but not closed tags
17060 !! wikitext
17061 <s>foo
17062 !! html
17063 <p><s>foo</s>
17064 </p>
17065 !! end
17066
17067 !! test
17068 Sanitizer: Closing of closed but not open tags
17069 !! options
17070 parsoid=wt2html
17071 !! wikitext
17072 </s>
17073 !! html/php+tidy
17074 !! html/parsoid
17075 !! end
17076
17077 !! test
17078 Sanitizer: Closing of closed but not open table tags
17079 !! options
17080 parsoid=wt2html
17081 !! wikitext
17082 Table not started</td></tr></table>
17083 !! html/php+tidy
17084 <p>Table not started</p>
17085 !! html/parsoid
17086 <p>Table not started</p>
17087 !! end
17088
17089 !! test
17090 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
17091 !! wikitext
17092 <span id="æ: v">byte</span>[[#æ: v|backlink]]
17093 !! html
17094 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
17095 </p>
17096 !! end
17097
17098 # In HTML5, the restrictions are that id must contain at least one character,
17099 # and must not contain any space characters.
17100 !! test
17101 Sanitizer: Validating the contents of the id attribute (bug 4515)
17102 !! options
17103 disabled
17104 !! wikitext
17105 <br id="" /><br id="a space" />
17106 !! html
17107 Something ...
17108 !! end
17109
17110 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
17111 !! test
17112 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
17113 !! options
17114 disabled
17115 !! wikitext
17116 <br id="foo" /><br id="foo" />
17117 !! html
17118 Something need to be done. foo-2 ?
17119 !! end
17120
17121 !! test
17122 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
17123 !! wikitext
17124 <div itemscope>
17125 <meta itemprop="hello" content="world">
17126 <meta http-equiv="refresh" content="5">
17127 <meta itemprop="hello" http-equiv="refresh" content="5">
17128 <link itemprop="hello" href="{{SERVER}}">
17129 <link rel="stylesheet" href="{{SERVER}}">
17130 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
17131 </div>
17132 !! html
17133 <div itemscope="">
17134 <p> <meta itemprop="hello" content="world" />
17135 &lt;meta http-equiv="refresh" content="5"&gt;
17136 <meta itemprop="hello" content="5" />
17137 </p>
17138 <link itemprop="hello" href="http&#58;//example.org" />
17139 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
17140 <link itemprop="hello" href="http&#58;//example.org" />
17141 </div>
17142
17143 !! end
17144
17145 !! test
17146 Language converter: output gets cut off unexpectedly (bug 5757)
17147 !! options
17148 language=zh
17149 !! wikitext
17150 this bit is safe: }-
17151
17152 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
17153
17154 then we get cut off here: }-
17155
17156 all additional text is vanished
17157 !! html
17158 <p>this bit is safe: }-
17159 </p><p>but if we add a conversion instance: xxx
17160 </p><p>then we get cut off here: }-
17161 </p><p>all additional text is vanished
17162 </p>
17163 !! end
17164
17165 !! test
17166 Self closed html pairs (bug 5487)
17167 !! options
17168 !! wikitext
17169 <center><font id="bug" />Centered text</center>
17170 <div><font id="bug2" />In div text</div>
17171 !! html
17172 <center>&lt;font id="bug" /&gt;Centered text</center>
17173 <div>&lt;font id="bug2" /&gt;In div text</div>
17174
17175 !! end
17176
17177 #
17178 #
17179 #
17180
17181 !! test
17182 Punctuation: nbsp before exclamation
17183 !! wikitext
17184 C'est grave !
17185 !! html
17186 <p>C'est grave&#160;!
17187 </p>
17188 !! end
17189
17190 !! test
17191 Punctuation: CSS !important (bug 11874)
17192 !! wikitext
17193 <div style="width:50% !important">important</div>
17194 !! html
17195 <div style="width:50% !important">important</div>
17196
17197 !!end
17198
17199 !! test
17200 Punctuation: CSS ! important (bug 11874; with space after)
17201 !! wikitext
17202 <div style="width:50% ! important">important</div>
17203 !! html
17204 <div style="width:50% ! important">important</div>
17205
17206 !!end
17207
17208 !! test
17209 HTML bullet list, closed tags (bug 5497)
17210 !! wikitext
17211 <ul>
17212 <li>One</li>
17213 <li>Two</li>
17214 </ul>
17215 !! html/php
17216 <ul>
17217 <li>One</li>
17218 <li>Two</li>
17219 </ul>
17220
17221 !! html/parsoid
17222 <ul data-parsoid='{"stx":"html"}'>
17223 <li data-parsoid='{"stx":"html"}'>One</li>
17224 <li data-parsoid='{"stx":"html"}'>Two</li>
17225 </ul>
17226
17227 !! end
17228
17229 !! test
17230 HTML bullet list, unclosed tags (bug 5497)
17231 !! wikitext
17232 <ul>
17233 <li>One
17234 <li>Two
17235 </ul>
17236 !! html/php+tidy
17237 <ul>
17238 <li>One</li>
17239 <li>Two</li>
17240 </ul>
17241 !! html/parsoid
17242 <ul data-parsoid='{"stx":"html"}'>
17243 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
17244 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
17245 </ul>
17246
17247 !! end
17248
17249 !! test
17250 HTML ordered list, closed tags (bug 5497)
17251 !! wikitext
17252 <ol>
17253 <li>One</li>
17254 <li>Two</li>
17255 </ol>
17256 !! html/php
17257 <ol>
17258 <li>One</li>
17259 <li>Two</li>
17260 </ol>
17261
17262 !! html/parsoid
17263 <ol data-parsoid='{"stx":"html"}'>
17264 <li data-parsoid='{"stx":"html"}'>One</li>
17265 <li data-parsoid='{"stx":"html"}'>Two</li>
17266 </ol>
17267
17268 !! end
17269
17270 !! test
17271 HTML ordered list, unclosed tags (bug 5497)
17272 !! options
17273 !! wikitext
17274 <ol>
17275 <li>One
17276 <li>Two
17277 </ol>
17278 !! html/php+tidy
17279 <ol>
17280 <li>One</li>
17281 <li>Two</li>
17282 </ol>
17283 !! html/parsoid
17284 <ol data-parsoid='{"stx":"html"}'>
17285 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
17286 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
17287 </ol>
17288
17289 !! end
17290
17291 !! test
17292 HTML nested bullet list, closed tags (bug 5497)
17293 !! wikitext
17294 <ul>
17295 <li>One</li>
17296 <li>Two:
17297 <ul>
17298 <li>Sub-one</li>
17299 <li>Sub-two</li>
17300 </ul>
17301 </li>
17302 </ul>
17303 !! html/php
17304 <ul>
17305 <li>One</li>
17306 <li>Two:
17307 <ul>
17308 <li>Sub-one</li>
17309 <li>Sub-two</li>
17310 </ul>
17311 </li>
17312 </ul>
17313
17314 !! html/parsoid
17315 <ul data-parsoid='{"stx":"html"}'>
17316 <li data-parsoid='{"stx":"html"}'>One</li>
17317 <li data-parsoid='{"stx":"html"}'>Two:
17318 <ul data-parsoid='{"stx":"html"}'>
17319 <li data-parsoid='{"stx":"html"}'>Sub-one</li>
17320 <li data-parsoid='{"stx":"html"}'>Sub-two</li>
17321 </ul>
17322 </li>
17323 </ul>
17324 !! end
17325
17326 !! test
17327 HTML nested bullet list, open tags (bug 5497)
17328 !! wikitext
17329 <ul>
17330 <li>One
17331 <li>Two:
17332 <ul>
17333 <li>Sub-one
17334 <li>Sub-two
17335 </ul>
17336 </ul>
17337 !! html/php+tidy
17338 <ul>
17339 <li>One</li>
17340 <li>Two:
17341 <ul>
17342 <li>Sub-one</li>
17343 <li>Sub-two</li>
17344 </ul>
17345 </li>
17346 </ul>
17347 !! html/parsoid
17348 <ul>
17349 <li>One
17350 </li>
17351 <li>Two:
17352 <ul>
17353 <li>Sub-one
17354 </li>
17355 <li>Sub-two
17356 </li>
17357 </ul>
17358 </li>
17359 </ul>
17360
17361 !! end
17362
17363 !! test
17364 HTML nested ordered list, closed tags (bug 5497)
17365 !! wikitext
17366 <ol>
17367 <li>One</li>
17368 <li>Two:
17369 <ol>
17370 <li>Sub-one</li>
17371 <li>Sub-two</li>
17372 </ol>
17373 </li>
17374 </ol>
17375 !! html
17376 <ol>
17377 <li>One</li>
17378 <li>Two:
17379 <ol>
17380 <li>Sub-one</li>
17381 <li>Sub-two</li>
17382 </ol>
17383 </li>
17384 </ol>
17385
17386 !! end
17387
17388 !! test
17389 HTML nested ordered list, open tags (bug 5497)
17390 !! wikitext
17391 <ol>
17392 <li>One
17393 <li>Two:
17394 <ol>
17395 <li>Sub-one
17396 <li>Sub-two
17397 </ol>
17398 </ol>
17399 !! html/php
17400 <ol>
17401 <li>One
17402 <li>Two:
17403 <ol>
17404 <li>Sub-one
17405 <li>Sub-two
17406 </ol>
17407 </ol>
17408
17409 !! html/parsoid
17410 <ol>
17411 <li>One
17412 </li>
17413 <li>Two:
17414 <ol>
17415 <li>Sub-one
17416 </li>
17417 <li>Sub-two
17418 </li>
17419 </ol>
17420 </li>
17421 </ol>
17422
17423 !! end
17424
17425 !! test
17426 HTML ordered list item with parameters oddity
17427 !! wikitext
17428 <ol><li id="fragment">One</li>
17429 </ol>
17430 !! html
17431 <ol><li id="fragment">One</li>
17432 </ol>
17433
17434 !! end
17435
17436 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
17437 !!test
17438 bug 5918: autonumbering
17439 !! wikitext
17440 [http://first/] [http://second] [ftp://ftp]
17441
17442 ftp://inlineftp
17443
17444 [mailto:enclosed@mail.tld With target]
17445
17446 [mailto:enclosed@mail.tld]
17447
17448 mailto:inline@mail.tld
17449 !! html/php
17450 <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>
17451 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
17452 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
17453 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
17454 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
17455 </p>
17456 !! html/parsoid
17457 <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>
17458 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
17459 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
17460 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
17461 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
17462 !! end
17463
17464
17465 #
17466 # Security and HTML correctness
17467 # From Nick Jenkins' fuzz testing
17468 #
17469
17470 !! test
17471 Fuzz testing: Parser13
17472 !! wikitext
17473 {|
17474 | http://a|
17475 !! html
17476 <table>
17477 <tr>
17478 <td>
17479 </td>
17480 </tr>
17481 </table>
17482
17483 !! end
17484
17485 !! test
17486 Fuzz testing: Parser14
17487 !! wikitext
17488 == onmouseover= ==
17489 http://__TOC__
17490 !! html
17491 <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>
17492 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17493 <ul>
17494 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17495 </ul>
17496 </div>
17497
17498
17499 !! html+tidy
17500 <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>
17501 <p>http://</p>
17502 <div id="toc" class="toc">
17503 <div id="toctitle">
17504 <h2>Contents</h2>
17505 </div>
17506 <ul>
17507 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17508 </ul>
17509 </div>
17510 <p></p>
17511 !! end
17512
17513 !! test
17514 Fuzz testing: Parser14-table
17515 !! options
17516 parsoid=wt2html,html2html
17517 !! wikitext
17518 ==a==
17519 {| STYLE=__TOC__
17520 !! html
17521 <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>
17522 <table style="&#95;_TOC&#95;_">
17523 <tr><td></td></tr>
17524 </table>
17525
17526 !! html+tidy
17527 <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>
17528 <table style="__TOC__">
17529 <tr>
17530 <td></td>
17531 </tr>
17532 </table>
17533 !! html/parsoid
17534 <h2>a</h2>
17535 <table style="__TOC__"></table>
17536 !! end
17537
17538 # Known to produce bogus xml (extra </td>)
17539 !! test
17540 Fuzz testing: Parser16
17541 !! wikitext
17542 {|
17543 !https://||||||
17544 !! html
17545 <table>
17546 <tr>
17547 <th>https://</th>
17548 <th></th>
17549 <th></th>
17550 <th>
17551 </td>
17552 </tr>
17553 </table>
17554
17555 !! html+tidy
17556 <table>
17557 <tr>
17558 <th>https://</th>
17559 <th></th>
17560 <th></th>
17561 <th></th>
17562 </tr>
17563 </table>
17564 !! end
17565
17566 !! test
17567 Fuzz testing: Parser21
17568 !! wikitext
17569 {|
17570 ! irc://{{ftp://a" onmouseover="alert('hello world');"
17571 |
17572 !! html
17573 <table>
17574 <tr>
17575 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
17576 </th>
17577 <td>
17578 </td>
17579 </tr>
17580 </table>
17581
17582 !! end
17583
17584 !! test
17585 Fuzz testing: Parser22
17586 !! wikitext
17587 http://===r:::https://b
17588
17589 {|
17590 !! html
17591 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
17592 </p>
17593 <table>
17594 <tr><td></td></tr>
17595 </table>
17596
17597 !! end
17598
17599 # Known to produce bad XML for now
17600 !! test
17601 Fuzz testing: Parser24
17602 !! wikitext
17603 {|
17604 {{{|
17605 <u CLASS=
17606 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
17607 <br style="onmouseover='alert(document.cookie);' " />
17608
17609 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17610 |
17611 !! html
17612 <table>
17613 {{{|
17614 <u class="&#124;">}}}} &gt;
17615 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
17616
17617 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17618 <tr>
17619 <td></u>
17620 </td>
17621 </tr>
17622 </table>
17623
17624 !! end
17625
17626 # Note: the current result listed for this is not what the original one was,
17627 # but the original bug was JavaScript injection, which is fixed in any case.
17628 # It's not clear that the original result listed was any more correct than the
17629 # current one. Original result:
17630 # <p>{{{|
17631 # </p>
17632 # <li class="&#124;&#124;">
17633 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17634 !!test
17635 Fuzz testing: Parser25 (bug 6055)
17636 !! wikitext
17637 {{{
17638 |
17639 <LI CLASS=||
17640 >
17641 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
17642 !! html
17643 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17644 </p>
17645 !! end
17646
17647 !!test
17648 Fuzz testing: URL adjacent extension (with space, clean)
17649 !! wikitext
17650 http://example.com <nowiki>junk</nowiki>
17651 !! html/php
17652 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
17653 </p>
17654 !! html/parsoid
17655 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
17656 !! end
17657
17658 !!test
17659 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
17660 !! wikitext
17661 http://example.com<nowiki>junk</nowiki>
17662 !! html/php
17663 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
17664 </p>
17665 !! html/parsoid
17666 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
17667 !! end
17668
17669 !!test
17670 Fuzz testing: URL adjacent extension (no space, dirty; pre)
17671 !! wikitext
17672 http://example.com<pre>junk</pre>
17673 !! html/php
17674 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
17675
17676 !! html/php+tidy
17677 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
17678 <pre>
17679 junk
17680 </pre>
17681 !! html/parsoid
17682 <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>
17683 !!end
17684
17685 !!test
17686 Fuzz testing: image with bogus manual thumbnail
17687 !! wikitext
17688 [[Image:foobar.jpg|thumbnail= ]]
17689 !! html/php
17690 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
17691
17692 !! html/parsoid
17693 <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>
17694 !!end
17695
17696 !! test
17697 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
17698 !! wikitext
17699 <pre dir="&#10;"></pre>
17700 !! html
17701 <pre dir="&#10;"></pre>
17702
17703 !! end
17704
17705 !! test
17706 Parsing optional HTML elements (Bug 6171)
17707 !! options
17708 !! wikitext
17709 <table>
17710 <tr>
17711 <td> Some tabular data</td>
17712 <td> More tabular data ...
17713 <td> And yet som tabular data</td>
17714 </tr>
17715 </table>
17716 !! html
17717 <table>
17718 <tr>
17719 <td> Some tabular data</td>
17720 <td> More tabular data ...
17721 </td><td> And yet som tabular data</td>
17722 </tr>
17723 </table>
17724
17725 !! end
17726
17727 !! test
17728 Correct handling of <td>, <tr> (Bug 6171)
17729 !! options
17730 !! wikitext
17731 <table>
17732 <tr>
17733 <td> Some tabular data</td>
17734 <td> More tabular data ...</td>
17735 <td> And yet som tabular data</td>
17736 </tr>
17737 </table>
17738 !! html
17739 <table>
17740 <tr>
17741 <td> Some tabular data</td>
17742 <td> More tabular data ...</td>
17743 <td> And yet som tabular data</td>
17744 </tr>
17745 </table>
17746
17747 !! end
17748
17749
17750 !! test
17751 Parsing crashing regression (fr:JavaScript)
17752 !! wikitext
17753 </body></x>
17754 !! html
17755 <p>&lt;/body&gt;&lt;/x&gt;
17756 </p>
17757 !! end
17758
17759 !! test
17760 Inline wiki vs wiki block nesting
17761 !! wikitext
17762 '''Bold paragraph
17763
17764 New wiki paragraph
17765 !! html
17766 <p><b>Bold paragraph</b>
17767 </p><p>New wiki paragraph
17768 </p>
17769 !! end
17770
17771 # FIXME: The current php output is documented
17772 # and desired output is the parsoid target.
17773 !! test
17774 Inline HTML vs wiki block nesting
17775 !! wikitext
17776 <b>Bold paragraph
17777
17778 New wiki paragraph
17779 !! html/php
17780 <p><b>Bold paragraph
17781 </p><p>New wiki paragraph</b>
17782 </p>
17783 !! html/parsoid
17784 <p><b>Bold paragraph</b>
17785 </p><p>New wiki paragraph
17786 </p>
17787 !! end
17788
17789 # Original result was this:
17790 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
17791 # </p>
17792 # While that might be marginally more intuitive, maybe, the six-apostrophe
17793 # construct is clearly pathological and the result stated here (which is what
17794 # the parser actually does) is about as reasonable as anything.
17795 !!test
17796 Mixing markup for italics and bold
17797 !! options
17798 !! wikitext
17799 '''bold''''''bold''bolditalics'''''
17800 !! html
17801 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
17802 </p>
17803 !! end
17804
17805
17806 !! article
17807 Xyzzyx
17808 !! text
17809 Article for special page transclusion test
17810 !! endarticle
17811
17812 !! test
17813 Special page transclusion
17814 !! options
17815 !! wikitext
17816 {{Special:Prefixindex/Xyzzyx}}
17817 !! html
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 Special page transclusion twice (bug 5021)
17825 !! options
17826 !! wikitext
17827 {{Special:Prefixindex/Xyzzyx}}
17828 {{Special:Prefixindex/Xyzzyx}}
17829 !! html
17830 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17831 </ul>
17832 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17833 </ul>
17834
17835 !! end
17836
17837 !! test
17838 Transclusion of default MediaWiki message
17839 !! wikitext
17840 {{MediaWiki:Mainpage}}
17841 !! html
17842 <p>Main Page
17843 </p>
17844 !! end
17845
17846 !! test
17847 Transclusion of nonexistent MediaWiki message
17848 !! wikitext
17849 {{MediaWiki:Mainpagexxx}}
17850 !! html
17851 <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>
17852 </p>
17853 !! end
17854
17855 !! test
17856 Transclusion of MediaWiki message with underscore
17857 !! wikitext
17858 {{MediaWiki:history_short}}
17859 !! html
17860 <p>History
17861 </p>
17862 !! end
17863
17864 !! test
17865 Transclusion of MediaWiki message with space
17866 !! wikitext
17867 {{MediaWiki:history short}}
17868 !! html
17869 <p>History
17870 </p>
17871 !! end
17872
17873 !! test
17874 Invalid header with following text
17875 !! wikitext
17876 = x = y
17877 !! html
17878 <p>= x = y
17879 </p>
17880 !! end
17881
17882
17883 !! test
17884 Section extraction test (section 0)
17885 !! options
17886 section=0
17887 !! wikitext
17888 start
17889 ==a==
17890 ===aa===
17891 ====aaa====
17892 ==b==
17893 ===ba===
17894 ===bb===
17895 ====bba====
17896 ===bc===
17897 ==c==
17898 ===ca===
17899 !! html/php
17900 start
17901 !! end
17902
17903 !! test
17904 Section extraction test (section 1)
17905 !! options
17906 section=1
17907 !! wikitext
17908 start
17909 ==a==
17910 ===aa===
17911 ====aaa====
17912 ==b==
17913 ===ba===
17914 ===bb===
17915 ====bba====
17916 ===bc===
17917 ==c==
17918 ===ca===
17919 !! html/php
17920 ==a==
17921 ===aa===
17922 ====aaa====
17923 !! end
17924
17925 !! test
17926 Section extraction test (section 2)
17927 !! options
17928 section=2
17929 !! wikitext
17930 start
17931 ==a==
17932 ===aa===
17933 ====aaa====
17934 ==b==
17935 ===ba===
17936 ===bb===
17937 ====bba====
17938 ===bc===
17939 ==c==
17940 ===ca===
17941 !! html/php
17942 ===aa===
17943 ====aaa====
17944 !! end
17945
17946 !! test
17947 Section extraction test (section 3)
17948 !! options
17949 section=3
17950 !! wikitext
17951 start
17952 ==a==
17953 ===aa===
17954 ====aaa====
17955 ==b==
17956 ===ba===
17957 ===bb===
17958 ====bba====
17959 ===bc===
17960 ==c==
17961 ===ca===
17962 !! html/php
17963 ====aaa====
17964 !! end
17965
17966 !! test
17967 Section extraction test (section 4)
17968 !! options
17969 section=4
17970 !! wikitext
17971 start
17972 ==a==
17973 ===aa===
17974 ====aaa====
17975 ==b==
17976 ===ba===
17977 ===bb===
17978 ====bba====
17979 ===bc===
17980 ==c==
17981 ===ca===
17982 !! html/php
17983 ==b==
17984 ===ba===
17985 ===bb===
17986 ====bba====
17987 ===bc===
17988 !! end
17989
17990 !! test
17991 Section extraction test (section 5)
17992 !! options
17993 section=5
17994 !! wikitext
17995 start
17996 ==a==
17997 ===aa===
17998 ====aaa====
17999 ==b==
18000 ===ba===
18001 ===bb===
18002 ====bba====
18003 ===bc===
18004 ==c==
18005 ===ca===
18006 !! html/php
18007 ===ba===
18008 !! end
18009
18010 !! test
18011 Section extraction test (section 6)
18012 !! options
18013 section=6
18014 !! wikitext
18015 start
18016 ==a==
18017 ===aa===
18018 ====aaa====
18019 ==b==
18020 ===ba===
18021 ===bb===
18022 ====bba====
18023 ===bc===
18024 ==c==
18025 ===ca===
18026 !! html/php
18027 ===bb===
18028 ====bba====
18029 !! end
18030
18031 !! test
18032 Section extraction test (section 7)
18033 !! options
18034 section=7
18035 !! wikitext
18036 start
18037 ==a==
18038 ===aa===
18039 ====aaa====
18040 ==b==
18041 ===ba===
18042 ===bb===
18043 ====bba====
18044 ===bc===
18045 ==c==
18046 ===ca===
18047 !! html/php
18048 ====bba====
18049 !! end
18050
18051 !! test
18052 Section extraction test (section 8)
18053 !! options
18054 section=8
18055 !! wikitext
18056 start
18057 ==a==
18058 ===aa===
18059 ====aaa====
18060 ==b==
18061 ===ba===
18062 ===bb===
18063 ====bba====
18064 ===bc===
18065 ==c==
18066 ===ca===
18067 !! html/php
18068 ===bc===
18069 !! end
18070
18071 !! test
18072 Section extraction test (section 9)
18073 !! options
18074 section=9
18075 !! wikitext
18076 start
18077 ==a==
18078 ===aa===
18079 ====aaa====
18080 ==b==
18081 ===ba===
18082 ===bb===
18083 ====bba====
18084 ===bc===
18085 ==c==
18086 ===ca===
18087 !! html/php
18088 ==c==
18089 ===ca===
18090 !! end
18091
18092 !! test
18093 Section extraction test (section 10)
18094 !! options
18095 section=10
18096 !! wikitext
18097 start
18098 ==a==
18099 ===aa===
18100 ====aaa====
18101 ==b==
18102 ===ba===
18103 ===bb===
18104 ====bba====
18105 ===bc===
18106 ==c==
18107 ===ca===
18108 !! html/php
18109 ===ca===
18110 !! end
18111
18112 !! test
18113 Section extraction test (nonexistent section 11)
18114 !! options
18115 section=11
18116 !! wikitext
18117 start
18118 ==a==
18119 ===aa===
18120 ====aaa====
18121 ==b==
18122 ===ba===
18123 ===bb===
18124 ====bba====
18125 ===bc===
18126 ==c==
18127 ===ca===
18128 !! html/php
18129 !! end
18130
18131 !! test
18132 Section extraction test with bogus heading (section 1)
18133 !! options
18134 section=1
18135 !! wikitext
18136 ==a==
18137 ==bogus== not a legal section
18138 ==b==
18139 !! html/php
18140 ==a==
18141 ==bogus== not a legal section
18142 !! end
18143
18144 !! test
18145 Section extraction test with bogus heading (section 2)
18146 !! options
18147 section=2
18148 !! wikitext
18149 ==a==
18150 ==bogus== not a legal section
18151 ==b==
18152 !! html/php
18153 ==b==
18154 !! end
18155
18156 !! test
18157 Section extraction test with comment after heading (section 1)
18158 !! options
18159 section=1
18160 !! wikitext
18161 ==a==
18162 ==b== <!-- -->
18163 ==c==
18164 !! html/php
18165 ==a==
18166 !! end
18167
18168 !! test
18169 Section extraction test with comment after heading (section 2)
18170 !! options
18171 section=2
18172 !! wikitext
18173 ==a==
18174 ==b== <!-- -->
18175 ==c==
18176 !! html/php
18177 ==b== <!-- -->
18178 !! end
18179
18180 !! test
18181 Section extraction test with bogus <nowiki> heading (section 1)
18182 !! options
18183 section=1
18184 !! wikitext
18185 ==a==
18186 ==bogus== <nowiki>not a legal section</nowiki>
18187 ==b==
18188 !! html/php
18189 ==a==
18190 ==bogus== <nowiki>not a legal section</nowiki>
18191 !! end
18192
18193 !! test
18194 Section extraction test with bogus <nowiki> heading (section 2)
18195 !! options
18196 section=2
18197 !! wikitext
18198 ==a==
18199 ==bogus== <nowiki>not a legal section</nowiki>
18200 ==b==
18201 !! html/php
18202 ==b==
18203 !! end
18204
18205 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
18206 # instead of respecting commented sections
18207 !! test
18208 Section extraction prefixed by comment (section 1)
18209 !! options
18210 section=1
18211 !! wikitext
18212 <!-- -->==sec1==
18213 ==sec2==
18214 !! html/php
18215 ==sec2==
18216 !!end
18217
18218 !! test
18219 Section extraction prefixed by comment (section 2)
18220 !! options
18221 section=2
18222 !! wikitext
18223 <!-- -->==sec1==
18224 ==sec2==
18225 !! html/php
18226
18227 !!end
18228
18229 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
18230 # instead of respecting HTML-style headings
18231 !! test
18232 Section extraction, mixed wiki and html (section 1)
18233 !! options
18234 section=1
18235 !! wikitext
18236 <h2>unmarked</h2>
18237 unmarked
18238 ==1==
18239 one
18240 ==2==
18241 two
18242 !! html/php
18243 ==1==
18244 one
18245 !! end
18246
18247 !! test
18248 Section extraction, mixed wiki and html (section 2)
18249 !! options
18250 section=2
18251 !! wikitext
18252 <h2>unmarked</h2>
18253 unmarked
18254 ==1==
18255 one
18256 ==2==
18257 two
18258 !! html/php
18259 ==2==
18260 two
18261 !! end
18262
18263
18264 # Formerly testing for bug 3342
18265 !! test
18266 Section extraction, heading surrounded by <noinclude>
18267 !! options
18268 section=1
18269 !! wikitext
18270 <noinclude>==unmarked==</noinclude>
18271 ==marked==
18272 !! html/php
18273 ==marked==
18274 !!end
18275
18276 # Test behavior of bug 19910
18277 !! test
18278 Sectiion with all-equals
18279 !! options
18280 section=2
18281 !! wikitext
18282 ===
18283 The line above must have a trailing space
18284 === <!--
18285 --> <!-- -->
18286 But just in case it doesn't...
18287 !! html/php
18288 === <!--
18289 --> <!-- -->
18290 But just in case it doesn't...
18291 !! end
18292
18293 !! test
18294 Section replacement test (section 0)
18295 !! options
18296 replace=0,"xxx"
18297 !! wikitext
18298 start
18299 ==a==
18300 ===aa===
18301 ====aaa====
18302 ==b==
18303 ===ba===
18304 ===bb===
18305 ====bba====
18306 ===bc===
18307 ==c==
18308 ===ca===
18309 !! html/php
18310 xxx
18311
18312 ==a==
18313 ===aa===
18314 ====aaa====
18315 ==b==
18316 ===ba===
18317 ===bb===
18318 ====bba====
18319 ===bc===
18320 ==c==
18321 ===ca===
18322 !! end
18323
18324 !! test
18325 Section replacement test (section 1)
18326 !! options
18327 replace=1,"xxx"
18328 !! wikitext
18329 start
18330 ==a==
18331 ===aa===
18332 ====aaa====
18333 ==b==
18334 ===ba===
18335 ===bb===
18336 ====bba====
18337 ===bc===
18338 ==c==
18339 ===ca===
18340 !! html/php
18341 start
18342 xxx
18343
18344 ==b==
18345 ===ba===
18346 ===bb===
18347 ====bba====
18348 ===bc===
18349 ==c==
18350 ===ca===
18351 !! end
18352
18353 !! test
18354 Section replacement test (section 2)
18355 !! options
18356 replace=2,"xxx"
18357 !! wikitext
18358 start
18359 ==a==
18360 ===aa===
18361 ====aaa====
18362 ==b==
18363 ===ba===
18364 ===bb===
18365 ====bba====
18366 ===bc===
18367 ==c==
18368 ===ca===
18369 !! html/php
18370 start
18371 ==a==
18372 xxx
18373
18374 ==b==
18375 ===ba===
18376 ===bb===
18377 ====bba====
18378 ===bc===
18379 ==c==
18380 ===ca===
18381 !! end
18382
18383 !! test
18384 Section replacement test (section 3)
18385 !! options
18386 replace=3,"xxx"
18387 !! wikitext
18388 start
18389 ==a==
18390 ===aa===
18391 ====aaa====
18392 ==b==
18393 ===ba===
18394 ===bb===
18395 ====bba====
18396 ===bc===
18397 ==c==
18398 ===ca===
18399 !! html/php
18400 start
18401 ==a==
18402 ===aa===
18403 xxx
18404
18405 ==b==
18406 ===ba===
18407 ===bb===
18408 ====bba====
18409 ===bc===
18410 ==c==
18411 ===ca===
18412 !! end
18413
18414 !! test
18415 Section replacement test (section 4)
18416 !! options
18417 replace=4,"xxx"
18418 !! wikitext
18419 start
18420 ==a==
18421 ===aa===
18422 ====aaa====
18423 ==b==
18424 ===ba===
18425 ===bb===
18426 ====bba====
18427 ===bc===
18428 ==c==
18429 ===ca===
18430 !! html/php
18431 start
18432 ==a==
18433 ===aa===
18434 ====aaa====
18435 xxx
18436
18437 ==c==
18438 ===ca===
18439 !! end
18440
18441 !! test
18442 Section replacement test (section 5)
18443 !! options
18444 replace=5,"xxx"
18445 !! wikitext
18446 start
18447 ==a==
18448 ===aa===
18449 ====aaa====
18450 ==b==
18451 ===ba===
18452 ===bb===
18453 ====bba====
18454 ===bc===
18455 ==c==
18456 ===ca===
18457 !! html/php
18458 start
18459 ==a==
18460 ===aa===
18461 ====aaa====
18462 ==b==
18463 xxx
18464
18465 ===bb===
18466 ====bba====
18467 ===bc===
18468 ==c==
18469 ===ca===
18470 !! end
18471
18472 !! test
18473 Section replacement test (section 6)
18474 !! options
18475 replace=6,"xxx"
18476 !! wikitext
18477 start
18478 ==a==
18479 ===aa===
18480 ====aaa====
18481 ==b==
18482 ===ba===
18483 ===bb===
18484 ====bba====
18485 ===bc===
18486 ==c==
18487 ===ca===
18488 !! html/php
18489 start
18490 ==a==
18491 ===aa===
18492 ====aaa====
18493 ==b==
18494 ===ba===
18495 xxx
18496
18497 ===bc===
18498 ==c==
18499 ===ca===
18500 !! end
18501
18502 !! test
18503 Section replacement test (section 7)
18504 !! options
18505 replace=7,"xxx"
18506 !! wikitext
18507 start
18508 ==a==
18509 ===aa===
18510 ====aaa====
18511 ==b==
18512 ===ba===
18513 ===bb===
18514 ====bba====
18515 ===bc===
18516 ==c==
18517 ===ca===
18518 !! html/php
18519 start
18520 ==a==
18521 ===aa===
18522 ====aaa====
18523 ==b==
18524 ===ba===
18525 ===bb===
18526 xxx
18527
18528 ===bc===
18529 ==c==
18530 ===ca===
18531 !! end
18532
18533 !! test
18534 Section replacement test (section 8)
18535 !! options
18536 replace=8,"xxx"
18537 !! wikitext
18538 start
18539 ==a==
18540 ===aa===
18541 ====aaa====
18542 ==b==
18543 ===ba===
18544 ===bb===
18545 ====bba====
18546 ===bc===
18547 ==c==
18548 ===ca===
18549 !! html/php
18550 start
18551 ==a==
18552 ===aa===
18553 ====aaa====
18554 ==b==
18555 ===ba===
18556 ===bb===
18557 ====bba====
18558 xxx
18559
18560 ==c==
18561 ===ca===
18562 !!end
18563
18564 !! test
18565 Section replacement test (section 9)
18566 !! options
18567 replace=9,"xxx"
18568 !! wikitext
18569 start
18570 ==a==
18571 ===aa===
18572 ====aaa====
18573 ==b==
18574 ===ba===
18575 ===bb===
18576 ====bba====
18577 ===bc===
18578 ==c==
18579 ===ca===
18580 !! html/php
18581 start
18582 ==a==
18583 ===aa===
18584 ====aaa====
18585 ==b==
18586 ===ba===
18587 ===bb===
18588 ====bba====
18589 ===bc===
18590 xxx
18591 !! end
18592
18593 !! test
18594 Section replacement test (section 10)
18595 !! options
18596 replace=10,"xxx"
18597 !! wikitext
18598 start
18599 ==a==
18600 ===aa===
18601 ====aaa====
18602 ==b==
18603 ===ba===
18604 ===bb===
18605 ====bba====
18606 ===bc===
18607 ==c==
18608 ===ca===
18609 !! html/php
18610 start
18611 ==a==
18612 ===aa===
18613 ====aaa====
18614 ==b==
18615 ===ba===
18616 ===bb===
18617 ====bba====
18618 ===bc===
18619 ==c==
18620 xxx
18621 !! end
18622
18623 !! test
18624 Section replacement test with initial whitespace (bug 13728)
18625 !! options
18626 replace=2,"xxx"
18627 !! wikitext
18628 Preformatted initial line
18629 ==a==
18630 ===a===
18631 !! html/php
18632 Preformatted initial line
18633 ==a==
18634 xxx
18635 !! end
18636
18637
18638 !! test
18639 Section extraction, heading followed by pre with 20 spaces (bug 6398)
18640 !! options
18641 section=1
18642 !! wikitext
18643 ==a==
18644 a
18645 !! html/php
18646 ==a==
18647 a
18648 !! end
18649
18650 !! test
18651 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
18652 !! options
18653 section=1
18654 !! wikitext
18655 ==a==
18656 a
18657 !! html/php
18658 ==a==
18659 a
18660 !! end
18661
18662
18663 !! test
18664 Section extraction, <pre> around bogus header (bug 10309)
18665 !! options
18666 section=2
18667 !! wikitext
18668 == Section One ==
18669 <pre>
18670 =======
18671 </pre>
18672
18673 == Section Two ==
18674 stuff
18675 !! html/php
18676 == Section Two ==
18677 stuff
18678 !! end
18679
18680 !! test
18681 Section replacement, <pre> around bogus header (bug 10309)
18682 !! options
18683 replace=2,"xxx"
18684 !! wikitext
18685 == Section One ==
18686 <pre>
18687 =======
18688 </pre>
18689
18690 == Section Two ==
18691 stuff
18692 !! html/php
18693 == Section One ==
18694 <pre>
18695 =======
18696 </pre>
18697
18698 xxx
18699 !! end
18700
18701
18702 !! test
18703 Handling of &#x0A; in URLs
18704 !! wikitext
18705 ** irc://&#x0A;a
18706 !! html/php
18707 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18708
18709 !! html/parsoid
18710 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
18711 a">irc://
18712 a</a></li></ul></li></ul>
18713 !! end
18714
18715 !! test
18716 Handling of %0A in URLs
18717 !! wikitext
18718 ** irc://%0Aa
18719 !! html/php
18720 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18721
18722 !! html/parsoid
18723 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18724 !! end
18725
18726
18727 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
18728 !! test
18729 5 quotes, code coverage +1 line
18730 !! options
18731 parsoid=wt2html
18732 !! wikitext
18733 '''''
18734 !! html/php
18735 !! html/parsoid
18736 <p><b><i></i></b></p>
18737 !! end
18738
18739 # same html as previous, but wikitext adjusted to match parsoid html2wt
18740 # note that wt2html and html2html will put the <i> before the <b>
18741 !! test
18742 5 quotes, code coverage +1 line w/ nowiki (1)
18743 !! options
18744 parsoid=wt2wt,html2wt
18745 !! wikitext
18746 '''''<nowiki/>'''''
18747 !! html/php
18748 <p><i></i>
18749 </p>
18750 !! html/parsoid
18751 <p><b><i></i></b></p>
18752 !! end
18753
18754 # same as previous, just swapping the <i> and <b>
18755 !! test
18756 5 quotes, code coverage +1 line w/ nowiki (2)
18757 !! wikitext
18758 '''''<nowiki/>'''''
18759 !! html/php
18760 <p><i></i>
18761 </p>
18762 !! html/parsoid
18763 <p><i><b></b></i></p>
18764 !! end
18765
18766 !! test
18767 Special:Search page linking.
18768 !! wikitext
18769 {{Special:search}}
18770 !! html
18771 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
18772 </p>
18773 !! end
18774
18775 !! test
18776 {{!}} is a magic word
18777 !! wikitext
18778 {{!}} is a magic word there and {{!}} is still a magic word here
18779 | is not a magic word here but {{!}} is still a magic word here
18780 !! html/php
18781 <p>| is a magic word there and | is still a magic word here
18782 | is not a magic word here but | is still a magic word here
18783 </p>
18784 !! html/parsoid
18785 <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
18786 | 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>
18787
18788 !! end
18789
18790 !! test
18791 Say the magic word
18792 !! options
18793 title=[[Parser test]]
18794 !! wikitext
18795 * {{PAGENAME}}
18796 * {{PAGENAMEE}}
18797 * {{FULLPAGENAME}}
18798 * {{FULLPAGENAMEE}}
18799 * {{BASEPAGENAME}}
18800 * {{BASEPAGENAMEE}}
18801 * {{SUBPAGENAME}}
18802 * {{SUBPAGENAMEE}}
18803 * {{ROOTPAGENAME}}
18804 * {{ROOTPAGENAMEE}}
18805 * {{TALKPAGENAME}}
18806 * {{TALKPAGENAMEE}}
18807 * {{SUBJECTPAGENAME}}
18808 * {{SUBJECTPAGENAMEE}}
18809 * {{NAMESPACEE}}
18810 * {{NAMESPACE}}
18811 * {{NAMESPACENUMBER}}
18812 * {{TALKSPACE}}
18813 * {{TALKSPACEE}}
18814 * {{SUBJECTSPACE}}
18815 * {{SUBJECTSPACEE}}
18816 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
18817 !! html
18818 <ul><li> Parser test</li>
18819 <li> Parser_test</li>
18820 <li> Parser test</li>
18821 <li> Parser_test</li>
18822 <li> Parser test</li>
18823 <li> Parser_test</li>
18824 <li> Parser test</li>
18825 <li> Parser_test</li>
18826 <li> Parser test</li>
18827 <li> Parser_test</li>
18828 <li> Talk:Parser test</li>
18829 <li> Talk:Parser_test</li>
18830 <li> Parser test</li>
18831 <li> Parser_test</li>
18832 <li> </li>
18833 <li> </li>
18834 <li> 0</li>
18835 <li> Talk</li>
18836 <li> Talk</li>
18837 <li> </li>
18838 <li> </li>
18839 <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>
18840
18841 !! end
18842 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
18843
18844 !! test
18845 Gallery
18846 !! wikitext
18847 <gallery>
18848 image1.png |
18849 image2.gif|||||
18850
18851 image3|
18852 image4 |300px| centre
18853 image5.svg| http://///////
18854 [[x|xx]]]]
18855 * image6
18856 </gallery>
18857 !! html
18858 <ul class="gallery mw-gallery-traditional">
18859 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18860 <div class="thumb" style="height: 150px;">Image1.png</div>
18861 <div class="gallerytext">
18862 </div>
18863 </div></li>
18864 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18865 <div class="thumb" style="height: 150px;">Image2.gif</div>
18866 <div class="gallerytext">
18867 </div>
18868 </div></li>
18869 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18870 <div class="thumb" style="height: 150px;">Image3</div>
18871 <div class="gallerytext">
18872 </div>
18873 </div></li>
18874 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18875 <div class="thumb" style="height: 150px;">Image4</div>
18876 <div class="gallerytext">
18877 <pre>centre
18878 </pre>
18879 </div>
18880 </div></li>
18881 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18882 <div class="thumb" style="height: 150px;">Image5.svg</div>
18883 <div class="gallerytext">
18884 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
18885 </p>
18886 </div>
18887 </div></li>
18888 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18889 <div class="thumb" style="height: 150px;">* image6</div>
18890 <div class="gallerytext">
18891 </div>
18892 </div></li>
18893 </ul>
18894
18895 !! end
18896
18897 !! test
18898 Gallery (with options)
18899 !! wikitext
18900 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
18901 File:Nonexistent.jpg|caption
18902 File:Nonexistent.jpg
18903 image:foobar.jpg|some '''caption''' [[Main Page]]
18904 image:foobar.jpg
18905 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
18906 </gallery>
18907 !! html
18908 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
18909 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
18910 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18911 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18912 <div class="gallerytext">
18913 <p>caption
18914 </p>
18915 </div>
18916 </div></li>
18917 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18918 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18919 <div class="gallerytext">
18920 </div>
18921 </div></li>
18922 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18923 <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>
18924 <div class="gallerytext">
18925 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18926 </p>
18927 </div>
18928 </div></li>
18929 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18930 <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>
18931 <div class="gallerytext">
18932 </div>
18933 </div></li>
18934 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18935 <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>
18936 <div class="gallerytext">
18937 <p>blabla.
18938 </p>
18939 </div>
18940 </div></li>
18941 </ul>
18942
18943 !! end
18944
18945 !! test
18946 Gallery with link that has fragment
18947 !! wikitext
18948 <gallery>
18949 image:foobar.jpg|link=Main_Page
18950 image:foobar.jpg|link=Main_Page#section
18951 image:foobar.jpg|link=Main Page#section|caption
18952 </gallery>
18953 !! html
18954 <ul class="gallery mw-gallery-traditional">
18955 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18956 <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>
18957 <div class="gallerytext">
18958 </div>
18959 </div></li>
18960 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18961 <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>
18962 <div class="gallerytext">
18963 </div>
18964 </div></li>
18965 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18966 <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>
18967 <div class="gallerytext">
18968 <p>caption
18969 </p>
18970 </div>
18971 </div></li>
18972 </ul>
18973
18974 !! end
18975
18976 !! test
18977 Gallery with wikitext inside caption
18978 !! wikitext
18979 <gallery>
18980 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
18981 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
18982 </gallery>
18983 !! html
18984 <ul class="gallery mw-gallery-traditional">
18985 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18986 <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>
18987 <div class="gallerytext">
18988 <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>
18989 </p>
18990 </div>
18991 </div></li>
18992 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18993 <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>
18994 <div class="gallerytext">
18995 <p>This is a test template
18996 </p>
18997 </div>
18998 </div></li>
18999 </ul>
19000
19001 !! end
19002
19003 !! test
19004 gallery (with showfilename option)
19005 !! wikitext
19006 <gallery showfilename>
19007 File:Nonexistent.jpg|caption
19008 File:Nonexistent.jpg
19009 image:foobar.jpg|some '''caption''' [[Main Page]]
19010 File:Foobar.jpg
19011 </gallery>
19012 !! html
19013 <ul class="gallery mw-gallery-traditional">
19014 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19015 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19016 <div class="gallerytext">
19017 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
19018 caption
19019 </p>
19020 </div>
19021 </div></li>
19022 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19023 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19024 <div class="gallerytext">
19025 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
19026 </p>
19027 </div>
19028 </div></li>
19029 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19030 <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>
19031 <div class="gallerytext">
19032 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
19033 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19034 </p>
19035 </div>
19036 </div></li>
19037 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19038 <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>
19039 <div class="gallerytext">
19040 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
19041 </p>
19042 </div>
19043 </div></li>
19044 </ul>
19045
19046 !! end
19047
19048 !! test
19049 Gallery (with namespace-less filenames)
19050 !! wikitext
19051 <gallery>
19052 File:Nonexistent.jpg
19053 Nonexistent.jpg
19054 image:foobar.jpg
19055 foobar.jpg
19056 </gallery>
19057 !! html
19058 <ul class="gallery mw-gallery-traditional">
19059 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19060 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19061 <div class="gallerytext">
19062 </div>
19063 </div></li>
19064 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19065 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19066 <div class="gallerytext">
19067 </div>
19068 </div></li>
19069 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19070 <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>
19071 <div class="gallerytext">
19072 </div>
19073 </div></li>
19074 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19075 <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>
19076 <div class="gallerytext">
19077 </div>
19078 </div></li>
19079 </ul>
19080
19081 !! end
19082
19083 !! test
19084 HTML Hex character encoding (spells the word "JavaScript")
19085 !! options
19086 parsoid=wt2html,wt2wt,html2html
19087 !! wikitext
19088 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
19089 !! html/php
19090 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
19091 </p>
19092 !! html/php+tidy
19093 <p>JavaScript</p>
19094 !! html/parsoid
19095 <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>
19096 !! end
19097
19098 !! test
19099 HTML Hex character encoding bogus encoding (bug 26437 regression check)
19100 !! wikitext
19101 &#xsee;&#XSEE;
19102 !! html/php
19103 <p>&amp;#xsee;&amp;#XSEE;
19104 </p>
19105 !! html/parsoid
19106 <p>&amp;#xsee;&amp;#XSEE;</p>
19107 !! end
19108
19109 !! test
19110 HTML Hex character encoding mixed case
19111 !! options
19112 parsoid=wt2html,wt2wt,html2html
19113 !! wikitext
19114 &#xEE;&#Xee;
19115 !! html/php
19116 <p>&#xee;&#xee;
19117 </p>
19118 !! html/php+tidy
19119 <p>îî</p>
19120 !! html/parsoid
19121 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
19122 !! end
19123
19124 # See: https://www.w3.org/TR/html5/syntax.html#character-references
19125 # Note that U+000C (form feed) is not a valid XML character, so
19126 # it is banned even though allowed in HTML5.
19127 !! test
19128 Illegal character references (T106578)
19129 !! wikitext
19130 ; Null: &#00;
19131 ; FF: &#xC;
19132 ; CR: &#xD;
19133 ; Control (low): &#8;
19134 ; Control (high): &#x7F; &#x9F;
19135 ; Surrogate: &#xD83D;&#xDCA9;
19136 ; This is an okay astral character: &#x1F4A9;
19137 !! html+tidy
19138 <dl>
19139 <dt>Null</dt>
19140 <dd>&amp;#00;</dd>
19141 <dt>FF</dt>
19142 <dd>&amp;#xC;</dd>
19143 <dt>CR</dt>
19144 <dd>&amp;#xD;</dd>
19145 <dt>Control (low)</dt>
19146 <dd>&amp;#8;</dd>
19147 <dt>Control (high)</dt>
19148 <dd>&amp;#x7F; &amp;#x9F;</dd>
19149 <dt>Surrogate</dt>
19150 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
19151 <dt>This is an okay astral character</dt>
19152 <dd>💩</dd>
19153 </dl>
19154 !! end
19155
19156 !! test
19157 __FORCETOC__ override
19158 !! wikitext
19159 __NEWSECTIONLINK__
19160 __FORCETOC__
19161 !! html/php
19162 <p><br />
19163 </p>
19164 !! end
19165
19166 !! test
19167 ISBN code coverage
19168 !! wikitext
19169 ISBN 978-0-1234-56&#x20;789
19170 !! html
19171 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
19172 </p>
19173 !! html+tidy
19174 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
19175 !! html/parsoid
19176 <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>
19177 !! end
19178
19179 !! test
19180 ISBN followed by 5 spaces
19181 !! wikitext
19182 ISBN
19183 !! html
19184 <p>ISBN
19185 </p>
19186 !! end
19187
19188 !! test
19189 Double ISBN
19190 !! wikitext
19191 ISBN ISBN 1234567890
19192 !! html/php
19193 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19194 </p>
19195 !! html/parsoid
19196 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
19197 !! end
19198
19199 # Uppercase X and lowercase x as well
19200 !! test
19201 ISBN with an X
19202 !! wikitext
19203 ISBN 3-462-04561-X
19204 ISBN 3-462-04561-x
19205 ISBN 080442957X
19206 ISBN 080442957x
19207 ISBN 978080442957X
19208 ISBN 978080442957x
19209 !! html/php
19210 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
19211 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
19212 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
19213 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
19214 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
19215 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
19216 </p>
19217 !! html/parsoid
19218 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
19219 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
19220 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
19221 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
19222 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
19223 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
19224 !! end
19225
19226 !! test
19227 ISBN with empty prefix (parsoid test)
19228 !! wikitext
19229 ISBN 1234567890
19230 !! html/php
19231 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19232 </p>
19233 !! html/parsoid
19234 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
19235 !! end
19236
19237 !! test
19238 Bug 22905: <abbr> followed by ISBN followed by </a>
19239 !! wikitext
19240 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
19241 !! html/php
19242 <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>
19243 </p>
19244 !! html/parsoid
19245 <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>
19246 !! end
19247
19248 !! test
19249 Double RFC
19250 !! wikitext
19251 RFC RFC 1234
19252 !! html
19253 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
19254 </p>
19255 !! end
19256
19257 !! test
19258 Double RFC with a wiki link
19259 !! wikitext
19260 RFC [[RFC 1234]]
19261 !! html
19262 <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>
19263 </p>
19264 !! end
19265
19266 !! test
19267 RFC code coverage
19268 !! wikitext
19269 RFC 983&#x20;987
19270 !! html
19271 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
19272 </p>
19273 !! html+tidy
19274 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
19275 !! end
19276
19277 !! test
19278 Centre-aligned image
19279 !! wikitext
19280 [[Image:foobar.jpg|centre]]
19281 !! html
19282 <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>
19283
19284 !!end
19285
19286 !! test
19287 None-aligned image
19288 !! wikitext
19289 [[Image:foobar.jpg|none]]
19290 !! html
19291 <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>
19292
19293 !!end
19294
19295 !! test
19296 Width + Height sized image (using px) (height is ignored)
19297 !! wikitext
19298 [[Image:foobar.jpg|640x480px]]
19299 !! html
19300 <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>
19301 </p>
19302 !!end
19303
19304 !! test
19305 Width-sized image (using px, no following whitespace)
19306 !! wikitext
19307 [[Image:foobar.jpg|640px]]
19308 !! html
19309 <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>
19310 </p>
19311 !!end
19312
19313 !! test
19314 Width-sized image (using px, with following whitespace - test regression from r39467)
19315 !! wikitext
19316 [[Image:foobar.jpg|640px ]]
19317 !! html
19318 <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>
19319 </p>
19320 !!end
19321
19322 !! test
19323 Width-sized image (using px, with preceding whitespace - test regression from r39467)
19324 !! wikitext
19325 [[Image:foobar.jpg| 640px]]
19326 !! html
19327 <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>
19328 </p>
19329 !!end
19330
19331 !! test
19332 Image with page parameter
19333 !! options
19334 djvu
19335 !! wikitext
19336 [[File:LoremIpsum.djvu|page=2]]
19337 !! html/php
19338 <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>
19339 </p>
19340 !! html/parsoid
19341 <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>
19342 !! end
19343
19344 !! test
19345 Another italics / bold test
19346 !! wikitext
19347 ''' ''x'
19348 !! html
19349 <pre>'<i> </i>x'
19350 </pre>
19351 !!end
19352
19353 # FIXME: The php output seems broken. It's interleaving some open/close tags.
19354 !! test
19355 dt/dd/dl test
19356 !! wikitext
19357 :;;;::
19358 !! html/php
19359 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
19360
19361 !! html/parsoid
19362 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
19363
19364 !!end
19365
19366
19367 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
19368 !! test
19369 Images with the "|" character in the comment
19370 !! wikitext
19371 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
19372 !! html/php
19373 <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>
19374
19375 !! html/parsoid
19376 <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>
19377 !! end
19378
19379 !! test
19380 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
19381 !! wikitext
19382 <html><script>alert(1);</script></html>
19383 !! html
19384 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
19385 </p>
19386 !! end
19387
19388 !! test
19389 HTML with raw HTML ($wgRawHtml==true)
19390 !! options
19391 wgRawHtml=1
19392 !! wikitext
19393 <html><script>alert(1);</script></html>
19394 !! html
19395 <p><script>alert(1);</script>
19396 </p>
19397 !! end
19398
19399 !! test
19400 Parents of subpages, one level up
19401 !! options
19402 subpage title=[[Subpage test/L1/L2/L3]]
19403 !! wikitext
19404 [[../|L2]]
19405 !! html
19406 <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>
19407 </p>
19408 !! end
19409
19410
19411 !! test
19412 Parents of subpages, one level up, not named
19413 !! options
19414 subpage title=[[Subpage test/L1/L2/L3]]
19415 !! wikitext
19416 [[../]]
19417 !! html
19418 <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>
19419 </p>
19420 !! end
19421
19422
19423
19424 !! test
19425 Parents of subpages, two levels up
19426 !! options
19427 subpage title=[[Subpage test/L1/L2/L3]]
19428 !! wikitext
19429 [[../../|L1]]2
19430
19431 [[../../|L1]]l
19432 !! html
19433 <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
19434 </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>
19435 </p>
19436 !! end
19437
19438 !! test
19439 Parents of subpages, two levels up, without trailing slash or name.
19440 !! options
19441 subpage title=[[Subpage test/L1/L2/L3]]
19442 !! wikitext
19443 [[../..]]
19444 !! html
19445 <p>[[../..]]
19446 </p>
19447 !! end
19448
19449 !! test
19450 Parents of subpages, two levels up, with lots of extra trailing slashes.
19451 !! options
19452 subpage title=[[Subpage test/L1/L2/L3]]
19453 !! wikitext
19454 [[../../////]]
19455 !! html
19456 <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>
19457 </p>
19458 !! end
19459
19460 !! article
19461 Subpage test/L1/L2/L3Sibling
19462 !! text
19463 Sibling article
19464 !! endarticle
19465
19466 !! test
19467 Transclusion of a sibling page (one level up)
19468 !! options
19469 subpage title=[[Subpage test/L1/L2/L3]]
19470 !! wikitext
19471 {{../L3Sibling}}
19472 !! html
19473 <p>Sibling article
19474 </p>
19475 !! end
19476
19477 !! test
19478 Transclusion of a child page
19479 !! options
19480 subpage title=[[Subpage test/L1/L2]]
19481 !! wikitext
19482 {{/L3Sibling}}
19483 !! html
19484 <p>Sibling article
19485 </p>
19486 !! end
19487
19488 # This is wt2html only in Parsoid because we add <nowiki>
19489 # because of {{..}} and we don't expect to fix that to
19490 # eliminate the nowikis selective for {{..}} markup.
19491 !! test
19492 Non-transclusion because of too many up levels
19493 !! options
19494 subpage title=[[Subpage test/L1/L2/L3]]
19495 parsoid=wt2html
19496 !! wikitext
19497 {{../../../../More than parent}}
19498 !! html/php
19499 <p>{{../../../../More than parent}}
19500 </p>
19501 !! html/parsoid
19502 <p>{{../../../../More than parent}}</p>
19503 !! end
19504
19505 !! test
19506 Definition list code coverage
19507 !! wikitext
19508 ; title : def
19509 ; title : def
19510 ;title: def
19511 !! html/php
19512 <dl><dt> title &#160;</dt>
19513 <dd> def</dd>
19514 <dt> title&#160;</dt>
19515 <dd> def</dd>
19516 <dt>title</dt>
19517 <dd> def</dd></dl>
19518
19519 !! html/parsoid
19520 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
19521 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
19522 <dt>title</dt><dd> def</dd></dl>
19523 !! end
19524
19525 !! test
19526 Don't fall for the self-closing div
19527 !! wikitext
19528 <div>hello world</div/>
19529 !! html
19530 <div>hello world</div>
19531
19532 !! end
19533
19534 !! test
19535 MSGNW magic word
19536 !! wikitext
19537 {{MSGNW:msg}}
19538 !! html/php
19539 <p>&#91;&#91;:Template:Msg&#93;&#93;
19540 </p>
19541 !! end
19542
19543 !! test
19544 RAW magic word
19545 !! wikitext
19546 {{RAW:QUERTY}}
19547 !! html
19548 <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>
19549 </p>
19550 !! end
19551
19552 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
19553 !! test
19554 Always escape literal '>' in output, not just after '<'
19555 !! wikitext
19556 ><>
19557 !! html
19558 <p>&gt;&lt;&gt;
19559 </p>
19560 !! end
19561
19562 !! test
19563 Template caching
19564 !! wikitext
19565 {{Test}}
19566 {{Test}}
19567 !! html
19568 <p>This is a test template
19569 This is a test template
19570 </p>
19571 !! end
19572
19573
19574 !! article
19575 MediaWiki:Fake
19576 !! text
19577 ==header==
19578 !! endarticle
19579
19580 !! test
19581 Inclusion of !userCanEdit() content
19582 !! wikitext
19583 {{MediaWiki:Fake}}
19584 !! html
19585 <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>
19586
19587 !! end
19588
19589
19590 !! test
19591 Out-of-order TOC heading levels
19592 !! wikitext
19593 ==2==
19594 ======6======
19595 ===3===
19596 =1=
19597 =====5=====
19598 ==2==
19599 !! html
19600 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19601 <ul>
19602 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
19603 <ul>
19604 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
19605 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
19606 </ul>
19607 </li>
19608 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
19609 <ul>
19610 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
19611 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
19612 </ul>
19613 </li>
19614 </ul>
19615 </div>
19616
19617 <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>
19618 <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>
19619 <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>
19620 <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>
19621 <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>
19622 <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>
19623
19624 !! end
19625
19626
19627 !! test
19628 ISBN with a dummy number
19629 !! wikitext
19630 ISBN ---
19631 !! html
19632 <p>ISBN ---
19633 </p>
19634 !! end
19635
19636
19637 !! test
19638 ISBN with space-delimited number
19639 !! wikitext
19640 ISBN 92 9017 032 8
19641 !! html
19642 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
19643 </p>
19644 !! end
19645
19646
19647 !! test
19648 ISBN with multiple spaces, no number
19649 !! wikitext
19650 ISBN foo
19651 !! html
19652 <p>ISBN foo
19653 </p>
19654 !! end
19655
19656
19657 !! test
19658 ISBN length
19659 !! wikitext
19660 ISBN 123456789
19661
19662 ISBN 1234567890
19663
19664 ISBN 12345678901
19665 !! html
19666 <p>ISBN 123456789
19667 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19668 </p><p>ISBN 12345678901
19669 </p>
19670 !! end
19671
19672
19673 !! test
19674 ISBN with trailing year (bug 8110)
19675 !! wikitext
19676 ISBN 1-234-56789-0 - 2006
19677
19678 ISBN 1 234 56789 0 - 2006
19679 !! html
19680 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
19681 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
19682 </p>
19683 !! end
19684
19685
19686 !! test
19687 anchorencode
19688 !! wikitext
19689 {{anchorencode:foo bar©#%n}}
19690 !! html
19691 <p>foo_bar.C2.A9.23.25n
19692 </p>
19693 !! end
19694
19695 !! test
19696 anchorencode trims spaces
19697 !! wikitext
19698 {{anchorencode: __pretty__please__}}
19699 !! html
19700 <p>pretty_please
19701 </p>
19702 !! end
19703
19704 !! test
19705 anchorencode deals with links
19706 !! wikitext
19707 {{anchorencode: [[hello|world]] [[hi]]}}
19708 !! html
19709 <p>world_hi
19710 </p>
19711 !! end
19712
19713 !! test
19714 anchorencode deals with templates
19715 !! wikitext
19716 {{anchorencode: {{Foo}} }}
19717 !! html
19718 <p>FOO
19719 </p>
19720 !! end
19721
19722 !! test
19723 anchorencode encodes like the TOC generator: (bug 18431)
19724 !! wikitext
19725 === _ +:.3A%3A&&amp;]] ===
19726 {{anchorencode: _ +:.3A%3A&&amp;]] }}
19727 __NOEDITSECTION__
19728 !! html
19729 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
19730 <p>.2B:.3A.253A.26.26.5D.5D
19731 </p>
19732 !! end
19733
19734 !! test
19735 Bug 6200: blockquotes and paragraph formatting
19736 !! wikitext
19737 <blockquote>
19738 foo
19739 </blockquote>
19740
19741 bar
19742
19743 baz
19744 !! html
19745 <blockquote>
19746 <p>foo
19747 </p>
19748 </blockquote>
19749 <p>bar
19750 </p>
19751 <pre>baz
19752 </pre>
19753 !! end
19754
19755 !! test
19756 Bug 8293: Use of center tag ruins paragraph formatting
19757 !! wikitext
19758 <center>
19759 foo
19760 </center>
19761
19762 bar
19763
19764 baz
19765 !! html
19766 <center>
19767 <p>foo
19768 </p>
19769 </center>
19770 <p>bar
19771 </p>
19772 <pre>baz
19773 </pre>
19774 !! end
19775
19776 !!test
19777 Parsing of overlapping (improperly nested) inline html tags
19778 !! wikitext
19779 <span><s>x</span></s>
19780 !! html/php
19781 <p><span><s>x&lt;/span&gt;</s></span>
19782 </p>
19783 !! html/parsoid
19784 <p><span><s>x</s></span>
19785 </p>
19786 !!end
19787
19788 ###
19789 ### Language variants related tests
19790 ###
19791 !! test
19792 Self-link in language variants
19793 !! options
19794 title=[[Dunav]] language=sr
19795 !! wikitext
19796 Both [[Dunav]] and [[Дунав]] are names for this river.
19797 !! html
19798 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
19799 </p>
19800 !!end
19801
19802 !! article
19803 Дуна
19804 !! text
19805 content
19806 !! endarticle
19807
19808 !! test
19809 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
19810 !! options
19811 title=[[Duna]] language=sr
19812 !! wikitext
19813 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
19814 !! html
19815 <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.
19816 </p>
19817 !! end
19818
19819 !! test
19820 Link to a section of a variant of this title shouldn't be parsed as self-link
19821 !! options
19822 title=[[Duna]] language=sr
19823 !! wikitext
19824 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
19825 !! html
19826 <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.
19827 </p>
19828 !! end
19829
19830 !! test
19831 Link to pages in language variants
19832 !! options
19833 language=sr
19834 !! wikitext
19835 Main Page can be written as [[Маин Паге]]
19836 !! html
19837 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
19838 </p>
19839 !!end
19840
19841
19842 !! test
19843 Multiple links to pages in language variants
19844 !! options
19845 language=sr
19846 !! wikitext
19847 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
19848 !! html
19849 <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>.
19850 </p>
19851 !!end
19852
19853
19854 !! test
19855 Simple template in language variants
19856 !! options
19857 language=sr
19858 !! wikitext
19859 {{тест}}
19860 !! html
19861 <p>This is a test template
19862 </p>
19863 !! end
19864
19865
19866 !! test
19867 Template with explicit namespace in language variants
19868 !! options
19869 language=sr
19870 !! wikitext
19871 {{Template:тест}}
19872 !! html
19873 <p>This is a test template
19874 </p>
19875 !! end
19876
19877
19878 !! test
19879 Basic test for template parameter in language variants
19880 !! options
19881 language=sr
19882 !! wikitext
19883 {{парамтест|param=foo}}
19884 !! html
19885 <p>This is a test template with parameter foo
19886 </p>
19887 !! end
19888
19889 !! test
19890 Simple category in language variants
19891 !! options
19892 language=sr cat
19893 !! wikitext
19894 [[Category:МедиаWики Усер'с Гуиде]]
19895 !! html/php
19896 cat=МедиаWики_Усер'с_Гуиде sort=
19897 !! html/parsoid
19898 <link rel="mw:PageProp/Category" href="./Категорија:МедиаWики_Усер'с_Гуиде" data-parsoid='{"stx":"simple","a":{"href":"./Категорија:МедиаWики_Усер&#39;с_Гуиде"},"sa":{"href":"Category:МедиаWики Усер&#39;с Гуиде"}}'/>
19899 !! end
19900
19901 !! article
19902 Category:分类
19903 !! text
19904 blah
19905 !! endarticle
19906
19907 !! article
19908 Category:分類
19909 !! text
19910 blah
19911 !! endarticle
19912
19913 ## We used to, but no longer wt2wt this test since the default serializer
19914 ## will normalize all categories to serialize on their own line.
19915 ## This wikitext usage is going to be fairly uncommon in production and
19916 ## selser will take care of preserving formatting in those scenarios.
19917 !! test
19918 Don't convert blue categorylinks to another variant (bug 33210)
19919 !! options
19920 cat
19921 language=zh
19922 parsoid=wt2html
19923 !! wikitext
19924 [[A]][[Category:分类]]
19925 !! html/php
19926 cat=分类 sort=
19927 !! html/parsoid
19928 <p><a rel="mw:WikiLink" href="A" title="A">A</a></p>
19929 <link rel="mw:PageProp/Category" href="Category:分类"/>
19930 !! end
19931
19932 !! test
19933 Stripping -{}- tags (language variants)
19934 !! options
19935 language=sr
19936 !! wikitext
19937 Latin proverb: -{Ne nuntium necare}-
19938 !! html
19939 <p>Latin proverb: Ne nuntium necare
19940 </p>
19941 !! end
19942
19943
19944 !! test
19945 Prevent conversion with -{}- tags (language variants)
19946 !! options
19947 language=sr variant=sr-ec
19948 !! wikitext
19949 Latinski: -{Ne nuntium necare}-
19950 !! html
19951 <p>Латински: Ne nuntium necare
19952 </p>
19953 !! end
19954
19955
19956 !! test
19957 Prevent conversion of text with -{}- tags (language variants)
19958 !! options
19959 language=sr variant=sr-ec
19960 !! wikitext
19961 Latinski: -{Ne nuntium necare}-
19962 !! html
19963 <p>Латински: Ne nuntium necare
19964 </p>
19965 !! end
19966
19967
19968 !! test
19969 Prevent conversion of links with -{}- tags (language variants)
19970 !! options
19971 language=sr variant=sr-ec
19972 !! wikitext
19973 -{[[Main Page]]}-
19974 !! html
19975 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19976 </p>
19977 !! end
19978
19979
19980 !! test
19981 -{}- tags within headlines (within html for parserConvert())
19982 !! options
19983 language=sr variant=sr-ec
19984 !! wikitext
19985 == -{Naslov}- ==
19986 !! html
19987 <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>
19988
19989 !! end
19990
19991
19992 !! test
19993 Explicit definition of language variant alternatives
19994 !! options
19995 language=zh variant=zh-tw
19996 !! wikitext
19997 -{zh:China;zh-tw:Taiwan}-, not China
19998 !! html
19999 <p>Taiwan, not China
20000 </p>
20001 !! end
20002
20003
20004 !! test
20005 Conversion around HTML tags
20006 !! options
20007 language=sr variant=sr-ec
20008 !! wikitext
20009 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
20010 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
20011 !! html
20012 <p>
20013 <span title="ЛаCтин">ски</span>
20014 </p>
20015 !! end
20016
20017
20018 !! test
20019 Explicit session-wise language variant mapping (A flag and - flag)
20020 !! options
20021 language=zh variant=zh-tw
20022 !! wikitext
20023 Taiwan is not China.
20024 But -{A|zh:China;zh-tw:Taiwan}- is China,
20025 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
20026 and -{China}- is China.
20027 !! html
20028 <p>Taiwan is not China.
20029 But Taiwan is Taiwan,
20030 (This should be stripped!)
20031 and China is China.
20032 </p>
20033 !! end
20034
20035 !! test
20036 Explicit session-wise language variant mapping (H flag for hide)
20037 !! options
20038 language=zh variant=zh-tw
20039 !! wikitext
20040 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
20041 Taiwan is China.
20042 !! html
20043 <p>(This should be stripped!)
20044 Taiwan is Taiwan.
20045 </p>
20046 !! end
20047
20048 !! test
20049 Adding explicit conversion rule for title (T flag)
20050 !! options
20051 language=zh variant=zh-tw showtitle
20052 !! wikitext
20053 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20054 !! html
20055 Taiwan
20056 <p>Should be stripped!
20057 </p>
20058 !! end
20059
20060 !! test
20061 Testing that changing the language variant here in the tests actually works
20062 !! options
20063 language=zh variant=zh showtitle
20064 !! wikitext
20065 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20066 !! html
20067 China
20068 <p>Should be stripped!
20069 </p>
20070 !! end
20071
20072 !! test
20073 Recursive conversion of alt and title attrs shouldn't clear converter state
20074 !! options
20075 language=zh variant=zh-cn showtitle
20076 !! wikitext
20077 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
20078 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
20079 !! html
20080 China
20081 <p>
20082 Should be stripped<span title="Exclamation">!</span>
20083 </p>
20084 !! end
20085
20086 !! test
20087 Bug 24072: more test on conversion rule for title
20088 !! options
20089 language=zh variant=zh-tw showtitle
20090 !! wikitext
20091 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20092 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
20093 !! html
20094 Taiwan
20095 <p>This should be stripped!
20096 This won't take interferes with the title rule.
20097 </p>
20098 !! end
20099
20100 !! test
20101 Partly disable title conversion if variant == main language code
20102 !! options
20103 language=zh variant=zh title=[[ZH]] showtitle
20104 !! wikitext
20105 -{T|zh-cn:CN;zh-tw:TW}-
20106 !! html
20107 ZH
20108 <p>
20109 </p>
20110 !! end
20111
20112 !! test
20113 Partly disable title conversion if variant == main language code, more
20114 !! options
20115 language=zh variant=zh title=[[ZH]] showtitle
20116 !! wikitext
20117 -{T|TW}-
20118 !! html
20119 ZH
20120 <p>
20121 </p>
20122 !! end
20123
20124 !! test
20125 Raw output of variant escape tags (R flag)
20126 !! options
20127 language=zh variant=zh-tw
20128 !! wikitext
20129 Raw: -{R|zh:China;zh-tw:Taiwan}-
20130 !! html
20131 <p>Raw: zh:China;zh-tw:Taiwan
20132 </p>
20133 !! end
20134
20135 !! test
20136 Strings evaluating false shouldn't be ignored by Language converter (T51072)
20137 !! options
20138 language=zh variant=zh-cn
20139 !! input
20140 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
20141 !! result
20142 <p>0
20143 </p>
20144 !! end
20145
20146 !! test
20147 Conversion rules from [numeric-only string] to [something else] (T48634)
20148 !! options
20149 language=zh variant=zh-cn
20150 !! input
20151 -{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
20152 !! result
20153 <p>D12345EE12345
20154 </p>
20155 !! end
20156
20157 !! test
20158 Bidirectional converter rule entries with an empty value should be ignored (T53551)
20159 !! options
20160 language=zh variant=zh-cn
20161 !! input
20162 -{H|zh-cn:foo;zh-tw:;}-foobar
20163 !! result
20164 <p>foobar
20165 </p>
20166 !! end
20167
20168 !! test
20169 Unidirectional converter rule entries with an empty "from" string should be ignored (T53551)
20170 !! options
20171 language=zh variant=zh-cn
20172 !! input
20173 -{H|=>zh-cn:foo;}-foobar
20174 !! result
20175 <p>foobar
20176 </p>
20177 !! end
20178
20179 !! test
20180 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
20181 !! options
20182 language=zh variant=zh-cn
20183 !! input
20184 -{H|}-foobar
20185 !! result
20186 <p>foobar
20187 </p>
20188 !! end
20189
20190 !! test
20191 Nested using of manual convert syntax
20192 !! options
20193 language=zh variant=zh-hk
20194 !! wikitext
20195 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
20196 !! html
20197 <p>Nested: Hello Hong Kong!
20198 </p>
20199 !! end
20200
20201 # Since Parsoid is starting to emit canonical wikitext for links,
20202 # [http://example.com http://example.com] will not RT back to that
20203 # form anymore.
20204 !! test
20205 Proper conversion of text in external links
20206 !! options
20207 language=sr variant=sr-ec
20208 parsoid=wt2html
20209 !! wikitext
20210 http://www.google.com
20211 gopher://www.google.com
20212 [http://www.google.com http://www.google.com]
20213 [gopher://www.google.com gopher://www.google.com]
20214 [https://www.google.com irc://www.google.com]
20215 [ftp://www.google.com www.google.com/ftp://dir]
20216 [//www.google.com www.google.com]
20217 !! html/php
20218 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
20219 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
20220 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
20221 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
20222 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
20223 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
20224 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
20225 </p>
20226 !! html/parsoid
20227 <p><a rel="mw:ExtLink" href="http://www.google.com">http://www.google.com</a>
20228 <a rel="mw:ExtLink" href="gopher://www.google.com">gopher://www.google.com</a>
20229 <a rel="mw:ExtLink" href="http://www.google.com">http://www.google.com</a>
20230 <a rel="mw:ExtLink" href="gopher://www.google.com">gopher://www.google.com</a>
20231 <a rel="mw:ExtLink" href="https://www.google.com">irc://www.google.com</a>
20232 <a rel="mw:ExtLink" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
20233 <a rel="mw:ExtLink" href="//www.google.com">www.гоогле.цом</a></p>
20234 !! end
20235
20236 !! test
20237 Do not convert roman numbers to language variants
20238 !! options
20239 language=sr variant=sr-ec
20240 !! wikitext
20241 Fridrih IV je car.
20242 !! html
20243 <p>Фридрих IV је цар.
20244 </p>
20245 !! end
20246
20247 !! test
20248 Unclosed language converter markup "-{"
20249 !! options
20250 language=sr
20251 !! wikitext
20252 -{T|hello
20253 !! html
20254 <p>-{T|hello
20255 </p>
20256 !! end
20257
20258 !! test
20259 Don't convert raw rule "-{R|=&gt;}-" to "=>"
20260 !! options
20261 language=sr
20262 !! wikitext
20263 -{R|=&gt;}-
20264 !! html
20265 <p>=&gt;
20266 </p>
20267 !!end
20268
20269 !! test
20270 Don't break link parsing if language converter markup is in the caption.
20271 !! options
20272 language=sr variant=sr-ec
20273 !! wikitext
20274 [[Main Page|-{R|main page}-]]
20275 !! html
20276 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
20277 </p>
20278 !! end
20279
20280 # FIXME: This test is currently broken in the PHP parser (bug 52661)
20281 !! test
20282 Don't break image parsing if language converter markup is in the caption.
20283 !! options
20284 language=sr
20285 !! wikitext
20286 [[File:Foobar.jpg|-{R|caption}-]]
20287 !! html/parsoid
20288 <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>
20289 </p>
20290 !! end
20291
20292 # FIXME: This test is currently broken in the PHP parser (bug 52661)
20293 !! test
20294 Don't break list handling if language converter markup is in the item.
20295 !! options
20296 language=zh variant=zh-cn
20297 !! wikitext
20298 ;-{zh-cn:AAA;zh-tw:BBB}-
20299 !! html/php
20300 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
20301
20302 !! html/parsoid
20303 <dl><dt>AAA
20304 </dt></dl>
20305 !! end
20306
20307 # FIXME: This test is currently broken in the PHP parser (bug 52661)
20308 !! test
20309 Don't break table handling if language converter markup is in the cell.
20310 !! options
20311 language=sr variant=sr-ec
20312 !! wikitext
20313 {|
20314 |-
20315 | -{R|B}-
20316 |}
20317 !! html/php
20318 <table>
20319
20320 <tr>
20321 <td>Б}-
20322 </td></tr></table>
20323
20324 !! html/parsoid
20325 <table>
20326
20327 <tr>
20328 <td> B
20329 </td></tr></table>
20330
20331 !! end
20332
20333 !! test
20334 Bug 529: Uncovered bullet
20335 !! wikitext
20336 * Foo {{bullet}}
20337 !! html
20338 <ul><li> Foo </li>
20339 <li> Bar</li></ul>
20340
20341 !! end
20342
20343 # Plain MediaWiki does not remove empty lists, but tidy actually does.
20344 # Templates in Wikipedia rely on this behavior, as tidy has always been
20345 # enabled there. These tests are normally run *without* tidy, so specify the
20346 # full output here.
20347 # To test realistic parsing behavior, apply a tidy-like transformation to both
20348 # the expected output and your parser's output.
20349 !! test
20350 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
20351 !! wikitext
20352 ******* Foo {{bullet}}
20353 !! html
20354 <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>
20355 <li> Bar</li></ul>
20356
20357 !! end
20358
20359 !! test
20360 Bug 529: Uncovered table already at line-start
20361 !! wikitext
20362 x
20363
20364 {{table}}
20365 y
20366 !! html
20367 <p>x
20368 </p>
20369 <table>
20370 <tr>
20371 <td> 1 </td>
20372 <td> 2
20373 </td></tr>
20374 <tr>
20375 <td> 3 </td>
20376 <td> 4
20377 </td></tr></table>
20378 <p>y
20379 </p>
20380 !! end
20381
20382 !! test
20383 Bug 529: Uncovered bullet in parser function result
20384 !! wikitext
20385 * Foo {{lc:{{bullet}} }}
20386 !! html
20387 <ul><li> Foo </li>
20388 <li> bar</li></ul>
20389
20390 !! end
20391
20392 !! test
20393 Bug 5678: Double-parsed template argument
20394 !! wikitext
20395 {{lc:{{{1}}}|hello}}
20396 !! html
20397 <p>{{{1}}}
20398 </p>
20399 !! end
20400
20401 !! test
20402 Bug 5678: Double-parsed template invocation
20403 !! wikitext
20404 {{lc:{{paramtest {{!}} param = hello }} }}
20405 !! html
20406 <p>{{paramtest | param = hello }}
20407 </p>
20408 !! end
20409
20410 !! test
20411 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
20412 !! options
20413 language=cs
20414 title=[[Main Page]]
20415 !! wikitext
20416 {{PRVNÍVELKÉ:ěščř}}
20417 {{prvnívelké:ěščř}}
20418 {{PRVNÍMALÉ:ěščř}}
20419 {{prvnímalé:ěščř}}
20420 {{MALÁ:ěščř}}
20421 {{malá:ěščř}}
20422 {{VELKÁ:ěščř}}
20423 {{velká:ěščř}}
20424 !! html
20425 <p>Ěščř
20426 Ěščř
20427 ěščř
20428 ěščř
20429 ěščř
20430 ěščř
20431 ĚŠČŘ
20432 ĚŠČŘ
20433 </p>
20434 !! end
20435
20436 !! test
20437 Morwen/13: Unclosed link followed by heading
20438 !! wikitext
20439 [[link
20440 ==heading==
20441 !! html
20442 <p>[[link
20443 </p>
20444 <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>
20445
20446 !! end
20447
20448 !! test
20449 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
20450 !! wikitext
20451 {{foo|
20452 =heading=
20453 !! html
20454 <p>{{foo|
20455 </p>
20456 <h1><span class="mw-headline" id="heading">heading</span></h1>
20457
20458 !! end
20459
20460 !! test
20461 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
20462 !! wikitext
20463 {{foo|
20464 ==heading==
20465 !! html
20466 <p>{{foo|
20467 </p>
20468 <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>
20469
20470 !! end
20471
20472 !! test
20473 Tildes in comments
20474 !! options
20475 pst
20476 !! wikitext
20477 <!-- ~~~~ -->
20478 !! html/php
20479 <!-- ~~~~ -->
20480 !! end
20481
20482 !! test
20483 Paragraphs inside divs (no extra line breaks)
20484 !! wikitext
20485 <div>Line one
20486
20487 Line two</div>
20488 !! html
20489 <div>Line one
20490 Line two</div>
20491
20492 !! end
20493
20494 !! test
20495 Paragraphs inside divs (extra line break on open)
20496 !! wikitext
20497 <div>
20498 Line one
20499
20500 Line two</div>
20501 !! html
20502 <div>
20503 <p>Line one
20504 </p>
20505 Line two</div>
20506
20507 !! end
20508
20509 !! test
20510 Paragraphs inside divs (extra line break on close)
20511 !! wikitext
20512 <div>Line one
20513
20514 Line two
20515 </div>
20516 !! html
20517 <div>Line one
20518 <p>Line two
20519 </p>
20520 </div>
20521
20522 !! end
20523
20524 !! test
20525 Paragraphs inside divs (extra line break on open and close)
20526 !! wikitext
20527 <div>
20528 Line one
20529
20530 Line two
20531 </div>
20532 !! html
20533 <div>
20534 <p>Line one
20535 </p><p>Line two
20536 </p>
20537 </div>
20538
20539 !! end
20540
20541 !! test
20542 Nesting tags, paragraphs on lines which begin with <div>
20543 !! wikitext
20544 <div></div><strong>A
20545 B</strong>
20546 !! html/php+tidy
20547 <p><strong>A</strong></p>
20548 <p><strong>B</strong></p>
20549 !! html/parsoid
20550 <div></div>
20551 <p><strong>A
20552 B</strong>
20553 </p>
20554 !! end
20555
20556 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
20557 !! test
20558 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
20559 !! wikitext
20560 <blockquote>Line one
20561
20562 Line two</blockquote>
20563 !! html
20564 <blockquote>Line one
20565 Line two</blockquote>
20566
20567 !! html+tidy
20568 <blockquote>
20569 <p>Line one Line two</p>
20570 </blockquote>
20571 !! end
20572
20573 !! test
20574 Bug 6200: paragraphs inside blockquotes (extra line break on open)
20575 !! wikitext
20576 <blockquote>
20577 Line one
20578
20579 Line two</blockquote>
20580 !! html
20581 <blockquote>
20582 <p>Line one
20583 </p>
20584 Line two</blockquote>
20585
20586 !! html+tidy
20587 <blockquote>
20588 <p>Line one</p>
20589 Line two</blockquote>
20590 !! end
20591
20592 !! test
20593 Bug 6200: paragraphs inside blockquotes (extra line break on close)
20594 !! wikitext
20595 <blockquote>Line one
20596
20597 Line two
20598 </blockquote>
20599 !! html
20600 <blockquote>Line one
20601 <p>Line two
20602 </p>
20603 </blockquote>
20604
20605 !! html+tidy
20606 <blockquote>
20607 <p>Line one</p>
20608 <p>Line two</p>
20609 </blockquote>
20610 !! end
20611
20612 !! test
20613 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
20614 !! wikitext
20615 <blockquote>
20616 Line one
20617
20618 Line two
20619 </blockquote>
20620 !! html
20621 <blockquote>
20622 <p>Line one
20623 </p><p>Line two
20624 </p>
20625 </blockquote>
20626
20627 !! html+tidy
20628 <blockquote>
20629 <p>Line one</p>
20630 <p>Line two</p>
20631 </blockquote>
20632 !! end
20633
20634 !! test
20635 Paragraphs inside blockquotes/divs (no extra line breaks)
20636 !! wikitext
20637 <blockquote><div>Line one
20638
20639 Line two</div></blockquote>
20640 !! html
20641 <blockquote><div>Line one
20642 Line two</div></blockquote>
20643
20644 !! end
20645
20646 !! test
20647 Paragraphs inside blockquotes/divs (extra line break on open)
20648 !! wikitext
20649 <blockquote><div>
20650 Line one
20651
20652 Line two</div></blockquote>
20653 !! html
20654 <blockquote><div>
20655 <p>Line one
20656 </p>
20657 Line two</div></blockquote>
20658
20659 !! end
20660
20661 !! test
20662 Paragraphs inside blockquotes/divs (extra line break on close)
20663 !! wikitext
20664 <blockquote><div>Line one
20665
20666 Line two
20667 </div></blockquote>
20668 !! html
20669 <blockquote><div>Line one
20670 <p>Line two
20671 </p>
20672 </div></blockquote>
20673
20674 !! end
20675
20676 !! test
20677 Paragraphs inside blockquotes/divs (extra line break on open and close)
20678 !! wikitext
20679 <blockquote><div>
20680 Line one
20681
20682 Line two
20683 </div></blockquote>
20684 !! html
20685 <blockquote><div>
20686 <p>Line one
20687 </p><p>Line two
20688 </p>
20689 </div></blockquote>
20690
20691 !! end
20692
20693 !! test
20694 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
20695 !! options
20696 wgLinkHolderBatchSize=0
20697 !! wikitext
20698 [[meatball:1]]
20699 [[meatball:2]]
20700 [[meatball:3]]
20701 !! html
20702 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
20703 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
20704 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
20705 </p>
20706 !! end
20707
20708 !! test
20709 Free external link invading image caption
20710 !! wikitext
20711 [[Image:Foobar.jpg|thumb|http://x|hello]]
20712 !! html
20713 <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>
20714
20715 !! end
20716
20717 !! test
20718 Bug 15196: localised external link numbers
20719 !! options
20720 language=fa
20721 !! wikitext
20722 [http://en.wikipedia.org/]
20723 !! html/php
20724 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
20725 </p>
20726 !! html/parsoid
20727 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
20728 !! end
20729
20730 !! test
20731 Multibyte character in padleft
20732 !! wikitext
20733 {{padleft:-Hello|7|Æ}}
20734 !! html
20735 <p>Æ-Hello
20736 </p>
20737 !! end
20738
20739 !! test
20740 Multibyte character in padright
20741 !! wikitext
20742 {{padright:Hello-|7|Æ}}
20743 !! html
20744 <p>Hello-Æ
20745 </p>
20746 !! end
20747
20748 !!test
20749 formatdate parser function
20750 !! wikitext
20751 {{#formatdate:2009-03-24}}
20752 !! html
20753 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
20754 </p>
20755 !! end
20756
20757 !!test
20758 formatdate parser function, with default format
20759 !! wikitext
20760 {{#formatdate:2009-03-24|mdy}}
20761 !! html
20762 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
20763 </p>
20764 !! end
20765
20766 !! test
20767 Spacing of numbers in formatted dates
20768 !! wikitext
20769 {{#formatdate:January 15}}
20770 !! html
20771 <p><span class="mw-formatted-date" title="01-15">January 15</span>
20772 </p>
20773 !! end
20774
20775 !! test
20776 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
20777 !! options
20778 language=nl title=[[MediaWiki:Common.css]]
20779 !! wikitext
20780 {{#formatdate:2009-03-24|dmy}}
20781 !! html
20782 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
20783 </p>
20784 !! end
20785
20786 #
20787 #
20788 #
20789
20790 #
20791 # Edit comments
20792 #
20793
20794 !! test
20795 Edit comment with link
20796 !! options
20797 comment
20798 !! wikitext
20799 I like the [[Main Page]] a lot
20800 !! html/php
20801 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
20802 !!end
20803
20804 !! test
20805 Edit comment with link and link text
20806 !! options
20807 comment
20808 !! wikitext
20809 I like the [[Main Page|best pages]] a lot
20810 !! html/php
20811 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
20812 !!end
20813
20814 !! test
20815 Edit comment with link and link text with suffix
20816 !! options
20817 comment
20818 !! wikitext
20819 I like the [[Main Page|best page]]s a lot
20820 !! html/php
20821 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
20822 !!end
20823
20824 !! test
20825 Edit comment with section link (non-local, eg in history list)
20826 !! options
20827 comment title=[[Main Page]]
20828 !! wikitext
20829 /* External links */ removed bogus entries
20830 !! html/php
20831 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
20832 !!end
20833
20834 !! test
20835 Edit comment with section link and text before it (non-local, eg in history list)
20836 !! options
20837 comment title=[[Main Page]]
20838 !! wikitext
20839 pre-comment text /* External links */ removed bogus entries
20840 !! html/php
20841 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>
20842 !!end
20843
20844 !! test
20845 Edit comment with section link (local, eg in diff view)
20846 !! options
20847 comment local title=[[Main Page]]
20848 !! wikitext
20849 /* External links */ removed bogus entries
20850 !! html/php
20851 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
20852 !!end
20853
20854 !! test
20855 Edit comment with subpage link (bug 14080)
20856 !! options
20857 comment
20858 subpage
20859 title=[[Subpage test]]
20860 !! wikitext
20861 Poked at a [[/subpage]] here...
20862 !! html/php
20863 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
20864 !!end
20865
20866 !! test
20867 Edit comment with subpage link and link text (bug 14080)
20868 !! options
20869 comment
20870 subpage
20871 title=[[Subpage test]]
20872 !! wikitext
20873 Poked at a [[/subpage|neat little page]] here...
20874 !! html/php
20875 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
20876 !!end
20877
20878 !! test
20879 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
20880 !! options
20881 comment
20882 title=[[Subpage test]]
20883 !! wikitext
20884 Poked at a [[/subpage]] here...
20885 !! html/php
20886 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...
20887 !!end
20888
20889 !! test
20890 Edit comment with bare anchor link (local, as on diff)
20891 !! options
20892 comment
20893 local
20894 title=[[Main Page]]
20895 !! wikitext
20896 [[#section]]
20897 !! html/php
20898 <a href="#section">#section</a>
20899 !! end
20900
20901 !! test
20902 Edit comment with bare anchor link (non-local, as on history)
20903 !! options
20904 comment
20905 title=[[Main Page]]
20906 !! wikitext
20907 [[#section]]
20908 !! html/php
20909 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
20910 !! end
20911
20912 !! test
20913 Anchor starting with underscore
20914 !! options
20915 title=[[Foo]]
20916 !! wikitext
20917 [[#_ref|One]]
20918 !! html/php
20919 <p><a href="#_ref">One</a>
20920 </p>
20921 !! html/parsoid
20922 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
20923 !! end
20924
20925 !! test
20926 Id starting with underscore
20927 !! wikitext
20928 <div id="_ref"></div>
20929 !! html/*
20930 <div id="_ref"></div>
20931
20932 !! end
20933
20934 !! test
20935 Edit comment with link with more than one pipe (T99346)
20936 !! options
20937 comment
20938 !! wikitext
20939 [[Main Page|Many|pipes]]
20940 !! html
20941 <a href="/wiki/Main_Page" title="Main Page">Many|pipes</a>
20942 !! end
20943
20944 !! test
20945 Complex edit comment with link with more than one pipe (T99346)
20946 !! options
20947 comment
20948 !! wikitext
20949 Created page with "<noinclude>[[Category:Requests for permissions/Bot|{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}]]</noinclude> === [[User:MineoBot|]] 8=== {{Request for permissions/links|Mineo..."
20950 !! html
20951 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;
20952 !! end
20953
20954 !! test
20955 Space normalisation on autocomment (bug 22784)
20956 !! options
20957 comment
20958 title=[[Main Page]]
20959 !! wikitext
20960 /* __hello__world__ */
20961 !! html/php
20962 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
20963 !! end
20964
20965 !! test
20966 percent-encoding and + signs in comments (Bug 26410)
20967 !! options
20968 comment
20969 !! wikitext
20970 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
20971 !! html/php
20972 <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>
20973 !! end
20974
20975 # Parsoid doesn't support this yet: see bug 73581
20976 # but it *should* omit the 'src' attribute if the image is bad.
20977 # PHP side of tests was disabled in
20978 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
20979 # because of issues in the PHP parserTests infrastructure
20980 # (but the output below is indeed what the PHP side emits)
20981 !! test
20982 Bad images - basic functionality
20983 !! wikitext
20984 [[File:Bad.jpg]]
20985 !! DISABLED/html/php
20986 !! html/parsoid
20987 <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>
20988 !! end
20989
20990 !! test
20991 Bad images - bug 16039: text after bad image disappears
20992 !! wikitext
20993 Foo bar
20994 [[File:Bad.jpg]]
20995 Bar foo
20996 !! DISABLED/html/php
20997 <p>Foo bar
20998 </p><p>Bar foo
20999 </p>
21000 !! html/parsoid
21001 <p>Foo bar
21002 <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>
21003 Bar foo</p>
21004 !! end
21005
21006 !! test
21007 Verify that displaytitle works (bug #22501) no displaytitle
21008 !! options
21009 showtitle
21010 !! config
21011 wgAllowDisplayTitle=true
21012 wgRestrictDisplayTitle=false
21013 !! wikitext
21014 this is not the the title
21015 !! html/php
21016 Parser test
21017 <p>this is not the the title
21018 </p>
21019 !! end
21020
21021 !! test
21022 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
21023 !! options
21024 showtitle
21025 title=[[Screen]]
21026 !! config
21027 wgAllowDisplayTitle=true
21028 wgRestrictDisplayTitle=false
21029 !! wikitext
21030 this is not the the title
21031 {{DISPLAYTITLE:whatever}}
21032 !! html/php
21033 whatever
21034 <p>this is not the the title
21035 </p>
21036 !! end
21037
21038 !! test
21039 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
21040 !! options
21041 showtitle
21042 title=[[Screen]]
21043 !! config
21044 wgAllowDisplayTitle=true
21045 wgRestrictDisplayTitle=true
21046 !! wikitext
21047 this is not the the title
21048 {{DISPLAYTITLE:whatever}}
21049 !! html/php
21050 Screen
21051 <p>this is not the the title
21052 </p>
21053 !! end
21054
21055 !! test
21056 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
21057 !! options
21058 showtitle
21059 title=[[Screen]]
21060 !! config
21061 wgAllowDisplayTitle=true
21062 wgRestrictDisplayTitle=true
21063 !! wikitext
21064 this is not the the title
21065 {{DISPLAYTITLE:screen}}
21066 !! html/php
21067 screen
21068 <p>this is not the the title
21069 </p>
21070 !! end
21071
21072 !! test
21073 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
21074 !! options
21075 showtitle
21076 title=[[Screen]]
21077 !! config
21078 wgAllowDisplayTitle=false
21079 !! wikitext
21080 this is not the the title
21081 {{DISPLAYTITLE:screen}}
21082 !! html/php
21083 Screen
21084 <p>this is not the the title
21085 <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>
21086 </p>
21087 !! end
21088
21089 !! test
21090 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
21091 !! options
21092 showtitle
21093 title=[[Screen]]
21094 !! config
21095 wgAllowDisplayTitle=false
21096 !! wikitext
21097 this is not the the title
21098 !! html/php
21099 Screen
21100 <p>this is not the the title
21101 </p>
21102 !! end
21103
21104 !! test
21105 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
21106 !! options
21107 showtitle
21108 title=[[Screen]]
21109 !! config
21110 wgAllowDisplayTitle=true
21111 wgRestrictDisplayTitle=true
21112 !! wikitext
21113 this is not the the title
21114 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
21115 !! html/php
21116 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
21117 <p>this is not the the title
21118 </p>
21119 !! end
21120
21121 !! test
21122 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
21123 !! options
21124 showtitle
21125 title=[[Screen]]
21126 !! config
21127 wgAllowDisplayTitle=true
21128 wgRestrictDisplayTitle=true
21129 !! wikitext
21130 this is not the the title
21131 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
21132 !! html/php
21133 <span style="color: red;">s</span>creen
21134 <p>this is not the the title
21135 </p>
21136 !! end
21137
21138 !! test
21139 Page status indicators: Empty name is invalid
21140 !! options
21141 showindicators
21142 !! wikitext
21143 <indicator name=" "></indicator>
21144 <indicator></indicator>
21145 !! html
21146 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
21147 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
21148 </p>
21149 !! end
21150
21151 !! test
21152 Page status indicators: Weird syntaxes that are okay
21153 !! options
21154 showindicators
21155 !! wikitext
21156 <indicator name="empty" />
21157 <indicator name="name"></indicator>
21158 !! html
21159 empty=
21160 name=
21161 <p><br />
21162 </p>
21163 !! end
21164
21165 !! test
21166 Page status indicators: Torture test
21167 !! options
21168 showindicators
21169 !! wikitext
21170 <indicator name="01">hello world</indicator>
21171 <indicator name="02">[[Main Page]]</indicator>
21172 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
21173 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
21174 <indicator name="05">* foo
21175 * bar</indicator>
21176 <indicator name="06"><nowiki>foo</nowiki></indicator>
21177 <indicator name="07"> Preformatted</indicator>
21178 <indicator name="08"><div>Broken tag</indicator>
21179 <indicator name="09">{| class=wikitable
21180 | cell
21181 |}</indicator>
21182 <indicator name="10">Two
21183
21184 paragraphs</indicator>
21185 !! html
21186 01=hello world
21187 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
21188 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" />
21189 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>
21190 05=<ul><li> foo</li>
21191 <li> bar</li></ul>
21192
21193 06=foo
21194 07=<pre>Preformatted
21195 </pre>
21196 08=<div>Broken tag</div>
21197
21198 09=<table class="wikitable">
21199 <tr>
21200 <td> cell
21201 </td></tr></table>
21202
21203 10=<p>Two
21204 </p><p>paragraphs
21205 </p>
21206 <p><br />
21207 </p><p><br />
21208 </p><p><br />
21209 </p><p><br />
21210 </p><p><br />
21211 </p>
21212 !! end
21213
21214 !! test
21215 preload: check <noinclude> and <includeonly>
21216 !! options
21217 preload
21218 !! wikitext
21219 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
21220 !! html/php
21221 Hello kind world.
21222 !! end
21223
21224 !! test
21225 preload: check <onlyinclude>
21226 !! options
21227 preload
21228 !! wikitext
21229 Goodbye <onlyinclude>Hello world</onlyinclude>
21230 !! html/php
21231 Hello world
21232 !! end
21233
21234 !! test
21235 preload: can pass tags through if we want to
21236 !! options
21237 preload
21238 !! wikitext
21239 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
21240 !! html/php
21241 <includeonly>Hello world</includeonly>
21242 !! end
21243
21244 !! test
21245 preload: check that it doesn't try to do tricks
21246 !! options
21247 preload
21248 !! wikitext
21249 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
21250 !! html/php
21251 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
21252 !! end
21253
21254 !! test
21255 Play a bit with r67090 and bug 3158
21256 !! wikitext
21257 <div style="width:50% !important">&nbsp;</div>
21258 <div style="width:50%&nbsp;!important">&nbsp;</div>
21259 <div style="width:50%&#160;!important">&nbsp;</div>
21260 <div style="border : solid;">&nbsp;</div>
21261 !! html/php
21262 <div style="width:50% !important">&#160;</div>
21263 <div style="width:50% !important">&#160;</div>
21264 <div style="width:50% !important">&#160;</div>
21265 <div style="border&#160;: solid;">&#160;</div>
21266
21267 !! html/parsoid
21268 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
21269 <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>
21270 <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>
21271 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
21272
21273 !! end
21274
21275 !! test
21276 HTML5 data attributes
21277 !! wikitext
21278 <span data-foo="bar">Baz</span>
21279 <p data-abc-def_hij="">Quuz</p>
21280 !! html/php
21281 <p><span data-foo="bar">Baz</span>
21282 </p>
21283 <p data-abc-def_hij="">Quuz</p>
21284
21285 !! html/parsoid
21286 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
21287 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
21288 !! end
21289
21290 !! test
21291 Strip reserved data attributes
21292 !! wikitext
21293 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
21294 !! html/php
21295 <div data-ok="fred">d</div>
21296
21297 !! html/parsoid
21298 <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>
21299 !! end
21300
21301 !! test
21302 percent-encoding and + signs in internal links (Bug 26410)
21303 !! wikitext
21304 [[User:+%]] [[Page+title%]]
21305 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
21306 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
21307 [[%33%45]] [[%33%45+]]
21308 !! html/php
21309 <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>
21310 <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>
21311 <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>
21312 <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>
21313 </p>
21314 !! html/parsoid
21315 <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>
21316 <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>
21317 <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>
21318 <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>
21319 !! end
21320
21321 !! test
21322 Special characters in embedded file links (bug 27679)
21323 !! wikitext
21324 [[File:Contains & ampersand.jpg]]
21325 [[File:Does not exist.jpg|Title with & ampersand]]
21326 !! html/php
21327 <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>
21328 <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>
21329 </p>
21330 !! html/parsoid
21331 <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>
21332 <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>
21333 !! end
21334
21335 !! test
21336 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
21337 !! wikitext
21338 Text&apos;s been normalized?
21339 !! html
21340 <p>Text&#39;s been normalized?
21341 </p>
21342 !! end
21343
21344 !! test
21345 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
21346 !! wikitext
21347 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
21348 !! html
21349 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
21350 </p>
21351 !! end
21352
21353 !! test
21354 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
21355 !! wikitext
21356 [http://www.example.org/ ideograms]
21357 !! html
21358 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
21359 </p>
21360 !! end
21361
21362 !! test
21363 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
21364 !! wikitext
21365 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
21366 !! html
21367 <p><img src="http://www.example.org/pic.png" alt="pic.png"/> &lt;-- U+3000 (vim: ^Vu3000)
21368 </p>
21369 !! end
21370
21371 !! article
21372 Mediawiki:loop1
21373 !! text
21374 {{Identical|A}}
21375 !! endarticle
21376
21377 !! article
21378 Mediawiki:loop2
21379 !! text
21380 {{Identical|B}}
21381 !! endarticle
21382
21383 !! article
21384 Template:Identical
21385 !! text
21386 {{int:loop1}}
21387 {{int:loop2}}
21388 !! endarticle
21389
21390 !! test
21391 Bug 31098 Template which includes system messages which includes the template
21392 !! wikitext
21393 {{Identical}}
21394 !! html
21395 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
21396 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
21397 </p>
21398 !! end
21399
21400 !! test
21401 Bug31490 Turkish: ucfirst 'blah'
21402 !! options
21403 language=tr
21404 !! wikitext
21405 {{ucfirst:blah}}
21406 !! html
21407 <p>Blah
21408 </p>
21409 !! end
21410
21411 !! test
21412 Bug31490 Turkish: ucfirst 'ix'
21413 !! options
21414 language=tr
21415 !! wikitext
21416 {{ucfirst:ix}}
21417 !! html
21418 <p>İx
21419 </p>
21420 !! end
21421
21422 !! test
21423 Bug31490 Turkish: lcfirst 'BLAH'
21424 !! options
21425 language=tr
21426 !! wikitext
21427 {{lcfirst:BLAH}}
21428 !! html
21429 <p>bLAH
21430 </p>
21431 !! end
21432
21433 !! test
21434 Bug31490 Turkish: ucfırst (with a dotless i)
21435 !! options
21436 language=tr
21437 !! wikitext
21438 {{ucfırst:blah}}
21439 !! html
21440 <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>
21441 </p>
21442 !! end
21443
21444 !! test
21445 Bug31490 ucfırst (with a dotless i) with English language
21446 !! options
21447 language=en
21448 !! wikitext
21449 {{ucfırst:blah}}
21450 !! html
21451 <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>
21452 </p>
21453 !! end
21454
21455 !! test
21456 Bug 26375: TOC with italics
21457 !! options
21458 title=[[Main Page]]
21459 !! wikitext
21460 __TOC__
21461 == ''Lost'' episodes ==
21462 !! html
21463 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21464 <ul>
21465 <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>
21466 </ul>
21467 </div>
21468
21469 <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>
21470
21471 !! end
21472
21473 !! test
21474 Bug 26375: TOC with bold
21475 !! options
21476 title=[[Main Page]]
21477 !! wikitext
21478 __TOC__
21479 == '''should be bold''' then normal text ==
21480 !! html
21481 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21482 <ul>
21483 <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>
21484 </ul>
21485 </div>
21486
21487 <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>
21488
21489 !! end
21490
21491 !! test
21492 Bug 33845: Headings become cursive in TOC when they contain an image
21493 !! options
21494 title=[[Main Page]]
21495 !! wikitext
21496 __TOC__
21497 == Image [[Image:foobar.jpg]] ==
21498 !! html
21499 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21500 <ul>
21501 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
21502 </ul>
21503 </div>
21504
21505 <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>
21506
21507 !! end
21508
21509 !! test
21510 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
21511 !! options
21512 title=[[Main Page]]
21513 !! wikitext
21514 __TOC__
21515 == <blockquote>Quote</blockquote> ==
21516 !! html
21517 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21518 <ul>
21519 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
21520 </ul>
21521 </div>
21522
21523 <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>
21524
21525 !! html+tidy
21526 <p></p>
21527 <div id="toc" class="toc">
21528 <div id="toctitle">
21529 <h2>Contents</h2>
21530 </div>
21531 <ul>
21532 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
21533 </ul>
21534 </div>
21535 <p></p>
21536 <h2><span class="mw-headline" id="Quote"></span></h2>
21537 <blockquote>
21538 <p><span class="mw-headline" id="Quote">Quote</span></p>
21539 </blockquote>
21540 <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>
21541 !! end
21542
21543 !! test
21544 Unclosed tags in TOC
21545 !! options
21546 title=[[Main Page]]
21547 !! wikitext
21548 __TOC__
21549 == Proof: 2 < 3 ==
21550 <small>Hanc marginis exiguitas non caperet.</small>
21551 QED
21552 !! html
21553 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21554 <ul>
21555 <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>
21556 </ul>
21557 </div>
21558
21559 <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>
21560 <p><small>Hanc marginis exiguitas non caperet.</small>
21561 QED
21562 </p>
21563 !! end
21564
21565 !! test
21566 Multiple tags in TOC
21567 !! wikitext
21568 __TOC__
21569 == <i>Foo</i> <b>Bar</b> ==
21570
21571 == <i>Foo</i> <blockquote>Bar</blockquote> ==
21572 !! html
21573 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21574 <ul>
21575 <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>
21576 <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>
21577 </ul>
21578 </div>
21579
21580 <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>
21581 <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>
21582
21583 !! html+tidy
21584 <p></p>
21585 <div id="toc" class="toc">
21586 <div id="toctitle">
21587 <h2>Contents</h2>
21588 </div>
21589 <ul>
21590 <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>
21591 <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>
21592 </ul>
21593 </div>
21594 <p></p>
21595 <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>
21596 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
21597 <blockquote>
21598 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
21599 </blockquote>
21600 <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>
21601 !! end
21602
21603 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
21604 # html5 tag parsing.
21605 !! test
21606 Tags with parameters in TOC
21607 !! options
21608 parsoid=wt2html
21609 !! wikitext
21610 __TOC__
21611 == <sup class="in-h2">Hello</sup> ==
21612
21613 == <sup class="a > b">Evilbye</sup> ==
21614 !! html/php
21615 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21616 <ul>
21617 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
21618 <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>
21619 </ul>
21620 </div>
21621
21622 <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>
21623 <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>
21624
21625 !! html/parsoid
21626 <meta property="mw:PageProp/toc" />
21627 <h2> <sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup> </h2>
21628
21629 <h2> <sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup> </h2>
21630 !! end
21631
21632 !! test
21633 span tags with directionality in TOC
21634 !! wikitext
21635 __TOC__
21636 == <span dir="ltr">C++</span> ==
21637
21638 == <span dir="rtl">זבנג!</span> ==
21639
21640 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
21641
21642 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
21643
21644 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
21645 !! html
21646 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21647 <ul>
21648 <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>
21649 <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>
21650 <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>
21651 <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>
21652 <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>
21653 </ul>
21654 </div>
21655
21656 <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>
21657 <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>
21658 <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>
21659 <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>
21660 <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>
21661
21662 !! end
21663
21664 !! test
21665 Bug 72884: bdi element in ToC
21666 !! wikitext
21667 __TOC__
21668 == <bdi>test</bdi> ==
21669 !! html
21670 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21671 <ul>
21672 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
21673 </ul>
21674 </div>
21675
21676 <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>
21677
21678 !! end
21679
21680 !! test
21681 T35715: s/strike element in ToC
21682 !! wikitext
21683 __TOC__
21684 == <s>test</s> test <strike>test</strike> ==
21685 !! html
21686 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21687 <ul>
21688 <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>
21689 </ul>
21690 </div>
21691
21692 <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>
21693
21694 !! end
21695
21696 # Note that the html output does not have the <p></p>, but the
21697 # html+tidy output *does*. This is because the empty <p></p> is
21698 # removed by the sanitizer, but only when tidy is *not* enabled (!).
21699 !! test
21700 Empty <p> tag in TOC, removed by Sanitizer (T92892)
21701 !! wikitext
21702 __TOC__
21703 == x ==
21704 !! html
21705 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21706 <ul>
21707 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
21708 </ul>
21709 </div>
21710
21711 <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>
21712
21713 !! html+tidy
21714 <p></p>
21715 <div id="toc" class="toc">
21716 <div id="toctitle">
21717 <h2>Contents</h2>
21718 </div>
21719 <ul>
21720 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
21721 </ul>
21722 </div>
21723 <p></p>
21724 <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>
21725 !! end
21726
21727 !! article
21728 MediaWiki:Bug32057
21729 !! text
21730 == {{int:headline_sample}} ==
21731 !! endarticle
21732
21733 !! test
21734 Bug 32057: Title needed when expanding <h> nodes.
21735 !! options
21736 title=[[Main Page]]
21737 !! wikitext
21738 {{int:Bug32057}}
21739 !! html
21740 <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>
21741
21742 !! end
21743
21744 !! test
21745 Strip marker in urlencode
21746 !! wikitext
21747 {{urlencode:x<nowiki/>y}}
21748 {{urlencode:x<nowiki/>y|wiki}}
21749 {{urlencode:x<nowiki/>y|path}}
21750 {{urlencode:x<pre id="one">two</pre>y}}
21751 !! html
21752 <p>xy
21753 xy
21754 xy
21755 xy
21756 </p>
21757 !! end
21758
21759 !! test
21760 Strip marker in lc
21761 !! wikitext
21762 {{lc:x<nowiki/>y}}
21763 !! html
21764 <p>xy
21765 </p>
21766 !! end
21767
21768 !! test
21769 Strip marker in uc
21770 !! wikitext
21771 {{uc:x<nowiki/>y}}
21772 !! html
21773 <p>XY
21774 </p>
21775 !! end
21776
21777 !! test
21778 Strip marker in formatNum
21779 !! wikitext
21780 {{formatnum:1<nowiki/>2}}
21781 {{formatnum:1<nowiki/>2|R}}
21782 !! html
21783 <p>12
21784 12
21785 </p>
21786 !! end
21787
21788 !! test
21789 Check noCommafy in formatNum
21790 !! options
21791 language=be-tarask
21792 !! wikitext
21793 {{formatnum:123456.78}}
21794 {{formatnum:123456.78|NOSEP}}
21795 !! html
21796 <p>123 456,78
21797 123456.78
21798 </p>
21799 !! end
21800
21801 !! test
21802 Wrong option for formatNum (bug 56199)
21803 !! wikitext
21804 {{formatnum:1,234.56|Random}}
21805 {{formatnum:1,234.56|EVERYTHING}}
21806 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
21807 !! html
21808 <p>1,234.56
21809 1,234.56
21810 1,234.56
21811 </p>
21812 !! end
21813
21814 !! test
21815 Strip marker in grammar
21816 !! options
21817 language=fi
21818 !! wikitext
21819 {{grammar:elative|foo<nowiki/>bar}}
21820 !! html
21821 <p>foobarista
21822 </p>
21823 !! end
21824
21825 !! test
21826 Strip marker in padleft
21827 !! wikitext
21828 {{padleft:|2|x<nowiki/>y}}
21829 !! html
21830 <p>xy
21831 </p>
21832 !! end
21833
21834 !! test
21835 Strip marker in padright
21836 !! wikitext
21837 {{padright:|2|x<nowiki/>y}}
21838 !! html
21839 <p>xy
21840 </p>
21841 !! end
21842
21843 !! test
21844 Strip marker in anchorencode
21845 !! wikitext
21846 {{anchorencode:x<nowiki/>y}}
21847 !! html
21848 <p>xy
21849 </p>
21850 !! end
21851
21852 !! test
21853 nowiki inside link inside heading (bug 18295)
21854 !! wikitext
21855 ==[[foo|x<nowiki>y</nowiki>z]]==
21856 !! html
21857 <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>
21858
21859 !! end
21860
21861 !! test
21862 new support for bdi element (bug 31817)
21863 !! wikitext
21864 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
21865 !! html
21866 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
21867
21868 !!end
21869
21870 !! test
21871 Ignore pipe between table row attributes
21872 !! wikitext
21873 {|
21874 | quux
21875 |- id=foo | style='color: red'
21876 | bar
21877 |}
21878 !! html
21879 <table>
21880 <tr>
21881 <td> quux
21882 </td></tr>
21883 <tr id="foo" style="color: red">
21884 <td> bar
21885 </td></tr></table>
21886
21887 !! end
21888
21889 !!test
21890 Gallery override link with WikiLink (bug 34852)
21891 !! wikitext
21892 <gallery>
21893 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
21894 </gallery>
21895 !! html
21896 <ul class="gallery mw-gallery-traditional">
21897 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21898 <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>
21899 <div class="gallerytext">
21900 <p>caption
21901 </p>
21902 </div>
21903 </div></li>
21904 </ul>
21905
21906 !! end
21907
21908 !!test
21909 Gallery override link with absolute external link (bug 34852)
21910 !! wikitext
21911 <gallery>
21912 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
21913 </gallery>
21914 !! html
21915 <ul class="gallery mw-gallery-traditional">
21916 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21917 <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>
21918 <div class="gallerytext">
21919 <p>caption
21920 </p>
21921 </div>
21922 </div></li>
21923 </ul>
21924
21925 !! end
21926
21927 !!test
21928 Gallery override link with malicious javascript (bug 34852)
21929 !! wikitext
21930 <gallery>
21931 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
21932 </gallery>
21933 !! html
21934 <ul class="gallery mw-gallery-traditional">
21935 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21936 <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>
21937 <div class="gallerytext">
21938 <p>caption
21939 </p>
21940 </div>
21941 </div></li>
21942 </ul>
21943
21944 !! end
21945
21946 !!test
21947 Gallery with invalid title as link (bug 43964)
21948 !! wikitext
21949 <gallery>
21950 File:foobar.jpg|link=<
21951 </gallery>
21952 !! html
21953 <ul class="gallery mw-gallery-traditional">
21954 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21955 <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>
21956 <div class="gallerytext">
21957 </div>
21958 </div></li>
21959 </ul>
21960
21961 !! end
21962
21963 !!test
21964 Language parser function
21965 !! wikitext
21966 {{#language:ar}}
21967 !! html
21968 <p>العربية
21969 </p>
21970 !! end
21971
21972 !!test
21973 Padleft and padright as substr
21974 !! wikitext
21975 {{padleft:|3|abcde}}
21976 {{padright:|3|abcde}}
21977 !! html
21978 <p>abc
21979 abc
21980 </p>
21981 !! end
21982
21983 !!test
21984 Special parser function
21985 !! wikitext
21986 {{#special:RandomPage}}
21987 {{#special:BaDtItLe}}
21988 {{#special:Foobar}}
21989 !! html
21990 <p>Special:Random
21991 Special:Badtitle
21992 Special:Foobar
21993 </p>
21994 !! end
21995
21996 !!test
21997 Bug 34939 - Case insensitive link parsing ([HttP://])
21998 !! wikitext
21999 [HttP://MediaWiki.Org/]
22000 !! html/php
22001 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
22002 </p>
22003 !! html/parsoid
22004 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
22005 !! end
22006
22007 !!test
22008 Bug 34939 - Case insensitive link parsing ([HttP:// title])
22009 !! wikitext
22010 [HttP://MediaWiki.Org/ MediaWiki]
22011 !! html
22012 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
22013 </p>
22014 !! end
22015
22016 !!test
22017 Bug 34939 - Case insensitive link parsing (HttP://)
22018 !! wikitext
22019 HttP://MediaWiki.Org/
22020 !! html/php
22021 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
22022 </p>
22023 !! html/parsoid
22024 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
22025 !! end
22026
22027 !!test
22028 Disable TOC
22029 !! options
22030 notoc
22031 !! wikitext
22032 Lead
22033 == Section 1 ==
22034 == Section 2 ==
22035 == Section 3 ==
22036 == Section 4 ==
22037 == Section 5 ==
22038 !! html
22039 <p>Lead
22040 </p>
22041
22042 <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>
22043 <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>
22044 <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>
22045 <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>
22046 <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>
22047
22048 !! end
22049
22050
22051 ###
22052 ### Parsoid-specific tests
22053 ### Parsoid-PHP parser incompatibilities
22054 ###
22055 !!test
22056 1. SOL-sensitive wikitext tokens as template-args
22057 !!options
22058 parsoid=wt2html,wt2wt
22059 !! wikitext
22060 {{echo|*a}}
22061 {{echo|#a}}
22062 {{echo|:a}}
22063 !! html
22064 <span about="#mwt1" typeof="mw:Transclusion">
22065 </span><ul about="#mwt1"><li>a</li>
22066 </ul>
22067 <span about="#mwt2" typeof="mw:Transclusion">
22068 </span><ol about="#mwt2"><li>a</li>
22069 </ol>
22070 <span about="#mwt3" typeof="mw:Transclusion">
22071 </span><dl about="#mwt3"><dd>a</dd>
22072 </dl>
22073 !!end
22074
22075 #### -----------------------------------------------------------------
22076 #### Parsoid-specific functionality tests
22077 #### -----------------------------------------------------------------
22078
22079 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
22080 # We know wt2wt will fail, but we expect selser to pass.
22081 # Due to the nature of our testing, wt2wt and selser tests will enter the
22082 # blacklist and we'll catch selser regressions based on changes to the
22083 # blacklist entries for selser tests.
22084 !! test
22085 1. Bad treebuilder fixup of formatting elt is cleaned up
22086 !! options
22087 parsoid=wt2html,wt2wt
22088 !! wikitext
22089 {|
22090 |
22091 <small>
22092 [[Image:Foobar.jpg|right|Test]]
22093 </small>
22094 |}
22095 !! html/parsoid
22096 <table>
22097 <tbody><tr><td>
22098 <small>
22099 <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>
22100 </small>
22101 </td></tr>
22102 </tbody></table>
22103 !! end
22104
22105 !! test
22106 2. Bad treebuilder fixup of formatting elt is cleaned up
22107 !! options
22108 parsoid=wt2html,wt2wt
22109 !! wikitext
22110 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
22111
22112 <small>[[Image:Foobar.jpg|right|300px]]</small>
22113 !! html/parsoid
22114
22115 <p><b>foo</b></p>
22116 <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>
22117 <p><b>bar</b></p>
22118 <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>
22119 !! end
22120
22121 !! test
22122 3. Bad treebuilder fixup of formatting elt is cleaned up
22123 !! options
22124 parsoid=wt2html,wt2wt
22125 !! wikitext
22126 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
22127 !! html/parsoid
22128 <p><small><b>foo</b></small></p>
22129 <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>
22130 <p><small><b>bar</b></small></p>
22131 !! end
22132
22133 !! test
22134 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
22135 !! options
22136 parsoid=wt2html,wt2wt
22137 !! wikitext
22138 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
22139 !! html/parsoid
22140 <p><b><small></small></b></p>
22141 <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>
22142 <p></p>
22143 !! end
22144
22145 #### ----------------------------------------------------------------
22146 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
22147 #### tags. Parsoid's output for these tags differs from that of the
22148 #### PHP parser.
22149 #### ----------------------------------------------------------------
22150
22151 !!test
22152 Ref: 1. ref-location should be replaced with an index span
22153 !! wikitext
22154 A <ref>foo</ref>
22155 B <ref name="x">foo</ref>
22156 C <ref name="y" />
22157 <references />
22158 !! html/parsoid
22159 <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>
22160 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>
22161 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>
22162 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22163 <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>
22164 <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>
22165 <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>
22166 </ol>
22167 !!end
22168
22169 !!test
22170 Ref: 2. ref-tags with identical names should all get the same index
22171 !! wikitext
22172 A <ref name="x">foo</ref>
22173 B <ref name="x" />
22174 <references />
22175 !! html/parsoid
22176 <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>
22177 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>
22178 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22179 <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>
22180 </ol>
22181 !!end
22182
22183 !!test
22184 Ref: 3. spaces in ref-names should be ignored
22185 !! wikitext
22186 A <ref name="x">foo</ref>
22187 B <ref name=" x " />
22188 C <ref name= x />
22189 <references />
22190 !! html/parsoid
22191 <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>
22192 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>
22193 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>
22194 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22195 <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>
22196 </ol>
22197 !!end
22198
22199 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
22200 !!test
22201 Ref: 4. 'constructor' should be accepted as a valid ref-name
22202 !! wikitext
22203 A <ref name="constructor">foo</ref>
22204 <references />
22205 !! html/parsoid
22206 <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>
22207 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22208 <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>
22209 </ol>
22210 !!end
22211
22212 !!test
22213 Ref: 5. body should accept generic wikitext
22214 !! wikitext
22215 A <ref>
22216 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
22217 </ref>
22218
22219 <references />
22220 !! html/parsoid
22221 <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>
22222
22223 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
22224 <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>
22225 </span></li>
22226 </ol>
22227 !!end
22228
22229 !!test
22230 Ref: 6. indent-pres should not be output in ref-body
22231 !! wikitext
22232 A <ref>
22233 foo
22234 bar
22235 baz
22236 </ref>
22237
22238 <references />
22239 !! html/parsoid
22240 <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>
22241
22242 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22243 <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
22244 bar
22245 baz
22246 </span></li>
22247 </ol>
22248 !!end
22249
22250 !!test
22251 Ref: 7. No p-wrapping in ref-body
22252 !! wikitext
22253 A <ref>
22254 foo
22255
22256 bar
22257
22258
22259 baz
22260
22261
22262
22263 booz
22264 </ref>
22265
22266 <references />
22267 !! html/parsoid
22268 <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>
22269
22270 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22271 <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
22272
22273 bar
22274
22275
22276 baz
22277
22278
22279
22280 booz
22281 </span></li>
22282 </ol>
22283 !!end
22284
22285 !!test
22286 Ref: 8. transclusion wikitext has lower precedence
22287 !! wikitext
22288 A <ref> foo {{echo|</ref> B C}}
22289
22290 <references />
22291 !! html/parsoid
22292 <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>
22293 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22294 <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>
22295 </ol>
22296 !!end
22297
22298 !!test
22299 Ref: 9. unclosed comments should not leak out of ref-body
22300 !! wikitext
22301 A <ref> foo <!--</ref> B C
22302 <references />
22303 !! html/parsoid
22304 <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>
22305 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22306 <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>
22307 </ol>
22308 !!end
22309
22310 !!test
22311 Ref: 10. Unclosed HTML tags should not leak out of ref-body
22312 !! wikitext
22313 A <ref> <b> foo </ref> B C
22314
22315 <references />
22316 !! html/parsoid
22317 <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>
22318
22319
22320 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" 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"><b data-parsoid='{"stx":"html","autoInsertedEnd":true}'> foo </b></span></li>
22322 </ol>
22323 !!end
22324
22325 !!test
22326 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
22327 !! wikitext
22328 A <ref>foo</ref> B
22329 C <ref>bar</ref> D
22330 <references />
22331 !! html/parsoid
22332 <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
22333 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>
22334 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22335 <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>
22336 <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>
22337 </ol>
22338 !!end
22339
22340 !!test
22341 Ref: 12. ref-tags act as trailing newline migration barrier
22342 !! wikitext
22343 <!--the newline at the end of this line moves out of the p tag-->a
22344
22345 b<!--the newline at the end of this line stays inside the p tag--> <ref />
22346 <ref />
22347
22348 c
22349 <references />
22350 !! html/parsoid
22351 <!--the newline at the end of this line moves out of the p tag--><p>a</p>
22352
22353
22354 <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>
22355 <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>
22356
22357 <p>c</p>
22358 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22359 <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>
22360 <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>
22361 !!end
22362
22363 !!test
22364 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
22365 !! wikitext
22366 <ref>foo</ref> A
22367 <ref>bar
22368 </ref> B
22369 <references />
22370 !! html/parsoid
22371 <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
22372 <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>
22373 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22374 <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>
22375 <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
22376 </span></li>
22377 </ol>
22378 !!end
22379
22380 !!test
22381 Ref: 14. A nested ref-tag should be emitted as plain text
22382 !! wikitext
22383 <ref>foo <ref>bar</ref> baz</ref>
22384
22385 <references />
22386 !! html/parsoid
22387 <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>
22388 </p>
22389 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
22390 <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>
22391 </ol>
22392 !!end
22393
22394 !!test
22395 Ref: 15. ref-tags with identical names should get identical indexes
22396 !! wikitext
22397 A1 <ref name="a">foo</ref> A2 <ref name="a" />
22398 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
22399
22400 <references />
22401 !! html/parsoid
22402 <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>
22403 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>
22404
22405 <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>
22406 </ol>
22407 !!end
22408
22409 ## We don't bother wt2wt-ing non-standard whitespace
22410 !!test
22411 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
22412 !!options
22413 parsoid=wt2html
22414 !! wikitext
22415 A <ref >foo</ref >
22416
22417 <references />
22418 !! html/parsoid
22419 <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>
22420 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22421 <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>
22422 !!end
22423
22424 !!test
22425 Ref: 17. Generate valid HTML5 id/about attributes
22426 !!wikitext
22427 <ref name="a b">foo</ref>
22428
22429 <references />
22430 !!html/parsoid
22431 <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>
22432 </p>
22433
22434 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22435 <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>
22436 </ol>
22437 !!end
22438
22439 !!test
22440 Ref: 18. T58916: Extension attributes should be parsed as plain text
22441 !!wikitext
22442 <ref name="{{echo|a}}">foo</ref>
22443
22444 <references />
22445 !!html/parsoid
22446 <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>
22447 </p>
22448
22449 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22450 <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>
22451 </ol>
22452 !!end
22453
22454 !!test
22455 Ref: 19. ref-tags with identical name encodings should get identical indexes
22456 !! wikitext
22457 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
22458
22459 <references />
22460 !! html/parsoid
22461 <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>
22462 </p>
22463 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22464 <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>
22465 </ol>
22466 !!end
22467
22468 !!test
22469 Ref: 20. ref-tags with identical names but different content should keep it
22470 !! wikitext
22471 A <ref name="foo">Foo one</ref>
22472 B <ref name="foo">Foo two</ref>
22473 C <ref name="foo" />
22474
22475 <references />
22476 !! html/parsoid
22477 <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>
22478 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>
22479 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>
22480
22481 <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>
22482 </ol>
22483 !!end
22484
22485 !!test
22486 References: 1. references tag without any refs should be handled properly
22487 !! wikitext
22488 <references />
22489 !! html/parsoid
22490 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
22491 !!end
22492
22493 !!test
22494 References: 2. references tag with group only outputs references from that group
22495 !! wikitext
22496 A <ref group="a">foo</ref>
22497 B <ref group="b">bar</ref>
22498 C <ref>baz</ref>
22499
22500 <references group="a" />
22501 <references />
22502 <references group="b" />
22503 !! html/parsoid
22504 <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>
22505 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>
22506 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>
22507
22508 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="a" data-mw='{"name":"references","attrs":{"group":"a"}}'>
22509 <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>
22510 </ol>
22511 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'>
22512 <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>
22513 </ol>
22514 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt12" data-mw-group="b" data-mw='{"name":"references","attrs":{"group":"b"}}'>
22515 <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>
22516 </ol>
22517 !!end
22518
22519 !!test
22520 References: 3. ref list should be cleared after processing references
22521 !! wikitext
22522 A <ref>foo</ref>
22523
22524 <references />
22525
22526 B <ref>bar</ref>
22527
22528 <references />
22529 !! html/parsoid
22530 <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>
22531
22532 <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>
22533 </ol>
22534
22535 <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>
22536
22537 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22538 <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>
22539 </ol>
22540 !!end
22541
22542 !!test
22543 References: 4. only referenced group should be cleared after processing references
22544 !! wikitext
22545 A <ref group="a">afoo</ref>
22546 B <ref>bfoo</ref>
22547
22548 <references group="a" />
22549
22550 C <ref>cfoo</ref>
22551
22552 <references />
22553 !! html/parsoid
22554 <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>
22555 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>
22556
22557 <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>
22558 </ol>
22559
22560 <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>
22561
22562 <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>
22563 </ol>
22564 !!end
22565
22566 ## Don't expect this to rt since we're dropping content
22567 !! test
22568 References: 5. ref tags in references should be processed while ignoring all other content
22569 !! options
22570 parsoid=wt2html,html2html
22571 !! wikitext
22572 A <ref name="a" />
22573 B <ref name="b">bar</ref>
22574
22575 <references>
22576 <ref name="a">foo</ref>
22577 This should just get lost.
22578 </references>
22579 !! html/parsoid
22580 <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>
22581 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>
22582
22583
22584 <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>
22585 </ol>
22586 !! end
22587
22588 !! test
22589 References: 6. <references /> from a transclusion
22590 !! wikitext
22591 <ref>Foo</ref> {{echo|<references />}}
22592 !! html/parsoid
22593 <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>
22594 </ol>
22595 !! end
22596
22597 !! test
22598 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
22599 !! wikitext
22600 A <ref>foo bar for a</ref>
22601 B <ref group="X" name="b" />
22602
22603 <references />
22604
22605 <references group="X">
22606 <ref name="b">foo</ref>
22607 </references>
22608 !! html/parsoid
22609 <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>
22610 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>
22611 </p>
22612
22613 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22614 <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>
22615 </ol>
22616
22617 <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"}}'>
22618 <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>
22619 </ol>
22620 !! end
22621
22622 !! test
22623 References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
22624 !! wikitext
22625 X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
22626 <references />
22627 !! html/parsoid
22628 <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>
22629 <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>
22630 </ol>
22631 !!end
22632
22633 # This test only works in wt2html now as the <references /> are always generated
22634 # unless selser is active. Once T72722 is fixed, we should add a changes test
22635 # here to ensure that unrelated changes don't add the new <references />
22636 # when selser is active.
22637 !! test
22638 References: 9. Generate missing references list at the end
22639 !! wikitext
22640 A <ref>foo</ref>
22641 B <ref group="inexistent">bar</ref>
22642 !! html/parsoid
22643 <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>
22644 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{},"autoGenerated":true}'>
22645 <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>
22646 </ol>
22647 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="inexistent" data-mw='{"name":"references","attrs":{"group":"inexistent"},"autoGenerated":true}'>
22648 <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>
22649 </ol>
22650 !! end
22651
22652 !! test
22653 References: 10. New <references/> shouldn't be added for unrelated edits.
22654 !! options
22655 parsoid={
22656 "modes": ["selser"],
22657 "changes": [["#x", "remove"]],
22658 "selser": "noauto"
22659 }
22660 !! wikitext
22661 Unrelated text<span id="x"> that's going to disappear</span>.
22662 A <ref>foo</ref>
22663 !! wikitext/edited
22664 Unrelated text.
22665 A <ref>foo</ref>
22666 !!end
22667
22668 !! test
22669 Entities in ref name
22670 !! wikitext
22671 <ref name="test &amp; me">hi</ref>
22672 <references />
22673 !! html/parsoid
22674 <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>
22675 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22676 <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>
22677 </ol>
22678 !! end
22679
22680 ## The output here may look funny, but it's what the php parser will do. The
22681 ## unclosed references tag becomes escaped text, and then a new references
22682 ## tag is auto-generated. The test is wt2html only because it roundtrips with
22683 ## nowiki tags, and the auto-generated references tag is only dropped in
22684 ## rtTestMode.
22685 !! test
22686 Generate references for unclosed references tag
22687 !! options
22688 parsoid=wt2html
22689 !! wikitext
22690 a<ref>foo</ref>
22691
22692 <references>
22693 !! html/parsoid
22694 <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>
22695
22696 <p>&lt;references></p>
22697 <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>
22698 !! end
22699
22700 !! test
22701 New reference serializes on its own line
22702 !! options
22703 parsoid=wt2wt,html2wt
22704 !! wikitext
22705 foo
22706 <references />
22707 !! html/parsoid
22708 foo<ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
22709 !! end
22710
22711 #### ----------------------------------------------------------------
22712 #### Parsoid-only testing of Parsoid's impl of LST
22713 #### Not implemented yet, see
22714 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
22715 #### ----------------------------------------------------------------
22716
22717 !! test
22718 LST Sections: 1. Simple section start and end
22719 !! options
22720 parsoid={ "suppressErrors": true }
22721 !! wikitext
22722 <section begin="2011-05-16" />
22723 <section end="2014-04-10 (MW 1.23wmf22)" />
22724 !! html/parsoid
22725 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
22726 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
22727 !! end
22728
22729 #--------- Test stripping of empty nodes in template content ----------
22730 !!test
22731 Empty LI and TR nodes should be stripped from template content
22732 !!wikitext
22733 {{EmptyLITest}}
22734 {{EmptyTRTest}}
22735 !!html/parsoid
22736 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
22737 <li>a</li>
22738 <li>b</li>
22739 </ul>
22740 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
22741 <tbody>
22742 <tr>
22743 <td>foo</td>
22744 </tr>
22745 <tr>
22746 <td>bar</td>
22747 </tr>
22748 </tbody>
22749 </table>
22750 !!end
22751
22752 !!test
22753 Empty LI and TR nodes should not be stripped from top-level content
22754 !!wikitext
22755 * a
22756 *
22757 * b
22758 {|
22759 |-
22760 |-
22761 |foo
22762 |}
22763 !!html/parsoid
22764 <ul>
22765 <li> a</li>
22766 <li></li>
22767 <li> b</li>
22768 </ul>
22769 <table>
22770 <tbody>
22771 <tr></tr>
22772 <tr>
22773 <td>foo</td>
22774 </tr>
22775 </tbody>
22776 </table>
22777 !!end
22778
22779 !!test
22780 Empty TR nodes should not be stripped if they have any attributes set
22781 !!wikitext
22782 {{EmptyTRWithHTMLAttrTest}}
22783 !!html/parsoid
22784 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
22785 <tr align="center"></tr>
22786 <tr><td>foo</td></tr>
22787 <tr align="center"></tr>
22788 <tr><td>bar</td></tr>
22789 </table>
22790 !!end
22791
22792 #### ----------------------------------------------------------------
22793 #### The following section of tests are primarily to test
22794 #### wikitext escaping capabilities of Parsoid. Given that
22795 #### escaping can be done any number of ways, the wikitext (input)
22796 #### is always adjusted to reflect how Parsoid adds nowiki
22797 #### escape tags.
22798 ####
22799 #### We are marking several tests as parsoid-only since the
22800 #### HTML in the result section is different from what the
22801 #### PHP parser generates for it.
22802 #### ----------------------------------------------------------------
22803
22804
22805 #### --------------- Headings ---------------
22806 #### 0. Unnested
22807 #### 1. Nested inside html <h1>=foo=</h1>
22808 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
22809 #### 3. Nested inside html with wikitext split by html tags
22810 #### 4. No escape needed
22811 #### 5. Empty headings <h1></h1>
22812 #### 6. Heading chars in SOL context
22813 #### ----------------------------------------
22814 !! test
22815 Headings: 0. Unnested
22816 !! options
22817 parsoid=html2wt
22818 !! html/parsoid
22819 <p>=foo=</p>
22820
22821 <p> =foo=
22822 <!--cmt-->
22823 =foo=</p>
22824
22825 <p>=foo<i>a</i>=</p>
22826 !! wikitext
22827 <nowiki>=foo=</nowiki>
22828
22829 <nowiki> </nowiki>=foo=
22830 <!--cmt-->
22831 <nowiki>=foo=</nowiki>
22832
22833 =foo''a''<nowiki>=</nowiki>
22834 !!end
22835
22836 # New headings and existing headings are handled differently
22837 !! test
22838 Headings: 1. Nested inside html
22839 !! options
22840 parsoid=html2wt
22841 !! html/parsoid
22842 <h1>=foo=</h1>
22843 <h2>=foo=</h2>
22844 <h3>=foo=</h3>
22845
22846 <h1 data-parsoid=''>=foo=</h1>
22847 <h2 data-parsoid=''>=foo=</h2>
22848 <h3 data-parsoid=''>=foo=</h3>
22849 <h4 data-parsoid=''>=foo=</h4>
22850 <h5 data-parsoid=''>=foo=</h5>
22851 <h6 data-parsoid=''>=foo=</h6>
22852 !! wikitext
22853 = =foo= =
22854
22855 == =foo= ==
22856
22857 === =foo= ===
22858
22859 =<nowiki>=foo=</nowiki>=
22860 ==<nowiki>=foo=</nowiki>==
22861 ===<nowiki>=foo=</nowiki>===
22862 ====<nowiki>=foo=</nowiki>====
22863 =====<nowiki>=foo=</nowiki>=====
22864 ======<nowiki>=foo=</nowiki>======
22865
22866 !!end
22867
22868 !! test
22869 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
22870 !! options
22871 parsoid=html2wt
22872 !! html/parsoid
22873 <h1>foo</h1>*bar
22874 <h1>foo</h1>=bar
22875 <h1>foo</h1>=bar=
22876 !! wikitext
22877 = foo =
22878 <nowiki>*</nowiki>bar
22879
22880 = foo =
22881 =bar
22882
22883 = foo =
22884 <nowiki>=bar=</nowiki>
22885 !!end
22886
22887 !! test
22888 Headings: 3. Nested inside html with wikitext split by html tags
22889 !! options
22890 parsoid=html2wt
22891 !! html/parsoid
22892 <h1>=<b>bold</b>foo=</h1>
22893 !! wikitext
22894 = ='''bold'''foo= =
22895 !!end
22896
22897 !! test
22898 Headings: 4a. No escaping needed (testing just h1 and h2)
22899 !! options
22900 parsoid=html2wt
22901 !! html/parsoid
22902 <h1>=foo</h1>
22903 <h1>foo=</h1>
22904 <h1> =foo= </h1>
22905 <h1>=foo= bar</h1>
22906 <h2>=foo</h2>
22907 <h2>foo=</h2>
22908 <h1>=</h1>
22909 <h1><i>=</i>foo=</h1>
22910 !! wikitext
22911 = =foo =
22912
22913 = foo= =
22914
22915 = =foo= =
22916
22917 = =foo= bar =
22918
22919 == =foo ==
22920
22921 == foo= ==
22922
22923 = = =
22924
22925 = ''=''foo= =
22926 !!end
22927
22928 !! test
22929 Headings: 4b. No escaping needed (inside p-tags)
22930 !! options
22931 parsoid=html2wt
22932 !! html/parsoid
22933 <p>===
22934 =foo= x
22935 =foo= <s></s>
22936 </p>
22937 !! wikitext
22938 ===
22939 =foo= x
22940 =foo= <s></s>
22941 !!end
22942
22943 !! test
22944 Headings: 5. Empty headings
22945 !! options
22946 parsoid=html2wt
22947 !! html/parsoid
22948 <h1 data-parsoid='{}'></h1>
22949
22950 <h2 data-parsoid='{}'></h2>
22951
22952 <h3 data-parsoid='{}'></h3>
22953
22954 <h4 data-parsoid='{}'></h4>
22955
22956 <h5 data-parsoid='{}'></h5>
22957
22958 <h6 data-parsoid='{}'></h6>
22959 !! wikitext
22960 =<nowiki/>=
22961
22962 ==<nowiki/>==
22963
22964 ===<nowiki/>===
22965
22966 ====<nowiki/>====
22967
22968 =====<nowiki/>=====
22969
22970 ======<nowiki/>======
22971 !!end
22972
22973 !! test
22974 Headings: 6a. Heading chars in SOL context (with trailing spaces)
22975 !! options
22976 parsoid=html2wt
22977 !! html/parsoid
22978 <p>=a=</p>
22979
22980 <p>=a=</p>
22981
22982 <p>=a=</p>
22983 !! wikitext
22984 <nowiki>=a=</nowiki>
22985
22986 <nowiki>=a=</nowiki>
22987
22988 <nowiki>=a=</nowiki>
22989 !!end
22990
22991 !! test
22992 Headings: 6b. Heading chars in SOL context (with trailing newlines)
22993 !! options
22994 parsoid=html2wt
22995 !! html/parsoid
22996 <p>=a=
22997 b</p>
22998
22999 <p>=a=
23000 b</p>
23001
23002 <p>=a=
23003 b</p>
23004 !! wikitext
23005 <nowiki>=a=</nowiki>
23006 b
23007
23008 <nowiki>=a=</nowiki>
23009 b
23010
23011 <nowiki>=a=</nowiki>
23012 b
23013 !!end
23014
23015 !! test
23016 Headings: 6c. Heading chars in SOL context (leading newline break)
23017 !! options
23018 parsoid=html2wt
23019 !! html/parsoid
23020 <p>a
23021 =b=</p>
23022 !! wikitext
23023 a
23024 <nowiki>=b=</nowiki>
23025 !!end
23026
23027 !! test
23028 Headings: 6d. Heading chars in SOL context (with interspersed comments)
23029 !! options
23030 parsoid=html2wt
23031 !! html/parsoid
23032 <!--c0--><p>=a=</p>
23033
23034 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
23035 !! wikitext
23036 <!--c0--><nowiki>=a=</nowiki>
23037
23038 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
23039 !!end
23040
23041 !! test
23042 Headings: 6d. Heading chars in SOL context (No escaping needed)
23043 !! options
23044 parsoid=html2wt
23045 !! html/parsoid
23046 =a=<div>b</div>
23047 !! wikitext
23048 =a=<div>b</div>
23049 !!end
23050
23051 !! test
23052 Headings: 7. Insert a newline between new content and headings
23053 !! options
23054 parsoid=html2wt
23055 !! html/parsoid
23056 <h2>NEW</h2>
23057 <p>new</p>
23058 <h2 data-parsoid='{}'>A</h2>
23059 <p data-parsoid='{}'>a</p>
23060 !! wikitext
23061 == NEW ==
23062 new
23063
23064 ==A==
23065 a
23066
23067 !! end
23068
23069 #### --------------- Lists ---------------
23070 #### 0. Outside nests (*foo, etc.)
23071 #### 1. Nested inside html <ul><li>*foo</li></ul>
23072 #### 2. Inside definition lists
23073 #### 3. Only bullets at start should be escaped
23074 #### 4. No escapes needed
23075 #### 5. No unnecessary escapes
23076 #### 6. Escape bullets in SOL position
23077 #### 7. Escape bullets in a multi-line context
23078 #### ----------------------------------------
23079
23080 !! test
23081 Lists: 0. Outside nests
23082 !! options
23083 parsoid=html2wt
23084 !! html/parsoid
23085 <p>*foo</p>
23086
23087 <p>#foo</p>
23088
23089 <p>;Foo:bar</p>
23090 !! wikitext
23091 <nowiki>*</nowiki>foo
23092
23093 <nowiki>#</nowiki>foo
23094
23095 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
23096 !!end
23097
23098 ## Making these next 3 tests Parsoid-only since they are html2wt tests
23099 ## to test wikitext escaping, and insignificant whitespace diffs
23100 ## cause PHP parser tests to barf
23101 !! test
23102 Lists: 1. Nested inside html (No unnecessary escapes)
23103 !! options
23104 parsoid=html2wt
23105 !! html/parsoid
23106 <ul>
23107 <li>*foo</li>
23108 <li>#foo</li>
23109 <li>:foo</li>
23110 <li>;foo</li>
23111 <li data-parsoid='{}'>*foo</li>
23112 <li data-parsoid='{}'>#foo</li>
23113 <li data-parsoid='{}'>:foo</li>
23114 <li data-parsoid='{}'>;foo</li>
23115 </ul>
23116
23117 <ol>
23118 <li>*foo</li>
23119 <li>#foo</li>
23120 <li>:foo</li>
23121 <li>;foo</li>
23122 <li data-parsoid='{}'>*foo</li>
23123 <li data-parsoid='{}'>#foo</li>
23124 <li data-parsoid='{}'>:foo</li>
23125 <li data-parsoid='{}'>;foo</li>
23126 </ol>
23127 !! wikitext
23128 * *foo
23129 * #foo
23130 * :foo
23131 * ;foo
23132 *<nowiki>*foo</nowiki>
23133 *<nowiki>#foo</nowiki>
23134 *<nowiki>:foo</nowiki>
23135 *<nowiki>;foo</nowiki>
23136
23137 # *foo
23138 # #foo
23139 # :foo
23140 # ;foo
23141 #<nowiki>*foo</nowiki>
23142 #<nowiki>#foo</nowiki>
23143 #<nowiki>:foo</nowiki>
23144 #<nowiki>;foo</nowiki>
23145 !!end
23146
23147 !! test
23148 Lists: 2. Inside definition lists
23149 !! options
23150 parsoid=html2wt
23151 !! html/parsoid
23152 <dl><dt>;foo</dt></dl>
23153 <dl><dt>:foo</dt></dl>
23154 <dl><dt>:foo</dt>
23155 <dd>bar</dd></dl>
23156 <dl><dd>:foo</dd></dl>
23157 !! wikitext
23158 ; ;foo
23159
23160 ; <nowiki>:foo</nowiki>
23161
23162 ; <nowiki>:foo</nowiki>
23163 : bar
23164
23165 : :foo
23166 !!end
23167
23168 !! test
23169 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
23170 !! options
23171 parsoid=html2wt
23172 !! html/parsoid
23173 <ul>
23174 <li>*foo*bar</li>
23175 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
23176 </ul>
23177 !! wikitext
23178 * *foo*bar
23179 *<nowiki>*foo</nowiki>''it''*bar
23180 !!end
23181
23182 !! test
23183 Lists: 4. No escapes needed
23184 !! options
23185 parsoid=html2wt
23186 !! html/parsoid
23187 <ul>
23188 <li>foo*bar
23189 </li>
23190 </ul>
23191 <ul>
23192 <li><i>foo</i>*bar
23193 </li>
23194 </ul>
23195 <ul>
23196 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
23197 </li>
23198 </ul>
23199 <ul>
23200 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
23201 </li>
23202 </ul>
23203 !! wikitext
23204 *foo*bar
23205
23206 *''foo''*bar
23207
23208 *[[Foo]]: bar
23209
23210 *[[Foo]]*bar
23211 !!end
23212
23213 !! test
23214 Lists: 5. No unnecessary escapes
23215 !! options
23216 parsoid=html2wt
23217 !! html/parsoid
23218 <ul><li> bar <span>[[foo]]</span></li></ul>
23219 <ul><li> =bar <span>[[foo]]</span></li></ul>
23220 <ul><li> [[bar <span>[[foo]]</span></li></ul>
23221 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
23222 <ul><li> =bar <span>foo]]</span>=</li></ul>
23223 <ul><li> <s></s>: a</li></ul>
23224 <ul><li> <i>* foo</i></li></ul>
23225
23226 !! wikitext
23227 * bar <span><nowiki>[[foo]]</nowiki></span>
23228
23229 * =bar <span><nowiki>[[foo]]</nowiki></span>
23230
23231 * [[bar <span><nowiki>[[foo]]</nowiki></span>
23232
23233 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
23234
23235 * =bar <span>foo]]</span>=
23236
23237 * <s></s>: a
23238
23239 * ''* foo''
23240 !!end
23241
23242 !! test
23243 Lists: 6. Escape bullets in SOL position
23244 !! options
23245 parsoid=html2wt
23246 !! html/parsoid
23247 <p><!--cmt-->*foo</p>
23248 !! wikitext
23249 <!--cmt--><nowiki>*</nowiki>foo
23250 !!end
23251
23252 !! test
23253 Lists: 7. Escape bullets in a multi-line context
23254 !! options
23255 parsoid=html2wt
23256 !! html/parsoid
23257 <p>a
23258 *b
23259 </p>
23260 !! wikitext
23261 a
23262 <nowiki>*</nowiki>b
23263 !!end
23264
23265 !! test
23266 Lists: 8. Escape colons only if not present in tags
23267 !! options
23268 parsoid=html2wt
23269 !! html/parsoid
23270 <dl><dt>a:b<i>c:d</i></dt></dl>
23271 !! wikitext
23272 ; <nowiki>a:b</nowiki>''c:d''
23273 !! end
23274
23275 #### --------------- HRs ---------------
23276 #### 1. Single line
23277 #### -----------------------------------
23278
23279 !! test
23280 HRs: 1. Single line
23281 !! options
23282 parsoid=html2wt
23283 !! html/parsoid
23284 <hr />----
23285 <hr />=foo=
23286 <hr />*foo
23287 !! wikitext
23288 ----<nowiki>----</nowiki>
23289 ----=foo=
23290 ----*foo
23291 !! end
23292
23293 #### --------------- Tables ---------------
23294 #### 1a. Simple example
23295 #### 1b. No escaping needed (!foo)
23296 #### 1c. No escaping needed (|foo)
23297 #### 1d. No escaping needed (|}foo)
23298 ####
23299 #### 2a. Nested in td (<td>foo|bar</td>)
23300 #### 2b. Nested in td (<td>foo||bar</td>)
23301 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
23302 ####
23303 #### 3a. Nested in th (<th>foo!bar</th>)
23304 #### 3b. Nested in th (<th>foo!!bar</th>)
23305 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
23306 ####
23307 #### 4a. Escape -
23308 #### 4b. Escape +
23309 #### 4c. No escaping needed
23310 #### --------------------------------------
23311
23312 !! test
23313 Tables: 1a. Simple example
23314 !! options
23315 parsoid=html2wt
23316 !! html/parsoid
23317 <p>{|
23318 |}
23319 </p>
23320 !! wikitext
23321 <nowiki>{|</nowiki>
23322 |}
23323 !! end
23324
23325 !! test
23326 Tables: 1b. No escaping needed
23327 !! options
23328 parsoid=html2wt
23329 !! html/parsoid
23330 <p>!foo
23331 </p>
23332 !! wikitext
23333 !foo
23334 !! end
23335
23336 !! test
23337 Tables: 1c. No escaping needed
23338 !! options
23339 parsoid=html2wt
23340 !! html/parsoid
23341 <p>|foo
23342 </p>
23343 !! wikitext
23344 |foo
23345 !! end
23346
23347 !! test
23348 Tables: 1d. No escaping needed
23349 !! options
23350 parsoid=html2wt
23351 !! html/parsoid
23352 <p>|}foo
23353 </p>
23354 !! wikitext
23355 |}foo
23356 !! end
23357
23358 !! test
23359 Tables: 2a. Nested in td
23360 !! options
23361 parsoid=html2wt
23362 !! html/parsoid
23363 <table><tbody><tr>
23364 <td>foo|bar</td></tr>
23365 <tr><td>x<div>a|b</div></td>
23366 </tbody></table>
23367 !! wikitext
23368 {|
23369 |<nowiki>foo|bar</nowiki>
23370 |-
23371 |x<div><nowiki>a|b</nowiki></div>
23372 |}
23373 !! html/php+tidy
23374 <table>
23375 <tr>
23376 <td>foo|bar</td>
23377 </tr>
23378 <tr>
23379 <td>x
23380 <div>a|b</div>
23381 </td>
23382 </tr>
23383 </table>
23384 !! end
23385
23386 !! test
23387 Tables: 2b. Nested in td
23388 !! options
23389 parsoid=html2wt
23390 !! html/parsoid
23391 <table><tbody><tr>
23392 <td>foo||bar</td>
23393 <td>a<i>b||c</i></td>
23394 <td>a<i><div>b||c</div></i></td>
23395 </tr></tbody></table>
23396 !! wikitext
23397 {|
23398 |<nowiki>foo||bar</nowiki>
23399 |a''<nowiki>b||c</nowiki>''
23400 |a''<div><nowiki>b||c</nowiki></div>''
23401 |}
23402 !! html/php
23403 <table>
23404 <tr>
23405 <td>foo||bar
23406 </td>
23407 <td>a<i>b||c</i>
23408 </td>
23409 <td>a<i><div>b||c</div></i>
23410 </td></tr></table>
23411
23412 !! end
23413
23414 !! test
23415 Tables: 2c. Nested in td -- no escaping needed
23416 !! options
23417 parsoid=html2wt
23418 !! html/*
23419 <table>
23420 <tr>
23421 <td>foo!!bar
23422 </td></tr></table>
23423
23424 !! wikitext
23425 {|
23426 |foo!!bar
23427 |}
23428 !! end
23429
23430 !! test
23431 Tables: 3a. Nested in th
23432 !! options
23433 parsoid=html2wt
23434 !! html/*
23435 <table>
23436 <tr>
23437 <th>foo!bar
23438 </th></tr></table>
23439
23440 !! wikitext
23441 {|
23442 !foo!bar
23443 |}
23444 !! end
23445
23446 !! test
23447 Tables: 3b. Nested in th
23448 !! options
23449 parsoid=html2wt
23450 !! html/parsoid
23451 <table><tbody>
23452 <tr><th>foo!!bar</th>
23453 <th><i>foo|bar</i></th>
23454 <th><i>foo!!bar</i></th>
23455 <th><i><span>foo!!bar</span></i></th>
23456 </tr></tbody></table>
23457 !! wikitext
23458 {|
23459 !<nowiki>foo!!bar</nowiki>
23460 !''<nowiki>foo|bar</nowiki>''
23461 !''<nowiki>foo!!bar</nowiki>''
23462 !''<span><nowiki>foo!!bar</nowiki></span>''
23463 |}
23464 !! html/php
23465 <table>
23466 <tr>
23467 <th>foo!!bar
23468 </th>
23469 <th><i>foo|bar</i>
23470 </th>
23471 <th><i>foo!!bar</i>
23472 </th>
23473 <th><i><span>foo!!bar</span></i>
23474 </th></tr></table>
23475
23476 !! end
23477
23478 !! test
23479 Tables: 3c. Nested in th
23480 !! options
23481 parsoid=html2wt
23482 !! html/parsoid
23483 <table><tbody>
23484 <tr><th>foo||bar</th>
23485 <th><span typeof="mw:Nowiki">foo||bar</span></th>
23486 </tr></tbody></table>
23487 !! wikitext
23488 {|
23489 !<nowiki>foo||bar</nowiki>
23490 !<nowiki>foo||bar</nowiki>
23491 |}
23492 !! html/php
23493 <table>
23494 <tr>
23495 <th>foo||bar
23496 </th>
23497 <th>foo||bar
23498 </th></tr></table>
23499
23500 !! end
23501
23502 !! test
23503 Tables: 4a. Escape -
23504 !! options
23505 parsoid=html2wt
23506 !! html/*
23507 <table>
23508 <tr>
23509 <th>-bar
23510 </th></tr>
23511 <tr>
23512 <td>-bar
23513 </td></tr></table>
23514
23515 !! wikitext
23516 {|
23517 !-bar
23518 |-
23519 |<nowiki>-bar</nowiki>
23520 |}
23521 !! end
23522
23523 !! test
23524 Tables: 4b. Escape +
23525 !! options
23526 parsoid=html2wt
23527 !! html/*
23528 <table>
23529 <tr>
23530 <th>+bar
23531 </th></tr>
23532 <tr>
23533 <td>+bar
23534 </td></tr></table>
23535
23536 !! wikitext
23537 {|
23538 !+bar
23539 |-
23540 |<nowiki>+bar</nowiki>
23541 |}
23542 !! end
23543
23544 !! test
23545 Tables: 4c. No escaping needed
23546 !! options
23547 parsoid=html2wt
23548 !! html/parsoid
23549 <table><tbody>
23550 <tr><td>foo-bar</td><td>foo+bar</td></tr>
23551 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
23552 <tr><td>foo
23553 <p>bar|baz
23554 +bar
23555 -bar</p></td></tr>
23556 <tr><td>x
23557 <div>a|b</div></td>
23558 </tbody></table>
23559 !! wikitext
23560 {|
23561 |foo-bar
23562 |foo+bar
23563 |-
23564 |''foo''-bar
23565 |''foo''+bar
23566 |-
23567 |foo
23568 bar|baz
23569 +bar
23570 -bar
23571 |-
23572 |x
23573 <div>a|b</div>
23574 |}
23575 !! html/php
23576 <table>
23577 <tr>
23578 <td>foo-bar
23579 </td>
23580 <td>foo+bar
23581 </td></tr>
23582 <tr>
23583 <td><i>foo</i>-bar
23584 </td>
23585 <td><i>foo</i>+bar
23586 </td></tr>
23587 <tr>
23588 <td>foo
23589 <p>bar|baz
23590 +bar
23591 -bar
23592 </p>
23593 </td></tr>
23594 <tr>
23595 <td>x
23596 <div>a|b</div>
23597 </td></tr></table>
23598
23599 !! end
23600
23601 !! test
23602 Tables: 4d. No escaping needed
23603 !! options
23604 parsoid=html2wt
23605 !! html/parsoid
23606 <table>
23607 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
23608 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
23609 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
23610 </tbody></table>
23611 !! wikitext
23612 {|
23613 |[[Foo]]-bar
23614 ||+1
23615 ||-2
23616 |}
23617 !! html/php
23618 <table>
23619 <tr>
23620 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
23621 </td>
23622 <td>+1
23623 </td>
23624 <td>-2
23625 </td></tr></table>
23626
23627 !! end
23628
23629 !! test
23630 T97430: Don't emit empty nowiki pairs around marker meta tags
23631 !! options
23632 parsoid=html2wt
23633 !! html/parsoid
23634 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
23635 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
23636 !! wikitext
23637 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
23638 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
23639 !! end
23640
23641 !! test
23642 Unclosed xmlish element in table line shouldn't eat end delimiters
23643 !! options
23644 parsoid=html2wt
23645 !! html/parsoid
23646 <table>
23647 <tbody><tr><td> &lt;foo</td>
23648 <td> bar></td></tr>
23649 </tbody></table>
23650 !! wikitext
23651 {|
23652 | <foo
23653 | bar>
23654 |}
23655 !! html/php
23656 <table>
23657 <tr>
23658 <td> &lt;foo
23659 </td>
23660 <td> bar&gt;
23661 </td></tr></table>
23662
23663 !! end
23664
23665 #### --------------- Links ----------------
23666 #### 1. Quote marks in link text
23667 #### 2. Wikilinks: Escapes needed
23668 #### 3. Wikilinks: No escapes needed
23669 #### 4. Extlinks: Escapes needed
23670 #### 5. Extlinks: No escapes needed
23671 #### --------------------------------------
23672 !! test
23673 Links 1. WikiLinks: No escapes needed
23674 !! options
23675 parsoid=html2wt
23676 !! html/parsoid
23677 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
23678 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
23679 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
23680 !! wikitext
23681 [[Foo|Foo''boo'']]
23682 [[Foo|[Foobar]]]
23683 [[Foo|x [Foobar] x]]
23684 !! html/php
23685 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
23686 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
23687 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
23688 </p>
23689 !! end
23690
23691 !! test
23692 Links 2. WikiLinks: Escapes needed
23693 !! options
23694 parsoid=html2wt
23695 !! html/parsoid
23696 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
23697 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
23698 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
23699 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
23700 <a href="Foo" rel="mw:WikiLink">|Bar</a>
23701 <a href="Foo" rel="mw:WikiLink">]]bar</a>
23702 <a href="Foo" rel="mw:WikiLink">[[bar</a>
23703 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
23704 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
23705 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
23706 !! wikitext
23707 [[Foo|<nowiki>Foobar]</nowiki>]]
23708 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
23709 [[Foo|<nowiki>[[Bar]]</nowiki>]]
23710 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
23711 [[Foo|<nowiki>|Bar</nowiki>]]
23712 [[Foo|<nowiki>]]bar</nowiki>]]
23713 [[Foo|<nowiki>[[bar</nowiki>]]
23714 [[Foo|<nowiki>x [[ y</nowiki>]]
23715 [[Foo|<nowiki>x ]] y</nowiki>]]
23716 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
23717 !! html/php
23718 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
23719 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
23720 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
23721 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
23722 <a href="/wiki/Foo" title="Foo">|Bar</a>
23723 <a href="/wiki/Foo" title="Foo">]]bar</a>
23724 <a href="/wiki/Foo" title="Foo">[[bar</a>
23725 <a href="/wiki/Foo" title="Foo">x [[ y</a>
23726 <a href="/wiki/Foo" title="Foo">x ]] y</a>
23727 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
23728 </p>
23729 !! end
23730
23731 !! test
23732 Links 3. WikiLinks: No escapes needed
23733 !! options
23734 parsoid=html2wt
23735 !! html/parsoid
23736 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
23737 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
23738 !! wikitext
23739 [[Foo|[Foobar]]
23740 [[Foo|foo|bar]]
23741 !! html/php
23742 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
23743 <a href="/wiki/Foo" title="Foo">foo|bar</a>
23744 </p>
23745 !! end
23746
23747 !! test
23748 Links 4. ExtLinks: Escapes needed
23749 !! options
23750 parsoid=html2wt
23751 !! html/parsoid
23752 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
23753 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
23754 <p>[http://google.com]</p>
23755 <p>[http://google.com google]</p>
23756 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
23757 <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>
23758 !! wikitext
23759 [http://google.com <nowiki>[google]</nowiki>]
23760 [http://google.com <nowiki>google]</nowiki>]
23761
23762 <nowiki>[http://google.com]</nowiki>
23763
23764 <nowiki>[http://google.com google]</nowiki>
23765
23766 [http://google.com<nowiki>]</nowiki>
23767
23768 [{{echo|http://google.com}}<nowiki>]</nowiki>
23769 !! html/php
23770 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
23771 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
23772 </p><p>[http://google.com]
23773 </p><p>[http://google.com google]
23774 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
23775 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
23776 </p>
23777 !! end
23778
23779 !! test
23780 Links 5. ExtLinks: No escapes needed
23781 !! options
23782 parsoid=html2wt
23783 !! html/parsoid
23784 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
23785 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
23786 !! wikitext
23787 [http://google.com [google]
23788
23789 [[http://google.com]]
23790 !! html/php
23791 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
23792 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
23793 </p>
23794 !! end
23795
23796 !! test
23797 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
23798 !! options
23799 parsoid=html2wt
23800 !! html/parsoid
23801 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
23802 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
23803 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
23804 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
23805 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
23806 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
23807 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
23808 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
23809 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
23810 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
23811 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
23812 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
23813 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
23814 </p>
23815 !! wikitext
23816 x<nowiki/>http://example.com<nowiki/>y
23817 http://example.com<nowiki/>?x
23818 http://example.com<nowiki/>&x
23819 http://example.com<nowiki/>'x
23820 http://example.com<nowiki/>,x
23821 http://example.com<nowiki/>.x
23822 http://example.com<nowiki/>;x
23823 http://example.com<nowiki/>:x
23824 http://example.com<nowiki/>;x
23825 http://example.com<nowiki/>!x
23826 http://example.com<nowiki/>=x
23827 http://example.com<nowiki/>(x)
23828 http://example.com(x<nowiki/>)
23829 !! end
23830
23831 !! test
23832 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
23833 !! options
23834 parsoid=html2wt
23835 !! html/parsoid
23836 <p>x
23837 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
23838 y
23839 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
23840 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
23841 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
23842 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
23843 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
23844 </p>
23845 !! wikitext
23846 x
23847 http://example.com
23848 y
23849 "http://example.com"
23850 (http://example.com)
23851 (http://example.com) foo
23852 http://example.com,
23853 http://example.com, foo
23854 !! html/php
23855 <p>x
23856 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
23857 y
23858 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
23859 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
23860 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
23861 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
23862 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
23863 </p>
23864 !! end
23865
23866 !! test
23867 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
23868 !! options
23869 parsoid=html2wt
23870 !! html/parsoid
23871 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
23872 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
23873 !! wikitext
23874 http://example.com.,;:!?\
23875 -http://example.com:
23876 !! html/php
23877 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
23878 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
23879 </p>
23880 !! end
23881
23882 !! test
23883 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (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>4
23888 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
23889 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
23890 !! wikitext
23891 RFC 123<nowiki/>4
23892 RFC 123<nowiki/>y
23893 X<nowiki/>RFC 123<nowiki/>y
23894 !! end
23895
23896 !! test
23897 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
23898 !! options
23899 parsoid=html2wt
23900 !! html/parsoid
23901 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
23902 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
23903 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
23904 </p>
23905 !! wikitext
23906 RFC 123?foo
23907 RFC 123&foo
23908 -RFC 123-
23909 !! html/php
23910 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
23911 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
23912 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
23913 </p>
23914 !! end
23915
23916 !! test
23917 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (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>4
23922 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
23923 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
23924 !! wikitext
23925 PMID 123<nowiki/>4
23926 PMID 123<nowiki/>y
23927 X<nowiki/>PMID 123<nowiki/>y
23928 !! end
23929
23930 !! test
23931 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
23932 !! options
23933 parsoid=html2wt
23934 !! html/parsoid
23935 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
23936 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
23937 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
23938 </p>
23939 !! wikitext
23940 PMID 123?foo
23941 PMID 123&foo
23942 -PMID 123-
23943 !! html/php
23944 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
23945 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
23946 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
23947 </p>
23948 !! end
23949
23950 !! test
23951 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
23952 !! options
23953 parsoid=html2wt
23954 !! html/parsoid
23955 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
23956 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
23957 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
23958 </p>
23959 !! wikitext
23960 ISBN 1234567890<nowiki/>1
23961 ISBN 1234567890<nowiki/>x
23962 a<nowiki/>ISBN 1234567890<nowiki/>b
23963 !! end
23964
23965 !! test
23966 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
23967 !! options
23968 parsoid=html2wt
23969 !! html/parsoid
23970 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
23971 !! wikitext
23972 -ISBN 1234567890's
23973 !! html/php
23974 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
23975 </p>
23976 !! end
23977
23978 !! test
23979 Links 14. Protect link-like plain text. (Parsoid bug T78425)
23980 !! options
23981 parsoid=html2wt
23982 !! html/*
23983 <p>this is not a link: http://example.com
23984 </p>
23985 !! wikitext
23986 this is not a link: <nowiki>http://example.com</nowiki>
23987 !! end
23988
23989 !! test
23990 Links 15. Link trails can't become link prefixes.
23991 !! options
23992 language=is
23993 parsoid=html2wt
23994 !! html/parsoid
23995 <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>
23996 !! wikitext
23997 [[Söfnuður]]-[[00]]
23998 !! html/php
23999 <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>
24000 </p>
24001 !! end
24002
24003 #### --------------- Quotes ---------------
24004 #### 1. Quotes inside <b> and <i>
24005 #### 2. Link fragments separated by <i> and <b> tags
24006 #### 3. Link fragments inside <i> and <b>
24007 #### 4. No escaping needed
24008 #### --------------------------------------
24009 !! test
24010 1a. Quotes inside <b> and <i>
24011 !! options
24012 parsoid=html2wt
24013 !! html/*
24014 <p><i>'foo'</i>
24015 <i>''foo''</i>
24016 <i>'''foo'''</i>
24017 <i>foo</i>'s
24018 <b>'foo'</b>
24019 <b>''foo''</b>
24020 <b>'''foo'''</b>
24021 <b>foo'<i>bar'</i>baz</b>
24022 <b>foo</b>'s
24023 '<i>foo</i>
24024 <i>foo</i>'
24025 <i>foo'</i>'
24026 '<i>foo</i>'
24027 '<b>foo</b>
24028 <b>foo</b>'
24029 '<b>foo</b>'
24030 <i>fools'<span> errand</span></i>
24031 <i><span>fool</span>'s errand</i>
24032 '<i>foo</i> bar '<i>baz</i>
24033 a|!*#-:;+-~[]{}b'<i>x</i>
24034 </p>
24035 !! wikitext
24036 ''<nowiki/>'foo'''
24037 ''<nowiki>''foo''</nowiki>''
24038 ''<nowiki>'''foo'''</nowiki>''
24039 ''foo''<nowiki/>'s
24040 '''<nowiki/>'foo''''
24041 '''<nowiki>''foo''</nowiki>'''
24042 '''<nowiki>'''foo'''</nowiki>'''
24043 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
24044 '''foo'''<nowiki/>'s
24045 '''foo''
24046 ''foo''<nowiki/>'
24047 ''foo'''<nowiki/>'
24048 '''foo''<nowiki/>'
24049 ''''foo'''
24050 '''foo'''<nowiki/>'
24051 ''''foo'''<nowiki/>'
24052 ''fools'<span> errand</span>''
24053 ''<span>fool</span>'s errand''
24054 '<nowiki/>''foo'' bar '''baz''
24055 a|!*#-:;+-~[]{}b'''x''
24056 !! end
24057
24058 !! test
24059 1b. Quotes inside <b> and <i> with other tags on same line
24060 !! options
24061 parsoid=html2wt
24062 !! html/parsoid
24063 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
24064 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
24065 <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>
24066 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
24067 '<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>
24068 '<i>foo</i> <div title="name">test</div>
24069 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
24070 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
24071 <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>
24072 </ol>
24073 !! wikitext
24074 '''a'' foo ''[[bar]]''
24075 ''a''' foo ''[[bar]]''
24076 ''a''' foo '''{{echo|[[bar]]}}'''
24077 [[foo]] x'''[[bar]]''
24078 '''foo'' <ref>test</ref>
24079 '''foo'' <div title="name">test</div>
24080 '''foo'' and <br> bar
24081 <references />
24082 !! end
24083
24084 !! test
24085 2. Link fragments separated by <i> and <b> tags
24086 !! options
24087 parsoid=html2wt
24088 !! html/parsoid
24089 <p>[[<i>foo</i>hello]]</p>
24090 <p>[[<b>foo</b>hello]]</p>
24091 !! wikitext
24092 [[''foo''<nowiki>hello]]</nowiki>
24093
24094 [['''foo'''<nowiki>hello]]</nowiki>
24095 !! end
24096
24097 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
24098 # this is one of the shortcomings of this format
24099 !! test
24100 3. Link fragments inside <i> and <b>
24101 !! options
24102 parsoid=html2wt
24103 !! html/parsoid
24104 <p><i>[[foo</i>]]</p>
24105 <p><b>[[foo</b>]]</p>
24106 !! wikitext
24107 ''[[foo''<nowiki>]]</nowiki>
24108
24109 '''[[foo'''<nowiki>]]</nowiki>
24110 !! end
24111
24112 !! test
24113 4. No escaping needed
24114 !! options
24115 options=html2wt
24116 !! html/parsoid
24117 <p>'<span><i>bar</i></span>'
24118 '<span><b>bar</b></span>'
24119 'a:b'foo
24120 </p>
24121 !! wikitext
24122 '<span>''bar''</span>'
24123 '<span>'''bar'''</span>'
24124 'a:b'foo
24125 !! end
24126
24127 #### ----------- Paragraphs ---------------
24128 #### 1. No unnecessary escapes
24129 #### --------------------------------------
24130
24131 !! test
24132 1. No unnecessary escapes
24133 !! options
24134 parsoid=html2wt
24135 !! html/parsoid
24136 <p>bar <span>[[foo]]</span>
24137 </p><p>=bar <span>[[foo]]</span>
24138 </p><p>[[bar <span>[[foo]]</span>
24139 </p><p>]]bar <span>[[foo]]</span>
24140 </p><p>=bar <span>foo]]</span>=
24141 </p>
24142 !! wikitext
24143 bar <span><nowiki>[[foo]]</nowiki></span>
24144
24145 =bar <span><nowiki>[[foo]]</nowiki></span>
24146
24147 [[bar <span><nowiki>[[foo]]</nowiki></span>
24148
24149 ]]bar <span><nowiki>[[foo]]</nowiki></span>
24150
24151 =bar <span>foo]]</span><nowiki>=</nowiki>
24152 !!end
24153
24154 #### ----------------------- PRE --------------------------
24155 #### 1. Leading whitespace in SOL context should be escaped
24156 #### ------------------------------------------------------
24157 !! test
24158 1. Leading whitespace in SOL context should be escaped
24159 !! options
24160 parsoid=html2wt
24161 !! html/parsoid
24162 <p> a</p>
24163
24164 <p> a</p>
24165
24166 <p> a(tab)</p>
24167
24168 <p> a
24169 <!--cmt-->
24170 a</p>
24171
24172 <p>a
24173 b</p>
24174
24175 <p>a
24176 b</p>
24177
24178 <p>a
24179 b</p>
24180 !! wikitext
24181 <nowiki> </nowiki>a
24182
24183 <nowiki> </nowiki> a
24184
24185 a(tab)
24186
24187 <nowiki> </nowiki> a
24188 <!--cmt-->
24189 <nowiki> </nowiki>a
24190
24191 a
24192 <nowiki> </nowiki>b
24193
24194 a
24195 b
24196
24197 a
24198 b
24199 !! html/php
24200 <p> a
24201 </p><p> a
24202 </p><p> a(tab)
24203 </p><p> a
24204 a
24205 </p><p>a
24206 b
24207 </p><p>a
24208 b
24209 </p><p>a
24210 b
24211 </p>
24212 !! end
24213
24214 !! test
24215 2. Leading whitespace in non-indent-pre contexts should not be escaped
24216 !! options
24217 parsoid=html2wt
24218 !! html/parsoid
24219 <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>
24220 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
24221 <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>
24222 b</span></li>
24223 </ol>
24224 !! wikitext
24225 foo <ref>''a''
24226 b</ref>
24227 <references />
24228 !! end
24229
24230 !! test
24231 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
24232 !! options
24233 parsoid=html2wt
24234 !! html/parsoid
24235 <blockquote>
24236 <p>
24237 a
24238 <span>b</span>
24239 c</p>
24240 </blockquote>
24241 !! wikitext
24242 <blockquote>
24243 a
24244 <span>b</span>
24245 c
24246 </blockquote>
24247 !! end
24248
24249 !! test
24250 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
24251 !! options
24252 options=html2wt
24253 !! html/parsoid
24254 <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>
24255 !! wikitext
24256 [[File:Foobar.jpg|thumb|caption]]
24257 !! end
24258
24259 !! test
24260 5. Nowiki escaping should account for indent-pres
24261 !! options
24262 parsoid=html2wt
24263 !! html/parsoid
24264 <pre>==foo==</pre>
24265 !! wikitext
24266 ==foo==
24267 !! end
24268
24269 !!test
24270 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
24271 !! options
24272 parsoid=html2wt
24273 !! html/parsoid
24274 <pre>
24275 * foo
24276 * bar
24277 </pre>
24278 !! wikitext
24279 * foo
24280 * bar
24281 !! end
24282
24283 #### --------------- Behavior Switches --------------------
24284
24285 !! test
24286 1. Valid behavior switches should be escaped
24287 !! options
24288 parsoid=html2wt
24289 !! html/parsoid
24290 __TOC__
24291 <i>__TOC__</i>
24292 !! wikitext
24293 <nowiki>__TOC__</nowiki>
24294 ''<nowiki>__TOC__</nowiki>''
24295 !! end
24296
24297 !! test
24298 2. Invalid behavior switches should not be escaped
24299 !! options
24300 parsoid=html2wt
24301 !! html/parsoid
24302 __TOO__
24303 __|__
24304 !! wikitext
24305 __TOO__
24306 __|__
24307 !! end
24308
24309 # We use indent-pre as an indirect way to test for sol-transparent behavior.
24310 !! test
24311 Behavior switches should be SOL-transparent
24312 !! options
24313 parsoid=html2wt
24314 !! html/parsoid
24315 <meta property="mw:PageProp/toc" />
24316
24317 <!-- this one's bogus -->
24318 <pre>__TOO__</pre>
24319
24320 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
24321
24322 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
24323 !! wikitext
24324 __TOC__
24325
24326 <!-- this one's bogus -->
24327 __TOO__
24328
24329 __TOC__ foo
24330
24331 __TOC__
24332 bar
24333 !! end
24334
24335 #### --------------- HTML tags ---------------
24336 #### 1. a tags
24337 #### 2. other tags
24338 #### 3. multi-line html tag
24339 #### 4. extension tags
24340 #### -----------------------------------------
24341 !! test
24342 1. a tags
24343 !! options
24344 parsoid=html2wt
24345 !! html/parsoid
24346 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
24347 !! wikitext
24348 <a href="http://google.com">google</a>
24349 !! end
24350
24351 !! test
24352 2. other tags
24353 !! options
24354 parsoid=html2wt
24355 !! html/parsoid
24356 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
24357 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
24358 <li> &lt;td&gt;</li></ul>
24359
24360 !! wikitext
24361 * <nowiki><div>foo</div></nowiki>
24362 * <nowiki><div style="color:red">foo</div></nowiki>
24363 * <nowiki><td></nowiki>
24364 !! end
24365
24366 !! test
24367 3. multi-line html tag
24368 !! options
24369 parsoid=html2wt
24370 !! html/parsoid
24371 <p>&lt;div
24372 &gt;foo&lt;/div
24373 &gt;
24374 </p>
24375 !! wikitext
24376 <nowiki><div
24377 >foo</div
24378 ></nowiki>
24379 !! end
24380
24381 !! test
24382 4. extension tags
24383 !! options
24384 parsoid=html2wt
24385 !! html/parsoid
24386 <p>&lt;ref&gt;foo&lt;/ref&gt;
24387 </p><p>&lt;ref&gt;bar
24388 </p><p>baz&lt;/ref&gt;
24389 </p>
24390 !! wikitext
24391 <nowiki><ref>foo</ref></nowiki>
24392
24393 <nowiki><ref>bar</nowiki>
24394
24395 baz<nowiki></ref></nowiki>
24396 !! end
24397
24398 #### --------------- Others ---------------
24399 !! test
24400 Escaping nowikis
24401 !! options
24402 parsoid=html2wt
24403 !! html/parsoid
24404 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
24405 </p>
24406 !! wikitext
24407 &lt;nowiki&gt;foo&lt;/nowiki&gt;
24408 !! end
24409
24410 ## The quote-char in the input is necessary for triggering the bug
24411 !! test
24412 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
24413 !! options
24414 parsoid=html2wt
24415 !! html/parsoid
24416 <p>foo's bar :</p>
24417 !! wikitext
24418 foo's bar :
24419 !! end
24420
24421 #----------- End of wikitext escaping tests --------------
24422
24423 !! test
24424
24425 Tag-like HTML structures are passed through as text
24426 !! wikitext
24427 <x y>
24428
24429 <x.y>
24430
24431 <x-y>
24432
24433 1>2
24434
24435 x<y
24436
24437 a>b
24438
24439 1<d e>f
24440 !! html
24441 <p>&lt;x y&gt;
24442 </p><p>&lt;x.y&gt;
24443 </p><p>&lt;x-y&gt;
24444 </p><p>1&gt;2
24445 </p><p>x&lt;y
24446 </p><p>a&gt;b
24447 </p><p>1&lt;d e&gt;f
24448 </p>
24449 !! end
24450
24451 !! test
24452 HTML tag with necessary entities in attributes
24453 !! wikitext
24454 <span title="&amp;amp;">foo</span>
24455 !! html
24456 <p><span title="&amp;amp;">foo</span>
24457 </p>
24458 !! end
24459
24460 !! test
24461 HTML tag with 'unnecessary' entity encoding in attributes
24462 !! wikitext
24463 <span title="&amp;">foo</span>
24464 !! html
24465 <p><span title="&amp;">foo</span>
24466 </p>
24467 !! end
24468
24469 !! test
24470 HTML tag with broken attribute value quoting
24471 !! options
24472 parsoid=wt2html,html2html
24473 !! wikitext
24474 <span title="Hello world>Foo</span>
24475 !! html/php
24476 <p><span title="Hello world">Foo</span>
24477 </p>
24478 !! html/parsoid
24479 <p><span title="Hello world">Foo</span></p>
24480 !! end
24481
24482 !! test
24483 Self-closed tag with broken attribute value quoting
24484 !! options
24485 parsoid=wt2html,html2html
24486 !! wikitext
24487 <div title="Hello world />Foo
24488 !! html/php+tidy
24489 <div title="Hello world"></div>
24490 <p>Foo</p>
24491 !! html/parsoid
24492 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
24493 !! end
24494
24495 !! test
24496 Table with broken attribute value quoting
24497 !! options
24498 parsoid=wt2html,html2html
24499 !! wikitext
24500 {|
24501 | title="Hello world|Foo
24502 |}
24503 !! html/php
24504 <table>
24505 <tr>
24506 <td title="Hello world">Foo
24507 </td></tr></table>
24508
24509 !! html/parsoid
24510 <table>
24511 <tr>
24512 <td title="Hello world">Foo
24513 </td></tr></table>
24514
24515 !! end
24516
24517 !! test
24518 Table with broken attribute value quoting on consecutive lines
24519 !! options
24520 parsoid=wt2html,html2html
24521 !! wikitext
24522 {|
24523 | title="Hello world|Foo
24524 | style="color:red|Bar
24525 |}
24526 !! html/php
24527 <table>
24528 <tr>
24529 <td title="Hello world">Foo
24530 </td>
24531 <td style="color:red">Bar
24532 </td></tr></table>
24533
24534 !! html/parsoid
24535 <table><tbody>
24536 <tr>
24537 <td title="Hello world">Foo
24538 </td><td style="color: red">Bar
24539 </td></tr></tbody></table>
24540
24541 !! end
24542
24543 !!test
24544 Accept empty td cell attribute
24545 !! wikitext
24546 {|
24547 | align="center" | foo || |
24548 |}
24549 !! html
24550 <table>
24551 <tr>
24552 <td align="center"> foo </td>
24553 <td>
24554 </td></tr></table>
24555
24556 !!end
24557
24558 !!test
24559 Non-empty attributes in th-cells
24560 !! wikitext
24561 {|
24562 ! Foo !! style="color: red" | Bar
24563 |}
24564 !! html
24565 <table>
24566 <tr>
24567 <th> Foo </th>
24568 <th style="color: red"> Bar
24569 </th></tr></table>
24570
24571 !!end
24572
24573 !!test
24574 Accept empty attributes in th-cells
24575 !! wikitext
24576 {|
24577 !| foo !!| bar
24578 |}
24579 !! html
24580 <table>
24581 <tr>
24582 <th> foo </th>
24583 <th> bar
24584 </th></tr></table>
24585
24586 !!end
24587
24588 !!test
24589 Empty table rows go away
24590 !! wikitext
24591 {|
24592 | Hello
24593 | there
24594 |- class="foo"
24595 |-
24596 |}
24597 !! html
24598 <table>
24599 <tr>
24600 <td> Hello
24601 </td>
24602 <td> there
24603 </td></tr>
24604
24605 </table>
24606
24607 !! end
24608
24609 ###
24610 ### Parsoid-centric tests for testing RTing of inter-element separators
24611 ### Edge cases not tested by existing parser tests and specific to
24612 ### Parsoid-specific serialization strategies.
24613 ###
24614
24615 !!test
24616 RT-ed inter-element separators should be valid separators
24617 !! wikitext
24618 {|
24619 |- [[foo]]
24620 |}
24621 !! html/php
24622 <table>
24623
24624 </table>
24625
24626 !! html/parsoid
24627 <table>
24628 <tbody><tr data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
24629 </tbody></table>
24630 !!end
24631
24632 # Parsoid-only since PHP parser relies on Tidy for correct output
24633 !!test
24634 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
24635 !!options
24636 parsoid
24637 !! wikitext
24638 {|
24639 |<small>foo
24640 bar
24641 |}
24642
24643 {|
24644 |<small>foo<small>
24645 |}
24646 !! html
24647 <table>
24648 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
24649 <p>bar</p></small></td></tr>
24650 </tbody></table>
24651
24652 <table>
24653 <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>
24654 </tbody></table>
24655 !!end
24656
24657 # Note that the "style" attribute is really a template parameter here.
24658 # The = would have to be {{=}} if you wanted the literal.
24659 !!test
24660 Empty TD followed by TD with tpl-generated attribute
24661 !! wikitext
24662 {|
24663 |-
24664 |
24665 |{{echo|style='color:red'}}|foo
24666 |}
24667 !! html
24668 <table>
24669
24670 <tr>
24671 <td>
24672 </td>
24673 <td>foo
24674 </td></tr></table>
24675
24676 !!end
24677
24678 !!test
24679 Indented table with an empty td
24680 !! wikitext
24681 {|
24682 |-
24683 |
24684 |foo
24685 |}
24686 !! html
24687 <table>
24688
24689 <tr>
24690 <td>
24691 </td>
24692 <td>foo
24693 </td></tr></table>
24694
24695 !!end
24696
24697 ## We have some newline diffs RT-ing this edge case
24698 ## and it is not important enough -- we seem to be emitting
24699 ## at most 2 newlines after a </tr> and this is unrelated to
24700 ## the issue from T85627 that this is testing.
24701 !!test
24702 Indented table with blank lines in between (T85627)
24703 !! options
24704 parsoid=wt2html
24705 !! wikitext
24706 {|
24707 |foo
24708
24709
24710 |}
24711 !! html
24712 <table>
24713
24714 <tr>
24715 <td>foo
24716 </td></tr></table>
24717
24718 !!end
24719
24720 !!test
24721 Indented block & table
24722 !! wikitext
24723 <div>foo</div>
24724 {|
24725 |foo
24726 |}
24727 !! html/php
24728 <div>foo</div>
24729 <table>
24730 <tr>
24731 <td>foo
24732 </td></tr></table>
24733
24734 !! html/parsoid
24735 <div data-parsoid='{"stx":"html"}'>foo</div>
24736 <table><tbody>
24737 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
24738 </tbody></table>
24739 !!end
24740
24741 !! test
24742 Indent and comment before table row
24743 !! wikitext
24744 {|
24745 <!--hi-->|-
24746 | there
24747 |}
24748 !! html/php
24749 <table>
24750
24751 <tr>
24752 <td> there
24753 </td></tr></table>
24754
24755 !! html/parsoid
24756 <table>
24757 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
24758 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
24759 </tbody></table>
24760 !! end
24761
24762 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
24763 !!test
24764 Empty TR followed by a template-generated TR
24765 !!options
24766 parsoid
24767 !! wikitext
24768 {|
24769 |-
24770 {{echo|<tr><td>foo</td></tr>}}
24771 |}
24772 !! html
24773 <table>
24774 <tbody>
24775 <tr></tr>
24776 <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}}]}'>
24777 <td>foo</td></tr>
24778 </tbody></table>
24779 !!end
24780
24781 ## PHP and parsoid output differ for this, and since this is primarily
24782 ## for testing Parsoid's serializer, marking this Parsoid only
24783 !!test
24784 Empty TR followed by mixed-ws-comment line should RT correctly
24785 !!options
24786 parsoid
24787 !! wikitext
24788 {|
24789 |-
24790 <!--c-->
24791 |-
24792 <!--c--> <!--d-->
24793 |}
24794 !! html
24795 <table>
24796 <tbody>
24797 <tr></tr>
24798 <!--c-->
24799 <tr>
24800 <!--c--> </tr><!--d-->
24801 </tbody></table>
24802
24803 !!end
24804
24805 !!test
24806 Multi-line image caption generated by templates with/without trailing newlines
24807 !! wikitext
24808 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
24809 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
24810 !! html/parsoid
24811 <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>
24812 <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>
24813 !!end
24814
24815 !! test
24816 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
24817 !! options
24818 parsoid=html2wt
24819 !! html/parsoid
24820 <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>
24821
24822 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
24823 !! wikitext
24824 <includeonly>foo</includeonly>
24825 new para
24826
24827 [[Category:Foo]]
24828
24829 = new heading =
24830 !! end
24831
24832 ## PHP emits broken html for this, and since this is primarily
24833 ## a Parsoid serializer test, marking this Parsoid only
24834 !!test
24835 Improperly nested inline or quotes tags with whitespace in between
24836 !! wikitext
24837 <span> <s>x</span> </s>
24838 ''' ''x''' ''
24839 !! html/parsoid
24840 <p><span> <s>x</s></span><s> </s>
24841 <b> <i>x</i></b><i> </i>
24842 </p>
24843 !!end
24844
24845 !!test
24846 Encapsulate protected attributes from wt
24847 !! wikitext
24848 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
24849
24850 {| typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true"
24851 | ok
24852 |}
24853 !! html/parsoid
24854 <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>
24855
24856 <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">
24857 <tbody><tr><td data-parsoid='{"autoInsertedEnd":true}'> ok</td></tr>
24858 </tbody></table>
24859 !!end
24860
24861 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
24862 ## Having nested or stray pre tags results in the attempt to add duplicates,
24863 ## causing an assertion fail. This test tries to prevent that situation.
24864 !!test
24865 Ensure ParagraphWrapper can deal with stray closing pre tags
24866 !!options
24867 parsoid=wt2html
24868 !! wikitext
24869 plain text</pre>
24870 !! html/parsoid
24871 plain text
24872 !!end
24873
24874 !!test
24875 1. Ensure fostered text content is wrapped in element nodes
24876 !!options
24877 parsoid=wt2html
24878 !! wikitext
24879 <table>hi</table><table>ho</table>
24880 !! html/parsoid
24881 <p>hi</p>
24882 <table></table>
24883 <p>ho</p>
24884 <table></table>
24885 !!end
24886
24887 !!test
24888 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
24889 !!options
24890 parsoid=wt2html,wt2wt
24891 !! wikitext
24892 <table>
24893 <tr> || ||
24894 <td> a
24895 </table>
24896 !! html/parsoid
24897 <p> || ||
24898 </p><table>
24899 <tbody><tr><td> a</td></tr>
24900 </tbody></table>
24901 !!end
24902
24903 !!test
24904 Encapsulation properly handles null DSR information from foster box
24905 !!options
24906 parsoid=wt2html,wt2wt
24907 !! wikitext
24908 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
24909 !! html/parsoid
24910 <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>
24911 !!end
24912
24913 !!test
24914 1. Encapsulate foster-parented transclusion content
24915 !!options
24916 parsoid=wt2wt,wt2html
24917 !! wikitext
24918 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
24919 !! html/parsoid
24920 <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>
24921 <tbody>
24922 <tr>
24923 <td>bar</td>
24924 </tr>
24925 </tbody>
24926 </table>
24927 !!end
24928
24929 !!test
24930 2. Encapsulate foster-parented transclusion content
24931 !!options
24932 parsoid=wt2wt,wt2html
24933 !! wikitext
24934 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
24935 !! html/parsoid
24936 <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>
24937 <table>
24938 <tbody>
24939 <tr>
24940 <td>bar</td>
24941 </tr>
24942 </tbody>
24943 </table>
24944 !!end
24945
24946 !!test
24947 3. Encapsulate foster-parented transclusion content
24948 !!options
24949 parsoid=wt2wt,wt2html
24950 !! wikitext
24951 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
24952 !! html/parsoid
24953 <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;]}">
24954 <p>foo</p>
24955 </div>
24956 <table>
24957 <tbody>
24958 <tr>
24959 <td>bar</td>
24960 </tr>
24961 </tbody>
24962 </table>
24963 !!end
24964
24965 !!test
24966 4. Encapsulate foster-parented transclusion content
24967 !!options
24968 parsoid=wt2wt,wt2html
24969 !! wikitext
24970 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
24971 !! html/parsoid
24972 <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;]}">
24973 <p>foo</p>
24974 </div>
24975 <table>
24976 <tbody>
24977 <tr>
24978 <td>bar</td>
24979 </tr>
24980 </tbody>
24981 </table>
24982 !!end
24983
24984 !!test
24985 5. Encapsulate foster-parented transclusion content
24986 !!options
24987 parsoid=wt2wt,wt2html
24988 !! wikitext
24989 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
24990 !! html/parsoid
24991 <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>
24992 <table>
24993 <tbody>
24994 <tr>
24995 <td>
24996 <div>
24997 <p>foo</p>
24998 </div>
24999 </td>
25000 </tr>
25001 </tbody>
25002 </table>
25003 !!end
25004
25005 !!test
25006 6. Encapsulate foster-parented transclusion content
25007 !!options
25008 parsoid=wt2wt,wt2html
25009 !! wikitext
25010 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
25011 !! html/parsoid
25012 <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>
25013 <table>
25014 <tbody>
25015 <tr>
25016 <td>
25017 <div>
25018 <p>foo</p>
25019 </div>
25020 </td>
25021 </tr>
25022 </tbody>
25023 </table>
25024 <p>ok</p>
25025 !!end
25026
25027 !!test
25028 7. Encapsulate foster-parented transclusion content
25029 !!options
25030 parsoid=wt2wt,wt2html
25031 !! wikitext
25032 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
25033 !! html/parsoid
25034 <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>
25035 <table>
25036 <tbody>
25037 <tr>
25038 <td>bar</td>
25039 </tr>
25040 </tbody>
25041 </table>
25042 !!end
25043
25044 # Note that the wt is broken on purpose: the = should be {{=}} if you
25045 # don't want it to be a template parameter key.
25046 !!test
25047 8. Encapsulate foster-parented transclusion content
25048 !!options
25049 parsoid=wt2wt,wt2html
25050 !! wikitext
25051 {{echo|a
25052 }}{|{{echo|style='color:red'}}
25053 |-
25054 |b
25055 |}
25056 !! html/parsoid
25057 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
25058 <span> </span>
25059 <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>
25060 <table>
25061 <tbody>
25062 <tr>
25063 <td>b</td>
25064 </tr>
25065 </tbody>
25066 </table>
25067 !!end
25068
25069 !!test
25070 9. Encapsulate foster-parented transclusion content
25071 !!options
25072 parsoid=wt2wt,wt2html
25073 !! wikitext
25074 <table>{{echo|hi</table>hello}}
25075 !! html/parsoid
25076 <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>
25077 !!end
25078
25079 !!test
25080 Table in fosterable position
25081 !!options
25082 parsoid=wt2html
25083 !! wikitext
25084 {{OpenTable}}
25085 <div>
25086 {|
25087 |}
25088 </div>
25089 |}
25090 !! html/parsoid
25091 <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">
25092 </span>
25093 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
25094
25095 <table>
25096 </table>
25097 !!end
25098
25099 # Parsoid only for bug 64747
25100 !! test
25101 Properly encapsulate empty-content transclusions in fosterable positions
25102 !! wikitext
25103 <table>
25104 {{#if:|
25105 <td>foo</td>
25106 }}
25107 </table>
25108 !! html/parsoid
25109 <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"}]]}'>
25110
25111 </table>
25112 !! end
25113
25114 !! test
25115 Always encapsulate foster box when template range is expanded to table
25116 !! options
25117 parsoid=wt2wt
25118 !! wikitext
25119 {|
25120 hello
25121 {{OpenTable}}
25122 |}
25123 !! html/parsoid
25124
25125 !! end
25126
25127 !! test
25128 T115289: Unclosed table
25129 !! wikitext
25130 {{echo|<table>}}<!--c-->[[Category:Two]]
25131 !! html/parsoid
25132 <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>
25133 !! end
25134
25135 !! test
25136 T115289: Don't migrate newlines out of tables with fostered content
25137 !! wikitext
25138 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
25139 !! html/parsoid
25140 <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>
25141 !! end
25142
25143 !! test
25144 T73074: More fostering fun
25145 !! wikitext
25146 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
25147 !! html/parsoid
25148 <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>
25149 !! end
25150
25151 !!test
25152 Support <object> element with .data attribute
25153 !!options
25154 parsoid=html2wt
25155 !! html/parsoid
25156 <object data="test.swf"></object>
25157 !! wikitext
25158 <object data="test.swf"></object>
25159 !!end
25160
25161 !! test
25162 Don't block XML namespace declaration
25163 !! wikitext
25164 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
25165 !! html/php
25166 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
25167 </p>
25168 !! html/parsoid
25169 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
25170 !! end
25171
25172 # -----------------------------------------------------------------
25173 # The following section of tests are primarily to spec requirements
25174 # around Parsoid's serialization (old, new, edited content)
25175 #
25176 # All these tests are marked Parsoid html2wt and html2html only
25177 # ----------------------------------------------------------------
25178
25179 !! test
25180 Ignore rel attribute in a-tags during serialization to url-links
25181 !! options
25182 parsoid=html2wt
25183 !! html/parsoid
25184 <a href='http://en.wikipedia.org/wiki/Foobar'>http://en.wikipedia.org/wiki/Foobar</a>
25185 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:ExtLink'>http://en.wikipedia.org/wiki/Foobar</a>
25186 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:WikiLink'>http://en.wikipedia.org/wiki/Foobar</a>
25187 !! wikitext
25188 http://en.wikipedia.org/wiki/Foobar
25189 http://en.wikipedia.org/wiki/Foobar
25190 http://en.wikipedia.org/wiki/Foobar
25191 !! end
25192
25193 # 'mi' is a localinterwiki prefix as well as a language
25194 !! test
25195 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
25196 !! options
25197 parsoid=html2wt
25198 !! html/parsoid
25199 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
25200 !! wikitext
25201 [[Foo]]
25202 !! end
25203
25204 # See T93839
25205 !! test
25206 New wikilinks should be serialized properly
25207 !! options
25208 parsoid=html2wt
25209 !! html/parsoid
25210 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
25211 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
25212 <a href="//en.wikipedia.org/wiki/Foo">//en.wikipedia.org/wiki/Foo</a>
25213 <a href="http://en.wikipedia.org/wiki/Foo">http://en.wikipedia.org/wiki/Foo</a>
25214 <a href="//en.wikipedia.org/wiki/Foo_bar">//en.wikipedia.org/wiki/Foo bar</a>
25215 !! wikitext
25216 [[Foo]]
25217 [[Foo]]
25218 [[:en:Foo|//en.wikipedia.org/wiki/Foo]]
25219 http://en.wikipedia.org/wiki/Foo
25220 [[:en:Foo_bar|//en.wikipedia.org/wiki/Foo bar]]
25221 !! end
25222
25223 !! test
25224 New wiki links (href variations)
25225 !! options
25226 parsoid=html2wt
25227 !! html/parsoid
25228 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
25229 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
25230 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
25231 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
25232 !! wikitext
25233 [[Foo_bar]]
25234 [[Foo_bar]]
25235 [[Foo_bar]]
25236 [[Toxine bactérienne]]
25237 !! end
25238
25239 !! test
25240 New wiki links (content string variations)
25241 !! options
25242 parsoid=html2wt
25243 !! html/parsoid
25244 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
25245 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
25246 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
25247 !! wikitext
25248 [[Foo_bar]]
25249 [[Foo bar]]
25250 [[Foo_bar|./Foo_bar]]
25251 !! end
25252
25253 !! test
25254 New category links (href variations)
25255 !! options
25256 parsoid=html2wt
25257 !! html/parsoid
25258 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
25259 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
25260 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
25261 !! wikitext
25262 [[Category:Toxine bactérienne]]
25263 [[Category:Toxine bactérienne]]
25264 [[Category:Toxine bactérienne]]
25265 !! end
25266
25267 !! test
25268 New sol transparent links don't need indent-pre nowiki protection
25269 !! options
25270 parsoid=html2wt
25271 language=de
25272 !! html/parsoid
25273 <link rel="mw:PageProp/redirect" href="./Main_Page">
25274 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
25275 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
25276 !! wikitext
25277 #WEITERLEITUNG [[Main Page]]
25278 <!-- this is good --> [[Category:Good]]
25279 <!-- this is great --> [[Kategorie:Great]]
25280 !! end
25281
25282 !! test
25283 New interlanguage links (href variations)
25284 !! options
25285 parsoid=html2wt
25286 !! html/parsoid
25287 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
25288 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
25289 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
25290 !! wikitext
25291 [[es:Toxine bactérienne]]
25292 [[es:Toxine_bactérienne]]
25293 [[es:Toxine_bactérienne]]
25294 !! end
25295
25296 !! test
25297 Image: Modifying size of an image (1)
25298 !! options
25299 parsoid={
25300 "modes": ["wt2wt"],
25301 "changes": [
25302 ["img[height]", "attr", "height", "22"],
25303 ["img[width]", "attr", "width", "200"]
25304 ]
25305 }
25306 !! wikitext
25307 [[Image:Foobar.jpg|230x230px]]
25308 !! wikitext/edited
25309 [[Image:Foobar.jpg|200x200px]]
25310 !!end
25311
25312 !! test
25313 Image: Modifying size of an image (2)
25314 !! options
25315 parsoid={
25316 "modes": ["wt2wt"],
25317 "changes": [
25318 ["img[height]", "attr", "height", "100"],
25319 ["img[width]", "attr", "width", "500"]
25320 ]
25321 }
25322 !! wikitext
25323 [[Image:Foobar.jpg|230x230px]]
25324 !! wikitext/edited
25325 [[Image:Foobar.jpg|500x500px]]
25326 !!end
25327
25328 # Change in size is ignored so long as class='mw-default-size'
25329 !! test
25330 Image: Modifying size of an image (3)
25331 !! options
25332 parsoid={
25333 "modes": ["wt2wt"],
25334 "changes": [
25335 ["figure[class]", "removeClass", "mw-default-size"],
25336 ["figure img", "attr", "height", "19"],
25337 ["figure img", "attr", "width", "170"]
25338 ]
25339 }
25340 !! wikitext
25341 [[Image:Foobar.jpg|thumb]]
25342 !! wikitext/edited
25343 [[Image:Foobar.jpg|thumb|170x170px]]
25344 !!end
25345
25346 !! test
25347 Image: Modifying alignment of an image (bug 48665)
25348 !! options
25349 parsoid={
25350 "modes": ["wt2wt"],
25351 "changes": [
25352 ["figure[class]", "removeClass", "mw-halign-right"],
25353 ["figure[class]", "addClass", "mw-halign-left"]
25354 ]
25355 }
25356 !! wikitext
25357 [[Image:Foobar.jpg|thumb|caption|right]]
25358 !! wikitext/edited
25359 [[Image:Foobar.jpg|thumb|caption|left]]
25360 !! end
25361
25362 !! test
25363 Image: Modifying mw-default-size of an frameless image (bug 62805)
25364 !! options
25365 parsoid={
25366 "modes": ["wt2wt"],
25367 "changes": [
25368 ["figure.mw-default-size", "removeClass", "mw-default-size"]
25369 ]
25370 }
25371 !! wikitext
25372 [[Image:Foobar.jpg|frameless|right]]
25373 !! wikitext/edited
25374 [[Image:Foobar.jpg|frameless|right|220x220px]]
25375 !! end
25376
25377 !! test
25378 Image: Modifying valign of an image (bug 49221)
25379 !! options
25380 parsoid={
25381 "modes": ["wt2wt"],
25382 "changes": [
25383 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
25384 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
25385 ]
25386 }
25387 !! wikitext
25388 [[File:Foobar.jpg|20px|middle]]
25389 !! wikitext/edited
25390 [[File:Foobar.jpg|20px|text-top]]
25391 !! end
25392
25393 !! test
25394 Image: Modifying alt attribute of an image (bug 56400)
25395 !! options
25396 parsoid={
25397 "modes": ["wt2wt"],
25398 "changes": [
25399 ["img[alt]", "attr", "alt", "some alternate edited text"]
25400 ]
25401 }
25402 !! wikitext
25403 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
25404 !! wikitext/edited
25405 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
25406 !!end
25407
25408 !! test
25409 Image: Modifying caption of an image
25410 !! options
25411 parsoid={
25412 "modes": ["wt2wt"],
25413 "changes": [
25414 ["figcaption", "text", "new caption"]
25415 ]
25416 }
25417 !! wikitext
25418 [[Image:Foobar.jpg|thumb|original caption]]
25419 !! wikitext/edited
25420 [[Image:Foobar.jpg|thumb|new caption]]
25421 !!end
25422
25423 !! test
25424 Image: empty alt attribute (bug 48924)
25425 !! options
25426 parsoid
25427 !! wikitext
25428 [[File:Foobar.jpg|thumb|alt=|bar]]
25429 !! html
25430 <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>
25431 !! end
25432
25433 !! test
25434 Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
25435 !! options
25436 parsoid=html2wt
25437 language=ar
25438 disabled
25439 !! html/parsoid
25440 <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>
25441 !! wikitext
25442 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
25443 !! end
25444
25445 !! test
25446 Image: Block level image should have \n before and after
25447 !! wikitext
25448 123
25449 [[File:Foobar.jpg|right|thumb|150x150px]]
25450 456
25451 !! html/parsoid
25452 <p>123</p>
25453 <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>
25454 <p>456</p>
25455 !!end
25456
25457 !! test
25458 Image: New block level image should have \n before and after (existing content)
25459 !! wikitext
25460 123
25461 [[File:Foobar.jpg|right|thumb|150x150px]]
25462 456
25463 !! html/parsoid
25464 <p>123</p>
25465 <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>
25466 <p>456</p>
25467 !!end
25468
25469 !! test
25470 Image: upright option (parsoid)
25471 !! wikitext
25472 [[File:Foobar.jpg|thumb|upright|caption]]
25473 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
25474 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
25475 !! html/parsoid
25476 <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>
25477 <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>
25478 <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>
25479 !!end
25480
25481 !! test
25482 Image: upright option is ignored on inline and frame images (parsoid)
25483 !! wikitext
25484 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
25485 !! html/parsoid
25486 <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>
25487 !!end
25488
25489 !! test
25490 Image: from basic HTML (1)
25491 !! options
25492 parsoid=html2wt
25493 !! html/parsoid
25494 <span typeof="mw:Image">
25495 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
25496 </span>
25497 !! wikitext
25498 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
25499 !! end
25500
25501 !! test
25502 Image: from basic HTML (2)
25503 !! options
25504 parsoid=html2wt
25505 !! html/parsoid
25506 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
25507 !! wikitext
25508 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
25509 !! end
25510
25511 !! test
25512 Image: from basic HTML (3)
25513 !! options
25514 parsoid=html2wt
25515 !! html/parsoid
25516 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
25517 !! wikitext
25518 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
25519 !! end
25520
25521 !! test
25522 Image: from basic HTML (4)
25523 !! options
25524 parsoid=html2wt
25525 !! html/parsoid
25526 <img src="./File:Foobar.jpg">
25527 !! wikitext
25528 [[File:Foobar.jpg|link=]]
25529 !! end
25530
25531 !! test
25532 Image: Invalid title as link
25533 !! wikitext
25534 [[File:Foobar.jpg|link=<]]
25535 !! html/php
25536 <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>
25537 </p>
25538 !! html/parsoid
25539 <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>
25540 !! end
25541
25542 !! test
25543 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
25544 !! options
25545 parsoid=html2wt
25546 !! html/parsoid
25547 <ul>
25548 <li><p>foo</p></li>
25549 </ul>
25550 !! wikitext
25551 * foo
25552 !! end
25553
25554 !! test
25555 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
25556 !! options
25557 parsoid=html2wt
25558 !! html/parsoid
25559 <ul> <li>foo</li></ul>
25560 !! wikitext
25561 * foo
25562 !! end
25563
25564 !! test
25565 Don't strip leading whitespace when handling indent-pre suppressing tags
25566 !! options
25567 parsoid=html2wt
25568 !! html/parsoid
25569 <table>
25570 <tr><td> indented row</td></tr>
25571 </table>
25572 <blockquote><p>
25573 <b>This is very bold of you!</b>
25574 </p>
25575 <table><tr><td>
25576 indented cell (no pre-wrapping!)
25577 </td></tr></table>
25578 </blockquote>
25579 <p>foo</p>
25580 <div>bar</div>
25581 !! wikitext
25582 {|
25583 | indented row
25584 |}
25585 <blockquote>
25586 '''This is very bold of you!'''
25587
25588 {|
25589 |
25590 indented cell (no pre-wrapping!)
25591 |}
25592 </blockquote>
25593 foo
25594 <div>bar</div>
25595 !! end
25596
25597 !! test
25598 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
25599 !! options
25600 parsoid=html2wt
25601 !! html/parsoid
25602 <p>foo</p>
25603 <span>bar</span>
25604
25605 <span>foo2
25606 </span>bar2
25607
25608 <div>foo</div>
25609 <span>bar</span>
25610
25611 <div>
25612 <span>foo</span>
25613 </div>
25614 !! wikitext
25615 foo
25616
25617 <span>bar</span>
25618
25619 <span>foo2
25620 <nowiki> </nowiki></span>bar2
25621
25622 <div>foo</div>
25623 <nowiki> </nowiki><span>bar</span>
25624
25625 <div>
25626 <nowiki> </nowiki><span>foo</span>
25627 </div>
25628 !! end
25629
25630 !! test
25631 Lists: Dont insert newlines in a serialized list item.
25632 !! options
25633 parsoid=html2wt
25634 !! html/parsoid
25635 <ul><li>a<br>b</li><li>c</li></ul>
25636 !! wikitext
25637 * a<br>b
25638 * c
25639 !! end
25640
25641 !! test
25642 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
25643 !! options
25644 parsoid={
25645 "modes": ["html2wt"],
25646 "scrubWikitext": false
25647 }
25648 !! html/parsoid
25649 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
25650 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
25651
25652 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
25653 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
25654
25655 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
25656
25657 <h2><meta property="mw:PageProp/toc" /> ok</h2>
25658 !! wikitext
25659 == hello there [[Category:A1]] ==
25660
25661 == [[Category:A2]] hi pal ==
25662
25663 == <!--foo--> [[Category:A3]] how goes it ==
25664
25665 == it goes well [[Category:A4]] <!--bar--> ==
25666
25667 ==howdy [[Category:A5]]==
25668
25669 == __TOC__ ok ==
25670 !! end
25671
25672 !! test
25673 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
25674 !! options
25675 parsoid={
25676 "modes": ["html2wt"],
25677 "scrubWikitext": true
25678 }
25679 !! html/parsoid
25680 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
25681 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
25682
25683 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
25684 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
25685
25686 <h2><meta property="mw:PageProp/toc" /> ok</h2>
25687 !! wikitext
25688 == hello there ==
25689 [[Category:A1]]
25690 [[Category:A2]]
25691
25692 == hi pal ==
25693
25694 <!--foo--> [[Category:A3]]
25695
25696 == how goes it ==
25697
25698 == it goes well ==
25699 [[Category:A4]] <!--bar-->
25700
25701 __TOC__
25702
25703 == ok ==
25704 !! end
25705
25706 !! test
25707 Headings: Don't hoist metas that come from templates
25708 !! options
25709 parsoid={
25710 "modes": ["html2wt"],
25711 "scrubWikitext": true
25712 }
25713 !! html/parsoid
25714 <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>
25715 !! wikitext
25716 == {{echo|foo [[Category:Foo]]}} ==
25717 !! end
25718
25719 !! test
25720 Headings: Category in ref isn't hoisted
25721 !! options
25722 parsoid={
25723 "modes": ["html2wt"],
25724 "scrubWikitext": true
25725 }
25726 !! html/parsoid
25727 <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>
25728
25729 <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>
25730 !! wikitext
25731 == foo <ref>bar
25732 [[Category:Baz]] </ref> ==
25733
25734 <references />
25735 !! end
25736
25737 !! test
25738 Parsoid: Serialize positional parameters with = in them as named parameter
25739 !! options
25740 parsoid=html2wt
25741 !! html/parsoid
25742 <p about="#mwt1" typeof="mw:Transclusion"
25743 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
25744
25745 <p about="#mwt1" typeof="mw:Transclusion"
25746 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
25747
25748 <!--Orig params with data-parsoid has heuristics for handling = chars-->
25749 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
25750 <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>
25751 !! wikitext
25752 {{echo|1=f=oo}}
25753
25754 {{echo|1=f=oo|2=bar}}
25755
25756 <!--Orig params with data-parsoid has heuristics for handling = chars-->
25757 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
25758 {{echo|<nowiki>f=oo</nowiki>|bar}}
25759 !! end
25760
25761 !! test
25762 Parsoid: Serialize positional parameters with = in extlink as named parameter
25763 !! options
25764 parsoid=html2wt
25765 !! html/parsoid
25766 <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>
25767 !! wikitext
25768 {{echo|1=http://stuff?is=ok}}
25769 !! end
25770
25771 !! test
25772 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
25773 !! options
25774 parsoid=html2wt
25775 !! html/parsoid
25776 <div>a<p>b</p></div>
25777 <div>a
25778 <p>b</p></div>
25779 <div>
25780 a
25781 <p>b</p></div>
25782 !! wikitext
25783 <div>a
25784 b
25785 </div>
25786 <div>a
25787 b
25788 </div>
25789 <div>
25790 a
25791
25792 b
25793 </div>
25794 !! end
25795
25796 !! test
25797 Substrings resembling wikitext in hrefs should not get nowiki escapes
25798 !! options
25799 parsoid=html2wt
25800 !! html/parsoid
25801 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
25802 !! wikitext
25803 [[Foo''bar''baz]]
25804 !! end
25805
25806 !! test
25807 Enforce single-line context in the serializer
25808 !! options
25809 parsoid=html2wt
25810 !! html/parsoid
25811 <h2>testing
25812 123</h2>
25813
25814 <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">
25815 </span><span about="#mwt1">you</span> </h2>
25816
25817 <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>
25818
25819 <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
25820 there</span></li></ol>
25821
25822 <ul><li>asd
25823 sdf</li></ul>
25824
25825 <ul><li>foo
25826 bar
25827 baz</li>
25828 <li>foo <b>bar</b>
25829 baz</li></ul>
25830
25831 <dl><dt>hi
25832 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
25833 ho</dd></dl>
25834
25835 <dl><dd> <table>
25836 <tbody><tr><td> ha
25837 ha
25838 ha</td></tr>
25839 </tbody></table></dd></dl>
25840 !! wikitext
25841 == testing 123 ==
25842
25843 == hi {{bogus|there
25844 you}} ==
25845
25846 == foo <ref>hello
25847 there</ref> ==
25848
25849 <references />
25850
25851 * asd sdf
25852
25853 * foo bar baz
25854 * foo '''bar''' baz
25855
25856 ; hi ho : hi ho
25857
25858 : {|
25859 | ha
25860 ha
25861 ha
25862 |}
25863 !! end
25864
25865 !! test
25866 Serialize new placeholder space without spans
25867 !! options
25868 parsoid=html2wt
25869 !! html/parsoid
25870 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
25871
25872 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
25873
25874 <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>
25875 !! wikitext
25876 foo : bar
25877
25878 foo : bar
25879
25880 <ref>foo : bar</ref>ok
25881 !! end
25882
25883
25884 #-----------------------
25885 # Tag minimization tests
25886 #-----------------------
25887
25888 !! test
25889 1. I/B quote minimization: wikitext-only tags should be combined
25890 !! options
25891 parsoid=html2wt
25892 !! html/parsoid
25893 <p><i>A</i><i>B</i></p>
25894 <p><b>A</b><b>B</b></p>
25895 <p><i>A</i><b><i>B</i></b></p>
25896 <p><b>A</b><i><b>B</b></i></p>
25897 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
25898 <p><i><b>A</b></i><i><b>B</b></i></p>
25899 <p><i><b>A</b></i><b><i>B</i></b></p>
25900 <p><b><i>A</i></b><i><b>B</b></i></p>
25901 !! wikitext
25902 ''AB''
25903
25904 '''AB'''
25905
25906 ''A'''B'''''
25907
25908 '''A''B'''''
25909
25910 '''A''BC''D'''
25911
25912 '''''AB'''''
25913
25914 '''''AB'''''
25915
25916 '''''AB'''''
25917 !! end
25918
25919 !! test
25920 2. I/B quote minimization: wikitext and html tags should not be combined
25921 !! options
25922 parsoid=html2wt
25923 !! html/parsoid
25924 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
25925 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
25926 !! wikitext
25927 ''A''<i>B</i>
25928
25929 ''A''<nowiki/>'''<i>B</i>'''
25930 !! end
25931
25932 !! test
25933 3. I/B quote minimization: templated content stops minimization
25934 !! options
25935 parsoid=html2wt
25936 !! html/parsoid
25937 <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>
25938 <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>
25939 !! wikitext
25940 ''A''{{echo|''B''}}
25941
25942 ''A''{{echo|'''''B'''''}}
25943 !! end
25944
25945 !! test
25946 4. I/B quote minimization: new content should be mimimized with adjacent old content
25947 !! options
25948 parsoid=html2wt
25949 !! html/parsoid
25950 <p><i>A</i><i>B</i></p>
25951 <p><b>A</b><b>B</b></p>
25952 <p><i>A</i><b><i>B</i></b></p>
25953 !! wikitext
25954 ''AB''
25955
25956 '''AB'''
25957
25958 ''A'''B'''''
25959 !! end
25960
25961 !! test
25962 5a. Merge adjacent quote nodes if they've been edited
25963 !! options
25964 parsoid={
25965 "modes": ["wt2wt", "selser"],
25966 "changes": [
25967 ["p", "contents", "remove", ":contains('b')"]
25968 ]
25969 }
25970 !! wikitext
25971 ''a''b''c''
25972 !! wikitext/edited
25973 ''ac''
25974 !! end
25975
25976 !! test
25977 5b. Merge adjacent quote nodes if they've been edited
25978 !! options
25979 parsoid={
25980 "modes": ["wt2wt", "selser"],
25981 "changes": [
25982 ["#x", "remove"]
25983 ]
25984 }
25985 !! wikitext
25986 ''a''<span id="x">b</span>''c''
25987 !! wikitext/edited
25988 ''ac''
25989 !! end
25990
25991 !! test
25992 1. Merge adjacent link nodes as long as at least one element is new
25993 !! options
25994 parsoid={
25995 "modes": ["html2wt"],
25996 "scrubWikitext": true
25997 }
25998 !! html/parsoid
25999 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26000 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26001 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
26002 !! wikitext
26003 [[Football]]
26004 [[Football]]
26005 [[Football|Foot]][[Football|ball]]
26006 !! end
26007
26008 !! test
26009 2. Merge adjacent link nodes and enable additional normalizations
26010 !! options
26011 parsoid={
26012 "modes": ["html2wt"],
26013 "scrubWikitext": true
26014 }
26015 !! html/parsoid
26016 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
26017 !! wikitext
26018 [[Football|''Football'']]
26019 !! end
26020
26021 !! test
26022 3. Don't merge adjacent link nodes if scrubWikitext is false
26023 !! options
26024 parsoid={
26025 "modes": ["html2wt"],
26026 "scrubWikitext": false
26027 }
26028 !! html/parsoid
26029 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26030 !! wikitext
26031 [[Football|Foot]][[Football|ball]]
26032 !! end
26033
26034 #------------------------------
26035 # End of tag minimization tests
26036 #------------------------------
26037
26038 !!test
26039 Bug 54262: New entities
26040 !! options
26041 parsoid=html2wt
26042 !! html/parsoid
26043 <span typeof="mw:Entity">&nbsp;</span>
26044 !! wikitext
26045 &nbsp;
26046 !! end
26047
26048 ## Note that there is no wikitext output for 'unknownproperty' ##
26049 ## Unknown magic words are silently dropped ##
26050
26051 !! test
26052 Magic words
26053 !! options
26054 parsoid=html2wt
26055 !! html/parsoid
26056 <meta property='mw:PageProp/toc' />
26057 <meta property='mw:PageProp/notoc' />
26058 <meta property='mw:PageProp/forcetoc' />
26059 <meta property='mw:PageProp/index' />
26060 <meta property='mw:PageProp/noindex' />
26061 <meta property='mw:PageProp/nogallery' />
26062 <meta property='mw:PageProp/noeditsection' />
26063 <meta property='mw:PageProp/notitleconvert' />
26064 <meta property='mw:PageProp/nocontentconvert' />
26065 <meta property='mw:PageProp/unknownproperty' />
26066 !! wikitext
26067 __TOC__
26068 __NOTOC__
26069 __FORCETOC__
26070 __INDEX__
26071 __NOINDEX__
26072 __NOGALLERY__
26073 __NOEDITSECTION__
26074 __NOTITLECONVERT__
26075 __NOCONTENTCONVERT__
26076 !! end
26077
26078 !! test
26079 Consecutive <pre>s should not get merged
26080 !! options
26081 parsoid=html2wt,html2html
26082 !! html/parsoid
26083 <pre>a</pre><pre>b</pre>
26084
26085 <pre>c
26086 </pre><pre>
26087 d</pre>
26088
26089 <pre>e
26090
26091 </pre><pre>
26092
26093 f</pre>
26094 !! wikitext
26095 a
26096
26097 b
26098
26099 c
26100
26101 d
26102
26103 e
26104
26105
26106
26107 f
26108 !! end
26109
26110 !! test
26111 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
26112 !! options
26113 parsoid=html2wt
26114 !! html/parsoid
26115 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
26116 !! wikitext
26117 [[Special:BookSources/1234567890|ISBN 1234567895]]
26118 !! end
26119
26120 !! test
26121 Edited RFC links not serializable as RFC links should serialize as extlinks
26122 !! options
26123 parsoid=html2wt
26124 !! html/parsoid
26125 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
26126 !! wikitext
26127 [//tools.ietf.org/html/rfc123 New RFC]
26128 !! end
26129
26130 !! test
26131 Edited PMID links not serializable as PMID links should serialize as extlinks
26132 !! options
26133 parsoid=html2wt
26134 !! html/parsoid
26135 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
26136 !! wikitext
26137 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
26138 !! end
26139
26140 !! test
26141 WTS of autolinks with trailing/surrounding context
26142 !! options
26143 parsoid=html2wt
26144 !! html/parsoid
26145 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
26146 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
26147 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
26148 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
26149 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
26150 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
26151 !! wikitext
26152 http://cscott.net'''foo'''
26153
26154 http://cscott.net<b>foo</b>
26155
26156 '''http://cscott.net'''
26157
26158 '''http://cscott.net '''
26159
26160 '''http://cscott.net<nowiki/>x'''
26161
26162 http://cscott.net<nowiki/>x
26163 !! end
26164
26165 !! test
26166 WTS of autolinks with nowikis (round-trip)
26167 !! wikitext
26168 x<nowiki/>http://cscott.net<nowiki/>x
26169 !! html/parsoid
26170 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
26171 !! end
26172
26173 # this is the "easy" test because it leaves in place all the
26174 # data-parsoid information indicating this is an autolink
26175 !! test
26176 WTS of autolinks with escapes (editing)
26177 !! options
26178 parsoid={
26179 "modes": ["wt2wt"],
26180 "changes": [
26181 [ "meta", "remove" ]
26182 ]
26183 }
26184 !! wikitext
26185 x<nowiki/>http://cscott.net<nowiki/>x
26186 !! wikitext/edited
26187 x<nowiki/>http://cscott.net<nowiki/>x
26188 !! end
26189
26190 !! test
26191 WTS of edited autolink-like text (T103364)
26192 !! options
26193 parsoid={
26194 "modes": ["wt2wt"],
26195 "changes": [
26196 [ "span[typeof]", "removeAttr", "typeof" ]
26197 ]
26198 }
26199 !! wikitext
26200 Not a link: <nowiki>http://example.com</nowiki>.
26201 !! wikitext/edited
26202 Not a link: <span><nowiki>http://example.com</nowiki></span>.
26203 !! end
26204
26205 !! test
26206 WTS of newly-authored autolink-like text (T103364)
26207 !! options
26208 parsoid=html2wt
26209 !! html/parsoid
26210 <p>http://example.com is not a link.</p>
26211 !! wikitext
26212 <nowiki>http://example.com</nowiki> is not a link.
26213 !! end
26214
26215 !! test
26216 WTS of autolink-like text after an autolink (T108563)
26217 !! options
26218 parsoid=html2wt
26219 !! html/parsoid
26220 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
26221 !! wikitext
26222 http://example.com <nowiki>http://example.com</nowiki> is not a link.
26223 !! end
26224
26225 !! test
26226 Magic links inside links (not autolinked)
26227 !! wikitext
26228 [[Foo|http://example.com]]
26229 [[Foo|RFC 1234]]
26230 [[Foo|PMID 1234]]
26231 [[Foo|ISBN 123456789x]]
26232
26233 [http://foo.com http://example.com]
26234 [http://foo.com RFC 1234]
26235 [http://foo.com PMID 1234]
26236 [http://foo.com ISBN 123456789x]
26237 !! html+tidy
26238 <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>
26239 <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>
26240 !! html/parsoid
26241 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
26242 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
26243 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
26244 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
26245
26246 <p><a rel="mw:ExtLink" href="http://foo.com">http://example.com</a>
26247 <a rel="mw:ExtLink" href="http://foo.com">RFC 1234</a>
26248 <a rel="mw:ExtLink" href="http://foo.com">PMID 1234</a>
26249 <a rel="mw:ExtLink" href="http://foo.com">ISBN 123456789x</a></p>
26250 !! end
26251
26252 !! test
26253 Magic links inside image captions (autolinked)
26254 !! wikitext
26255 [[File:Foobar.jpg|thumb|http://example.com]]
26256 [[File:Foobar.jpg|thumb|RFC 1234]]
26257 [[File:Foobar.jpg|thumb|PMID 1234]]
26258 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
26259 !! html+tidy
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 rel="nofollow" class="external free" href="http://example.com">http://example.com</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 class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a></div>
26272 </div>
26273 </div>
26274 <div class="thumb tright">
26275 <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>
26276 <div class="thumbcaption">
26277 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26278 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a></div>
26279 </div>
26280 </div>
26281 <div class="thumb tright">
26282 <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>
26283 <div class="thumbcaption">
26284 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26285 <a href="/wiki/Special:BookSources/123456789X" class="internal mw-magiclink-isbn">ISBN 123456789x</a></div>
26286 </div>
26287 </div>
26288 !! html/parsoid
26289 <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>
26290 <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>
26291 <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>
26292 <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>
26293 !! end
26294
26295 !! test
26296 WTS of magic word text (T109371)
26297 !! options
26298 parsoid=html2wt
26299 !! html/parsoid
26300 <p>RFC 1234</p>
26301 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
26302 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
26303 !! wikitext
26304 <nowiki>RFC 1234</nowiki>
26305
26306 [http://foo.com RFC 1234]
26307
26308 [[Foo|RFC 1234]]
26309 !! end
26310
26311 !! test
26312 Edited Redirect link should emit a non-piped wikitext link
26313 !! options
26314 parsoid=html2wt
26315 !! html/parsoid
26316 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
26317 !! wikitext
26318 #REDIRECT [[Bar]]
26319 !! end
26320
26321 !! test
26322 T75121: Infer extension name from typeOf if data-mw is not present
26323 !! options
26324 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26325 !! html/parsoid
26326 <div typeOf="mw:Extension/foo"></div>
26327 !! wikitext
26328 <foo />
26329 !! end
26330
26331 # Note that the <p> wrapping isn't present in PHP parser output
26332 # The important thing for this test is that P-wrapping doesn't
26333 # interfere with the <nowiki> protection for leading - in <td>
26334 # (which isn't necessary for <th>).
26335 !! test
26336 T88318: p-wrapped dash in table.
26337 !! options
26338 parsoid=html2wt,wt2wt
26339 !! html/parsoid
26340 <table><tbody>
26341 <tr><th><p>-</p></th><th><p>- </p></th></tr>
26342 <tr><td><p>-</p></td><td><p>- </p></td></tr>
26343 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
26344 </tbody></table>
26345 !! wikitext
26346 {|
26347 !-
26348 !-
26349 |-
26350 |<nowiki>-</nowiki>
26351 |<nowiki>- </nowiki>
26352 |-
26353 |<small>-</small>
26354 |<br>
26355 -
26356 |<br>
26357 -
26358 |}
26359 !! html/php+tidy
26360 <table>
26361 <tr>
26362 <th>-</th>
26363 <th>-</th>
26364 </tr>
26365 <tr>
26366 <td>-</td>
26367 <td>-</td>
26368 </tr>
26369 <tr>
26370 <td><small>-</small></td>
26371 <td><br />
26372 <p>-</p>
26373 </td>
26374 <td><br />
26375 <p>-</p>
26376 </td>
26377 </tr>
26378 </table>
26379 !! end
26380
26381 !! test
26382 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
26383 !! options
26384 parsoid=html2wt
26385 !! html/parsoid
26386 <table id='mwAb'>
26387 <td id='mwAc'>foo</td>
26388 <td id='serialize-this'>bar</td>
26389 </table>
26390 !! wikitext
26391 {|
26392 |foo
26393 | id="serialize-this" |bar
26394 |}
26395 !! end
26396
26397 !! test
26398 Parsoid-like element ids should not be serialized to wikitext unless shadowed
26399 !! options
26400 parsoid=html2wt
26401 !! html/parsoid
26402 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
26403 !! wikitext
26404 <div id="hello">ok</div>
26405 !! end
26406
26407 !! test
26408 WTS change modes
26409 !! options
26410 parsoid={
26411 "modes": ["wt2wt"],
26412 "changes": [
26413 [ "#xyz", "before", "<b>before</b> stuff " ],
26414 [ "#xyz", "after", " stuff <i>after</i>" ],
26415 [ "#xyz", "html", "x <b>y</b> z" ]
26416 ]
26417 }
26418 !! wikitext
26419 <span id="xyz">hello</span>
26420 !! wikitext/edited
26421 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
26422 !! end
26423
26424 !! test
26425 Never serialize a-tag as html, regardless of what data-parsoid has to say
26426 !! options
26427 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26428 !! html/parsoid
26429 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
26430 !! wikitext
26431 [[Foo]]
26432 !! end
26433
26434 ## SSS FIXME: This is broken output nevertheless.
26435 ## What might be a reasonable non-broken output for this?
26436 ## This is an edge case unlikely to be seen in production
26437 ## that I am not wasting more time on this right now.
26438 !! test
26439 Never serialize a-tag as html, no matter what attributes it has
26440 !! options
26441 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26442 !! html/parsoid
26443 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
26444 !! wikitext
26445 [http://boo.org http://boohoo.org]
26446 !! end
26447
26448 # Misnested is an indication that selser can reuse the source but these have
26449 # shown to sneak through on occasion. See T101768.
26450 # The original wikitext here is: [http://test.com [[one]] two three]
26451 !! test
26452 Strip span tags added to mark misnested links
26453 !! options
26454 parsoid=html2wt
26455 !! html/parsoid
26456 <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>
26457 !! wikitext
26458 [http://test.com][[one]] two three
26459 !! end
26460
26461 !! test
26462 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
26463 !! options
26464 parsoid=html2wt
26465 !! html/parsoid
26466 <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|}"]}'>
26467 <tbody><tr><td>d
26468 </td></tr>
26469 </tbody></table>
26470 !! wikitext
26471 {{echo|a}}
26472 {|{{echo|c
26473 {{!}}d
26474 }}
26475 |}
26476 !! end
26477
26478 ## This test verifies the presence and computation of this attribute indirectly
26479 ## by making an edit and ensuring that the serialization is correct (which it would be
26480 ## only if firstWikitextNode is properly set).
26481 !! test
26482 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
26483 !! options
26484 parsoid= {
26485 "modes": ["wt2wt"],
26486 "changes": [
26487 [ "div#x", "remove" ],
26488 [ "div", "before", "<div>new</div>" ]
26489 ]
26490 }
26491 !! wikitext
26492 <div id="x">foo</div>
26493 {|
26494 {{echo|<div>boo</div>
26495 {{!}}b}}
26496 |c
26497 |}
26498 !! wikitext/edited
26499
26500 <div>new</div>
26501 {|
26502 {{echo|<div>boo</div>
26503 {{!}}b}}
26504 |c
26505 |}
26506 !! end
26507
26508 # --------------------------------------------
26509 # Tests spec'ing wikitext serialization norms |
26510 # --------------------------------------------
26511
26512 !! test
26513 1. Categories should always be serialized on their own line
26514 !! options
26515 parsoid=html2wt
26516 !! html/parsoid
26517 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
26518 !! wikitext
26519 foo
26520 [[Category:Foo]]
26521 bar
26522 !! end
26523
26524 !! test
26525 2. Categories that are part of templates should not introduce a line break
26526 !! wikitext
26527 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
26528 !! html/parsoid
26529 <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>
26530 !! end
26531
26532 # Careful while editing these next 2 tests. There are \u200f characters
26533 # before and after the <link> tags in the HTML and following some
26534 # of the categories in wikitext
26535 # Do not remove these characters in edits.
26536 #
26537 # As part of the serialization, these bidi characters will get stripped.
26538 !! test
26539 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
26540 !! options
26541 parsoid={
26542 "modes": ["html2wt"],
26543 "scrubWikitext": true
26544 }
26545 !! html/parsoid
26546 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
26547 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
26548 !! wikitext
26549 [[קטגוריה:טקסים]]
26550 [[קטגוריה: שיטות משפט]]
26551 !! end
26552
26553 !! test
26554 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
26555 !! options
26556 parsoid={
26557 "modes": ["html2wt"],
26558 "scrubWikitext": true
26559 }
26560 !! html/parsoid
26561 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
26562 !! wikitext
26563 [[קטגוריה:טקסים]]
26564 ‏y
26565 !! end
26566
26567 !! test
26568 Lists: Add space after bullets
26569 !! options
26570 parsoid=html2wt
26571 !! html/parsoid
26572 <ul>
26573 <li>foo</li>
26574 <li> bar</li>
26575 <li><span> baz</span></li>
26576 </ul>
26577 !! wikitext
26578 * foo
26579 * bar
26580 * <span> baz</span>
26581 !! end
26582
26583 !! test
26584 1. Headings: Add space before/after == (T53744)
26585 !! options
26586 parsoid=html2wt
26587 !! html/parsoid
26588 <h2>foo</h2>
26589 <h2> bar</h2>
26590 <h2>baz </h2>
26591 <h2><span> baz</span></h2>
26592 !! wikitext
26593 == foo ==
26594
26595 == bar ==
26596
26597 == baz ==
26598
26599 == <span> baz</span> ==
26600 !! end
26601
26602 !! test
26603 2. Headings: Add space before/after == even after hoisted content
26604 !! options
26605 parsoid={
26606 "modes": ["html2wt"],
26607 "scrubWikitext": true
26608 }
26609 !! html/parsoid
26610 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
26611 !! wikitext
26612 [[Category:A2]]
26613
26614 == ok ==
26615 !! end
26616
26617 !! test
26618 1. Headings: suppress newly created empty headings
26619 !! options
26620 parsoid={
26621 "modes": ["html2wt"],
26622 "scrubWikitext": true
26623 }
26624 !! html/parsoid
26625 <h2></h2>
26626 !! wikitext
26627 !! end
26628
26629 !! test
26630 2. Headings: don't suppress empty headings if scrubWikitext is false
26631 !! options
26632 parsoid=html2wt
26633 !! html/parsoid
26634 <h2></h2>
26635 !! wikitext
26636 ==<nowiki/>==
26637 !! end
26638
26639 !! test
26640 3. Headings: suppress empty headings on edits
26641 !! options
26642 parsoid={
26643 "modes": ["selser"],
26644 "scrubWikitext": true,
26645 "changes": [
26646 [ "#x", "remove"]
26647 ]
26648 }
26649 !! wikitext
26650 ==<span id="x">foo</span>==
26651 !! wikitext/edited
26652 !! end
26653
26654 !! test
26655 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
26656 !! options
26657 parsoid={
26658 "modes": ["html2wt"],
26659 "scrubWikitext": true
26660 }
26661 !! html/parsoid
26662 <h2>foo<br/>bar</h2>
26663 <h2>foo <span><br/>bar</span> baz</h2>
26664 !! wikitext
26665 == foo bar ==
26666
26667 == foo <span> bar</span> baz ==
26668 !! end
26669
26670 !! test
26671 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
26672 !! options
26673 parsoid={
26674 "modes": ["html2wt"],
26675 "scrubWikitext": false
26676 }
26677 !! html/parsoid
26678 <h2>foo<br/>bar</h2>
26679 !! wikitext
26680 == foo<br> bar ==
26681 !! end
26682
26683 !! test
26684 1. WT Quote Tags: suppress newly created empty style tags
26685 !! options
26686 parsoid={
26687 "modes": ["html2wt"],
26688 "scrubWikitext": true
26689 }
26690 !! html/parsoid
26691 <i></i><b></b>
26692 !! wikitext
26693 !! end
26694
26695 !! test
26696 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
26697 !! options
26698 parsoid=html2wt
26699 !! html/parsoid
26700 <i></i><b></b>
26701 !! wikitext
26702 ''<nowiki/>'''''<nowiki/>'''
26703 !! end
26704
26705 !! test
26706 3. WT Quote Tags: suppress empty style tags on edits
26707 !! options
26708 parsoid={
26709 "modes": ["selser"],
26710 "scrubWikitext": true,
26711 "changes": [
26712 [ "#x", "remove"]
26713 ]
26714 }
26715 !! wikitext
26716 '''<span id="x">foo</span>'''
26717 !! wikitext/edited
26718 !! end
26719
26720 !! test
26721 1. Anchors: suppress newly created empty anchors
26722 !! options
26723 parsoid={
26724 "modes": ["html2wt"],
26725 "scrubWikitext": true
26726 }
26727 !! html/parsoid
26728 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
26729 !! wikitext
26730 !! end
26731
26732 !! test
26733 2. Anchors: don't suppress empty anchors if scrubWikitext is false
26734 !! options
26735 parsoid={
26736 "modes": ["html2wt"],
26737 "scrubWikitext": false
26738 }
26739 !! html/parsoid
26740 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
26741 !! wikitext
26742 [[Test|<nowiki/>]]
26743 !! end
26744
26745 !! test
26746 3. Anchors: suppress empty anchors on edits
26747 !! options
26748 parsoid={
26749 "modes": ["selser"],
26750 "scrubWikitext": true,
26751 "changes": [
26752 [ "#x", "remove"]
26753 ]
26754 }
26755 !! wikitext
26756 [[Test|<span id="x">foo</span>]]
26757 !! wikitext/edited
26758 !! end
26759
26760 !! test
26761 3a. Anchors: do not suppress numbered extlinks
26762 !! options
26763 parsoid={
26764 "modes": ["wt2wt"],
26765 "scrubWikitext": true
26766 }
26767 !! wikitext
26768 [http://foo.com]
26769 !! html/parsoid
26770 <a rel="mw:ExtLink" href="http://foo.com"></a>
26771 !! end
26772
26773 !! test
26774 3b. Anchors: do not suppress numbered extlinks
26775 !! options
26776 parsoid={
26777 "modes": ["wt2wt"],
26778 "scrubWikitext": true,
26779 "changes": [
26780 [ "#x", "remove"]
26781 ]
26782 }
26783 !! wikitext
26784 [http://foo.com <span id="x">foo</span>]
26785 !! wikitext/edited
26786 [http://foo.com]
26787 !! end
26788
26789 !!test
26790 Normalizations should be restricted to edited content
26791 !!options
26792 parsoid={
26793 "modes": ["selser"],
26794 "scrubWikitext": true,
26795 "changes": [
26796 [ "h1", "before", "<i></i>"]
26797 ]
26798 }
26799 !!wikitext
26800 a
26801 = =
26802 b
26803 !!wikitext/edited
26804 a
26805 = =
26806 b
26807 !!end
26808
26809 !! test
26810 1. Multiple normalizations (html2wt)
26811 !! options
26812 parsoid={
26813 "modes": ["html2wt"],
26814 "scrubWikitext": true
26815 }
26816 !! html
26817 <h2><i></i></h2>
26818 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
26819 </a><b><i></i></b>x</p>
26820 !! wikitext
26821
26822 [[foo]]
26823 x
26824
26825 !! end
26826
26827 !! test
26828 2. Multiple normalizations (selser)
26829 !! options
26830 parsoid={
26831 "modes": ["selser"],
26832 "scrubWikitext": true,
26833 "changes": [
26834 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
26835 ]
26836 }
26837 !! wikitext
26838 <span id="x">foo</span>
26839 !! wikitext/edited
26840 <span id="x">foo</span>
26841
26842 x
26843 !! end
26844
26845 !! test
26846 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
26847 !! options
26848 parsoid={
26849 "modes": ["html2wt"],
26850 "scrubWikitext": true
26851 }
26852 !! html/parsoid
26853 <p> hi</p>
26854 <p> hello</p>
26855 !! wikitext
26856 hi
26857
26858 hello
26859 !! end
26860
26861 !! test
26862 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
26863 !! options
26864 parsoid=html2wt
26865 !! html/parsoid
26866 <p> hi</p>
26867 <p> hello</p>
26868 !! wikitext
26869 <nowiki> </nowiki>hi
26870
26871 <nowiki> </nowiki> hello
26872 !! end
26873
26874 !! test
26875 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
26876 !! options
26877 parsoid={
26878 "modes": ["html2wt"],
26879 "scrubWikitext": true
26880 }
26881 !! html/parsoid
26882 <p>Foo
26883 bar
26884 baz</p>
26885
26886 <table><tr><td>Foo
26887 bar
26888 baz bang</td></tr></table>
26889
26890 <p><!--boo--> foo
26891 bar</p>
26892
26893 <p> foo
26894 bar<span>boo</span></p>
26895 !! wikitext
26896 Foo
26897 bar
26898 baz
26899
26900 {|
26901 |Foo
26902 bar
26903 baz bang
26904 |}
26905
26906 <!--boo-->foo
26907 bar
26908
26909 foo
26910 bar<span>boo</span>
26911 !! end
26912
26913 !! test
26914 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
26915 !! options
26916 parsoid={
26917 "modes": ["selser"],
26918 "scrubWikitext": true,
26919 "changes": [
26920 [ "p", "html", " a\n b" ]
26921 ]
26922 }
26923 !! wikitext
26924 xyz
26925 !! wikitext/edited
26926 a
26927 b
26928 !! end
26929
26930 !! test
26931 1. New links that end in spaces
26932 !! options
26933 parsoid={
26934 "modes": ["html2wt"],
26935 "scrubWikitext": false
26936 }
26937 !! html/parsoid
26938 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
26939 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
26940 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
26941 !! wikitext
26942 [[Berlin ]]<nowiki/>is the capital of Germany.
26943
26944 [[Foo ]]'''bar'''
26945
26946 [[Boston ]] is a city.
26947 !! end
26948
26949 !! test
26950 2. New links that end in spaces
26951 !! options
26952 parsoid={
26953 "modes": ["html2wt"],
26954 "scrubWikitext": true
26955 }
26956 !! html/parsoid
26957 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
26958 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
26959 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
26960 !! wikitext
26961 [[Berlin]] is the capital of Germany.
26962
26963 [[Foo]] '''bar'''
26964
26965 [[Boston]] is a city.
26966 !! end
26967
26968 !! test
26969 1. Table cells with escapable prefixes
26970 !! options
26971 parsoid={
26972 "modes": ["html2wt"],
26973 "scrubWikitext": false
26974 }
26975 !! html
26976 <table>
26977 <tr><td>a</td></tr>
26978 <tr><td>-</td></tr>
26979 <tr><td>+</td></tr>
26980 </table>
26981 !! wikitext
26982 {|
26983 |a
26984 |-
26985 |<nowiki>-</nowiki>
26986 |-
26987 |<nowiki>+</nowiki>
26988 |}
26989 !! end
26990
26991 !! test
26992 2. Table cells with escapable prefixes
26993 !! options
26994 parsoid={
26995 "modes": ["html2wt"],
26996 "scrubWikitext": true
26997 }
26998 !! html
26999 <table>
27000 <tr><td>a</td></tr>
27001 <tr><td>-</td></tr>
27002 <tr><td>+</td></tr>
27003 </table>
27004 !! wikitext
27005 {|
27006 |a
27007 |-
27008 | -
27009 |-
27010 | +
27011 |}
27012 !! end
27013
27014 !! test
27015 3a. Table cells with escapable prefixes after edits
27016 !! options
27017 parsoid={
27018 "modes": ["selser"],
27019 "scrubWikitext": true,
27020 "changes": [
27021 [ "table tbody tr:first-child td:first-child", "remove"]
27022 ]
27023 }
27024 !! wikitext
27025 {|
27026 |a||-
27027 |}
27028 !! wikitext/edited
27029 {|
27030 | -
27031 |}
27032 !! end
27033
27034 !! test
27035 3b. Table cells with escapable prefixes after edits
27036 !! options
27037 parsoid={
27038 "modes": ["selser"],
27039 "scrubWikitext": true,
27040 "changes": [
27041 [ "table tbody tr:first-child td:first-child", "html", "-" ],
27042 [ "#x", "remove" ]
27043 ]
27044 }
27045 !! wikitext
27046 {|
27047 |pqr
27048 |<span id="x">foo</span>+
27049 |}
27050 !! wikitext/edited
27051 {|
27052 | -
27053 | +
27054 |}
27055 !! end
27056
27057 # FIXME: This test will fail because
27058 # normalization doesn't realize that the id attribute
27059 # will eliminate the escapable scenario
27060 !! test
27061 4a. Table cells without escapable prefixes after edits
27062 !! options
27063 parsoid={
27064 "modes": ["selser"],
27065 "scrubWikitext": true,
27066 "changes": [
27067 [ "#x", "html", "-" ]
27068 ]
27069 }
27070 !! wikitext
27071 {|
27072 | id="x" |abcd
27073 |}
27074 !! wikitext/edited
27075 {|
27076 | id="x" |-
27077 |}
27078 !! end
27079
27080 ## This tests normalizer's ability to discriminate between
27081 ## cells having identical content.
27082 !! test
27083 4b. Table cells without escapable prefixes after edits
27084 !! options
27085 parsoid={
27086 "modes": ["selser"],
27087 "scrubWikitext": true,
27088 "changes": [
27089 [ "td", "html", "-" ]
27090 ]
27091 }
27092 !! wikitext
27093 {|
27094 |a||b
27095 |}
27096 !! wikitext/edited
27097 {|
27098 | -||-
27099 |}
27100 !! end
27101
27102 ## This tests normalizer's ability to not be tripped by
27103 ## comments (and whitespace)
27104 !! test
27105 4c. Table cells without escapable prefixes after edits
27106 !! options
27107 parsoid={
27108 "modes": ["selser"],
27109 "scrubWikitext": true,
27110 "changes": [
27111 [ "table tbody tr td:first-child", "remove" ]
27112 ]
27113 }
27114 !! wikitext
27115 {|
27116 |-
27117 <!--foo--> |a||-
27118 |}
27119 !! wikitext/edited
27120 {|
27121 |-
27122 <!--foo--> | -
27123 |}
27124 !! end
27125
27126 ## This tests normalizer's ability to handle HTML cells
27127 !! test
27128 4d. Table cells without escapable prefixes after edits
27129 !! options
27130 parsoid={
27131 "modes": ["selser"],
27132 "scrubWikitext": true,
27133 "changes": [
27134 [ "td", "html", "-" ]
27135 ]
27136 }
27137 !! wikitext
27138 <table>
27139 <tr><td>a</td></tr>
27140 </table>
27141 !! wikitext/edited
27142 <table>
27143 <tr><td>-</td></tr>
27144 </table>
27145 !! end
27146
27147 ## T111151 Remove font elements without attributes
27148 !! test
27149 5a. font tags without attributes should be dropped in scrubWikitext mode
27150 !! options
27151 parsoid={
27152 "modes": ["html2wt"],
27153 "scrubWikitext": true
27154 }
27155 !! html
27156 <font>foo</font>
27157 <font><font>bar</font></font>
27158 <font class="x">boo</font>
27159 !! wikitext
27160 foo
27161 bar
27162 <font class="x">boo</font>
27163 !! end
27164
27165 !! test
27166 5b. font tags should not be dropped without scrubWikitext being enabled
27167 !! options
27168 parsoid={
27169 "modes": ["html2wt"],
27170 "scrubWikitext": false
27171 }
27172 !! html
27173 <font>foo</font>
27174 !! wikitext
27175 <font>foo</font>
27176 !! end
27177
27178 !! test
27179 Escape nowiki DOM elements
27180 !! options
27181 parsoid=html2wt
27182 !! html/parsoid
27183 <nowiki><i>foo</i></nowiki>
27184 !! wikitext
27185 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
27186 !! end
27187
27188 # This is meant to be an interim fix while we go about figuring out
27189 # how to not introduce these trailing <nowiki/>s in the first place.
27190 !! test
27191 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
27192 !! options
27193 parsoid=html2wt
27194 !! html/parsoid
27195 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
27196 y</p>
27197 <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>
27198 <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>
27199 !! wikitext
27200 x
27201 y
27202
27203 {{echo|
27204 1 = <nowiki/>}}
27205
27206 {{echo|
27207 1 = <nowiki/>
27208 }}
27209 !! end
27210
27211 # ---------------------------------------------------
27212 # End of tests spec'ing wikitext serialization norms |
27213 # ---------------------------------------------------
27214
27215 # T104032
27216 !! test
27217 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
27218 !! options
27219 parsoid=html2wt
27220 !! html/parsoid
27221 a<p>b</p>
27222 <b>c</b><p>d</p>
27223 <table><tr>
27224 <td>a<p>b</p></td>
27225 <td><b>c</b><p>d</p></td>
27226 </tr></table>
27227 !! wikitext
27228 a
27229
27230 b
27231
27232 '''c'''
27233
27234 d
27235 {|
27236 |a
27237 b
27238 |'''c'''
27239 d
27240 |}
27241 !! end
27242
27243 # -----------------------------------------------------------------
27244 # End of section for Parsoid-only html2wt tests for serialization
27245 # of new content
27246 # -----------------------------------------------------------------
27247
27248 # -----------------------------------------------------------------
27249 # The following section of tests are primarily to spec behavior of
27250 # the selective serializer. All these tests have manual selser
27251 # changes. The automated selser changes for all tests handle the
27252 # wide variation of changes, but these tests here capture specs
27253 # deterministically.
27254 # ----------------------------------------------------------------
27255
27256 ## T90517
27257 !! test
27258 Selser: New comments should not be lost
27259 !! options
27260 parsoid={
27261 "modes": ["selser"],
27262 "changes": [
27263 [ "#a", "after", "<!--c1-->" ],
27264 [ "#b", "before", "<!--c2-->" ]
27265 ]
27266 }
27267 !! wikitext
27268 <span id="a">a</span>
27269
27270 <span id="b">b</span>
27271 !! wikitext/edited
27272 <span id="a">a</span><!--c1-->
27273
27274 <!--c2--><span id="b">b</span>
27275 !! end
27276
27277 ## T89383
27278 !! test
27279 Selser: Check for validity of DSR before using it
27280 !! options
27281 parsoid={
27282 "modes": ["selser"],
27283 "changes": [
27284 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
27285 ]
27286 }
27287 !! wikitext
27288 <span id="a">a</span>
27289 !! wikitext/edited
27290 {{DISPLAYTITLE:foo}}
27291 <span id="a">a</span>
27292 !! end
27293
27294 !! test
27295 1. DOMDiff: Changes to <ref> content should be looked up using id
27296 !! options
27297 parsoid={
27298 "modes": ["selser"],
27299 "changes": [
27300 ["#X", "after", "bar"],
27301 ["#Y", "after", "baz"]
27302 ]
27303 }
27304 !! wikitext
27305 X <ref><span id="X">foo</span></ref>
27306 Y <ref name="a" />
27307 <references>
27308 <ref name="a"><span id="Y">foo</span></ref>
27309 </references>
27310 !! wikitext/edited
27311 X <ref><span id="X">foo</span>bar</ref>
27312 Y <ref name="a" />
27313 <references>
27314 <ref name="a"><span id="Y">foo</span>baz</ref>
27315 </references>
27316 !! end
27317
27318 !! test
27319 2. DOMDiff: Changes to <ref> content should be looked up using id
27320 !! options
27321 parsoid={
27322 "modes": ["selser"],
27323 "changes": [
27324 ["#Z", "after", "bar"]
27325 ]
27326 }
27327 !! wikitext
27328 A <ref>foo bar for a</ref>
27329 B <ref group="X" name="b" />
27330
27331 <references />
27332
27333 <references group="X">
27334 <ref name="b"><span id="Z">foo</span></ref>
27335 </references>
27336 !! wikitext/edited
27337 A <ref>foo bar for a</ref>
27338 B <ref group="X" name="b" />
27339
27340 <references />
27341
27342 <references group="X">
27343 <ref name="b"><span id="Z">foo</span>bar</ref>
27344 </references>
27345 !! end
27346
27347 !! test
27348 DOMDiff: Edits to content nested in elements with templated attributes should not be lost (T139388)
27349 !! options
27350 parsoid={
27351 "modes": ["selser"],
27352 "changes": [
27353 [ "div:first-child", "text", "bar" ]
27354 ]
27355 }
27356 !! wikitext
27357 <div style="{{1x|color:red;}}%">foo</div>
27358 !! wikitext/edited
27359 <div style="{{1x|color:red;}}%">bar</div>
27360 !! end
27361
27362 !! test
27363 Empty LI (T49673)
27364 !! wikitext
27365 * a
27366 *
27367 *
27368 * b
27369 !! html/php+tidy
27370 <ul>
27371 <li>a</li>
27372 <li class="mw-empty-elt"></li>
27373 <li class="mw-empty-elt"></li>
27374 <li>b</li>
27375 </ul>
27376 !! end
27377
27378 !! test
27379 Thumbnail output
27380 !! wikitext
27381 [[File:Thumb.png|thumb]]
27382 !! html/php+tidy
27383 <div class="thumb tright">
27384 <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>
27385 <div class="thumbcaption">
27386 <div class="magnify"><a href="/wiki/File:Thumb.png" class="internal" title="Enlarge"></a></div>
27387 </div>
27388 </div>
27389 </div>
27390 !! end
27391
27392 !! test
27393 unclosed internal link XSS (T137264)
27394 !! wikitext
27395 [[#%3Cscript%3Ealert(1)%3C/script%3E|
27396 !! html/php
27397 <p>[[#&lt;script&gt;alert(1)&lt;/script&gt;|
27398 </p>
27399 !! html/parsoid
27400 <p>[[#%3Cscript%3Ealert(1)%3C/script%3E|</p>
27401 !! end