Add dotall modifier to EDITSECTION_REGEX
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
1 # MediaWiki Parser test cases
2 # Some taken from http://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
4 #
5 # The syntax should be fairly self-explanatory.
6 #
7 # Currently supported test options:
8 # One of the following three:
9 #
10 # (default) generate HTML output
11 # pst apply pre-save transform
12 # msg apply message transform
13 #
14 # Plus any combination of these:
15 #
16 # cat add category links
17 # (ignored by Parsoid, since it emits <link>s)
18 # ill add inter-language links
19 # (ignored by Parsoid, since it emits <link>s)
20 # subpage enable subpages (disabled by default)
21 # 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 Heading with line break in nowiki
518 !! wikitext
519 == A <nowiki>B
520 C</nowiki> ==
521 !! html
522 <h2><span class="mw-headline" id="A_B.0AC">A B
523 C</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 B&#10;C">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
524
525 !! end
526
527 !! test
528 Parsing an URL
529 !! wikitext
530 http://fr.wikipedia.org/wiki/🍺
531 <!-- EasterEgg we love beer, better be able be able to link to it -->
532 !! html
533 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
534 </p>
535 !! end
536
537 # Note that the html+tidy output removes the spaces after the <li>,
538 # which is a bug (http://sourceforge.net/p/tidy/bugs/945/, etc).
539 # This is an issue for all tests with lists. We intentionally do
540 # *not* add html+tidy clauses for these, as we don't want to
541 # document/test the broken behavior. (Parsoid matches the non-tidy
542 # output in these cases.)
543
544 !! test
545 Simple list
546 !! wikitext
547 * Item 1
548 * Item 2
549 !! html
550 <ul><li> Item 1</li>
551 <li> Item 2</li></ul>
552
553 !! end
554
555 !! test
556 Italics and bold
557 !! wikitext
558 * plain
559 * plain''italic''plain
560 * plain''italic''plain''italic''plain
561 * plain'''bold'''plain
562 * plain'''bold'''plain'''bold'''plain
563 * plain''italic''plain'''bold'''plain
564 * plain'''bold'''plain''italic''plain
565 * plain''italic'''bold-italic'''italic''plain
566 * plain'''bold''bold-italic''bold'''plain
567 * plain'''''bold-italic'''italic''plain
568 * plain'''''bold-italic''bold'''plain
569 * plain''italic'''bold-italic'''''plain
570 * plain'''bold''bold-italic'''''plain
571 * plain l'''italic''plain
572 * plain l''''bold''' plain
573 !! html
574 <ul><li> plain</li>
575 <li> plain<i>italic</i>plain</li>
576 <li> plain<i>italic</i>plain<i>italic</i>plain</li>
577 <li> plain<b>bold</b>plain</li>
578 <li> plain<b>bold</b>plain<b>bold</b>plain</li>
579 <li> plain<i>italic</i>plain<b>bold</b>plain</li>
580 <li> plain<b>bold</b>plain<i>italic</i>plain</li>
581 <li> plain<i>italic<b>bold-italic</b>italic</i>plain</li>
582 <li> plain<b>bold<i>bold-italic</i>bold</b>plain</li>
583 <li> plain<i><b>bold-italic</b>italic</i>plain</li>
584 <li> plain<b><i>bold-italic</i>bold</b>plain</li>
585 <li> plain<i>italic<b>bold-italic</b></i>plain</li>
586 <li> plain<b>bold<i>bold-italic</i></b>plain</li>
587 <li> plain l'<i>italic</i>plain</li>
588 <li> plain l'<b>bold</b> plain</li></ul>
589
590 !! end
591
592 # this example taken from the [[simple:Moon]] article (bug 47326)
593 !! test
594 Italics and possessives (1)
595 !! wikitext
596 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
597 !! html
598 <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
599 </p>
600 !! end
601
602 # this example taken from [[en:Flaming Pie]] (bug 49926)
603 !! test
604 Italics and possessives (2)
605 !! wikitext
606 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
607 !! html
608 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
609 </p>
610 !! end
611
612 # this example taken from [[en:Dictionary]] (bug 49926)
613 !! test
614 Italics and possessives (3)
615 !! wikitext
616 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''.
617 !! html
618 <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>.
619 </p>
620 !! end
621
622
623 ###
624 ### 2-quote opening sequence tests
625 ###
626 !! test
627 Italics and bold: 2-quote opening sequence: (2,2)
628 !! wikitext
629 ''foo''
630 !! html
631 <p><i>foo</i>
632 </p>
633 !!end
634
635 !! test
636 Italics and bold: 2-quote opening sequence: (2,3)
637 !! wikitext
638 ''foo'''
639 !! html/*
640 <p><i>foo'</i>
641 </p>
642 !!end
643
644 !! test
645 Italics and bold: 2-quote opening sequence: (2,4)
646 !! options
647 parsoid=wt2html
648 !! wikitext
649 ''foo''''
650 !! html/*
651 <p><i>foo''</i>
652 </p>
653 !!end
654
655 # same html as previous, but wikitext adjusted to match parsoid html2wt
656 !! test
657 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
658 !! wikitext
659 ''foo<nowiki>''</nowiki>''
660 !! html
661 <p><i>foo''</i>
662 </p>
663 !! end
664
665 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
666 !! test
667 Italics and bold: 2-quote opening sequence: (2,5)
668 !! options
669 parsoid=wt2html
670 !! wikitext
671 ''foo'''''
672 !! html/php
673 <p><i>foo</i>
674 </p>
675 !! html/parsoid
676 <p><i>foo</i><b></b>
677 </p>
678 !!end
679
680 # same html as previous, but wikitext adjusted to match parsoid html2wt
681 !! test
682 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
683 !! wikitext
684 ''foo'''''<nowiki/>'''
685 !! html/php
686 <p><i>foo</i>
687 </p>
688 !! html/parsoid
689 <p><i>foo</i><b></b>
690 </p>
691 !! end
692
693
694 ###
695 ### 3-quote opening sequence tests
696 ###
697
698 !! test
699 Italics and bold: 3-quote opening sequence: (3,2)
700 !! wikitext
701 '''foo''
702 !! html/*
703 <p>'<i>foo</i>
704 </p>
705 !!end
706
707 !! test
708 Italics and bold: 3-quote opening sequence: (3,3)
709 !! wikitext
710 '''foo'''
711 !! html
712 <p><b>foo</b>
713 </p>
714 !!end
715
716 !! test
717 Italics and bold: 3-quote opening sequence: (3,4)
718 !! wikitext
719 '''foo''''
720 !! html/*
721 <p><b>foo'</b>
722 </p>
723 !!end
724
725 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
726 !! test
727 Italics and bold: 3-quote opening sequence: (3,5)
728 !! options
729 parsoid=wt2html
730 !! wikitext
731 '''foo'''''
732 !! html/php
733 <p><b>foo</b>
734 </p>
735 !! html/parsoid
736 <p><b>foo</b><i></i>
737 </p>
738 !!end
739
740 # same html as previous, but wikitext adjusted to match parsoid html2wt
741 !! test
742 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
743 !! wikitext
744 '''foo'''''<nowiki/>''
745 !! html/php
746 <p><b>foo</b>
747 </p>
748 !! html/parsoid
749 <p><b>foo</b><i></i>
750 </p>
751 !! end
752
753
754 ###
755 ### 4-quote opening sequence tests
756 ###
757
758 !! test
759 Italics and bold: 4-quote opening sequence: (4,2)
760 !! options
761 parsoid=wt2html
762 !! wikitext
763 ''''foo''
764 !! html/*
765 <p>''<i>foo</i>
766 </p>
767 !!end
768
769 # same html as previous, but wikitext adjusted to match parsoid html2wt
770 !! test
771 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
772 !! wikitext
773 <nowiki>''</nowiki>''foo''
774 !! html
775 <p>''<i>foo</i>
776 </p>
777 !! end
778
779 !! test
780 Italics and bold: 4-quote opening sequence: (4,3)
781 !! wikitext
782 ''''foo'''
783 !! html/*
784 <p>'<b>foo</b>
785 </p>
786 !!end
787
788 !! test
789 Italics and bold: 4-quote opening sequence: (4,4)
790 !! options
791 parsoid=wt2html
792 !! wikitext
793 ''''foo''''
794 !! html/*
795 <p>'<b>foo'</b>
796 </p>
797 !!end
798
799 # same html as previous, but wikitext adjusted to match parsoid html2wt
800 !! test
801 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
802 !! wikitext
803 '<nowiki/>'''foo''''
804 !! html
805 <p>'<b>foo'</b>
806 </p>
807 !! end
808
809 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
810 !! test
811 Italics and bold: 4-quote opening sequence: (4,5)
812 !! options
813 parsoid=wt2html
814 !! wikitext
815 ''''foo'''''
816 !! html/php
817 <p>'<b>foo</b>
818 </p>
819 !! html/parsoid
820 <p>'<b>foo</b><i></i>
821 </p>
822 !!end
823
824 # same html as previous, but wikitext adjusted to match parsoid html2wt
825 !! test
826 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
827 !! wikitext
828 '<nowiki/>'''foo'''''<nowiki/>''
829 !! html/php
830 <p>'<b>foo</b>
831 </p>
832 !! html/parsoid
833 <p>'<b>foo</b><i></i>
834 </p>
835 !! end
836
837
838 ###
839 ### 5-quote opening sequence tests
840 ###
841
842 !! test
843 Italics and bold: 5-quote opening sequence: (5,2)
844 !! options
845 parsoid=wt2html
846 !! wikitext
847 '''''foo''
848 !! html/*
849 <p><b><i>foo</i></b>
850 </p>
851 !!end
852
853 # same html as previous, but wikitext adjusted to match parsoid html2wt
854 !! test
855 Italics and bold: 5-quote opening sequence: (5,2+3)
856 !! wikitext
857 '''''foo'''''
858 !! html/*
859 <p><i><b>foo</b></i>
860 </p>
861 !! end
862
863 !! test
864 Italics and bold: 5-quote opening sequence: (5,3)
865 !! options
866 parsoid=wt2html
867 !! wikitext
868 '''''foo'''
869 !! html/*
870 <p><i><b>foo</b></i>
871 </p>
872 !!end
873
874 # same html as previous, but wikitext adjusted to match parsoid html2wt
875 !! test
876 Italics and bold: 5-quote opening sequence: (5,3+2)
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,4)
886 !! options
887 parsoid=wt2html
888 !! wikitext
889 '''''foo''''
890 !! html/*
891 <p><i><b>foo'</b></i>
892 </p>
893 !!end
894
895 !! test
896 Italics and bold: 5-quote opening sequence: (5,5)
897 !! wikitext
898 '''''foo'''''
899 !! html
900 <p><i><b>foo</b></i>
901 </p>
902 !!end
903
904 !! test
905 Italics and bold: 5-quote opening sequence: (5,6)
906 !! wikitext
907 '''''foo''''''
908 !! html/*
909 <p><i><b>foo'</b></i>
910 </p>
911 !! end
912
913 ###
914 ### multiple quote sequences in a line
915 ###
916 !! test
917 Italics and bold: multiple quote sequences: (2,4,2)
918 !! options
919 parsoid=wt2html
920 !! wikitext
921 ''foo''''bar''
922 !! html/*
923 <p><i>foo'<b>bar</b></i>
924 </p>
925 !!end
926
927
928 # same html as previous, but wikitext adjusted to match parsoid html2wt
929 !! test
930 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
931 !! wikitext
932 ''foo'<nowiki/>'''bar'''''
933 !! html
934 <p><i>foo'<b>bar</b></i>
935 </p>
936 !! end
937
938
939 !! test
940 Italics and bold: multiple quote sequences: (2,4,3)
941 !! options
942 parsoid=wt2html
943 !! wikitext
944 ''foo''''bar'''
945 !! html/*
946 <p><i>foo'<b>bar</b></i>
947 </p>
948 !!end
949
950
951 # same html as previous, but wikitext adjusted to match parsoid html2wt
952 !! test
953 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
954 !! wikitext
955 ''foo'<nowiki/>'''bar'''''
956 !! html
957 <p><i>foo'<b>bar</b></i>
958 </p>
959 !! end
960
961
962 !! test
963 Italics and bold: multiple quote sequences: (2,4,4)
964 !! options
965 parsoid=wt2html
966 !! wikitext
967 ''foo''''bar''''
968 !! html/*
969 <p><i>foo'<b>bar'</b></i>
970 </p>
971 !!end
972
973
974 # same html as previous, but wikitext adjusted to match parsoid html2wt
975 !! test
976 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
977 !! wikitext
978 ''foo'<nowiki/>'''bar'<nowiki/>'''''
979 !! html
980 <p><i>foo'<b>bar'</b></i>
981 </p>
982 !! end
983
984
985 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
986 !! test
987 Italics and bold: multiple quote sequences: (3,4,2)
988 !! options
989 parsoid=wt2html
990 !! wikitext
991 '''foo''''bar''
992 !! html/php
993 <p><b>foo'</b>bar
994 </p>
995 !! html/parsoid
996 <p><b>foo'</b>bar<i></i>
997 </p>
998 !!end
999
1000 # same html as previous, but wikitext adjusted to match parsoid html2wt
1001 !! test
1002 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
1003 !! options
1004 parsoid
1005 !! wikitext
1006 '''<nowiki>foo'</nowiki>'''bar''<nowiki/>''
1007 !! html/php
1008 <p><b>foo'</b>bar
1009 </p>
1010 !! html/parsoid
1011 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<i></i>
1012 </p>
1013 !! end
1014
1015
1016 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1017 !! test
1018 Italics and bold: multiple quote sequences: (3,4,3)
1019 !! options
1020 parsoid=wt2html
1021 !! wikitext
1022 '''foo''''bar'''
1023 !! html/php
1024 <p><b>foo'</b>bar
1025 </p>
1026 !! html/parsoid
1027 <p><b>foo'</b>bar<b></b>
1028 </p>
1029 !!end
1030
1031 # same html as previous, but wikitext adjusted to match parsoid html2wt
1032 !! test
1033 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
1034 !! wikitext
1035 '''<nowiki>foo'</nowiki>'''bar'''<nowiki/>'''
1036 !! html/php
1037 <p><b>foo'</b>bar
1038 </p>
1039 !! html/parsoid
1040 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<b></b>
1041 </p>
1042 !! end
1043
1044 ###
1045 ### other quote tests
1046 ###
1047 !! test
1048 Italics and bold: other quote tests: (2,3,5)
1049 !! wikitext
1050 ''this is about '''foo's family'''''
1051 !! html
1052 <p><i>this is about <b>foo's family</b></i>
1053 </p>
1054 !!end
1055
1056
1057 !! test
1058 Italics and bold: other quote tests: (2,(3,3),2)
1059 !! wikitext
1060 ''this is about '''foo's''' family''
1061 !! html
1062 <p><i>this is about <b>foo's</b> family</i>
1063 </p>
1064 !!end
1065
1066
1067 !! test
1068 Italics and bold: other quote tests: (3,2,3,2)
1069 !! options
1070 parsoid=wt2html
1071 !! wikitext
1072 '''this is about ''foo'''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 # same html as previous, but wikitext adjusted to match parsoid html2wt
1080 !! test
1081 Italics and bold: other quote tests: (3,2,3+2+2,2)
1082 !! wikitext
1083 '''this is about ''foo'''''<nowiki/>''s family''
1084 !! html
1085 <p><b>this is about <i>foo</i></b><i>s family</i>
1086 </p>
1087 !! end
1088
1089
1090 !! test
1091 Italics and bold: other quote tests: (3,2,3,3)
1092 !! wikitext
1093 '''this is about ''foo'''s family'''
1094 !! html/*
1095 <p>'<i>this is about </i>foo<b>s family</b>
1096 </p>
1097 !!end
1098
1099
1100 !! test
1101 Italics and bold: other quote tests: (3,(2,2),3)
1102 !! wikitext
1103 '''this is about ''foo's'' family'''
1104 !! html
1105 <p><b>this is about <i>foo's</i> family</b>
1106 </p>
1107 !!end
1108
1109
1110 !! test
1111 Italicized possessive
1112 !! wikitext
1113 The ''[[Main Page]]'''s talk page.
1114 !! html/php
1115 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1116 </p>
1117 !! html/parsoid
1118 <p>The <i><a rel="mw:WikiLink" href="Main_Page" title="Main Page">Main Page</a>'</i>s talk page.</p>
1119 !! end
1120
1121 !! test
1122 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
1123 (Requires tidy for PHP parser output to be fixed up)
1124 !! options
1125 parsoid=wt2html,wt2wt
1126 !! wikitext
1127 {|
1128 !''a!!''b
1129 |''a||''b
1130 |}
1131 !! html/php+tidy
1132 <table>
1133 <tr>
1134 <th><i>a</i></th>
1135 <th><i>b</i></th>
1136 <td><i>a</i></td>
1137 <td><i>b</i></td>
1138 </tr>
1139 </table>
1140 !! html/parsoid
1141 <table>
1142 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
1143 <td><i>a</i></td><td><i>b</i></td></tr>
1144 </tbody></table>
1145 !! end
1146
1147 ###
1148 ### Non-html5 tags
1149 ###
1150
1151 !! test
1152 Non-html5 tags should be accepted
1153 !! wikitext
1154 <center>''foo''</center>
1155 <big>''foo''</big>
1156 <font>''foo''</font>
1157 <strike>''foo''</strike>
1158 <tt>''foo''</tt>
1159 !! html
1160 <center><i>foo</i></center>
1161 <p><big><i>foo</i></big>
1162 <font><i>foo</i></font>
1163 <strike><i>foo</i></strike>
1164 <tt><i>foo</i></tt>
1165 </p>
1166 !! end
1167
1168 !! test
1169 <wbr> is valid wikitext (bug 52468)
1170 !! wikitext
1171 <wbr>
1172 !! html
1173 <p><wbr />
1174 </p>
1175 !! end
1176
1177 # <strike> is HTML4, <s> is HTML4/5.
1178 !! test
1179 <s> or <strike> for strikethrough
1180 !! wikitext
1181 <strike>strike</strike>
1182
1183 <s>s</s>
1184 !! html
1185 <p><strike>strike</strike>
1186 </p><p><s>s</s>
1187 </p>
1188 !! end
1189
1190 ## a not permitted
1191 ## i,b,br omitted
1192 !! test
1193 Text-level semantic html elements in wikitext
1194 !! wikitext
1195 <em>text</em>
1196 <strong>text</strong>
1197 <small>text</small>
1198 <s>text</s>
1199 <cite>text</cite>
1200 <q>text</q>
1201 <dfn>text</dfn>
1202 <abbr>text</abbr>
1203 <data>text</data>
1204 <time>text</time>
1205 <code>text</code>
1206 <var>text</var>
1207 <samp>text</samp>
1208 <kbd>text</kbd>
1209 <sub>text</sub>
1210 <u>text</u>
1211 <mark>text</mark>
1212 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1213 <bdi>text</bdi>
1214 <bdo>text</bdo>
1215 <span>text</span>
1216 <wbr />
1217 !! html
1218 <p><em>text</em>
1219 <strong>text</strong>
1220 <small>text</small>
1221 <s>text</s>
1222 <cite>text</cite>
1223 <q>text</q>
1224 <dfn>text</dfn>
1225 <abbr>text</abbr>
1226 <data>text</data>
1227 <time>text</time>
1228 <code>text</code>
1229 <var>text</var>
1230 <samp>text</samp>
1231 <kbd>text</kbd>
1232 <sub>text</sub>
1233 <u>text</u>
1234 <mark>text</mark>
1235 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1236 <bdi>text</bdi>
1237 <bdo>text</bdo>
1238 <span>text</span>
1239 <wbr />
1240 </p>
1241 !! end
1242
1243 # test cases taken from
1244 # http://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
1245 !! test
1246 Ruby markup (W3C-style)
1247 !! wikitext
1248 ; Mono-ruby for individual base characters
1249 : <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
1250 ; Group ruby
1251 : <ruby>今日<rt>きょう</rt></ruby>
1252 ; Jukugo ruby
1253 : <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
1254 ; Inline ruby
1255 : <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
1256 ; Double-sided ruby
1257 : <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
1258 <ruby>
1259 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1260 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1261 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1262 </ruby>
1263 !! html
1264 <dl><dt> Mono-ruby for individual base characters</dt>
1265 <dd> <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1266 <dt> Group ruby</dt>
1267 <dd> <ruby>今日<rt>きょう</rt></ruby></dd>
1268 <dt> Jukugo ruby</dt>
1269 <dd> <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1270 <dt> Inline ruby</dt>
1271 <dd> <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1272 <dt> Double-sided ruby</dt>
1273 <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>
1274 <p><ruby>
1275 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1276 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1277 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1278 </ruby>
1279 </p>
1280 !! end
1281
1282 # The next two test different paths in the sanitizer.
1283 !! test
1284 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
1285 !! wikitext
1286 <blockquote|>a</blockquote>
1287
1288 <b→> doesn't terminate </b→>
1289
1290 <bä> doesn't terminate </bä>
1291
1292 <boo> doesn't terminate </boo>
1293
1294 <s.foo> doesn't terminate </s.foo>
1295
1296 <sub-ID#1>
1297 !! html
1298 <p>&lt;blockquote|&gt;a&lt;/blockquote&gt;
1299 </p><p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1300 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1301 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1302 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1303 </p><p>&lt;sub-ID#1&gt;
1304 </p>
1305 !! end
1306
1307 # There is a tidy bug here: http://sourceforge.net/p/tidy/bugs/946/
1308 # If the non-word-character tag made it through the sanitizer, tidy
1309 # would munge it up.
1310 !! test
1311 Non-word characters don't terminate tag names + tidy
1312 !! wikitext
1313 <blockquote|>a</blockquote>
1314
1315 <b→> doesn't terminate </b→>
1316
1317 <bä> doesn't terminate </bä>
1318
1319 <boo> doesn't terminate </boo>
1320
1321 <s.foo> doesn't terminate </s.foo>
1322
1323 <sub-ID#1>
1324 !! html+tidy
1325 <p>&lt;blockquote|&gt;a</p>
1326 <p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;</p>
1327 <p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;</p>
1328 <p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;</p>
1329 <p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;</p>
1330 <p>&lt;sub-ID#1&gt;</p>
1331 !! end
1332
1333 ###
1334 ### See tests/parser/parserTestsParserHook.php for the <tåg> extension)
1335 ### This checks that HTML5 tags (with non-word characters in the tag
1336 ### name) make it safely through the parser -- the Sanitizer will
1337 ### munge them later, as it should.
1338 ###
1339 !! test
1340 Non-word characters are valid in extension tags (T19663)
1341 !! wikitext
1342 <tåg>tåg</tåg>
1343 !! html/php
1344 <pre>
1345 'tåg'
1346 array (
1347 )
1348 </pre>
1349
1350 !! html/parsoid
1351 <pre typeof="mw:Extension/tåg" data-mw='{"name":"tåg","attrs":{},"body":{"extsrc":"tåg"}}' data-parsoid='{}' about="#mwt2"></pre>
1352 !! end
1353
1354 !! test
1355 Isolated close tags should be treated as literal text (bug 52760)
1356 !! options
1357 parsoid=wt2html
1358 !! wikitext
1359 </b>
1360
1361 <s.foo>s</s>
1362 !! html/php+tidy
1363 <p>&lt;s.foo&gt;s</p>
1364 !! html/parsoid
1365 <p>&lt;s.foo&gt;s</p>
1366 !! end
1367
1368 ###
1369 ### Special characters
1370 ###
1371
1372 !! test
1373 Bare pipe character (bug 52363)
1374 !! wikitext
1375 |
1376 !! html
1377 <p>|
1378 </p>
1379 !! end
1380
1381 !! test
1382 Bare pipe character from a template (bug 52363)
1383 !! wikitext
1384 {{pipe}}
1385 !! html
1386 <p>|
1387 </p>
1388 !! end
1389
1390 ###
1391 ### <nowiki> test cases
1392 ###
1393
1394 !! test
1395 <nowiki> unordered list
1396 !! wikitext
1397 <nowiki>* This is not an unordered list item.</nowiki>
1398 !! html/php
1399 <p>* This is not an unordered list item.
1400 </p>
1401 !! html/parsoid
1402 <p><span typeof="mw:Nowiki">* This is not an unordered list item.</span></p>
1403 !! end
1404
1405 !! test
1406 <nowiki> spacing
1407 !! wikitext
1408 <nowiki>Lorem ipsum dolor
1409
1410 sed abit.
1411 sed nullum.
1412
1413 :and a colon
1414 </nowiki>
1415 !! html/php
1416 <p>Lorem ipsum dolor
1417
1418 sed abit.
1419 sed nullum.
1420
1421 :and a colon
1422
1423 </p>
1424 !! html/parsoid
1425 <p><span typeof="mw:Nowiki">Lorem ipsum dolor
1426
1427 sed abit.
1428 sed nullum.
1429
1430 :and a colon
1431 </span></p>
1432 !! end
1433
1434 !! test
1435 nowiki 3
1436 !! wikitext
1437 :There is not nowiki.
1438 :There is <nowiki>nowiki</nowiki>.
1439
1440 #There is not nowiki.
1441 #There is <nowiki>nowiki</nowiki>.
1442
1443 *There is not nowiki.
1444 *There is <nowiki>nowiki</nowiki>.
1445 !! html/php
1446 <dl><dd>There is not nowiki.</dd>
1447 <dd>There is nowiki.</dd></dl>
1448 <ol><li>There is not nowiki.</li>
1449 <li>There is nowiki.</li></ol>
1450 <ul><li>There is not nowiki.</li>
1451 <li>There is nowiki.</li></ul>
1452
1453 !! html/parsoid
1454 <dl><dd data-parsoid='{}'>There is not nowiki.</dd>
1455 <dd data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</dd></dl>
1456
1457 <ol><li data-parsoid='{}'>There is not nowiki.</li>
1458 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ol>
1459
1460 <ul><li data-parsoid='{}'>There is not nowiki.</li>
1461 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ul>
1462 !! end
1463
1464 !! test
1465 Entities inside <nowiki>
1466 !! wikitext
1467 <nowiki>&lt;</nowiki>
1468 !! html
1469 <p>&lt;
1470 </p>
1471 !! end
1472
1473 !! test
1474 Entities inside template parameters
1475 !! wikitext
1476 {{echo|&ndash;}}
1477 !! html/php+tidy
1478 <p>–</p>
1479 !! html/parsoid
1480 <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>
1481 !! end
1482
1483 !! test
1484 Properly escape nowiki when combined with other wiki markup
1485 !! options
1486 parsoid=html2wt
1487 !! html/parsoid
1488 <p>* &lt;/nowiki&gt; tag</p>
1489 !! wikitext
1490 <nowiki>*</nowiki> <nowiki>&lt;/nowiki&gt;</nowiki> tag
1491 !! end
1492
1493 !! test
1494 T93824: Put escaped HTML tags inside nowiki
1495 !! options
1496 parsoid=html2wt
1497 !! html/parsoid
1498 <p>&lt;h2&gt;foo&lt;/h2&gt;</p>
1499 !! wikitext
1500 <nowiki><h2>foo</h2></nowiki>
1501 !! end
1502
1503 !! test
1504 T71950: 1. Put nowiki as close to cause as possible, even with non-quote escapable chars
1505 !! options
1506 parsoid=html2wt
1507 !! html/parsoid
1508 <p>This text: L'<a rel="mw:WikiLink" href="./Foo">Foo</a>
1509 This text: L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1510 This text: L'''<a rel="mw:WikiLink" href="./Foo">Foo</a>''</p>
1511 !! wikitext
1512 This text: L'[[Foo]]
1513 This text: L<nowiki>''</nowiki>[[Foo]]
1514 This text: L<nowiki>'''</nowiki>[[Foo]]<nowiki>''</nowiki>
1515 !! end
1516
1517 # This test fails because wikitext whitespace is not normalized before comparing.
1518 !! test
1519 T71950: 2. Put nowiki as close to cause as possible, after ' :'
1520 !! options
1521 parsoid=html2wt
1522 !! html/parsoid
1523 <p>This text : L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1524 </p>
1525 !! wikitext
1526 This text : L<nowiki>''</nowiki>[[Foo]]
1527 !! end
1528
1529 # This test and the next one are html2wt only as they test that incorrect wikitext
1530 # passed in template arguments gets escaped or wrapped in nowikis where required.
1531 !! test
1532 T71482: Use {{!}} instead of nowiki for single pipe in template argument
1533 !! options
1534 parsoid=html2wt
1535 !! html/parsoid
1536 <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>
1537 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo|bar |[[&quot;}},&quot;i&quot;:0}}]}" about="#mwt2"></p>
1538 !! wikitext
1539 {{echo|foo{{!}}bar}}
1540 {{echo|<nowiki>foo|bar |[[</nowiki>}}
1541 !! end
1542
1543 !! test
1544 T53961: Output correct nowikis in template arguments
1545 !! options
1546 parsoid=html2wt
1547 !! html/parsoid
1548 <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>
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 }} b&quot;}},&quot;i&quot;:0}}]}" about="#mwt2"></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 [[ b&quot;}},&quot;i&quot;:0}}]}" about="#mwt3"></span>
1551 <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>
1552 <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>
1553 !! wikitext
1554 {{echo|a [ b}}
1555 {{echo|<nowiki>a }} b</nowiki>}}
1556 {{echo|<nowiki>a [[ b</nowiki>}}
1557 {{echo|<nowiki>a | {{ ]]</nowiki>}}
1558 {{echo|a <nowiki>}</nowiki>}}
1559 !! end
1560
1561 !! test
1562 Cases where "!!" needs nowiki protection
1563 !! options
1564 parsoid=html2wt
1565 !! html/parsoid
1566 <table>
1567 <tr><th>this needs protection !! here</th></tr>
1568 </table>
1569
1570 <table>
1571 <tr><th>this does not need
1572 protection !! here</th></tr>
1573 </table>
1574 !! wikitext
1575 {|
1576 !<nowiki>this needs protection !! here</nowiki>
1577 |}
1578
1579 {|
1580 !this does not need
1581 protection !! here
1582 |}
1583 !! end
1584
1585 ###
1586 ### Comments
1587 ###
1588 !! test
1589 Comments and Indent-Pre
1590 !! wikitext
1591 <!-- comment 1 --> asdf
1592
1593 <!-- comment 1 --> asdf
1594 <!-- comment 2 -->
1595
1596 <!-- comment 1 --> asdf
1597 <!-- comment 2 -->xyz
1598
1599 <!-- comment 1 --> asdf
1600 <!-- comment 2 --> xyz
1601 !! html
1602 <pre>asdf
1603 </pre>
1604 <pre>asdf
1605 </pre>
1606 <pre>asdf
1607 </pre>
1608 <p>xyz
1609 </p>
1610 <pre>asdf
1611 xyz
1612 </pre>
1613 !! end
1614
1615 !! test
1616 Comment test 2a
1617 !! wikitext
1618 asdf
1619 <!-- comment 1 -->
1620 jkl
1621 !! html
1622 <p>asdf
1623 jkl
1624 </p>
1625 !! end
1626
1627 !! test
1628 Comment test 2b
1629 !! wikitext
1630 asdf
1631 <!-- comment 1 -->
1632
1633 jkl
1634 !! html
1635 <p>asdf
1636 </p><p>jkl
1637 </p>
1638 !! end
1639
1640 !! test
1641 Comment test 3
1642 !! wikitext
1643 asdf
1644 <!-- comment 1 -->
1645 <!-- comment 2 -->
1646 jkl
1647 !! html
1648 <p>asdf
1649 jkl
1650 </p>
1651 !! end
1652
1653 !! test
1654 Comment test 4
1655 !! wikitext
1656 asdf<!-- comment 1 -->jkl
1657 !! html
1658 <p>asdfjkl
1659 </p>
1660 !! end
1661
1662 !! test
1663 Comment spacing
1664 !! wikitext
1665 a
1666 <!-- foo --> b <!-- bar -->
1667 c
1668 !! html
1669 <p>a
1670 </p>
1671 <pre> b
1672 </pre>
1673 <p>c
1674 </p>
1675 !! end
1676
1677 !! test
1678 Comment whitespace
1679 !! wikitext
1680 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1681 !! html
1682
1683 !! end
1684
1685 !! test
1686 Comment semantics and delimiters
1687 !! wikitext
1688 <!-- --><!----><!-----><!------>
1689 !! html/php
1690
1691 !! html/parsoid
1692 <!-- --><!----><!--&#x2D;--><!--&#x2D;&#x2D;-->
1693 !! end
1694
1695 !! test
1696 Comment semantics and delimiters, redux
1697 !! wikitext
1698 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1699 -- foo -- funky huh? ... -->
1700 !! html/php
1701
1702 !! html/parsoid
1703 <!-- In SGML every "foo" here would actually show up in the text &#x2D;&#x2D; foo &#x2D;&#x2D; bar
1704 &#x2D;&#x2D; foo &#x2D;&#x2D; funky huh? ... -->
1705 !! end
1706
1707 !! test
1708 Comment semantics and delimiters: directors cut
1709 !! wikitext
1710 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1711 everything starting with < followed by !-- until the first -- and > we see,
1712 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1713 -->-->
1714 !! html/php
1715 <p>--&gt;
1716 </p>
1717 !! html/parsoid
1718 <!-- ... However we like to keep things simple and somewhat XML&#x2D;ish so we eat
1719 everything starting with < followed by !&#x2D;&#x2D; until the first &#x2D;&#x2D; and &#x3E; we see,
1720 that wouldn't be valid XML however, since in XML &#x2D;&#x2D; has to terminate a comment
1721 --><p>--></p>
1722 !! end
1723
1724 !! test
1725 Comment semantics: nesting
1726 !! wikitext
1727 <!--<!-- no, we're not going to do anything fancy here -->-->
1728 !! html/php
1729 <p>--&gt;
1730 </p>
1731 !! html/parsoid
1732 <!--<!&#x2D;&#x2D; no, we're not going to do anything fancy here --><p>--></p>
1733 !! end
1734
1735 # Parsoid closes the unclosed comment, even if it means a slight
1736 # round-trip diff.
1737 !! test
1738 Comment semantics: unclosed comment at end
1739 !! options
1740 parsoid=wt2html,html2html
1741 !! wikitext
1742 <!--This comment will run out to the end of the document
1743 !! html/php
1744
1745 !! html/parsoid
1746 <!--This comment will run out to the end of the document-->
1747 !! end
1748
1749 !! test
1750 Comment semantics: normalize comments to play nice with XML and browsers
1751 !! wikitext
1752 <!-- Browsers --!> think this is closed -->
1753 <!--> This would normally be text -->
1754 <!---> As would this -->
1755 <!-- XML doesn't like trailing dashes -------->
1756 <!-- Nor doubled hyphens -- anywhere in the data -->
1757 But this is not a comment.
1758 !! html/php
1759 <p>But this is not a comment.
1760 </p>
1761 !! html/parsoid
1762 <!-- Browsers &#x2D;&#x2D;!&#x3E; think this is closed -->
1763 <!--&#x3E; This would normally be text -->
1764 <!--&#x2D;&#x3E; As would this -->
1765 <!-- XML doesn't like trailing dashes &#x2D;&#x2D;&#x2D;&#x2D;&#x2D;&#x2D;-->
1766 <!-- Nor doubled hyphens &#x2D;&#x2D; anywhere in the data -->
1767 <p>But this is not a comment.</p>
1768 !! end
1769
1770 !! test
1771 Comment semantics: round-trip even text which contains encoded -->
1772 !! wikitext
1773 <!-- hello & goodbye - > --&gt; --&amp;gt; --&xx -->
1774 !! html/parsoid
1775 <!-- hello &#x26; goodbye &#x2D; &#x3E; &#x2D;&#x2D;&#x3E; &#x2D;&#x2D;&#x26;gt; &#x2D;&#x2D;&#x26;xx -->
1776 !! end
1777
1778 !! test
1779 Comment in template title
1780 !! wikitext
1781 {{f<!---->oo}}
1782 !! html
1783 <p>FOO
1784 </p>
1785 !! end
1786
1787 !! test
1788 Comment on its own line post-expand
1789 !! wikitext
1790 a
1791 {{blank}}<!---->
1792 b
1793 !! html
1794 <p>a
1795 </p><p>b
1796 </p>
1797 !! end
1798
1799 !! test
1800 Comment on its own line post-expand with non-significant whitespace
1801 !! wikitext
1802 a
1803 {{blank}} <!---->
1804 b
1805 !! html
1806 <p>a
1807 </p><p>b
1808 </p>
1809 !! end
1810
1811 !! test
1812 Multiple comments should still parse as SOL-transparent
1813 !! options
1814 parsoid=wt2html,wt2wt
1815 !! wikitext
1816 <!--c1-->*a
1817 <!--c2--><!--c3--><!--c4-->*b
1818 !! html/php
1819 <ul><li>a</li>
1820 <li>b</li></ul>
1821
1822 !! html/parsoid
1823 <!--c1--><ul>
1824 <li>a
1825 </li>
1826 <!--c2--><!--c3--><!--c4-->
1827 <li>b
1828 </li>
1829 </ul>
1830 !! end
1831
1832 ###
1833 ### paragraph wrapping tests
1834 ###
1835 !! test
1836 No block tags
1837 !! wikitext
1838 a
1839
1840 b
1841 !! html
1842 <p>a
1843 </p><p>b
1844 </p>
1845 !! end
1846
1847 !! test
1848 Block tag on one line (<div>)
1849 !! wikitext
1850 a <div>foo</div>
1851
1852 b
1853 !! html
1854 a <div>foo</div>
1855 <p>b
1856 </p>
1857 !! html+tidy
1858 <p>a</p>
1859 <div>foo</div>
1860 <p>b</p>
1861 !! end
1862
1863 !! test
1864 Block tag on one line (<blockquote>)
1865 !! wikitext
1866 a <blockquote>foo</blockquote>
1867
1868 b
1869 !! html
1870 a <blockquote>foo</blockquote>
1871 <p>b
1872 </p>
1873 !! html+tidy
1874 <p>a</p>
1875 <blockquote>
1876 <p>foo</p>
1877 </blockquote>
1878 <p>b</p>
1879 !! end
1880
1881 !! test
1882 Block tag on both lines (<div>)
1883 !! wikitext
1884 a <div>foo</div>
1885
1886 b <div>foo</div>
1887 !! html
1888 a <div>foo</div>
1889 b <div>foo</div>
1890
1891 !! html+tidy
1892 <p>a</p>
1893 <div>foo</div>
1894 <p>b</p>
1895 <div>foo</div>
1896 !! end
1897
1898 !! test
1899 Block tag on both lines (<blockquote>)
1900 !! wikitext
1901 a <blockquote>foo</blockquote>
1902
1903 b <blockquote>foo</blockquote>
1904 !! html
1905 a <blockquote>foo</blockquote>
1906 b <blockquote>foo</blockquote>
1907
1908 !! html+tidy
1909 <p>a</p>
1910 <blockquote>
1911 <p>foo</p>
1912 </blockquote>
1913 <p>b</p>
1914 <blockquote>
1915 <p>foo</p>
1916 </blockquote>
1917 !! end
1918
1919 !! test
1920 Multiple lines without block tags
1921 !! wikitext
1922 <div>foo</div> a
1923 b
1924 c
1925 d<!--foo--> e
1926 x <div>foo</div> z
1927 !! html
1928 <div>foo</div> a
1929 <p>b
1930 c
1931 d e
1932 </p>
1933 x <div>foo</div> z
1934
1935 !! html+tidy
1936 <div>foo</div>
1937 <p>a</p>
1938 <p>b c d e</p>
1939 <p>x</p>
1940 <div>foo</div>
1941 <p>z</p>
1942 !! end
1943
1944 # Tidy strips out the empty <div> tags. Parsoid doesn't.
1945 # So, we have a separate section for Parsoid. We don't want
1946 # to mimic this stripping behavior in Parsoid. It affects
1947 # editing experience and also requires us to maintain additional
1948 # info for RT-ing.
1949 !! test
1950 Empty lines between lines with block tags
1951 !! wikitext
1952 <div></div>
1953
1954
1955 <div></div>a
1956
1957 b
1958 <div>a</div>b
1959
1960 <div>b</div>d
1961
1962
1963 <div>e</div>
1964 !! html
1965 <div></div>
1966 <p><br />
1967 </p>
1968 <div></div>a
1969 <p>b
1970 </p>
1971 <div>a</div>b
1972 <div>b</div>d
1973 <p><br />
1974 </p>
1975 <div>e</div>
1976
1977 !! html+tidy
1978 <p><br /></p>
1979 <p>a</p>
1980 <p>b</p>
1981 <div>a</div>
1982 <p>b</p>
1983 <div>b</div>
1984 <p>d</p>
1985 <p><br /></p>
1986 <div>e</div>
1987 !! html/parsoid
1988 <div data-parsoid='{"stx":"html"}'></div>
1989
1990 <p><br /></p>
1991 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
1992
1993 <p>b</p>
1994 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
1995
1996 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
1997
1998 <p><br /></p>
1999 <div data-parsoid='{"stx":"html"}'>e</div>
2000 !! end
2001
2002 ## PHP parser emits output which is broken
2003 !! test
2004 Unclosed HTML p-tags should be handled properly
2005 !! wikitext
2006 <div><p>foo</div>
2007 a
2008
2009 b
2010 !! html/php+tidy
2011 <div>
2012 <p>foo</p>
2013 </div>
2014 <p>a</p>
2015 <p>b</p>
2016 !! html/parsoid
2017 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
2018 <p>a</p>
2019 <p>b</p>
2020 !! end
2021
2022 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
2023 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
2024 ## them for now.
2025 !! test
2026 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
2027 !! options
2028 parsoid=wt2html
2029 !! wikitext
2030 a [[Category:A1]] [[Category:A2]]
2031 [[Category:A3]]
2032 [[Category:A4]]
2033 !! html/parsoid
2034 <p>a</p>
2035 <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"/>
2036 !! end
2037
2038 !! test
2039 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
2040 !! options
2041 parsoid=wt2html
2042 !! wikitext
2043 [[Category:A1]]a
2044 !! html/parsoid
2045 <link rel="mw:PageProp/Category" href="./Category:A1"/><p>a</p>
2046 !! end
2047
2048 ###
2049 ### Preformatted text
2050 ###
2051 !! test
2052 Preformatted text
2053 !! wikitext
2054 This is some
2055 Preformatted text
2056 With ''italic''
2057 And '''bold'''
2058 And a [[Main Page|link]]
2059 !! html
2060 <pre>This is some
2061 Preformatted text
2062 With <i>italic</i>
2063 And <b>bold</b>
2064 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
2065 </pre>
2066 !! end
2067
2068 !! test
2069 Tabs don't trigger preformatted text
2070 !! wikitext
2071 This is not
2072 preformatted text.
2073 This is preformatted text.
2074 So is this.
2075 !! html/php
2076 <p> This is not
2077 preformatted text.
2078 </p>
2079 <pre>This is preformatted text.
2080 So is this.
2081 </pre>
2082 !! html/parsoid
2083 <p> This is not
2084 preformatted text.</p>
2085 <pre>This is preformatted text.
2086 So is this.</pre>
2087 !! end
2088
2089 !! test
2090 Space before tab needs nowiki pre protection
2091 !! options
2092 parsoid=html2wt
2093 !! html/parsoid
2094 <p> a</p>
2095 !! wikitext
2096 <nowiki> </nowiki> a
2097 !! end
2098
2099 !! test
2100 Ident preformatting with inline content
2101 !! wikitext
2102 a
2103 ''b''
2104 !! html
2105 <pre>a
2106 <i>b</i>
2107 </pre>
2108 !! end
2109
2110 !! test
2111 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
2112 !! wikitext
2113 <pre><nowiki>
2114 <b>
2115 <cite>
2116 <em>
2117 </nowiki></pre>
2118 !! html
2119 <pre>
2120 &lt;b&gt;
2121 &lt;cite&gt;
2122 &lt;em&gt;
2123 </pre>
2124
2125 !! end
2126
2127 !! test
2128 Regression with preformatted in <center>
2129 !! wikitext
2130 <center>
2131 Blah
2132 </center>
2133 !! html
2134 <center>
2135 <pre>Blah
2136 </pre>
2137 </center>
2138
2139 !! end
2140
2141 !! test
2142 Bug 52763: Preformatted in <blockquote>
2143 !! wikitext
2144 <blockquote>
2145 Blah
2146 {|
2147 |
2148 indented cell (no pre-wrapping!)
2149 |}
2150 </blockquote>
2151 !! html
2152 <blockquote>
2153 <p> Blah
2154 </p>
2155 <table>
2156 <tr>
2157 <td>
2158 <p> indented cell (no pre-wrapping!)
2159 </p>
2160 </td></tr></table>
2161 </blockquote>
2162
2163 !! end
2164
2165 !! test
2166 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
2167 !! wikitext
2168 <blockquote>
2169 Foo
2170
2171 Bar
2172 </blockquote>
2173 !! html
2174 <blockquote>
2175 <p>Foo
2176 </p><p>Bar
2177 </p>
2178 </blockquote>
2179
2180 !! end
2181
2182 !! test
2183 Bug 15491: <ins>/<del> in blockquote
2184 !! wikitext
2185 <blockquote>
2186 Foo <del>bar</del> <ins>baz</ins> quux
2187 </blockquote>
2188 !! html
2189 <blockquote>
2190 <p>Foo <del>bar</del> <ins>baz</ins> quux
2191 </p>
2192 </blockquote>
2193
2194 !! end
2195
2196 # Note that the p-wrapping is newline sensitive, which could be
2197 # considered a bug: tidy will wrap only the 'Foo' in the example
2198 # below in a <p> tag. (see comment 23-25 of bug #6200)
2199 !! test
2200 Bug 15491: <ins>/<del> in blockquote (2)
2201 !! wikitext
2202 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2203 </blockquote>
2204 !! html
2205 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2206 </blockquote>
2207
2208 !! html+tidy
2209 <blockquote>
2210 <p>Foo</p>
2211 <del>bar</del> <ins>baz</ins> quux</blockquote>
2212 !! end
2213
2214 !! test
2215 <pre> with attributes (bug 3202)
2216 !! wikitext
2217 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2218 !! html
2219 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2220
2221 !! end
2222
2223 !! test
2224 <pre> with width attribute (bug 3202)
2225 !! wikitext
2226 <pre width="8">Narrow screen goodies</pre>
2227 !! html
2228 <pre width="8">Narrow screen goodies</pre>
2229
2230 !! end
2231
2232 !! test
2233 <pre> with forbidden attribute (bug 3202)
2234 !! wikitext
2235 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
2236 !! html
2237 <pre width="8">Narrow screen goodies</pre>
2238
2239 !! end
2240
2241 !! test
2242 Entities inside <pre>
2243 !! wikitext
2244 <pre>&lt;</pre>
2245 !! html
2246 <pre>&lt;</pre>
2247
2248 !! end
2249
2250 !! test
2251 <pre> with forbidden attribute values (bug 3202)
2252 !! wikitext
2253 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
2254 !! html
2255 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
2256
2257 !! end
2258
2259 !! test
2260 <nowiki> inside <pre> (bug 13238)
2261 !! wikitext
2262 <pre>
2263 <nowiki>
2264 </pre>
2265 <pre>
2266 <nowiki></nowiki>
2267 </pre>
2268 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
2269 !! html
2270 <pre>
2271 &lt;nowiki&gt;
2272 </pre>
2273 <pre>
2274
2275 </pre>
2276 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2277
2278 !! end
2279
2280 !! test
2281 <nowiki> inside of #tag:pre
2282 !! wikitext
2283 {{#tag:pre|Foo <nowiki>&rarr;bar</nowiki>}}
2284 !! html/php
2285 <pre>Foo &#8594;bar</pre>
2286
2287 !! html/parsoid
2288 <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>
2289 !! end
2290
2291 !! test
2292 <nowiki> and <pre> preference (first one wins)
2293 !! wikitext
2294 <pre>
2295 <nowiki>
2296 </pre>
2297 </nowiki>
2298 </pre>
2299
2300 <nowiki>
2301 <pre>
2302 <nowiki>
2303 </pre>
2304 </nowiki>
2305 </pre>
2306
2307 !! html/php
2308 <pre>
2309 &lt;nowiki&gt;
2310 </pre>
2311 <p>&lt;/nowiki&gt;
2312 &lt;/pre&gt;
2313 </p><p>
2314 &lt;pre&gt;
2315 &lt;nowiki&gt;
2316 &lt;/pre&gt;
2317
2318 &lt;/pre&gt;
2319 </p>
2320 !! html/parsoid
2321 <pre data-parsoid='{"stx":"html","strippedNL":true}'>&lt;nowiki>
2322 </pre>
2323 <p><span typeof="mw:Placeholder" data-parsoid='{"src":"&lt;/nowiki>"}'>&lt;/nowiki></span>
2324 &lt;/pre></p>
2325
2326 <p><span typeof="mw:Nowiki">
2327 &lt;pre>
2328 &lt;nowiki>
2329 &lt;/pre>
2330 </span>
2331 &lt;/pre></p>
2332 !! end
2333
2334 !! test
2335 </pre> inside nowiki
2336 !! wikitext
2337 <nowiki></pre></nowiki>
2338 !! html
2339 <p>&lt;/pre&gt;
2340 </p>
2341 !! end
2342
2343 # Parsoid doesn't strip empty tags, like Tidy does.
2344 !! test
2345 Empty pre; pre inside other HTML tags (bug 54946)
2346 !! options
2347 parsoid=wt2html,wt2wt
2348 !! wikitext
2349 a
2350
2351 <div><pre>
2352 foo
2353 </pre></div>
2354 <pre></pre>
2355 !! html/php
2356 <p>a
2357 </p>
2358 <div><pre>
2359 foo
2360 </pre></div>
2361 <pre></pre>
2362
2363 !! html/php+tidy
2364 <p>a</p>
2365 <div>
2366 <pre>
2367 foo
2368 </pre></div>
2369 !! html/parsoid
2370 <p>a</p>
2371
2372 <div><pre>foo
2373 </pre></div>
2374 <pre></pre>
2375 !! end
2376
2377 !! test
2378 HTML pre followed by indent-pre
2379 !! wikitext
2380 <pre>foo</pre>
2381 bar
2382 !! html
2383 <pre>foo</pre>
2384 <pre>bar
2385 </pre>
2386 !! end
2387
2388 # Note that tidy removes the empty <p> tags from the start and end.
2389 # Parsoid does not, by design.
2390 !!test
2391 Block tag pre
2392 !! wikitext
2393 <p><pre>foo</pre></p>
2394 !! html/php+tidy
2395 <pre>
2396 foo
2397 </pre>
2398 !! html/parsoid
2399 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2400 !!end
2401
2402 !!test
2403 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2404 !! wikitext
2405 {{echo|}}
2406 !! html
2407
2408 !!end
2409
2410 !!test
2411 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2412 !! wikitext
2413 {{echo|
2414 foo}}
2415 !! html
2416 <p>foo
2417 </p>
2418 !!end
2419
2420 !! test
2421 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2422 !! wikitext
2423 {{echo|a
2424 b}}
2425 !! html
2426 <pre>a
2427 </pre>
2428 <p>b
2429 </p>
2430 !!end
2431
2432 !! test
2433 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2434 !! wikitext
2435 {{echo|a
2436 b
2437 c
2438 d
2439 e
2440 }}
2441 !! html
2442 <pre>a
2443 </pre>
2444 <p>b
2445 c
2446 </p>
2447 <pre>d
2448 </pre>
2449 <p>e
2450 </p>
2451 !!end
2452
2453 !!test
2454 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2455 !! wikitext
2456 {{echo| foo}}
2457
2458 {{echo| foo}}{{echo| bar}}
2459
2460 {{echo| foo}}
2461 {{echo| bar}}
2462
2463 {{echo|<!--cmt--> foo}}
2464
2465 <!--cmt-->{{echo| foo}}
2466
2467 {{echo|{{echo| }}bar}}
2468 !! html
2469 <pre>foo
2470 </pre>
2471 <pre>foo bar
2472 </pre>
2473 <pre>foo
2474 bar
2475 </pre>
2476 <pre>foo
2477 </pre>
2478 <pre>foo
2479 </pre>
2480 <pre>bar
2481 </pre>
2482 !!end
2483
2484 !! test
2485 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2486 !! wikitext
2487 {{echo| }}a
2488
2489 {{echo|
2490 }}a
2491
2492 {{echo|
2493 b}}
2494
2495 {{echo|a
2496 }}b
2497
2498 {{echo|a
2499 }} b
2500 !! html
2501 <pre>a
2502 </pre>
2503 <p><br />
2504 </p>
2505 <pre>a
2506 </pre>
2507 <p><br />
2508 </p>
2509 <pre>b
2510 </pre>
2511 <p>a
2512 </p>
2513 <pre>b
2514 </pre>
2515 <p>a
2516 </p>
2517 <pre>b
2518 </pre>
2519 !!end
2520
2521 !! test
2522 Pres with newline attributes
2523 !! wikitext
2524 <pre class="one
2525 two">hi</pre>
2526 !! html/php
2527 <pre class="one two">hi</pre>
2528
2529 !! html/parsoid
2530 <pre class="one
2531 two" data-parsoid='{"stx":"html"}'>hi</pre>
2532 !! end
2533
2534 !! test
2535 Things that look like <pre> tags aren't treated as such
2536 !! wikitext
2537 Barack Obama <President> of the United States
2538 <President></President>
2539 !! html
2540 <p>Barack Obama &lt;President&gt; of the United States
2541 &lt;President&gt;&lt;/President&gt;
2542 </p>
2543 !! end
2544
2545 !! test
2546 Handle broken pre-like tags (bug 64025)
2547 !! options
2548 parsoid=wt2html
2549 !! wikitext
2550 {{echo|<pre <pre>x</pre>}}
2551
2552 <table><pre </table>
2553 !! html/php
2554 <pre>x</pre>
2555 <table>&lt;pre </table>
2556
2557 !! html/php+tidy
2558 <pre>
2559 x
2560 </pre>
2561 <p>&lt;pre</p>
2562 !! html/parsoid
2563 <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>
2564
2565
2566 <p>&lt;pre </p>
2567
2568 <table></table>
2569 !! end
2570
2571 !! test
2572 Parsoid: handle pre with space after attribute
2573 !! options
2574 parsoid=wt2html
2575 !! wikitext
2576 <pre style="width:50%;" >{{echo|foo}}</pre>
2577 !! html/php
2578 <pre style="width:50%;">{{echo|foo}}</pre>
2579
2580 !! html/parsoid
2581 <pre style="width:50%;">{{echo|foo}}</pre>
2582 !! end
2583
2584 # TODO / maybe: fix wt2wt for this
2585 !! test
2586 Parsoid: Don't paragraph-wrap fosterable content
2587 !! options
2588 parsoid=wt2html
2589 !! wikitext
2590 {|
2591 <td></td>
2592 <td></td>
2593
2594
2595
2596 |}
2597 !! html
2598 <table>
2599
2600 <tbody>
2601 <tr>
2602 <td></td>
2603
2604 <td></td></tr>
2605
2606
2607
2608 </tbody></table>
2609 !! end
2610
2611 !! test
2612 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2613 !! options
2614 parsoid=wt2html
2615 !! wikitext
2616 {|
2617 <td>
2618 <td>
2619 </td>
2620
2621
2622
2623 |}
2624 !! html
2625 <table>
2626
2627 <tbody>
2628 <tr>
2629 <td></td>
2630
2631 <td>
2632 </td></tr>
2633
2634
2635
2636 </tbody></table>
2637 !! end
2638
2639
2640 #--------------------------------------------------------------------
2641 # Transclusion parameter whitespace stripping tests
2642 # Behavior is different for positional and named parameters
2643 #--------------------------------------------------------------------
2644 !! test
2645 Templates: Strip leading and trailing whitespace from named-param values
2646 !! wikitext
2647 {{echo|1= a }}
2648
2649 {{echo|1= {{echo|b}} }}
2650
2651 {{echo| 1 =
2652 c }}
2653
2654 {{echo| 1 =
2655 * d
2656 }}
2657 !! html
2658 <p>a
2659 </p><p>b
2660 </p><p>c
2661 </p>
2662 <ul><li> d</li></ul>
2663
2664 !! end
2665
2666 !! test
2667 Templates: Don't strip whitespace from positional-param values
2668 !! wikitext
2669 {{echo|a }}
2670
2671 {{echo|{{echo|b}} }}
2672
2673 {{echo| c
2674 }}
2675
2676 {{echo| {{echo|d}}
2677 }}
2678
2679 {{echo|
2680 e}}
2681
2682 {{echo|
2683 * f}}
2684
2685 {{echo|
2686 }}g
2687 !! html
2688 <p>a
2689 </p><p>b
2690 </p>
2691 <pre>c
2692 </pre>
2693 <p><br />
2694 </p>
2695 <pre>d
2696 </pre>
2697 <p><br />
2698 </p>
2699 <pre>e
2700 </pre>
2701 <p><br />
2702 </p>
2703 <ul><li> f</li></ul>
2704 <p><br />
2705 </p>
2706 <pre>g
2707 </pre>
2708 !! end
2709
2710 !! test
2711 Templates: Handle empty comment-and-ws-only lines correctly
2712 !! wikitext
2713 {{echo|foo
2714 <!--should be ignored-->
2715 <!--should be ignored as well-->
2716 bar}}
2717 !! html
2718 <p>foo
2719 bar
2720 </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/parsoid
2737 <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>
2738
2739 <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>
2740
2741 <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>
2742
2743 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2744 !!end
2745
2746 !! test
2747 Templates: Handle comments in parameter names (bug 67657)
2748 !! wikitext
2749 {{echo|1
2750 <!-- should be ignored -->
2751 =foo}}
2752
2753 {{echo|
2754 <!-- should be ignored -->
2755 1 = foo}}
2756
2757 {{echo|1<!-- should be ignored -->=foo}}
2758
2759 {{echo|<!-- should be ignored -->1=foo}}
2760 !!html/parsoid
2761 <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>
2762
2763 <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>
2764
2765 <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>
2766
2767 <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>
2768 !!end
2769
2770 !! test
2771 Templates: Other wikitext in parameter names (bug 67657)
2772 !! wikitext
2773 {{echo|''1''=foo}}
2774 !!html/parsoid
2775 <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>
2776 !!html/php
2777 <p>{{{1}}}
2778 </p>
2779 !!end
2780
2781 #--------------------------------------------------------------------
2782 # Transclusion parameter escaping tests
2783 #--------------------------------------------------------------------
2784 !! test
2785 Templates: Parsoid parameter escaping test 1
2786 !! wikitext
2787 {{echo|[foo]|{{echo|[bar]}}}}
2788 !! html/php+tidy
2789 <p>[foo]</p>
2790 !! html/parsoid
2791 <p about="#mwt1" typeof="mw:Transclusion"
2792 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2793 !! end
2794
2795 !! test
2796 Parsoid: Pipes in external links in template parameter
2797 !! wikitext
2798 {{echo|[{{echo|http://example.com}} link]}}
2799 !! html/php+tidy
2800 <p><a rel="nofollow" class="external text" href="http://example.com">link</a></p>
2801 !! html/parsoid
2802 <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>
2803 !! end
2804
2805 !! test
2806 Parsoid: pipe in transclusion parameter
2807 !! wikitext
2808 {{echo|http://foo.com/a&#124;b}}
2809 !! html/php+tidy
2810 <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</a></p>
2811 !! html/parsoid
2812 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2813 typeof="mw:Transclusion"
2814 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>
2815 !! end
2816
2817 !! test
2818 Parsoid: Pipe in external link target and content in template parameter
2819 !! options
2820 parsoid=html2wt,wt2wt
2821 !! wikitext
2822 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2823 !! html/php+tidy
2824 <p><a rel="nofollow" class="external text" href="http://foo.com/a%7Cb">a|b</a></p>
2825 !! html/parsoid
2826 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2827 typeof="mw:Transclusion"
2828 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2829 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2830 !! end
2831
2832 !! test
2833 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2834 !! options
2835 parsoid
2836 !! wikitext
2837 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2838 !! html
2839 <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>
2840 !! end
2841
2842 !! test
2843 Templates: Don't escape already nowiki-escaped text in template parameters
2844 !! options
2845 parsoid=html2wt,wt2wt
2846 !! wikitext
2847 {{echo|foo<nowiki>|</nowiki>bar}}
2848 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2849 {{echo|<nowiki></nowiki>}}
2850 !! html/php+tidy
2851 <p>foo|bar &lt;div&gt;</p>
2852 !! html/parsoid
2853 <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>
2854 <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>
2855 <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>
2856 </p>
2857 !! end
2858
2859 ## Bug 52824
2860 !! test
2861 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2862 !! options
2863 parsoid=html2wt,wt2wt
2864 !! wikitext
2865 {{echo|{{echo|1=bar}}}}
2866 !! html/php+tidy
2867 <p>bar</p>
2868 !! html/parsoid
2869 <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>
2870 !! end
2871
2872 ## Bug 56733
2873 !! test
2874 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2875 !! wikitext
2876 {{echo|a : b}}
2877 !! html/php+tidy
2878 <p>a&#160;: b</p>
2879 !! html/parsoid
2880 <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>
2881 !! end
2882
2883 ## Bug T73412
2884 !! test
2885 Templates: Preserve blank parameter names
2886 !! wikitext
2887 {{echo|=foo}}
2888 !! html/php+tidy
2889 <p>{{{1}}}</p>
2890 !! html/parsoid
2891 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2892 !! end
2893
2894 !! test
2895 Templates: Preserve blank parameter names in other positions
2896 !! wikitext
2897 {{blank_param|bar|=foo}}
2898 !! html/php+tidy
2899 <p>bar foo</p>
2900 !! html/parsoid
2901 <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
2902 foo</p>
2903 !! end
2904
2905 ###
2906 ### Parsoid-centric tests for testing RT edge cases for pre
2907 ###
2908
2909 !!test
2910 1a. Indent-Pre and Comments
2911 !! wikitext
2912 a
2913 <!--a-->
2914 c
2915 !! html
2916 <pre>a
2917 </pre>
2918 <p>c
2919 </p>
2920 !!end
2921
2922 !!test
2923 1b. Indent-Pre and Comments
2924 !! wikitext
2925 a
2926 <!--a-->
2927 c
2928 !! html
2929 <pre>a
2930 </pre>
2931 <p>c
2932 </p>
2933 !!end
2934
2935 !!test
2936 1c. Indent-Pre and Comments
2937 !! wikitext
2938 <!--a--> a
2939
2940 <!--a--> a
2941 !! html
2942 <pre> a
2943 </pre>
2944 <pre> a
2945 </pre>
2946 !!end
2947
2948 !!test
2949 1d. Indent-Pre and Comments
2950 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2951 !! wikitext
2952 <!--a--> a
2953
2954 <!--b-->b
2955 !! html
2956 <pre>a
2957 </pre>
2958 <pre>b
2959 </pre>
2960 !!end
2961
2962 !!test
2963 2a. Indent-Pre and tables
2964 !! wikitext
2965 {|
2966 |-
2967 !h1!!h2
2968 |foo||bar
2969 |}
2970 !! html
2971 <table>
2972
2973 <tr>
2974 <th>h1</th>
2975 <th>h2
2976 </th>
2977 <td>foo</td>
2978 <td>bar
2979 </td></tr></table>
2980
2981 !!end
2982
2983 !!test
2984 2b. Indent-Pre and tables
2985 !! wikitext
2986 {|
2987 |-
2988 |foo
2989 |}
2990 !! html
2991 <table>
2992
2993 <tr>
2994 <td>foo
2995 </td></tr></table>
2996
2997 !!end
2998
2999 !!test
3000 2c. Indent-Pre and tables (bug 42252)
3001 !! wikitext
3002 {|
3003 |+ foo
3004 ! | bar
3005 |}
3006 !! html
3007 <table>
3008 <caption> foo
3009 </caption>
3010 <tr>
3011 <th> bar
3012 </th></tr></table>
3013
3014 !!end
3015
3016 !!test
3017 2d. Indent-Pre and tables
3018 !! wikitext
3019 a
3020 {|
3021 | b
3022 |}
3023 !! html/php
3024 <pre>a
3025 </pre>
3026 <table>
3027 <tr>
3028 <td> b
3029 </td></tr></table>
3030
3031 !! html/parsoid
3032 <pre>a</pre>
3033 <table>
3034 <tbody><tr><td> b</td></tr>
3035 </tbody></table>
3036 !!end
3037
3038 !!test
3039 2e. Indent-Pre and table-line syntax
3040 !! wikitext
3041 a
3042 | b
3043 | c
3044 !! html/php
3045 <pre>a
3046 | b
3047 | c
3048 </pre>
3049 !!end
3050
3051 !!test
3052 2f. Indent-pre started by table-line syntax
3053 !! wikitext
3054 a
3055 | b
3056 | c
3057 !! html/php
3058 <p>a
3059 </p>
3060 <pre>| b
3061 | c
3062 </pre>
3063 !! html/parsoid
3064 <p>a</p>
3065 <pre>
3066 | b
3067 | c</pre>
3068 !!end
3069
3070 !! test
3071 2g. Indented table markup mixed with indented pre content (proposed in bug 6200)
3072 !! wikitext
3073 <table>
3074 <tr>
3075 <td>
3076 Text that should be rendered preformatted
3077 </td>
3078 </tr>
3079 </table>
3080 !! html
3081 <table>
3082 <tr>
3083 <td>
3084 <pre>Text that should be rendered preformatted
3085 </pre>
3086 </td>
3087 </tr>
3088 </table>
3089
3090 !! end
3091
3092 !!test
3093 3a. Indent-Pre and block tags (single-line html)
3094 !! wikitext
3095 a <p> foo </p>
3096 b <div> foo </div>
3097 c <blockquote> foo </blockquote>
3098 <span> foo </span>
3099 !! html
3100 a <p> foo </p>
3101 b <div> foo </div>
3102 c <blockquote> foo </blockquote>
3103 <pre><span> foo </span>
3104 </pre>
3105 !! html/parsoid
3106 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
3107 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3108 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
3109 <pre><span> foo </span>
3110 </pre>
3111 !! html+tidy
3112 <p>a</p>
3113 <p>foo</p>
3114 <p>b</p>
3115 <div>foo</div>
3116 <p>c</p>
3117 <blockquote>
3118 <p>foo</p>
3119 </blockquote>
3120 <pre>
3121 <span> foo </span>
3122 </pre>
3123 !! end
3124
3125 !!test
3126 3b. Indent-Pre and block tags (multi-line html)
3127 !! wikitext
3128 a <span>foo</span>
3129 b <div> foo </div>
3130 !! html
3131 <pre>a <span>foo</span>
3132 </pre>
3133 b <div> foo </div>
3134
3135 !! html/parsoid
3136 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3137 b <div data-parsoid='{"stx":"html"}'> foo </div>
3138 !! html+tidy
3139 <pre>
3140 a <span>foo</span>
3141 </pre>
3142 <p>b</p>
3143 <div>foo</div>
3144 !!end
3145
3146 !!test
3147 3c. Indent-Pre and block tags (pre-content on separate line)
3148 !! wikitext
3149 <p>
3150 foo
3151 </p>
3152
3153 <div>
3154 foo
3155 </div>
3156
3157 <center>
3158 foo
3159 </center>
3160
3161 <blockquote>
3162 foo
3163 </blockquote>
3164
3165 <blockquote>
3166 <pre>
3167 foo
3168 </pre>
3169 </blockquote>
3170
3171 <table><tr><td>
3172 foo
3173 </td></tr></table>
3174
3175 <ul><li>
3176 foo
3177 </li></ul>
3178
3179 !! html
3180 <p>
3181 foo
3182 </p>
3183 <div>
3184 <pre>foo
3185 </pre>
3186 </div>
3187 <center>
3188 <pre>foo
3189 </pre>
3190 </center>
3191 <blockquote>
3192 <p> foo
3193 </p>
3194 </blockquote>
3195 <blockquote>
3196 <pre>
3197 foo
3198 </pre>
3199 </blockquote>
3200 <table><tr><td>
3201 <pre>foo
3202 </pre>
3203 </td></tr></table>
3204 <ul><li>
3205 foo
3206 </li></ul>
3207
3208 !!end
3209
3210 !! test
3211 4. Indent-Pre and extension tags
3212 !! wikitext
3213 a <tag />
3214 !! html/php
3215 a <pre>
3216 NULL
3217 array (
3218 )
3219 </pre>
3220
3221 !! html/parsoid
3222 a <pre typeof="mw:Extension/tag" about="#mwt2" data-parsoid='{}' data-mw='{"name":"tag","attrs":{},"body":null}'></pre>
3223 !! end
3224
3225 !!test
3226 Render paragraphs when indent-pre is suppressed in blocklevels
3227 !! wikitext
3228 <blockquote>
3229 foo
3230
3231 bar
3232 </blockquote>
3233 !! html
3234 <blockquote>
3235 <p> foo
3236 </p><p> bar
3237 </p>
3238 </blockquote>
3239
3240 !!end
3241
3242 !!test
3243 4. Multiple spaces at start-of-line
3244 !! wikitext
3245 <p> foo </p>
3246 foo
3247 {|
3248 |foo
3249 |}
3250 !! html
3251 <p> foo </p>
3252 <pre> foo
3253 </pre>
3254 <table>
3255 <tr>
3256 <td>foo
3257 </td></tr></table>
3258
3259 !!end
3260
3261 ## NOTE: the leading white-space chars on empty line are significant
3262 !! test
3263 5a. White-space in indent-pre
3264 !! wikitext
3265 a<br />
3266
3267 b
3268 !! html
3269 <pre>a<br />
3270
3271 b
3272 </pre>
3273 !! end
3274
3275 ## NOTE: the leading white-space chars on empty line are significant
3276 !! test
3277 5b. White-space in indent-pre
3278 !! wikitext
3279 a
3280
3281 b
3282
3283
3284 c
3285 !! html
3286 <pre>a
3287
3288 b
3289
3290
3291 c
3292 </pre>
3293 !! end
3294
3295 !! test
3296 5c. White-space in indent-pre
3297 !! wikitext
3298 ''a''
3299 ''b''
3300 ''c''
3301 !! html
3302 <pre><i>a</i>
3303 <i>b</i>
3304 <i>c</i>
3305 </pre>
3306 !! end
3307
3308 !! test
3309 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3310 !! wikitext
3311 a
3312
3313 <!-- continue -->
3314 b
3315
3316 c
3317
3318 d
3319 !! html
3320 <pre>a
3321
3322 b
3323 </pre>
3324 <pre>c
3325
3326 </pre>
3327 <p>d
3328 </p>
3329 !! end
3330
3331 !! test
3332 7a. Indent-pre and category links
3333 !! options
3334 parsoid=wt2html,wt2wt
3335 !! wikitext
3336 [[Category:foo]] <!-- No pre-wrapping -->
3337 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3338 !! html/php+tidy
3339 !! html/parsoid
3340 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3341 <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 -->
3342 !! end
3343
3344 ## We used to, but no longer wt2wt this test since the default serializer
3345 ## will normalize all categories to serialize on their own line.
3346 ## This wikitext usage is going to be fairly uncommon in production and
3347 ## selser will take care of preserving formatting in those scenarios.
3348 !! test
3349 7b. Indent-pre and category links
3350 !! options
3351 parsoid=wt2html
3352 !! wikitext
3353 [[Category:foo]] a
3354 [[Category:foo]] {{echo|b}}
3355 !! html/parsoid
3356 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3357 <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>
3358 !! end
3359
3360 !! test
3361 Indent-Pre: Newlines in comments shouldn't affect sol state
3362 !! wikitext
3363 a <!--
3364 foo
3365 --> b
3366 !! html/php+tidy
3367 <p>a b</p>
3368 !! html/parsoid
3369 <p>a <!--
3370 foo
3371 --> b</p>
3372 !! end
3373
3374 ###
3375 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3376 ###
3377
3378 !!test
3379 HTML-pre: 1. embedded newlines
3380 !! wikitext
3381 <pre>foo</pre>
3382
3383 <pre>
3384 foo
3385 </pre>
3386
3387 <pre>
3388
3389 foo
3390 </pre>
3391
3392 <pre>
3393
3394
3395 foo
3396 </pre>
3397 !! html/php+tidy
3398 <pre>
3399 foo
3400 </pre>
3401 <pre>
3402 foo
3403 </pre>
3404 <pre>
3405
3406 foo
3407 </pre>
3408 <pre>
3409
3410
3411 foo
3412 </pre>
3413 !! html/parsoid
3414 <pre data-parsoid='{"stx":"html"}'>foo</pre>
3415
3416 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
3417 foo
3418 </pre>
3419
3420 <pre data-parsoid='{"stx":"html"}'>
3421
3422 foo
3423 </pre>
3424
3425 <pre data-parsoid='{"stx":"html"}'>
3426
3427
3428 foo
3429 </pre>
3430 !!end
3431
3432 !! test
3433 HTML-pre: big spaces
3434 !! wikitext
3435 <pre>
3436
3437
3438
3439
3440 haha
3441
3442
3443
3444
3445 haha
3446
3447
3448
3449
3450 </pre>
3451 !! html/php+tidy
3452 <pre>
3453
3454
3455
3456
3457 haha
3458
3459
3460
3461
3462 haha
3463
3464
3465
3466
3467 </pre>
3468 !! html/parsoid
3469 <pre data-parsoid='{"stx":"html"}'>
3470
3471
3472
3473
3474 haha
3475
3476
3477
3478
3479 haha
3480
3481
3482
3483
3484 </pre>
3485 !! end
3486
3487 !!test
3488 HTML-pre: 2: indented text
3489 !! wikitext
3490 <pre>
3491 foo
3492 </pre>
3493 !! html
3494 <pre>
3495 foo
3496 </pre>
3497
3498 !!end
3499
3500 !!test
3501 HTML-pre: 3: other wikitext
3502 !! wikitext
3503 <pre>
3504 * foo
3505 # bar
3506 = no-h =
3507 '' no-italic ''
3508 [[ NoLink ]]
3509 </pre>
3510 !! html/php
3511 <pre>
3512 * foo
3513 # bar
3514 = no-h =
3515 '' no-italic ''
3516 [[ NoLink ]]
3517 </pre>
3518
3519 !! html/parsoid
3520 <pre data-parsoid='{"stx":"html","strippedNL":true}'>* foo
3521 # bar
3522 = no-h =
3523 '' no-italic ''
3524 [[ NoLink ]]
3525 </pre>
3526 !!end
3527
3528 ###
3529 ### Definition lists
3530 ###
3531 !! test
3532 Simple definition
3533 !! wikitext
3534 ; name : Definition
3535 !! html
3536 <dl><dt> name&#160;</dt>
3537 <dd> Definition</dd></dl>
3538
3539 !! end
3540
3541 !! test
3542 Definition list for indentation only
3543 !! wikitext
3544 : Indented text
3545 !! html
3546 <dl><dd> Indented text</dd></dl>
3547
3548 !! end
3549
3550 !! test
3551 Definition list with no space
3552 !! wikitext
3553 ;name:Definition
3554 !! html
3555 <dl><dt>name</dt>
3556 <dd>Definition</dd></dl>
3557
3558 !!end
3559
3560 !! test
3561 Definition list with URL link
3562 !! wikitext
3563 ; http://example.com/ : definition
3564 !! html
3565 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3566 <dd> definition</dd></dl>
3567
3568 !! end
3569
3570 !! test
3571 Definition list with bracketed URL link
3572 !! wikitext
3573 ;[http://www.example.com/ Example]:Something about it
3574 !! html
3575 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3576 <dd>Something about it</dd></dl>
3577
3578 !! end
3579
3580 !! test
3581 Definition list with wikilink containing colon
3582 !! wikitext
3583 ; [[Help:FAQ]]: The least-read page on Wikipedia
3584 !! html
3585 <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>
3586 <dd> The least-read page on Wikipedia</dd></dl>
3587
3588 !! end
3589
3590 # At Brion's and JeLuF's insistence... :)
3591 !! test
3592 Definition list with news link containing colon
3593 !! wikitext
3594 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
3595 !! html/php
3596 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3597 <dd> This isn't even a real newsgroup!</dd></dl>
3598
3599 !! html/parsoid
3600 <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>
3601 !! end
3602
3603 !! test
3604 Malformed definition list with colon
3605 !! wikitext
3606 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3607 !! html
3608 <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>
3609
3610 !! end
3611
3612 !! test
3613 Definition lists: colon in external link text
3614 !! wikitext
3615 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3616 !! html
3617 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3618 <dd> OK, I made that up</dd></dl>
3619
3620 !! end
3621
3622 !! test
3623 Definition lists: colon in HTML attribute
3624 !! wikitext
3625 ;<b style="display: inline">bold</b>
3626 !! html
3627 <dl><dt><b style="display: inline">bold</b></dt></dl>
3628
3629 !! end
3630
3631 !! test
3632 Definition lists: self-closed tag
3633 !! wikitext
3634 ;one<br/>two : two-line fun
3635 !! html
3636 <dl><dt>one<br />two&#160;</dt>
3637 <dd> two-line fun</dd></dl>
3638
3639 !! end
3640
3641 !! test
3642 Bug 11748: Literal closing tags
3643 !! wikitext
3644 <dl>
3645 <dt>test 1</dt>
3646 <dd>test test test test test</dd>
3647 <dt>test 2</dt>
3648 <dd>test test test test test</dd>
3649 </dl>
3650 !! html
3651 <dl>
3652 <dt>test 1</dt>
3653 <dd>test test test test test</dd>
3654 <dt>test 2</dt>
3655 <dd>test test test test test</dd>
3656 </dl>
3657
3658 !! end
3659
3660 !! test
3661 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3662 !! wikitext
3663 <ul><li>
3664 ; term : description
3665 * unordered
3666 </li></ul>
3667 !! html
3668 <ul><li>
3669 <dl><dt> term&#160;</dt>
3670 <dd> description</dd></dl>
3671 <ul><li> unordered</li></ul>
3672 </li></ul>
3673
3674 !! end
3675
3676 !! test
3677
3678 Definition list with empty definition and following paragraph
3679 !! wikitext
3680 ; term:
3681 Paragraph text
3682 !! html
3683 <dl><dt> term</dt>
3684 <dd></dd></dl>
3685 <p>Paragraph text
3686 </p>
3687 !! end
3688
3689 !! test
3690 Nested definition lists using html syntax
3691 !! wikitext
3692 <dl><dt>x</dt>
3693 <dd>a</dd>
3694 <dd>b</dd></dl>
3695 !! html
3696 <dl><dt>x</dt>
3697 <dd>a</dd>
3698 <dd>b</dd></dl>
3699
3700 !! end
3701
3702 !! test
3703 Definition Lists: No nesting: Multiple dd's
3704 !! wikitext
3705 ;x
3706 :a
3707 :b
3708 !! html
3709 <dl><dt>x</dt>
3710 <dd>a</dd>
3711 <dd>b</dd></dl>
3712
3713 !! end
3714
3715 !! test
3716 Definition Lists: Indentation: Regular
3717 !! wikitext
3718 :i1
3719 ::i2
3720 :::i3
3721 !! html
3722 <dl><dd>i1
3723 <dl><dd>i2
3724 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3725
3726 !! end
3727
3728 !! test
3729 Definition Lists: Indentation: Missing 1st level
3730 !! wikitext
3731 ::i2
3732 :::i3
3733 !! html
3734 <dl><dd><dl><dd>i2
3735 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3736
3737 !! end
3738
3739 !! test
3740 Definition Lists: Indentation: Multi-level indent
3741 !! wikitext
3742 :::i3
3743 !! html
3744 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3745
3746 !! end
3747
3748 !! test
3749 Definition Lists: Hacky use to indent tables
3750 !! wikitext
3751 ::{|
3752 |foo
3753 |bar
3754 |}
3755 this text
3756 should be left alone
3757 !! html
3758 <dl><dd><dl><dd><table>
3759 <tr>
3760 <td>foo
3761 </td>
3762 <td>bar
3763 </td></tr></table></dd></dl></dd></dl>
3764 <p>this text
3765 should be left alone
3766 </p>
3767 !! end
3768
3769 !! test
3770 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3771 !! wikitext
3772 <!-- foo -->
3773 ::{|
3774 |foo
3775 |bar
3776 |}<!-- bar -->
3777 this text
3778 should be left alone
3779 !! html/parsoid
3780 <!-- foo -->
3781 <dl><dd><dl><dd><table><tr>
3782 <td>foo</td>
3783 <td>bar</td>
3784 </tr></table><!-- bar --></dd></dl></dd></dl>
3785 <p>this text
3786 should be left alone</p>
3787 !! end
3788
3789 !! test
3790 Definition Lists: Hacky use to indent tables, with comment before table
3791 !! wikitext
3792 ::<!-- foo -->{|
3793 |foo
3794 |}
3795 !! html/parsoid
3796 <dl><dd><dl><dd><!-- foo --><table><tr>
3797 <td>foo</td>
3798 </tr></table></dd></dl></dd></dl>
3799 !! end
3800
3801 # The trailing whitespace in this test is to catch a regression in
3802 # Parsoid after T54473.
3803 !! test
3804 Definition Lists: Hacky use to indent tables (WS-insensitive)
3805 !! wikitext
3806 : {|
3807 |a
3808 |}
3809 !! html/php
3810 <dl><dd><table>
3811 <tr>
3812 <td>a
3813 </td></tr></table></dd></dl>
3814
3815 !! html/parsoid
3816 <dl><dd> <table>
3817 <tbody><tr><td>a</td></tr>
3818 </tbody></table> </dd></dl>
3819 !! end
3820
3821 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3822 ## as an empty dt item. It also ignores all but the last ";" when followed
3823 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3824 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3825 ## ";"s.
3826 ##
3827 ## Ex: ";;t2 ::d2" is transformed into:
3828 ##
3829 ## <dl>
3830 ## <dt>t2 </dt>
3831 ## <dd>
3832 ## <dl>
3833 ## <dt></dt>
3834 ## <dd>d2</dd>
3835 ## </dl>
3836 ## </dd>
3837 ## </dl>
3838 ##
3839 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3840 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3841 ##
3842 ## <dl>
3843 ## <dt>
3844 ## <dl>
3845 ## <dt>t2 </dt>
3846 ## <dd>:d2</dd>
3847 ## </dl>
3848 ## </dt>
3849 ## </dl>
3850 ##
3851 ## All Parsoid only definition list tests have this difference.
3852 ##
3853 ## See also: https://phabricator.wikimedia.org/T8569
3854 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3855
3856 !! test
3857 Table / list interaction: indented table with lists in table contents
3858 !! wikitext
3859 :{|
3860 |-
3861 | a
3862 * b
3863 |-
3864 | c
3865 * d
3866 |}
3867 !! html
3868 <dl><dd><table>
3869
3870 <tr>
3871 <td> a
3872 <ul><li> b</li></ul>
3873 </td></tr>
3874 <tr>
3875 <td> c
3876 <ul><li> d</li></ul>
3877 </td></tr></table></dd></dl>
3878
3879 !! end
3880
3881 !!test
3882 Table / list interaction: lists nested in tables nested in indented lists
3883 !! wikitext
3884 :{|
3885 |
3886 :a
3887 :b
3888 |
3889 *c
3890 *d
3891 |}
3892
3893 *e
3894 *f
3895 !! html
3896 <dl><dd><table>
3897 <tr>
3898 <td>
3899 <dl><dd>a</dd>
3900 <dd>b</dd></dl>
3901 </td>
3902 <td>
3903 <ul><li>c</li>
3904 <li>d</li></ul>
3905 </td></tr></table></dd></dl>
3906 <ul><li>e</li>
3907 <li>f</li></ul>
3908
3909 !!end
3910
3911 !! test
3912 Definition Lists: Nesting: Multi-level (Parsoid only)
3913 !! options
3914 parsoid
3915 !! wikitext
3916 ;t1 :d1
3917 ;;t2 ::d2
3918 ;;;t3 :::d3
3919 !! html
3920 <dl>
3921 <dt>t1 </dt>
3922 <dd>d1</dd>
3923 <dt>
3924 <dl>
3925 <dt>t2 </dt>
3926 <dd>:d2</dd>
3927 <dt>
3928 <dl>
3929 <dt>t3 </dt>
3930 <dd>::d3</dd>
3931 </dl>
3932 </dt>
3933 </dl>
3934 </dt>
3935 </dl>
3936
3937
3938 !! end
3939
3940
3941 !! test
3942 Definition Lists: Nesting: Test 2 (Parsoid only)
3943 !! wikitext
3944 ;t1
3945 ::d2
3946 !! html/php+tidy
3947 <dl>
3948 <dt>t1</dt>
3949 <dd>
3950 <dl>
3951 <dd>d2</dd>
3952 </dl>
3953 </dd>
3954 </dl>
3955 !! html/parsoid
3956 <dl>
3957 <dt>t1</dt>
3958 <dd>
3959 <dl>
3960 <dd>d2</dd>
3961 </dl>
3962 </dd>
3963 </dl>
3964
3965 !! end
3966
3967
3968 !! test
3969 Definition Lists: Nesting: Test 3 (Parsoid only)
3970 !! wikitext
3971 :;t1
3972 ::::d2
3973 !! html/php+tidy
3974 <dl>
3975 <dd>
3976 <dl>
3977 <dt>t1</dt>
3978 <dd>
3979 <dl>
3980 <dd>
3981 <dl>
3982 <dd>d2</dd>
3983 </dl>
3984 </dd>
3985 </dl>
3986 </dd>
3987 </dl>
3988 </dd>
3989 </dl>
3990 !! html/parsoid
3991 <dl>
3992 <dd>
3993 <dl>
3994 <dt>t1</dt>
3995 <dd>
3996 <dl>
3997 <dd>
3998 <dl>
3999 <dd>d2</dd>
4000 </dl>
4001 </dd>
4002 </dl>
4003 </dd>
4004 </dl>
4005 </dd>
4006 </dl>
4007
4008 !! end
4009
4010
4011 !! test
4012 Definition Lists: Nesting: Test 4
4013 !! wikitext
4014 ::;t3
4015 :::d3
4016 !! html
4017 <dl><dd><dl><dd><dl><dt>t3</dt>
4018 <dd>d3</dd></dl></dd></dl></dd></dl>
4019
4020 !! end
4021
4022
4023 ## The Parsoid team believes the following three test exposes a
4024 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
4025 ## wrong to close the <dl> after the <dt> containing the <ul>.)
4026 ## It also exposes a "misfeature" in tidy, which doesn't like
4027 ## <dl> tags with a single <dt> child; it converts the <dt> into
4028 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
4029 !! test
4030 Definition Lists: Mixed Lists: Test 1
4031 !! wikitext
4032 :;* foo
4033 ::* bar
4034 :; baz
4035 !! html/php
4036 <dl><dd><dl><dt><ul><li> foo</li>
4037 <li> bar</li></ul></dt></dl>
4038 <dl><dt> baz</dt></dl></dd></dl>
4039
4040 !! html/php+tidy
4041 <dl>
4042 <dd>
4043 <dl>
4044 <dd>
4045 <ul>
4046 <li>foo</li>
4047 <li>bar</li>
4048 </ul>
4049 </dd>
4050 </dl>
4051 <dl>
4052 <dt>baz</dt>
4053 </dl>
4054 </dd>
4055 </dl>
4056 !! html/parsoid
4057 <dl>
4058 <dd><dl>
4059 <dt><ul>
4060 <li> foo
4061 </li>
4062 </ul></dt>
4063 <dd><ul>
4064 <li> bar
4065 </li>
4066 </ul></dd>
4067 <dt> baz</dt>
4068 </dl></dd>
4069 </dl>
4070 !! end
4071
4072 !! test
4073 Definition Lists: Mixed Lists: Test 2
4074 !! wikitext
4075 *: d1
4076 *: d2
4077 !! html
4078 <ul><li><dl><dd> d1</dd>
4079 <dd> d2</dd></dl></li></ul>
4080
4081 !! end
4082
4083
4084 !! test
4085 Definition Lists: Mixed Lists: Test 3
4086 !! wikitext
4087 *::: d1
4088 *::: d2
4089 !! html
4090 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
4091 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
4092
4093 !! end
4094
4095
4096 !! test
4097 Definition Lists: Mixed Lists: Test 4
4098 !! wikitext
4099 *;d1 :d2
4100 *;d3 :d4
4101 !! html
4102 <ul><li><dl><dt>d1&#160;</dt>
4103 <dd>d2</dd>
4104 <dt>d3&#160;</dt>
4105 <dd>d4</dd></dl></li></ul>
4106
4107 !! end
4108
4109
4110 !! test
4111 Definition Lists: Mixed Lists: Test 5
4112 !! wikitext
4113 *:d1
4114 *:: d2
4115 !! html
4116 <ul><li><dl><dd>d1
4117 <dl><dd> d2</dd></dl></dd></dl></li></ul>
4118
4119 !! end
4120
4121
4122 !! test
4123 Definition Lists: Mixed Lists: Test 6
4124 !! wikitext
4125 #*:d1
4126 #*::: d3
4127 !! html
4128 <ol><li><ul><li><dl><dd>d1
4129 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4130
4131 !! end
4132
4133
4134 !! test
4135 Definition Lists: Mixed Lists: Test 7
4136 !! wikitext
4137 :* d1
4138 :* d2
4139 !! html
4140 <dl><dd><ul><li> d1</li>
4141 <li> d2</li></ul></dd></dl>
4142
4143 !! end
4144
4145
4146 !! test
4147 Definition Lists: Mixed Lists: Test 8
4148 !! wikitext
4149 :* d1
4150 ::* d2
4151 !! html
4152 <dl><dd><ul><li> d1</li></ul>
4153 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
4154
4155 !! end
4156
4157
4158 !! test
4159 Definition Lists: Mixed Lists: Test 9
4160 !! wikitext
4161 *;foo :bar
4162 !! html
4163 <ul><li><dl><dt>foo&#160;</dt>
4164 <dd>bar</dd></dl></li></ul>
4165
4166 !! end
4167
4168
4169 !! test
4170 Definition Lists: Mixed Lists: Test 10
4171 !! wikitext
4172 *#;foo :bar
4173 !! html
4174 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4175 <dd>bar</dd></dl></li></ol></li></ul>
4176
4177 !! end
4178
4179 # The Parsoid team disagrees with the PHP parser's seemingly-random
4180 # rules regarding dd/dt on the next two tests. Parsoid is more
4181 # consistent, and recognizes the shared nesting and keeps the
4182 # still-open tags around until the nesting is complete.
4183 # (And tidy again converts <dt> to <dd> before 'bar'.)
4184
4185 !! test
4186 Definition Lists: Mixed Lists: Test 11
4187 !! wikitext
4188 *#*#;*;;foo :bar
4189 *#*#;boo :baz
4190 !! html/php
4191 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4192 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4193 <dl><dt>boo&#160;</dt>
4194 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4195
4196 !! html/php+tidy
4197 <ul>
4198 <li>
4199 <ol>
4200 <li>
4201 <ul>
4202 <li>
4203 <ol>
4204 <li>
4205 <dl>
4206 <dt>foo&#160;</dt>
4207 <dd>
4208 <ul>
4209 <li>
4210 <dl>
4211 <dd>
4212 <dl>
4213 <dt>bar</dt>
4214 </dl>
4215 </dd>
4216 </dl>
4217 </li>
4218 </ul>
4219 </dd>
4220 </dl>
4221 <dl>
4222 <dt>boo&#160;</dt>
4223 <dd>baz</dd>
4224 </dl>
4225 </li>
4226 </ol>
4227 </li>
4228 </ul>
4229 </li>
4230 </ol>
4231 </li>
4232 </ul>
4233 !! html/parsoid
4234 <ul>
4235 <li>
4236 <ol>
4237 <li>
4238 <ul>
4239 <li>
4240 <ol>
4241 <li>
4242 <dl>
4243 <dt>
4244 <ul>
4245 <li>
4246 <dl>
4247 <dt>
4248 <dl>
4249 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4250 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4251 </dl></dt>
4252 </dl></li>
4253 </ul></dt>
4254 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4255 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4256 </dl></li>
4257 </ol></li>
4258 </ul></li>
4259 </ol></li>
4260 </ul>
4261 !! end
4262
4263
4264 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
4265 # From whitelist:
4266 # * The test is wrong, there are two colons where there should be :;
4267 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4268 !! test
4269 Definition Lists: Weird Ones: Test 1
4270 !! wikitext
4271 *#;*::;; foo : bar (who uses this?)
4272 !! html/php
4273 <ul><li><ol><li><dl><dt> foo&#160;</dt>
4274 <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>
4275
4276 !! html/php+tidy
4277 <ul>
4278 <li>
4279 <ol>
4280 <li>
4281 <dl>
4282 <dt>foo&#160;</dt>
4283 <dd>
4284 <ul>
4285 <li>
4286 <dl>
4287 <dd>
4288 <dl>
4289 <dd>
4290 <dl>
4291 <dd>
4292 <dl>
4293 <dt>bar (who uses this?)</dt>
4294 </dl>
4295 </dd>
4296 </dl>
4297 </dd>
4298 </dl>
4299 </dd>
4300 </dl>
4301 </li>
4302 </ul>
4303 </dd>
4304 </dl>
4305 </li>
4306 </ol>
4307 </li>
4308 </ul>
4309 !! html/parsoid
4310 <ul>
4311 <li>
4312 <ol>
4313 <li>
4314 <dl>
4315 <dt>
4316 <ul>
4317 <li>
4318 <dl>
4319 <dd>
4320 <dl>
4321 <dd>
4322 <dl>
4323 <dt>
4324 <dl>
4325 <dt> foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span></dt>
4326 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
4327 </dl></dt>
4328 </dl></dd>
4329 </dl></dd>
4330 </dl></li>
4331 </ul></dt>
4332 </dl></li>
4333 </ol></li>
4334 </ul>
4335 !! end
4336
4337 !! test
4338 Definition Lists: colons occurring in tags
4339 !! wikitext
4340 ;a:b
4341 ;'''a:b'''
4342 ;<i>a:b</i>
4343 ;<span>a:b</span>
4344 ;<div>a:b</div>
4345 ;<div>a
4346 :b</div>
4347 ;{{echo|a:b}}
4348 ;{{echo|''a:b''}}
4349 ;;;''a:b''
4350 !! html+tidy
4351 <dl>
4352 <dt>a</dt>
4353 <dd>b</dd>
4354 <dt><b>a:b</b></dt>
4355 <dt><i>a:b</i></dt>
4356 <dt><span>a:b</span></dt>
4357 <dd>
4358 <div>a:b</div>
4359 </dd>
4360 <dd>
4361 <div>a
4362 <dl>
4363 <dd>b</dd>
4364 </dl>
4365 </div>
4366 </dd>
4367 <dt>a</dt>
4368 <dd>b</dd>
4369 <dt><i>a:b</i></dt>
4370 </dl>
4371 <dl>
4372 <dd>
4373 <dl>
4374 <dd>
4375 <dl>
4376 <dt><i>a:b</i></dt>
4377 </dl>
4378 </dd>
4379 </dl>
4380 </dd>
4381 </dl>
4382 !! html/parsoid
4383 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4384 <dt><b>a:b</b></dt>
4385 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4386 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4387 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4388 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4389 <dd>b</dd>
4390 <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>
4391 <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>
4392 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4393 !! end
4394
4395 !! test
4396 Definition Lists: colons and tables 1
4397 !! wikitext
4398 :{|
4399 | x
4400 |}
4401 :{|
4402 | y
4403 |}
4404 !! html
4405 <dl><dd><table>
4406 <tr>
4407 <td> x
4408 </td></tr></table></dd></dl>
4409 <dl><dd><table>
4410 <tr>
4411 <td> y
4412 </td></tr></table></dd></dl>
4413
4414 !! end
4415
4416 # Parsoid's output (as documented below) differs from php's in this case.
4417 # This is probably a bug. If we fixup parsoid to match php's output, the
4418 # above test should pass and the below test case can be removed. It is
4419 # unclear which output is more desirable.
4420
4421 !! test
4422 Definition Lists: colons and tables 2
4423 !! wikitext
4424 :{|
4425 | x
4426 |}
4427 :{|
4428 | y
4429 |}
4430 !! html/parsoid
4431 <dl><dd><table>
4432 <tr>
4433 <td> x
4434 </td></tr></table></dd>
4435 <dd><table>
4436 <tr>
4437 <td> y
4438 </td></tr></table></dd></dl>
4439 !! end
4440
4441 !! test
4442 Definition Lists: template interaction
4443 !! wikitext
4444 ::{{definition_list}}
4445
4446 :one
4447 ::{{definition_list}}
4448 :::two
4449 :::three
4450 ::four
4451 !! html/parsoid
4452 <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">
4453 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4454
4455 <dl><dd data-parsoid='{}'>one
4456 <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">
4457 </span><dd about="#mwt2">two
4458 <dl><dd>two</dd>
4459 <dd>three</dd></dl></dd>
4460 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4461 !! end
4462
4463
4464 ###
4465 ### External links
4466 ###
4467 !! test
4468 External links: non-bracketed
4469 !! wikitext
4470 Non-bracketed: http://example.com
4471 !! html
4472 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4473 </p>
4474 !! end
4475
4476 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4477 !! test
4478 External links: numbered
4479 !! wikitext
4480 Numbered: [http://example.com]
4481 Numbered: [http://example.net]
4482 Numbered: [http://example.com]
4483 !! html/php
4484 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4485 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4486 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4487 </p>
4488 !! html/parsoid
4489 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
4490 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
4491 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
4492 !!end
4493
4494 !! test
4495 External links: specified text
4496 !! wikitext
4497 Specified text: [http://example.com link]
4498 !! html
4499 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4500 </p>
4501 !!end
4502
4503 !! test
4504 External links: trail
4505 !! wikitext
4506 Linktrails should not work for external links: [http://example.com link]s
4507 !! html
4508 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4509 </p>
4510 !! end
4511
4512 !! test
4513 External links: dollar sign in URL
4514 !! wikitext
4515 http://example.com/1$2345
4516 !! html
4517 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4518 </p>
4519 !! end
4520
4521 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4522 !! test
4523 External links: dollar sign in URL (autonumber)
4524 !! wikitext
4525 [http://example.com/1$2345]
4526 !! html/php
4527 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4528 </p>
4529 !! html/parsoid
4530 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4531 !!end
4532
4533 !! test
4534 External links: open square bracket forbidden in URL (bug 4377)
4535 !! options
4536 parsoid=wt2html,wt2wt,html2html
4537 !! wikitext
4538 http://example.com/1[2345
4539 !! html/php
4540 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4541 </p>
4542 !! html/parsoid
4543 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4544 !! end
4545
4546 !! test
4547 External links: open square bracket forbidden in URL (named) (bug 4377)
4548 !! options
4549 parsoid=wt2html,html2html
4550 !! wikitext
4551 [http://example.com/1[2345]
4552 !! html/php
4553 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4554 </p>
4555 !! html/parsoid
4556 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4557 !!end
4558
4559 # parsoid adds a space before the link name
4560 !! test
4561 External links: open square bracket forbidden in URL (named) (bug 4377)
4562 Parsoid variant.
4563 !! wikitext
4564 [http://example.com/1 [2345]
4565 !! html
4566 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4567 </p>
4568 !!end
4569
4570 !! test
4571 External links: nowiki in URL link text (bug 6230)
4572 !! wikitext
4573 [http://example.com/ <nowiki>''example site''</nowiki>]
4574 !! html
4575 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4576 </p>
4577 !! end
4578
4579 !! test
4580 External links: newline forbidden in text (bug 6230 regression check)
4581 !! wikitext
4582 [http://example.com/ first
4583 second]
4584 !! html
4585 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4586 second]
4587 </p>
4588 !!end
4589
4590 !! test
4591 External links: Pipe char between url and text
4592 !! wikitext
4593 [http://example.com | link]
4594 !! html
4595 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4596 </p>
4597 !!end
4598
4599 !! test
4600 External links: protocol-relative URL in brackets
4601 !! wikitext
4602 [//example.com/ Test]
4603 !! html
4604 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4605 </p>
4606 !! end
4607
4608 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4609 !! test
4610 External links: protocol-relative URL in brackets without text
4611 !! wikitext
4612 [//example.com]
4613 !! html/php
4614 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4615 </p>
4616 !! html/parsoid
4617 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4618 !! end
4619
4620 !! test
4621 External links: protocol-relative URL in free text is left alone
4622 !! wikitext
4623 //example.com/Foo
4624 !! html
4625 <p>//example.com/Foo
4626 </p>
4627 !!end
4628
4629 !! test
4630 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
4631 !! wikitext
4632 foo//example.com/Foo
4633 !! html
4634 <p>foo//example.com/Foo
4635 </p>
4636 !! end
4637
4638 !! test
4639 External links: with no contents
4640 !! wikitext
4641 [http://en.wikipedia.org/wiki/Foo]
4642
4643 [[wikipedia:Foo|Bar]]
4644
4645 [[wikipedia:Foo|<span>Bar</span>]]
4646 !! html/php
4647 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4648 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4649 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4650 </p>
4651 !! html/parsoid
4652 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4653 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4654 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4655 !! end
4656
4657 !! test
4658 External links: Free with trailing punctuation
4659 !! wikitext
4660 http://example.com,
4661 http://example.com;
4662 http://example.com\
4663 http://example.com.
4664 http://example.com:
4665 http://example.com!
4666 http://example.com?
4667 http://example.com)
4668 http://example.com/url_with_(brackets)
4669 (http://example.com/url_without_brackets)
4670 http://example.com/url_with_entity&amp;
4671 http://example.com/url_with_entity&#x26;
4672 http://example.com/url_with_entity&#038;
4673 http://example.com/url_with_entity&nbsp;
4674 http://example.com/url_with_entity&#xA0;
4675 http://example.com/url_with_entity&#160;
4676 http://example.com/url_with_entity&lt;
4677 http://example.com/url_with_entity&#x3C;
4678 http://example.com/url_with_entity&#60;
4679 !! html/php
4680 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4681 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4682 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4683 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4684 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4685 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4686 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4687 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4688 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4689 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4690 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4691 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4692 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4693 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4694 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#xa0;
4695 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4696 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4697 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#x3c;
4698 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#60;
4699 </p>
4700 !! html/parsoid
4701 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>,
4702 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>;
4703 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>\
4704 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>.
4705 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:
4706 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>!
4707 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>?
4708 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)
4709 <a rel="mw:ExtLink" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4710 (<a rel="mw:ExtLink" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4711 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4712 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4713 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4714 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>
4715 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span>
4716 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span>
4717 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span>
4718 <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>
4719 <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>
4720 !! end
4721
4722 !! test
4723 External links: tricky Parsoid html2html case
4724 !! options
4725 parsoid=wt2html,wt2wt,html2html
4726 !! wikitext
4727 http://example.com/url_with_entity&amp;amp;
4728 !! html/php
4729 <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>;
4730 </p>
4731 !! html/parsoid
4732 <p><a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;amp">http://example.com/url_with_entity&amp;amp</a>;</p>
4733 !! end
4734
4735 !! test
4736 External links: Free with trailing quotes (T113666)
4737 !! wikitext
4738 '''News:''' Stuff here
4739
4740 news:'a'b''c''d e
4741 !! html/php
4742 <p><b>News:</b> Stuff here
4743 </p><p><a rel="nofollow" class="external free" href="news:'a'b">news:'a'b</a><i>c</i>d e
4744 </p>
4745 !! html/parsoid
4746 <p><b>News:</b> Stuff here</p>
4747 <p><a rel="mw:ExtLink" href="news:'a'b">news:'a'b</a><i>c</i>d e</p>
4748 !! end
4749
4750 !! test
4751 External links: Lone protocols are never linked (T105697)
4752 !! wikitext
4753 http://
4754 http://;
4755 (http://)
4756 bitcoin:
4757 bitcoin:;
4758 (bitcoin:)
4759 !! html
4760 <p>http://
4761 http://;
4762 (http://)
4763 bitcoin:
4764 bitcoin:;
4765 (bitcoin:)
4766 </p>
4767 !! end
4768
4769 !! test
4770 External links: No preceding word characters allowed (bug 65278)
4771 !! wikitext
4772 NOPEhttp://example.com
4773 N0http://example.com
4774 ok:http://example.com
4775 ok-http://example.com
4776 !! html
4777 <p>NOPEhttp://example.com
4778 N0http://example.com
4779 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4780 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4781 </p>
4782 !! end
4783
4784 !! test
4785 External links: nofollow domain exception
4786 !! wikitext
4787 A [https://no-nofollow.org/foobar link], and another [https://example.org link].
4788 !! html
4789 <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>.
4790 </p>
4791 !!end
4792
4793 !! test
4794 External image
4795 !! wikitext
4796 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4797 !! html
4798 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4799 </p>
4800 !! end
4801
4802 !! test
4803 External image from https
4804 !! wikitext
4805 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4806 !! html
4807 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4808 </p>
4809 !! end
4810
4811 !! test
4812 External image (when not allowed)
4813 !! options
4814 wgAllowExternalImages=0
4815 !! wikitext
4816 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4817 !! html
4818 <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>
4819 </p>
4820 !! end
4821
4822 !! test
4823 Link to non-http image, no img tag
4824 !! wikitext
4825 Link to non-http image, no img tag: ftp://example.com/test.jpg
4826 !! html
4827 <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>
4828 </p>
4829 !! end
4830
4831 !! test
4832 External links: terminating separator
4833 !! wikitext
4834 Terminating separator: http://example.com/thing,
4835 !! html
4836 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4837 </p>
4838 !! end
4839
4840 !! test
4841 External links: intervening separator
4842 !! wikitext
4843 Intervening separator: http://example.com/1,2,3
4844 !! html
4845 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4846 </p>
4847 !! end
4848
4849 !! test
4850 External links: old bug with URL in query
4851 !! wikitext
4852 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4853 !! html
4854 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4855 </p>
4856 !! end
4857
4858 !! test
4859 External links: old URL-in-URL bug, mixed protocols
4860 !! wikitext
4861 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4862 !! html
4863 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4864 </p>
4865 !!end
4866
4867 # Since Parsoid is starting to emit canonical wikitext for links,
4868 # [http://example.com http://example.com] will not RT back to that
4869 # form anymore.
4870 !! test
4871 External links: URL in text
4872 !! options
4873 parsoid=wt2html
4874 !! wikitext
4875 URL in text: [http://example.com http://example.com]
4876 !! html/php
4877 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4878 </p>
4879 !! html/parsoid
4880 <p>URL in text: <a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
4881 !! end
4882
4883 !! test
4884 External links: Clickable images
4885 !! wikitext
4886 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4887 !! html/php
4888 <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>
4889 </p>
4890 !! html/parsoid
4891 <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>
4892 !! end
4893
4894 !! test
4895 External links: raw ampersand
4896 !! wikitext
4897 Old &amp; use: http://x&y
4898 !! html
4899 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4900 </p>
4901 !! end
4902
4903 !! test
4904 External links: encoded ampersand
4905 !! wikitext
4906 Old &amp; use: http://x&amp;y
4907 !! html/php
4908 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4909 </p>
4910 !! html/parsoid
4911 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4912 !! end
4913
4914 !! test
4915 External links: encoded equals (bug 6102)
4916 !! wikitext
4917 http://example.com/?foo&#61;bar
4918 !! html/php
4919 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4920 </p>
4921 !! html/parsoid
4922 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4923 !! end
4924
4925 ##
4926 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4927 ## does it number them. As discussed in bug 53505, we can identify
4928 ## autonumbered links via CSS.
4929 ##
4930
4931 !! test
4932 External links: [raw ampersand]
4933 !! wikitext
4934 Old &amp; use: [http://x&y]
4935 !! html/php
4936 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4937 </p>
4938 !! html/parsoid
4939 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4940 !! end
4941
4942 # note that parsoid html is identical to [raw ampersand] case; so html2wt
4943 # mode will return the [raw ampersand] wikitext
4944 !! test
4945 External links: [encoded ampersand]
4946 !! options
4947 parsoid=wt2html,wt2wt,html2html
4948 !! wikitext
4949 Old &amp; use: [http://x&amp;y]
4950 !! html/php
4951 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4952 </p>
4953 !! html/parsoid
4954 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4955 !! end
4956
4957 !! test
4958 External links: [raw equals]
4959 !! wikitext
4960 [http://example.com/?foo=bar]
4961 !! html/php
4962 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4963 </p>
4964 !! html/parsoid
4965 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4966 !! end
4967
4968 # note that parsoid html is identical to [raw equals] case; so html2wt
4969 # mode will return the [raw equals] wikitext
4970 !! test
4971 External links: [encoded equals] (bug 6102)
4972 !! options
4973 parsoid=wt2html,wt2wt,html2html
4974 !! wikitext
4975 [http://example.com/?foo&#61;bar]
4976 !! html/php
4977 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4978 </p>
4979 !! html/parsoid
4980 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4981 !! end
4982
4983 # xxx parsoid strips the IDN character, so the round-trip tests will
4984 # obviously fail and are disabled. --cscott
4985 !! test
4986 External links: [IDN ignored character reference in hostname; strip it right off]
4987 !! options
4988 parsoid=wt2html,wt2wt,html2html
4989 !! wikitext
4990 [http://e&zwnj;xample.com/]
4991 !! html/php
4992 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
4993 </p>
4994 !! html/parsoid
4995 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
4996 !! end
4997
4998 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
4999 # Where an external link could easily circumvent the sanitization of the text of
5000 # a link like this (where an IDN-ignore character is in the URL somewhere), this
5001 # test demands a higher standard. That's a bit strange.
5002 #
5003 # Example:
5004 #
5005 # http://e‌xample.com -> [http://example.com|http://example.com]
5006 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
5007 #
5008 # The first example is sanitized, but the second is not. Any security benefits
5009 # from this production are trivial to circumvent. Either remove this test and
5010 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
5011 # the test accordingly.
5012 #
5013 # All our love,
5014 # The Parsoid team.
5015 # xxx parsoid strips the IDN character, so the round-trip tests will
5016 # obviously fail and are disabled. --cscott
5017 !! test
5018 External links: IDN ignored character reference in hostname; strip it right off
5019 !! options
5020 parsoid=wt2html,html2html
5021 !! wikitext
5022 http://e&zwnj;xample.com/
5023 !! html/php
5024 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
5025 </p>
5026 !! html/parsoid
5027 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
5028 !! end
5029
5030 !! test
5031 External links: www.jpeg.org (bug 554)
5032 !! wikitext
5033 http://www.jpeg.org
5034 !! html
5035 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
5036 </p>
5037 !! end
5038
5039 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
5040 !! test
5041 External links: URL within URL (original bug 2)
5042 !! wikitext
5043 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
5044 !! html/php
5045 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
5046 </p>
5047 !! html/parsoid
5048 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
5049 !! end
5050
5051 !! test
5052 BUG 361: URL inside bracketed URL
5053 !! wikitext
5054 [http://www.example.com/foo http://www.example.com/bar]
5055 !! html
5056 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
5057 </p>
5058 !! end
5059
5060 !! test
5061 BUG 361: URL within URL, not bracketed
5062 !! wikitext
5063 http://www.example.com/foo?=http://www.example.com/bar
5064 !! html
5065 <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>
5066 </p>
5067 !! end
5068
5069 !! test
5070 BUG 289: ">"-token in URL-tail
5071 !! wikitext
5072 http://www.example.com/<hello>
5073 !! html
5074 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
5075 </p>
5076 !!end
5077
5078 !! test
5079 BUG 289: literal ">"-token in URL-tail
5080 !! wikitext
5081 http://www.example.com/<b>html</b>
5082 !! html/php
5083 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
5084 </p>
5085 !! html/parsoid
5086 <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>
5087 !! end
5088
5089 !! test
5090 BUG 289: ">"-token in bracketed URL
5091 !! wikitext
5092 [http://www.example.com/<hello> stuff]
5093 !! html
5094 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
5095 </p>
5096 !!end
5097
5098 !! test
5099 BUG 289: literal ">"-token in bracketed URL
5100 !! wikitext
5101 [http://www.example.com/<b>html</b> stuff]
5102 !! html
5103 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
5104 </p>
5105 !!end
5106
5107 !! test
5108 BUG 289: literal double quote at end of URL
5109 !! wikitext
5110 http://www.example.com/"hello"
5111 !! html
5112 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
5113 </p>
5114 !!end
5115
5116 !! test
5117 BUG 289: literal double quote in bracketed URL
5118 !! wikitext
5119 [http://www.example.com/"hello" stuff]
5120 !! html
5121 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
5122 </p>
5123 !!end
5124
5125 !! test
5126 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
5127 !! wikitext
5128 [http://www.example.com test]
5129 !! html
5130 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
5131 </p>
5132 !! end
5133
5134 !! test
5135 External links: link text with spaces
5136 !! wikitext
5137 [http://www.example.com a b c]
5138 [http://www.example.com ''a'' ''b'']
5139 !! html
5140 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5141 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5142 </p>
5143 !! end
5144
5145 !! test
5146 External links: wiki links within external link (Bug 3695)
5147 !! options
5148 parsoid=wt2html,html2html
5149 !! wikitext
5150 [http://example.com [[wikilink]] embedded in ext link]
5151 !! html/php
5152 <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>
5153 </p>
5154 !! html/parsoid
5155 <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>
5156 !! end
5157
5158 !! test
5159 BUG 787: Links with one slash after the url protocol are invalid
5160 !! wikitext
5161 http:/example.com
5162
5163 [http:/example.com title]
5164 !! html
5165 <p>http:/example.com
5166 </p><p>[http:/example.com title]
5167 </p>
5168 !! end
5169
5170 !! test
5171 Bracketed external links with template-generated invalid target
5172 !! wikitext
5173 [{{echo|http:/example.com}} title]
5174 !! html
5175 <p>[http:/example.com title]
5176 </p>
5177 !! end
5178
5179 !! test
5180 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
5181 !! wikitext
5182 ''[http://example.com text'']
5183 [http://example.com '''text]'''
5184 ''Something [http://example.com in italic'']
5185 ''Something [http://example.com mixed''''', even bold]'''
5186 '''''Now [http://example.com both''''']
5187 !! html
5188 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5189 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5190 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5191 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5192 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5193 </p>
5194 !! end
5195
5196
5197 !! test
5198 Bug 4781: %26 in URL
5199 !! wikitext
5200 http://www.example.com/?title=AT%26T
5201 !! html/php
5202 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5203 </p>
5204 !! html/parsoid
5205 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
5206 !! end
5207
5208 # According to http://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5209 # % is actually legal in HTML5. Any change in output would need testing though.
5210 !! test
5211 Bug 4781, 5267: %25 in URL
5212 !! wikitext
5213 http://www.example.com/?title=100%25_Bran
5214 !! html/php
5215 <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>
5216 </p>
5217 !! html/parsoid
5218 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
5219 !! end
5220
5221 !! test
5222 Bug 4781, 5267: %28, %29 in URL
5223 !! wikitext
5224 http://www.example.com/?title=Ben-Hur_%281959_film%29
5225 !! html/php
5226 <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>
5227 </p>
5228 !! html/parsoid
5229 <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>
5230 !! end
5231
5232
5233 !! test
5234 Bug 4781: %26 in autonumber URL
5235 !! wikitext
5236 [http://www.example.com/?title=AT%26T]
5237 !! html/php
5238 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5239 </p>
5240 !! html/parsoid
5241 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
5242 !! end
5243
5244 !! test
5245 Bug 4781, 5267: %26 in autonumber URL
5246 !! wikitext
5247 [http://www.example.com/?title=100%25_Bran]
5248 !! html/php
5249 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5250 </p>
5251 !! html/parsoid
5252 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
5253 !! end
5254
5255 !! test
5256 Bug 4781, 5267: %28, %29 in autonumber URL
5257 !! wikitext
5258 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5259 !! html/php
5260 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5261 </p>
5262 !! html/parsoid
5263 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5264 !! end
5265
5266
5267 !! test
5268 Bug 4781: %26 in bracketed URL
5269 !! wikitext
5270 [http://www.example.com/?title=AT%26T link]
5271 !! html/php
5272 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5273 </p>
5274 !! html/parsoid
5275 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
5276 !! end
5277
5278 !! test
5279 Bug 4781, 5267: %25 in bracketed URL
5280 !! wikitext
5281 [http://www.example.com/?title=100%25_Bran link]
5282 !! html
5283 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5284 </p>
5285 !! end
5286
5287 !! test
5288 Bug 4781, 5267: %28, %29 in bracketed URL
5289 !! wikitext
5290 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5291 !! html/php
5292 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5293 </p>
5294 !! html/parsoid
5295 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5296 !! end
5297
5298 !! test
5299 External link containing a period in the anchor. (bug 63947)
5300 !! wikitext
5301 [//foo.org/bar#baz. bang]
5302
5303 [//foo.org/bar. bang]
5304 !! html/php
5305 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5306 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5307 </p>
5308 !! html/parsoid
5309 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
5310 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
5311 !! end
5312
5313 !! test
5314 External link containing a single quote. (bug 63947)
5315 !! wikitext
5316 [//foo.org/bar'baz]
5317
5318 [//foo.org/bar'baz bang]
5319 !! html/php
5320 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
5321 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
5322 </p>
5323 !! html/parsoid
5324 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
5325 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
5326 !! end
5327
5328 !! test
5329 External link containing double-single-quotes in text '' (bug 4598 sanity check)
5330 !! wikitext
5331 Some [http://example.com/ pretty ''italics'' and stuff]!
5332 !! html
5333 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5334 </p>
5335 !! end
5336
5337 !! test
5338 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
5339 !! wikitext
5340 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5341 !! html
5342 <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>
5343 </p>
5344 !! end
5345
5346 !! test
5347 External link containing double-single-quotes with no space separating the url from text in italics
5348 !! wikitext
5349 [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]].]
5350 !! html/php
5351 <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>
5352 </p>
5353 !! html/php+tidy
5354 <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>
5355 !! html/parsoid
5356 <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>
5357 !! end
5358
5359 !! test
5360 External link with comments in link text
5361 !! wikitext
5362 [http://www.google.com Google <!-- comment -->]
5363 !! html/php
5364 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5365 </p>
5366 !! html/parsoid
5367 <p><a rel="mw:ExtLink" href="http://www.google.com">Google <!-- comment --></a></p>
5368 !! end
5369
5370 !! test
5371 External link to bare IPv4 address
5372 !! wikitext
5373 [http://192.168.0.1 Link]
5374 !! html/php
5375 <p><a rel="nofollow" class="external text" href="http://192.168.0.1">Link</a>
5376 </p>
5377 !! html/parsoid
5378 <p><a rel="mw:ExtLink" href="http://192.168.0.1">Link</a></p>
5379 !! end
5380
5381 !! test
5382 URL-encoding in URL functions (single parameter)
5383 !! wikitext
5384 {{localurl:Some page|amp=&}}
5385 !! html
5386 <p>/index.php?title=Some_page&amp;amp=&amp;
5387 </p>
5388 !! end
5389
5390 !! test
5391 URL-encoding in URL functions (multiple parameters)
5392 !! wikitext
5393 {{localurl:Some page|q=?&amp=&}}
5394 !! html
5395 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5396 </p>
5397 !! end
5398
5399 !! test
5400 Brackets in urls
5401 !! wikitext
5402 http://example.com/index.php?foozoid%5B%5D=bar
5403
5404 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5405 !! html/php
5406 <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>
5407 </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>
5408 </p>
5409 !! html/parsoid
5410 <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>
5411
5412 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
5413 !! end
5414
5415 !! test
5416 IPv6 urls, autolink format (T23261)
5417 !! wikitext
5418 http://[2404:130:0:1000::187:2]/index.php
5419
5420 Examples from RFC 2373, section 2.2:
5421 * http://[1080::8:800:200C:417A]/unicast
5422 * http://[FF01::101]/multicast
5423 * http://[::1]/loopback
5424 * http://[::]/unspecified
5425 * http://[::13.1.68.3]/ipv4compat
5426 * http://[::FFFF:129.144.52.38]/ipv4compat
5427
5428 Examples from RFC 2732, section 2:
5429 * http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5430 * http://[1080:0:0:0:8:800:200C:417A]/index.html
5431 * http://[3ffe:2a00:100:7031::1]
5432 * http://[1080::8:800:200C:417A]/foo
5433 * http://[::192.9.5.5]/ipng
5434 * http://[::FFFF:129.144.52.38]:80/index.html
5435 * http://[2010:836B:4179::836B:4179]
5436
5437 !! html/php
5438 <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>
5439 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5440 </p>
5441 <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>
5442 <li> <a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5443 <li> <a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5444 <li> <a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5445 <li> <a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5446 <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>
5447 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5448 </p>
5449 <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>
5450 <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>
5451 <li> <a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5452 <li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5453 <li> <a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5454 <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>
5455 <li> <a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5456
5457 !! html/parsoid
5458 <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>
5459
5460 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5461 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5462 <li> <a rel="mw:ExtLink" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5463 <li> <a rel="mw:ExtLink" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5464 <li> <a rel="mw:ExtLink" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5465 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5466 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5467
5468 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5469 <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>
5470 <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>
5471 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5472 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5473 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5474 <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>
5475 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5476 !! end
5477
5478 !! test
5479 IPv6 urls, bracketed format (T23261)
5480 !! wikitext
5481 [http://[2404:130:0:1000::187:2]/index.php test]
5482
5483 Examples from RFC 2373, section 2.2:
5484 * [http://[1080::8:800:200C:417A] unicast]
5485 * [http://[FF01::101] multicast]
5486 * [http://[::1]/ loopback]
5487 * [http://[::] unspecified]
5488 * [http://[::13.1.68.3] ipv4compat]
5489 * [http://[::FFFF:129.144.52.38] ipv4compat]
5490
5491 Examples from RFC 2732, section 2:
5492 * [http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5493 * [http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5494 * [http://[3ffe:2a00:100:7031::1] 3]
5495 * [http://[1080::8:800:200C:417A]/foo 4]
5496 * [http://[::192.9.5.5]/ipng 5]
5497 * [http://[::FFFF:129.144.52.38]:80/index.html 6]
5498 * [http://[2010:836B:4179::836B:4179] 7]
5499
5500 !! html/php
5501 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5502 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5503 </p>
5504 <ul><li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5505 <li> <a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5506 <li> <a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5507 <li> <a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5508 <li> <a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5509 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5510 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5511 </p>
5512 <ul><li> <a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5513 <li> <a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5514 <li> <a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5515 <li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5516 <li> <a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5517 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5518 <li> <a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5519
5520 !! html/parsoid
5521 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php">test</a></p>
5522
5523 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5524 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5525 <li> <a rel="mw:ExtLink" href="http://[FF01::101]">multicast</a></li>
5526 <li> <a rel="mw:ExtLink" href="http://[::1]/">loopback</a></li>
5527 <li> <a rel="mw:ExtLink" href="http://[::]">unspecified</a></li>
5528 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]">ipv4compat</a></li>
5529 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5530
5531 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5532 <ul><li> <a rel="mw:ExtLink" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5533 <li> <a rel="mw:ExtLink" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5534 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5535 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5536 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">5</a></li>
5537 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5538 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5539 !! end
5540
5541 !! test
5542 Non-extlinks in brackets
5543 !! wikitext
5544 [foo]
5545 [foo bar]
5546 [foo ''bar'']
5547 [fool's] errand
5548 [fool's errand]
5549 [{{echo|foo}}]
5550 [{{echo|foo}} bar]
5551 [{{echo|foo}} ''bar'']
5552 [{{echo|foo}}l's] errand
5553 [{{echo|foo}}l's errand]
5554 [url={{echo|foo}}]
5555 [url=http://example.com]
5556 [http:// bare protocols don't count]
5557 !! html/php
5558 <p>[foo]
5559 [foo bar]
5560 [foo <i>bar</i>]
5561 [fool's] errand
5562 [fool's errand]
5563 [foo]
5564 [foo bar]
5565 [foo <i>bar</i>]
5566 [fool's] errand
5567 [fool's errand]
5568 [url=foo]
5569 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5570 [http:// bare protocols don't count]
5571 </p>
5572 !! html/parsoid
5573 <p>[foo]
5574 [foo bar]
5575 [foo <i>bar</i>]
5576 [fool's] errand
5577 [fool's errand]
5578 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span>]
5579 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> bar]
5580 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> <i>bar</i>]
5581 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span>] errand
5582 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span> errand]
5583 [<span typeof="mw:Placeholder" data-parsoid='{"src":"url={{echo|foo}}"}'>url=foo</span>]
5584 [url=<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>]
5585 [http:// bare protocols don't count]</p>
5586 !! end
5587
5588 !! test
5589 Percent encoding in external links
5590 !! wikitext
5591 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
5592 !! html/php
5593 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
5594 </p>
5595 !! html/parsoid
5596 <p><a rel="mw:ExtLink"
5597 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
5598 !! end
5599
5600 !! test
5601 Use url link syntax for links where the content is equal the link target
5602 !! wikitext
5603 http://example.com
5604 !! html/php
5605 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5606 </p>
5607 !! html/parsoid
5608 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5609 !! end
5610
5611 !! test
5612 Parenthesis in external links, especially URL links
5613 !! wikitext
5614 http://example.com)
5615
5616 http://example.com/test)
5617
5618 http://example.com/(test)
5619
5620 http://example.com/((test)
5621
5622 (http://example.com/(test))
5623
5624 (http://example.com/(test)))))
5625
5626 http://example.com/a)b
5627
5628 [http://example.com) foo]
5629 !! html/php
5630 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5631 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
5632 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
5633 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
5634 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
5635 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
5636 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
5637 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5638 </p>
5639 !! html/parsoid
5640 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
5641 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
5642 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
5643 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
5644 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
5645 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
5646 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
5647 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
5648 !! end
5649
5650 !! test
5651 Parenthesis in external links, w/ transclusion or comment
5652 !! wikitext
5653 (http://example.com/{{echo|hi}})
5654
5655 (http://example.com<!-- hi -->)
5656 !! html/php
5657 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5658 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5659 </p>
5660 !! html/parsoid
5661 <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>
5662
5663 <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>
5664 !! end
5665
5666 !! test
5667 Serialize <a> tags with invalid link targets as plain text
5668 !! options
5669 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
5670 !! html/parsoid
5671 <a rel="mw:WikiLink" href="[[foo]]">text</a>
5672 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
5673 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
5674 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
5675 !! wikitext
5676 text
5677 <nowiki>*</nowiki>text
5678 <nowiki>[[foo]]</nowiki>
5679 <nowiki>*</nowiki>a <nowiki>[[foo]]</nowiki>
5680 !! end
5681
5682 !! test
5683 mw:ExtLink -vs- mw:WikiLink (T94723)
5684 !! options
5685 parsoid=html2wt
5686 !! html/parsoid
5687 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>Bar</a>
5688 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
5689 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5690 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5691 <p>
5692 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5693 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5694 </p>
5695 !! wikitext
5696 [[Foo|Bar]]
5697 [[Foo|Bar]]
5698 [[wikipedia:Foo|Bar]]
5699 [[wikipedia:Foo|Bar]]
5700
5701 [[wikipedia:European_Robin|European Robin]]
5702 [[wikipedia:European_Robin|European Robin]]
5703 !! end
5704
5705 !! test
5706 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
5707 !! options
5708 parsoid=wt2wt
5709 !! wikitext
5710 [http://en.wikipedia.org/wiki/European_Robin European Robin]
5711 !! html/parsoid
5712 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
5713 !! end
5714
5715
5716 ###
5717 ### Quotes
5718 ###
5719
5720 !! test
5721 Quotes
5722 !! wikitext
5723 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5724
5725 Normal text. '''''Bold italic text.''''' Normal text.
5726 !! html
5727 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5728 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5729 </p>
5730 !! end
5731
5732
5733 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5734 # parser strips. The wikitext contains just the first half of the bold
5735 # quote pair.
5736 !! test
5737 Unclosed and unmatched quotes
5738 !! wikitext
5739 '''''Bold italic text '''with bold deactivated''' in between.'''''
5740
5741 '''''Bold italic text ''with italic deactivated'' in between.'''''
5742
5743 '''Bold text..
5744
5745 ..spanning two paragraphs (should not work).'''
5746
5747 '''Bold tag left open
5748
5749 ''Italic tag left open
5750
5751 Normal text.
5752
5753 <!-- Unmatching number of opening, closing tags: -->
5754 '''This year''''s election ''should'' beat '''last year''''s.
5755
5756 ''Tom'''s car is bigger than ''Susan'''s.
5757
5758 Plain ''italic'''s plain
5759 !! html/php
5760 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5761 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5762 </p><p><b>Bold text..</b>
5763 </p><p>..spanning two paragraphs (should not work).
5764 </p><p><b>Bold tag left open</b>
5765 </p><p><i>Italic tag left open</i>
5766 </p><p>Normal text.
5767 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5768 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5769 </p><p>Plain <i>italic'</i>s plain
5770 </p>
5771 !! html/parsoid
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).<b></b>
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>
5780 <!-- Unmatching number of opening, closing tags: -->
5781 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5782 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5783 </p><p>Plain <i>italic'</i>s plain
5784 </p>
5785 !! end
5786
5787 ###
5788 ### Tables
5789 ###
5790 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5791 ###
5792
5793 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5794 # is the bare minimum required by the spec, see:
5795 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5796 # Parsoid team replies: empty table tags are legal in HTML5
5797 !! test
5798 A table with no data.
5799 !! options
5800 parsoid=wt2html
5801 !! wikitext
5802 {||}
5803 !! html/php
5804
5805 !! html/parsoid
5806 <table></table>
5807
5808 !! end
5809
5810 !! test
5811 A table with stray table end tags on start tag line (wt2html)
5812 !! options
5813 parsoid=wt2html
5814 !! wikitext
5815 {|style="color: red;"|}
5816
5817 {|style="color: red;" |}
5818 |foo
5819 |}
5820
5821 {|style="color: red;"|} id="foo"
5822 |foo
5823 |}
5824
5825 {|style="color: red;" |} id="foo"
5826 |foo
5827 |}
5828 !! html
5829 <table style="color: red;"></table>
5830
5831 <table style="color: red;">
5832 <tbody><tr>
5833 <td>foo</td>
5834 </tr></tbody>
5835 </table>
5836
5837 <table style="color: red;" id="foo">
5838 <tbody><tr>
5839 <td>foo</td>
5840 </tr></tbody>
5841 </table>
5842
5843 <table style="color: red;" id="foo">
5844 <tbody><tr>
5845 <td>foo</td>
5846 </tr></tbody>
5847 </table>
5848
5849 !! end
5850
5851 !! test
5852 A table with no data (take 2)
5853 !! wikitext
5854 {|
5855 |}
5856 !! html/parsoid
5857 <table></table>
5858 !! end
5859
5860 # A table with nothing but a caption is invalid XHTML, we might want to render
5861 # this as <p>caption</p>
5862 # Parsoid team replies: table with only a caption is legal in HTML5
5863 !! test
5864 A table with nothing but a caption
5865 !! wikitext
5866 {|
5867 |+ caption
5868 |}
5869 !! html/php
5870 <table>
5871 <caption> caption
5872 </caption><tr><td></td></tr></table>
5873
5874 !! html/parsoid
5875 <table><caption> caption</caption></table>
5876 !! end
5877
5878 !! test
5879 A table with caption with default-spaced attributes and a table row
5880 !! wikitext
5881 {|
5882 |+ style="color: red;" | caption1
5883 |-
5884 | foo
5885 |}
5886 !! html
5887 <table>
5888 <caption style="color: red;"> caption1
5889 </caption>
5890 <tr>
5891 <td> foo
5892 </td></tr></table>
5893
5894 !! end
5895
5896 !! test
5897 A table with captions with non-default spaced attributes and a table row
5898 !! wikitext
5899 {|
5900 |+style="color: red;"|caption2
5901 |+ style="color: red;"| caption3
5902 |-
5903 | foo
5904 |}
5905 !! html
5906 <table>
5907 <caption style="color: red;">caption2
5908 </caption>
5909 <caption style="color: red;"> caption3
5910 </caption>
5911 <tr>
5912 <td> foo
5913 </td></tr></table>
5914
5915 !! end
5916
5917 !! test
5918 Table td-cell syntax variations
5919 !! wikitext
5920 {|
5921 | foo bar foo | baz
5922 | foo bar foo || baz
5923 | style='color:red;' | baz
5924 | style='color:red;' || baz
5925 |}
5926 !! html
5927 <table>
5928 <tr>
5929 <td> baz
5930 </td>
5931 <td> foo bar foo </td>
5932 <td> baz
5933 </td>
5934 <td style="color:red;"> baz
5935 </td>
5936 <td> style='color:red;' </td>
5937 <td> baz
5938 </td></tr></table>
5939
5940 !! end
5941
5942 !! test
5943 Simple table
5944 !! wikitext
5945 {|
5946 | 1 || 2
5947 |-
5948 | 3 || 4
5949 |}
5950 !! html
5951 <table>
5952 <tr>
5953 <td> 1 </td>
5954 <td> 2
5955 </td></tr>
5956 <tr>
5957 <td> 3 </td>
5958 <td> 4
5959 </td></tr></table>
5960
5961 !! end
5962
5963 !! test
5964 Simple table but with multiple dashes for row wikitext
5965 !! wikitext
5966 {|
5967 | foo
5968 |-----
5969 | bar
5970 |}
5971 !! html
5972 <table>
5973 <tr>
5974 <td> foo
5975 </td></tr>
5976 <tr>
5977 <td> bar
5978 </td></tr></table>
5979
5980 !! end
5981
5982 !! test
5983 Multiplication table
5984 !! wikitext
5985 {| border="1" cellpadding="2"
5986 |+Multiplication table
5987 |-
5988 ! &times; !! 1 !! 2 !! 3
5989 |-
5990 ! 1
5991 | 1 || 2 || 3
5992 |-
5993 ! 2
5994 | 2 || 4 || 6
5995 |-
5996 ! 3
5997 | 3 || 6 || 9
5998 |-
5999 ! 4
6000 | 4 || 8 || 12
6001 |-
6002 ! 5
6003 | 5 || 10 || 15
6004 |}
6005 !! html
6006 <table border="1" cellpadding="2">
6007 <caption>Multiplication table
6008 </caption>
6009 <tr>
6010 <th> &#215; </th>
6011 <th> 1 </th>
6012 <th> 2 </th>
6013 <th> 3
6014 </th></tr>
6015 <tr>
6016 <th> 1
6017 </th>
6018 <td> 1 </td>
6019 <td> 2 </td>
6020 <td> 3
6021 </td></tr>
6022 <tr>
6023 <th> 2
6024 </th>
6025 <td> 2 </td>
6026 <td> 4 </td>
6027 <td> 6
6028 </td></tr>
6029 <tr>
6030 <th> 3
6031 </th>
6032 <td> 3 </td>
6033 <td> 6 </td>
6034 <td> 9
6035 </td></tr>
6036 <tr>
6037 <th> 4
6038 </th>
6039 <td> 4 </td>
6040 <td> 8 </td>
6041 <td> 12
6042 </td></tr>
6043 <tr>
6044 <th> 5
6045 </th>
6046 <td> 5 </td>
6047 <td> 10 </td>
6048 <td> 15
6049 </td></tr></table>
6050
6051 !! end
6052
6053 !! test
6054 Accept "||" in table headings
6055 !! wikitext
6056 {|
6057 !h1 || h2
6058 |}
6059 !! html
6060 <table>
6061 <tr>
6062 <th>h1 </th>
6063 <th> h2
6064 </th></tr></table>
6065
6066 !! end
6067
6068 !! test
6069 Accept "!!" in table data
6070 !! wikitext
6071 {|
6072 | Foo!! ||
6073 |}
6074 !! html
6075 <table>
6076 <tr>
6077 <td> Foo!! </td>
6078 <td>
6079 </td></tr></table>
6080
6081 !! html/parsoid
6082 <table>
6083 <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>
6084 </tbody></table>
6085 !! end
6086
6087 !! test
6088 Accept "||" in indented table headings
6089 !! wikitext
6090 :{|
6091 !h1 || h2
6092 |}
6093 !! html
6094 <dl><dd><table>
6095 <tr>
6096 <th>h1 </th>
6097 <th> h2
6098 </th></tr></table></dd></dl>
6099
6100 !! end
6101
6102 !! test
6103 Accept "!!" in templates
6104 !! wikitext
6105 {|
6106 !a {{echo|b!!c}}
6107 |}
6108 !! html/php
6109 <table>
6110 <tr>
6111 <th>a b</th>
6112 <th>c
6113 </th></tr></table>
6114
6115 !! html/parsoid
6116 <table>
6117 <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>
6118 !! end
6119
6120 !! test
6121 Accept "!!" in table headings after newline
6122 !! wikitext
6123 {|
6124 !a
6125 b!!c
6126 |}
6127 !! html/php
6128 <table>
6129 <tr>
6130 <th>a
6131 <p>b!!c
6132 </p>
6133 </th></tr></table>
6134
6135 !! html/parsoid
6136 <table>
6137 <tbody><tr><th>a
6138 <p>b!!c</p></th></tr>
6139 </tbody></table>
6140 !! end
6141
6142 !! test
6143 Accept "!!" in table data of mixed wikitext / html syntax
6144 !! wikitext
6145 {|
6146 !a
6147 <tr><td>b!!c</td></tr>
6148 |}
6149 !! html+tidy
6150 <table>
6151 <tr>
6152 <th>a</th>
6153 </tr>
6154 <tr>
6155 <td>b!!c</td>
6156 </tr>
6157 </table>
6158 !! html/parsoid
6159 <table>
6160 <tbody><tr><th>a</th></tr>
6161 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6162 </tbody></table>
6163 !! end
6164
6165 !! test
6166 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6167 !! wikitext
6168 {|
6169 !| h1
6170 || a
6171 |}
6172 !! html
6173 <table>
6174 <tr>
6175 <th> h1
6176 </th>
6177 <td> a
6178 </td></tr></table>
6179
6180 !! end
6181
6182 !!test
6183 Accept "| !" at start of line in tables (ignore !-attribute)
6184 !! wikitext
6185 {|
6186 |-
6187 | !style="color:red" | bar
6188 |}
6189 !! html
6190 <table>
6191
6192 <tr>
6193 <td> bar
6194 </td></tr></table>
6195
6196 !!end
6197
6198 !!test
6199 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 +/-
6200 !! wikitext
6201 {|
6202 |-
6203 |style='color:red;'|+1
6204 |style='color:blue;'|-1
6205 |-
6206 | 1 || 2 || 3
6207 | 1 ||+2 ||-3
6208 |-
6209 | +1
6210 | -1
6211 |}
6212 !! html
6213 <table>
6214
6215 <tr>
6216 <td style="color:red;">+1
6217 </td>
6218 <td style="color:blue;">-1
6219 </td></tr>
6220 <tr>
6221 <td> 1 </td>
6222 <td> 2 </td>
6223 <td> 3
6224 </td>
6225 <td> 1 </td>
6226 <td>+2 </td>
6227 <td>-3
6228 </td></tr>
6229 <tr>
6230 <td> +1
6231 </td>
6232 <td> -1
6233 </td></tr></table>
6234
6235 !!end
6236
6237 !! test
6238 Table rowspan
6239 !! wikitext
6240 {| border=1
6241 | Cell 1, row 1
6242 |rowspan=2| Cell 2, row 1 (and 2)
6243 | Cell 3, row 1
6244 |-
6245 | Cell 1, row 2
6246 | Cell 3, row 2
6247 |}
6248 !! html
6249 <table border="1">
6250 <tr>
6251 <td> Cell 1, row 1
6252 </td>
6253 <td rowspan="2"> Cell 2, row 1 (and 2)
6254 </td>
6255 <td> Cell 3, row 1
6256 </td></tr>
6257 <tr>
6258 <td> Cell 1, row 2
6259 </td>
6260 <td> Cell 3, row 2
6261 </td></tr></table>
6262
6263 !! end
6264
6265 !! test
6266 Nested table
6267 !! wikitext
6268 {| border=1
6269 | &alpha;
6270 |
6271 {| bgcolor=#ABCDEF border=2
6272 |nested
6273 |-
6274 |table
6275 |}
6276 |the original table again
6277 |}
6278 !! html
6279 <table border="1">
6280 <tr>
6281 <td> &#945;
6282 </td>
6283 <td>
6284 <table bgcolor="#ABCDEF" border="2">
6285 <tr>
6286 <td>nested
6287 </td></tr>
6288 <tr>
6289 <td>table
6290 </td></tr></table>
6291 </td>
6292 <td>the original table again
6293 </td></tr></table>
6294
6295 !! end
6296
6297 !! test
6298 Invalid attributes in table cell (bug 1830)
6299 !! wikitext
6300 {|
6301 |Cell:|broken
6302 |}
6303 !! html
6304 <table>
6305 <tr>
6306 <td>broken
6307 </td></tr></table>
6308
6309 !! end
6310
6311 !! test
6312 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6313 !! wikitext
6314 {|
6315 | title="foo" |bar
6316 | title="foo<nowiki>|</nowiki>" |bar
6317 | title="foo<nowiki>|</nowiki>" bar
6318 |}
6319 !! html/php
6320 <table>
6321 <tr>
6322 <td title="foo">bar
6323 </td>
6324 <td title="foo&#124;">bar
6325 </td>
6326 <td> title="foo|" bar
6327 </td></tr></table>
6328
6329 !! html/parsoid
6330 <table>
6331 <tbody><tr><td title="foo">bar</td>
6332 <td title="foo|" data-parsoid='{"a":{"title":"foo|"},"sa":{"title":"foo&lt;nowiki>|&lt;/nowiki>"},"autoInsertedEnd":true}'>bar</td>
6333 <td> title="foo<span typeof="mw:Nowiki">|</span>" bar</td></tr>
6334 </tbody></table>
6335 !! end
6336
6337 # See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
6338 # N.B. The "|}" to close the table is missing from the input, so parsoid's
6339 # *2wt modes will fail.
6340 !! test
6341 Table security: embedded pipes
6342 !! options
6343 parsoid=wt2html,html2html
6344 !! wikitext
6345 {|
6346 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6347 !! html/php
6348 <table>
6349 <tr>
6350 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6351 <td>]" onmouseover="alert(document.cookie)"&gt;test
6352 </td>
6353 </tr>
6354 </table>
6355
6356 !! html/parsoid
6357 <table><tbody>
6358 <tr>
6359 <td data-parsoid='{"startTagSrc":"| ","attrSepSrc":"|","autoInsertedEnd":true}'><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
6360 !! end
6361
6362 !! test
6363 Element attributes with double ! should not be broken up by <th>
6364 !! wikitext
6365 {|
6366 ! hi <div class="!!">ha</div> ho
6367 |}
6368 !! html/php
6369 <table>
6370 <tr>
6371 <th> hi <div class="!!">ha</div> ho
6372 </th></tr></table>
6373
6374 !! html/parsoid
6375 <table>
6376 <tbody><tr><th> hi <div class="!!" data-parsoid='{"stx":"html"}'>ha</div> ho</th></tr>
6377 </tbody></table>
6378 !! end
6379
6380 !! test
6381 ! and || in element attributes should not be parsed as <th>/<td>
6382 !! wikitext
6383 {|
6384 | <div style="color: red !important;" data-contrived="put this here ||">hi</div>
6385 |}
6386 !! html/php
6387 <table>
6388 <tr>
6389 <td> <div style="color: red !important;" data-contrived="put this here &#124;&#124;">hi</div>
6390 </td></tr></table>
6391
6392 !! html/parsoid
6393 <table>
6394 <tbody><tr><td> <div style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"stx":"html"}'>hi</div></td></tr>
6395 </tbody></table>
6396 !! end
6397
6398 # FIXME: The output seems broken. Filed as T110268.
6399 !! test
6400 ! and || in td attributes should not be parsed as <th>/<td>
6401 !! options
6402 parsoid=wt2html
6403 !! wikitext
6404 {|
6405 | style="color: red !important;" data-contrived="put this here ||" | foo
6406 |}
6407 !! html/php
6408 <table>
6409 <tr>
6410 <td> style="color: red !important;" data-contrived="put this here </td>
6411 <td> foo
6412 </td></tr></table>
6413
6414 !! html/parsoid
6415 <table>
6416 <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>
6417 </tbody></table>
6418 !! end
6419
6420 !! test
6421 Break on | in element attribute in template
6422 !! options
6423 parsoid=wt2html,html2html
6424 !! wikitext
6425 {{echo|1=<div class="hi|ho">ha</div>}}
6426 !! html/php
6427 <p>ho"&gt;ha&lt;/div&gt;
6428 </p>
6429 !! html/parsoid
6430 <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>
6431 !! end
6432
6433 ## We don't support roundtripping of these attributes in Parsoid.
6434 ## Selective serialization takes care of preventing dirty diffs.
6435 ## But, on edits, we dirty-diff the invalid attribute text.
6436 !! test
6437 Invalid text in table attributes should be discarded
6438 !! options
6439 parsoid=wt2html
6440 !! wikitext
6441 {| <span>boo</span> style='border:1px solid black'
6442 | <span>boo</span> style='color:blue' | 1
6443 |<span>boo</span> style='color:blue'| 2
6444 |}
6445 !! html/php
6446 <table style="border:1px solid black">
6447 <tr>
6448 <td style="color:blue"> 1
6449 </td>
6450 <td style="color:blue"> 2
6451 </td></tr></table>
6452
6453 !! html/parsoid
6454 <table style="border:1px solid black">
6455 <tr>
6456 <td style="color:blue"> 1</td>
6457 <td style="color:blue"> 2</td>
6458 </tr>
6459 </table>
6460 !! end
6461
6462 !! test
6463 Invalid text in table attributes should be preserved by selective serializer
6464 !! options
6465 parsoid={
6466 "modes": ["selser"],
6467 "changes": [
6468 ["td:first-child", "text", "abc"],
6469 ["td + td", "text", "xyz"]
6470 ]
6471 }
6472 !! wikitext
6473 {| <span>boo</span> style='border:1px solid black'
6474 | <span>boo</span> style='color:blue' | 1
6475 |<span>boo</span> style='color:blue'| 2
6476 |}
6477 !! wikitext/edited
6478 {| <span>boo</span> style='border:1px solid black'
6479 | <span>boo</span> style='color:blue' |abc
6480 |<span>boo</span> style='color:blue'|xyz
6481 |}
6482 !! end
6483
6484 !! test
6485 1. Template-generated table cell attributes and cell content
6486 !! wikitext
6487 {|
6488 |{{table_attribs}}
6489 | {{table_attribs}}
6490 || {{table_attribs_5}}
6491 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6492 |align=center {{table_attribs}}
6493 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6494 |}
6495 !! html
6496 <table>
6497 <tr>
6498 <td style="color:red;">Foo
6499 </td>
6500 <td style="color:red;">Foo
6501 </td>
6502 <td> style="color:red;"</td>
6503 <td>Bar
6504 </td>
6505 <td style="color:red;">Foo
6506 </td>
6507 <td align="center" style="color:red;">Foo
6508 </td>
6509 <td align="center" style="color:red;">Foo
6510 </td></tr></table>
6511
6512 !! end
6513
6514 !! test
6515 2. Template-generated table cell attributes and cell content
6516 !! wikitext
6517 {|
6518 |{{table_attribs_2}}
6519 |}
6520 !! html/php
6521 <table>
6522 <tr>
6523 <td style="color:red;">Foo
6524 </td>
6525 <td>Bar</td>
6526 <td>Baz
6527 </td></tr></table>
6528
6529 !! html/parsoid
6530 <table>
6531 <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>
6532 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6533 </tbody></table>
6534 !! end
6535
6536 !! test
6537 3. Template-generated table cell attributes and cell content
6538 !! wikitext
6539 {|
6540 !align=center {{table_header_cells}}
6541 |-
6542 |align=center {{table_cells}}
6543 |}
6544 !! html/php
6545 <table>
6546 <tr>
6547 <th align="center" style="color:red;">Foo</th>
6548 <th style="color:red;"><i>Bar</i></th>
6549 <th style="color:brown;"><i>Foo</i> and Baz
6550 </th></tr>
6551 <tr>
6552 <td align="center" style="color:red;">Foo</td>
6553 <td style="color:red;"><i>Bar</i></td>
6554 <td style="color:brown;"><i>Foo</i> and Baz
6555 </td></tr></table>
6556
6557 !! html/parsoid
6558 <table>
6559 <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>
6560 <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>
6561 </tbody></table>
6562 !! end
6563
6564 !! test
6565 4. Template-generated table cell attributes and cell content inside a templated table
6566 !! wikitext
6567 {{tbl-start}}
6568 !align=center {{table_header_cells}}
6569 |-
6570 |align=center {{table_cells}}
6571 {{tbl-end}}
6572 !! html/php
6573 <table>
6574 <tr>
6575 <th align="center" style="color:red;">Foo</th>
6576 <th style="color:red;"><i>Bar</i></th>
6577 <th style="color:brown;"><i>Foo</i> and Baz
6578 </th></tr>
6579 <tr>
6580 <td align="center" style="color:red;">Foo</td>
6581 <td style="color:red;"><i>Bar</i></td>
6582 <td style="color:brown;"><i>Foo</i> and Baz
6583 </td></tr></table>
6584
6585 !! html/parsoid
6586 <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}}]}'>
6587 <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>
6588 <tr>
6589 <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>
6590 </tbody></table>
6591 !! end
6592
6593 ## Edge case fix to prevent future regressions
6594 !! test
6595 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
6596 !! wikitext
6597 {|
6598 |{{table_attribs_7}}
6599 |}
6600 <references />
6601 !! html/parsoid
6602 <table>
6603 <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>
6604 </tbody></table>
6605 <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>
6606 !! end
6607
6608 !! test
6609 Table with row followed by newlines and table heading
6610 !! options
6611 parsoid=wt2html,html2html
6612 !! wikitext
6613 {|
6614 |-
6615
6616 ! foo
6617 |}
6618 !! html/*
6619 <table>
6620
6621
6622 <tr>
6623 <th> foo
6624 </th></tr></table>
6625
6626 !! end
6627
6628 !! test
6629 Table with empty line following the start tag
6630 !! options
6631 parsoid=wt2html,html2html
6632 !! wikitext
6633 {|
6634
6635 |-
6636 | foo
6637 |}
6638 !! html/*
6639 <table>
6640
6641
6642 <tr>
6643 <td> foo
6644 </td></tr></table>
6645
6646 !! end
6647
6648 !! test
6649 Table attributes with empty value
6650 !! options
6651 parsoid=wt2html,html2html
6652 !! wikitext
6653 {|
6654 | style=| hello
6655 |}
6656 !! html/php
6657 <table>
6658 <tr>
6659 <td style=""> hello
6660 </td></tr></table>
6661
6662 !! html/parsoid
6663 <table>
6664 <tbody><tr><td style=""> hello</td></tr>
6665 </tbody></table>
6666 !! end
6667
6668 !! test
6669 Wikitext table with a lot of comments
6670 !! wikitext
6671 {|
6672 <!-- c0 -->
6673 | foo
6674 <!-- c1 -->
6675 |-<!-- c2 -->
6676 <!-- c3 -->
6677 |<!-- c4 -->
6678 <!-- c5 -->
6679 |}
6680 !! html
6681 <table>
6682 <tr>
6683 <td> foo
6684 </td></tr>
6685 <tr>
6686 <td>
6687 </td></tr></table>
6688
6689 !! end
6690
6691 !! test
6692 Wikitext table comments represented in parsoid dom
6693 !! wikitext
6694 {|<!--c1--><!--c2-->
6695 |-<!--c3-->
6696 | x
6697 |}
6698 !! html/php+tidy
6699 <table>
6700 <tr>
6701 <td>x</td>
6702 </tr>
6703 </table>
6704 !! html/parsoid
6705 <table><!--c1--><!--c2-->
6706 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
6707 <td data-parsoid='{"autoInsertedEnd":true}'> x</td></tr>
6708 </tbody></table>
6709 !! end
6710
6711 !! test
6712 Wikitext table with double-line table cell
6713 !! wikitext
6714 {|
6715 |a
6716 b
6717 |}
6718 !! html
6719 <table>
6720 <tr>
6721 <td>a
6722 <p>b
6723 </p>
6724 </td></tr></table>
6725
6726 !! end
6727
6728 !! test
6729 Table cell with a single comment
6730 !! wikitext
6731 {|
6732 | <!-- c1 -->
6733 | a
6734 |}
6735 !! html
6736 <table>
6737 <tr>
6738 <td>
6739 </td>
6740 <td> a
6741 </td></tr></table>
6742
6743 !! end
6744
6745 !! test
6746 Table-cell after a comment-only-empty-line
6747 !! wikitext
6748 {|
6749 |a
6750 <!--c1-->
6751 <!--c2-->| b
6752 |}
6753 !! html
6754 <table>
6755 <tr>
6756 <td>a
6757 </td>
6758 <td> b
6759 </td></tr></table>
6760
6761 !! html/parsoid
6762 <table>
6763 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
6764 <!--c1-->
6765 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
6766 </tbody></table>
6767
6768 !! end
6769
6770 !! test
6771 Build table with {{!}}
6772 !! wikitext
6773 {{{!}} class="wikitable"
6774 ! header
6775 ! second header
6776 {{!}}- style="color:red;"
6777 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
6778 {{!}}}
6779 !! html
6780 <table class="wikitable">
6781 <tr>
6782 <th> header
6783 </th>
6784 <th> second header
6785 </th></tr>
6786 <tr style="color:red;">
6787 <td> data </td>
6788 <td style="color:red;"> second data
6789 </td></tr></table>
6790
6791 !! end
6792
6793 !! test
6794 Build table with pipe as data
6795 !! wikitext
6796 {| class="wikitable"
6797 ! header
6798 ! second header
6799 |- style="color:red;"
6800 | data || style="color:red;" | second data
6801 |-
6802 | style="color:red;" | data with | || style="color:red;" | second data with |
6803 |-
6804 || data with | ||| second data with |
6805 |}
6806 !! html
6807 <table class="wikitable">
6808 <tr>
6809 <th> header
6810 </th>
6811 <th> second header
6812 </th></tr>
6813 <tr style="color:red;">
6814 <td> data </td>
6815 <td style="color:red;"> second data
6816 </td></tr>
6817 <tr>
6818 <td style="color:red;"> data with | </td>
6819 <td style="color:red;"> second data with |
6820 </td></tr>
6821 <tr>
6822 <td> data with | </td>
6823 <td> second data with |
6824 </td></tr></table>
6825
6826 !! end
6827
6828 !! test
6829 Build table with wikilink
6830 !! wikitext
6831 {| class="wikitable"
6832 ! header || second header
6833 |- style="color:red;"
6834 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
6835 |-
6836 | data || second data [[Main Page|link|text with pipe]]
6837 |}
6838 !! html
6839 <table class="wikitable">
6840 <tr>
6841 <th> header </th>
6842 <th> second header
6843 </th></tr>
6844 <tr style="color:red;">
6845 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
6846 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
6847 </td></tr>
6848 <tr>
6849 <td> data </td>
6850 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
6851 </td></tr></table>
6852
6853 !! end
6854
6855 # The expected HTML structure in this test is debatable. The PHP parser does
6856 # not parse this kind of table at all. The main focus for Parsoid is on
6857 # round-tripping, so this output is ok for now. TODO: revisit!
6858 !! test
6859 Wikitext table with html-syntax row
6860 !! wikitext
6861 {|
6862 |-
6863 <td>foo</td>
6864 |}
6865 !! html/parsoid
6866 <table>
6867 <tbody>
6868 <tr>
6869 <td>foo</td></tr></tbody></table>
6870 !! end
6871
6872 ## Note that Parsoid output differs from PHP and PHP+tidy here.
6873 ## The lack of <tr> tags in the PHP output is arguably a bug in the
6874 ## PHP parser, which tidy then compounds by fostering the content
6875 ## entirely out of the table. Parsoid recognizes the table context
6876 ## and generates <tr> and <td> wrappers as needed. Hopefully nobody
6877 ## depends on PHP's treatment of broken table markup!
6878 !! test
6879 Implicit <td> after a |-
6880 !! options
6881 parsoid=wt2html,html2html
6882 !! wikitext
6883 {|
6884 |-
6885 a
6886 |}
6887 !! html/php
6888 <table>
6889
6890 a
6891 </table>
6892
6893 !! html/php+tidy
6894 <p>a</p>
6895 !! html/parsoid
6896 <table>
6897 <tr><td>a</td></tr>
6898 </table>
6899 !! end
6900
6901 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
6902 !! test
6903 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
6904 !! options
6905 parsoid=wt2html,html2html
6906 !! wikitext
6907 {|
6908 |-
6909 |
6910 a
6911 |-
6912 b
6913 |}
6914 !! html/php
6915 <table>
6916
6917 <tr>
6918 <td>
6919 <pre>a
6920 </pre>
6921 </td></tr>
6922 b
6923 </table>
6924
6925 !! html/php+tidy
6926 <p>b</p>
6927 <table>
6928 <tr>
6929 <td>
6930 <pre>
6931 a
6932 </pre></td>
6933 </tr>
6934 </table>
6935 !! html/parsoid
6936 <table>
6937 <tbody>
6938 <tr><td><pre>a</pre></td></tr>
6939 <tr><td> b</td></tr>
6940 </tbody>
6941 </table>
6942 !! end
6943
6944 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
6945 # Parsoid generates the missing <td>, so wt2wt won't succeed.
6946 !! test
6947 Lists should be recognized in an implicit <td> context
6948 !! options
6949 parsoid=wt2html,html2html
6950 !! wikitext
6951 {|
6952 |-
6953 *a
6954 |}
6955 !! html/php
6956 <table>
6957
6958 <ul><li>a</li></ul>
6959 </table>
6960
6961 !! html/php+tidy
6962 <ul>
6963 <li>a</li>
6964 </ul>
6965 !! html/parsoid
6966 <table>
6967 <tr>
6968 <td><ul>
6969 <li>a</li>
6970 </ul></td>
6971 </tr>
6972 </table>
6973 !! end
6974
6975 !! test
6976 Table cells not properly parsed in an implicit-td context
6977 !! wikitext
6978 {|
6979 |-
6980 {{table_attribs_4}} || a || b
6981 |}
6982 !! html/php+tidy
6983 <table>
6984 <tr>
6985 <td style="background-color:#DC241f;" width="10px"></td>
6986 <td>a</td>
6987 <td>b</td>
6988 </tr>
6989 </table>
6990 !! html/parsoid
6991 <table>
6992 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
6993 <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>
6994 </tbody></table>
6995 !! end
6996
6997 !! test
6998 Parsoid: Round-trip tables directly followed by content (bug 51219)
6999 !! options
7000 parsoid=wt2html,wt2wt
7001 !! wikitext
7002 {|
7003 |foo
7004 |} bar
7005
7006 {|
7007 |baz
7008 |}<b>quux</b>
7009 !! html+tidy
7010 <table>
7011 <tr>
7012 <td>foo</td>
7013 </tr>
7014 </table>
7015 <p>bar</p>
7016 <table>
7017 <tr>
7018 <td>baz</td>
7019 </tr>
7020 </table>
7021 <p><b>quux</b></p>
7022 !! end
7023
7024 !! test
7025 Parsoid: Default to a newline after tables in new content (bug 51219)
7026 !! options
7027 parsoid=html2wt
7028 !! html/parsoid
7029 <table><tbody>
7030 <tr><td>foo</td></tr></tbody></table> bar
7031 <table><tbody>
7032 <tr><td>baz</td></tr></tbody></table><b>quux</b>
7033 !! wikitext
7034 {|
7035 |foo
7036 |}
7037 <nowiki> </nowiki>bar
7038 {|
7039 |baz
7040 |}
7041 '''quux'''
7042 !! end
7043
7044 !! test
7045 Parsoid: newline inducing block nodes don't suppress <nowiki>
7046 !! options
7047 parsoid=html2wt
7048 !! html/parsoid
7049 a<h1>foo</h1>
7050 !! wikitext
7051 <nowiki> </nowiki>a
7052
7053 = foo =
7054 !! end
7055
7056 !! test
7057 Parsoid: Row-syntax table headings followed by comment & table cells
7058 !! options
7059 parsoid=wt2html,wt2wt
7060 !! wikitext
7061 {|
7062 ! foo || bar
7063 <!-- foo --> || baz || quux
7064 |}
7065 !! html/php
7066 <table>
7067 <tr>
7068 <th> foo </th>
7069 <th> bar
7070 </th>
7071 <td> baz </td>
7072 <td> quux
7073 </td></tr></table>
7074
7075 !! html/parsoid
7076 <table>
7077 <tbody><tr><th> foo </th><th> bar
7078 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
7079 </tbody></table>
7080 !! end
7081
7082 !!test
7083 Parsoid: Recover better from broken table attributes
7084 !!options
7085 parsoid=wt2html
7086 !!wikitext
7087 {| class="foo
7088 | class="bar" |
7089 foo
7090 |}
7091 !!html/php+tidy
7092 <table class="foo">
7093 <tr>
7094 <td class="bar">
7095 <p>foo</p>
7096 </td>
7097 </tr>
7098 </table>
7099 !!html/parsoid
7100 <table class="foo">
7101 <tr>
7102 <td class="bar">
7103 <p>foo</p></td></tr>
7104 </tbody></table>
7105 !!end
7106
7107 !! test
7108 Tables: Digest broken attributes on table and tr tag
7109 !! options
7110 parsoid=wt2html
7111 !! wikitext
7112 {| || |} ++
7113 |- || || ++ --
7114 |- > [
7115 |}
7116 !! html
7117 <table>
7118 <tbody>
7119 <tr></tr>
7120 <tr></tr>
7121 </tbody></table>
7122 !! end
7123
7124 # T137406: Whitespace in the HTML
7125 !! test
7126 1. Generate correct wikitext for tables with thead/tbody/tfoot
7127 !! options
7128 parsoid=html2wt
7129 !! html/parsoid
7130 <table>
7131 <caption>Test</caption>
7132 <thead>
7133 <tr>
7134 <th>Month</th>
7135 <th>Savings</th>
7136 </tr>
7137 </thead>
7138 <tbody>
7139 <tr>
7140 <td>January</td>
7141 <td>$100</td>
7142 </tr>
7143 <tr>
7144 <td>February</td>
7145 <td>$80</td>
7146 </tr>
7147 </tbody>
7148 <tfoot>
7149 <tr>
7150 <td>Sum</td>
7151 <td>$180</td>
7152 </tr>
7153 </tfoot>
7154 </table>
7155 !! wikitext
7156 {|
7157 |+Test
7158 !Month
7159 !Savings
7160 |-
7161 |January
7162 |$100
7163 |-
7164 |February
7165 |$80
7166 |-
7167 |Sum
7168 |$180
7169 |}
7170 !! html/php+tidy
7171 <table>
7172 <caption>Test</caption>
7173 <tr>
7174 <th>Month</th>
7175 <th>Savings</th>
7176 </tr>
7177 <tr>
7178 <td>January</td>
7179 <td>$100</td>
7180 </tr>
7181 <tr>
7182 <td>February</td>
7183 <td>$80</td>
7184 </tr>
7185 <tr>
7186 <td>Sum</td>
7187 <td>$180</td>
7188 </tr>
7189 </table>
7190 !! end
7191
7192 # T137406: No whitespace in the HTML
7193 !! test
7194 2. Generate correct wikitext for tables with thead/tbody/tfoot
7195 !! options
7196 parsoid=html2wt
7197 !! html/parsoid
7198 <table><thead><tr><th>heading</th></tr></thead><tbody><tr><td>foo</td></tr></tbody></table>
7199 !! wikitext
7200 {|
7201 !heading
7202 |-
7203 |foo
7204 |}
7205 !! end
7206
7207 !! test
7208 Testing serialization after deletion in references
7209 !! options
7210 parsoid={
7211 "modes": ["wt2wt"],
7212 "changes": [
7213 ["#x", "remove"]
7214 ]
7215 }
7216 !! wikitext
7217 hi <ref><div id="x">ho</div></ref>
7218
7219 <references />
7220 !! wikitext/edited
7221 hi <ref></ref>
7222
7223 <references />
7224 !! end
7225
7226 !!test
7227 Testing serialization after deletion of table cells
7228 !!options
7229 parsoid={
7230 "modes": ["wt2wt", "selser"],
7231 "changes": [
7232 ["#x", "remove"]
7233 ]
7234 }
7235 !!wikitext
7236 {|
7237 !h1 !!h2 !!h3
7238 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
7239 |}
7240 !! wikitext/edited
7241 {|
7242 !h1 !!h2 !!h3
7243 |c2 |||c3
7244 |}
7245 !!end
7246
7247 !! test
7248 Testing selser after addition of new row before first row (T125419)
7249 !! options
7250 parsoid={
7251 "modes": ["wt2wt", "selser"],
7252 "changes": [
7253 [ "tr", "before", "<tr><td>X</td></tr>" ]
7254 ]
7255 }
7256 !! wikitext
7257 {|
7258 |a
7259 |}
7260 !! wikitext/edited
7261 {|
7262 |X
7263 |-
7264 |a
7265 |}
7266 !! end
7267
7268 !! test
7269 Serialize new table rows in a HTML table using HTML tags
7270 !! options
7271 parsoid={
7272 "modes": ["wt2wt", "selser"],
7273 "changes": [
7274 [ "tr", "before", "<tr><td>X</td></tr>" ]
7275 ]
7276 }
7277 !! wikitext
7278 <table><tr><td>a</td></tr></table>
7279 !! wikitext/edited
7280 <table><tr><td>X</td></tr><tr><td>a</td></tr></table>
7281 !! end
7282
7283 !! test
7284 Serialize new table cells in a HTML row using HTML tags
7285 !! options
7286 parsoid={
7287 "modes": ["wt2wt", "selser"],
7288 "changes": [
7289 [ "td", "before", "<td>X</td>" ]
7290 ]
7291 }
7292 !! wikitext
7293 <table><tr><td>a</td></tr></table>
7294 !! wikitext/edited
7295 <table><tr><td>X</td><td>a</td></tr></table>
7296 !! end
7297
7298 !! test
7299 Wikitext tables can be nested inside HTML tables
7300 !! options
7301 parsoid=html2wt
7302 !! html
7303 <table data-parsoid='{"stx":"html"}'>
7304 <tr><td>
7305 <table>
7306 <tr><td>foo</td></tr>
7307 </table>
7308 </td></tr>
7309 </table>
7310 !! wikitext
7311 <table>
7312 <tr><td>
7313 {|
7314 |foo
7315 |}
7316 </td></tr>
7317 </table>
7318 !! end
7319
7320 !! test
7321 Serialize wikitext list items as HTML list items when embedded in a HTML list
7322 !! options
7323 parsoid=html2wt
7324 !! html
7325 <ul data-parsoid='{"stx": "html"}'>
7326 <li data-parsoid='{}'>a</li>
7327 <li>b</li>
7328 </ul>
7329 !! wikitext
7330 <ul>
7331 <li>a</li>
7332 <li>b</li>
7333 </ul>
7334 !! end
7335
7336 # SSS FIXME: Is this actually a good thing given the
7337 # odd nested list output that is generated by MW?
7338 # <ul><li>foo<ul>..</ul></li></ul> instead of
7339 # <ul><li>foo</li><ul>..</ul></ul>
7340 !! test
7341 Wikitext lists can be nested inside HTML lists
7342 !! options
7343 parsoid=html2wt
7344 !! html
7345 <ul data-parsoid='{"stx": "html"}'>
7346 <li data-parsoid='{"stx": "html"}'>a
7347 <ul><li>b</li></ul>
7348 </li>
7349 </ul>
7350
7351 <ul data-parsoid='{"stx": "html"}'>
7352 <li>x
7353 <ul><li>y</li></ul>
7354 </li>
7355 </ul>
7356 !! wikitext
7357 <ul>
7358 <li>a
7359 * b
7360 </li>
7361 </ul>
7362
7363 <ul>
7364 <li>x
7365 * y
7366 </li>
7367 </ul>
7368 !! end
7369
7370 ###
7371 ### Internal links
7372 ###
7373 !! test
7374 Plain link, capitalized
7375 !! wikitext
7376 [[Main Page]]
7377 !! html
7378 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7379 </p>
7380 !! end
7381
7382 !! test
7383 Plain link, uncapitalized
7384 !! wikitext
7385 [[main Page]]
7386 !! html
7387 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
7388 </p>
7389 !! end
7390
7391 !! test
7392 Piped link
7393 !! wikitext
7394 [[Main Page|The Main Page]]
7395 !! html
7396 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7397 </p>
7398 !! end
7399
7400 !! test
7401 Piped link with comment in link text
7402 !! wikitext
7403 [[Main Page|The Main<!--front--> Page]]
7404 !! html
7405 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7406 </p>
7407 !! end
7408
7409 !! test
7410 Piped link with multiple pipe characters in link text
7411 !! wikitext
7412 [[Main Page||The|Main|Page|]]
7413 !! html/php
7414 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7415 </p>
7416 !! html/parsoid
7417 <p><a rel="mw:WikiLink" href="Main_Page" title="Main Page">|The|Main|Page|</a></p>
7418 !! end
7419
7420 !! test
7421 Piped link with no link text
7422 !! wikitext
7423 [[Thomas Bek (bishop of St David's)|]]
7424 !! html/php
7425 <p>[[Thomas Bek (bishop of St David's)|]]
7426 </p>
7427 !! html/parsoid
7428 <p>[[Thomas Bek (bishop of St David's)|]]</p>
7429 !! end
7430
7431 !! test
7432 Broken link
7433 !! wikitext
7434 [[Zigzagzogzagzig]]
7435 !! html
7436 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7437 </p>
7438 !! end
7439
7440 !! test
7441 Broken link with fragment
7442 !! wikitext
7443 [[Zigzagzogzagzig#zug]]
7444 !! html
7445 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7446 </p>
7447 !! end
7448
7449 !! test
7450 Special page link with fragment
7451 !! wikitext
7452 [[Special:Version#anchor]]
7453 !! html
7454 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7455 </p>
7456 !! end
7457
7458 !! test
7459 Nonexistent special page link with fragment
7460 !! wikitext
7461 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7462 !! html
7463 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7464 </p>
7465 !! end
7466
7467 !! test
7468 Link with prefix
7469 !! wikitext
7470 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7471 !! html
7472 <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>
7473 </p>
7474 !! end
7475
7476 !! test
7477 Link with suffix
7478 !! wikitext
7479 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7480 !! html
7481 <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>!!!
7482 </p>
7483 !! end
7484
7485 !! article
7486 prefixed article
7487 !! text
7488 Some text
7489 !! endarticle
7490
7491 !! test
7492 Bug 43661: Piped links with identical prefixes
7493 !! wikitext
7494 [[prefixed article|prefixed articles with spaces]]
7495
7496 [[prefixed article|prefixed articlesaoeu]]
7497
7498 [[Main Page|Main Page test]]
7499 !! html
7500 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7501 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7502 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7503 </p>
7504 !! end
7505
7506
7507 !! test
7508 Link with HTML entity in suffix / tail
7509 !! wikitext
7510 [[Main Page]]&quot;, [[Main Page]]&#97;
7511 !! html/php
7512 <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;
7513 </p>
7514 !! html/parsoid
7515 <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>
7516 !! end
7517
7518 !! test
7519 Link with 3 brackets
7520 !! wikitext
7521 [[[Main Page]]]
7522 Foo [[[Main Page]]]
7523 !! html
7524 <p>[[[Main Page]]]
7525 Foo [[[Main Page]]]
7526 </p>
7527 !! end
7528
7529 !! test
7530 Link with 4 brackets
7531 !! wikitext
7532 [[[[Main Page]]]]
7533 !! html
7534 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7535 </p>
7536 !! end
7537
7538 !! test
7539 Piped link with 3 brackets
7540 !! wikitext
7541 [[[main page|the main page]]]
7542 !! html
7543 <p>[[[main page|the main page]]]
7544 </p>
7545 !! end
7546
7547 !! test
7548 Piped link with extlink-like text
7549 !! wikitext
7550 [[Main Page|[bar]]]
7551 [[Main Page|This is a [bar]]]
7552 !! html/php
7553 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7554 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7555 </p>
7556 !! html/parsoid
7557 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7558 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a></p>
7559 !! end
7560
7561 !! test
7562 Link with multiple pipes
7563 !! wikitext
7564 [[Main Page|The|Main|Page]]
7565 !! html
7566 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7567 </p>
7568 !! end
7569
7570 # Note that parsoid does not munge anchor text; all non-space
7571 # characters are valid in HTML5 ids.
7572 !! test
7573 Anchor containing a #. (bug 63430)
7574 !! wikitext
7575 [[Main Page#And#Link]]
7576 !! html/php
7577 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
7578 </p>
7579 !! html/parsoid
7580 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link" title="Main Page">Main Page#And#Link</a></p>
7581 !! end
7582
7583 !! test
7584 Link to namespaces
7585 !! wikitext
7586 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7587 !! html
7588 <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>
7589 </p>
7590 !! end
7591
7592 !! test
7593 Link with space in namespace
7594 !! wikitext
7595 [[User talk:Foo bar]]
7596 !! html
7597 <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>
7598 </p>
7599 !! end
7600
7601 !! article
7602 MemoryAlpha:AlphaTest
7603 !! text
7604 This is an article in the MemoryAlpha namespace
7605 (which shadows the memoryalpha interwiki link).
7606 !! endarticle
7607
7608 !! test
7609 Namespace takes precedence over interwiki link (bug 51680)
7610 !! wikitext
7611 [[MemoryAlpha:AlphaTest]]
7612 !! html
7613 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7614 </p>
7615 !! end
7616
7617 # The previous test doesn't work correctly in html2*, due to not recognizing the
7618 # link as an internal one. This one checks for the correct behavior.
7619 !! test
7620 Link to namespace preferred over interwiki with correct rel attribute
7621 !! options
7622 parsoid=html2wt,html2html
7623 !! html/parsoid
7624 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7625 !! wikitext
7626 [[MemoryAlpha:AlphaTest]]
7627 !! end
7628
7629 !! test
7630 Piped link to namespace
7631 !! wikitext
7632 [[Meta:Disclaimers|The disclaimers]]
7633 !! html
7634 <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>
7635 </p>
7636 !! end
7637
7638 !! test
7639 Link containing }
7640 !! wikitext
7641 [[Usually caused by a typo (oops}]]
7642 !! html
7643 <p>[[Usually caused by a typo (oops}]]
7644 </p>
7645 !! end
7646
7647 !! article
7648 7% Solution
7649 !! text
7650 Just a test of an article title containing a percent.
7651 !! endarticle
7652
7653 !! test
7654 Link containing % (not as a hex sequence)
7655 !! wikitext
7656 [[7% Solution]]
7657 [[7% Solution|7%25 Solution]]
7658 !! html/php
7659 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7660 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7661 </p>
7662 !! html/parsoid
7663 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7664 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7665 !! end
7666
7667 # note that the parsoid HTML is identical to the previous test output,
7668 # so the previous test ensures that the html2wt mode will generate the
7669 # "not as a hex sequence" wikitext.
7670 !! test
7671 Link containing % as a single hex sequence interpreted to char
7672 !! options
7673 parsoid=wt2wt,wt2html,html2html
7674 !! wikitext
7675 [[7%25 Solution]]
7676 [[7%25 Solution|7%25 Solution]]
7677 !! html/php
7678 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7679 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7680 </p>
7681 !! html/parsoid
7682 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7683 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7684 !!end
7685
7686 !! test
7687 Link containing % as a double hex sequence interpreted to hex sequence
7688 !! wikitext
7689 [[7%2525 Solution]]
7690 !! html
7691 <p>[[7%2525 Solution]]
7692 </p>
7693 !!end
7694
7695 # note that parsoid does not munge anchor text; all non-space
7696 # characters are valid in HTML5 anchors.
7697 !! test
7698 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7699 Example for such a section: == < ==
7700 !! wikitext
7701 [[%23%3c]][[%23%3e]]
7702 !! html/php
7703 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7704 </p>
7705 !! html/parsoid
7706 <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>
7707 !! end
7708
7709 !! test
7710 Link containing "<#" and ">#" as a hex sequences
7711 !! wikitext
7712 [[%3c%23]][[%3e%23]]
7713 !! html
7714 <p>[[%3c%23]][[%3e%23]]
7715 </p>
7716 !! end
7717
7718 !! test
7719 Link containing an equals sign
7720 !! wikitext
7721 [[Special:BookSources/isbn=4-00-026157-6]]
7722 !! html/php
7723 <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>
7724 </p>
7725 !! html/parsoid
7726 <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>
7727 !! end
7728
7729 !! article
7730 Foo~bar
7731 !! text
7732 Just a test of an article title containing a tilde.
7733 !! endarticle
7734
7735 # note that links containing signatures, like [[Foo~~~~]], are
7736 # massaged by the pre-save transform (PST) and so the tildes are never
7737 # seen by the parser.
7738 !! test
7739 Link containing a tilde
7740 !! wikitext
7741 [[Foo~bar]]
7742 !! html/php
7743 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
7744 </p>
7745 !! html/parsoid
7746 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
7747 !! end
7748
7749 !! test
7750 Link containing double-single-quotes '' (bug 4598)
7751 !! wikitext
7752 [[Lista d''e paise d''o munno]]
7753 !! html/php
7754 <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>
7755 </p>
7756 !! html/parsoid
7757 <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>
7758 !! end
7759
7760 !! test
7761 Link containing double-single-quotes '' in text (bug 4598 sanity check)
7762 !! wikitext
7763 Some [[Link|pretty ''italics'' and stuff]]!
7764 !! html/php
7765 <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>!
7766 </p>
7767 !! html/parsoid
7768 <p>Some <a rel="mw:WikiLink" href="Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
7769 !! end
7770
7771 !! test
7772 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
7773 !! wikitext
7774 ''Some [[Link|pretty ''italics'' and stuff]]!''
7775 !! html
7776 <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>
7777 </p>
7778 !! end
7779
7780 !! test
7781 Link with double quotes in title part (literal) and alternate part (interpreted)
7782 !! wikitext
7783 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
7784
7785 [[''Pentecoste'']]
7786
7787 [[''Pentecoste''|Pentecoste]]
7788
7789 [[''Pentecoste''|''Pentecoste'']]
7790 !! html/php
7791 <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>
7792 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)">''Pentecoste''</a>
7793 </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>
7794 </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>
7795 </p>
7796 !! html/parsoid
7797 <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>
7798 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
7799 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
7800 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
7801 !! end
7802
7803 !! test
7804 Broken image links with HTML captions (bug 39700)
7805 !! wikitext
7806 [[File:Nonexistent|<script></script>]]
7807 [[File:Nonexistent|100x100px|<script></script>]]
7808 [[File:Nonexistent|&lt;]]
7809 [[File:Nonexistent|a<i>b</i>c]]
7810 !! html/php
7811 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7812 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7813 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
7814 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
7815 </p>
7816 !! html/parsoid
7817 <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>
7818 <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>
7819 <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>
7820 <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>
7821 !! end
7822
7823 !! test
7824 Plain link to URL
7825 !! wikitext
7826 [[http://www.example.com]]
7827 !! html/php
7828 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
7829 </p>
7830 !! html/parsoid
7831 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
7832 !! end
7833
7834 !! test
7835 Plain link to URL with link text
7836 !! wikitext
7837 [[http://www.example.com Link text]]
7838 !! html
7839 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
7840 </p>
7841 !! end
7842
7843 !! test
7844 Plain link to protocol-relative URL
7845 !! wikitext
7846 [[//www.example.com]]
7847 !! html/php
7848 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
7849 </p>
7850 !! html/parsoid
7851 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
7852 !! end
7853
7854 !! test
7855 Plain link to protocol-relative URL with link text
7856 !! wikitext
7857 [[//www.example.com Link text]]
7858 !! html
7859 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
7860 </p>
7861 !! end
7862
7863 !! test
7864 Plain link to page with question mark in title
7865 !! wikitext
7866 [[A?b]]
7867
7868 [[A?b|Baz]]
7869 !! html
7870 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
7871 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
7872 </p>
7873 !! end
7874
7875
7876 # I'm fairly sure the expected result here is wrong.
7877 # We want these to be URL links, not pseudo-pages with URLs for titles....
7878 # However the current output is also pretty screwy.
7879 #
7880 # ----
7881 # I'm changing it to match the current output--it arguably makes more
7882 # sense in the light of the test above. Old expected result was:
7883 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
7884 #</p>
7885 # But I think this test is bordering on "garbage in, garbage out" anyway.
7886 # -- wtm
7887 !! test
7888 Piped link to URL
7889 !! wikitext
7890 Piped link to URL: [[http://www.example.com|an example URL]]
7891 !! html/php
7892 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
7893 </p>
7894 !! html/parsoid
7895 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
7896 !! end
7897
7898 !! test
7899 BUG 2: [[page|http://url/]] should link to page, not http://url/
7900 !! wikitext
7901 [[Main Page|http://url/]]
7902 !! html/php
7903 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
7904 </p>
7905 !! html/parsoid
7906 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
7907 !! end
7908
7909 # Parsoid does not mark self-links, by design.
7910 !! test
7911 BUG 337: Escaped self-links should be bold
7912 !! options
7913 title=[[Bug462]]
7914 !! wikitext
7915 [[Bu&#103;462]] [[Bug462]]
7916 !! html/php
7917 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
7918 </p>
7919 !! html/php+tidy
7920 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
7921 !! html/parsoid
7922 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
7923 !! end
7924
7925 !! test
7926 Self-link to section should not be bold
7927 !! options
7928 title=[[Main Page]]
7929 !! wikitext
7930 [[Main Page#section]]
7931 !! html
7932 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
7933 </p>
7934 !! end
7935
7936 !! article
7937 00
7938 !! text
7939 This is 00.
7940 !! endarticle
7941
7942 !!test
7943 Self-link to numeric title
7944 !!options
7945 title=[[0]]
7946 !! wikitext
7947 [[0]]
7948 !! html
7949 <p><strong class="selflink">0</strong>
7950 </p>
7951 !!end
7952
7953 !!test
7954 Link to numeric-equivalent title
7955 !!options
7956 title=[[0]]
7957 !! wikitext
7958 [[00]]
7959 !! html
7960 <p><a href="/wiki/00" title="00">00</a>
7961 </p>
7962 !!end
7963
7964 !! test
7965 <nowiki> inside a link
7966 !! wikitext
7967 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
7968 !! html
7969 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
7970 </p>
7971 !! end
7972
7973 !! test
7974 Non-breaking spaces in title
7975 !! wikitext
7976 [[&nbsp; Main &nbsp; Page &nbsp;]]
7977 !! html
7978 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
7979 </p>
7980 !!end
7981
7982 !! test
7983 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
7984 !! options
7985 language=ca
7986 !! wikitext
7987 '''[[Main Page]]'''
7988 !! html
7989 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
7990 </p>
7991 !! end
7992
7993 !! test
7994 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
7995 !! options
7996 language=ca
7997 !! wikitext
7998 ''[[Main Page]]''
7999 !! html
8000 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
8001 </p>
8002 !! end
8003
8004 !! test
8005 Internal link with en linktrail: no apostrophes (bug 27473)
8006 !! options
8007 language=en
8008 !! wikitext
8009 [[Something]]'nice
8010 !! html
8011 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
8012 </p>
8013 !! end
8014
8015 !! test
8016 Internal link with ca linktrail with apostrophes (bug 27473)
8017 !! options
8018 language=ca
8019 !! wikitext
8020 [[Something]]'nice
8021 !! html
8022 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
8023 </p>
8024 !! end
8025
8026 !! test
8027 Internal link with kaa linktrail with apostrophes (bug 27473)
8028 !! options
8029 language=kaa
8030 !! wikitext
8031 [[Something]]'nice
8032 !! html
8033 <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>
8034 </p>
8035 !! end
8036
8037 !! test
8038 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
8039 !! wikitext
8040 [[User:Foo/Test/63636:Bar|Test]]
8041 !! html/php
8042 <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>
8043 </p>
8044 !! html/parsoid
8045 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
8046 !! end
8047
8048 ## Mainly a sanity check for Parsoid
8049 !! test
8050 Handle title parsing for subpages
8051 !! options
8052 title=[[/123123]]
8053 !! wikitext
8054 123
8055 !! html/parsoid
8056 <p>123</p>
8057 !! end
8058
8059 ## FIXME: Add a working php section here
8060 !! test
8061 Link to a subpage from a namespace other than main
8062 !! options
8063 title=[[User:test]]
8064 !! wikitext
8065 [[/123]]
8066 !! html/parsoid
8067 <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>
8068 !! end
8069
8070 !! test
8071 Ensure that transclusion titles are not url-decoded
8072 !! options
8073 subpage title=[[Test]]
8074 parsoid=wt2html
8075 !! wikitext
8076 {{Bar%C3%A9}} {{/Bar%C3%A9}}
8077 !! html/php
8078 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}
8079 </p>
8080 !! html/parsoid
8081 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}</p>
8082 !! end
8083
8084 !! test
8085 Purely hash wikilink
8086 !! options
8087 title=[[User:test/123]]
8088 !! wikitext
8089 [[#a|b]]
8090 !! html/php
8091 <p><a href="#a">b</a>
8092 </p>
8093 !! html/parsoid
8094 <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>
8095 !! end
8096
8097 !! test
8098 1. Interaction of linktrail and template encapsulation
8099 !! options
8100 parsoid
8101 !! wikitext
8102 {{echo|[[Foo]]}}l
8103 !! html
8104 <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>
8105 !! end
8106
8107 !! test
8108 2. Interaction of linktrail and template encapsulation
8109 !! options
8110 parsoid
8111 !! wikitext
8112 {{echo|Some [[Fool]]}}s
8113 !! html
8114 <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>
8115 !! end
8116
8117 !! test
8118 3. Interaction of linktrail and template encapsulation
8119 !! options
8120 parsoid
8121 !! wikitext
8122 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
8123 !! html
8124 <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>
8125 !! end
8126
8127 !! article
8128 Söfnuður
8129 !! text
8130 Test.
8131 !! endarticle
8132
8133 !! test
8134 Internal link with is link prefix
8135 !! options
8136 language=is
8137 !! wikitext
8138 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
8139 !! html
8140 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
8141 </p>
8142 !! end
8143
8144 !! article
8145 Mótmælendatrú
8146 !! text
8147 Test.
8148 !! endarticle
8149
8150 !! test
8151 Internal link with is link trail and link prefix
8152 !! options
8153 language=is
8154 !! wikitext
8155 [[mótmælendatrú|xxx]]ar
8156 [[mótmælendatrú]]ar
8157 mótmælenda[[söfnuður]]
8158 mótmælenda[[söfnuður|söfnuðir]]
8159 mótmælenda[[söfnuður|söfnuðir]]xxx
8160 !! html
8161 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
8162 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
8163 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
8164 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
8165 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
8166 </p>
8167 !! end
8168
8169 !! test
8170 Parsoid link trail escaping
8171 !! options
8172 parsoid=html2wt,html2html
8173 !! html/parsoid
8174 <p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p>
8175 !! wikitext
8176 [[apple]]<nowiki/>s
8177 !! end
8178
8179 !! test
8180 Parsoid link prefix escaping
8181 !! options
8182 language=is
8183 parsoid=html2wt,html2html
8184 !! html/parsoid
8185 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p>
8186 !! wikitext
8187 Aðrir mótmælenda<nowiki/>[[söfnuður]]
8188 !! end
8189
8190 !! test
8191 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
8192 !! wikitext
8193 [[Foo| bar]]
8194
8195 [[Foo| ''bar'']]
8196
8197 [http://wp.org foo]
8198
8199 [http://wp.org ''foo'']
8200 !! html
8201 <p><a href="/wiki/Foo" title="Foo"> bar</a>
8202 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
8203 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
8204 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
8205 </p>
8206 !! end
8207
8208 !! test
8209 Parsoid: Scoped parsing should handle mixed transclusions and plain text
8210 !! options
8211 parsoid
8212 !! wikitext
8213 [[Foo|{{echo|a}} b {{echo|c}}]]
8214 !! html
8215 <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>
8216 !! end
8217
8218 !! test
8219 Link with angle bracket after anchor
8220 !! wikitext
8221 [[Foo#<bar>]]
8222 !! html/php
8223 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
8224 </p>
8225 !! html/parsoid
8226 <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>
8227 !! end
8228
8229 ###
8230 ### Interwiki links (see maintenance/interwiki.sql)
8231 ###
8232
8233 !! test
8234 Inline interwiki link
8235 !! options
8236 parsoid=wt2html,wt2wt,html2html
8237 !! wikitext
8238 [[MeatBall:SoftSecurity]]
8239 !! html/php
8240 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
8241 </p>
8242 !! html/parsoid
8243 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
8244 !! end
8245
8246 !! test
8247 Inline interwiki link with empty title (bug 2372)
8248 !! options
8249 parsoid=wt2html,wt2wt,html2html
8250 !! wikitext
8251 [[MeatBall:]]
8252 !! html/php
8253 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
8254 </p>
8255 !! html/parsoid
8256 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
8257 !! end
8258
8259 !! test
8260 Interwiki link encoding conversion (bug 1636)
8261 !! wikitext
8262 *[[Wikipedia:ro:Olteni&#0355;a]]
8263 *[[Wikipedia:ro:Olteni&#355;a]]
8264 !! html
8265 <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>
8266 <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>
8267
8268 !! html+tidy
8269 <ul>
8270 <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>
8271 <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>
8272 </ul>
8273 !! end
8274
8275 !! test
8276 Interwiki link with fragment (bug 2130)
8277 !! wikitext
8278 [[MeatBall:SoftSecurity#foo]]
8279 !! html
8280 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
8281 </p>
8282 !! end
8283
8284 # Ideally the wikipedia: prefix here should be proto-relative too
8285 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
8286 # define the 'en' prefix, and originally the test used 'wikipedia',
8287 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
8288 # article.
8289 !! test
8290 Different interwiki prefixes mapping to the same URL
8291 !! wikitext
8292 [[:en:Foo]]
8293
8294 [[:en:Foo|Foo]]
8295
8296 [[wikipedia:Foo]]
8297
8298 [[:wikipedia:Foo|Foo]]
8299
8300 [[wikipedia:en:Foo]]
8301
8302 [[:wikipedia:en:Foo]]
8303
8304 [[ wikiPEdia :Foo]]
8305 !! html/parsoid
8306 <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>
8307
8308 <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>
8309
8310 <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>
8311
8312 <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>
8313
8314 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/en:Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/en:Foo"},"sa":{"href":"wikipedia:en:Foo"},"isIW":true}' title="wikipedia:en:Foo">wikipedia:en:Foo</a></p>
8315
8316 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/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>
8317
8318 <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>
8319 !! end
8320
8321 !! test
8322 Interwiki links that cannot be represented in wiki syntax
8323 !! wikitext
8324 [[meatball:ok]]
8325 [[meatball:ok#foo|ok with fragment]]
8326 [[meatball:ok_as_well?|ok ending with ? mark]]
8327 [http://de.wikipedia.org/wiki/Foo?action=history has query]
8328 [http://de.wikipedia.org/wiki/#foo is just fragment]
8329
8330 !! html/php
8331 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
8332 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
8333 <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>
8334 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8335 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
8336 </p>
8337 !! html/parsoid
8338 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
8339 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
8340 <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>
8341 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8342 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
8343 !! end
8344
8345 !! test
8346 Interwiki links: trail
8347 !! wikitext
8348 [[wikipedia:Foo|Ba]]r
8349 !! html/php
8350 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
8351 </p>
8352 !! html/parsoid
8353 <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>
8354 !! end
8355
8356 !! test
8357 Local interwiki link
8358 !! options
8359 parsoid=wt2html,wt2wt,html2html
8360 !! wikitext
8361 [[local:Template:Foo]]
8362 !! html/php
8363 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
8364 </p>
8365 !! html/parsoid
8366 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
8367 !! end
8368
8369 # Parsoid does not mark self-links, by design.
8370 !! test
8371 Local interwiki link: self-link to current page
8372 !! options
8373 title=[[Main Page]]
8374 parsoid=wt2html,wt2wt,html2html
8375 !! wikitext
8376 [[local:Main Page]]
8377 !! html/php
8378 <p><strong class="selflink">local:Main Page</strong>
8379 </p>
8380 !! html/parsoid
8381 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
8382 !! end
8383
8384 !! test
8385 Local interwiki link: prefix only (bug 64167)
8386 !! options
8387 parsoid=wt2html,wt2wt,html2html
8388 !! wikitext
8389 [[local:]]
8390 !! html/php
8391 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
8392 </p>
8393 !! html/parsoid
8394 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
8395 !! end
8396
8397 !! test
8398 Local interwiki link: with additional interwiki prefix (bug 61357)
8399 !! options
8400 parsoid=wt2html,wt2wt,html2html
8401 !! wikitext
8402 [[local:meatball:Hello]]
8403 !! html/php
8404 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8405 </p>
8406 !! html/parsoid
8407 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8408 !! end
8409
8410 !! test
8411 Multiple local interwiki link prefixes
8412 !! wikitext
8413 [[local:local:local:local:mi:local:Foo]]
8414 !! options
8415 parsoid=wt2html,wt2wt,html2html
8416 !! html/php
8417 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8418 </p>
8419 !! html/parsoid
8420 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8421 !! end
8422
8423 ###
8424 ### Interlanguage links
8425 ### Language links (so that searching for '### language' matches..)
8426 ###
8427
8428 !! test
8429 Interlanguage link
8430 !! wikitext
8431 Blah blah blah
8432 [[zh:Chinese]]
8433 !! html/php
8434 <p>Blah blah blah
8435 </p>
8436 !! html/parsoid
8437 <p>Blah blah blah</p>
8438 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8439 !! end
8440
8441 ## parsoid html2wt will lose the space variations
8442 !! test
8443 Interlanguage link with spacing
8444 !! options
8445 parsoid=wt2html,wt2wt,html2html
8446 !! wikitext
8447 Blah blah blah
8448 [[ zh : Chinese ]]
8449 !! html/php
8450 <p>Blah blah blah
8451 </p>
8452 !! html/parsoid
8453 <p>Blah blah blah</p>
8454 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8455 !! end
8456
8457 !! test
8458 Double interlanguage link
8459 !! wikitext
8460 Blah blah blah
8461 [[es:Spanish]]
8462 [[zh:Chinese]]
8463 !! html/php
8464 <p>Blah blah blah
8465 </p>
8466 !! html/parsoid
8467 <p>Blah blah blah</p>
8468 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8469 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8470 !! end
8471
8472 ## parsoid html2wt will lose the space variations
8473 !! test
8474 Interlanguage link variations
8475 !! options
8476 parsoid=wt2html,wt2wt,html2html
8477 !! wikitext
8478 Blah blah blah
8479 [[ es :Spanish]]
8480 [[ ZH :Chinese]]
8481 [[es:Foo_bar]]
8482 !! html/php
8483 <p>Blah blah blah
8484 </p>
8485 !! html/parsoid
8486 <p>Blah blah blah</p>
8487 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
8488 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
8489 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
8490 !! end
8491
8492 ## parsoid html2wt will normalize the space to _
8493 !! test
8494 Space and question mark encoding in interlanguage links (T95473)
8495 !! options
8496 parsoid=wt2html,wt2wt,html2html
8497 !! wikitext
8498 Blah blah blah
8499 [[es:Foo bar?]]
8500 !! html/php
8501 <p>Blah blah blah
8502 </p>
8503 !! html/parsoid
8504 <p>Blah blah blah</p>
8505 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
8506 !! end
8507
8508 !! test
8509 Interlanguage link, with prefix links
8510 !! options
8511 language=ln
8512 !! wikitext
8513 Blah blah blah
8514 [[zh:Chinese]]
8515 !! html/php
8516 <p>Blah blah blah
8517 </p>
8518 !! html/parsoid
8519 <p>Blah blah blah</p>
8520 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8521 !! end
8522
8523 !! test
8524 Double interlanguage link, with prefix links (bug 8897)
8525 !! options
8526 language=ln
8527 !! wikitext
8528 Blah blah blah
8529 [[es:Spanish]]
8530 [[zh:Chinese]]
8531 !! html/php
8532 <p>Blah blah blah
8533 </p>
8534 !! html/parsoid
8535 <p>Blah blah blah</p>
8536 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8537 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8538 !! end
8539
8540 !! test
8541 "Extra" interlanguage links (bug 32189 / gerrit 111390)
8542 !! wikitext
8543 Blah blah blah
8544 [[mul:Article]]
8545 !! html/php
8546 <p>Blah blah blah
8547 </p>
8548 !! html/parsoid
8549 <p>Blah blah blah</p>
8550 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
8551 !! end
8552
8553 ## PHP parser tests script needs an update
8554 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
8555 !! test
8556 Language links render as inline links if $wgInterwikiMagic=false
8557 !! options
8558 wgInterwikiMagic=false
8559 parsoid=wt2html,wt2wt,html2html
8560 !! wikitext
8561 Blah blah blah
8562 [[zh:Chinese]]
8563 !! html/parsoid
8564 <p>Blah blah blah <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
8565 !! end
8566
8567 ## PHP parser tests script needs an update
8568 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
8569 !! test
8570 Language links render as inline links in the Talk namespace
8571 !! options
8572 title=Talk:Foo
8573 parsoid=wt2html,wt2wt,html2html
8574 !! wikitext
8575 Blah blah blah
8576 [[zh:Chinese]]
8577 !! html/parsoid
8578 <p>Blah blah blah <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
8579 !! end
8580
8581 !! test
8582 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
8583 !! options
8584 language=ln
8585 !! wikitext
8586 [[WW&nbsp;II]]
8587 !! html
8588 <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>
8589 </p>
8590 !! end
8591
8592 !! test
8593 Parsoid bug 53221: Wikilinks should be properly entity-escaped
8594 !! options
8595 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
8596 !! html/parsoid
8597 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8598 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8599 !! wikitext
8600 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
8601
8602 He&amp;nbsp;llo He&amp;nbsp;llo
8603 !! html/php
8604 <p>He&amp;nbsp;llo <a href="/wiki/Foo" title="Foo">He&amp;nbsp;llo</a>
8605 </p><p>He&amp;nbsp;llo He&amp;nbsp;llo
8606 </p>
8607 !! end
8608
8609 # html2wt will fail because of title normalization without data-parsoid
8610 !! test
8611 Parsoid: handle constructor well
8612 !! options
8613 parsoid=wt2html,wt2wt
8614 !! wikitext
8615 [[constructor]]
8616
8617 [[constructor:foo]]
8618 !! html/php
8619 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
8620 </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>
8621 </p>
8622 !! html/parsoid
8623 <p><a rel="mw:WikiLink" href="./Constructor" title="Constructor" data-parsoid='{"stx":"simple","a":{"href":"./Constructor"},"sa":{"href":"constructor"}}'>constructor</a></p>
8624
8625 <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>
8626 !! end
8627
8628 !! article
8629 ko:
8630 !! text
8631 Test.
8632 !! endarticle
8633
8634 # Note that `ko` isn't a known interlanguage prefix
8635 !! test
8636 Parsoid: recognize interlanguage links without a target page
8637 !! options
8638 ill
8639 !! wikitext
8640 [[es:]]
8641
8642 [[ko:]]
8643 !! html/php
8644 es:
8645 !! html/parsoid
8646 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
8647
8648 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8649 !! end
8650
8651 # Note that `ko` isn't a known interwiki prefix
8652 !! test
8653 Parsoid: recognize interwiki links without a target page
8654 !! options
8655 parsoid=wt2html,wt2wt,html2html
8656 !! wikitext
8657 [[:es:]]
8658
8659 [[:ko:]]
8660 !! html/php
8661 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
8662 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
8663 </p>
8664 !! html/parsoid
8665 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
8666 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8667 !! end
8668
8669 !! test
8670 Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
8671 !! wikitext
8672 [[mi:Foo]]
8673 !! html/php
8674 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
8675 </p>
8676 !! html/parsoid
8677 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
8678 !! end
8679
8680 !! test
8681 Interlanguage link with preceding local interwiki link (bug 68085)
8682 !! options
8683 parsoid=wt2html,wt2wt,html2html
8684 !! wikitext
8685 Blah blah blah
8686 [[local:es:Spanish]]
8687 !! html/php
8688 <p>Blah blah blah
8689 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
8690 </p>
8691 !! html/parsoid
8692 <p>Blah blah blah
8693 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
8694 !! end
8695
8696 !! test
8697 Looks like an interlanguage link, but is actually a local interwiki
8698 !! options
8699 parsoid=wt2html,wt2wt,html2html
8700 !! wikitext
8701 Blah blah blah
8702 [[mi:Template:Foo]]
8703 !! html/php
8704 <p>Blah blah blah
8705 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
8706 </p>
8707 !! html/parsoid
8708 <p>Blah blah blah
8709 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
8710 !! end
8711
8712 ###
8713 ### Redirects, Parsoid-only
8714 ###
8715
8716 !! test
8717 1. Simple redirect to page
8718 !! wikitext
8719 #REDIRECT [[Main Page]]
8720 !! html/parsoid
8721 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8722 !! end
8723
8724 !! test
8725 2. Other redirect variants
8726 !! wikitext
8727 #REDIRECT [[Main_Page]]
8728 !! html/parsoid
8729 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
8730 !! end
8731
8732 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
8733 # This tests the Parsoid bail-out code.
8734 !! test
8735 3. Other redirect variants
8736 !! wikitext
8737 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
8738 !! html/parsoid
8739 <ol><li data-parsoid>REDIRECT [[[[Bar]]]]</li></ol>
8740 !! end
8741
8742 !! test
8743 4. Redirect to a templated destination
8744 !! wikitext
8745 #REDIRECT [[{{echo|Foo}}bar]]
8746 !! html/parsoid
8747 <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"}]]}'/>
8748 !! end
8749
8750 !! test
8751 Empty redirect
8752 !! options
8753 parsoid=wt2html,wt2wt
8754 !! wikitext
8755 #REDIRECT [[]]
8756 !! html/parsoid
8757 <ol>
8758 <li>REDIRECT [[]]</li></ol>
8759 !! end
8760
8761 !! test
8762 Optional colon in #REDIRECT
8763 !! options
8764 # the colon is archaic syntax. we support it for wt2html, but we
8765 # don't care that it roundtrips back to the modern syntax.
8766 parsoid=wt2html,html2html
8767 !! wikitext
8768 #REDIRECT:[[Main Page]]
8769 !! html/parsoid
8770 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8771 !! end
8772
8773 !! test
8774 Whitespace in #REDIRECT with optional colon
8775 !! options
8776 # the colon and gratuitous whitespace is archaic syntax. we support
8777 # it for wt2html, but we don't care that it roundtrips back to the
8778 # modern syntax (without extra whitespace)
8779 parsoid=wt2html,html2html
8780 !! wikitext
8781
8782 #REDIRECT
8783 :
8784 [[Main Page]]
8785 !! html/parsoid
8786 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8787 !! end
8788
8789 !! test
8790 Piped link in #REDIRECT
8791 !! options
8792 # content after piped link is ignored. we support this syntax,
8793 # but don't care that the piped link is lost when we roundtrip this.
8794 parsoid=wt2html
8795 !! wikitext
8796 #REDIRECT [[Main Page|bar]]
8797 !! html/parsoid
8798 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8799 !! end
8800
8801 !! test
8802 Redirect to category (T104502)
8803 !! options
8804 parsoid=wt2html,wt2wt
8805 !! wikitext
8806 #REDIRECT [[Category:Foo]]
8807 !! html/parsoid
8808 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8809 !! end
8810
8811 !! test
8812 Redirect to category with URL encoding (T104502)
8813 !! options
8814 parsoid=wt2html
8815 !! wikitext
8816 #REDIRECT [[Category%3AFoo]]
8817 !! html/parsoid
8818 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8819 !! end
8820
8821 !! test
8822 Redirect to category page
8823 !! wikitext
8824 #REDIRECT [[:Category:Foo]]
8825 !! html/parsoid
8826 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8827 !! end
8828
8829 !! test
8830 Redirect to image page (1)
8831 !! wikitext
8832 #REDIRECT [[File:Wiki.png]]
8833 !! html/parsoid
8834 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
8835 !! end
8836
8837 !! test
8838 Redirect to image page (2)
8839 !! wikitext
8840 #REDIRECT [[Image:Wiki.png]]
8841 !! html/parsoid
8842 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
8843 !! end
8844
8845 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
8846 # Next test confirms this.
8847 !! test
8848 Redirect to language (1) (T104918)
8849 !! options
8850 parsoid=wt2html,wt2wt,html2html
8851 !! wikitext
8852 #REDIRECT [[en:File:Wiki.png]]
8853 !! html/parsoid
8854 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8855 !! end
8856
8857 !! test
8858 Redirect to language (2) (T104918)
8859 !! wikitext
8860 #REDIRECT [[:en:File:Wiki.png]]
8861 !! html/parsoid
8862 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8863 !! end
8864
8865 !! test
8866 Redirect to interwiki (T104918)
8867 !! wikitext
8868 #REDIRECT [[meatball:File:Wiki.png]]
8869 !! html/parsoid
8870 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
8871 !! end
8872
8873 !! test
8874 Non-English #REDIRECT
8875 !! options
8876 language=is
8877 !! wikitext
8878 #TILVÍSUN [[Main Page]]
8879 !! html/parsoid
8880 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
8881 !! end
8882
8883 !! test
8884 Redirect syntax under text isn't considered a redirect
8885 !! wikitext
8886 some text
8887 #redirect [[Main Page]]
8888 !! html/parsoid
8889 <p>some text</p>
8890 <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>
8891 !! end
8892
8893 # FIXME: Should hoist the redirect to the top of the page and ensure there
8894 # is only one.
8895 !! test
8896 New redirect
8897 !! options
8898 parsoid=html2wt
8899 !! html/parsoid
8900 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
8901 !! wikitext
8902 Foo
8903 #REDIRECT [[Foo]]
8904 !! end
8905
8906 ##
8907 ## XHTML tidiness
8908 ###
8909
8910 !! test
8911 <br> to <br />
8912 !! wikitext
8913 1<br>2<br />3
8914 !! html
8915 <p>1<br />2<br />3
8916 </p>
8917 !! end
8918
8919 !! test
8920 Broken br tag sanitization
8921 !! wikitext
8922 </br>
8923 !! html/php
8924 <p>&lt;/br&gt;
8925 </p>
8926 !! end
8927
8928 # TODO: Fix html2html mode (bug 51055)!
8929 !! test
8930 Parsoid: Broken br tag recognition
8931 !! options
8932 parsoid=wt2html
8933 !! wikitext
8934 </br>
8935
8936 <br/ >
8937 !! html+tidy
8938 <p><br /></p>
8939 <p><br /></p>
8940 !! end
8941
8942 !! test
8943 Incorrecly removing closing slashes from correctly formed XHTML
8944 !! wikitext
8945 <br style="clear:both;" />
8946 !! html
8947 <p><br style="clear:both;" />
8948 </p>
8949 !! end
8950
8951 !! test
8952 Failing to transform badly formed HTML into correct XHTML
8953 !! wikitext
8954 <br style="clear: left;">
8955 <br style="clear: right;">
8956 <br style="clear: both;">
8957 !! html
8958 <p><br style="clear: left;" />
8959 <br style="clear: right;" />
8960 <br style="clear: both;" />
8961 </p>
8962 !!end
8963
8964 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
8965 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
8966 !! test
8967 Handling html with a div self-closing tag
8968 !! wikitext
8969 <div title />
8970 <div title/>
8971 <div title/ >
8972 <div title=bar />
8973 <div title=bar/>
8974 <div title=bar/ >
8975 !! html/php
8976 <p>&lt;div title /&gt;
8977 &lt;div title/&gt;
8978 </p>
8979 <div>
8980 <p>&lt;div title=bar /&gt;
8981 &lt;div title=bar/&gt;
8982 </p>
8983 <div title="bar/"></div>
8984 </div>
8985
8986 !! html/parsoid
8987 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8988 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8989 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
8990 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8991 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8992 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
8993 !! end
8994
8995 !! test
8996 Handling html with a br self-closing tag
8997 !! wikitext
8998 <br title />
8999 <br title/>
9000 <br title/ >
9001 <br title=bar />
9002 <br title=bar/>
9003 <br title=bar/ >
9004 !! html/php
9005 <p><br title="" />
9006 <br title="" />
9007 <br />
9008 <br title="bar" />
9009 <br title="bar" />
9010 <br title="bar/" />
9011 </p>
9012 !! html/parsoid
9013 <p><br title="" />
9014 <br title="" />
9015 <br title="" />
9016 <br title="bar" />
9017 <br title="bar" />
9018 <br title="bar/" />
9019 </p>
9020 !! end
9021
9022 !! test
9023 Horizontal ruler (should it add that extra space?)
9024 !! wikitext
9025 <hr>
9026 <hr >
9027 foo <hr
9028 > bar
9029 !! html+tidy
9030 <hr />
9031 <hr />
9032 <p>foo</p>
9033 <hr />
9034 <p>bar</p>
9035 !! end
9036
9037 !! test
9038 Horizontal ruler -- 4+ dashes render hr
9039 !! wikitext
9040 ----
9041 !! html
9042 <hr />
9043
9044 !! end
9045
9046 !! test
9047 Horizontal ruler -- eats additional dashes on the same line
9048 !! wikitext
9049 ---------
9050 !! html
9051 <hr />
9052
9053 !! end
9054
9055 !! test
9056 Horizontal ruler -- does not collapse dashes on consecutive lines
9057 !! wikitext
9058 ----
9059 ----
9060 !! html
9061 <hr />
9062 <hr />
9063
9064 !! end
9065
9066 !! test
9067 Horizontal ruler -- <4 dashes render as plain text
9068 !! wikitext
9069 ---
9070 !! html
9071 <p>---
9072 </p>
9073 !! end
9074
9075 !! test
9076 Horizontal ruler -- Supports content following dashes on same line
9077 !! wikitext
9078 ---- Foo
9079 !! html
9080 <hr /> Foo
9081
9082 !! html+tidy
9083 <hr />
9084 <p>Foo</p>
9085 !! end
9086
9087 ###
9088 ### Block-level elements
9089 ###
9090 !! test
9091 Common list
9092 !! wikitext
9093 *Common list
9094 * item 2
9095 *item 3
9096 !! html
9097 <ul><li>Common list</li>
9098 <li> item 2</li>
9099 <li>item 3</li></ul>
9100
9101 !! end
9102
9103 !! test
9104 Numbered list
9105 !! wikitext
9106 #Numbered list
9107 #item 2
9108 # item 3
9109 !! html
9110 <ol><li>Numbered list</li>
9111 <li>item 2</li>
9112 <li> item 3</li></ol>
9113
9114 !! end
9115
9116 !! test
9117 Mixed list
9118 !! wikitext
9119 *Mixed list
9120 *# with numbers
9121 ** and bullets
9122 *# and numbers
9123 *bullets again
9124 **bullet level 2
9125 ***bullet level 3
9126 ***#Number on level 4
9127 **bullet level 2
9128 **#Number on level 3
9129 **#Number on level 3
9130 *#number level 2
9131 *Level 1
9132 *** Level 3
9133 #** Level 3, but ordered
9134 !! html
9135 <ul><li>Mixed list
9136 <ol><li> with numbers</li></ol>
9137 <ul><li> and bullets</li></ul>
9138 <ol><li> and numbers</li></ol></li>
9139 <li>bullets again
9140 <ul><li>bullet level 2
9141 <ul><li>bullet level 3
9142 <ol><li>Number on level 4</li></ol></li></ul></li>
9143 <li>bullet level 2
9144 <ol><li>Number on level 3</li>
9145 <li>Number on level 3</li></ol></li></ul>
9146 <ol><li>number level 2</li></ol></li>
9147 <li>Level 1
9148 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
9149 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
9150
9151 !! end
9152
9153 !! test
9154 1. Nested mixed wikitext and html list
9155 !! wikitext
9156 * hi
9157 * <ul><li>ho</li></ul>
9158 * hi
9159 ** ho
9160 !! html/php
9161 <ul><li> hi</li>
9162 <li> <ul><li>ho</li></ul></li>
9163 <li> hi
9164 <ul><li> ho</li></ul></li></ul>
9165
9166 !! html/parsoid
9167 <ul><li> hi</li>
9168 <li> <ul data-parsoid='{"stx":"html"}'><li data-parsoid='{"stx":"html"}'>ho</li></ul></li>
9169 <li> hi
9170 <ul><li> ho</li></ul></li></ul>
9171 !! end
9172
9173 !! test
9174 2. Nested mixed wikitext and html list (incompatible)
9175 !! wikitext
9176 ; hi
9177 : {{echo|<li>ho</li>}}
9178 !! html/php
9179 <dl><dt> hi</dt>
9180 <dd> <li>ho</li></dd></dl>
9181
9182 !! html/parsoid
9183 <dl><dt> hi</dt>
9184 <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>
9185 !! end
9186
9187 !! test
9188 Nested lists 1
9189 !! wikitext
9190 *foo
9191 **bar
9192 !! html
9193 <ul><li>foo
9194 <ul><li>bar</li></ul></li></ul>
9195
9196 !! end
9197
9198 !! test
9199 Nested lists 2
9200 !! wikitext
9201 **foo
9202 *bar
9203 !! html
9204 <ul><li><ul><li>foo</li></ul></li>
9205 <li>bar</li></ul>
9206
9207 !! end
9208
9209 !! test
9210 Nested lists 3 (first element empty)
9211 !! wikitext
9212 *
9213 **bar
9214 !! html
9215 <ul><li>
9216 <ul><li>bar</li></ul></li></ul>
9217
9218 !! end
9219
9220 !! test
9221 Nested lists 4 (first element empty)
9222 !! wikitext
9223 **
9224 *bar
9225 !! html
9226 <ul><li><ul><li></li></ul></li>
9227 <li>bar</li></ul>
9228
9229 !! end
9230
9231 !! test
9232 Nested lists 5 (both elements empty)
9233 !! wikitext
9234 **
9235 *
9236 !! html
9237 <ul><li><ul><li></li></ul></li>
9238 <li></li></ul>
9239
9240 !! end
9241
9242 !! test
9243 Nested lists 6 (both elements empty)
9244 !! wikitext
9245 *
9246 **
9247 !! html
9248 <ul><li>
9249 <ul><li></li></ul></li></ul>
9250
9251 !! end
9252
9253 !! test
9254 Nested lists 7 (skip initial nesting levels)
9255 !! wikitext
9256 *** foo
9257 !! html
9258 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
9259
9260 !! end
9261
9262 !! test
9263 Nested lists 8 (multiple nesting transitions)
9264 !! wikitext
9265 * foo
9266 *** bar
9267 ** baz
9268 * boo
9269 !! html
9270 <ul><li> foo
9271 <ul><li><ul><li> bar</li></ul></li>
9272 <li> baz</li></ul></li>
9273 <li> boo</li></ul>
9274
9275 !! end
9276
9277 !! test
9278 Nested lists 9 (extension interaction)
9279 !! options
9280 parsoid
9281 !! wikitext
9282 *<references />
9283 !! html/parsoid
9284 <ul><li data-parsoid='{}'><ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
9285 !! end
9286
9287 !! test
9288 1. Lists with start-of-line-transparent tokens before bullets: Comments
9289 !! wikitext
9290 *foo
9291 *<!--cmt-->bar
9292 <!--cmt-->*baz
9293 !! html
9294 <ul><li>foo</li>
9295 <li>bar</li>
9296 <li>baz</li></ul>
9297
9298 !! end
9299
9300 !! test
9301 2. Lists with start-of-line-transparent tokens before bullets: Template close
9302 !! wikitext
9303 *foo {{echo|bar
9304 }}*baz
9305 !! html
9306 <ul><li>foo bar</li>
9307 <li>baz</li></ul>
9308
9309 !! end
9310
9311 !! test
9312 List items are not parsed correctly following a <pre> block (bug 785)
9313 !! wikitext
9314 * <pre>foo</pre>
9315 * <pre>bar</pre>
9316 * zar
9317 !! html/php
9318 <ul><li> <pre>foo</pre></li>
9319 <li> <pre>bar</pre></li>
9320 <li> zar</li></ul>
9321
9322 !! html/parsoid
9323 <ul><li> <pre data-parsoid='{"stx":"html"}'>foo</pre></li>
9324 <li> <pre data-parsoid='{"stx":"html"}'>bar</pre></li>
9325 <li> zar</li></ul>
9326 !! end
9327
9328 !! test
9329 List items from template
9330 !! wikitext
9331
9332 {{inner list}}
9333 * item 2
9334
9335 * item 0
9336 {{inner list}}
9337 * item 2
9338
9339 * item 0
9340 * notSOL{{inner list}}
9341 * item 2
9342 !! html
9343 <ul><li> item 1</li>
9344 <li> item 2</li></ul>
9345 <ul><li> item 0</li>
9346 <li> item 1</li>
9347 <li> item 2</li></ul>
9348 <ul><li> item 0</li>
9349 <li> notSOL</li>
9350 <li> item 1</li>
9351 <li> item 2</li></ul>
9352
9353 !! end
9354
9355 !! test
9356 List interrupted by empty line or heading
9357 !! wikitext
9358 * foo
9359
9360 ** bar
9361 == A heading ==
9362 * Another list item
9363 !! html
9364 <ul><li> foo</li></ul>
9365 <ul><li><ul><li> bar</li></ul></li></ul>
9366 <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>
9367 <ul><li> Another list item</li></ul>
9368
9369 !!end
9370
9371 !!test
9372 Multiple list tags generated by templates
9373 !! wikitext
9374 {{echo|<li>}}a
9375 {{echo|<li>}}b
9376 {{echo|<li>}}c
9377 !! html
9378 <li>a
9379 <li>b
9380 <li>c</li>
9381 </li>
9382 </li>
9383
9384 !! html+tidy
9385 <ul>
9386 <li>a</li>
9387 <li>b</li>
9388 <li>c</li>
9389 </ul>
9390 !!end
9391
9392 !!test
9393 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
9394 !! wikitext
9395 *a
9396 <!--This line will NOT split the list-->
9397 *b
9398 <!--This line will NOT split the list either-->
9399 *c
9400 <!--foo--> <!----> <!--This line NOT split the list either-->
9401 *d
9402 !! html
9403 <ul><li>a</li>
9404 <li>b</li>
9405 <li>c</li>
9406 <li>d</li></ul>
9407
9408 !!end
9409
9410 !!test
9411 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
9412 !! wikitext
9413 *a
9414 <!--This line will NOT split the list-->
9415 *b
9416 <!--This line will NOT split the list either-->
9417 *c
9418 <!--foo--> <!----> <!--This line NOT split the list
9419 either-->
9420 *d
9421 !! html
9422 <ul><li>a</li>
9423 <li>b</li>
9424 <li>c</li>
9425 <li>d</li></ul>
9426
9427 !!end
9428
9429 !!test
9430 Test the li-hack
9431 (The PHP parser relies on Tidy for the hack)
9432 !!options
9433 parsoid=wt2html,wt2wt
9434 !! wikitext
9435 * foo
9436 * <li>li-hack
9437 * {{echo|<li>templated li-hack}}
9438 * <!--foo--> <li> unsupported li-hack with preceding comments
9439
9440 <ul>
9441 <li><li>not a li-hack
9442 </li>
9443 </ul>
9444 !! html+tidy
9445 <ul>
9446 <li>foo</li>
9447 <li>li-hack</li>
9448 <li>templated li-hack</li>
9449 <li>unsupported li-hack with preceding comments</li>
9450 </ul>
9451 <ul>
9452 <li>not a li-hack</li>
9453 </ul>
9454 !!end
9455
9456 !! test
9457 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
9458 !! options
9459 parsoid
9460 !! wikitext
9461 # foo
9462 ## bar
9463 * foo
9464 ** bar
9465 : foo
9466 :: bar
9467 !! html
9468 <ol>
9469 <li> foo<ol>
9470 <li> bar</li>
9471 </ol></li>
9472 </ol><ul>
9473 <li> foo<ul>
9474 <li> bar</li>
9475 </ul></li>
9476 </ul><dl>
9477 <dd> foo<dl>
9478 <dd> bar</dd>
9479 </dl></dd>
9480 </dl>
9481 !! end
9482
9483 !! test
9484 Parsoid: Test of whitespace serialization with Templated bullets
9485 !! options
9486 parsoid
9487 !! wikitext
9488 * {{bullet}}
9489 !! html
9490 <ul>
9491 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
9492 </ul>
9493 !! end
9494
9495 # ------------------------------------------------------------------------
9496 # The next set of tests are about Parsoid's ability to handle badly nested
9497 # tags (parse, minimize scope of fixup, and roundtrip back)
9498 # ------------------------------------------------------------------------
9499
9500 !! test
9501 Unbalanced closing block tags break a list
9502 (php parser relies on Tidy to fix up)
9503 !! wikitext
9504 <div>
9505 *a</div><div>
9506 *b</div>
9507 !! html+tidy
9508 <div>
9509 <ul>
9510 <li>a</li>
9511 </ul>
9512 </div>
9513 <div>
9514 <ul>
9515 <li>b</li>
9516 </ul>
9517 </div>
9518 !! end
9519
9520 # Parsoid fails this test, but it might be tricky to support properly.
9521 # See bug 68395.
9522 !! test
9523 Unbalanced closing non-block tags don't break a list
9524 (php parser relies on Tidy to fix up)
9525 !! wikitext
9526 <span>
9527 *a</span><span>
9528 *b</span>
9529 !! html/php+tidy
9530 <ul>
9531 <li><span>a</span></li>
9532 <li><span>b</span></li>
9533 </ul>
9534 !! html/parsoid
9535 <span>
9536 <ul>
9537 <li>a<span></span>
9538 </li>
9539 <li>b
9540 </li>
9541 </ul>
9542 </span>
9543 !! end
9544
9545 !! test
9546 Unclosed formatting tags that straddle lists are closed and reopened
9547 (php parser relies on Tidy to fix up)
9548 !! options
9549 parsoid=wt2html,wt2wt,html2html
9550 !! wikitext
9551 # <s> a
9552 # b </s>
9553 !! html/php+tidy
9554 <ol>
9555 <li><s>a</s></li>
9556 <li><s>b</s></li>
9557 </ol>
9558 !! html/parsoid
9559 <ol><li> <s> a</s></li>
9560 <li><s> b </s></li></ol>
9561 !! end
9562
9563 # See bug 68395.
9564 !!test
9565 1. List embedded in a formatting tag
9566 !! wikitext
9567 <small>
9568 * foo
9569 </small>
9570 !! html/php+tidy
9571 <ul>
9572 <li><small>foo</small></li>
9573 </ul>
9574 !! html/parsoid
9575 <small>
9576 <ul>
9577 <li> foo</li>
9578 </ul>
9579 </small>
9580 !!end
9581
9582 ## Ugly Parsoid output here
9583 ## Not sure what the right output is.
9584 !!test
9585 2. List embedded in a formatting tag
9586 !! wikitext
9587 <small>
9588 *a
9589 *b</small>
9590 !! html/php+tidy
9591 <ul>
9592 <li><small>a</small></li>
9593 <li><small>b</small></li>
9594 </ul>
9595 !! html/parsoid
9596 <small></small>
9597 <ul><small>
9598 <li>a</li>
9599 </small>
9600 <li><small>b</small></li>
9601 </ul>
9602 !!end
9603
9604 # Ugly Parsoid and PHP parser output here
9605 # Not sure if we want to make this a test!
9606 #
9607 ## !!test
9608 ## 3. Unclosed formatting tags in list elements
9609 ## !! wikitext
9610 ## *<small>a
9611 ## *<small>b
9612 ## !! html/php+tidy
9613 ## <ul>
9614 ## <li><small>a</small></li>
9615 ## <li><small><small>b</small></small></li>
9616 ## </ul>
9617 ## !! html/parsoid
9618 ## <ul>
9619 ## <li><small>a</small></li>
9620 ## <small>
9621 ## <li><small>b</small></li>
9622 ## </small></ul>
9623 ## !!end
9624
9625 # This is a bug in the PHP parser + tidy combination.
9626 # (The </tr> tag gets parsed as text and html-escaped by PHP,
9627 # and then fostered out of the table by tidy.)
9628 # We believe the Parsoid output to be correct.
9629 !! test
9630 Table with missing opening <tr> tag
9631 !! options
9632 parsoid=wt2html,wt2wt
9633 !! wikitext
9634 <table>
9635 <td>foo</td>
9636 </tr>
9637 </table>
9638 !! html+tidy
9639 <table>
9640 <tr>
9641 <td>foo</td>
9642 </tr>
9643 </table>
9644 !! end
9645
9646 ###
9647 ### Magic Words
9648 ###
9649
9650 # Note that the current date is hard-coded as
9651 # 1970-01-01T00:02:03Z (a Thursday)
9652 # when running parser tests. The timezone is also fixed to GMT, so
9653 # local date will be identical to current date.
9654
9655 !! test
9656 Magic Word: {{CURRENTDAY}}
9657 !! wikitext
9658 {{CURRENTDAY}}
9659 !! html
9660 <p>1
9661 </p>
9662 !! end
9663
9664 !! test
9665 Magic Word: {{CURRENTDAY2}}
9666 !! wikitext
9667 {{CURRENTDAY2}}
9668 !! html
9669 <p>01
9670 </p>
9671 !! end
9672
9673 !! test
9674 Magic Word: {{CURRENTDAYNAME}}
9675 !! wikitext
9676 {{CURRENTDAYNAME}}
9677 !! html
9678 <p>Thursday
9679 </p>
9680 !! end
9681
9682 !! test
9683 Magic Word: {{CURRENTDOW}}
9684 !! wikitext
9685 {{CURRENTDOW}}
9686 !! html
9687 <p>4
9688 </p>
9689 !! end
9690
9691 !! test
9692 Magic Word: {{CURRENTMONTH}}
9693 !! wikitext
9694 {{CURRENTMONTH}}
9695 !! html
9696 <p>01
9697 </p>
9698 !! end
9699
9700 !! test
9701 Magic Word: {{CURRENTMONTH1}}
9702 !! wikitext
9703 {{CURRENTMONTH1}}
9704 !! html
9705 <p>1
9706 </p>
9707 !! end
9708
9709 !! test
9710 Magic Word: {{CURRENTMONTHABBREV}}
9711 !! wikitext
9712 {{CURRENTMONTHABBREV}}
9713 !! html
9714 <p>Jan
9715 </p>
9716 !! end
9717
9718 !! test
9719 Magic Word: {{CURRENTMONTHNAME}}
9720 !! wikitext
9721 {{CURRENTMONTHNAME}}
9722 !! html
9723 <p>January
9724 </p>
9725 !! end
9726
9727 !! test
9728 Magic Word: {{CURRENTMONTHNAMEGEN}}
9729 !! wikitext
9730 {{CURRENTMONTHNAMEGEN}}
9731 !! html
9732 <p>January
9733 </p>
9734 !! end
9735
9736 !! test
9737 Magic Word: {{CURRENTTIME}}
9738 !! wikitext
9739 {{CURRENTTIME}}
9740 !! html
9741 <p>00:02
9742 </p>
9743 !! end
9744
9745 !! test
9746 Magic Word: {{CURRENTHOUR}}
9747 !! wikitext
9748 {{CURRENTHOUR}}
9749 !! html
9750 <p>00
9751 </p>
9752 !! end
9753
9754 !! test
9755 Magic Word: {{CURRENTWEEK}} (@bug 4594)
9756 !! wikitext
9757 {{CURRENTWEEK}}
9758 !! html
9759 <p>1
9760 </p>
9761 !! end
9762
9763 !! test
9764 Magic Word: {{CURRENTYEAR}}
9765 !! wikitext
9766 {{CURRENTYEAR}}
9767 !! html
9768 <p>1970
9769 </p>
9770 !! end
9771
9772 !! test
9773 Magic Word: {{CURRENTTIMESTAMP}}
9774 !! wikitext
9775 {{CURRENTTIMESTAMP}}
9776 !! html
9777 <p>19700101000203
9778 </p>
9779 !! end
9780
9781 !! test
9782 Magic Words LOCAL (UTC)
9783 !! wikitext
9784 * {{LOCALMONTH}}
9785 * {{LOCALMONTH1}}
9786 * {{LOCALMONTHNAME}}
9787 * {{LOCALMONTHNAMEGEN}}
9788 * {{LOCALMONTHABBREV}}
9789 * {{LOCALDAY}}
9790 * {{LOCALDAY2}}
9791 * {{LOCALDAYNAME}}
9792 * {{LOCALYEAR}}
9793 * {{LOCALTIME}}
9794 * {{LOCALHOUR}}
9795 * {{LOCALWEEK}}
9796 * {{LOCALDOW}}
9797 * {{LOCALTIMESTAMP}}
9798 !! html
9799 <ul><li> 01</li>
9800 <li> 1</li>
9801 <li> January</li>
9802 <li> January</li>
9803 <li> Jan</li>
9804 <li> 1</li>
9805 <li> 01</li>
9806 <li> Thursday</li>
9807 <li> 1970</li>
9808 <li> 00:02</li>
9809 <li> 00</li>
9810 <li> 1</li>
9811 <li> 4</li>
9812 <li> 19700101000203</li></ul>
9813
9814 !! end
9815
9816 !! test
9817 Magic Word: {{FULLPAGENAME}}
9818 !! options
9819 title=[[User:Ævar Arnfjörð Bjarmason]]
9820 !! wikitext
9821 {{FULLPAGENAME}}
9822 !! html
9823 <p>User:Ævar Arnfjörð Bjarmason
9824 </p>
9825 !! end
9826
9827 !! test
9828 Magic Word: {{FULLPAGENAMEE}}
9829 !! options
9830 title=[[User:Ævar Arnfjörð Bjarmason]]
9831 !! wikitext
9832 {{FULLPAGENAMEE}}
9833 !! html
9834 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9835 </p>
9836 !! end
9837
9838 !! test
9839 Magic Word: {{TALKSPACE}}
9840 !! options
9841 title=[[User:Ævar Arnfjörð Bjarmason]]
9842 !! wikitext
9843 {{TALKSPACE}}
9844 !! html
9845 <p>User talk
9846 </p>
9847 !! end
9848
9849 !! test
9850 Magic Word: {{TALKSPACE}}, same namespace
9851 !! options
9852 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9853 !! wikitext
9854 {{TALKSPACE}}
9855 !! html
9856 <p>User talk
9857 </p>
9858 !! end
9859
9860 !! test
9861 Magic Word: {{TALKSPACE}}, main namespace
9862 !! options
9863 title=[[Parser Test]]
9864 !! wikitext
9865 {{TALKSPACE}}
9866 !! html
9867 <p>Talk
9868 </p>
9869 !! end
9870
9871 !! test
9872 Magic Word: {{TALKSPACEE}}
9873 !! options
9874 title=[[User:Ævar Arnfjörð Bjarmason]]
9875 !! wikitext
9876 {{TALKSPACEE}}
9877 !! html
9878 <p>User_talk
9879 </p>
9880 !! end
9881
9882 !! test
9883 Magic Word: {{SUBJECTSPACE}}
9884 !! options
9885 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9886 !! wikitext
9887 {{SUBJECTSPACE}}
9888 !! html
9889 <p>User
9890 </p>
9891 !! end
9892
9893 !! test
9894 Magic Word: {{SUBJECTSPACE}}, same namespace
9895 !! options
9896 title=[[User:Ævar Arnfjörð Bjarmason]]
9897 !! wikitext
9898 {{SUBJECTSPACE}}
9899 !! html
9900 <p>User
9901 </p>
9902 !! end
9903
9904 !! test
9905 Magic Word: {{SUBJECTSPACE}}, main namespace
9906 !! options
9907 title=[[Parser Test]]
9908 !! wikitext
9909 {{SUBJECTSPACE}}
9910 !! html
9911
9912 !! end
9913
9914 !! test
9915 Magic Word: {{SUBJECTSPACEE}}
9916 !! options
9917 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9918 !! wikitext
9919 {{SUBJECTSPACEE}}
9920 !! html
9921 <p>User
9922 </p>
9923 !! end
9924
9925 !! test
9926 Magic Word: {{NAMESPACE}}
9927 !! options
9928 title=[[User:Ævar Arnfjörð Bjarmason]]
9929 !! wikitext
9930 {{NAMESPACE}}
9931 !! html
9932 <p>User
9933 </p>
9934 !! end
9935
9936 !! test
9937 Magic Word: {{NAMESPACEE}}
9938 !! options
9939 title=[[User:Ævar Arnfjörð Bjarmason]]
9940 !! wikitext
9941 {{NAMESPACEE}}
9942 !! html
9943 <p>User
9944 </p>
9945 !! end
9946
9947 !! test
9948 Magic Word: {{NAMESPACENUMBER}}
9949 !! options
9950 title=[[User:Ævar Arnfjörð Bjarmason]]
9951 !! wikitext
9952 {{NAMESPACENUMBER}}
9953 !! html
9954 <p>2
9955 </p>
9956 !! end
9957
9958 !! test
9959 Magic Word: {{SUBPAGENAME}}
9960 !! options
9961 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9962 !! wikitext
9963 {{SUBPAGENAME}}
9964 !! html
9965 <p>sub ö
9966 </p>
9967 !! end
9968
9969 !! test
9970 Magic Word: {{SUBPAGENAMEE}}
9971 !! options
9972 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9973 !! wikitext
9974 {{SUBPAGENAMEE}}
9975 !! html
9976 <p>sub_%C3%B6
9977 </p>
9978 !! end
9979
9980 !! test
9981 Magic Word: {{ROOTPAGENAME}}
9982 !! options
9983 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9984 !! wikitext
9985 {{ROOTPAGENAME}}
9986 !! html
9987 <p>Ævar Arnfjörð Bjarmason
9988 </p>
9989 !! end
9990
9991 !! test
9992 Magic Word: {{ROOTPAGENAMEE}}
9993 !! options
9994 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9995 !! wikitext
9996 {{ROOTPAGENAMEE}}
9997 !! html
9998 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9999 </p>
10000 !! end
10001
10002 !! test
10003 Magic Word: {{BASEPAGENAME}}
10004 !! options
10005 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10006 !! wikitext
10007 {{BASEPAGENAME}}
10008 !! html
10009 <p>Ævar Arnfjörð Bjarmason
10010 </p>
10011 !! end
10012
10013 !! test
10014 Magic Word: {{BASEPAGENAMEE}}
10015 !! options
10016 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10017 !! wikitext
10018 {{BASEPAGENAMEE}}
10019 !! html
10020 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10021 </p>
10022 !! end
10023
10024 !! test
10025 Magic Word: {{TALKPAGENAME}}
10026 !! options
10027 title=[[User:Ævar Arnfjörð Bjarmason]]
10028 !! wikitext
10029 {{TALKPAGENAME}}
10030 !! html
10031 <p>User talk:Ævar Arnfjörð Bjarmason
10032 </p>
10033 !! end
10034
10035 !! test
10036 Magic Word: {{TALKPAGENAMEE}}
10037 !! options
10038 title=[[User:Ævar Arnfjörð Bjarmason]]
10039 !! wikitext
10040 {{TALKPAGENAMEE}}
10041 !! html
10042 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10043 </p>
10044 !! end
10045
10046 !! test
10047 Magic Word: {{SUBJECTPAGENAME}}
10048 !! options
10049 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10050 !! wikitext
10051 {{SUBJECTPAGENAME}}
10052 !! html
10053 <p>User:Ævar Arnfjörð Bjarmason
10054 </p>
10055 !! end
10056
10057 !! test
10058 Magic Word: {{SUBJECTPAGENAMEE}}
10059 !! options
10060 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10061 !! wikitext
10062 {{SUBJECTPAGENAMEE}}
10063 !! html
10064 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10065 </p>
10066 !! end
10067
10068 !! test
10069 Magic Word: {{NUMBEROFFILES}}
10070 !! wikitext
10071 {{NUMBEROFFILES}}
10072 !! html
10073 <p>7
10074 </p>
10075 !! end
10076
10077 !! test
10078 Magic Word: {{PAGENAME}}
10079 !! options
10080 title=[[User:Ævar Arnfjörð Bjarmason]]
10081 !! wikitext
10082 {{PAGENAME}}
10083 !! html
10084 <p>Ævar Arnfjörð Bjarmason
10085 </p>
10086 !! end
10087
10088 !! test
10089 Magic Word: {{PAGENAME}} with metacharacters
10090 !! options
10091 title=[['foo & bar = baz']]
10092 !! wikitext
10093 ''{{PAGENAME}}''
10094 !! html/php
10095 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
10096 </p>
10097 !! html+tidy
10098 <p><i>'foo &amp; bar = baz'</i></p>
10099 !! end
10100
10101 !! test
10102 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
10103 !! options
10104 title=[[*RFC 1234 http://example.com/]]
10105 !! wikitext
10106 {{PAGENAME}}
10107 !! html/php
10108 <p>&#42;RFC&#32;1234 http&#58;//example.com/
10109 </p>
10110 !! html+tidy
10111 <p>*RFC 1234 http://example.com/</p>
10112 !! end
10113
10114 !! test
10115 Magic Word: {{PAGENAMEE}}
10116 !! options
10117 title=[[User:Ævar Arnfjörð Bjarmason]]
10118 !! wikitext
10119 {{PAGENAMEE}}
10120 !! html
10121 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10122 </p>
10123 !! end
10124
10125 !! test
10126 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
10127 !! options
10128 title=[[*RFC 1234 http://example.com/]]
10129 !! wikitext
10130 {{PAGENAMEE}}
10131 !! html/php
10132 <p>&#42;RFC_1234_http&#58;//example.com/
10133 </p>
10134 !! html+tidy
10135 <p>*RFC_1234_http://example.com/</p>
10136 !! end
10137
10138 !! test
10139 Magic Word: {{REVISIONID}}
10140 !! wikitext
10141 {{REVISIONID}}
10142 !! html
10143 <p>1337
10144 </p>
10145 !! end
10146
10147 !! test
10148 Magic Word: {{SCRIPTPATH}}
10149 !! wikitext
10150 {{SCRIPTPATH}}
10151 !! html
10152
10153 !! end
10154
10155 !! test
10156 Magic Word: {{STYLEPATH}}
10157 !! wikitext
10158 {{STYLEPATH}}
10159 !! html
10160 <p>/skins
10161 </p>
10162 !! end
10163
10164 !! test
10165 Magic Word: {{SERVER}}
10166 !! wikitext
10167 {{SERVER}}
10168 !! html
10169 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10170 </p>
10171 !! end
10172
10173 !! test
10174 Magic Word: {{SERVERNAME}}
10175 !! wikitext
10176 {{SERVERNAME}}
10177 !! html
10178 <p>example.org
10179 </p>
10180 !! end
10181
10182 !! test
10183 Magic Word: {{SITENAME}}
10184 !! wikitext
10185 {{SITENAME}}
10186 !! html
10187 <p>MediaWiki
10188 </p>
10189 !! end
10190
10191 !! test
10192 Case-sensitive magic words, when cased differently, should just be template transclusions
10193 !! wikitext
10194 {{CurrentMonth}}
10195 {{currentday}}
10196 {{cURreNTweEK}}
10197 {{currentHour}}
10198 !! html
10199 <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>
10200 <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>
10201 <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>
10202 <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>
10203 </p>
10204 !! end
10205
10206 !! test
10207 Case-insensitive magic words should still work with weird casing.
10208 !! wikitext
10209 {{sErVeRNaMe}}
10210 {{LCFirst:AOEU}}
10211 {{ucFIRST:aoeu}}
10212 {{SERver}}
10213 !! html
10214 <p>example.org
10215 aOEU
10216 Aoeu
10217 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10218 </p>
10219 !! end
10220
10221 # From plwiki:PLOS_ONE
10222 !! test
10223 Parsoid: Page property magic word with magic word contents
10224 !! wikitext
10225 {{DISPLAYTITLE:''{{PAGENAME}}''}}
10226 !! html/parsoid
10227 <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>"}]]}'/>
10228 !! end
10229
10230 !! test
10231 Parsoid: Template-generated DISPLAYTITLE
10232 !! wikitext
10233 {{{{echo|DISPLAYTITLE}}:Foo}}
10234 !! html/parsoid
10235 <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}}]}'/>
10236 !! end
10237
10238 !! test
10239 Namespace 1 {{ns:1}}
10240 !! wikitext
10241 {{ns:1}}
10242 !! html
10243 <p>Talk
10244 </p>
10245 !! end
10246
10247 !! test
10248 Namespace 1 {{ns:01}}
10249 !! wikitext
10250 {{ns:01}}
10251 !! html
10252 <p>Talk
10253 </p>
10254 !! end
10255
10256 !! test
10257 Namespace 0 {{ns:0}} (bug 4783)
10258 !! wikitext
10259 {{ns:0}}
10260 !! html
10261
10262 !! end
10263
10264 !! test
10265 Namespace 0 {{ns:00}} (bug 4783)
10266 !! wikitext
10267 {{ns:00}}
10268 !! html
10269
10270 !! end
10271
10272 !! test
10273 Namespace -1 {{ns:-1}}
10274 !! wikitext
10275 {{ns:-1}}
10276 !! html
10277 <p>Special
10278 </p>
10279 !! end
10280
10281 !! test
10282 Namespace User {{ns:User}}
10283 !! wikitext
10284 {{ns:User}}
10285 !! html
10286 <p>User
10287 </p>
10288 !! end
10289
10290 !! test
10291 Namespace User talk {{ns:User_talk}}
10292 !! wikitext
10293 {{ns:User_talk}}
10294 !! html
10295 <p>User talk
10296 </p>
10297 !! end
10298
10299 !! test
10300 Namespace User talk {{ns:uSeR tAlK}}
10301 !! wikitext
10302 {{ns:uSeR tAlK}}
10303 !! html
10304 <p>User talk
10305 </p>
10306 !! end
10307
10308 !! test
10309 Namespace File {{ns:File}}
10310 !! wikitext
10311 {{ns:File}}
10312 !! html
10313 <p>File
10314 </p>
10315 !! end
10316
10317 !! test
10318 Namespace File {{ns:Image}}
10319 !! wikitext
10320 {{ns:Image}}
10321 !! html
10322 <p>File
10323 </p>
10324 !! end
10325
10326 !! test
10327 Namespace (lang=de) Benutzer {{ns:User}}
10328 !! options
10329 language=de
10330 !! wikitext
10331 {{ns:User}}
10332 !! html
10333 <p>Benutzer
10334 </p>
10335 !! end
10336
10337 !! test
10338 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
10339 !! options
10340 language=de
10341 !! wikitext
10342 {{ns:3}}
10343 !! html
10344 <p>Benutzer Diskussion
10345 </p>
10346 !! end
10347
10348
10349 !! test
10350 Urlencode
10351 !! wikitext
10352 {{urlencode:hi world?!}}
10353 {{urlencode:hi world?!|WIKI}}
10354 {{urlencode:hi world?!|PATH}}
10355 {{urlencode:hi world?!|QUERY}}
10356 !! html
10357 <p>hi+world%3F%21
10358 hi_world%3F!
10359 hi%20world%3F%21
10360 hi+world%3F%21
10361 </p>
10362 !! end
10363
10364 !! test
10365 Magic Word: prioritize type info over data-parsoid
10366 !! options
10367 parsoid=html2wt
10368 !! html/parsoid
10369 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
10370 !! wikitext
10371 __FORCETOC__
10372 !! end
10373
10374 !! test
10375 Magic Word: serialize on separate line (parsoid)
10376 !! options
10377 parsoid=wt2wt,html2wt
10378 !! wikitext
10379 foo
10380 __NOTOC__
10381 bar
10382 !! html/parsoid
10383 foo<meta property="mw:PageProp/notoc"/>bar
10384 !! end
10385
10386 !! test
10387 Magic Word: rt non-english wikis
10388 !! options
10389 parsoid=wt2wt
10390 language=de
10391 !! wikitext
10392 __NOEDITSECTION__
10393 !! html/parsoid
10394 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
10395 !! end
10396
10397 !!test
10398 __proto__ is treated as normal wikitext (T105997)
10399 !!wikitext
10400 __proto__
10401 !!html
10402 <p>__proto__
10403 </p>
10404 !!end
10405
10406 ###
10407 ### Magic links
10408 ###
10409 !! test
10410 Magic links: internal link to RFC (bug 479)
10411 !! wikitext
10412 [[RFC 123]]
10413 !! html/php
10414 <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>
10415 </p>
10416 !! html/parsoid
10417 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
10418 !! end
10419
10420 !! test
10421 Magic links: RFC (bug 479)
10422 !! wikitext
10423 RFC 822
10424 !! html/php
10425 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10426 </p>
10427 !! html/parsoid
10428 <p><a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a></p>
10429 !! end
10430
10431 !! test
10432 Magic links: RFC (bug 65278)
10433 !! wikitext
10434 This is RFC 822 but thisRFC 822 is not RFC 822linked.
10435 !! html/php
10436 <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.
10437 </p>
10438 !! html/parsoid
10439 <p>This is <a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a> but thisRFC 822 is not RFC 822linked.</p>
10440 !! end
10441
10442 !! test
10443 Magic links: RFC (w/ non-newline whitespace, bug 28950/29025)
10444 !! wikitext
10445 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
10446 RFC
10447 822
10448 !! html/php
10449 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10450 RFC
10451 822
10452 </p>
10453 !! html/parsoid
10454 <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>
10455 RFC
10456 822</p>
10457 !! end
10458
10459 !! test
10460 Magic links: ISBN (bug 1937)
10461 !! wikitext
10462 ISBN 0-306-40615-2
10463 !! html/php
10464 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
10465 </p>
10466 !! html/parsoid
10467 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
10468 !! end
10469
10470 !! test
10471 Magic links: ISBN (bug 65278)
10472 !! wikitext
10473 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
10474 !! html/php
10475 <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.
10476 </p>
10477 !! html/parsoid
10478 <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>
10479 !! end
10480
10481 !! test
10482 Magic links: ISBN (w/ non-newline whitespace, bug 28950/29025)
10483 !! wikitext
10484 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
10485 ISBN
10486 9780316098113
10487 ISBN 978
10488 0316098113
10489 !! html/php
10490 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
10491 ISBN
10492 9780316098113
10493 ISBN 978
10494 0316098113
10495 </p>
10496 !! html/parsoid
10497 <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>
10498 ISBN
10499 9780316098113
10500 ISBN 978
10501 0316098113</p>
10502 !! end
10503
10504 !! test
10505 Magic links: PMID incorrectly converts space to underscore
10506 !! wikitext
10507 PMID 1234
10508 !! html/php
10509 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10510 </p>
10511 !! html/parsoid
10512 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a></p>
10513 !! end
10514
10515 !! test
10516 Magic links: PMID (bug 65278)
10517 !! wikitext
10518 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
10519 !! html/php
10520 <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.
10521 </p>
10522 !! html/parsoid
10523 <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>
10524 !! end
10525
10526 !! test
10527 Magic links: PMID (w/ non-newline whitespace, bug 28950/29025)
10528 !! wikitext
10529 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
10530 PMID
10531 1234
10532 !! html/php
10533 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10534 PMID
10535 1234
10536 </p>
10537 !! html/parsoid
10538 <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>
10539 PMID
10540 1234</p>
10541 !! end
10542
10543 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
10544 # since these are ExtLinkText, not MagicLinkText
10545 !! test
10546 Magic links: use appropriate serialization for "almost" magic links.
10547 !! wikitext
10548 X[[Special:BookSources/0978739256|foo]]
10549
10550 X[//tools.ietf.org/html/rfc1234 foo]
10551 !! html/php
10552 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
10553 </p><p>X<a rel="nofollow" class="external text" href="//tools.ietf.org/html/rfc1234">foo</a>
10554 </p>
10555 !! html/parsoid
10556 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
10557 <p>X<a rel="mw:ExtLink" href="//tools.ietf.org/html/rfc1234">foo</a></p>
10558 !! end
10559
10560 !! test
10561 Magic links: All disabled (T47942)
10562 !! options
10563 wgEnableMagicLinks={"ISBN":false, "PMID":false, "RFC":false}
10564 !! wikitext
10565 ISBN 0-306-40615-2
10566 PMID 1234
10567 RFC 4321
10568 !! html/php
10569 <p>ISBN 0-306-40615-2
10570 PMID 1234
10571 RFC 4321
10572 </p>
10573 !! end
10574
10575 ###
10576 ### Templates
10577 ####
10578
10579 !! test
10580 Nonexistent template
10581 !! wikitext
10582 {{thistemplatedoesnotexist}}
10583 !! html
10584 <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>
10585 </p>
10586 !! end
10587
10588 !! test
10589 Template with invalid target containing tags
10590 !! wikitext
10591 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10592 !! html
10593 <p>{{a<b>b</b>|foo|a=b|a = b}}
10594 </p>
10595 !! end
10596
10597 !! test
10598 Template with invalid target containing unclosed tag
10599 !! wikitext
10600 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10601 !! html
10602 <p>{{a<b>|foo|a=b|a = b}}</b>
10603 </p>
10604 !! end
10605
10606 !! test
10607 Template with invalid target containing wikilink
10608 !! wikitext
10609 {{[[Main Page]]}}
10610 !! html/php
10611 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
10612 </p>
10613 !! html/parsoid
10614 <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>
10615 !! end
10616
10617 !! test
10618 Template with just whitespace in it, bug #68421
10619 !! wikitext
10620 {{echo|{{ }}}}
10621 !! html/parsoid
10622 <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>
10623 !! end
10624
10625 !! article
10626 Template:test
10627 !! text
10628 This is a test template
10629 !! endarticle
10630
10631 !! test
10632 Simple template
10633 !! wikitext
10634 {{test}}
10635 !! html
10636 <p>This is a test template
10637 </p>
10638 !! end
10639
10640 !! test
10641 Template with explicit namespace
10642 !! wikitext
10643 {{Template:test}}
10644 !! html
10645 <p>This is a test template
10646 </p>
10647 !! end
10648
10649
10650 !! article
10651 Template:paramtest
10652 !! text
10653 This is a test template with parameter {{{param}}}
10654 !! endarticle
10655
10656 !! test
10657 Template parameter
10658 !! wikitext
10659 {{paramtest|param=foo}}
10660 !! html
10661 <p>This is a test template with parameter foo
10662 </p>
10663 !! end
10664
10665 !! article
10666 Template:paramtestnum
10667 !! text
10668 [[{{{1}}}|{{{2}}}]]
10669 !! endarticle
10670
10671 !! test
10672 Template unnamed parameter
10673 !! wikitext
10674 {{paramtestnum|Main Page|the main page}}
10675 !! html
10676 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
10677 </p>
10678 !! end
10679
10680 !! article
10681 Template:templatesimple
10682 !! text
10683 (test)
10684 !! endarticle
10685
10686 !! article
10687 Template:templateredirect
10688 !! text
10689 #redirect [[Template:templatesimple]]
10690 !! endarticle
10691
10692 !! article
10693 Template:templateasargtestnum
10694 !! text
10695 {{{{{1}}}}}
10696 !! endarticle
10697
10698 !! article
10699 Template:templateasargtest
10700 !! text
10701 {{template{{{templ}}}}}
10702 !! endarticle
10703
10704 !! article
10705 Template:templateasargtest2
10706 !! text
10707 {{{{{templ}}}}}
10708 !! endarticle
10709
10710 !! test
10711 Template with template name as unnamed argument
10712 !! wikitext
10713 {{templateasargtestnum|templatesimple}}
10714 !! html
10715 <p>(test)
10716 </p>
10717 !! end
10718
10719 !! test
10720 Template with template name as argument
10721 !! wikitext
10722 {{templateasargtest|templ=simple}}
10723 !! html
10724 <p>(test)
10725 </p>
10726 !! end
10727
10728 !! test
10729 Template with template name as argument (2)
10730 !! wikitext
10731 {{templateasargtest2|templ=templatesimple}}
10732 !! html
10733 <p>(test)
10734 </p>
10735 !! end
10736
10737 !! article
10738 Template:templateasargtestdefault
10739 !! text
10740 {{{{{templ|templatesimple}}}}}
10741 !! endarticle
10742
10743 !! article
10744 Template:templa
10745 !! text
10746 '''templ'''
10747 !! endarticle
10748
10749 !! test
10750 Template with default value
10751 !! wikitext
10752 {{templateasargtestdefault}}
10753 !! html
10754 <p>(test)
10755 </p>
10756 !! end
10757
10758 !! test
10759 Template with default value (value set)
10760 !! wikitext
10761 {{templateasargtestdefault|templ=templa}}
10762 !! html
10763 <p><b>templ</b>
10764 </p>
10765 !! end
10766
10767 !! test
10768 Template redirect
10769 !! wikitext
10770 {{templateredirect}}
10771 !! html/php
10772 <p>(test)
10773 </p>
10774 !! html/parsoid
10775 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
10776 !! end
10777
10778 !! test
10779 Template with argument in separate line
10780 !! wikitext
10781 {{ templateasargtest |
10782 templ = simple }}
10783 !! html
10784 <p>(test)
10785 </p>
10786 !! end
10787
10788 !! test
10789 Template with complex template as argument
10790 !! wikitext
10791 {{paramtest|
10792 param ={{ templateasargtest |
10793 templ = simple }}}}
10794 !! html
10795 <p>This is a test template with parameter (test)
10796 </p>
10797 !! end
10798
10799 !! test
10800 Template with thumb image (with link in description)
10801 !! wikitext
10802 {{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
10803 !! html/php
10804 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>
10805
10806 !! html+tidy
10807 <p>This is a test template with parameter</p>
10808 <div class="thumb tright">
10809 <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>
10810 <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>
10811 </div>
10812 </div>
10813 !! html/parsoid
10814 <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>
10815 !! end
10816
10817 !! article
10818 Template:complextemplate
10819 !! text
10820 {{{1}}} {{paramtest|
10821 param ={{{param}}}}}
10822 !! endarticle
10823
10824 !! test
10825 Template with complex arguments
10826 !! wikitext
10827 {{complextemplate|
10828 param ={{ templateasargtest |
10829 templ = simple }}|[[Template:complextemplate|link]]}}
10830 !! html
10831 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
10832 </p>
10833 !! end
10834
10835 !! test
10836 BUG 553: link with two variables in a piped link
10837 !! wikitext
10838 {|
10839 |[[{{{1}}}|{{{2}}}]]
10840 |}
10841 !! html/php
10842 <table>
10843 <tr>
10844 <td>[[{{{1}}}|{{{2}}}]]
10845 </td></tr></table>
10846
10847 !! html/parsoid
10848 <table>
10849 <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>
10850 !! end
10851
10852 # See: T2553
10853 !! test
10854 Abort table cell attribute parsing on wikilink
10855 !! wikitext
10856 {|
10857 | testing [[one|two]] | three || four
10858 | testing one two | three || four
10859 | testing="[[one|two]]" | three || four
10860 |}
10861 !! html/php
10862 <table>
10863 <tr>
10864 <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>
10865 <td> four
10866 </td>
10867 <td> three </td>
10868 <td> four
10869 </td>
10870 <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>
10871 <td> four
10872 </td></tr></table>
10873
10874 !! html/parsoid
10875 <table>
10876 <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>
10877 <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>
10878 <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>
10879 </tbody></table>
10880 !! end
10881
10882 !! test
10883 Don't abort table cell attribute parsing if wikilink is found in template arg
10884 !! wikitext
10885 {|
10886 | Test {{#tag:ref|One two "[[three]]" four}}
10887 |}
10888 !! html/parsoid
10889 <table>
10890 <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>
10891 </tbody></table>
10892 !! end
10893
10894 !! test
10895 Magic variable as template parameter
10896 !! wikitext
10897 {{paramtest|param={{SITENAME}}}}
10898 !! html
10899 <p>This is a test template with parameter MediaWiki
10900 </p>
10901 !! end
10902
10903 !! article
10904 Template:linktest
10905 !! text
10906 [[{{{param}}}|link]]
10907 !! endarticle
10908
10909 !! test
10910 Template parameter as link source
10911 !! wikitext
10912 {{linktest|param=Main Page}}
10913 !! html
10914 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
10915 </p>
10916 !! end
10917
10918 !!article
10919 Template:paramtest2
10920 !! text
10921 including another template, {{paramtest|param={{{arg}}}}}
10922 !! endarticle
10923
10924 !! test
10925 Template passing argument to another template
10926 !! wikitext
10927 {{paramtest2|arg='hmm'}}
10928 !! html
10929 <p>including another template, This is a test template with parameter 'hmm'
10930 </p>
10931 !! end
10932
10933 !! article
10934 Template:Linktest2
10935 !! text
10936 Main Page
10937 !! endarticle
10938
10939 !! test
10940 Template as link source
10941 !! wikitext
10942 [[{{linktest2}}]]
10943
10944 [[{{linktest2}}|Main Page]]
10945
10946 [[{{linktest2}}]]Page
10947 !! html
10948 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10949 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10950 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
10951 </p>
10952 !! end
10953
10954
10955 !! article
10956 Template:loop1
10957 !! text
10958 {{loop2}}
10959 !! endarticle
10960
10961 !! article
10962 Template:loop2
10963 !! text
10964 {{loop1}}
10965 !! endarticle
10966
10967 !! test
10968 Template infinite loop
10969 !! wikitext
10970 {{loop1}}
10971 !! html
10972 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
10973 </p>
10974 !! end
10975
10976 !! test
10977 Template from main namespace
10978 !! wikitext
10979 {{:Main Page}}
10980 !! html
10981 <p>blah blah
10982 </p>
10983 !! end
10984
10985 !! article
10986 Template:table
10987 !! text
10988 {|
10989 | 1 || 2
10990 |-
10991 | 3 || 4
10992 |}
10993 !! endarticle
10994
10995 !! test
10996 BUG 529: Template with table, not included at beginning of line
10997 !! wikitext
10998 foo {{table}}
10999 !! html
11000 <p>foo
11001 </p>
11002 <table>
11003 <tr>
11004 <td> 1 </td>
11005 <td> 2
11006 </td></tr>
11007 <tr>
11008 <td> 3 </td>
11009 <td> 4
11010 </td></tr></table>
11011
11012 !! end
11013
11014 !! test
11015 BUG 523: Template shouldn't eat newline (or add an extra one before table)
11016 !! wikitext
11017 foo
11018 {{table}}
11019 !! html
11020 <p>foo
11021 </p>
11022 <table>
11023 <tr>
11024 <td> 1 </td>
11025 <td> 2
11026 </td></tr>
11027 <tr>
11028 <td> 3 </td>
11029 <td> 4
11030 </td></tr></table>
11031
11032 !! end
11033
11034 !! test
11035 BUG 41: Template parameters shown as broken links
11036 !! wikitext
11037 {{{parameter}}}
11038 !! html
11039 <p>{{{parameter}}}
11040 </p>
11041 !! end
11042
11043 !! test
11044 Template with targets containing wikilinks
11045 !! wikitext
11046 {{[[foo]]}}
11047
11048 {{[[{{echo|foo}}]]}}
11049
11050 {{{{echo|[[foo}}]]}}
11051 !! html
11052 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11053 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11054 </p><p>{{[[foo}}]]
11055 </p>
11056 !! end
11057
11058 !! article
11059 Template:''
11060 !! text
11061 bar
11062 !! endarticle
11063
11064 !! test
11065 Templates: Double quotes as template target
11066 !! wikitext
11067 foo {{''}} baz
11068 !! html/php
11069 <p>foo bar baz
11070 </p>
11071 !! html/parsoid
11072 <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
11073 </p>
11074 !! end
11075
11076 ## This test is about making sure Parsoid's data-mw is well formed in the
11077 ## face of multiple templates with intersecting and overlapping ranges. The
11078 ## wikitext itself is wretched.
11079 !! test
11080 Templates with intersecting and overlapping ranges
11081 !! wikitext
11082 {|{{echo|
11083 <p>ha</p>}}
11084 {|{{echo|
11085 <p>ho</p>}}
11086 {{echo|{{!}}hi}}
11087 |}
11088 !! html/php+tidy
11089 <p>ha</p>
11090 <p>ho</p>
11091 <table>
11092 <tr>
11093 <td></td>
11094 </tr>
11095 <tr>
11096 <td>hi</td>
11097 </tr>
11098 </table>
11099 <table>
11100 <tr>
11101 <td></td>
11102 </tr>
11103 </table>
11104 !! html/parsoid
11105 <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":""}]]}'>
11106
11107 </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
11108
11109 <tbody><tr><td>hi</td></tr>
11110 </tbody></table>
11111 !! end
11112
11113 !! article
11114 Template:MSGNW test
11115 !! text
11116 ''None'' of '''this''' should be
11117 * interpreted
11118 but rather passed unmodified
11119 {{test}}
11120 <gallery>
11121 File:Foobar.jpg
11122 </gallery>
11123 <!-- comment -->
11124 !! endarticle
11125
11126 # hmm, fix this or just deprecate msgnw and document its behavior?
11127 !! test
11128 msgnw keyword
11129 !! wikitext
11130 {{msgnw:MSGNW test}}
11131 !! html/php
11132 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
11133 &#42; interpreted
11134 &#32;but rather passed unmodified
11135 &#123;&#123;test&#125;&#125;
11136 &#60;gallery&#62;
11137 File:Foobar.jpg
11138 &#60;/gallery&#62;
11139 &#60;!-- comment --&#62;
11140 </p>
11141 !! end
11142
11143 !! test
11144 int keyword
11145 !! wikitext
11146 {{int:youhavenewmessages|lots of money|not!}}
11147 !! html
11148 <p>You have lots of money (not!).
11149 </p>
11150 !! end
11151
11152 !! test
11153 int keyword - non-existing message
11154 !! wikitext
11155 {{int:var}}
11156 !! html
11157 <p>⧼var⧽
11158 </p>
11159 !! end
11160
11161 !! article
11162 Template:Includes
11163 !! text
11164 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11165 !! endarticle
11166
11167 !! test
11168 <includeonly> and <noinclude> being included
11169 !! wikitext
11170 {{Includes}}
11171 !! html
11172 <p>Foobar
11173 </p>
11174 !! end
11175
11176 !! article
11177 Template:Includes2
11178 !! text
11179 <onlyinclude>Foo</onlyinclude>bar
11180 !! endarticle
11181
11182 !! test
11183 <onlyinclude> being included
11184 !! wikitext
11185 {{Includes2}}
11186 !! html
11187 <p>Foo
11188 </p>
11189 !! end
11190
11191
11192 !! article
11193 Template:Includes3
11194 !! text
11195 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
11196 !! endarticle
11197
11198 !! test
11199 <onlyinclude> and <includeonly> being included
11200 !! wikitext
11201 {{Includes3}}
11202 !! html
11203 <p>Foo
11204 </p>
11205 !! end
11206
11207 !! test
11208 <includeonly> and <noinclude> on a page
11209 !! wikitext
11210 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11211 !! html
11212 <p>Foozar
11213 </p>
11214 !! end
11215
11216 !! test
11217 Un-closed <noinclude>
11218 !! wikitext
11219 <noinclude>
11220 !! html
11221 !! end
11222
11223 !! test
11224 <onlyinclude> on a page
11225 !! wikitext
11226 <onlyinclude>Foo</onlyinclude>bar
11227 !! html
11228 <p>Foobar
11229 </p>
11230 !! end
11231
11232 !! test
11233 Un-closed <onlyinclude>
11234 !! wikitext
11235 <onlyinclude>
11236 !! html
11237 !! end
11238
11239 !!test
11240 Self-closed noinclude, includeonly, onlyinclude tags
11241 !! wikitext
11242 <noinclude />
11243 <includeonly />
11244 <onlyinclude />
11245 !! html
11246 <p><br />
11247 </p>
11248 !!end
11249
11250 !!test
11251 Unbalanced includeonly and noinclude tags
11252 !! wikitext
11253 {|
11254 |a</noinclude>
11255 |b</noinclude></noinclude>
11256 |c</noinclude></includeonly>
11257 |d</includeonly></includeonly>
11258 |}
11259 !! html
11260 <table>
11261 <tr>
11262 <td>a
11263 </td>
11264 <td>b
11265 </td>
11266 <td>c&lt;/includeonly&gt;
11267 </td>
11268 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
11269 </td></tr></table>
11270
11271 !!end
11272
11273 !! article
11274 Template:Includeonly section
11275 !! text
11276 <includeonly>
11277 ==Includeonly section==
11278 </includeonly>
11279 ==Section T-1==
11280 !!endarticle
11281
11282 !! test
11283 Bug 6563: Edit link generation for section shown by <includeonly>
11284 !! wikitext
11285 {{includeonly section}}
11286 !! html
11287 <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>
11288 <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>
11289
11290 !! end
11291
11292 # Uses same input as the contents of [[Template:Includeonly section]]
11293 !! test
11294 Bug 6563: Section extraction for section shown by <includeonly>
11295 !! options
11296 section=T-2
11297 !! wikitext
11298 <includeonly>
11299 ==Includeonly section==
11300 </includeonly>
11301 ==Section T-2==
11302 !! html
11303 ==Section T-2==
11304 !! end
11305
11306 !! test
11307 Bug 6563: Edit link generation for section suppressed by <includeonly>
11308 !! wikitext
11309 <includeonly>
11310 ==Includeonly section==
11311 </includeonly>
11312 ==Section 1==
11313 !! html
11314 <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>
11315
11316 !! end
11317
11318 !! test
11319 Bug 6563: Section extraction for section suppressed by <includeonly>
11320 !! options
11321 section=1
11322 !! wikitext
11323 <includeonly>
11324 ==Includeonly section==
11325 </includeonly>
11326 ==Section 1==
11327 !! html
11328 ==Section 1==
11329 !! end
11330
11331 !! test
11332 Un-closed <includeonly>
11333 !! wikitext
11334 <includeonly>
11335 !! html/php
11336 !! html/parsoid
11337 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>"}'/>
11338 !! end
11339
11340 ## We used to, but no longer wt2wt this test since the default serializer
11341 ## will normalize the include directives to serialize on their own line.
11342 ## Selser will take care of preserving formatting in scenarios where they
11343 ## intermingled with other wikitext.
11344 !! test
11345 Includes and comments at SOL
11346 !! options
11347 parsoid=wt2html,html2html
11348 !! wikitext
11349 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
11350
11351 <noinclude>
11352 some
11353 </noinclude>* stuff
11354 * here
11355
11356 <includeonly>can have stuff</includeonly>=== here ===
11357
11358 !! html/php
11359 <h2><span class="mw-headline" id="hu">hu</span></h2>
11360 <p>some
11361 </p>
11362 <ul><li> stuff</li>
11363 <li> here</li></ul>
11364 <h3><span class="mw-headline" id="here">here</span></h3>
11365
11366 !! html/parsoid
11367 <!-- 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>
11368
11369 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
11370 <p>some</p>
11371 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
11372 <li> here</li></ul>
11373
11374 <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>
11375
11376 !! end
11377
11378 # TODO: test with DOM fragment reuse!
11379 !! test
11380 Parsoid: DOM fragment reuse
11381 !! options
11382 parsoid=wt2wt,wt2html
11383 !! wikitext
11384 a{{echo|b<table></table>c}}d
11385
11386 a{{echo|b
11387 <table></table>
11388 c}}d
11389
11390 {{echo|a
11391
11392 <table></table>
11393
11394 b}}
11395 !! html
11396 <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>
11397
11398 <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">
11399 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
11400 </span><p about="#mwt2">cd</p>
11401
11402 <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">
11403
11404 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
11405
11406 </span><p about="#mwt3">b</p>
11407 !! end
11408
11409 !! test
11410 Parsoid: Merge double tds (T52603)
11411 !! options
11412 parsoid
11413 !! wikitext
11414 {|
11415 |{{echo|{{!}} foo}}
11416 |}
11417 !! html
11418 <table><tbody>
11419 <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>
11420 </tbody></table>
11421 !! end
11422
11423 !! test
11424 Parsoid: Merge double tds in nested transclusion content (T52603)
11425 !! options
11426 parsoid
11427 !! wikitext
11428 {{echo|<div>}}
11429 {|
11430 |{{echo|{{!}} foo}}
11431 |}
11432 {{echo|</div>}}
11433 !! html
11434 <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}}]}'>
11435 <table><tbody>
11436 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
11437 </tbody></table>
11438 </div>
11439 !! end
11440
11441 ###
11442 ### <includeonly> and <noinclude> in attributes
11443 ###
11444 !!test
11445 0. includeonly around the entire attribute
11446 !! wikitext
11447 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
11448 !! html
11449 <p><span id="v2">bar</span>
11450 </p>
11451 !!end
11452
11453 !!test
11454 1. includeonly in html attr key
11455 !! wikitext
11456 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
11457 !! html
11458 <p><span id="foo">bar</span>
11459 </p>
11460 !!end
11461
11462 !!test
11463 2. includeonly in html attr value
11464 !! wikitext
11465 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
11466 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
11467 !! html
11468 <p><span id="v1">bar</span>
11469 <span id="v1">bar</span>
11470 </p>
11471 !!end
11472
11473 !!test
11474 3. includeonly in part of an attr value
11475 !! wikitext
11476 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
11477 !! html
11478 <p><span style="color:red;">bar</span>
11479 </p>
11480 !!end
11481
11482 !!test
11483 4. includeonly in table attributes
11484 !! wikitext
11485 {|
11486 |- <noinclude>
11487 |-
11488 |a
11489 </noinclude>
11490 |- <includeonly>
11491 |-
11492 |b
11493 </includeonly>
11494 |}
11495 !! html
11496 <table>
11497
11498
11499 <tr>
11500 <td>a
11501 </td></tr>
11502 </table>
11503
11504 !!end
11505
11506 ###
11507 ### Token Stream Patcher tests
11508 ###
11509 ### These tests won't always pass wt2wt and other modes because
11510 ### on serialization, the table will be output on a new line.
11511 ### For now, we are blacklisting them, and using this to test selser.
11512 ###
11513
11514 !!test
11515 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
11516 !!options
11517 parsoid=wt2html,wt2wt
11518 !!wikitext
11519 {{echo|}}{| width = '100%'
11520 |foo
11521 |}
11522 !!html/parsoid
11523 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
11524 <tbody><tr><td>foo</td></tr>
11525 </tbody></table>
11526 !!end
11527
11528 ## We used to, but no longer wt2wt this test since the default serializer
11529 ## will normalize the include directives to serialize on their own line.
11530 ## Selser will take care of preserving formatting in scenarios where they
11531 ## intermingled with other wikitext.
11532 !!test
11533 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
11534 !!options
11535 parsoid=wt2html
11536 !!wikitext
11537 <includeonly>a</includeonly>{| {{{b}}}
11538 |c
11539 |}
11540 !!html/parsoid
11541 <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":""}]]}'>
11542 <tbody><tr><td>c</td></tr>
11543 </tbody></table>
11544 !!end
11545
11546 !! test
11547 Table wikitext syntax outside wiki-tables
11548 !! wikitext
11549 a
11550 |+ not a caption
11551 ! not a table heading
11552 |- not a table row
11553 | not a table cell
11554 | class="foo bar" | baz
11555 b
11556 |}
11557 |-
11558 c
11559 !! html
11560 <p>a
11561 |+ not a caption
11562 ! not a table heading
11563 |- not a table row
11564 | not a table cell
11565 | class="foo bar" | baz
11566 b
11567 |}
11568 |-
11569 c
11570 </p>
11571 !! end
11572
11573 ###
11574 ### Testing parsing of templates where a template arg
11575 ### has the same name as the template itself.
11576 ###
11577
11578 !! article
11579 Template:quote
11580 !! text
11581 {{{quote|{{{1}}}}}}
11582 !! endarticle
11583
11584 !!test
11585 Templates: Template Name/Arg clash: 1. Use of positional param
11586 !! wikitext
11587 {{quote|foo}}
11588 !! html
11589 <p>foo
11590 </p>
11591 !!end
11592
11593 !!test
11594 Templates: Template Name/Arg clash: 2. Use of named param
11595 !! wikitext
11596 {{quote|quote=foo}}
11597 !! html
11598 <p>foo
11599 </p>
11600 !!end
11601
11602 !!test
11603 Templates: Template Name/Arg clash: 3. Use of named param with empty input
11604 !! wikitext
11605 {{quote|quote}}
11606 !! html
11607 <p>quote
11608 </p>
11609 !!end
11610
11611 ###
11612 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
11613 ###
11614
11615 !!test
11616 Templates: 1. Simple use
11617 !! wikitext
11618 {{echo|Foo}}
11619 !! html
11620 <p>Foo
11621 </p>
11622 !!end
11623
11624 !!test
11625 Templates: 2. Inside a block tag
11626 !! wikitext
11627 <div>{{echo|Foo}}</div>
11628 <blockquote>{{echo|Foo}}</blockquote>
11629 !! html
11630 <div>Foo</div>
11631 <blockquote>Foo</blockquote>
11632
11633 !! html+tidy
11634 <div>Foo</div>
11635 <blockquote>
11636 <p>Foo</p>
11637 </blockquote>
11638 !!end
11639
11640 !!test
11641 Templates: P-wrapping: 1a. Templates on consecutive lines
11642 !! wikitext
11643 {{echo|Foo}}
11644 {{echo|bar}}
11645 !! html
11646 <p>Foo
11647 bar
11648 </p>
11649 !!end
11650
11651 !!test
11652 Templates: P-wrapping: 1b. Templates on consecutive lines
11653 !! wikitext
11654 Foo
11655
11656 {{echo|bar}}
11657 {{echo|baz}}
11658 !! html
11659 <p>Foo
11660 </p><p>bar
11661 baz
11662 </p>
11663 !!end
11664
11665 !!test
11666 Templates: P-wrapping: 1c. Templates on consecutive lines
11667 !! wikitext
11668 {{echo|Foo}}
11669 {{echo|bar}} <div>baz</div>
11670 !! html
11671 <p>Foo
11672 </p>
11673 bar <div>baz</div>
11674
11675 !! html+tidy
11676 <p>Foo</p>
11677 <p>bar</p>
11678 <div>baz</div>
11679 !! end
11680
11681 !!test
11682 Templates: P-wrapping: 1d. Template preceded by comment-only line
11683 !!options
11684 parsoid
11685 !! wikitext
11686 <!-- foo -->
11687 {{echo|Bar}}
11688 !! html
11689 <!-- foo -->
11690
11691 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
11692 !!end
11693
11694 !!test
11695 Templates: Inline Text: 1. Multiple template uses
11696 !! wikitext
11697 {{echo|Foo}}bar{{echo|baz}}
11698 !! html
11699 <p>Foobarbaz
11700 </p>
11701 !!end
11702
11703 !!test
11704 Templates: Inline Text: 2. Back-to-back template uses
11705 !! wikitext
11706 {{echo|Foo}}{{echo|bar}}
11707 !! html
11708 <p>Foobar
11709 </p>
11710 !!end
11711
11712 !!test
11713 Templates: Block Tags: 1. Multiple template uses
11714 !! wikitext
11715 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
11716 !! html
11717 <div>Foo</div><div>bar</div><div>baz</div>
11718
11719 !!end
11720
11721 !!test
11722 Templates: Block Tags: 2. Back-to-back template uses
11723 !! wikitext
11724 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
11725 !! html
11726 <div>Foo</div><div>bar</div>
11727
11728 !!end
11729
11730 # This is an edge case relating to paragraph wrapping.
11731 !!test
11732 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
11733 !! wikitext
11734 {{echo|a
11735 b</p>}}
11736 !! html/parsoid
11737 <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
11738 b</p>
11739 !!end
11740
11741 !!test
11742 Templates: Links: 1. Simple example
11743 !! wikitext
11744 {{echo|[[Foo|bar]]}}
11745 !! html
11746 <p><a href="/wiki/Foo" title="Foo">bar</a>
11747 </p>
11748 !!end
11749
11750 !!test
11751 Templates: Links: 2. Generation of link href
11752 !! wikitext
11753 [[{{echo|Foo}}|bar]]
11754 !! html
11755 <p><a href="/wiki/Foo" title="Foo">bar</a>
11756 </p>
11757 !!end
11758
11759 !!test
11760 Templates: Links: 3. Generation of part of a link href
11761 !! wikitext
11762 [[Fo{{echo|o}}|bar]]
11763
11764 [[Foo{{echo|bar}}]]
11765
11766 [[Foo{{echo|bar}}baz]]
11767
11768 [[Foo{{echo|bar}}|bar]]
11769
11770 [[:Foo{{echo|bar}}]]
11771
11772 [[:Foo{{echo|bar}}|bar]]
11773 !! html
11774 <p><a href="/wiki/Foo" title="Foo">bar</a>
11775 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11776 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
11777 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11778 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11779 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11780 </p>
11781 !!end
11782
11783 !!test
11784 Templates: Links: 4. Multiple templates generating link href
11785 !! wikitext
11786 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
11787 !! html
11788 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11789 </p>
11790 !!end
11791
11792 !!test
11793 Templates: Links: 5. Generation of link text
11794 !! wikitext
11795 [[Foo|{{echo|bar}}]]
11796 !! html
11797 <p><a href="/wiki/Foo" title="Foo">bar</a>
11798 </p>
11799 !!end
11800
11801 !!test
11802 Templates: Links: 5. Nested templates (only outermost template should be marked)
11803 !! wikitext
11804 {{echo|[[{{echo|Foo}}|bar]]}}
11805 !! html
11806 <p><a href="/wiki/Foo" title="Foo">bar</a>
11807 </p>
11808 !!end
11809
11810 !!test
11811 Templates: HTML Tag: 1. Generation of HTML attr. key
11812 !! wikitext
11813 <div {{echo|style}}="color:red;">foo</div>
11814 !! html
11815 <div style="color:red;">foo</div>
11816
11817 !!end
11818
11819 !!test
11820 Templates: HTML Tag: 2. Generation of HTML attr. value
11821 !! wikitext
11822 <div style={{echo|'color:red;'}}>foo</div>
11823 !! html
11824 <div style="color:red;">foo</div>
11825
11826 !!end
11827
11828 !!test
11829 Templates: HTML Tag: 3. Generation of HTML attr key and value
11830 !! wikitext
11831 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
11832 !! html
11833 <div style="color:red;">foo</div>
11834
11835 !!end
11836
11837 !!test
11838 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
11839 !! wikitext
11840 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
11841 !! html
11842 <div title="This is a long title with just one piece templated">foo</div>
11843
11844 !!end
11845
11846 !!test
11847 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
11848 !! wikitext
11849 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
11850 !! html
11851 <div title="This is a long title with just one piece templated">foo</div>
11852
11853 !!end
11854
11855 !!test
11856 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
11857 !! wikitext
11858 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
11859 !! html
11860 <div title="This is a long title with just one piece templated">foo</div>
11861
11862 !!end
11863
11864 # SSS FIXME: While it is great we added support for all this,
11865 # do we want to make this part of the spec? Maybe we want to
11866 # deprecate this kind of usage in the future?
11867 !!test
11868 Templates: HTML Tag: 7. Generation of partial attribute key string
11869 !! wikitext
11870 <div st{{echo|yle}}="color:red;">foo</div>
11871 !! html
11872 <div style="color:red;">foo</div>
11873
11874 !!end
11875
11876 !! test
11877 Templates: HTML Tag: 8. Template-generated attribute (k=v)
11878 !! wikitext
11879 <div {{echo|1=id="v1"}}>bar</div>
11880 !! html
11881 <div id="v1">bar</div>
11882
11883 !!end
11884
11885 !! test
11886 Templates: HTML Tag: 9. Multiple template-generated attributes
11887 !! wikitext
11888 <div {{echo|1=id="v1" title="foo"}}>bar</div>
11889 !! html
11890 <div id="v1" title="foo">bar</div>
11891
11892 !!end
11893
11894 !! test
11895 Templates: Support for templates generating attributes and content
11896 !! wikitext
11897 {| {{mixed_attr_content_template}}
11898 |-
11899 |bar
11900 |}
11901 !! html/php
11902 <table style="color:red;" title="T48811">
11903
11904 <tr>
11905 <td>foo
11906 </td></tr>
11907 <tr>
11908 <td>bar
11909 </td></tr></table>
11910
11911 !! html/parsoid
11912 <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|}"]}'>
11913 <tbody><tr>
11914 <td>foo</td></tr>
11915 <tr>
11916 <td>bar</td></tr>
11917 </tbody></table>
11918 !!end
11919
11920 !! test
11921 1. Entities and nowikis inside templated attributes should be handled correctly
11922 !! wikitext
11923 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
11924 !! html/php
11925 <div style="background:#f9f9f9;">foo</div>
11926
11927 !! html/parsoid
11928 <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>
11929 !! end
11930
11931 !! test
11932 2. Entities and nowikis inside templated attributes should be handled correctly
11933 !! wikitext
11934 {|
11935 |{{table_attribs_3}}
11936 |}
11937 !! html/php
11938 <table>
11939 <tr>
11940 <td style="background:#f9f9f9;">Foo
11941 </td></tr></table>
11942
11943 !! html/parsoid
11944 <table>
11945 <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>
11946 </tbody></table>
11947 !! end
11948
11949 !! test
11950 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11951 !! wikitext
11952 {{tbl-start}}
11953 |{{table_attribs_3}}
11954 {{tbl-end}}
11955 !! html/php
11956 <table>
11957 <tr>
11958 <td style="background:#f9f9f9;">Foo
11959 </td></tr></table>
11960
11961 !! html/parsoid
11962 <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}}]}'>
11963 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
11964 </tbody></table>
11965 !! end
11966
11967 # T107622
11968 !! test
11969 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11970 !! wikitext
11971 {|
11972 | {{table_attribs_6}} hi
11973 |}
11974 !! html/php
11975 <table>
11976 <tr>
11977 <td style="background: red;"> hi
11978 </td></tr></table>
11979
11980 !! html/parsoid
11981 <table>
11982 <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>
11983 </tbody></table>
11984 !! end
11985
11986 !!test
11987 Templates: HTML Tables: 1. Generating start of a HTML table
11988 !! wikitext
11989 {{echo|<table><tr><td>foo</td>}}</tr></table>
11990 !! html
11991 <table><tr><td>foo</td></tr></table>
11992
11993 !!end
11994
11995 !!test
11996 Templates: HTML Tables: 2a. Generating middle of a HTML table
11997 !! wikitext
11998 <table><tr>{{echo|<td>foo</td>}}</tr></table>
11999 !! html
12000 <table><tr><td>foo</td></tr></table>
12001
12002 !!end
12003
12004 !!test
12005 Templates: HTML Tables: 2b. Generating middle of a HTML table
12006 !! wikitext
12007 <table>{{echo|<tr><td>foo</td></tr>}}</table>
12008 !! html
12009 <table><tr><td>foo</td></tr></table>
12010
12011 !!end
12012
12013 !!test
12014 Templates: HTML Tables: 3. Generating end of a HTML table
12015 !! wikitext
12016 <table><tr>{{echo|<td>foo</td></tr></table>}}
12017 !! html
12018 <table><tr><td>foo</td></tr></table>
12019
12020 !!end
12021
12022 !!test
12023 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
12024 !! wikitext
12025 {{echo|<table>}}<tr><td>foo</td></tr></table>
12026 !! html
12027 <table><tr><td>foo</td></tr></table>
12028
12029 !!end
12030
12031 !!test
12032 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
12033 !! wikitext
12034 <table>{{echo|<tr>}}<td>foo</td></tr></table>
12035 !! html
12036 <table><tr><td>foo</td></tr></table>
12037
12038 !!end
12039
12040 !!test
12041 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
12042 !! wikitext
12043 <table><tr>{{echo|<td>}}foo</td></tr></table>
12044 !! html
12045 <table><tr><td>foo</td></tr></table>
12046
12047 !!end
12048
12049 !!test
12050 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
12051 !! wikitext
12052 <table><tr><td>foo{{echo|</td>}}</tr></table>
12053 !! html
12054 <table><tr><td>foo</td></tr></table>
12055
12056 !!end
12057
12058 !!test
12059 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
12060 !! wikitext
12061 <table><tr><td>foo</td>{{echo|</tr>}}</table>
12062 !! html
12063 <table><tr><td>foo</td></tr></table>
12064
12065 !!end
12066
12067 !!test
12068 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
12069 !! wikitext
12070 <table><tr><td>foo</td></tr>{{echo|</table>}}
12071 !! html
12072 <table><tr><td>foo</td></tr></table>
12073
12074 !!end
12075
12076 !!test
12077 Templates: HTML Tables: 5. Proper fostering of categories from inside
12078 !!options
12079 parsoid=wt2html,wt2wt
12080 !! wikitext
12081 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
12082 <!--Two categories (Bug 50330)-->
12083 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
12084 !! html
12085 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
12086 <!--Two categories (Bug 50330)-->
12087 <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>
12088 !!end
12089
12090 !!test
12091 Templates: Wiki Tables: 1a. Fostering of entire template content
12092 !! wikitext
12093 {|
12094 {{echo|a}}
12095 |}
12096 !! html
12097 <table>
12098 a
12099 <tr><td></td></tr></table>
12100
12101 !! html+tidy
12102 <p>a</p>
12103 <table>
12104 <tr>
12105 <td></td>
12106 </tr>
12107 </table>
12108 !! end
12109
12110 !!test
12111 Templates: Wiki Tables: 1b. Fostering of entire template content
12112 !! wikitext
12113 {|
12114 {{echo|<div>}}
12115 foo
12116 {{echo|</div>}}
12117 |}
12118 !! html
12119 <table>
12120 <div>
12121 <p>foo
12122 </p>
12123 </div>
12124 <tr><td></td></tr></table>
12125
12126 !! html+tidy
12127 <div>
12128 <p>foo</p>
12129 </div>
12130 <table>
12131 <tr>
12132 <td></td>
12133 </tr>
12134 </table>
12135 !! end
12136
12137 !!test
12138 Templates: Wiki Tables: 2. Fostering of partial template content
12139 !! wikitext
12140 {|
12141 {{echo|a
12142 <div>b</div>}}
12143 |}
12144 !! html
12145 <table>
12146 a
12147 <div>b</div>
12148 <tr><td></td></tr></table>
12149
12150 !! html+tidy
12151 <p>a</p>
12152 <div>b</div>
12153 <table>
12154 <tr>
12155 <td></td>
12156 </tr>
12157 </table>
12158 !! end
12159
12160 !!test
12161 Templates: Wiki Tables: 3. td-content via multiple templates
12162 !! wikitext
12163 {|
12164 {{echo|{{pipe}}a}}{{echo|b}}
12165 |}
12166 !! html
12167 <table>
12168 <tr>
12169 <td>ab
12170 </td></tr></table>
12171
12172 !!end
12173
12174 !!test
12175 Templates: Wiki Tables: 4. Templated tags, no content
12176 !! wikitext
12177 {{tbl-start}}
12178 {{tbl-end}}
12179 !! html
12180 <table>
12181 <tr><td></td></tr></table>
12182
12183 !!end
12184
12185 !!test
12186 Templates: Wiki Tables: 5. Templated tags, regular td-tags
12187 !! wikitext
12188 {{tbl-start}}
12189 |foo
12190 {{tbl-end}}
12191 !! html
12192 <table>
12193 <tr>
12194 <td>foo
12195 </td></tr></table>
12196
12197 !!end
12198
12199 !!test
12200 Templates: Wiki Tables: 6. Templated tags, templated td-tags
12201 !! wikitext
12202 {{tbl-start}}
12203 {{!}}foo
12204 {{tbl-end}}
12205 !! html
12206 <table>
12207 <tr>
12208 <td>foo
12209 </td></tr></table>
12210
12211 !!end
12212
12213 ## This test case is very specific to Parsoid's internals
12214 ## and is hence only tested for Parsoid's code. Parsoid uses
12215 ## a <meta> marker tag for <ref> tags and they are expanded
12216 ## much later. We are verifying that this <meta> tag usage
12217 ## doesn't prevent foster parenting.
12218 !!test
12219 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
12220 !!wikitext
12221 {{PartialTable}}<ref>foo</ref>
12222 |}
12223
12224 <references />
12225 !!html/parsoid
12226 <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">
12227 <tbody>
12228 </tbody></table>
12229
12230 <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>
12231 !!end
12232
12233 !! test
12234 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
12235 !! wikitext
12236 {{echo|
12237 {{{!}}
12238 {{!}}-}}
12239 <onlyinclude>
12240 |foo
12241 </onlyinclude>
12242 {{!}}}
12243 !! html/parsoid
12244 <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{{!}}}"]}'>
12245 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
12246 <tbody><tr>
12247
12248 <td>foo
12249 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
12250 </tbody></table>
12251 !! end
12252
12253 !!test
12254 Templates: Lists: Multi-line list-items via templates
12255 !! wikitext
12256 *{{echo|a {{nonexistent|
12257 unused}}}}
12258 *{{echo|b {{nonexistent|
12259 unused}}}}
12260 !! html
12261 <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>
12262 <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>
12263
12264 !!end
12265
12266 !!test
12267 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
12268 !! wikitext
12269 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
12270 !! html
12271 <p><i>ab</i>c<i>d</i>e
12272 </p>
12273 !!end
12274
12275 !!test
12276 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
12277 (PHP parser generates misnested html)
12278 !! wikitext
12279 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
12280 !! html/parsoid
12281 <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>
12282 !!end
12283
12284 !!test
12285 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
12286 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
12287 !! options
12288 parsoid=wt2html,wt2wt
12289 !! wikitext
12290 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
12291 !! html
12292 <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>
12293 <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>
12294 <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>
12295 !!end
12296
12297 !!test
12298 Templates: Ugly nesting: 4. Divs opened/closed across templates
12299 !! wikitext
12300 a<div>b{{echo|c</div>d}}e
12301 !! html
12302 a<div>bc</div>de
12303
12304 !! html+tidy
12305 <p>a</p>
12306 <div>bc</div>
12307 <p>de</p>
12308 !! end
12309
12310 !!test
12311 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
12312 (Parsoid-centric)
12313 !! options
12314 parsoid
12315 !! wikitext
12316 {|
12317 |{{echo|foo</table>}}
12318 |bar
12319 |}
12320 !! html
12321 <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|}"]}'>
12322
12323 <tbody>
12324 <tr>
12325 <td>foo</td></tr></tbody></table><span about="#mwt1">
12326 </span><span about="#mwt1">|bar</span><span about="#mwt1">
12327 |}</span>
12328 !!end
12329
12330 !!test
12331 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
12332 (Parsoid-centric)
12333 !! options
12334 parsoid
12335 !! wikitext
12336 <table>
12337 <tr>
12338 <td>
12339 <table>
12340 <tr>
12341 <td>1. {{echo|foo </table>}}</td>
12342 <td> bar </td>
12343 <td>2. {{echo|baz </table>}}</td>
12344 </tr>
12345 <tr>
12346 <td>abc</td>
12347 </tr>
12348 </table>
12349 </td>
12350 </tr>
12351 <tr>
12352 <td>xyz</td>
12353 </tr>
12354 </table>
12355 !! html
12356 <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>"]}'>
12357 <tbody><tr>
12358 <td>
12359 <table>
12360 <tbody><tr>
12361 <td>1. foo </td></tr></tbody></table></td>
12362 <td> bar </td>
12363 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
12364 </span><span about="#mwt2">
12365 </span><span about="#mwt2">
12366 </span><span about="#mwt2">abc</span><span about="#mwt2">
12367 </span><span about="#mwt2">
12368 </span><span about="#mwt2">
12369 </span><span about="#mwt2">
12370 </span><span about="#mwt2">
12371 </span><span about="#mwt2">
12372 </span><span about="#mwt2">xyz</span><span about="#mwt2">
12373 </span><span about="#mwt2">
12374 </span>
12375 !!end
12376
12377 !! test
12378 Templates: Ugly templates: 3. newline-only template parameter
12379 !! wikitext
12380 foo {{echo|
12381 }}
12382 !! html
12383 <p>foo
12384 </p>
12385 !! end
12386
12387 # This looks like a bug: a single newline triggers p/br for some reason.
12388 !! test
12389 Templates: Ugly templates: 4. newline-only template parameter inconsistency
12390 !! wikitext
12391 {{echo|
12392 }}
12393 !! html
12394 <p><br />
12395 </p>
12396 !! end
12397
12398 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
12399 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
12400 !! test
12401 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
12402 !! wikitext
12403 {{echo|<table>}}
12404 {{echo|<div>foo}}
12405 {{echo|</table>}}
12406 !! html/parsoid
12407 <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
12408 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12409 </table>
12410 !! end
12411
12412 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
12413 # that are "identical" and generate nesting cycles in the algorithm
12414 !! test
12415 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
12416 !! wikitext
12417 {{echo|<table><tr><td><table>}}
12418 {{echo|<div>}}
12419 {{echo|</div>}}
12420 !! html/parsoid
12421 <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"}'>
12422 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12423 </table></td></tr></tbody></table>
12424 !! end
12425
12426 !! test
12427 Templates: Parameters substituted at the top-level
12428 !! wikitext
12429 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
12430 !! html/php
12431 <p><i>who</i> me? <b>never!</b>
12432 </p>
12433 !! html/parsoid
12434 <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>
12435 !! end
12436
12437 !!test
12438 Parser Functions: 1. Simple example
12439 !! wikitext
12440 {{uc:foo}}
12441 !! html
12442 <p>FOO
12443 </p>
12444 !!end
12445
12446 !!test
12447 Parser Functions: 2. Nested use (only outermost should be marked up)
12448 !! wikitext
12449 {{uc:{{lc:FOO}}}}
12450 !! html
12451 <p>FOO
12452 </p>
12453 !!end
12454
12455 ###
12456 ### Pre-save transform tests
12457 ###
12458 !! test
12459 pre-save transform: subst:
12460 !! options
12461 pst
12462 !! wikitext
12463 {{subst:test}}
12464 !! html/php
12465 This is a test template
12466 !! end
12467
12468 !! test
12469 pre-save transform: normal template
12470 !! options
12471 pst
12472 !! wikitext
12473 {{test}}
12474 !! html/php
12475 {{test}}
12476 !! end
12477
12478 !! test
12479 pre-save transform: nonexistent template
12480 !! options
12481 pst
12482 !! wikitext
12483 {{thistemplatedoesnotexist}}
12484 !! html/php
12485 {{thistemplatedoesnotexist}}
12486 !! end
12487
12488 !! test
12489 pre-save transform: subst magic variables
12490 !! options
12491 pst
12492 !! wikitext
12493 {{subst:SITENAME}}
12494 !! html/php
12495 MediaWiki
12496 !! end
12497
12498 # This is bug 89, which I fixed. -- wtm
12499 !! test
12500 pre-save transform: subst: templates with parameters
12501 !! options
12502 pst
12503 !! wikitext
12504 {{subst:paramtest|param="something else"}}
12505 !! html/php
12506 This is a test template with parameter "something else"
12507 !! end
12508
12509 !! article
12510 Template:nowikitest
12511 !! text
12512 <nowiki>'''not wiki'''</nowiki>
12513 !! endarticle
12514
12515 !! test
12516 pre-save transform: nowiki in subst (bug 1188)
12517 !! options
12518 pst
12519 !! wikitext
12520 {{subst:nowikitest}}
12521 !! html/php
12522 <nowiki>'''not wiki'''</nowiki>
12523 !! end
12524
12525 !! article
12526 Template:commenttest
12527 !! text
12528 This template has <!-- a comment --> in it.
12529 !! endarticle
12530
12531 !! test
12532 pre-save transform: comment in subst (bug 1936)
12533 !! options
12534 pst
12535 !! wikitext
12536 {{subst:commenttest}}
12537 !! html/php
12538 This template has <!-- a comment --> in it.
12539 !! end
12540
12541 !! test
12542 pre-save transform: unclosed tag
12543 !! options
12544 pst
12545 !! wikitext
12546 <nowiki>'''not wiki'''
12547 !! html/php
12548 <nowiki>'''not wiki'''
12549 !! end
12550
12551 !! test
12552 pre-save transform: mixed tag case
12553 !! options
12554 pst
12555 !! wikitext
12556 <NOwiki>'''not wiki'''</noWIKI>
12557 !! html/php
12558 <NOwiki>'''not wiki'''</noWIKI>
12559 !! end
12560
12561 !! test
12562 pre-save transform: unclosed comment in <nowiki>
12563 !! options
12564 pst
12565 !! wikitext
12566 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12567 !! html/php
12568 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12569 !!end
12570
12571 # Leading @ in this template definition works around a limitation
12572 # in parsoid's parserTests which otherwise strips the <span> from the
12573 # result (confusing it for a template wrapper)
12574 !! article
12575 Template:dangerous
12576 !!text
12577 @<span onmouseover="alert('crap')">Oh no</span>
12578 !!endarticle
12579
12580 !!test
12581 (confirming safety of fix for subst bug 1936)
12582 !! wikitext
12583 {{Template:dangerous}}
12584 !! html
12585 <p>@<span>Oh no</span>
12586 </p>
12587 !! end
12588
12589 !! test
12590 pre-save transform: comment containing gallery (bug 5024)
12591 !! options
12592 pst
12593 !! wikitext
12594 <!-- <gallery>data</gallery> -->
12595 !! html/php
12596 <!-- <gallery>data</gallery> -->
12597 !!end
12598
12599 !! test
12600 pre-save transform: comment containing extension
12601 !! options
12602 pst
12603 !! wikitext
12604 <!-- <tag>data</tag> -->
12605 !! html/php
12606 <!-- <tag>data</tag> -->
12607 !!end
12608
12609 !! test
12610 pre-save transform: comment containing nowiki
12611 !! options
12612 pst
12613 !! wikitext
12614 <!-- <nowiki>data</nowiki> -->
12615 !! html/php
12616 <!-- <nowiki>data</nowiki> -->
12617 !!end
12618
12619 !! test
12620 pre-save transform: <noinclude> in subst (bug 3298)
12621 !! options
12622 pst
12623 !! wikitext
12624 {{subst:Includes}}
12625 !! html/php
12626 Foobar
12627 !! end
12628
12629 !! test
12630 pre-save transform: <onlyinclude> in subst (bug 3298)
12631 !! options
12632 pst
12633 !! wikitext
12634 {{subst:Includes2}}
12635 !! html/php
12636 Foo
12637 !! end
12638
12639 !! article
12640 Template:SubstTest
12641 !!text
12642 {{<includeonly>subst:</includeonly>Includes}}
12643 !! endarticle
12644
12645 !! article
12646 Template:SafeSubstTest
12647 !! text
12648 {{<includeonly>safesubst:</includeonly>Includes}}
12649 !! endarticle
12650
12651 !! test
12652 bug 22297: safesubst: works during PST
12653 !! options
12654 pst
12655 !! wikitext
12656 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
12657 !! html/php
12658 FoobarFoobar
12659 !! end
12660
12661 !! test
12662 bug 22297: safesubst: works during normal parse
12663 !! wikitext
12664 {{SafeSubstTest}}
12665 !! html
12666 <p>Foobar
12667 </p>
12668 !! end
12669
12670 !! test
12671 subst: does not work during normal parse
12672 !! wikitext
12673 {{SubstTest}}
12674 !! html
12675 <p>{{subst:Includes}}
12676 </p>
12677 !! end
12678
12679 !! test
12680 pre-save transform: context links ("pipe trick")
12681 !! options
12682 pst
12683 !! wikitext
12684 [[Article (context)|]]
12685 [[Bar:Article|]]
12686 [[:Bar:Article|]]
12687 [[Bar:Article (context)|]]
12688 [[:Bar:Article (context)|]]
12689 [[|Article]]
12690 [[|Article (context)]]
12691 [[Bar:X (Y) Z|]]
12692 [[:Bar:X (Y) Z|]]
12693 !! html/php
12694 [[Article (context)|Article]]
12695 [[Bar:Article|Article]]
12696 [[:Bar:Article|Article]]
12697 [[Bar:Article (context)|Article]]
12698 [[:Bar:Article (context)|Article]]
12699 [[Article]]
12700 [[Article (context)]]
12701 [[Bar:X (Y) Z|X (Y) Z]]
12702 [[:Bar:X (Y) Z|X (Y) Z]]
12703 !! end
12704
12705 !! test
12706 pre-save transform: context links ("pipe trick") with interwiki prefix
12707 !! options
12708 pst
12709 !! wikitext
12710 [[interwiki:Article|]]
12711 [[:interwiki:Article|]]
12712 [[interwiki:Bar:Article|]]
12713 [[:interwiki:Bar:Article|]]
12714 !! html/php
12715 [[interwiki:Article|Article]]
12716 [[:interwiki:Article|Article]]
12717 [[interwiki:Bar:Article|Bar:Article]]
12718 [[:interwiki:Bar:Article|Bar:Article]]
12719 !! end
12720
12721 !! test
12722 pre-save transform: context links ("pipe trick") with parens in title
12723 !! options
12724 pst title=[[Somearticle (context)]]
12725 !! wikitext
12726 [[|Article]]
12727 !! html/php
12728 [[Article (context)|Article]]
12729 !! end
12730
12731 !! test
12732 pre-save transform: context links ("pipe trick") with comma in title
12733 !! options
12734 pst title=[[Someplace, Somewhere]]
12735 !! wikitext
12736 [[|Otherplace]]
12737 [[Otherplace, Elsewhere|]]
12738 [[Otherplace, Elsewhere, Anywhere|]]
12739 !! html/php
12740 [[Otherplace, Somewhere|Otherplace]]
12741 [[Otherplace, Elsewhere|Otherplace]]
12742 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
12743 !! end
12744
12745 !! test
12746 pre-save transform: context links ("pipe trick") with parens and comma
12747 !! options
12748 pst title=[[Someplace (IGNORED), Somewhere]]
12749 !! wikitext
12750 [[|Otherplace]]
12751 [[Otherplace (place), Elsewhere|]]
12752 !! html/php
12753 [[Otherplace, Somewhere|Otherplace]]
12754 [[Otherplace (place), Elsewhere|Otherplace]]
12755 !! end
12756
12757 !! test
12758 pre-save transform: context links ("pipe trick") with comma and parens
12759 !! options
12760 pst title=[[Who, me? (context)]]
12761 !! wikitext
12762 [[|Yes, you.]]
12763 [[Me, Myself, and I (1937 song)|]]
12764 !! html/php
12765 [[Yes, you. (context)|Yes, you.]]
12766 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
12767 !! end
12768
12769 !! test
12770 pre-save transform: context links ("pipe trick") with namespace
12771 !! options
12772 pst title=[[Ns:Somearticle]]
12773 !! wikitext
12774 [[|Article]]
12775 !! html/php
12776 [[Ns:Article|Article]]
12777 !! end
12778
12779 !! test
12780 pre-save transform: context links ("pipe trick") with namespace and parens
12781 !! options
12782 pst title=[[Ns:Somearticle (context)]]
12783 !! wikitext
12784 [[|Article]]
12785 !! html/php
12786 [[Ns:Article (context)|Article]]
12787 !! end
12788
12789 !! test
12790 pre-save transform: context links ("pipe trick") with namespace and comma
12791 !! options
12792 pst title=[[Ns:Somearticle, Context, Whatever]]
12793 !! wikitext
12794 [[|Article]]
12795 !! html/php
12796 [[Ns:Article, Context, Whatever|Article]]
12797 !! end
12798
12799 !! test
12800 pre-save transform: context links ("pipe trick") with namespace, comma and parens
12801 !! options
12802 pst title=[[Ns:Somearticle, Context (context)]]
12803 !! wikitext
12804 [[|Article]]
12805 !! html/php
12806 [[Ns:Article (context)|Article]]
12807 !! end
12808
12809 !! test
12810 pre-save transform: context links ("pipe trick") with namespace, parens and comma
12811 !! options
12812 pst title=[[Ns:Somearticle (IGNORED), Context]]
12813 !! wikitext
12814 [[|Article]]
12815 !! html/php
12816 [[Ns:Article, Context|Article]]
12817 !! end
12818
12819 !! test
12820 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
12821 !! options
12822 pst
12823 !! wikitext
12824 [[Article(context)|]]
12825 [[Bar:Article(context)|]]
12826 [[:Bar:Article(context)|]]
12827 [[|Article(context)]]
12828 [[Bar:X(Y)Z|]]
12829 [[:Bar:X(Y)Z|]]
12830 !! html/php
12831 [[Article(context)|Article]]
12832 [[Bar:Article(context)|Article]]
12833 [[:Bar:Article(context)|Article]]
12834 [[Article(context)]]
12835 [[Bar:X(Y)Z|X(Y)Z]]
12836 [[:Bar:X(Y)Z|X(Y)Z]]
12837 !! end
12838
12839 !! test
12840 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
12841 !! options
12842 pst
12843 !! wikitext
12844 [[Article (context)|]]
12845 [[Bar:Article (context)|]]
12846 [[:Bar:Article (context)|]]
12847 [[|Article (context)]]
12848 [[Bar:X (Y) Z|]]
12849 [[:Bar:X (Y) Z|]]
12850 !! html/php
12851 [[Article (context)|Article]]
12852 [[Bar:Article (context)|Article]]
12853 [[:Bar:Article (context)|Article]]
12854 [[Article (context)]]
12855 [[Bar:X (Y) Z|X (Y) Z]]
12856 [[:Bar:X (Y) Z|X (Y) Z]]
12857 !! end
12858
12859 !! test
12860 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
12861 !! options
12862 pst
12863 !! wikitext
12864 [[Article(context)|]]
12865 [[Bar:Article(context)|]]
12866 [[:Bar:Article(context)|]]
12867 [[|Article(context)]]
12868 [[Bar:X(Y)Z|]]
12869 [[:Bar:X(Y)Z|]]
12870 !! html/php
12871 [[Article(context)|Article]]
12872 [[Bar:Article(context)|Article]]
12873 [[:Bar:Article(context)|Article]]
12874 [[Article(context)]]
12875 [[Bar:X(Y)Z|X(Y)Z]]
12876 [[:Bar:X(Y)Z|X(Y)Z]]
12877 !! end
12878
12879 !! test
12880 pre-save transform: context links ("pipe trick") with commas (bug 21660)
12881 !! options
12882 pst
12883 !! wikitext
12884 [[Article (context), context|]]
12885 [[Article (context),context|]]
12886 [[Bar:Article (context), context|]]
12887 [[Bar:Article (context),context|]]
12888 [[:Bar:Article (context), context|]]
12889 [[:Bar:Article (context),context|]]
12890 !! html/php
12891 [[Article (context), context|Article]]
12892 [[Article (context),context|Article]]
12893 [[Bar:Article (context), context|Article]]
12894 [[Bar:Article (context),context|Article]]
12895 [[:Bar:Article (context), context|Article]]
12896 [[:Bar:Article (context),context|Article]]
12897 !! end
12898
12899 !! test
12900 pre-save transform: trim trailing empty lines
12901 !! options
12902 pst
12903 !! wikitext
12904 Empty lines are trimmed
12905
12906
12907
12908
12909 !! html/php
12910 Empty lines are trimmed
12911 !! end
12912
12913 !! test
12914 pre-save transform: Signature expansion
12915 !! options
12916 pst
12917 !! wikitext
12918 * ~~~
12919 * <noinclude>~~~</noinclude>
12920 * <includeonly>~~~</includeonly>
12921 * <onlyinclude>~~~</onlyinclude>
12922 !! html/php
12923 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
12924 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
12925 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
12926 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
12927 !! end
12928
12929
12930 !! test
12931 pre-save transform: Signature expansion in nowiki tags (bug 93)
12932 !! options
12933 pst disabled
12934 !! wikitext
12935 Shall not expand:
12936
12937 <nowiki>~~~~</nowiki>
12938
12939 <includeonly><nowiki>~~~~</nowiki></includeonly>
12940
12941 <noinclude><nowiki>~~~~</nowiki></noinclude>
12942
12943 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12944
12945 {{subst:Foo}} shall be converted to FOO
12946
12947 As well as inside noinclude/onlyinclude
12948 <noinclude>{{subst:Foo}}</noinclude>
12949 <onlyinclude>{{subst:Foo}}</onlyinclude>
12950
12951 But not inside includeonly
12952 <includeonly>{{subst:Foo}}</includeonly>
12953 !! html/php
12954 Shall not expand:
12955
12956 <nowiki>~~~~</nowiki>
12957
12958 <includeonly><nowiki>~~~~</nowiki></includeonly>
12959
12960 <noinclude><nowiki>~~~~</nowiki></noinclude>
12961
12962 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12963
12964 FOO shall be converted to FOO
12965
12966 As well as inside noinclude/onlyinclude
12967 <noinclude>FOO</noinclude>
12968 <onlyinclude>FOO</onlyinclude>
12969
12970 But not inside includeonly
12971 <includeonly>{{subst:Foo}}</includeonly>
12972 !! end
12973
12974 !! test
12975 Parsoid: Recognize nowiki with trailing space in tags
12976 !! options
12977 parsoid=wt2html
12978 !! wikitext
12979 <nowiki ><div>[[foo]]</nowiki >
12980
12981 a<nowiki / >b
12982
12983 c<nowiki />d
12984
12985 e<nowiki/ >f
12986 !! html
12987 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12988 <p>ab</p>
12989 <p>cd</p>
12990 <p>ef</p>
12991 !! end
12992
12993 !! test
12994 Parsoid: Recognize nowiki with odd capitalization
12995 !! options
12996 parsoid=wt2html
12997 !! wikitext
12998 <noWikI ><div>[[foo]]</Nowiki >
12999 !! html
13000 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
13001 !! end
13002
13003
13004 !! test
13005 Parsoid: Escape nowiki with trailing space in tags
13006 !! options
13007 parsoid=html2wt
13008 !! html/parsoid
13009 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
13010 <p>a&lt;nowiki /&gt;b</p>
13011 <p>c&lt;nowiki/ &gt;d</p>
13012 !! wikitext
13013 &lt;nowiki &gt; foo &lt;/nowiki &gt;
13014
13015 a&lt;nowiki /&gt;b
13016
13017 c&lt;nowiki/ &gt;d
13018 !! end
13019
13020 !! test
13021 Parsoid: Escape weird noWikI capitalizations
13022 !! options
13023 parsoid=html2wt
13024 !! html/parsoid
13025 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
13026 !! wikitext
13027 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
13028 !! end
13029
13030 ###
13031 ### Message transform tests
13032 ###
13033 !! test
13034 message transform: magic variables
13035 !! options
13036 msg
13037 !! wikitext
13038 {{SITENAME}}
13039 !! html
13040 MediaWiki
13041 !! end
13042
13043 !! test
13044 message transform: should not transform wiki markup
13045 !! options
13046 msg
13047 !! wikitext
13048 ''test''
13049 !! html
13050 ''test''
13051 !! end
13052
13053 !! test
13054 message transform: <noinclude> in transcluded template (bug 4926)
13055 !! options
13056 msg
13057 !! wikitext
13058 {{Includes}}
13059 !! html
13060 Foobar
13061 !! end
13062
13063 !! test
13064 message transform: <onlyinclude> in transcluded template (bug 4926)
13065 !! options
13066 msg
13067 !! wikitext
13068 {{Includes2}}
13069 !! html
13070 Foo
13071 !! end
13072
13073 !! test
13074 {{#special:}} page name, known
13075 !! options
13076 msg
13077 !! wikitext
13078 {{#special:Recentchanges}}
13079 !! html
13080 Special:RecentChanges
13081 !! end
13082
13083 !! test
13084 {{#special:}} page name with subpage, known
13085 !! options
13086 msg
13087 !! wikitext
13088 {{#special:Recentchanges/param}}
13089 !! html
13090 Special:RecentChanges/param
13091 !! end
13092
13093 !! test
13094 {{#special:}} page name, unknown
13095 !! options
13096 msg
13097 !! wikitext
13098 {{#special:foobar nonexistent}}
13099 !! html
13100 Special:Foobar nonexistent
13101 !! end
13102
13103 !! test
13104 {{#speciale:}} page name, known
13105 !! options
13106 msg
13107 !! wikitext
13108 {{#speciale:Recentchanges}}
13109 !! html
13110 Special:RecentChanges
13111 !! end
13112
13113 !! test
13114 {{#speciale:}} page name with subpage, known
13115 !! options
13116 msg
13117 !! wikitext
13118 {{#speciale:Recentchanges/param}}
13119 !! html
13120 Special:RecentChanges/param
13121 !! end
13122
13123 !! test
13124 {{#speciale:}} page name, unknown
13125 !! options
13126 msg
13127 !! wikitext
13128 {{#speciale:foobar nonexistent}}
13129 !! html
13130 Special:Foobar_nonexistent
13131 !! end
13132
13133 ###
13134 ### Images
13135 ###
13136 ### For Parsoid-specific tests, see
13137 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
13138
13139 !! test
13140 Simple image
13141 !! options
13142 parsoid=wt2html,wt2wt,html2html
13143 !! wikitext
13144 [[Image:foobar.jpg]]
13145 !! html/php
13146 <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>
13147 </p>
13148 !! html/parsoid
13149 <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>
13150 !! end
13151
13152 !! test
13153 Simple image (using File: namespace, now canonical)
13154 !! wikitext
13155 [[File:Foobar.jpg]]
13156 !! html/php
13157 <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>
13158 </p>
13159 !! html/parsoid
13160 <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>
13161 !! end
13162
13163 !! test
13164 Right-aligned image
13165 !! wikitext
13166 [[File:Foobar.jpg|right]]
13167 !! html/php
13168 <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>
13169
13170 !! html/parsoid
13171 <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>
13172 !! end
13173
13174 !! test
13175 Image with caption
13176 !! wikitext
13177 [[File:Foobar.jpg|right|Caption text]]
13178 !! html/php
13179 <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>
13180
13181 !! html/parsoid
13182 <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>
13183 !! end
13184
13185 !! test
13186 Image with caption, bug 53312 #1
13187 !! wikitext
13188 [[File:Foobar.jpg|right|Caption page stuff]]
13189 !! html/php
13190 <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>
13191
13192 !! html/parsoid
13193 <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>
13194 !! end
13195
13196 !! test
13197 Image with caption, bug 53312 #2
13198 !! wikitext
13199 [[File:Foobar.jpg|right|Caption page=]]
13200 !! html/php
13201 <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>
13202
13203 !! html/parsoid
13204 <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>
13205 !! end
13206
13207 !! test
13208 Image with caption, bug 53312 #3
13209 !! wikitext
13210 [[File:Foobar.jpg|right|Caption page=stuff]]
13211 !! html/php
13212 <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>
13213
13214 !! html/parsoid
13215 <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>
13216 !! end
13217
13218 !! test
13219 Allow empty links in image captions (Bug 60753)
13220 !! options
13221 thumbsize=220
13222 !! wikitext
13223 [[File:Foobar.jpg|thumb|Caption [[Link1]]
13224 [[]]
13225 [[Link2]]
13226 ]]
13227 !! html/php
13228 <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>
13229
13230 !! html/parsoid
13231 <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>
13232 [[]]
13233 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
13234 </figcaption></figure>
13235 !! end
13236
13237 !! test
13238 Titles in unlinked images (T23454)
13239 !! wikitext
13240 [[File:Foobar.jpg|link=|stuff]]
13241 !! html/php
13242 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
13243 </p>
13244 !! end
13245
13246 !! test
13247 Link with empty target
13248 !! wikitext
13249 [[]]
13250 !! html
13251 <p>[[]]
13252 </p>
13253 !! end
13254
13255 !! test
13256 Image with link trail
13257 !! wikitext
13258 Linktrails should not work for images: [[File:Foobar.jpg]]s
13259 !! html/php
13260 <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
13261 </p>
13262 !! html/parsoid
13263 <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>
13264 !! end
13265
13266 !! test
13267 Image with empty attribute
13268 !! options
13269 parsoid=wt2html,wt2wt,html2html
13270 !! wikitext
13271 [[File:Foobar.jpg|right||Caption text]]
13272 !! html/php
13273 <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>
13274
13275 !! html/parsoid
13276 <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>
13277 !! end
13278
13279 !! test
13280 1. Block image with individual attributes from templates
13281 !! wikitext
13282 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
13283 !! html/php
13284 <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>
13285
13286 !! html/parsoid
13287 <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>
13288 !! end
13289
13290 !! test
13291 2. Block Image with individual attributes from templates
13292 !! wikitext
13293 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
13294 !! html/php
13295 <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>
13296
13297 !! html/parsoid
13298 <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>
13299 !! end
13300
13301 !! test
13302 3. Inline image with individual attributes from templates
13303 !! wikitext
13304 [[File:Foobar.jpg|{{echo|50px}}]]
13305 !! html/php
13306 <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>
13307 </p>
13308 !! html/parsoid
13309 <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>
13310 !! end
13311
13312 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
13313 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
13314 !! test
13315 Image with multiple attributes from the same template
13316 !! wikitext
13317 [[File:Foobar.jpg|{{image_attribs}}]]
13318 !! html/php
13319 <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>
13320
13321 !! html/parsoid
13322 <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>
13323 !! end
13324
13325 !! test
13326 Image with link tails
13327 !! options
13328 thumbsize=220
13329 !! wikitext
13330 123[[File:Foobar.jpg]]456
13331 123[[File:Foobar.jpg|right]]456
13332 123[[File:Foobar.jpg|thumb]]456
13333 !! html/php
13334 <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
13335 </p>
13336 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
13337 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
13338
13339 !! html/php+tidy
13340 <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>
13341 <p>123</p>
13342 <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>
13343 <p>456 123</p>
13344 <div class="thumb tright">
13345 <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>
13346 <div class="thumbcaption">
13347 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
13348 </div>
13349 </div>
13350 </div>
13351 <p>456</p>
13352 !! html/parsoid
13353 <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>
13354 <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>
13355 <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>
13356 !! end
13357
13358 !! test
13359 Image with multiple captions -- only last one is accepted
13360 !! wikitext
13361 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
13362 !! html/php
13363 <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>
13364
13365 !! html/parsoid
13366 <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>
13367 !! end
13368
13369 !! test
13370 Image with multiple widths -- use last
13371 !! wikitext
13372 [[File:Foobar.jpg|200px|300px|caption]]
13373 !! html/php
13374 <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>
13375 </p>
13376 !! html/parsoid
13377 <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>
13378 !! end
13379
13380 !! test
13381 Image with multiple alignments -- use first (bug 48664)
13382 !! options
13383 thumbsize=220
13384 !! wikitext
13385 [[File:Foobar.jpg|thumb|left|right|center|caption]]
13386
13387 [[File:Foobar.jpg|middle|text-top|caption]]
13388 !! html/php
13389 <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>
13390 <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>
13391 </p>
13392 !! html/parsoid
13393 <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>
13394 <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>
13395 !! end
13396
13397 !! test
13398 Image with width attribute at different positions
13399 !! wikitext
13400 [[File:Foobar.jpg|200px|right|Caption]]
13401 [[File:Foobar.jpg|right|200px|Caption]]
13402 [[File:Foobar.jpg|right|Caption|200px]]
13403 !! html/php
13404 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a></div>
13405 <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>
13406 <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>
13407
13408 !! html/parsoid
13409 <figure class="mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>Caption</figcaption></figure>
13410 <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>
13411 <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>
13412 !! end
13413
13414 # a sad bit of backward-compatibility
13415 !! test
13416 Image with size specified with pxpx (bug 13500, 51628)
13417 !! options
13418 parsoid=wt2html,wt2wt,html2html
13419 !! wikitext
13420 [[File:Foobar.jpg|20pxpx]]
13421 [[File:Foobar.jpg|200x20pxpx]]
13422 !! html/php
13423 <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>
13424 <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>
13425 </p>
13426 !! html/parsoid
13427 <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>
13428 !! end
13429
13430 !! test
13431 Image with link parameter, wiki target
13432 !! wikitext
13433 [[File:Foobar.jpg|link=Main Page]]
13434 !! html/php
13435 <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>
13436 </p>
13437 !! html/parsoid
13438 <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>
13439 !! end
13440
13441 # parsoid bug 49293 (part 1)
13442 !! test
13443 Image with link parameter, URL target
13444 !! wikitext
13445 [[File:Foobar.jpg|link=http://example.com/]]
13446 !! html/php
13447 <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>
13448 </p>
13449 !! html/parsoid
13450 <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>
13451 !! end
13452
13453 # parsoid bug 49293 (part 2)
13454 !! test
13455 Image with link parameter, protocol-less URL target
13456 !! wikitext
13457 [[File:Foobar.jpg|link=//example.com/]]
13458 !! html/php
13459 <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>
13460 </p>
13461 !! html/parsoid
13462 <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>
13463 !! end
13464
13465 !! test
13466 Escaping non-block captions (T107435)
13467 !! options
13468 parsoid={
13469 "modes": ["wt2wt"],
13470 "changes": [
13471 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
13472 ]
13473 }
13474 !! wikitext
13475 [[Image:Foobar.jpg|caption]]
13476 !! wikitext/edited
13477 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
13478 !! end
13479
13480 # wgExternalLinkTarget not supported by Parsoid
13481 !! test
13482 Image with link parameter, wgExternalLinkTarget
13483 !! wikitext
13484 [[Image:foobar.jpg|link=http://example.com/]]
13485 !! config
13486 wgExternalLinkTarget='foobar'
13487 !! html/php
13488 <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>
13489 </p>
13490 !! end
13491
13492 !! test
13493 Image with link parameter, wgNoFollowLinks set to false
13494 !! wikitext
13495 [[Image:foobar.jpg|link=http://example.com/]]
13496 !! config
13497 wgNoFollowLinks=false
13498 !! html
13499 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13500 </p>
13501 !! end
13502
13503 !! test
13504 Image with link parameter, wgNoFollowDomainExceptions
13505 !! wikitext
13506 [[Image:foobar.jpg|link=http://example.com/]]
13507 !! config
13508 wgNoFollowDomainExceptions='example.com'
13509 !! html
13510 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13511 </p>
13512 !! end
13513
13514 # wgExternalLinkTarget not supported by Parsoid
13515 !! test
13516 Image with link parameter, wgExternalLinkTarget, unnamed parameter
13517 !! wikitext
13518 [[Image:foobar.jpg|link=http://example.com/|Title]]
13519 !! config
13520 wgExternalLinkTarget='foobar'
13521 !! html/php
13522 <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>
13523 </p>
13524 !! end
13525
13526 !! test
13527 Image with empty link parameter
13528 !! wikitext
13529 [[File:Foobar.jpg|link=]]
13530 !! html/php
13531 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
13532 </p>
13533 !! html/parsoid
13534 <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>
13535 !! end
13536
13537 !! test
13538 Image with link parameter (wiki target) and unnamed parameter
13539 !! wikitext
13540 [[File:Foobar.jpg|link=Main_Page|Title]]
13541 !! html/php
13542 <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>
13543 </p>
13544 !! html/parsoid
13545 <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>
13546 !! end
13547
13548 !! test
13549 Image with link parameter (URL target) and unnamed parameter
13550 !! wikitext
13551 [[File:Foobar.jpg|link=http://example.com/|Title]]
13552 !! html/php
13553 <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>
13554 </p>
13555 !! html/parsoid
13556 <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>
13557 !! end
13558
13559 !! test
13560 Thumbnail image with link parameter
13561 !! options
13562 thumbsize=220
13563 parsoid=wt2html,wt2wt,html2html
13564 !! wikitext
13565 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
13566 !! html/php
13567 <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>
13568
13569 !! html/parsoid
13570 <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>
13571 !! end
13572
13573 !! test
13574 Manually-specified thumbnail image
13575 !! options
13576 thumbsize=220
13577 !! wikitext
13578 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
13579 !! html/php
13580 <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>
13581
13582 !! html/parsoid
13583 <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>
13584 !! end
13585
13586 !! test
13587 Manually-specified thumbnail image with explicit link to wiki page
13588 !! options
13589 thumbsize=220
13590 parsoid=wt2html,wt2wt,html2html
13591 !! wikitext
13592 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
13593 !! html/php
13594 <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>
13595
13596 !! html/parsoid
13597 <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>
13598 !! end
13599
13600 !! test
13601 Manually-specified thumbnail image with explicit link to url
13602 !! options
13603 thumbsize=220
13604 parsoid=wt2html,wt2wt,html2html
13605 !! wikitext
13606 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
13607 !! html/php
13608 <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>
13609
13610 !! html/parsoid
13611 <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>
13612 !! end
13613
13614 !! test
13615 Manually-specified thumbnail image with explicit no link
13616 !! options
13617 thumbsize=220
13618 parsoid=wt2html,wt2wt,html2html
13619 !! wikitext
13620 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
13621 !! html/php
13622 <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>
13623
13624 !! html/parsoid
13625 <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>
13626 !! end
13627
13628 !! test
13629 Manually-specified thumbnail image with explicit link and alt text
13630 !! options
13631 thumbsize=220
13632 parsoid=wt2html,wt2wt,html2html
13633 !! wikitext
13634 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
13635 !! html/php
13636 <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>
13637
13638 !! html/parsoid
13639 <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>
13640 !! end
13641
13642 !! test
13643 Image with frame and link
13644 !! options
13645 parsoid=wt2html,wt2wt,html2html
13646 !! wikitext
13647 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
13648 !! html/php
13649 <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>
13650
13651 !! html/parsoid
13652 <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>
13653 !! end
13654
13655 !! test
13656 Image with frame and link and explicit alt
13657 !! options
13658 parsoid=wt2html,wt2wt,html2html
13659 !! wikitext
13660 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
13661 !! html/php
13662 <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>
13663
13664 !! html/parsoid
13665 <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>
13666 !! end
13667
13668 !! test
13669 Image with wiki markup in implicit alt
13670 !! wikitext
13671 [[Image:Foobar.jpg|testing '''bold''' in alt]]
13672
13673 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
13674 !! html/php
13675 <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>
13676 </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>
13677 </p>
13678 !! html/parsoid
13679 <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>
13680
13681 <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>
13682 !! end
13683
13684 !! test
13685 Alt image option should handle most kinds of wikitext without barfing
13686 !! wikitext
13687 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
13688 !! html/php
13689 <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>
13690
13691 !! html/parsoid
13692 <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>
13693 !! end
13694
13695 ###################
13696 # Conflicting image format options.
13697 # First option specified should 'win'.
13698 # All three cases in each test should be identical.
13699
13700 !! test
13701 Image with 'frameless' first.
13702 !! options
13703 parsoid=wt2html,wt2wt,html2html
13704 !! wikitext
13705 [[File:Foobar.jpg|frameless|caption]]
13706
13707 [[File:Foobar.jpg|frameless|frame|caption]]
13708
13709 [[File:Foobar.jpg|frameless|thumb|caption]]
13710 !! html/php
13711 <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a>
13712 </p><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>
13713 </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>
13714 </p>
13715 !! html/parsoid
13716 <p><span class="mw-default-size" typeof="mw:Image/Frameless" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></span></p>
13717 <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>
13718 <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>
13719 !! end
13720
13721 !! test
13722 Image with 'frame' first.
13723 !! options
13724 parsoid=wt2html,wt2wt,html2html
13725 !! wikitext
13726 [[File:Foobar.jpg|frame|caption]]
13727 [[File:Foobar.jpg|frame|frameless|caption]]
13728 [[File:Foobar.jpg|frame|thumb|caption]]
13729 !! html/php
13730 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">caption</div></div></div>
13731 <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>
13732 <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>
13733
13734 !! html/parsoid
13735 <figure class="mw-default-size" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
13736 <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>
13737 <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>
13738 !! end
13739
13740 !! test
13741 Image with 'thumb' first.
13742 !! options
13743 parsoid=wt2html,wt2wt,html2html
13744 !! wikitext
13745 [[File:Foobar.jpg|thumb|caption]]
13746 [[File:Foobar.jpg|thumb|frameless|caption]]
13747 [[File:Foobar.jpg|thumb|frame|caption]]
13748 !! html/php
13749 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
13750 <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>
13751 <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>
13752
13753 !! html/parsoid
13754 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
13755 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
13756 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
13757 !! end
13758
13759 ###################
13760 # Image sizing.
13761 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
13762 # and https://phabricator.wikimedia.org/T64258
13763 # Foobar has actual size of 1941x220
13764 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
13765 # a scalable format.
13766 # 2. Framed images always ignore size options; always render at default size.
13767 # 3. "Unspecified format" and border are the only types which can be
13768 # enlarged.
13769
13770 !! test
13771 Image: "unspecified format" and border enlarge
13772 !! options
13773 parsoid=wt2html,wt2wt,html2html
13774 !! wikitext
13775 [[File:Foobar.jpg|2000px]]
13776
13777 [[File:Foobar.jpg|border|2000px]]
13778 !! html/php
13779 <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>
13780 </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>
13781 </p>
13782 !! html/parsoid
13783 <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>
13784 <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>
13785 !! end
13786
13787 !! test
13788 Image: "unspecified format" and border reduce
13789 !! options
13790 parsoid=wt2html,wt2wt,html2html
13791 !! wikitext
13792 [[File:Foobar.jpg|1000px]]
13793
13794 [[File:Foobar.jpg|border|1000px]]
13795 !! html/php
13796 <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>
13797 </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>
13798 </p>
13799 !! html/parsoid
13800 <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>
13801 <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>
13802 !! end
13803
13804 !! test
13805 Image: thumbs reduce
13806 !! options
13807 parsoid=wt2html,wt2wt,html2html
13808 !! wikitext
13809 [[File:Foobar.jpg|thumb|50px]]
13810 !! html/php
13811 <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>
13812
13813 !! html/parsoid
13814 <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>
13815 !! end
13816
13817 !! test
13818 Image: bitmap thumbs can't be enlarged past original size, but vector can.
13819 !! options
13820 parsoid=wt2html,wt2wt,html2html
13821 !! wikitext
13822 [[File:Foobar.jpg|thumb|2000px]]
13823
13824 [[File:Foobar.svg|thumb|2000px]]
13825 !! html/php
13826 <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>
13827 <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>
13828
13829 !! html/parsoid
13830 <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>
13831 <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>
13832 !! end
13833
13834 !! test
13835 Image: frameless can reduce in size
13836 !! options
13837 parsoid=wt2html,wt2wt,html2html
13838 !! wikitext
13839 [[File:Foobar.jpg|frameless|50px]]
13840 !! html/php
13841 <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>
13842 </p>
13843 !! html/parsoid
13844 <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>
13845 !! end
13846
13847 !! test
13848 Image: bitmap frameless can't be enlarged past original size, but vector can
13849 !! options
13850 parsoid=wt2html,wt2wt,html2html
13851 !! wikitext
13852 [[File:Foobar.jpg|frameless|2000px]]
13853
13854 [[File:Foobar.svg|frameless|2000px]]
13855 !! html/php
13856 <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>
13857 </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>
13858 </p>
13859 !! html/parsoid
13860 <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>
13861 <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>
13862 !! end
13863
13864 !! test
13865 Image: framed images are always unscaled.
13866 !! options
13867 parsoid=wt2html,wt2wt,html2html
13868 !! wikitext
13869 [[File:Foobar.jpg|frame]]
13870
13871 [[File:Foobar.jpg|frame|50px]]
13872
13873 [[File:Foobar.jpg|frame|50x50px]]
13874
13875 [[File:Foobar.jpg|frame|2000px]]
13876 !! html/php
13877 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption"></div></div></div>
13878 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption"></div></div></div>
13879 <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>
13880 <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>
13881
13882 !! html/parsoid
13883 <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>
13884 <figure typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
13885 <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>
13886 <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>
13887 !! end
13888
13889 ###################
13890
13891 !! test
13892 Link to image page- image page normally doesn't exists, hence edit link
13893 Add test with existing image page
13894 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
13895 !! wikitext
13896 [[:Image:test]]
13897 !! html
13898 <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>
13899 </p>
13900 !! end
13901
13902 !! test
13903 bug 18784 Link to non-existent image page with caption should use caption as link text
13904 !! wikitext
13905 [[:Image:test|caption]]
13906 !! html
13907 <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>
13908 </p>
13909 !! end
13910
13911 !! test
13912 Frameless image caption with a free URL
13913 !! wikitext
13914 [[File:Foobar.jpg|http://example.com]]
13915 !! html/php
13916 <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>
13917 </p>
13918 !! html/parsoid
13919 <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>
13920 !! end
13921
13922 !! test
13923 Thumbnail image caption with a free URL
13924 !! options
13925 thumbsize=220
13926 !! wikitext
13927 [[File:Foobar.jpg|thumb|http://example.com]]
13928 !! html/php
13929 <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>
13930
13931 !! html/parsoid
13932 <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>
13933 !! end
13934
13935 !! test
13936 Thumbnail image caption with a free URL and explicit alt
13937 !! options
13938 thumbsize=220
13939 parsoid=wt2html,wt2wt,html2html
13940 !! wikitext
13941 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
13942 !! html/php
13943 <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>
13944
13945 !! html/parsoid
13946 <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>
13947 !! end
13948
13949 !! test
13950 SVG thumbnails with no language set
13951 !! options
13952 !! wikitext
13953 [[File:Foobar.svg|thumb|caption]]
13954 !! html/php
13955 <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>
13956
13957 !! html/parsoid
13958 <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>
13959 !! end
13960
13961 !! test
13962 SVG thumbnails with language de
13963 !! options
13964 parsoid=wt2html,wt2wt,html2html
13965 !! wikitext
13966 [[File:Foobar.svg|thumb|caption|lang=de]]
13967 !! html/php
13968 <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>
13969
13970 !! html/parsoid
13971 <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>
13972 !! end
13973
13974 !! test
13975 SVG thumbnails with invalid language code
13976 !! options
13977 parsoid=wt2html,wt2wt,html2html
13978 !! wikitext
13979 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
13980 !! html/php
13981 <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>
13982
13983 !! html/parsoid
13984 <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>
13985 !! end
13986
13987 !! test
13988 BUG 1887: A ISBN with a thumbnail
13989 !! wikitext
13990 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
13991 !! html/php
13992 <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>
13993
13994 !! html/parsoid
13995 <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>
13996 !! end
13997
13998 !! test
13999 BUG 1887: A RFC with a thumbnail
14000 !! wikitext
14001 [[File:Foobar.jpg|thumb|This is RFC 12354]]
14002 !! html/php
14003 <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>
14004
14005 !! html/parsoid
14006 <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>
14007 !! end
14008
14009 !! test
14010 BUG 1887: A mailto link with a thumbnail
14011 !! wikitext
14012 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
14013 !! html/php
14014 <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>
14015
14016 !! html/parsoid
14017 <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>
14018 !! end
14019
14020 # Pending resolution to bug 368
14021 !! test
14022 BUG 648: Frameless image caption with a link
14023 !! wikitext
14024 [[File:Foobar.jpg|text with a [[link]] in it]]
14025 !! html/php
14026 <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>
14027 </p>
14028 !! html/parsoid
14029 <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>
14030 !! end
14031
14032 !! test
14033 BUG 648: Frameless image caption with a link (suffix)
14034 !! wikitext
14035 [[File:Foobar.jpg|text with a [[link]]foo in it]]
14036 !! html/php
14037 <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>
14038 </p>
14039 !! html/parsoid
14040 <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>
14041 !! end
14042
14043 !! test
14044 BUG 648: Frameless image caption with an interwiki link
14045 !! wikitext
14046 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
14047 !! html/php
14048 <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>
14049 </p>
14050 !! html/parsoid
14051 <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>
14052 !! end
14053
14054 !! test
14055 BUG 648: Frameless image caption with a piped interwiki link
14056 !! wikitext
14057 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
14058 !! html/php
14059 <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>
14060 </p>
14061 !! html/parsoid
14062 <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>
14063 !! end
14064
14065 !! test
14066 T107474: Frameless image caption with <nowiki>
14067 !! wikitext
14068 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
14069 !! html/parsoid
14070 <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>
14071 !! end
14072
14073 !! test
14074 Escape HTML special chars in image alt text
14075 !! wikitext
14076 [[File:Foobar.jpg|& < > "]]
14077 !! html/php
14078 <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>
14079 </p>
14080 !! html/parsoid
14081 <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>
14082 !! end
14083
14084 !! test
14085 Entities in file name and attributes
14086 !! wikitext
14087 [[File:7%25 solution.gif|manualthumb=7%25 solution.gif|link=7%25 solution|[[7%25 solution]]]]
14088 !! html/php
14089 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=7%25_solution.gif" class="new" title="File:7% solution.gif">7% solution</a>
14090 </p>
14091 !! html/parsoid
14092 <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>
14093 !! end
14094
14095 !! test
14096 BUG 499: Alt text should have &#1234;, not &amp;1234;
14097 !! wikitext
14098 [[File:Foobar.jpg|&#9792;]]
14099 !! html/php
14100 <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>
14101 </p>
14102 !! html/parsoid
14103 <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>
14104 !! end
14105
14106 !! test
14107 Broken image caption with link
14108 !! options
14109 parsoid=wt2html,wt2wt,html2html
14110 !! wikitext
14111 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
14112 !! html/php
14113 <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.
14114 </p>
14115 !! html/parsoid
14116 <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>
14117 !! end
14118
14119 !! test
14120 Image caption containing another image
14121 !! wikitext
14122 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
14123 !! html/php
14124 <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>
14125
14126 !! html/parsoid
14127 <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>
14128 !! end
14129
14130 !! test
14131 Image: caption containing a newline
14132 !! wikitext
14133 [[File:Foobar.jpg|This
14134 *is some text]]
14135 !! html/php
14136 <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>
14137 </p>
14138 !! html/parsoid
14139 <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>
14140 !!end
14141
14142 !!test
14143 Image: caption containing leading space
14144 (The leading space should not trigger nowiki escaping in wt2wt mode)
14145 !! wikitext
14146 [[File:Foobar.jpg|thumb| bar]]
14147 !! html/php
14148 <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>
14149
14150 !! html/parsoid
14151 <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>
14152 !!end
14153
14154 !! test
14155 Image: caption containing a table
14156 !! options
14157 parsoid=wt2html,wt2wt,html2html
14158 !! wikitext
14159 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
14160 {|
14161 ! Foo !! Bar
14162 |-
14163 | Foo1 || Bar1
14164 |}
14165 and some more text.]]
14166 !! html/php
14167 <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>
14168
14169 !! html/parsoid
14170 <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
14171 <table>
14172 <tbody>
14173 <tr><th>Foo </th><th>Bar</th></tr>
14174 <tr>
14175 <td>Foo1 </td>
14176 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
14177 !! end
14178
14179 !! test
14180 Bug 3090: External links other than http: in image captions
14181 !! wikitext
14182 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
14183 !! html/php
14184 <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>
14185
14186 !! html/parsoid
14187 <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>
14188 !! end
14189
14190 !! test
14191 Custom class
14192 !! options
14193 parsoid=wt2html,wt2wt,html2html
14194 !! wikitext
14195 [[Image:foobar.jpg|a|class=b]]
14196 !! html/php
14197 <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>
14198 </p>
14199 !! html/parsoid
14200 <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>
14201 !! end
14202
14203 !! test
14204 Localized image handling (1).
14205 !! options
14206 parsoid=wt2html,wt2wt,html2html
14207 language=es
14208 !! wikitext
14209 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
14210 !! html/php
14211 <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>
14212
14213 !! html/parsoid
14214 <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>
14215 !! end
14216
14217 !! test
14218 Localized image handling (2).
14219 !! options
14220 thumbsize=220
14221 parsoid=wt2html,wt2wt,html2html
14222 language=es
14223 !! wikitext
14224 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
14225 !! html/php
14226 <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>
14227
14228 !! html/parsoid
14229 <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>
14230 !! end
14231
14232 !! test
14233 Localized image handling (3).
14234 !! options
14235 language=fa
14236 parsoid=html2wt
14237 !! html/parsoid
14238 <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>
14239 !! wikitext
14240 [[File:Foobar.jpg|بندانگشتی]]
14241 !! end
14242
14243 !! test
14244 "border", "frameless" and "class" attributes on an image.
14245 !! options
14246 thumbsize=220
14247 parsoid=wt2html,wt2wt,html2html
14248 !! wikitext
14249 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
14250 !! html/php
14251 <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>
14252 </p>
14253 !! html/parsoid
14254 <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>
14255 !! end
14256
14257 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
14258 !! test
14259 Invalid image attributes (bug 62500)
14260 !! options
14261 thumbsize=220
14262 parsoid=wt2html,wt2wt,html2html
14263 !! wikitext
14264 [[File:Foobar.jpg|thumb|float|left|caption]]
14265
14266 [[File:Foobar.jpg|thumb|righ|caption]]
14267
14268 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
14269 !! html/php
14270 <div class="thumb tleft"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
14271 <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>
14272 <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>
14273
14274 !! html/parsoid
14275 <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
14276 <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>
14277 <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>
14278 !! end
14279
14280 !! article
14281 File:Barfoo.jpg
14282 !! text
14283 #REDIRECT [[File:Barfoo.jpg]]
14284 !! endarticle
14285
14286 # FIXME: Parsoid should run this test -- but we'd need to teach the
14287 # mockAPI about the redirected Barfoo.jpg image.
14288 !! test
14289 Redirected image
14290 !! wikitext
14291 [[Image:Barfoo.jpg]]
14292 !! html/php
14293 <p><a href="/wiki/File:Barfoo.jpg" class="mw-redirect" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
14294 </p>
14295 !! end
14296
14297 !! test
14298 Missing image with uploads disabled
14299 !! options
14300 wgEnableUploads=0
14301 !! wikitext
14302 [[File:Foobaz.jpg]]
14303 !! html/php
14304 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
14305 </p>
14306 !! html/parsoid
14307 <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>
14308 !! end
14309
14310 # Parsoid-specific testing for images
14311 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
14312 # Currently imperfect due to a flaw in the Parsoid testrunner
14313 # Work in progress
14314 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
14315 # image tests.
14316
14317 !! test
14318 Parsoid-specific image handling - simple image with size and middle alignment
14319 !! wikitext
14320 [[File:Foobar.jpg|middle|50px]]
14321 !! html/parsoid
14322 <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>
14323 !! end
14324
14325 !! test
14326 Parsoid-specific image handling - simple image with size, middle alignment,
14327 non-standard namespace alias
14328 !! options
14329 parsoid=wt2wt,wt2html,html2html
14330 !! wikitext
14331 [[Image:Foobar.jpg|middle|50px]]
14332 !! html/parsoid
14333 <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>
14334 !! end
14335
14336 !! test
14337 Parsoid-specific image handling - simple image with size and middle alignment
14338 (existing content)
14339 !! wikitext
14340 [[File:Foobar.jpg|50px|middle]]
14341 !! html/parsoid
14342 <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>
14343 !! end
14344
14345 !! test
14346 Parsoid-specific image handling - simple image with size and middle alignment
14347 and non-standard namespace name
14348 !! options
14349 parsoid=wt2html,wt2wt,html2html
14350 !! wikitext
14351 [[Image:Foobar.jpg|50px|middle]]
14352 !! html/parsoid
14353 <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>
14354 !! end
14355
14356 !! test
14357 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
14358 !! wikitext
14359 [[File:Foobar.jpg|500x10px|baseline|caption]]
14360 !! html/parsoid
14361 <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>
14362 !! end
14363
14364 !! test
14365 Parsoid-specific image handling - simple image with border and size spec
14366 !! wikitext
14367 [[File:Foobar.jpg|50px|border|caption]]
14368 !! html/parsoid
14369 <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>
14370 !! end
14371
14372 !! test
14373 Parsoid-specific image handling - thumbnail with halign, valign, and caption
14374 !! wikitext
14375 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
14376 !! html/parsoid
14377 <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>
14378 !! end
14379
14380 !! test
14381 Parsoid-specific image handling - thumbnail with halign, valign, and caption
14382 (existing content)
14383 !! wikitext
14384 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
14385 !! html/parsoid
14386 <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>
14387 !! end
14388
14389 !! test
14390 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
14391 !! wikitext
14392 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
14393 !! html/parsoid
14394 <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>
14395 !! end
14396
14397 !! test
14398 Parsoid-specific image handling - thumbnail with specific size, halign,
14399 valign, and caption (existing content)
14400 !! wikitext
14401 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
14402 !! html/parsoid
14403 <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>
14404 !! end
14405
14406 !! test
14407 Parsoid-specific image handling - framed image with specific size and caption
14408 (size is ignored)
14409 !! options
14410 parsoid=wt2html,wt2wt,html2html
14411 !! wikitext
14412 [[File:Foobar.jpg|frame|500x50px|caption]]
14413 !! html/parsoid
14414 <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>
14415 !! end
14416
14417 !! test
14418 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
14419 (size is ignored)
14420 !! options
14421 parsoid=wt2html,wt2wt,html2html
14422 !! wikitext
14423 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
14424 !! html/parsoid
14425 <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>
14426 !! end
14427
14428 !! test
14429 Parsoid-specific image handling - frameless image with specific size, border, and caption
14430 !! wikitext
14431 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
14432 !! html/parsoid
14433 <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>
14434 !! end
14435
14436 !! test
14437 Parsoid-specific image handling - simple image with a formatted caption
14438 !! wikitext
14439 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
14440 !! html/parsoid
14441 <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>
14442 !! end
14443
14444 !! test
14445 Parsoid-specific image handling - caption with a template in it
14446 !! wikitext
14447 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
14448 !! html/parsoid
14449 <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>
14450 !! end
14451
14452 !! test
14453 Parsoid-specific image handling - caption with unbalanced tags in it
14454 !! options
14455 parsoid=wt2html,wt2wt,html2html
14456 !! wikitext
14457 foo
14458 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
14459 bar
14460 !! html/parsoid
14461 <p>foo</p>
14462 <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>
14463 <p>bar</p>
14464 !! end
14465
14466 !! test
14467 Parsoid-specific image handling - empty caption (1)
14468 !! options
14469 parsoid=wt2html,wt2wt
14470 !! wikitext
14471 [[File:Foobar.jpg|thumb|]]
14472 !! html/parsoid
14473 <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>
14474 !! end
14475
14476 # empty captions don't get serialized unless we're in the "round trip" case
14477 !! test
14478 Parsoid-specific image handling - empty caption (2)
14479 !! options
14480 parsoid=html2wt
14481 !! html/parsoid
14482 <figure class="mw-default-size" typeof="mw:Image/Thumb">
14483 <a href="./File:Foobar.jpg">
14484 <img resource="./File:Foobar.jpg"
14485 src="//example.com/images/3/3a/Foobar.jpg"
14486 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
14487 height="25" width="220"/>
14488 </a>
14489 <figcaption></figcaption>
14490 </figure>
14491 !! wikitext
14492 [[File:Foobar.jpg|thumb]]
14493 !! end
14494
14495 !! test
14496 Parsoid-specific image handling - whitespace caption
14497 !! wikitext
14498 [[File:Foobar.jpg|thumb| ]]
14499 !! html/parsoid
14500 <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>
14501 !! end
14502
14503 !! test
14504 Parsoid-specific image handling - lang option
14505 !! wikitext
14506 foo
14507 [[File:Foobar.svg|lang=de|caption]]
14508 bar
14509 !! html/parsoid
14510 <p>foo
14511 <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>
14512 bar</p>
14513 !! end
14514
14515 ## Edge case bugs in Parsoid from T93580
14516 !! test
14517 T93580: 1. Templated <ref> inside block images
14518 !! wikitext
14519 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
14520
14521 <references />
14522 !! html/parsoid
14523 <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>
14524
14525 <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>
14526 !! end
14527
14528 !! test
14529 T93580: 2. <ref> inside inline images
14530 !! wikitext
14531 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
14532
14533 <references />
14534 !! html/parsoid
14535 <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>
14536
14537 <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>
14538 !! end
14539
14540 !! test
14541 T93580: 3. Templated <ref> inside inline images
14542 !! wikitext
14543 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|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: {{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>
14548
14549 <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>
14550 !! end
14551
14552 ###
14553 ### Subpages
14554 ###
14555 !! article
14556 Subpage test/subpage
14557 !! text
14558 foo
14559 !! endarticle
14560
14561 !! test
14562 Subpage link
14563 !! options
14564 subpage title=[[Subpage test]]
14565 !! wikitext
14566 [[/subpage]]
14567 !! html
14568 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
14569 </p>
14570 !! end
14571
14572 !! test
14573 Subpage noslash link
14574 !! options
14575 subpage title=[[Subpage test]]
14576 !! wikitext
14577 [[/subpage/]]
14578 !! html
14579 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
14580 </p>
14581 !! end
14582
14583 !! article
14584 Subpage test/1/2/subpage
14585 !! text
14586 blah
14587 !! endarticle
14588
14589 !! test
14590 Relative subpage noslash link
14591 !! options
14592 parsoid=wt2wt,wt2html,html2html
14593 subpage title=[[Subpage test/1/2/3/4]]
14594 !! wikitext
14595 [[../../subpage/]]
14596
14597 [[../../subpage]]
14598 !! html/php
14599 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
14600 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
14601 </p>
14602 !! html/parsoid
14603 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
14604 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
14605 !! end
14606
14607 !! test
14608 Parsoid: dot-slash prefixed wikilinks
14609 !! wikitext
14610 [[./foo]]
14611
14612 [[././bar]]
14613
14614 [[././baz/]]
14615 !! html/php
14616 <p>[[./foo]]
14617 </p><p>[[././bar]]
14618 </p><p>[[././baz/]]
14619 </p>
14620 !! html/parsoid
14621 <p>[[./foo]]
14622 </p><p>[[././bar]]
14623 </p><p>[[././baz/]]
14624 </p>
14625 !! end
14626
14627 !! test
14628 Render invalid page names as plain text (bug 51090)
14629 !! wikitext
14630 [[./../foo|bar]]
14631 [[foo�|bar]]
14632 [[foo/.|bar]]
14633 [[foo/..|bar]]
14634 [[foo~~~bar]]
14635 [[foo>bar]]
14636 [[foo[bar]]
14637 [[.]]
14638 [[..]]
14639 [[foo././bar]]
14640
14641 [[{{echo|./../foo}}|bar]]
14642 [[{{echo|foo/.}}|bar]]
14643 [[{{echo|foo/..}}|bar]]
14644 [[{{echo|foo~~~~bar}}]]
14645 [[{{echo|foo>bar}}]]
14646 [[{{echo|foo././bar}}]]
14647 [[{{echo|foo{bar}}]]
14648 [[{{echo|foo}bar}}]]
14649 [[{{echo|foo[bar}}]]
14650 [[{{echo|foo]bar}}]]
14651 [[{{echo|foo<bar}}]]
14652 !!html/php
14653 <p>[[./../foo|bar]]
14654 [[foo�|bar]]
14655 [[foo/.|bar]]
14656 [[foo/..|bar]]
14657 [[foo~~~bar]]
14658 [[foo&gt;bar]]
14659 [[foo[bar]]
14660 [[.]]
14661 [[..]]
14662 [[foo././bar]]
14663 </p><p>[[./../foo|bar]]
14664 [[foo/.|bar]]
14665 [[foo/..|bar]]
14666 [[foo~~~~bar]]
14667 [[foo&gt;bar]]
14668 [[foo././bar]]
14669 [[foo{bar]]
14670 [[foo}bar]]
14671 [[foo[bar]]
14672 [[foo]bar]]
14673 [[foo&lt;bar]]
14674 </p>
14675 !!html/parsoid
14676 <p>[[./../foo|bar]]
14677 [[foo�|bar]]
14678 [[foo/.|bar]]
14679 [[foo/..|bar]]
14680 [[foo~~~bar]]
14681 [[foo>bar]]
14682 [[foo[bar]]
14683 [[.]]
14684 [[..]]
14685 [[foo././bar]]</p>
14686
14687 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
14688 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
14689 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
14690 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
14691 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
14692 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
14693 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
14694 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
14695 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
14696 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
14697 [[<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>
14698 !!end
14699
14700 !! test
14701 Disabled subpages
14702 !! wikitext
14703 [[/subpage]]
14704 !! html
14705 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
14706 </p>
14707 !! end
14708
14709 !! test
14710 BUG 561: {{/Subpage}}
14711 !! options
14712 subpage title=[[Page]]
14713 !! wikitext
14714 {{/Subpage}}
14715 !! html
14716 <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>
14717 </p>
14718 !! end
14719
14720 ###
14721 ### Categories
14722 ###
14723 !! article
14724 Category:MediaWiki User's Guide
14725 !! text
14726 blah
14727 !! endarticle
14728
14729 !! test
14730 Link to category
14731 !! wikitext
14732 [[:Category:MediaWiki User's Guide]]
14733 !! html
14734 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
14735 </p>
14736 !! end
14737
14738 !! test
14739 Simple category
14740 !! options
14741 cat
14742 !! wikitext
14743 [[Category:MediaWiki User's Guide]]
14744 !! html/php
14745 cat=MediaWiki_User's_Guide sort=
14746 !! html/parsoid
14747 <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"}}'/>
14748 !! end
14749
14750 !! test
14751 PAGESINCATEGORY invalid title fatal (r33546 fix)
14752 !! wikitext
14753 {{PAGESINCATEGORY:<bogus>}}
14754 !! html
14755 <p>0
14756 </p>
14757 !! end
14758
14759 !! test
14760 Category with different sort key
14761 !! options
14762 cat
14763 !! wikitext
14764 [[Category:MediaWiki User's Guide|Foo]]
14765 !! html/php
14766 cat=MediaWiki_User's_Guide sort=Foo
14767 !! html/parsoid
14768 <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"}}'/>
14769 !! end
14770
14771 !! test
14772 Category with identical sort key
14773 !! options
14774 cat
14775 !! wikitext
14776 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14777 !! html/php
14778 cat=MediaWiki_User's_Guide sort=MediaWiki User's Guide
14779 !! html/parsoid
14780 <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"}}'/>
14781 !! end
14782
14783 !! test
14784 Category with empty sort key
14785 !! options
14786 cat
14787 pst
14788 !! wikitext
14789 [[Category:MediaWiki User's Guide|]]
14790 !! html/php
14791 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14792 !! end
14793
14794 !! test
14795 Category with empty sort key and parentheses
14796 !! options
14797 cat
14798 pst
14799 !! wikitext
14800 [[Category:Foo (bar)|]]
14801 !! html/php
14802 [[Category:Foo (bar)|Foo]]
14803 !! end
14804
14805 !! test
14806 Category with link tail
14807 !! options
14808 cat
14809 pst
14810 !! wikitext
14811 123[[Category:Foo]]456
14812 !! html/php
14813 123[[Category:Foo]]456
14814 !! end
14815
14816 !! test
14817 Category with template
14818 !! options
14819 cat
14820 pst
14821 !! wikitext
14822 [[Category:{{echo|Foo}}]]
14823 !! html/php
14824 [[Category:{{echo|Foo}}]]
14825 !! end
14826
14827 !! test
14828 Category with template in sort key
14829 !! options
14830 cat
14831 pst
14832 !! wikitext
14833 [[Category:Foo|{{echo|Bar}}]]
14834 !! html/php
14835 [[Category:Foo|{{echo|Bar}}]]
14836 !! end
14837
14838 !! test
14839 Category with template in sort key and title
14840 !! options
14841 cat
14842 pst
14843 !! wikitext
14844 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14845 !! html/php
14846 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14847 !! end
14848
14849 ## We used to, but no longer wt2wt this test since the default serializer
14850 ## will normalize all categories to serialize on their own line.
14851 ## This wikitext usage is going to be fairly uncommon in production and
14852 ## selser will take care of preserving formatting in those scenarios.
14853 !! test
14854 Category / paragraph interactions
14855 !! options
14856 parsoid=wt2html
14857 !! wikitext
14858 Foo [[Category:Baz]] Bar
14859
14860 Foo [[Category:Baz]]
14861 Bar
14862
14863 Foo
14864 [[Category:Baz]]
14865 Bar
14866
14867 Foo
14868 [[Category:Baz]] Bar
14869
14870 Foo
14871 [[Category:Baz]]
14872 [[Category:Baz]]
14873 [[Category:Baz]]
14874 Bar
14875
14876 [[Category:Baz]]
14877 [[Category:Baz]]
14878 [[Category:Baz]]
14879
14880 [[Category:Baz]]
14881 {{echo|[[Category:Baz]]}}
14882 [[Category:Baz]]
14883 !! html/php
14884 <p>Foo Bar
14885 </p><p>Foo
14886 Bar
14887 </p><p>Foo
14888 Bar
14889 </p><p>Foo Bar
14890 </p><p>Foo
14891 Bar
14892 </p>
14893 !! html/parsoid
14894 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14895 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14896 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14897 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14898 <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>
14899 <link rel="mw:PageProp/Category" href="Category:Baz"/>
14900 !! end
14901
14902 ## We used to, but no longer wt2wt this test since the default serializer
14903 ## will normalize all categories to serialize on their own line.
14904 ## This wikitext usage is going to be fairly uncommon in production and
14905 ## selser will take care of preserving formatting in those scenarios.
14906 ##
14907 ## The whitespace on the empty line is part of the test. Please do not delete
14908 !! test
14909 1. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14910 !! options
14911 parsoid=wt2html
14912 !! wikitext
14913 This
14914
14915 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
14916
14917 {{echo|[[Category:Foo]] and so should this!}}
14918 !! html/php
14919 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
14920 </p>
14921 !! html/parsoid
14922 <p>This
14923
14924 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
14925
14926 <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>
14927 !! end
14928
14929 ## Parsoid will not try to wt2wt this while preserving newlines because
14930 ## it suppresses excess newlines within list items -- and we don't want to
14931 ## introduce a special case just for categories, which is, in reality somewhat
14932 ## odd behavior -- categories are unlikely to be used in list items like this
14933 ## in top-level pages and are only likely to show up in template-generated
14934 ## list items where this RT-ing is a non-issue.
14935 ##
14936 ## The whitespace on the empty line is part of the test. Please do not delete
14937 !! test
14938 2. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14939 !! options
14940 parsoid=wt2html
14941 !! wikitext
14942 * This
14943
14944 [[Category:Foo]] and this should be part of the same list item
14945 * So should this
14946
14947 {{echo|[[Category:Foo]] and this should be part of the same list item}}
14948 !! html
14949 <ul><li>This and this should be part of the same list item</li>
14950 <li>So should this and this should be part of the same list item</li></ul>
14951 !! html/parsoid
14952 <ul>
14953 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
14954 <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>
14955 </ul>
14956 !! end
14957
14958 ## Newlines and categories that follow the last item of a list
14959 ## are treated differently because this (list followed by categories)
14960 ## is an extremely common pattern on wikis.
14961 !! test
14962 3. Categories and newlines: newline suppression for last list item should RT properly
14963 !! wikitext
14964 * a
14965 * b
14966
14967 [[Category:Foo]]
14968
14969 [[Category:Bar]]
14970 [[Category:Baz]]
14971 !! html/parsoid
14972 <ul><li> a</li>
14973 <li> b</li></ul>
14974
14975 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14976
14977 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14978 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14979 !! end
14980
14981 !! test
14982 4. Categories and newlines: newline suppression for last list item should RT properly
14983 !! wikitext
14984 * a
14985 **** b
14986
14987 [[Category:Foo]]
14988 !! html/parsoid
14989 <ul><li> a
14990 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
14991
14992 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14993 !! end
14994
14995 ## only wt2html for this to make sure the algo only applies to the rightmost path
14996 !! test
14997 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
14998 !! options
14999 parsoid=wt2html
15000 !! wikitext
15001 * a
15002 ** b
15003 [[Category:Foo]]
15004 * c
15005 ** d
15006 [[Category:Foo]]
15007 !! html/parsoid
15008 <ul><li> a
15009 <ul><li> b
15010 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
15011 <li> c
15012 <ul><li> d</li></ul></li></ul>
15013 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15014 !! end
15015
15016 ## We used to, but no longer wt2wt this test since the default serializer
15017 ## will normalize all categories to serialize on their own line.
15018 ## This wikitext usage is going to be fairly uncommon in production and
15019 ## selser will take care of preserving formatting in those scenarios.
15020 !! test
15021 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
15022 !! options
15023 parsoid=wt2html
15024 !! wikitext
15025 * a [[Category:Foo]]
15026 !! html/parsoid
15027 <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>
15028 !! end
15029
15030 # This test also demonstrates because of newline+category tunneling
15031 # through the list hander, template wrapping doesn't expand to the
15032 # containing list when the list item swallows the category.
15033 !! test
15034 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
15035 !! wikitext
15036 * {{echo|a
15037 [[Category:Foo]]}}
15038 !! html/parsoid
15039 <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
15040 </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>
15041 !! end
15042
15043 !! test
15044 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
15045 !! wikitext
15046 * a
15047
15048 {{echo|[[Category:Foo]]
15049 [[Category:Bar]]}}
15050 [[Category:Baz]]
15051 !! html/parsoid
15052 <ul><li> a</li></ul>
15053
15054 <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">
15055 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
15056 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
15057 !! end
15058
15059 !! test
15060 Category links with multiple namespaces
15061 !! wikitext
15062 [[Category:Project:Foo]]
15063 !! html/parsoid
15064 <link rel="mw:PageProp/Category" href="./Category:Project:Foo" />
15065 !! end
15066
15067 !! test
15068 Parsoid: Serialize link to category page with colon escape
15069 !! options
15070 parsoid
15071 !! wikitext
15072
15073 [[:Category:Foo]]
15074 [[:Category:Foo|Bar]]
15075 !! html
15076 <p>
15077 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
15078 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
15079 </p>
15080 !! end
15081
15082 # We used to, but no longer wt2wt this test since the default serializer
15083 # will normalize all categories to serialize on their own line.
15084 # This wikitext usage is going to be fairly uncommon in production and
15085 # selser will take care of preventing whitespace insertion if this
15086 # occurs in an article.
15087 #
15088 # html2html disabled for the same reason (whitespace insertion between
15089 # x and y).
15090 #
15091 # html2wt disabled because it localizes the "Category" namespace.
15092 !! test
15093 Link prefix/suffixes aren't applied to category links
15094 !! options
15095 parsoid=wt2html
15096 language=is
15097 !! wikitext
15098 x[[Category:Foo]]y
15099 !! html/php
15100 <p>xy
15101 </p>
15102 !! html/parsoid
15103 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
15104 !! end
15105
15106 !! test
15107 Parsoid: Serialize link to file page with colon escape
15108 !! options
15109 parsoid
15110 !! wikitext
15111
15112 [[:File:Foo.png]]
15113 [[:File:Foo.png|Bar]]
15114 !! html
15115 <p>
15116 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
15117 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
15118 </p>
15119 !! end
15120
15121 !! test
15122 Parsoid: Serialize a genuine category link without colon escape
15123 !! options
15124 parsoid
15125 !! wikitext
15126 [[Category:Foo]]
15127 [[Category:Foo|Bar]]
15128 !! html
15129 <link rel="mw:PageProp/Category" href="./Category:Foo">
15130 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
15131 !! end
15132
15133 !! test
15134 Normalize hrefs properly before testing for invalid link targets (bug 70894)
15135 !! options
15136 parsoid=html2wt
15137 !! html/parsoid
15138 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
15139 !! wikitext
15140 [[Category:Toxine bactérienne]]
15141 !! end
15142
15143 !! test
15144 Parsoid: Defaultsort
15145 !! wikitext
15146 {{DEFAULTSORT:Foo}}
15147 !! html/parsoid
15148 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
15149 !! end
15150
15151 !! test
15152 Parsoid: Defaultsort (template-generated)
15153 !! wikitext
15154 {{{{echo|DEFAULTSORT}}:Foo}}
15155 !! html/parsoid
15156 <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}}]}'/>
15157 !! end
15158
15159 ###
15160 ### Inter-language links
15161 ###
15162 !! test
15163 Interlanguage links
15164 !! options
15165 ill
15166 !! wikitext
15167 [[es:Alimento]]
15168 [[fr:Nourriture]]
15169 [[zh:食品]]
15170 !! html/php
15171 es:Alimento fr:Nourriture zh:食品
15172 !! html/parsoid
15173 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
15174 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
15175 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
15176 !! end
15177
15178 !! test
15179 Duplicate interlanguage links (bug 24502)
15180 !! options
15181 ill
15182 !! wikitext
15183 [[es:1]]
15184 [[es:2]]
15185 [[fr:1]]
15186 [[fr:2]]
15187 !! html/php
15188 es:1 fr:1
15189 !! html/parsoid
15190 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
15191 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
15192 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
15193 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
15194 !! end
15195
15196 ###
15197 ### Sections
15198 ###
15199 !! test
15200 Basic section headings
15201 !! wikitext
15202 == Headline 1 ==
15203 Some text
15204
15205 ==Headline 2==
15206 More
15207 ===Smaller headline===
15208 Blah blah
15209 !! html
15210 <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>
15211 <p>Some text
15212 </p>
15213 <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>
15214 <p>More
15215 </p>
15216 <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>
15217 <p>Blah blah
15218 </p>
15219 !! end
15220
15221 !! test
15222 Section headings with TOC
15223 !! wikitext
15224 == Headline 1 ==
15225 === Subheadline 1 ===
15226 ===== Skipping a level =====
15227 ====== Skipping a level ======
15228
15229 == Headline 2 ==
15230 Some text
15231 ===Another headline===
15232 !! html
15233 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15234 <ul>
15235 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
15236 <ul>
15237 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
15238 <ul>
15239 <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>
15240 <ul>
15241 <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>
15242 </ul>
15243 </li>
15244 </ul>
15245 </li>
15246 </ul>
15247 </li>
15248 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
15249 <ul>
15250 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
15251 </ul>
15252 </li>
15253 </ul>
15254 </div>
15255
15256 <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>
15257 <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>
15258 <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>
15259 <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>
15260 <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>
15261 <p>Some text
15262 </p>
15263 <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>
15264
15265 !! end
15266
15267 !! test
15268 TOC anchors don't collide
15269 !! wikitext
15270 __FORCETOC__
15271 == Headline 2 ==
15272 == Headline ==
15273 == Headline 2 ==
15274 == Headline ==
15275 !! html/php
15276 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15277 <ul>
15278 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
15279 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
15280 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
15281 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
15282 </ul>
15283 </div>
15284
15285 <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>
15286 <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>
15287 <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>
15288 <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>
15289
15290 !! end
15291
15292 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
15293 !! test
15294 Handling of sections up to level 6 and beyond
15295 !! wikitext
15296 = Level 1 Heading=
15297 == Level 2 Heading==
15298 === Level 3 Heading===
15299 ==== Level 4 Heading====
15300 ===== Level 5 Heading=====
15301 ====== Level 6 Heading======
15302 ======= Level 7 Heading=======
15303 ======== Level 8 Heading========
15304 ========= Level 9 Heading=========
15305 ========== Level 10 Heading==========
15306 !! html
15307 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15308 <ul>
15309 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
15310 <ul>
15311 <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>
15312 <ul>
15313 <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>
15314 <ul>
15315 <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>
15316 <ul>
15317 <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>
15318 <ul>
15319 <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>
15320 <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>
15321 <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>
15322 <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>
15323 <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>
15324 </ul>
15325 </li>
15326 </ul>
15327 </li>
15328 </ul>
15329 </li>
15330 </ul>
15331 </li>
15332 </ul>
15333 </li>
15334 </ul>
15335 </div>
15336
15337 <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>
15338 <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>
15339 <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>
15340 <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>
15341 <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>
15342 <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>
15343 <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>
15344 <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>
15345 <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>
15346 <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>
15347
15348 !! end
15349
15350 !! test
15351 TOC regression (T11764)
15352 !! wikitext
15353 == title 1 ==
15354 === title 1.1 ===
15355 ==== title 1.1.1 ====
15356 === title 1.2 ===
15357 == title 2 ==
15358 === title 2.1 ===
15359 !! html
15360 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15361 <ul>
15362 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15363 <ul>
15364 <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>
15365 <ul>
15366 <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>
15367 </ul>
15368 </li>
15369 <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>
15370 </ul>
15371 </li>
15372 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15373 <ul>
15374 <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>
15375 </ul>
15376 </li>
15377 </ul>
15378 </div>
15379
15380 <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>
15381 <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>
15382 <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>
15383 <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>
15384 <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>
15385 <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>
15386
15387 !! end
15388
15389 !! test
15390 TOC for heading containing <span id="..."></span> (T96153)
15391 !! wikitext
15392 __FORCETOC__
15393 ==<span id="old-anchor"></span>New title==
15394 !! html/php
15395 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15396 <ul>
15397 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
15398 </ul>
15399 </div>
15400
15401 <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>
15402
15403 !! end
15404
15405 !! test
15406 TOC with wgMaxTocLevel=3 (bug 6204)
15407 !! options
15408 wgMaxTocLevel=3
15409 !! wikitext
15410 == title 1 ==
15411 === title 1.1 ===
15412 ==== title 1.1.1 ====
15413 === title 1.2 ===
15414 == title 2 ==
15415 === title 2.1 ===
15416 !! html
15417 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15418 <ul>
15419 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15420 <ul>
15421 <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>
15422 <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>
15423 </ul>
15424 </li>
15425 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15426 <ul>
15427 <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>
15428 </ul>
15429 </li>
15430 </ul>
15431 </div>
15432
15433 <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>
15434 <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>
15435 <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>
15436 <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>
15437 <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>
15438 <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>
15439
15440 !! end
15441
15442 !! test
15443 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
15444 !! options
15445 wgMaxTocLevel=3
15446 !! wikitext
15447 ==Section 1==
15448 ===Section 1.1===
15449 ====Section 1.1.1====
15450 ====Section 1.1.1.1====
15451 ==Section 2==
15452 !! html
15453 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15454 <ul>
15455 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
15456 <ul>
15457 <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>
15458 </ul>
15459 </li>
15460 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
15461 </ul>
15462 </div>
15463
15464 <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>
15465 <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>
15466 <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>
15467 <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>
15468 <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>
15469
15470 !! end
15471
15472
15473 !! test
15474 Resolving duplicate section names
15475 !! wikitext
15476 == Foo bar ==
15477 == Foo bar ==
15478 !! html
15479 <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>
15480 <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>
15481
15482 !! end
15483
15484 !! test
15485 Resolving duplicate section names with differing case (bug 10721)
15486 !! wikitext
15487 == Foo bar ==
15488 == Foo Bar ==
15489 !! html
15490 <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>
15491 <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>
15492
15493 !! end
15494
15495 !! article
15496 Template:sections
15497 !! text
15498 ===Section 1===
15499 ==Section 2==
15500 !! endarticle
15501
15502 !! test
15503 Template with sections, __NOTOC__
15504 !! wikitext
15505 __NOTOC__
15506 ==Section 0==
15507 {{sections}}
15508 ==Section 4==
15509 !! html
15510 <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>
15511 <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>
15512 <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>
15513 <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>
15514
15515 !! end
15516
15517 !! test
15518 __NOEDITSECTION__ keyword
15519 !! wikitext
15520 __NOEDITSECTION__
15521 ==Section 1==
15522 ==Section 2==
15523 !! html
15524 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
15525 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
15526
15527 !! end
15528
15529 !! test
15530 Link inside a section heading
15531 !! wikitext
15532 ==Section with a [[Main Page|link]] in it==
15533 !! html
15534 <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>
15535
15536 !! end
15537
15538 !! test
15539 TOC regression (T14077)
15540 !! wikitext
15541 __TOC__
15542 == title 1 ==
15543 === title 1.1 ===
15544 == title 2 ==
15545 !! html
15546 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15547 <ul>
15548 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15549 <ul>
15550 <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>
15551 </ul>
15552 </li>
15553 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
15554 </ul>
15555 </div>
15556
15557 <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>
15558 <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>
15559 <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>
15560
15561 !! end
15562
15563 !! test
15564 BUG 1219 URL next to image (good)
15565 !! wikitext
15566 http://example.com [[File:Foobar.jpg]]
15567 !! html/php
15568 <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>
15569 </p>
15570 !! html/parsoid
15571 <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>
15572 !!end
15573
15574 !! test
15575 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
15576 !! wikitext
15577 ===
15578 The line above must have a trailing space!
15579 === <!--
15580 --> <!-- -->
15581 But just in case it doesn't...
15582 !! html
15583 <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>
15584 <p>The line above must have a trailing space!
15585 </p>
15586 <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>
15587 <p>But just in case it doesn't...
15588 </p>
15589 !! end
15590
15591 !! test
15592 Header with special characters (bug 25462)
15593 !! wikitext
15594 The tooltips shall not show entities to the user (ie. be double escaped)
15595
15596 == text > text ==
15597 section 1
15598
15599 == text < text ==
15600 section 2
15601
15602 == text & text ==
15603 section 3
15604
15605 == text ' text ==
15606 section 4
15607
15608 == text " text ==
15609 section 5
15610 !! html
15611 <p>The tooltips shall not show entities to the user (ie. be double escaped)
15612 </p>
15613 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15614 <ul>
15615 <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>
15616 <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>
15617 <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>
15618 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
15619 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
15620 </ul>
15621 </div>
15622
15623 <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>
15624 <p>section 1
15625 </p>
15626 <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>
15627 <p>section 2
15628 </p>
15629 <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>
15630 <p>section 3
15631 </p>
15632 <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>
15633 <p>section 4
15634 </p>
15635 <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>
15636 <p>section 5
15637 </p>
15638 !! end
15639
15640 !! test
15641 Header with space, plus and underscore as entity
15642 !! wikitext
15643 Id should not contain + for spaces
15644
15645 == Space between Text ==
15646 section 1
15647
15648 == Space-Entity&#32;between&#32;Text ==
15649 section 2
15650
15651 == Plus+between+Text ==
15652 section 3
15653
15654 == Plus-Entity&#43;between&#43;Text ==
15655 section 4
15656
15657 == Underscore_between_Text ==
15658 section 5
15659
15660 == Underscore-Entity&#95;between&#95;Text ==
15661 section 6
15662
15663 [[#Space between Text]]
15664 [[#Space-Entity&#32;between&#32;Text]]
15665 [[#Plus+between+Text]]
15666 [[#Plus-Entity&#43;between&#43;Text]]
15667 [[#Underscore_between_Text]]
15668 [[#Underscore-Entity&#95;between&#95;Text]]
15669 !! html
15670 <p>Id should not contain + for spaces
15671 </p>
15672 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15673 <ul>
15674 <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>
15675 <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>
15676 <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>
15677 <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>
15678 <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>
15679 <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>
15680 </ul>
15681 </div>
15682
15683 <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>
15684 <p>section 1
15685 </p>
15686 <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>
15687 <p>section 2
15688 </p>
15689 <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>
15690 <p>section 3
15691 </p>
15692 <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>
15693 <p>section 4
15694 </p>
15695 <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>
15696 <p>section 5
15697 </p>
15698 <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>
15699 <p>section 6
15700 </p><p><a href="#Space_between_Text">#Space between Text</a>
15701 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
15702 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
15703 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
15704 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
15705 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
15706 </p>
15707 !! end
15708
15709 !! test
15710 Headers with excess '=' characters
15711 (Are similar tests necessary beyond the 1st level?)
15712 !! wikitext
15713 =foo==
15714 ==foo=
15715 =''italic'' heading==
15716 ==''italic'' heading=
15717 !! html
15718 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15719 <ul>
15720 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
15721 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
15722 <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>
15723 <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>
15724 </ul>
15725 </div>
15726
15727 <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>
15728 <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>
15729 <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>
15730 <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>
15731
15732 !! end
15733
15734 !! test
15735 HTML headers vs TOC (bug 23393)
15736 (__NOEDITSECTION__ for clearer output, doesn't matter here)
15737 !! wikitext
15738 <h1>Header 1</h1>
15739 == Header 1.1 ==
15740 == Header 1.2 ==
15741
15742 <h1>Header 2
15743 </h1>
15744 == Header 2.1 ==
15745 == Header 2.2 ==
15746 __NOEDITSECTION__
15747 !! html
15748 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15749 <ul>
15750 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
15751 <ul>
15752 <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>
15753 <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>
15754 </ul>
15755 </li>
15756 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
15757 <ul>
15758 <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>
15759 <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>
15760 </ul>
15761 </li>
15762 </ul>
15763 </div>
15764
15765 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
15766 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
15767 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
15768 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
15769 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
15770 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
15771
15772 !! end
15773
15774 !! test
15775 Single-line or multiline-comments can follow headings
15776 !! options
15777 parsoid=wt2html,wt2wt
15778 !! wikitext
15779 ==foo==<!---->
15780 ==bar==<!--c1-->
15781 ==baz==<!--
15782 c2
15783 c3-->
15784 !! html
15785 <h2><span class="mw-headline" id="foo">foo</span></h2>
15786 <h2><span class="mw-headline" id="bar">bar</span></h2>
15787 <h2><span class="mw-headline" id="baz">baz</span></h2>
15788
15789 !! end
15790
15791 !! test
15792 BUG 1219 URL next to image (broken)
15793 !! wikitext
15794 http://example.com[[File:Foobar.jpg]]
15795 !! html/php
15796 <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>
15797 </p>
15798 !! html/parsoid
15799 <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>
15800 !!end
15801
15802 !! test
15803 Bug 1186 news: in the middle of text
15804 !! wikitext
15805 http://en.wikinews.org/wiki/Wikinews:Workplace
15806 !! html
15807 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
15808 </p>
15809 !!end
15810
15811
15812 !! test
15813 Namespaced link must have a title
15814 !! wikitext
15815 [[Project:]]
15816 !! html
15817 <p>[[Project:]]
15818 </p>
15819 !!end
15820
15821 !! test
15822 Namespaced link must have a title (bad fragment version)
15823 !! wikitext
15824 [[Project:#fragment]]
15825 !! html
15826 <p>[[Project:#fragment]]
15827 </p>
15828 !!end
15829
15830
15831 ###
15832 ### HTML tags and HTML attributes
15833 ###
15834
15835 !! test
15836 div with no attributes
15837 !! wikitext
15838 <div>HTML rocks</div>
15839 !! html
15840 <div>HTML rocks</div>
15841
15842 !! end
15843
15844 !! test
15845 div with double-quoted attribute
15846 !! wikitext
15847 <div id="rock">HTML rocks</div>
15848 !! html
15849 <div id="rock">HTML rocks</div>
15850
15851 !! end
15852
15853 !! test
15854 div with single-quoted attribute
15855 !! wikitext
15856 <div id='rock'>HTML rocks</div>
15857 !! html
15858 <div id="rock">HTML rocks</div>
15859
15860 !! end
15861
15862 !! test
15863 div with unquoted attribute
15864 !! wikitext
15865 <div id=rock>HTML rocks</div>
15866 !! html
15867 <div id="rock">HTML rocks</div>
15868
15869 !! end
15870
15871 !! test
15872 div with illegal double attributes
15873 !! wikitext
15874 <div id="a" id="b">HTML rocks</div>
15875 !! html
15876 <div id="b">HTML rocks</div>
15877
15878 !!end
15879
15880 !! test
15881 div with empty attribute value, space before equals
15882 !! options
15883 parsoid=wt2html,html2html
15884 !! wikitext
15885 <div class =>HTML rocks</div>
15886 !! html/php
15887 <div class="">HTML rocks</div>
15888
15889 !! html/parsoid
15890 <div class="" data-parsoid='{"stx":"html"}'>HTML rocks</div>
15891 !! end
15892
15893 !! test
15894 div with multiple empty attribute values
15895 !! options
15896 parsoid=wt2html,html2html
15897 !! wikitext
15898 <div id= title=>HTML rocks</div>
15899 !! html/php
15900 <div id="title.3D">HTML rocks</div>
15901
15902 !! html/parsoid
15903 <div id="title=" data-parsoid='{"stx":"html"}'>HTML rocks</div>
15904 !! end
15905
15906 !! test
15907 table with multiple empty attribute values
15908 !! options
15909 parsoid=wt2html,html2html
15910 !! wikitext
15911 {| title= id=
15912 | hi
15913 |}
15914 !! html/php
15915 <table title="id=">
15916 <tr>
15917 <td> hi
15918 </td></tr></table>
15919
15920 !! html/parsoid
15921 <table title="id=">
15922 <tbody><tr><td> hi</td></tr>
15923 </tbody></table>
15924 !! end
15925
15926 !! test
15927 div with braces in attribute value
15928 !! wikitext
15929 <div title="{}">Foo</div>
15930 !! html/php
15931 <div title="&#123;}">Foo</div>
15932
15933 !! html/parsoid
15934 <div title="{}">Foo</div>
15935 !! end
15936
15937 !! test
15938 div with empty attribute value, no space before equals
15939 !! options
15940 parsoid=wt2html,html2html
15941 !! wikitext
15942 <div class=>HTML rocks</div>
15943 !! html/php
15944 <div class="">HTML rocks</div>
15945
15946 !! html/parsoid
15947 <div class="">HTML rocks</div>
15948 !! end
15949
15950 !! test
15951 HTML multiple attributes correction
15952 !! wikitext
15953 <p class="error" class="awesome">Awesome!</p>
15954 !! html
15955 <p class="awesome">Awesome!</p>
15956
15957 !!end
15958
15959 !! test
15960 Table multiple attributes correction
15961 !! wikitext
15962 {|
15963 !+ class="error" class="awesome"| status
15964 |}
15965 !! html
15966 <table>
15967 <tr>
15968 <th class="awesome"> status
15969 </th></tr></table>
15970
15971 !!end
15972
15973 !! test
15974 DIV IN UPPERCASE
15975 !! wikitext
15976 <DIV ID="x">HTML ROCKS</DIV>
15977 !! html
15978 <div id="x">HTML ROCKS</div>
15979
15980 !!end
15981
15982 !! test
15983 Non-ASCII pseudo-tags are rendered as text
15984 !! wikitext
15985 <khyô>
15986 !! html
15987 <p>&lt;khyô&gt;
15988 </p>
15989 !! end
15990
15991 !! test
15992 Pseudo-tag with URL 'name' renders as url link
15993 !! wikitext
15994 <http://example.com/>
15995 !! html
15996 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
15997 </p>
15998 !! end
15999
16000 !! test
16001 text with amp in the middle of nowhere
16002 !! wikitext
16003 Remember AT&T?
16004 !! html
16005 <p>Remember AT&amp;T?
16006 </p>
16007 !! end
16008
16009 !! test
16010 text with character entity: eacute
16011 !! wikitext
16012 I always thought &eacute; was a cute letter.
16013 !! html
16014 <p>I always thought &#233; was a cute letter.
16015 </p>
16016 !! html+tidy
16017 <p>I always thought é was a cute letter.</p>
16018 !! end
16019
16020 !! test
16021 text with entity-escaped character entity-like string: eacute
16022 !! wikitext
16023 I always thought &amp;eacute; was a cute letter.
16024 !! html
16025 <p>I always thought &amp;eacute; was a cute letter.
16026 </p>
16027 !! end
16028
16029 !! test
16030 text with undefined character entity: xacute
16031 !! wikitext
16032 I always thought &xacute; was a cute letter.
16033 !! html
16034 <p>I always thought &amp;xacute; was a cute letter.
16035 </p>
16036 !! end
16037
16038 !! test
16039 HTML5 tags
16040 !! wikitext
16041 <data value="5">five</data>
16042 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
16043 <mark>This highlighted text</mark>
16044 !! html
16045 <p><data value="5">five</data>
16046 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
16047 <mark>This highlighted text</mark>
16048 </p>
16049 !! end
16050
16051 !! test
16052 HTML tag with leading space is parsed as text
16053 !! wikitext
16054 < div>foo< /div>
16055 !! html
16056 <p>&lt; div&gt;foo&lt; /div&gt;
16057 </p>
16058 !! end
16059
16060 ###
16061 ### Nesting tests (see bug 41545, 50604, 51081)
16062 ###
16063
16064 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
16065 # Note that html2wt is considerably more difficult if we use <b> in
16066 # the test case, instead of <big>
16067 !! test
16068 Ensure that HTML adoption agency algorithm is properly implemented.
16069 !! wikitext
16070 <big>X<big>Y</big>Z</big>
16071 !! html
16072 <p><big>X<big>Y</big>Z</big>
16073 </p>
16074 !! end
16075
16076 # This was bug 41545 in the PHP parser.
16077 # Note that tidy doesn't handle this correctly.
16078 !! test
16079 Nesting of <kbd>
16080 !! wikitext
16081 <kbd>X<kbd>Y</kbd>Z</kbd>
16082 !! html
16083 <p><kbd>X<kbd>Y</kbd>Z</kbd>
16084 </p>
16085 !! end
16086
16087 # The following cases were bug 51081 in the PHP parser.
16088 # Note that there are some other nestable tags (b, i, etc) which are
16089 # not covered; see bug 51081 for discussion.
16090
16091 # Note that tidy doesn't handle this correctly.
16092 !! test
16093 Nesting of <em>
16094 !! wikitext
16095 <em>X<em>Y</em>Z</em>
16096 !! html
16097 <p><em>X<em>Y</em>Z</em>
16098 </p>
16099 !! end
16100
16101 # Note that tidy doesn't handle this correctly.
16102 !! test
16103 Nesting of <strong>
16104 !! wikitext
16105 <strong>X<strong>Y</strong>Z</strong>
16106 !! html
16107 <p><strong>X<strong>Y</strong>Z</strong>
16108 </p>
16109 !! end
16110
16111 !! test
16112 Nesting of <q>
16113 !! wikitext
16114 <q>X<q>Y</q>Z</q>
16115 !! html+tidy
16116 <p><q>X<q>Y</q>Z</q></p>
16117 !! end
16118
16119 # Note that tidy doesn't handle this correctly.
16120 !! test
16121 Nesting of <ruby>
16122 !! wikitext
16123 <ruby>X<ruby>Y</ruby>Z</ruby>
16124 !! html
16125 <p><ruby>X<ruby>Y</ruby>Z</ruby>
16126 </p>
16127 !! end
16128
16129 # Note that tidy doesn't handle this correctly.
16130 !! test
16131 Nesting of <bdo>
16132 !! wikitext
16133 <bdo>X<bdo>Y</bdo>Z</bdo>
16134 !! html
16135 <p><bdo>X<bdo>Y</bdo>Z</bdo>
16136 </p>
16137 !! end
16138
16139
16140 ###
16141 ### Media links
16142 ###
16143
16144 !! test
16145 Media link
16146 !! wikitext
16147 [[Media:Foobar.jpg]]
16148 !! html
16149 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
16150 </p>
16151 !! end
16152
16153 !! test
16154 Media link with text
16155 !! wikitext
16156 [[Media:Foobar.jpg|A neat file to look at]]
16157 !! html
16158 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
16159 </p>
16160 !! end
16161
16162 # FIXME: this is still bad HTML tag nesting
16163 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
16164 !! test
16165 Media link with nasty text
16166 !! wikitext
16167 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
16168 !! html
16169 <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>
16170
16171 !! html+tidy
16172 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
16173 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
16174 !! end
16175
16176 !! test
16177 Media link to nonexistent file (bug 1702)
16178 !! wikitext
16179 [[Media:No such.jpg]]
16180 !! html
16181 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
16182 </p>
16183 !! end
16184
16185 !! test
16186 Image link to nonexistent file (bug 1850 - good)
16187 !! wikitext
16188 [[File:No_such.jpg]]
16189 !! html/php
16190 <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>
16191 </p>
16192 !! html/parsoid
16193 <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>
16194 !! end
16195
16196 !! test
16197 :Image link to nonexistent file (bug 1850 - bad)
16198 !! wikitext
16199 [[:Image:No such.jpg]]
16200 !! html/php
16201 <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>
16202 </p>
16203 !! html/parsoid
16204 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
16205 !! end
16206
16207
16208
16209 !! test
16210 Character reference normalization in link text (bug 1938)
16211 !! wikitext
16212 [[Main Page|this&that]]
16213 !! html
16214 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
16215 </p>
16216 !!end
16217
16218 !! article
16219 אַ
16220 !! text
16221 Test for unicode normalization
16222
16223 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
16224 !! endarticle
16225
16226 !! test
16227 (bug 19451) Links should refer to the normalized form.
16228 !! wikitext
16229 [[&#xFB2E;]]
16230 [[&#x5d0;&#x5b7;]]
16231 [[&#x5d0;ַ]]
16232 [[א&#x5b7;]]
16233 [[אַ]]
16234 !! html
16235 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
16236 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
16237 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
16238 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
16239 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
16240 </p>
16241 !! end
16242
16243 !! test
16244 Empty attribute crash test (bug 2067)
16245 !! wikitext
16246 <font color="">foo</font>
16247 !! html
16248 <p><font color="">foo</font>
16249 </p>
16250 !! end
16251
16252 !! test
16253 Empty attribute crash test single-quotes (bug 2067)
16254 !! wikitext
16255 <font color=''>foo</font>
16256 !! html
16257 <p><font color="">foo</font>
16258 </p>
16259 !! end
16260
16261 !! test
16262 Attribute test: equals, then nothing
16263 !! options
16264 parsoid=wt2html,html2html
16265 !! wikitext
16266 <font color=>foo</font>
16267 !! html/php
16268 <p><font color="">foo</font>
16269 </p>
16270 !! html/parsoid
16271 <p><font color="" data-parsoid='{"stx":"html"}'>foo</font></p>
16272 !! end
16273
16274 !! test
16275 Attribute test: unquoted value
16276 !! options
16277 parsoid=wt2html,html2html
16278 !! wikitext
16279 <font color=x>foo</font>
16280 !! html/php
16281 <p><font color="x">foo</font>
16282 </p>
16283 !! html/parsoid
16284 <p><font color="x" data-parsoid='{"stx":"html"}'>foo</font></p>
16285 !! end
16286
16287 !! test
16288 Attribute test: unquoted but illegal value (hash)
16289 !! wikitext
16290 <font color=#x>foo</font>
16291 !! html
16292 <p><font color="#x">foo</font>
16293 </p>
16294 !! end
16295
16296 # Parsoid does not serialize to empty attribute syntax,
16297 # so wt2wt and html2wt cases are skipped
16298 !! test
16299 Attribute test: no value (T54330)
16300 !! options
16301 parsoid=wt2html,html2html
16302 !! wikitext
16303 <font color>foo</font>
16304 !! html/php
16305 <p><font color="">foo</font>
16306 </p>
16307 !! html/parsoid
16308 <p><font color="">foo</font></p>
16309 !! end
16310
16311 !! test
16312 Bug 2095: link with three closing brackets
16313 !! wikitext
16314 [[Main Page]]]
16315 !! html/php
16316 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
16317 </p>
16318 !! html/parsoid
16319 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
16320 !! end
16321
16322 !! test
16323 Bug 2095: link with pipe and three closing brackets
16324 !! wikitext
16325 [[Main Page|link]]]
16326 !! html/php
16327 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
16328 </p>
16329 !! html/parsoid
16330 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
16331 !! end
16332
16333 !! test
16334 Bug 2095: link with pipe and three closing brackets, version 2
16335 !! wikitext
16336 [[Main Page|[http://example.com/]]]
16337 !! html/php
16338 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
16339 </p>
16340 !! html/parsoid
16341 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
16342 !! end
16343
16344
16345 ###
16346 ### Safety
16347 ###
16348
16349 !! article
16350 Template:Dangerous attribute
16351 !! text
16352 " onmouseover="alert(document.cookie)
16353 !! endarticle
16354
16355 !! article
16356 Template:Dangerous style attribute
16357 !! text
16358 border-size: expression(alert(document.cookie))
16359 !! endarticle
16360
16361 !! article
16362 Template:Div style
16363 !! text
16364 <div style="float: right; {{{1}}}">Magic div</div>
16365 !! endarticle
16366
16367 !! test
16368 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
16369 !! wikitext
16370 <div title="{{test}}"></div>
16371 !! html
16372 <div title="This is a test template"></div>
16373
16374 !! end
16375
16376 # Parsoid has enough context to handle this case
16377 !! test
16378 Bug 2304: HTML attribute safety (dangerous template; 2309)
16379 !! wikitext
16380 <div title="{{dangerous attribute}}"></div>
16381 !! html/php
16382 <div title=""></div>
16383
16384 !! html/parsoid
16385 <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>
16386 !! end
16387
16388 !! test
16389 Bug 2304: HTML attribute safety (dangerous style template; 2309)
16390 !! wikitext
16391 <div style="{{dangerous style attribute}}"></div>
16392 !! html
16393 <div style="/* insecure input */"></div>
16394
16395 !! end
16396
16397 !! test
16398 Bug 2304: HTML attribute safety (safe parameter; 2309)
16399 !! wikitext
16400 {{div style|width: 200px}}
16401 !! html
16402 <div style="float: right; width: 200px">Magic div</div>
16403
16404 !! end
16405
16406 !! test
16407 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
16408 !! wikitext
16409 {{div style|width: expression(alert(document.cookie))}}
16410 !! html
16411 <div style="/* insecure input */">Magic div</div>
16412
16413 !! end
16414
16415 !! test
16416 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
16417 !! wikitext
16418 {{div style|"><script>alert(document.cookie)</script>}}
16419 !! html
16420 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16421
16422 !! end
16423
16424 !! test
16425 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
16426 !! wikitext
16427 {{div style|" ><script>alert(document.cookie)</script>}}
16428 !! html
16429 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16430
16431 !! end
16432
16433 !! test
16434 Bug 2304: HTML attribute safety (link)
16435 !! wikitext
16436 <div title="[[Main Page]]"></div>
16437 !! html
16438 <div title="&#91;&#91;Main Page]]"></div>
16439
16440 !! end
16441
16442 !! test
16443 Bug 2304: HTML attribute safety (italics)
16444 !! wikitext
16445 <div title="''foobar''"></div>
16446 !! html
16447 <div title="&#39;&#39;foobar&#39;&#39;"></div>
16448
16449 !! end
16450
16451 !! test
16452 Bug 2304: HTML attribute safety (bold)
16453 !! wikitext
16454 <div title="'''foobar'''"></div>
16455 !! html
16456 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
16457
16458 !! end
16459
16460
16461 !! test
16462 Bug 2304: HTML attribute safety (ISBN)
16463 !! wikitext
16464 <div title="ISBN 1234567890"></div>
16465 !! html
16466 <div title="&#73;SBN 1234567890"></div>
16467
16468 !! end
16469
16470 !! test
16471 Bug 2304: HTML attribute safety (RFC)
16472 !! wikitext
16473 <div title="RFC 1234"></div>
16474 !! html
16475 <div title="&#82;FC 1234"></div>
16476
16477 !! end
16478
16479 !! test
16480 Bug 2304: HTML attribute safety (PMID)
16481 !! wikitext
16482 <div title="PMID 1234567890"></div>
16483 !! html
16484 <div title="&#80;MID 1234567890"></div>
16485
16486 !! end
16487
16488 !! test
16489 Bug 2304: HTML attribute safety (web link)
16490 !! wikitext
16491 <div title="http://example.com/"></div>
16492 !! html
16493 <div title="http&#58;//example.com/"></div>
16494
16495 !! end
16496
16497 !! test
16498 Bug 2304: HTML attribute safety (named web link)
16499 !! wikitext
16500 <div title="[http://example.com/ link]"></div>
16501 !! html
16502 <div title="&#91;http&#58;//example.com/ link]"></div>
16503
16504 !! end
16505
16506 !! test
16507 Bug 3244: HTML attribute safety (extension; safe)
16508 !! wikitext
16509 <div style="<nowiki>background:blue</nowiki>"></div>
16510 !! html
16511 <div style="background:blue"></div>
16512
16513 !! end
16514
16515 !! test
16516 Bug 3244: HTML attribute safety (extension; unsafe)
16517 !! wikitext
16518 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
16519 !! html
16520 <div style="/* insecure input */"></div>
16521
16522 !! end
16523
16524 # More MSIE fun discovered by Tom Gilder
16525
16526 !! test
16527 MSIE CSS safety test: spurious slash
16528 !! wikitext
16529 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
16530 !! html
16531 <div style="/* insecure input */">evil</div>
16532
16533 !! end
16534
16535 !! test
16536 MSIE CSS safety test: hex code
16537 !! wikitext
16538 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
16539 !! html
16540 <div style="/* insecure input */">evil</div>
16541
16542 !! end
16543
16544 !! test
16545 MSIE CSS safety test: comment in url
16546 !! wikitext
16547 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
16548 !! html
16549 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
16550
16551 !! end
16552
16553 !! test
16554 MSIE CSS safety test: comment in expression
16555 !! wikitext
16556 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
16557 !! html
16558 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
16559
16560 !! end
16561
16562 !! test
16563 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
16564 !! wikitext
16565 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
16566 !! html
16567 <p style="/* invalid control char */">A</p>
16568
16569 !! end
16570
16571 !! test
16572 MSIE 6 CSS safety test: Fullwidth (bug 55332)
16573 !! wikitext
16574 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
16575 <div style="top:EXPRESSION(alert())">B</div>
16576 !! html
16577 <p style="/* insecure input */">A</p>
16578 <div style="/* insecure input */">B</div>
16579
16580 !! end
16581
16582 !! test
16583 MSIE 6 CSS safety test: IPA extensions (bug 55332)
16584 !! wikitext
16585 <div style="background-image:uʀʟ(javascript:alert())">A</div>
16586 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
16587 !! html
16588 <div style="/* insecure input */">A</div>
16589 <p style="/* insecure input */">B</p>
16590
16591 !! end
16592
16593 !! test
16594 MSIE 6 CSS safety test: sup/sub script (bug 55332)
16595 !! wikitext
16596 <div style="background-image:url⁽javascript:alert())">A</div>
16597 <div style="background-image:url₍javascript:alert())">B</div>
16598 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
16599 !! html
16600 <div style="/* insecure input */">A</div>
16601 <div style="/* insecure input */">B</div>
16602 <p style="/* insecure input */">C</p>
16603
16604 !! end
16605
16606 # FIXME: Parsoid fails to sanitize this! See T58846.
16607 !! test
16608 Opera -o-link CSS
16609 !! wikitext
16610 <div
16611 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;"
16612 style="-o-link:attr(title);-o-link-source:current">X</div>
16613 !! html
16614 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
16615
16616 !! end
16617
16618 !! test
16619 MSIE 6 CSS safety test: Repetition markers (bug 55332)
16620 !! wikitext
16621 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
16622 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
16623 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
16624 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
16625 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
16626 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
16627 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
16628 !! html
16629 <p style="/* insecure input */">A</p>
16630 <p style="/* insecure input */">B</p>
16631 <p style="/* insecure input */">C</p>
16632 <p style="/* insecure input */">D</p>
16633 <p style="/* insecure input */">E</p>
16634 <p style="/* insecure input */">F</p>
16635 <p style="/* insecure input */">G</p>
16636
16637 !! end
16638
16639 !! test
16640 Table attribute legitimate extension
16641 !! wikitext
16642 {|
16643 !+ style="<nowiki>color:blue</nowiki>"| status
16644 |}
16645 !! html
16646 <table>
16647 <tr>
16648 <th style="color:blue"> status
16649 </th></tr></table>
16650
16651 !!end
16652
16653 !! test
16654 Table attribute safety
16655 !! wikitext
16656 {|
16657 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
16658 |}
16659 !! html
16660 <table>
16661 <tr>
16662 <th style="/* insecure input */"> status
16663 </th></tr></table>
16664
16665 !! end
16666
16667 !! test
16668 CSS line continuation 1
16669 !! wikitext
16670 <div style="background-image: u\&#10;rl(test.jpg);"></div>
16671 !! html
16672 <div style="/* insecure input */"></div>
16673
16674 !! end
16675
16676 !! test
16677 CSS line continuation 2
16678 !! wikitext
16679 <div style="background-image: u\&#13;rl(test.jpg); "></div>
16680 !! html
16681 <div style="/* invalid control char */"></div>
16682
16683 !! end
16684
16685 !! article
16686 Template:Identity
16687 !! text
16688 {{{1}}}
16689 !! endarticle
16690
16691 !! test
16692 Expansion of multi-line templates in attribute values (bug 6255)
16693 !! wikitext
16694 <div style="background: {{identity|#00FF00}}">-</div>
16695 !! html
16696 <div style="background: #00FF00">-</div>
16697
16698 !! end
16699
16700
16701 !! test
16702 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
16703 !! wikitext
16704 <div style="background:
16705 #00FF00">-</div>
16706 !! html/php
16707 <div style="background: #00FF00">-</div>
16708
16709 !! html/parsoid
16710 <div style="background:
16711 #00FF00">-</div>
16712 !! end
16713
16714 !! test
16715 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
16716 !! wikitext
16717 <div style="background: &#10;#00FF00">-</div>
16718 !! html
16719 <div style="background: &#10;#00FF00">-</div>
16720
16721 !! end
16722
16723 !! test
16724 Tags which are hidden from Tidy cannot pass through the Sanitizer
16725 !! wikitext
16726 <mw:toc><script>alert();</script></mw:toc>
16727 !! html+tidy
16728 <p>&lt;mw:toc&gt;&lt;script&gt;alert();&lt;/script&gt;&lt;/mw:toc&gt;</p>
16729 !! end
16730
16731 ###
16732 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
16733 ###
16734 !! test
16735 Parser hook: empty input
16736 !! wikitext
16737 <tag></tag>
16738 !! html/php
16739 <pre>
16740 ''
16741 array (
16742 )
16743 </pre>
16744
16745 !! html/parsoid
16746 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16747 !! end
16748
16749 ## Don't expect parsoid to rt this form.
16750 !! test
16751 Parser hook: empty input using terminated empty elements
16752 !! options
16753 parsoid=wt2html,html2html
16754 !! wikitext
16755 <tag/>
16756 !! html/php
16757 <pre>
16758 NULL
16759 array (
16760 )
16761 </pre>
16762
16763 !! html/parsoid
16764 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16765 !! end
16766
16767 !! test
16768 Parser hook: empty input using terminated empty elements (space before)
16769 !! wikitext
16770 <tag />
16771 !! html/php
16772 <pre>
16773 NULL
16774 array (
16775 )
16776 </pre>
16777
16778 !! html/parsoid
16779 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16780 !! end
16781
16782 !! test
16783 Parser hook: basic input
16784 !! wikitext
16785 <tag>input</tag>
16786 !! html/php
16787 <pre>
16788 'input'
16789 array (
16790 )
16791 </pre>
16792
16793 !! html/parsoid
16794 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16795 !! end
16796
16797 ## Don't expect parsoid to rt this form.
16798 !! test
16799 Parser hook: case insensitive
16800 !! options
16801 parsoid=wt2html,html2html
16802 !! wikitext
16803 <TAG>input</TAG>
16804 !! html/php
16805 <pre>
16806 'input'
16807 array (
16808 )
16809 </pre>
16810
16811 !! html/parsoid
16812 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16813 !! end
16814
16815 ## Don't expect parsoid to rt this form.
16816 !! test
16817 Parser hook: case insensitive, redux
16818 !! options
16819 parsoid=wt2html,html2html
16820 !! wikitext
16821 <TaG>input</TAg>
16822 !! html/php
16823 <pre>
16824 'input'
16825 array (
16826 )
16827 </pre>
16828
16829 !! html/parsoid
16830 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16831 !! end
16832
16833 !! test
16834 Parser hook: nested tags
16835 !! wikitext
16836 <tag><tag></tag></tag>
16837 !! html/php
16838 <pre>
16839 '<tag>'
16840 array (
16841 )
16842 </pre>&lt;/tag&gt;
16843
16844 !! html/parsoid
16845 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}' data-parsoid='{}' about="#mwt2"></pre>&lt;/tag>
16846 !! end
16847
16848 !! test
16849 Parser hook: basic arguments
16850 !! wikitext
16851 <tag width="200" height="100" depth="50" square=""></tag>
16852 !! html/php
16853 <pre>
16854 ''
16855 array (
16856 'width' => '200',
16857 'height' => '100',
16858 'depth' => '50',
16859 'square' => '',
16860 )
16861 </pre>
16862
16863 !! html/parsoid
16864 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16865 !! end
16866
16867 ## Don't expect parsoid to rt this form.
16868 !! test
16869 Parser hook: basic arguments, variations
16870 !! options
16871 parsoid=wt2html,html2html
16872 !! wikitext
16873 <tag width=200 height = "100" depth = '50' square></tag>
16874 !! html/php
16875 <pre>
16876 ''
16877 array (
16878 'width' => '200',
16879 'height' => '100',
16880 'depth' => '50',
16881 'square' => '',
16882 )
16883 </pre>
16884
16885 !! html/parsoid
16886 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16887 !! end
16888
16889 !! test
16890 Parser hook: argument containing a forward slash (bug 5344)
16891 !! wikitext
16892 <tag filename="/tmp/bla"></tag>
16893 !! html/php
16894 <pre>
16895 ''
16896 array (
16897 'filename' => '/tmp/bla',
16898 )
16899 </pre>
16900
16901 !! html/parsoid
16902 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16903 !! end
16904
16905 ## Don't expect parsoid to rt this form.
16906 !! test
16907 Parser hook: empty input using terminated empty elements (bug 2374)
16908 !! options
16909 parsoid=wt2html,html2html
16910 !! wikitext
16911 <tag foo=bar/>text
16912 !! html/php
16913 <pre>
16914 NULL
16915 array (
16916 'foo' => 'bar',
16917 )
16918 </pre>text
16919
16920 !! html/parsoid
16921 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"foo":"bar"},"body":null}' data-parsoid='{}' about="#mwt2"></pre>text
16922 !! end
16923
16924 ## </tag> should be output literally since there is no matching tag that begins it
16925 ## Don't expect parsoid to rt this form.
16926 !! test
16927 Parser hook: basic arguments using terminated empty elements (bug 2374)
16928 !! options
16929 parsoid=wt2html
16930 !! wikitext
16931 <tag width=200 height = "100" depth = '50' square/>
16932 other stuff
16933 </tag>
16934 !! html/php
16935 <pre>
16936 NULL
16937 array (
16938 'width' => '200',
16939 'height' => '100',
16940 'depth' => '50',
16941 'square' => '',
16942 )
16943 </pre>
16944 <p>other stuff
16945 &lt;/tag&gt;
16946 </p>
16947 !! html/parsoid
16948 <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
16949 &lt;/tag></p>
16950 !! end
16951
16952 ## Don't expect parsoid to rt this form.
16953 !! test
16954 Parser hook: Don't allow unclosed extension tags
16955 !! options
16956 parsoid=wt2html
16957 !! wikitext
16958 test <tag>123
16959
16960 this is a '''test'''
16961 !! html/php
16962 <p>test &lt;tag&gt;123
16963 </p><p>this is a <b>test</b>
16964 </p>
16965 !! html/parsoid
16966 <p>test &lt;tag>123</p>
16967
16968 <p>this is a <b>test</b></p>
16969 !! end
16970
16971 ###
16972 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
16973 ###
16974
16975 !! test
16976 Parser hook: static parser hook not inside a comment
16977 !! wikitext
16978 <statictag>hello, world</statictag>
16979
16980 <statictag action="flush" />
16981 !! html/php
16982 <p><br />
16983 hello, world
16984 </p>
16985 !! html/parsoid
16986 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
16987 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt4">hello, world</p>
16988 !! end
16989
16990 !! test
16991 Parser hook: static parser hook inside a comment
16992 !! wikitext
16993 <!-- <statictag>hello, world</statictag> -->
16994 <statictag action="flush" />
16995 !! html/php
16996 <p><br />
16997 </p>
16998 !! html/parsoid
16999 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
17000 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt2"></p>
17001 !! end
17002
17003 # Nested template calls; this case was broken by Parser.php rev 1.506,
17004 # since reverted.
17005
17006 !! article
17007 Template:One-parameter
17008 !! text
17009 (My parameter is: {{{1}}})
17010 !! endarticle
17011
17012 !! article
17013 Template:Map-one-parameter
17014 !! text
17015 {{{{{1}}}|{{{2}}}}}
17016 !! endarticle
17017
17018 !! test
17019 Nested template calls
17020 !! wikitext
17021 {{Map-one-parameter|One-parameter|param}}
17022 !! html
17023 <p>(My parameter is: param)
17024 </p>
17025 !! end
17026
17027
17028 ###
17029 ### Sanitizer
17030 ###
17031
17032 # HTML+Tidy effectively strips out the empty tags completely
17033 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
17034 # which Tidy would have done for the PHP parser had there been content inside it.
17035 !! test
17036 Sanitizer: Closing of open tags
17037 !! wikitext
17038 <s></s><table></table>
17039 !! html
17040 <s></s><table></table>
17041
17042 !! html/parsoid
17043 <p><s></s></p><table></table>
17044 !! end
17045
17046 !! test
17047 Sanitizer: Closing of open but not closed tags
17048 !! wikitext
17049 <s>foo
17050 !! html
17051 <p><s>foo</s>
17052 </p>
17053 !! end
17054
17055 !! test
17056 Sanitizer: Closing of closed but not open tags
17057 !! options
17058 parsoid=wt2html
17059 !! wikitext
17060 </s>
17061 !! html/php+tidy
17062 !! html/parsoid
17063 !! end
17064
17065 !! test
17066 Sanitizer: Closing of closed but not open table tags
17067 !! options
17068 parsoid=wt2html
17069 !! wikitext
17070 Table not started</td></tr></table>
17071 !! html/php+tidy
17072 <p>Table not started</p>
17073 !! html/parsoid
17074 <p>Table not started</p>
17075 !! end
17076
17077 !! test
17078 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
17079 !! wikitext
17080 <span id="æ: v">byte</span>[[#æ: v|backlink]]
17081 !! html
17082 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
17083 </p>
17084 !! end
17085
17086 # In HTML5, the restrictions are that id must contain at least one character,
17087 # and must not contain any space characters.
17088 !! test
17089 Sanitizer: Validating the contents of the id attribute (bug 4515)
17090 !! options
17091 disabled
17092 !! wikitext
17093 <br id="" /><br id="a space" />
17094 !! html
17095 Something ...
17096 !! end
17097
17098 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
17099 !! test
17100 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
17101 !! options
17102 disabled
17103 !! wikitext
17104 <br id="foo" /><br id="foo" />
17105 !! html
17106 Something need to be done. foo-2 ?
17107 !! end
17108
17109 !! test
17110 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
17111 !! wikitext
17112 <div itemscope>
17113 <meta itemprop="hello" content="world">
17114 <meta http-equiv="refresh" content="5">
17115 <meta itemprop="hello" http-equiv="refresh" content="5">
17116 <link itemprop="hello" href="{{SERVER}}">
17117 <link rel="stylesheet" href="{{SERVER}}">
17118 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
17119 </div>
17120 !! html
17121 <div itemscope="">
17122 <p> <meta itemprop="hello" content="world" />
17123 &lt;meta http-equiv="refresh" content="5"&gt;
17124 <meta itemprop="hello" content="5" />
17125 </p>
17126 <link itemprop="hello" href="http&#58;//example.org" />
17127 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
17128 <link itemprop="hello" href="http&#58;//example.org" />
17129 </div>
17130
17131 !! end
17132
17133 !! test
17134 Language converter: output gets cut off unexpectedly (bug 5757)
17135 !! options
17136 language=zh
17137 !! wikitext
17138 this bit is safe: }-
17139
17140 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
17141
17142 then we get cut off here: }-
17143
17144 all additional text is vanished
17145 !! html
17146 <p>this bit is safe: }-
17147 </p><p>but if we add a conversion instance: xxx
17148 </p><p>then we get cut off here: }-
17149 </p><p>all additional text is vanished
17150 </p>
17151 !! end
17152
17153 !! test
17154 Self closed html pairs (bug 5487)
17155 !! options
17156 !! wikitext
17157 <center><font id="bug" />Centered text</center>
17158 <div><font id="bug2" />In div text</div>
17159 !! html
17160 <center>&lt;font id="bug" /&gt;Centered text</center>
17161 <div>&lt;font id="bug2" /&gt;In div text</div>
17162
17163 !! end
17164
17165 #
17166 #
17167 #
17168
17169 !! test
17170 Punctuation: nbsp before exclamation
17171 !! wikitext
17172 C'est grave !
17173 !! html
17174 <p>C'est grave&#160;!
17175 </p>
17176 !! end
17177
17178 !! test
17179 Punctuation: CSS !important (bug 11874)
17180 !! wikitext
17181 <div style="width:50% !important">important</div>
17182 !! html
17183 <div style="width:50% !important">important</div>
17184
17185 !!end
17186
17187 !! test
17188 Punctuation: CSS ! important (bug 11874; with space after)
17189 !! wikitext
17190 <div style="width:50% ! important">important</div>
17191 !! html
17192 <div style="width:50% ! important">important</div>
17193
17194 !!end
17195
17196 !! test
17197 HTML bullet list, closed tags (bug 5497)
17198 !! wikitext
17199 <ul>
17200 <li>One</li>
17201 <li>Two</li>
17202 </ul>
17203 !! html/php
17204 <ul>
17205 <li>One</li>
17206 <li>Two</li>
17207 </ul>
17208
17209 !! html/parsoid
17210 <ul data-parsoid='{"stx":"html"}'>
17211 <li data-parsoid='{"stx":"html"}'>One</li>
17212 <li data-parsoid='{"stx":"html"}'>Two</li>
17213 </ul>
17214
17215 !! end
17216
17217 !! test
17218 HTML bullet list, unclosed tags (bug 5497)
17219 !! wikitext
17220 <ul>
17221 <li>One
17222 <li>Two
17223 </ul>
17224 !! html/php+tidy
17225 <ul>
17226 <li>One</li>
17227 <li>Two</li>
17228 </ul>
17229 !! html/parsoid
17230 <ul data-parsoid='{"stx":"html"}'>
17231 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
17232 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
17233 </ul>
17234
17235 !! end
17236
17237 !! test
17238 HTML ordered list, closed tags (bug 5497)
17239 !! wikitext
17240 <ol>
17241 <li>One</li>
17242 <li>Two</li>
17243 </ol>
17244 !! html/php
17245 <ol>
17246 <li>One</li>
17247 <li>Two</li>
17248 </ol>
17249
17250 !! html/parsoid
17251 <ol data-parsoid='{"stx":"html"}'>
17252 <li data-parsoid='{"stx":"html"}'>One</li>
17253 <li data-parsoid='{"stx":"html"}'>Two</li>
17254 </ol>
17255
17256 !! end
17257
17258 !! test
17259 HTML ordered list, unclosed tags (bug 5497)
17260 !! options
17261 !! wikitext
17262 <ol>
17263 <li>One
17264 <li>Two
17265 </ol>
17266 !! html/php+tidy
17267 <ol>
17268 <li>One</li>
17269 <li>Two</li>
17270 </ol>
17271 !! html/parsoid
17272 <ol data-parsoid='{"stx":"html"}'>
17273 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
17274 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
17275 </ol>
17276
17277 !! end
17278
17279 !! test
17280 HTML nested bullet list, closed tags (bug 5497)
17281 !! wikitext
17282 <ul>
17283 <li>One</li>
17284 <li>Two:
17285 <ul>
17286 <li>Sub-one</li>
17287 <li>Sub-two</li>
17288 </ul>
17289 </li>
17290 </ul>
17291 !! html/php
17292 <ul>
17293 <li>One</li>
17294 <li>Two:
17295 <ul>
17296 <li>Sub-one</li>
17297 <li>Sub-two</li>
17298 </ul>
17299 </li>
17300 </ul>
17301
17302 !! html/parsoid
17303 <ul data-parsoid='{"stx":"html"}'>
17304 <li data-parsoid='{"stx":"html"}'>One</li>
17305 <li data-parsoid='{"stx":"html"}'>Two:
17306 <ul data-parsoid='{"stx":"html"}'>
17307 <li data-parsoid='{"stx":"html"}'>Sub-one</li>
17308 <li data-parsoid='{"stx":"html"}'>Sub-two</li>
17309 </ul>
17310 </li>
17311 </ul>
17312 !! end
17313
17314 !! test
17315 HTML nested bullet list, open tags (bug 5497)
17316 !! wikitext
17317 <ul>
17318 <li>One
17319 <li>Two:
17320 <ul>
17321 <li>Sub-one
17322 <li>Sub-two
17323 </ul>
17324 </ul>
17325 !! html/php+tidy
17326 <ul>
17327 <li>One</li>
17328 <li>Two:
17329 <ul>
17330 <li>Sub-one</li>
17331 <li>Sub-two</li>
17332 </ul>
17333 </li>
17334 </ul>
17335 !! html/parsoid
17336 <ul>
17337 <li>One
17338 </li>
17339 <li>Two:
17340 <ul>
17341 <li>Sub-one
17342 </li>
17343 <li>Sub-two
17344 </li>
17345 </ul>
17346 </li>
17347 </ul>
17348
17349 !! end
17350
17351 !! test
17352 HTML nested ordered list, closed tags (bug 5497)
17353 !! wikitext
17354 <ol>
17355 <li>One</li>
17356 <li>Two:
17357 <ol>
17358 <li>Sub-one</li>
17359 <li>Sub-two</li>
17360 </ol>
17361 </li>
17362 </ol>
17363 !! html
17364 <ol>
17365 <li>One</li>
17366 <li>Two:
17367 <ol>
17368 <li>Sub-one</li>
17369 <li>Sub-two</li>
17370 </ol>
17371 </li>
17372 </ol>
17373
17374 !! end
17375
17376 !! test
17377 HTML nested ordered list, open tags (bug 5497)
17378 !! wikitext
17379 <ol>
17380 <li>One
17381 <li>Two:
17382 <ol>
17383 <li>Sub-one
17384 <li>Sub-two
17385 </ol>
17386 </ol>
17387 !! html/php
17388 <ol>
17389 <li>One
17390 <li>Two:
17391 <ol>
17392 <li>Sub-one
17393 <li>Sub-two
17394 </ol>
17395 </ol>
17396
17397 !! html/parsoid
17398 <ol>
17399 <li>One
17400 </li>
17401 <li>Two:
17402 <ol>
17403 <li>Sub-one
17404 </li>
17405 <li>Sub-two
17406 </li>
17407 </ol>
17408 </li>
17409 </ol>
17410
17411 !! end
17412
17413 !! test
17414 HTML ordered list item with parameters oddity
17415 !! wikitext
17416 <ol><li id="fragment">One</li>
17417 </ol>
17418 !! html
17419 <ol><li id="fragment">One</li>
17420 </ol>
17421
17422 !! end
17423
17424 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
17425 !!test
17426 bug 5918: autonumbering
17427 !! wikitext
17428 [http://first/] [http://second] [ftp://ftp]
17429
17430 ftp://inlineftp
17431
17432 [mailto:enclosed@mail.tld With target]
17433
17434 [mailto:enclosed@mail.tld]
17435
17436 mailto:inline@mail.tld
17437 !! html/php
17438 <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>
17439 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
17440 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
17441 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
17442 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
17443 </p>
17444 !! html/parsoid
17445 <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>
17446 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
17447 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
17448 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
17449 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
17450 !! end
17451
17452
17453 #
17454 # Security and HTML correctness
17455 # From Nick Jenkins' fuzz testing
17456 #
17457
17458 !! test
17459 Fuzz testing: Parser13
17460 !! wikitext
17461 {|
17462 | http://a|
17463 !! html
17464 <table>
17465 <tr>
17466 <td>
17467 </td>
17468 </tr>
17469 </table>
17470
17471 !! end
17472
17473 !! test
17474 Fuzz testing: Parser14
17475 !! wikitext
17476 == onmouseover= ==
17477 http://__TOC__
17478 !! html
17479 <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>
17480 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17481 <ul>
17482 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17483 </ul>
17484 </div>
17485
17486
17487 !! html+tidy
17488 <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>
17489 <p>http://</p>
17490 <div id="toc" class="toc">
17491 <div id="toctitle">
17492 <h2>Contents</h2>
17493 </div>
17494 <ul>
17495 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17496 </ul>
17497 </div>
17498 <p></p>
17499 !! end
17500
17501 !! test
17502 Fuzz testing: Parser14-table
17503 !! options
17504 parsoid=wt2html,html2html
17505 !! wikitext
17506 ==a==
17507 {| STYLE=__TOC__
17508 !! html
17509 <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>
17510 <table style="&#95;_TOC&#95;_">
17511 <tr><td></td></tr>
17512 </table>
17513
17514 !! html+tidy
17515 <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>
17516 <table style="__TOC__">
17517 <tr>
17518 <td></td>
17519 </tr>
17520 </table>
17521 !! html/parsoid
17522 <h2>a</h2>
17523 <table style="__TOC__"></table>
17524 !! end
17525
17526 # Known to produce bogus xml (extra </td>)
17527 !! test
17528 Fuzz testing: Parser16
17529 !! wikitext
17530 {|
17531 !https://||||||
17532 !! html
17533 <table>
17534 <tr>
17535 <th>https://</th>
17536 <th></th>
17537 <th></th>
17538 <th>
17539 </td>
17540 </tr>
17541 </table>
17542
17543 !! html+tidy
17544 <table>
17545 <tr>
17546 <th>https://</th>
17547 <th></th>
17548 <th></th>
17549 <th></th>
17550 </tr>
17551 </table>
17552 !! end
17553
17554 !! test
17555 Fuzz testing: Parser21
17556 !! wikitext
17557 {|
17558 ! irc://{{ftp://a" onmouseover="alert('hello world');"
17559 |
17560 !! html
17561 <table>
17562 <tr>
17563 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
17564 </th>
17565 <td>
17566 </td>
17567 </tr>
17568 </table>
17569
17570 !! end
17571
17572 !! test
17573 Fuzz testing: Parser22
17574 !! wikitext
17575 http://===r:::https://b
17576
17577 {|
17578 !! html
17579 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
17580 </p>
17581 <table>
17582 <tr><td></td></tr>
17583 </table>
17584
17585 !! end
17586
17587 # Known to produce bad XML for now
17588 !! test
17589 Fuzz testing: Parser24
17590 !! wikitext
17591 {|
17592 {{{|
17593 <u CLASS=
17594 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
17595 <br style="onmouseover='alert(document.cookie);' " />
17596
17597 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17598 |
17599 !! html
17600 <table>
17601 {{{|
17602 <u class="&#124;">}}}} &gt;
17603 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
17604
17605 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17606 <tr>
17607 <td></u>
17608 </td>
17609 </tr>
17610 </table>
17611
17612 !! end
17613
17614 # Note: the current result listed for this is not what the original one was,
17615 # but the original bug was JavaScript injection, which is fixed in any case.
17616 # It's not clear that the original result listed was any more correct than the
17617 # current one. Original result:
17618 # <p>{{{|
17619 # </p>
17620 # <li class="&#124;&#124;">
17621 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17622 !!test
17623 Fuzz testing: Parser25 (bug 6055)
17624 !! wikitext
17625 {{{
17626 |
17627 <LI CLASS=||
17628 >
17629 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
17630 !! html
17631 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17632 </p>
17633 !! end
17634
17635 !!test
17636 Fuzz testing: URL adjacent extension (with space, clean)
17637 !! wikitext
17638 http://example.com <nowiki>junk</nowiki>
17639 !! html/php
17640 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
17641 </p>
17642 !! html/parsoid
17643 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
17644 !! end
17645
17646 !!test
17647 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
17648 !! wikitext
17649 http://example.com<nowiki>junk</nowiki>
17650 !! html/php
17651 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
17652 </p>
17653 !! html/parsoid
17654 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
17655 !! end
17656
17657 !!test
17658 Fuzz testing: URL adjacent extension (no space, dirty; pre)
17659 !! wikitext
17660 http://example.com<pre>junk</pre>
17661 !! html/php
17662 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
17663
17664 !! html/php+tidy
17665 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
17666 <pre>
17667 junk
17668 </pre>
17669 !! html/parsoid
17670 <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>
17671 !!end
17672
17673 !!test
17674 Fuzz testing: image with bogus manual thumbnail
17675 !! wikitext
17676 [[Image:foobar.jpg|thumbnail= ]]
17677 !! html/php
17678 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
17679
17680 !! html/parsoid
17681 <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>
17682 !!end
17683
17684 !! test
17685 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
17686 !! wikitext
17687 <pre dir="&#10;"></pre>
17688 !! html
17689 <pre dir="&#10;"></pre>
17690
17691 !! end
17692
17693 !! test
17694 Parsing optional HTML elements (Bug 6171)
17695 !! options
17696 !! wikitext
17697 <table>
17698 <tr>
17699 <td> Some tabular data</td>
17700 <td> More tabular data ...
17701 <td> And yet som tabular data</td>
17702 </tr>
17703 </table>
17704 !! html
17705 <table>
17706 <tr>
17707 <td> Some tabular data</td>
17708 <td> More tabular data ...
17709 </td><td> And yet som tabular data</td>
17710 </tr>
17711 </table>
17712
17713 !! end
17714
17715 !! test
17716 Correct handling of <td>, <tr> (Bug 6171)
17717 !! options
17718 !! wikitext
17719 <table>
17720 <tr>
17721 <td> Some tabular data</td>
17722 <td> More tabular data ...</td>
17723 <td> And yet som tabular data</td>
17724 </tr>
17725 </table>
17726 !! html
17727 <table>
17728 <tr>
17729 <td> Some tabular data</td>
17730 <td> More tabular data ...</td>
17731 <td> And yet som tabular data</td>
17732 </tr>
17733 </table>
17734
17735 !! end
17736
17737
17738 !! test
17739 Parsing crashing regression (fr:JavaScript)
17740 !! wikitext
17741 </body></x>
17742 !! html
17743 <p>&lt;/body&gt;&lt;/x&gt;
17744 </p>
17745 !! end
17746
17747 !! test
17748 Inline wiki vs wiki block nesting
17749 !! wikitext
17750 '''Bold paragraph
17751
17752 New wiki paragraph
17753 !! html
17754 <p><b>Bold paragraph</b>
17755 </p><p>New wiki paragraph
17756 </p>
17757 !! end
17758
17759 # FIXME: The current php output is documented
17760 # and desired output is the parsoid target.
17761 !! test
17762 Inline HTML vs wiki block nesting
17763 !! wikitext
17764 <b>Bold paragraph
17765
17766 New wiki paragraph
17767 !! html/php
17768 <p><b>Bold paragraph
17769 </p><p>New wiki paragraph</b>
17770 </p>
17771 !! html/parsoid
17772 <p><b>Bold paragraph</b>
17773 </p><p>New wiki paragraph
17774 </p>
17775 !! end
17776
17777 # Original result was this:
17778 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
17779 # </p>
17780 # While that might be marginally more intuitive, maybe, the six-apostrophe
17781 # construct is clearly pathological and the result stated here (which is what
17782 # the parser actually does) is about as reasonable as anything.
17783 !!test
17784 Mixing markup for italics and bold
17785 !! options
17786 !! wikitext
17787 '''bold''''''bold''bolditalics'''''
17788 !! html
17789 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
17790 </p>
17791 !! end
17792
17793
17794 !! article
17795 Xyzzyx
17796 !! text
17797 Article for special page transclusion test
17798 !! endarticle
17799
17800 !! test
17801 Special page transclusion
17802 !! options
17803 !! wikitext
17804 {{Special:Prefixindex/Xyzzyx}}
17805 !! html
17806 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17807 </ul>
17808
17809 !! end
17810
17811 !! test
17812 Special page transclusion twice (bug 5021)
17813 !! options
17814 !! wikitext
17815 {{Special:Prefixindex/Xyzzyx}}
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 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17821 </ul>
17822
17823 !! end
17824
17825 !! test
17826 Transclusion of default MediaWiki message
17827 !! wikitext
17828 {{MediaWiki:Mainpage}}
17829 !! html
17830 <p>Main Page
17831 </p>
17832 !! end
17833
17834 !! test
17835 Transclusion of nonexistent MediaWiki message
17836 !! wikitext
17837 {{MediaWiki:Mainpagexxx}}
17838 !! html
17839 <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>
17840 </p>
17841 !! end
17842
17843 !! test
17844 Transclusion of MediaWiki message with underscore
17845 !! wikitext
17846 {{MediaWiki:history_short}}
17847 !! html
17848 <p>History
17849 </p>
17850 !! end
17851
17852 !! test
17853 Transclusion of MediaWiki message with space
17854 !! wikitext
17855 {{MediaWiki:history short}}
17856 !! html
17857 <p>History
17858 </p>
17859 !! end
17860
17861 !! test
17862 Invalid header with following text
17863 !! wikitext
17864 = x = y
17865 !! html
17866 <p>= x = y
17867 </p>
17868 !! end
17869
17870
17871 !! test
17872 Section extraction test (section 0)
17873 !! options
17874 section=0
17875 !! wikitext
17876 start
17877 ==a==
17878 ===aa===
17879 ====aaa====
17880 ==b==
17881 ===ba===
17882 ===bb===
17883 ====bba====
17884 ===bc===
17885 ==c==
17886 ===ca===
17887 !! html/php
17888 start
17889 !! end
17890
17891 !! test
17892 Section extraction test (section 1)
17893 !! options
17894 section=1
17895 !! wikitext
17896 start
17897 ==a==
17898 ===aa===
17899 ====aaa====
17900 ==b==
17901 ===ba===
17902 ===bb===
17903 ====bba====
17904 ===bc===
17905 ==c==
17906 ===ca===
17907 !! html/php
17908 ==a==
17909 ===aa===
17910 ====aaa====
17911 !! end
17912
17913 !! test
17914 Section extraction test (section 2)
17915 !! options
17916 section=2
17917 !! wikitext
17918 start
17919 ==a==
17920 ===aa===
17921 ====aaa====
17922 ==b==
17923 ===ba===
17924 ===bb===
17925 ====bba====
17926 ===bc===
17927 ==c==
17928 ===ca===
17929 !! html/php
17930 ===aa===
17931 ====aaa====
17932 !! end
17933
17934 !! test
17935 Section extraction test (section 3)
17936 !! options
17937 section=3
17938 !! wikitext
17939 start
17940 ==a==
17941 ===aa===
17942 ====aaa====
17943 ==b==
17944 ===ba===
17945 ===bb===
17946 ====bba====
17947 ===bc===
17948 ==c==
17949 ===ca===
17950 !! html/php
17951 ====aaa====
17952 !! end
17953
17954 !! test
17955 Section extraction test (section 4)
17956 !! options
17957 section=4
17958 !! wikitext
17959 start
17960 ==a==
17961 ===aa===
17962 ====aaa====
17963 ==b==
17964 ===ba===
17965 ===bb===
17966 ====bba====
17967 ===bc===
17968 ==c==
17969 ===ca===
17970 !! html/php
17971 ==b==
17972 ===ba===
17973 ===bb===
17974 ====bba====
17975 ===bc===
17976 !! end
17977
17978 !! test
17979 Section extraction test (section 5)
17980 !! options
17981 section=5
17982 !! wikitext
17983 start
17984 ==a==
17985 ===aa===
17986 ====aaa====
17987 ==b==
17988 ===ba===
17989 ===bb===
17990 ====bba====
17991 ===bc===
17992 ==c==
17993 ===ca===
17994 !! html/php
17995 ===ba===
17996 !! end
17997
17998 !! test
17999 Section extraction test (section 6)
18000 !! options
18001 section=6
18002 !! wikitext
18003 start
18004 ==a==
18005 ===aa===
18006 ====aaa====
18007 ==b==
18008 ===ba===
18009 ===bb===
18010 ====bba====
18011 ===bc===
18012 ==c==
18013 ===ca===
18014 !! html/php
18015 ===bb===
18016 ====bba====
18017 !! end
18018
18019 !! test
18020 Section extraction test (section 7)
18021 !! options
18022 section=7
18023 !! wikitext
18024 start
18025 ==a==
18026 ===aa===
18027 ====aaa====
18028 ==b==
18029 ===ba===
18030 ===bb===
18031 ====bba====
18032 ===bc===
18033 ==c==
18034 ===ca===
18035 !! html/php
18036 ====bba====
18037 !! end
18038
18039 !! test
18040 Section extraction test (section 8)
18041 !! options
18042 section=8
18043 !! wikitext
18044 start
18045 ==a==
18046 ===aa===
18047 ====aaa====
18048 ==b==
18049 ===ba===
18050 ===bb===
18051 ====bba====
18052 ===bc===
18053 ==c==
18054 ===ca===
18055 !! html/php
18056 ===bc===
18057 !! end
18058
18059 !! test
18060 Section extraction test (section 9)
18061 !! options
18062 section=9
18063 !! wikitext
18064 start
18065 ==a==
18066 ===aa===
18067 ====aaa====
18068 ==b==
18069 ===ba===
18070 ===bb===
18071 ====bba====
18072 ===bc===
18073 ==c==
18074 ===ca===
18075 !! html/php
18076 ==c==
18077 ===ca===
18078 !! end
18079
18080 !! test
18081 Section extraction test (section 10)
18082 !! options
18083 section=10
18084 !! wikitext
18085 start
18086 ==a==
18087 ===aa===
18088 ====aaa====
18089 ==b==
18090 ===ba===
18091 ===bb===
18092 ====bba====
18093 ===bc===
18094 ==c==
18095 ===ca===
18096 !! html/php
18097 ===ca===
18098 !! end
18099
18100 !! test
18101 Section extraction test (nonexistent section 11)
18102 !! options
18103 section=11
18104 !! wikitext
18105 start
18106 ==a==
18107 ===aa===
18108 ====aaa====
18109 ==b==
18110 ===ba===
18111 ===bb===
18112 ====bba====
18113 ===bc===
18114 ==c==
18115 ===ca===
18116 !! html/php
18117 !! end
18118
18119 !! test
18120 Section extraction test with bogus heading (section 1)
18121 !! options
18122 section=1
18123 !! wikitext
18124 ==a==
18125 ==bogus== not a legal section
18126 ==b==
18127 !! html/php
18128 ==a==
18129 ==bogus== not a legal section
18130 !! end
18131
18132 !! test
18133 Section extraction test with bogus heading (section 2)
18134 !! options
18135 section=2
18136 !! wikitext
18137 ==a==
18138 ==bogus== not a legal section
18139 ==b==
18140 !! html/php
18141 ==b==
18142 !! end
18143
18144 !! test
18145 Section extraction test with comment after heading (section 1)
18146 !! options
18147 section=1
18148 !! wikitext
18149 ==a==
18150 ==b== <!-- -->
18151 ==c==
18152 !! html/php
18153 ==a==
18154 !! end
18155
18156 !! test
18157 Section extraction test with comment after heading (section 2)
18158 !! options
18159 section=2
18160 !! wikitext
18161 ==a==
18162 ==b== <!-- -->
18163 ==c==
18164 !! html/php
18165 ==b== <!-- -->
18166 !! end
18167
18168 !! test
18169 Section extraction test with bogus <nowiki> heading (section 1)
18170 !! options
18171 section=1
18172 !! wikitext
18173 ==a==
18174 ==bogus== <nowiki>not a legal section</nowiki>
18175 ==b==
18176 !! html/php
18177 ==a==
18178 ==bogus== <nowiki>not a legal section</nowiki>
18179 !! end
18180
18181 !! test
18182 Section extraction test with bogus <nowiki> heading (section 2)
18183 !! options
18184 section=2
18185 !! wikitext
18186 ==a==
18187 ==bogus== <nowiki>not a legal section</nowiki>
18188 ==b==
18189 !! html/php
18190 ==b==
18191 !! end
18192
18193 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
18194 # instead of respecting commented sections
18195 !! test
18196 Section extraction prefixed by comment (section 1)
18197 !! options
18198 section=1
18199 !! wikitext
18200 <!-- -->==sec1==
18201 ==sec2==
18202 !! html/php
18203 ==sec2==
18204 !!end
18205
18206 !! test
18207 Section extraction prefixed by comment (section 2)
18208 !! options
18209 section=2
18210 !! wikitext
18211 <!-- -->==sec1==
18212 ==sec2==
18213 !! html/php
18214
18215 !!end
18216
18217 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
18218 # instead of respecting HTML-style headings
18219 !! test
18220 Section extraction, mixed wiki and html (section 1)
18221 !! options
18222 section=1
18223 !! wikitext
18224 <h2>unmarked</h2>
18225 unmarked
18226 ==1==
18227 one
18228 ==2==
18229 two
18230 !! html/php
18231 ==1==
18232 one
18233 !! end
18234
18235 !! test
18236 Section extraction, mixed wiki and html (section 2)
18237 !! options
18238 section=2
18239 !! wikitext
18240 <h2>unmarked</h2>
18241 unmarked
18242 ==1==
18243 one
18244 ==2==
18245 two
18246 !! html/php
18247 ==2==
18248 two
18249 !! end
18250
18251
18252 # Formerly testing for bug 3342
18253 !! test
18254 Section extraction, heading surrounded by <noinclude>
18255 !! options
18256 section=1
18257 !! wikitext
18258 <noinclude>==unmarked==</noinclude>
18259 ==marked==
18260 !! html/php
18261 ==marked==
18262 !!end
18263
18264 # Test behavior of bug 19910
18265 !! test
18266 Sectiion with all-equals
18267 !! options
18268 section=2
18269 !! wikitext
18270 ===
18271 The line above must have a trailing space
18272 === <!--
18273 --> <!-- -->
18274 But just in case it doesn't...
18275 !! html/php
18276 === <!--
18277 --> <!-- -->
18278 But just in case it doesn't...
18279 !! end
18280
18281 !! test
18282 Section replacement test (section 0)
18283 !! options
18284 replace=0,"xxx"
18285 !! wikitext
18286 start
18287 ==a==
18288 ===aa===
18289 ====aaa====
18290 ==b==
18291 ===ba===
18292 ===bb===
18293 ====bba====
18294 ===bc===
18295 ==c==
18296 ===ca===
18297 !! html/php
18298 xxx
18299
18300 ==a==
18301 ===aa===
18302 ====aaa====
18303 ==b==
18304 ===ba===
18305 ===bb===
18306 ====bba====
18307 ===bc===
18308 ==c==
18309 ===ca===
18310 !! end
18311
18312 !! test
18313 Section replacement test (section 1)
18314 !! options
18315 replace=1,"xxx"
18316 !! wikitext
18317 start
18318 ==a==
18319 ===aa===
18320 ====aaa====
18321 ==b==
18322 ===ba===
18323 ===bb===
18324 ====bba====
18325 ===bc===
18326 ==c==
18327 ===ca===
18328 !! html/php
18329 start
18330 xxx
18331
18332 ==b==
18333 ===ba===
18334 ===bb===
18335 ====bba====
18336 ===bc===
18337 ==c==
18338 ===ca===
18339 !! end
18340
18341 !! test
18342 Section replacement test (section 2)
18343 !! options
18344 replace=2,"xxx"
18345 !! wikitext
18346 start
18347 ==a==
18348 ===aa===
18349 ====aaa====
18350 ==b==
18351 ===ba===
18352 ===bb===
18353 ====bba====
18354 ===bc===
18355 ==c==
18356 ===ca===
18357 !! html/php
18358 start
18359 ==a==
18360 xxx
18361
18362 ==b==
18363 ===ba===
18364 ===bb===
18365 ====bba====
18366 ===bc===
18367 ==c==
18368 ===ca===
18369 !! end
18370
18371 !! test
18372 Section replacement test (section 3)
18373 !! options
18374 replace=3,"xxx"
18375 !! wikitext
18376 start
18377 ==a==
18378 ===aa===
18379 ====aaa====
18380 ==b==
18381 ===ba===
18382 ===bb===
18383 ====bba====
18384 ===bc===
18385 ==c==
18386 ===ca===
18387 !! html/php
18388 start
18389 ==a==
18390 ===aa===
18391 xxx
18392
18393 ==b==
18394 ===ba===
18395 ===bb===
18396 ====bba====
18397 ===bc===
18398 ==c==
18399 ===ca===
18400 !! end
18401
18402 !! test
18403 Section replacement test (section 4)
18404 !! options
18405 replace=4,"xxx"
18406 !! wikitext
18407 start
18408 ==a==
18409 ===aa===
18410 ====aaa====
18411 ==b==
18412 ===ba===
18413 ===bb===
18414 ====bba====
18415 ===bc===
18416 ==c==
18417 ===ca===
18418 !! html/php
18419 start
18420 ==a==
18421 ===aa===
18422 ====aaa====
18423 xxx
18424
18425 ==c==
18426 ===ca===
18427 !! end
18428
18429 !! test
18430 Section replacement test (section 5)
18431 !! options
18432 replace=5,"xxx"
18433 !! wikitext
18434 start
18435 ==a==
18436 ===aa===
18437 ====aaa====
18438 ==b==
18439 ===ba===
18440 ===bb===
18441 ====bba====
18442 ===bc===
18443 ==c==
18444 ===ca===
18445 !! html/php
18446 start
18447 ==a==
18448 ===aa===
18449 ====aaa====
18450 ==b==
18451 xxx
18452
18453 ===bb===
18454 ====bba====
18455 ===bc===
18456 ==c==
18457 ===ca===
18458 !! end
18459
18460 !! test
18461 Section replacement test (section 6)
18462 !! options
18463 replace=6,"xxx"
18464 !! wikitext
18465 start
18466 ==a==
18467 ===aa===
18468 ====aaa====
18469 ==b==
18470 ===ba===
18471 ===bb===
18472 ====bba====
18473 ===bc===
18474 ==c==
18475 ===ca===
18476 !! html/php
18477 start
18478 ==a==
18479 ===aa===
18480 ====aaa====
18481 ==b==
18482 ===ba===
18483 xxx
18484
18485 ===bc===
18486 ==c==
18487 ===ca===
18488 !! end
18489
18490 !! test
18491 Section replacement test (section 7)
18492 !! options
18493 replace=7,"xxx"
18494 !! wikitext
18495 start
18496 ==a==
18497 ===aa===
18498 ====aaa====
18499 ==b==
18500 ===ba===
18501 ===bb===
18502 ====bba====
18503 ===bc===
18504 ==c==
18505 ===ca===
18506 !! html/php
18507 start
18508 ==a==
18509 ===aa===
18510 ====aaa====
18511 ==b==
18512 ===ba===
18513 ===bb===
18514 xxx
18515
18516 ===bc===
18517 ==c==
18518 ===ca===
18519 !! end
18520
18521 !! test
18522 Section replacement test (section 8)
18523 !! options
18524 replace=8,"xxx"
18525 !! wikitext
18526 start
18527 ==a==
18528 ===aa===
18529 ====aaa====
18530 ==b==
18531 ===ba===
18532 ===bb===
18533 ====bba====
18534 ===bc===
18535 ==c==
18536 ===ca===
18537 !! html/php
18538 start
18539 ==a==
18540 ===aa===
18541 ====aaa====
18542 ==b==
18543 ===ba===
18544 ===bb===
18545 ====bba====
18546 xxx
18547
18548 ==c==
18549 ===ca===
18550 !!end
18551
18552 !! test
18553 Section replacement test (section 9)
18554 !! options
18555 replace=9,"xxx"
18556 !! wikitext
18557 start
18558 ==a==
18559 ===aa===
18560 ====aaa====
18561 ==b==
18562 ===ba===
18563 ===bb===
18564 ====bba====
18565 ===bc===
18566 ==c==
18567 ===ca===
18568 !! html/php
18569 start
18570 ==a==
18571 ===aa===
18572 ====aaa====
18573 ==b==
18574 ===ba===
18575 ===bb===
18576 ====bba====
18577 ===bc===
18578 xxx
18579 !! end
18580
18581 !! test
18582 Section replacement test (section 10)
18583 !! options
18584 replace=10,"xxx"
18585 !! wikitext
18586 start
18587 ==a==
18588 ===aa===
18589 ====aaa====
18590 ==b==
18591 ===ba===
18592 ===bb===
18593 ====bba====
18594 ===bc===
18595 ==c==
18596 ===ca===
18597 !! html/php
18598 start
18599 ==a==
18600 ===aa===
18601 ====aaa====
18602 ==b==
18603 ===ba===
18604 ===bb===
18605 ====bba====
18606 ===bc===
18607 ==c==
18608 xxx
18609 !! end
18610
18611 !! test
18612 Section replacement test with initial whitespace (bug 13728)
18613 !! options
18614 replace=2,"xxx"
18615 !! wikitext
18616 Preformatted initial line
18617 ==a==
18618 ===a===
18619 !! html/php
18620 Preformatted initial line
18621 ==a==
18622 xxx
18623 !! end
18624
18625
18626 !! test
18627 Section extraction, heading followed by pre with 20 spaces (bug 6398)
18628 !! options
18629 section=1
18630 !! wikitext
18631 ==a==
18632 a
18633 !! html/php
18634 ==a==
18635 a
18636 !! end
18637
18638 !! test
18639 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
18640 !! options
18641 section=1
18642 !! wikitext
18643 ==a==
18644 a
18645 !! html/php
18646 ==a==
18647 a
18648 !! end
18649
18650
18651 !! test
18652 Section extraction, <pre> around bogus header (bug 10309)
18653 !! options
18654 section=2
18655 !! wikitext
18656 == Section One ==
18657 <pre>
18658 =======
18659 </pre>
18660
18661 == Section Two ==
18662 stuff
18663 !! html/php
18664 == Section Two ==
18665 stuff
18666 !! end
18667
18668 !! test
18669 Section replacement, <pre> around bogus header (bug 10309)
18670 !! options
18671 replace=2,"xxx"
18672 !! wikitext
18673 == Section One ==
18674 <pre>
18675 =======
18676 </pre>
18677
18678 == Section Two ==
18679 stuff
18680 !! html/php
18681 == Section One ==
18682 <pre>
18683 =======
18684 </pre>
18685
18686 xxx
18687 !! end
18688
18689
18690 !! test
18691 Handling of &#x0A; in URLs
18692 !! wikitext
18693 ** irc://&#x0A;a
18694 !! html/php
18695 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18696
18697 !! html/parsoid
18698 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
18699 a">irc://
18700 a</a></li></ul></li></ul>
18701 !! end
18702
18703 !! test
18704 Handling of %0A in URLs
18705 !! wikitext
18706 ** irc://%0Aa
18707 !! html/php
18708 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18709
18710 !! html/parsoid
18711 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18712 !! end
18713
18714
18715 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
18716 !! test
18717 5 quotes, code coverage +1 line
18718 !! options
18719 parsoid=wt2html
18720 !! wikitext
18721 '''''
18722 !! html/php
18723 !! html/parsoid
18724 <p><b><i></i></b></p>
18725 !! end
18726
18727 # same html as previous, but wikitext adjusted to match parsoid html2wt
18728 # note that wt2html and html2html will put the <i> before the <b>
18729 !! test
18730 5 quotes, code coverage +1 line w/ nowiki (1)
18731 !! options
18732 parsoid=wt2wt,html2wt
18733 !! wikitext
18734 '''''<nowiki/>'''''
18735 !! html/php
18736 <p><i></i>
18737 </p>
18738 !! html/parsoid
18739 <p><b><i></i></b></p>
18740 !! end
18741
18742 # same as previous, just swapping the <i> and <b>
18743 !! test
18744 5 quotes, code coverage +1 line w/ nowiki (2)
18745 !! wikitext
18746 '''''<nowiki/>'''''
18747 !! html/php
18748 <p><i></i>
18749 </p>
18750 !! html/parsoid
18751 <p><i><b></b></i></p>
18752 !! end
18753
18754 !! test
18755 Special:Search page linking.
18756 !! wikitext
18757 {{Special:search}}
18758 !! html
18759 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
18760 </p>
18761 !! end
18762
18763 !! test
18764 {{!}} is a magic word
18765 !! wikitext
18766 {{!}} is a magic word there and {{!}} is still a magic word here
18767 | is not a magic word here but {{!}} is still a magic word here
18768 !! html/php
18769 <p>| is a magic word there and | is still a magic word here
18770 | is not a magic word here but | is still a magic word here
18771 </p>
18772 !! html/parsoid
18773 <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
18774 | 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>
18775
18776 !! end
18777
18778 !! test
18779 Say the magic word
18780 !! options
18781 title=[[Parser test]]
18782 !! wikitext
18783 * {{PAGENAME}}
18784 * {{PAGENAMEE}}
18785 * {{FULLPAGENAME}}
18786 * {{FULLPAGENAMEE}}
18787 * {{BASEPAGENAME}}
18788 * {{BASEPAGENAMEE}}
18789 * {{SUBPAGENAME}}
18790 * {{SUBPAGENAMEE}}
18791 * {{ROOTPAGENAME}}
18792 * {{ROOTPAGENAMEE}}
18793 * {{TALKPAGENAME}}
18794 * {{TALKPAGENAMEE}}
18795 * {{SUBJECTPAGENAME}}
18796 * {{SUBJECTPAGENAMEE}}
18797 * {{NAMESPACEE}}
18798 * {{NAMESPACE}}
18799 * {{NAMESPACENUMBER}}
18800 * {{TALKSPACE}}
18801 * {{TALKSPACEE}}
18802 * {{SUBJECTSPACE}}
18803 * {{SUBJECTSPACEE}}
18804 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
18805 !! html
18806 <ul><li> Parser test</li>
18807 <li> Parser_test</li>
18808 <li> Parser test</li>
18809 <li> Parser_test</li>
18810 <li> Parser test</li>
18811 <li> Parser_test</li>
18812 <li> Parser test</li>
18813 <li> Parser_test</li>
18814 <li> Parser test</li>
18815 <li> Parser_test</li>
18816 <li> Talk:Parser test</li>
18817 <li> Talk:Parser_test</li>
18818 <li> Parser test</li>
18819 <li> Parser_test</li>
18820 <li> </li>
18821 <li> </li>
18822 <li> 0</li>
18823 <li> Talk</li>
18824 <li> Talk</li>
18825 <li> </li>
18826 <li> </li>
18827 <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>
18828
18829 !! end
18830 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
18831
18832 !! test
18833 Gallery
18834 !! wikitext
18835 <gallery>
18836 image1.png |
18837 image2.gif|||||
18838
18839 image3|
18840 image4 |300px| centre
18841 image5.svg| http://///////
18842 [[x|xx]]]]
18843 * image6
18844 </gallery>
18845 !! html
18846 <ul class="gallery mw-gallery-traditional">
18847 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18848 <div class="thumb" style="height: 150px;">Image1.png</div>
18849 <div class="gallerytext">
18850 </div>
18851 </div></li>
18852 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18853 <div class="thumb" style="height: 150px;">Image2.gif</div>
18854 <div class="gallerytext">
18855 </div>
18856 </div></li>
18857 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18858 <div class="thumb" style="height: 150px;">Image3</div>
18859 <div class="gallerytext">
18860 </div>
18861 </div></li>
18862 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18863 <div class="thumb" style="height: 150px;">Image4</div>
18864 <div class="gallerytext">
18865 <pre>centre
18866 </pre>
18867 </div>
18868 </div></li>
18869 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18870 <div class="thumb" style="height: 150px;">Image5.svg</div>
18871 <div class="gallerytext">
18872 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
18873 </p>
18874 </div>
18875 </div></li>
18876 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18877 <div class="thumb" style="height: 150px;">* image6</div>
18878 <div class="gallerytext">
18879 </div>
18880 </div></li>
18881 </ul>
18882
18883 !! end
18884
18885 !! test
18886 Gallery (with options)
18887 !! wikitext
18888 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
18889 File:Nonexistent.jpg|caption
18890 File:Nonexistent.jpg
18891 image:foobar.jpg|some '''caption''' [[Main Page]]
18892 image:foobar.jpg
18893 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
18894 </gallery>
18895 !! html
18896 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
18897 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
18898 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18899 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18900 <div class="gallerytext">
18901 <p>caption
18902 </p>
18903 </div>
18904 </div></li>
18905 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18906 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18907 <div class="gallerytext">
18908 </div>
18909 </div></li>
18910 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18911 <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>
18912 <div class="gallerytext">
18913 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18914 </p>
18915 </div>
18916 </div></li>
18917 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18918 <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>
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="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>
18924 <div class="gallerytext">
18925 <p>blabla.
18926 </p>
18927 </div>
18928 </div></li>
18929 </ul>
18930
18931 !! end
18932
18933 !! test
18934 Gallery with link that has fragment
18935 !! wikitext
18936 <gallery>
18937 image:foobar.jpg|link=Main_Page
18938 image:foobar.jpg|link=Main_Page#section
18939 image:foobar.jpg|link=Main Page#section|caption
18940 </gallery>
18941 !! html
18942 <ul class="gallery mw-gallery-traditional">
18943 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18944 <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>
18945 <div class="gallerytext">
18946 </div>
18947 </div></li>
18948 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18949 <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>
18950 <div class="gallerytext">
18951 </div>
18952 </div></li>
18953 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18954 <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>
18955 <div class="gallerytext">
18956 <p>caption
18957 </p>
18958 </div>
18959 </div></li>
18960 </ul>
18961
18962 !! end
18963
18964 !! test
18965 Gallery with wikitext inside caption
18966 !! wikitext
18967 <gallery>
18968 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
18969 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
18970 </gallery>
18971 !! html
18972 <ul class="gallery mw-gallery-traditional">
18973 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18974 <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>
18975 <div class="gallerytext">
18976 <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>
18977 </p>
18978 </div>
18979 </div></li>
18980 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18981 <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>
18982 <div class="gallerytext">
18983 <p>This is a test template
18984 </p>
18985 </div>
18986 </div></li>
18987 </ul>
18988
18989 !! end
18990
18991 !! test
18992 gallery (with showfilename option)
18993 !! wikitext
18994 <gallery showfilename>
18995 File:Nonexistent.jpg|caption
18996 File:Nonexistent.jpg
18997 image:foobar.jpg|some '''caption''' [[Main Page]]
18998 File:Foobar.jpg
18999 </gallery>
19000 !! html
19001 <ul class="gallery mw-gallery-traditional">
19002 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19003 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19004 <div class="gallerytext">
19005 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
19006 caption
19007 </p>
19008 </div>
19009 </div></li>
19010 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19011 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19012 <div class="gallerytext">
19013 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
19014 </p>
19015 </div>
19016 </div></li>
19017 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19018 <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>
19019 <div class="gallerytext">
19020 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
19021 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19022 </p>
19023 </div>
19024 </div></li>
19025 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19026 <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>
19027 <div class="gallerytext">
19028 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
19029 </p>
19030 </div>
19031 </div></li>
19032 </ul>
19033
19034 !! end
19035
19036 !! test
19037 Gallery (with namespace-less filenames)
19038 !! wikitext
19039 <gallery>
19040 File:Nonexistent.jpg
19041 Nonexistent.jpg
19042 image:foobar.jpg
19043 foobar.jpg
19044 </gallery>
19045 !! html
19046 <ul class="gallery mw-gallery-traditional">
19047 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19048 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19049 <div class="gallerytext">
19050 </div>
19051 </div></li>
19052 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19053 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19054 <div class="gallerytext">
19055 </div>
19056 </div></li>
19057 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19058 <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>
19059 <div class="gallerytext">
19060 </div>
19061 </div></li>
19062 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19063 <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>
19064 <div class="gallerytext">
19065 </div>
19066 </div></li>
19067 </ul>
19068
19069 !! end
19070
19071 !! test
19072 HTML Hex character encoding (spells the word "JavaScript")
19073 !! options
19074 parsoid=wt2html,wt2wt,html2html
19075 !! wikitext
19076 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
19077 !! html/php
19078 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
19079 </p>
19080 !! html/php+tidy
19081 <p>JavaScript</p>
19082 !! html/parsoid
19083 <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>
19084 !! end
19085
19086 !! test
19087 HTML Hex character encoding bogus encoding (bug 26437 regression check)
19088 !! wikitext
19089 &#xsee;&#XSEE;
19090 !! html/php
19091 <p>&amp;#xsee;&amp;#XSEE;
19092 </p>
19093 !! html/parsoid
19094 <p>&amp;#xsee;&amp;#XSEE;</p>
19095 !! end
19096
19097 !! test
19098 HTML Hex character encoding mixed case
19099 !! options
19100 parsoid=wt2html,wt2wt,html2html
19101 !! wikitext
19102 &#xEE;&#Xee;
19103 !! html/php
19104 <p>&#xee;&#xee;
19105 </p>
19106 !! html/php+tidy
19107 <p>îî</p>
19108 !! html/parsoid
19109 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
19110 !! end
19111
19112 # See: http://www.w3.org/TR/html5/syntax.html#character-references
19113 # Note that U+000C (form feed) is not a valid XML character, so
19114 # it is banned even though allowed in HTML5.
19115 !! test
19116 Illegal character references (T106578)
19117 !! wikitext
19118 ; Null: &#00;
19119 ; FF: &#xC;
19120 ; CR: &#xD;
19121 ; Control (low): &#8;
19122 ; Control (high): &#x7F; &#x9F;
19123 ; Surrogate: &#xD83D;&#xDCA9;
19124 ; This is an okay astral character: &#x1F4A9;
19125 !! html+tidy
19126 <dl>
19127 <dt>Null</dt>
19128 <dd>&amp;#00;</dd>
19129 <dt>FF</dt>
19130 <dd>&amp;#xC;</dd>
19131 <dt>CR</dt>
19132 <dd>&amp;#xD;</dd>
19133 <dt>Control (low)</dt>
19134 <dd>&amp;#8;</dd>
19135 <dt>Control (high)</dt>
19136 <dd>&amp;#x7F; &amp;#x9F;</dd>
19137 <dt>Surrogate</dt>
19138 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
19139 <dt>This is an okay astral character</dt>
19140 <dd>💩</dd>
19141 </dl>
19142 !! end
19143
19144 !! test
19145 __FORCETOC__ override
19146 !! wikitext
19147 __NEWSECTIONLINK__
19148 __FORCETOC__
19149 !! html/php
19150 <p><br />
19151 </p>
19152 !! end
19153
19154 !! test
19155 ISBN code coverage
19156 !! wikitext
19157 ISBN 978-0-1234-56&#x20;789
19158 !! html
19159 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
19160 </p>
19161 !! html+tidy
19162 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
19163 !! html/parsoid
19164 <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>
19165 !! end
19166
19167 !! test
19168 ISBN followed by 5 spaces
19169 !! wikitext
19170 ISBN
19171 !! html
19172 <p>ISBN
19173 </p>
19174 !! end
19175
19176 !! test
19177 Double ISBN
19178 !! wikitext
19179 ISBN ISBN 1234567890
19180 !! html/php
19181 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19182 </p>
19183 !! html/parsoid
19184 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
19185 !! end
19186
19187 # Uppercase X and lowercase x as well
19188 !! test
19189 ISBN with an X
19190 !! wikitext
19191 ISBN 3-462-04561-X
19192 ISBN 3-462-04561-x
19193 ISBN 080442957X
19194 ISBN 080442957x
19195 ISBN 978080442957X
19196 ISBN 978080442957x
19197 !! html/php
19198 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
19199 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
19200 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
19201 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
19202 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
19203 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
19204 </p>
19205 !! html/parsoid
19206 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
19207 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
19208 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
19209 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
19210 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
19211 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
19212 !! end
19213
19214 !! test
19215 ISBN with empty prefix (parsoid test)
19216 !! wikitext
19217 ISBN 1234567890
19218 !! html/php
19219 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19220 </p>
19221 !! html/parsoid
19222 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
19223 !! end
19224
19225 !! test
19226 Bug 22905: <abbr> followed by ISBN followed by </a>
19227 !! wikitext
19228 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
19229 !! html/php
19230 <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>
19231 </p>
19232 !! html/parsoid
19233 <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>
19234 !! end
19235
19236 !! test
19237 Double RFC
19238 !! wikitext
19239 RFC RFC 1234
19240 !! html
19241 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
19242 </p>
19243 !! end
19244
19245 !! test
19246 Double RFC with a wiki link
19247 !! wikitext
19248 RFC [[RFC 1234]]
19249 !! html
19250 <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>
19251 </p>
19252 !! end
19253
19254 !! test
19255 RFC code coverage
19256 !! wikitext
19257 RFC 983&#x20;987
19258 !! html
19259 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
19260 </p>
19261 !! html+tidy
19262 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
19263 !! end
19264
19265 !! test
19266 Centre-aligned image
19267 !! wikitext
19268 [[Image:foobar.jpg|centre]]
19269 !! html
19270 <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>
19271
19272 !!end
19273
19274 !! test
19275 None-aligned image
19276 !! wikitext
19277 [[Image:foobar.jpg|none]]
19278 !! html
19279 <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>
19280
19281 !!end
19282
19283 !! test
19284 Width + Height sized image (using px) (height is ignored)
19285 !! wikitext
19286 [[Image:foobar.jpg|640x480px]]
19287 !! html
19288 <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>
19289 </p>
19290 !!end
19291
19292 !! test
19293 Width-sized image (using px, no following whitespace)
19294 !! wikitext
19295 [[Image:foobar.jpg|640px]]
19296 !! html
19297 <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>
19298 </p>
19299 !!end
19300
19301 !! test
19302 Width-sized image (using px, with following whitespace - test regression from r39467)
19303 !! wikitext
19304 [[Image:foobar.jpg|640px ]]
19305 !! html
19306 <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>
19307 </p>
19308 !!end
19309
19310 !! test
19311 Width-sized image (using px, with preceding whitespace - test regression from r39467)
19312 !! wikitext
19313 [[Image:foobar.jpg| 640px]]
19314 !! html
19315 <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>
19316 </p>
19317 !!end
19318
19319 !! test
19320 Image with page parameter
19321 !! options
19322 djvu
19323 !! wikitext
19324 [[File:LoremIpsum.djvu|page=2]]
19325 !! html/php
19326 <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>
19327 </p>
19328 !! html/parsoid
19329 <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>
19330 !! end
19331
19332 !! test
19333 Another italics / bold test
19334 !! wikitext
19335 ''' ''x'
19336 !! html
19337 <pre>'<i> </i>x'
19338 </pre>
19339 !!end
19340
19341 # FIXME: The php output seems broken. It's interleaving some open/close tags.
19342 !! test
19343 dt/dd/dl test
19344 !! wikitext
19345 :;;;::
19346 !! html/php
19347 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
19348
19349 !! html/parsoid
19350 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
19351
19352 !!end
19353
19354
19355 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
19356 !! test
19357 Images with the "|" character in the comment
19358 !! wikitext
19359 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
19360 !! html/php
19361 <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>
19362
19363 !! html/parsoid
19364 <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>
19365 !! end
19366
19367 !! test
19368 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
19369 !! wikitext
19370 <html><script>alert(1);</script></html>
19371 !! html
19372 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
19373 </p>
19374 !! end
19375
19376 !! test
19377 HTML with raw HTML ($wgRawHtml==true)
19378 !! options
19379 wgRawHtml=1
19380 !! wikitext
19381 <html><script>alert(1);</script></html>
19382 !! html
19383 <p><script>alert(1);</script>
19384 </p>
19385 !! end
19386
19387 !! test
19388 Parents of subpages, one level up
19389 !! options
19390 subpage title=[[Subpage test/L1/L2/L3]]
19391 !! wikitext
19392 [[../|L2]]
19393 !! html
19394 <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>
19395 </p>
19396 !! end
19397
19398
19399 !! test
19400 Parents of subpages, one level up, not named
19401 !! options
19402 subpage title=[[Subpage test/L1/L2/L3]]
19403 !! wikitext
19404 [[../]]
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)">Subpage test/L1/L2</a>
19407 </p>
19408 !! end
19409
19410
19411
19412 !! test
19413 Parents of subpages, two levels up
19414 !! options
19415 subpage title=[[Subpage test/L1/L2/L3]]
19416 !! wikitext
19417 [[../../|L1]]2
19418
19419 [[../../|L1]]l
19420 !! html
19421 <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
19422 </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>
19423 </p>
19424 !! end
19425
19426 !! test
19427 Parents of subpages, two levels up, without trailing slash or name.
19428 !! options
19429 subpage title=[[Subpage test/L1/L2/L3]]
19430 !! wikitext
19431 [[../..]]
19432 !! html
19433 <p>[[../..]]
19434 </p>
19435 !! end
19436
19437 !! test
19438 Parents of subpages, two levels up, with lots of extra trailing slashes.
19439 !! options
19440 subpage title=[[Subpage test/L1/L2/L3]]
19441 !! wikitext
19442 [[../../////]]
19443 !! html
19444 <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>
19445 </p>
19446 !! end
19447
19448 !! article
19449 Subpage test/L1/L2/L3Sibling
19450 !! text
19451 Sibling article
19452 !! endarticle
19453
19454 !! test
19455 Transclusion of a sibling page (one level up)
19456 !! options
19457 subpage title=[[Subpage test/L1/L2/L3]]
19458 !! wikitext
19459 {{../L3Sibling}}
19460 !! html
19461 <p>Sibling article
19462 </p>
19463 !! end
19464
19465 !! test
19466 Transclusion of a child page
19467 !! options
19468 subpage title=[[Subpage test/L1/L2]]
19469 !! wikitext
19470 {{/L3Sibling}}
19471 !! html
19472 <p>Sibling article
19473 </p>
19474 !! end
19475
19476 # This is wt2html only in Parsoid because we add <nowiki>
19477 # because of {{..}} and we don't expect to fix that to
19478 # eliminate the nowikis selective for {{..}} markup.
19479 !! test
19480 Non-transclusion because of too many up levels
19481 !! options
19482 subpage title=[[Subpage test/L1/L2/L3]]
19483 parsoid=wt2html
19484 !! wikitext
19485 {{../../../../More than parent}}
19486 !! html/php
19487 <p>{{../../../../More than parent}}
19488 </p>
19489 !! html/parsoid
19490 <p>{{../../../../More than parent}}</p>
19491 !! end
19492
19493 !! test
19494 Definition list code coverage
19495 !! wikitext
19496 ; title : def
19497 ; title : def
19498 ;title: def
19499 !! html/php
19500 <dl><dt> title &#160;</dt>
19501 <dd> def</dd>
19502 <dt> title&#160;</dt>
19503 <dd> def</dd>
19504 <dt>title</dt>
19505 <dd> def</dd></dl>
19506
19507 !! html/parsoid
19508 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
19509 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
19510 <dt>title</dt><dd> def</dd></dl>
19511 !! end
19512
19513 !! test
19514 Don't fall for the self-closing div
19515 !! wikitext
19516 <div>hello world</div/>
19517 !! html
19518 <div>hello world</div>
19519
19520 !! end
19521
19522 !! test
19523 MSGNW magic word
19524 !! wikitext
19525 {{MSGNW:msg}}
19526 !! html/php
19527 <p>&#91;&#91;:Template:Msg&#93;&#93;
19528 </p>
19529 !! end
19530
19531 !! test
19532 RAW magic word
19533 !! wikitext
19534 {{RAW:QUERTY}}
19535 !! html
19536 <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>
19537 </p>
19538 !! end
19539
19540 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
19541 !! test
19542 Always escape literal '>' in output, not just after '<'
19543 !! wikitext
19544 ><>
19545 !! html
19546 <p>&gt;&lt;&gt;
19547 </p>
19548 !! end
19549
19550 !! test
19551 Template caching
19552 !! wikitext
19553 {{Test}}
19554 {{Test}}
19555 !! html
19556 <p>This is a test template
19557 This is a test template
19558 </p>
19559 !! end
19560
19561
19562 !! article
19563 MediaWiki:Fake
19564 !! text
19565 ==header==
19566 !! endarticle
19567
19568 !! test
19569 Inclusion of !userCanEdit() content
19570 !! wikitext
19571 {{MediaWiki:Fake}}
19572 !! html
19573 <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>
19574
19575 !! end
19576
19577
19578 !! test
19579 Out-of-order TOC heading levels
19580 !! wikitext
19581 ==2==
19582 ======6======
19583 ===3===
19584 =1=
19585 =====5=====
19586 ==2==
19587 !! html
19588 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19589 <ul>
19590 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
19591 <ul>
19592 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
19593 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
19594 </ul>
19595 </li>
19596 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
19597 <ul>
19598 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
19599 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
19600 </ul>
19601 </li>
19602 </ul>
19603 </div>
19604
19605 <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>
19606 <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>
19607 <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>
19608 <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>
19609 <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>
19610 <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>
19611
19612 !! end
19613
19614
19615 !! test
19616 ISBN with a dummy number
19617 !! wikitext
19618 ISBN ---
19619 !! html
19620 <p>ISBN ---
19621 </p>
19622 !! end
19623
19624
19625 !! test
19626 ISBN with space-delimited number
19627 !! wikitext
19628 ISBN 92 9017 032 8
19629 !! html
19630 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
19631 </p>
19632 !! end
19633
19634
19635 !! test
19636 ISBN with multiple spaces, no number
19637 !! wikitext
19638 ISBN foo
19639 !! html
19640 <p>ISBN foo
19641 </p>
19642 !! end
19643
19644
19645 !! test
19646 ISBN length
19647 !! wikitext
19648 ISBN 123456789
19649
19650 ISBN 1234567890
19651
19652 ISBN 12345678901
19653 !! html
19654 <p>ISBN 123456789
19655 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19656 </p><p>ISBN 12345678901
19657 </p>
19658 !! end
19659
19660
19661 !! test
19662 ISBN with trailing year (bug 8110)
19663 !! wikitext
19664 ISBN 1-234-56789-0 - 2006
19665
19666 ISBN 1 234 56789 0 - 2006
19667 !! html
19668 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
19669 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
19670 </p>
19671 !! end
19672
19673
19674 !! test
19675 anchorencode
19676 !! wikitext
19677 {{anchorencode:foo bar©#%n}}
19678 !! html
19679 <p>foo_bar.C2.A9.23.25n
19680 </p>
19681 !! end
19682
19683 !! test
19684 anchorencode trims spaces
19685 !! wikitext
19686 {{anchorencode: __pretty__please__}}
19687 !! html
19688 <p>pretty_please
19689 </p>
19690 !! end
19691
19692 !! test
19693 anchorencode deals with links
19694 !! wikitext
19695 {{anchorencode: [[hello|world]] [[hi]]}}
19696 !! html
19697 <p>world_hi
19698 </p>
19699 !! end
19700
19701 !! test
19702 anchorencode deals with templates
19703 !! wikitext
19704 {{anchorencode: {{Foo}} }}
19705 !! html
19706 <p>FOO
19707 </p>
19708 !! end
19709
19710 !! test
19711 anchorencode encodes like the TOC generator: (bug 18431)
19712 !! wikitext
19713 === _ +:.3A%3A&&amp;]] ===
19714 {{anchorencode: _ +:.3A%3A&&amp;]] }}
19715 __NOEDITSECTION__
19716 !! html
19717 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
19718 <p>.2B:.3A.253A.26.26.5D.5D
19719 </p>
19720 !! end
19721
19722 !! test
19723 Bug 6200: blockquotes and paragraph formatting
19724 !! wikitext
19725 <blockquote>
19726 foo
19727 </blockquote>
19728
19729 bar
19730
19731 baz
19732 !! html
19733 <blockquote>
19734 <p>foo
19735 </p>
19736 </blockquote>
19737 <p>bar
19738 </p>
19739 <pre>baz
19740 </pre>
19741 !! end
19742
19743 !! test
19744 Bug 8293: Use of center tag ruins paragraph formatting
19745 !! wikitext
19746 <center>
19747 foo
19748 </center>
19749
19750 bar
19751
19752 baz
19753 !! html
19754 <center>
19755 <p>foo
19756 </p>
19757 </center>
19758 <p>bar
19759 </p>
19760 <pre>baz
19761 </pre>
19762 !! end
19763
19764 !!test
19765 Parsing of overlapping (improperly nested) inline html tags
19766 !! wikitext
19767 <span><s>x</span></s>
19768 !! html/php
19769 <p><span><s>x&lt;/span&gt;</s></span>
19770 </p>
19771 !! html/parsoid
19772 <p><span><s>x</s></span>
19773 </p>
19774 !!end
19775
19776 ###
19777 ### Language variants related tests
19778 ###
19779 !! test
19780 Self-link in language variants
19781 !! options
19782 title=[[Dunav]] language=sr
19783 !! wikitext
19784 Both [[Dunav]] and [[Дунав]] are names for this river.
19785 !! html
19786 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
19787 </p>
19788 !!end
19789
19790 !! article
19791 Дуна
19792 !! text
19793 content
19794 !! endarticle
19795
19796 !! test
19797 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
19798 !! options
19799 title=[[Duna]] language=sr
19800 !! wikitext
19801 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
19802 !! html
19803 <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.
19804 </p>
19805 !! end
19806
19807 !! test
19808 Link to a section of a variant of this title shouldn't be parsed as self-link
19809 !! options
19810 title=[[Duna]] language=sr
19811 !! wikitext
19812 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
19813 !! html
19814 <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.
19815 </p>
19816 !! end
19817
19818 !! test
19819 Link to pages in language variants
19820 !! options
19821 language=sr
19822 !! wikitext
19823 Main Page can be written as [[Маин Паге]]
19824 !! html
19825 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
19826 </p>
19827 !!end
19828
19829
19830 !! test
19831 Multiple links to pages in language variants
19832 !! options
19833 language=sr
19834 !! wikitext
19835 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
19836 !! html
19837 <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>.
19838 </p>
19839 !!end
19840
19841
19842 !! test
19843 Simple template in language variants
19844 !! options
19845 language=sr
19846 !! wikitext
19847 {{тест}}
19848 !! html
19849 <p>This is a test template
19850 </p>
19851 !! end
19852
19853
19854 !! test
19855 Template with explicit namespace in language variants
19856 !! options
19857 language=sr
19858 !! wikitext
19859 {{Template:тест}}
19860 !! html
19861 <p>This is a test template
19862 </p>
19863 !! end
19864
19865
19866 !! test
19867 Basic test for template parameter in language variants
19868 !! options
19869 language=sr
19870 !! wikitext
19871 {{парамтест|param=foo}}
19872 !! html
19873 <p>This is a test template with parameter foo
19874 </p>
19875 !! end
19876
19877 !! test
19878 Simple category in language variants
19879 !! options
19880 language=sr cat
19881 !! wikitext
19882 [[Category:МедиаWики Усер'с Гуиде]]
19883 !! html/php
19884 cat=МедиаWики_Усер'с_Гуиде sort=
19885 !! html/parsoid
19886 <link rel="mw:PageProp/Category" href="./Категорија:МедиаWики_Усер'с_Гуиде" data-parsoid='{"stx":"simple","a":{"href":"./Категорија:МедиаWики_Усер&#39;с_Гуиде"},"sa":{"href":"Category:МедиаWики Усер&#39;с Гуиде"}}'/>
19887 !! end
19888
19889 !! article
19890 Category:分类
19891 !! text
19892 blah
19893 !! endarticle
19894
19895 !! article
19896 Category:分類
19897 !! text
19898 blah
19899 !! endarticle
19900
19901 ## We used to, but no longer wt2wt this test since the default serializer
19902 ## will normalize all categories to serialize on their own line.
19903 ## This wikitext usage is going to be fairly uncommon in production and
19904 ## selser will take care of preserving formatting in those scenarios.
19905 !! test
19906 Don't convert blue categorylinks to another variant (bug 33210)
19907 !! options
19908 cat
19909 language=zh
19910 parsoid=wt2html
19911 !! wikitext
19912 [[A]][[Category:分类]]
19913 !! html/php
19914 cat=分类 sort=
19915 !! html/parsoid
19916 <p><a rel="mw:WikiLink" href="A" title="A">A</a></p>
19917 <link rel="mw:PageProp/Category" href="Category:分类"/>
19918 !! end
19919
19920 !! test
19921 Stripping -{}- tags (language variants)
19922 !! options
19923 language=sr
19924 !! wikitext
19925 Latin proverb: -{Ne nuntium necare}-
19926 !! html
19927 <p>Latin proverb: Ne nuntium necare
19928 </p>
19929 !! end
19930
19931
19932 !! test
19933 Prevent conversion with -{}- tags (language variants)
19934 !! options
19935 language=sr variant=sr-ec
19936 !! wikitext
19937 Latinski: -{Ne nuntium necare}-
19938 !! html
19939 <p>Латински: Ne nuntium necare
19940 </p>
19941 !! end
19942
19943
19944 !! test
19945 Prevent conversion of text 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 links with -{}- tags (language variants)
19958 !! options
19959 language=sr variant=sr-ec
19960 !! wikitext
19961 -{[[Main Page]]}-
19962 !! html
19963 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19964 </p>
19965 !! end
19966
19967
19968 !! test
19969 -{}- tags within headlines (within html for parserConvert())
19970 !! options
19971 language=sr variant=sr-ec
19972 !! wikitext
19973 == -{Naslov}- ==
19974 !! html
19975 <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>
19976
19977 !! end
19978
19979
19980 !! test
19981 Explicit definition of language variant alternatives
19982 !! options
19983 language=zh variant=zh-tw
19984 !! wikitext
19985 -{zh:China;zh-tw:Taiwan}-, not China
19986 !! html
19987 <p>Taiwan, not China
19988 </p>
19989 !! end
19990
19991
19992 !! test
19993 Conversion around HTML tags
19994 !! options
19995 language=sr variant=sr-ec
19996 !! wikitext
19997 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
19998 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
19999 !! html
20000 <p>
20001 <span title="ЛаCтин">ски</span>
20002 </p>
20003 !! end
20004
20005
20006 !! test
20007 Explicit session-wise language variant mapping (A flag and - flag)
20008 !! options
20009 language=zh variant=zh-tw
20010 !! wikitext
20011 Taiwan is not China.
20012 But -{A|zh:China;zh-tw:Taiwan}- is China,
20013 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
20014 and -{China}- is China.
20015 !! html
20016 <p>Taiwan is not China.
20017 But Taiwan is Taiwan,
20018 (This should be stripped!)
20019 and China is China.
20020 </p>
20021 !! end
20022
20023 !! test
20024 Explicit session-wise language variant mapping (H flag for hide)
20025 !! options
20026 language=zh variant=zh-tw
20027 !! wikitext
20028 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
20029 Taiwan is China.
20030 !! html
20031 <p>(This should be stripped!)
20032 Taiwan is Taiwan.
20033 </p>
20034 !! end
20035
20036 !! test
20037 Adding explicit conversion rule for title (T flag)
20038 !! options
20039 language=zh variant=zh-tw showtitle
20040 !! wikitext
20041 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20042 !! html
20043 Taiwan
20044 <p>Should be stripped!
20045 </p>
20046 !! end
20047
20048 !! test
20049 Testing that changing the language variant here in the tests actually works
20050 !! options
20051 language=zh variant=zh showtitle
20052 !! wikitext
20053 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20054 !! html
20055 China
20056 <p>Should be stripped!
20057 </p>
20058 !! end
20059
20060 !! test
20061 Recursive conversion of alt and title attrs shouldn't clear converter state
20062 !! options
20063 language=zh variant=zh-cn showtitle
20064 !! wikitext
20065 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
20066 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
20067 !! html
20068 China
20069 <p>
20070 Should be stripped<span title="Exclamation">!</span>
20071 </p>
20072 !! end
20073
20074 !! test
20075 Bug 24072: more test on conversion rule for title
20076 !! options
20077 language=zh variant=zh-tw showtitle
20078 !! wikitext
20079 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20080 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
20081 !! html
20082 Taiwan
20083 <p>This should be stripped!
20084 This won't take interferes with the title rule.
20085 </p>
20086 !! end
20087
20088 !! test
20089 Partly disable title conversion if variant == main language code
20090 !! options
20091 language=zh variant=zh title=[[ZH]] showtitle
20092 !! wikitext
20093 -{T|zh-cn:CN;zh-tw:TW}-
20094 !! html
20095 ZH
20096 <p>
20097 </p>
20098 !! end
20099
20100 !! test
20101 Partly disable title conversion if variant == main language code, more
20102 !! options
20103 language=zh variant=zh title=[[ZH]] showtitle
20104 !! wikitext
20105 -{T|TW}-
20106 !! html
20107 ZH
20108 <p>
20109 </p>
20110 !! end
20111
20112 !! test
20113 Raw output of variant escape tags (R flag)
20114 !! options
20115 language=zh variant=zh-tw
20116 !! wikitext
20117 Raw: -{R|zh:China;zh-tw:Taiwan}-
20118 !! html
20119 <p>Raw: zh:China;zh-tw:Taiwan
20120 </p>
20121 !! end
20122
20123 !! test
20124 Strings evaluating false shouldn't be ignored by Language converter (T51072)
20125 !! options
20126 language=zh variant=zh-cn
20127 !! input
20128 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
20129 !! result
20130 <p>0
20131 </p>
20132 !! end
20133
20134 !! test
20135 Conversion rules from [numeric-only string] to [something else] (T48634)
20136 !! options
20137 language=zh variant=zh-cn
20138 !! input
20139 -{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
20140 !! result
20141 <p>D12345EE12345
20142 </p>
20143 !! end
20144
20145 !! test
20146 Bidirectional converter rule entries with an empty value should be ignored (T53551)
20147 !! options
20148 language=zh variant=zh-cn
20149 !! input
20150 -{H|zh-cn:foo;zh-tw:;}-foobar
20151 !! result
20152 <p>foobar
20153 </p>
20154 !! end
20155
20156 !! test
20157 Unidirectional converter rule entries with an empty "from" string should be ignored (T53551)
20158 !! options
20159 language=zh variant=zh-cn
20160 !! input
20161 -{H|=>zh-cn:foo;}-foobar
20162 !! result
20163 <p>foobar
20164 </p>
20165 !! end
20166
20167 !! test
20168 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
20169 !! options
20170 language=zh variant=zh-cn
20171 !! input
20172 -{H|}-foobar
20173 !! result
20174 <p>foobar
20175 </p>
20176 !! end
20177
20178 !! test
20179 Nested using of manual convert syntax
20180 !! options
20181 language=zh variant=zh-hk
20182 !! wikitext
20183 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
20184 !! html
20185 <p>Nested: Hello Hong Kong!
20186 </p>
20187 !! end
20188
20189 # Since Parsoid is starting to emit canonical wikitext for links,
20190 # [http://example.com http://example.com] will not RT back to that
20191 # form anymore.
20192 !! test
20193 Proper conversion of text in external links
20194 !! options
20195 language=sr variant=sr-ec
20196 parsoid=wt2html
20197 !! wikitext
20198 http://www.google.com
20199 gopher://www.google.com
20200 [http://www.google.com http://www.google.com]
20201 [gopher://www.google.com gopher://www.google.com]
20202 [https://www.google.com irc://www.google.com]
20203 [ftp://www.google.com www.google.com/ftp://dir]
20204 [//www.google.com www.google.com]
20205 !! html/php
20206 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
20207 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
20208 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
20209 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
20210 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
20211 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
20212 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
20213 </p>
20214 !! html/parsoid
20215 <p><a rel="mw:ExtLink" href="http://www.google.com">http://www.google.com</a>
20216 <a rel="mw:ExtLink" href="gopher://www.google.com">gopher://www.google.com</a>
20217 <a rel="mw:ExtLink" href="http://www.google.com">http://www.google.com</a>
20218 <a rel="mw:ExtLink" href="gopher://www.google.com">gopher://www.google.com</a>
20219 <a rel="mw:ExtLink" href="https://www.google.com">irc://www.google.com</a>
20220 <a rel="mw:ExtLink" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
20221 <a rel="mw:ExtLink" href="//www.google.com">www.гоогле.цом</a></p>
20222 !! end
20223
20224 !! test
20225 Do not convert roman numbers to language variants
20226 !! options
20227 language=sr variant=sr-ec
20228 !! wikitext
20229 Fridrih IV je car.
20230 !! html
20231 <p>Фридрих IV је цар.
20232 </p>
20233 !! end
20234
20235 !! test
20236 Unclosed language converter markup "-{"
20237 !! options
20238 language=sr
20239 !! wikitext
20240 -{T|hello
20241 !! html
20242 <p>-{T|hello
20243 </p>
20244 !! end
20245
20246 !! test
20247 Don't convert raw rule "-{R|=&gt;}-" to "=>"
20248 !! options
20249 language=sr
20250 !! wikitext
20251 -{R|=&gt;}-
20252 !! html
20253 <p>=&gt;
20254 </p>
20255 !!end
20256
20257 !! test
20258 Don't break link parsing if language converter markup is in the caption.
20259 !! options
20260 language=sr variant=sr-ec
20261 !! wikitext
20262 [[Main Page|-{R|main page}-]]
20263 !! html
20264 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
20265 </p>
20266 !! end
20267
20268 # FIXME: This test is currently broken in the PHP parser (bug 52661)
20269 !! test
20270 Don't break image parsing if language converter markup is in the caption.
20271 !! options
20272 language=sr
20273 !! wikitext
20274 [[File:Foobar.jpg|-{R|caption}-]]
20275 !! html/parsoid
20276 <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>
20277 </p>
20278 !! end
20279
20280 # FIXME: This test is currently broken in the PHP parser (bug 52661)
20281 !! test
20282 Don't break list handling if language converter markup is in the item.
20283 !! options
20284 language=zh variant=zh-cn
20285 !! wikitext
20286 ;-{zh-cn:AAA;zh-tw:BBB}-
20287 !! html/php
20288 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
20289
20290 !! html/parsoid
20291 <dl><dt>AAA
20292 </dt></dl>
20293 !! end
20294
20295 # FIXME: This test is currently broken in the PHP parser (bug 52661)
20296 !! test
20297 Don't break table handling if language converter markup is in the cell.
20298 !! options
20299 language=sr variant=sr-ec
20300 !! wikitext
20301 {|
20302 |-
20303 | -{R|B}-
20304 |}
20305 !! html/php
20306 <table>
20307
20308 <tr>
20309 <td>Б}-
20310 </td></tr></table>
20311
20312 !! html/parsoid
20313 <table>
20314
20315 <tr>
20316 <td> B
20317 </td></tr></table>
20318
20319 !! end
20320
20321 !! test
20322 Bug 529: Uncovered bullet
20323 !! wikitext
20324 * Foo {{bullet}}
20325 !! html
20326 <ul><li> Foo </li>
20327 <li> Bar</li></ul>
20328
20329 !! end
20330
20331 # Plain MediaWiki does not remove empty lists, but tidy actually does.
20332 # Templates in Wikipedia rely on this behavior, as tidy has always been
20333 # enabled there. These tests are normally run *without* tidy, so specify the
20334 # full output here.
20335 # To test realistic parsing behavior, apply a tidy-like transformation to both
20336 # the expected output and your parser's output.
20337 !! test
20338 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
20339 !! wikitext
20340 ******* Foo {{bullet}}
20341 !! html
20342 <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>
20343 <li> Bar</li></ul>
20344
20345 !! end
20346
20347 !! test
20348 Bug 529: Uncovered table already at line-start
20349 !! wikitext
20350 x
20351
20352 {{table}}
20353 y
20354 !! html
20355 <p>x
20356 </p>
20357 <table>
20358 <tr>
20359 <td> 1 </td>
20360 <td> 2
20361 </td></tr>
20362 <tr>
20363 <td> 3 </td>
20364 <td> 4
20365 </td></tr></table>
20366 <p>y
20367 </p>
20368 !! end
20369
20370 !! test
20371 Bug 529: Uncovered bullet in parser function result
20372 !! wikitext
20373 * Foo {{lc:{{bullet}} }}
20374 !! html
20375 <ul><li> Foo </li>
20376 <li> bar</li></ul>
20377
20378 !! end
20379
20380 !! test
20381 Bug 5678: Double-parsed template argument
20382 !! wikitext
20383 {{lc:{{{1}}}|hello}}
20384 !! html
20385 <p>{{{1}}}
20386 </p>
20387 !! end
20388
20389 !! test
20390 Bug 5678: Double-parsed template invocation
20391 !! wikitext
20392 {{lc:{{paramtest {{!}} param = hello }} }}
20393 !! html
20394 <p>{{paramtest | param = hello }}
20395 </p>
20396 !! end
20397
20398 !! test
20399 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
20400 !! options
20401 language=cs
20402 title=[[Main Page]]
20403 !! wikitext
20404 {{PRVNÍVELKÉ:ěščř}}
20405 {{prvnívelké:ěščř}}
20406 {{PRVNÍMALÉ:ěščř}}
20407 {{prvnímalé:ěščř}}
20408 {{MALÁ:ěščř}}
20409 {{malá:ěščř}}
20410 {{VELKÁ:ěščř}}
20411 {{velká:ěščř}}
20412 !! html
20413 <p>Ěščř
20414 Ěščř
20415 ěščř
20416 ěščř
20417 ěščř
20418 ěščř
20419 ĚŠČŘ
20420 ĚŠČŘ
20421 </p>
20422 !! end
20423
20424 !! test
20425 Morwen/13: Unclosed link followed by heading
20426 !! wikitext
20427 [[link
20428 ==heading==
20429 !! html
20430 <p>[[link
20431 </p>
20432 <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>
20433
20434 !! end
20435
20436 !! test
20437 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
20438 !! wikitext
20439 {{foo|
20440 =heading=
20441 !! html
20442 <p>{{foo|
20443 </p>
20444 <h1><span class="mw-headline" id="heading">heading</span></h1>
20445
20446 !! end
20447
20448 !! test
20449 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
20450 !! wikitext
20451 {{foo|
20452 ==heading==
20453 !! html
20454 <p>{{foo|
20455 </p>
20456 <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>
20457
20458 !! end
20459
20460 !! test
20461 Tildes in comments
20462 !! options
20463 pst
20464 !! wikitext
20465 <!-- ~~~~ -->
20466 !! html/php
20467 <!-- ~~~~ -->
20468 !! end
20469
20470 !! test
20471 Paragraphs inside divs (no extra line breaks)
20472 !! wikitext
20473 <div>Line one
20474
20475 Line two</div>
20476 !! html
20477 <div>Line one
20478 Line two</div>
20479
20480 !! end
20481
20482 !! test
20483 Paragraphs inside divs (extra line break on open)
20484 !! wikitext
20485 <div>
20486 Line one
20487
20488 Line two</div>
20489 !! html
20490 <div>
20491 <p>Line one
20492 </p>
20493 Line two</div>
20494
20495 !! end
20496
20497 !! test
20498 Paragraphs inside divs (extra line break on close)
20499 !! wikitext
20500 <div>Line one
20501
20502 Line two
20503 </div>
20504 !! html
20505 <div>Line one
20506 <p>Line two
20507 </p>
20508 </div>
20509
20510 !! end
20511
20512 !! test
20513 Paragraphs inside divs (extra line break on open and close)
20514 !! wikitext
20515 <div>
20516 Line one
20517
20518 Line two
20519 </div>
20520 !! html
20521 <div>
20522 <p>Line one
20523 </p><p>Line two
20524 </p>
20525 </div>
20526
20527 !! end
20528
20529 !! test
20530 Nesting tags, paragraphs on lines which begin with <div>
20531 !! wikitext
20532 <div></div><strong>A
20533 B</strong>
20534 !! html/php+tidy
20535 <p><strong>A</strong></p>
20536 <p><strong>B</strong></p>
20537 !! html/parsoid
20538 <div></div>
20539 <p><strong>A
20540 B</strong>
20541 </p>
20542 !! end
20543
20544 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
20545 !! test
20546 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
20547 !! wikitext
20548 <blockquote>Line one
20549
20550 Line two</blockquote>
20551 !! html
20552 <blockquote>Line one
20553 Line two</blockquote>
20554
20555 !! html+tidy
20556 <blockquote>
20557 <p>Line one Line two</p>
20558 </blockquote>
20559 !! end
20560
20561 !! test
20562 Bug 6200: paragraphs inside blockquotes (extra line break on open)
20563 !! wikitext
20564 <blockquote>
20565 Line one
20566
20567 Line two</blockquote>
20568 !! html
20569 <blockquote>
20570 <p>Line one
20571 </p>
20572 Line two</blockquote>
20573
20574 !! html+tidy
20575 <blockquote>
20576 <p>Line one</p>
20577 Line two</blockquote>
20578 !! end
20579
20580 !! test
20581 Bug 6200: paragraphs inside blockquotes (extra line break on close)
20582 !! wikitext
20583 <blockquote>Line one
20584
20585 Line two
20586 </blockquote>
20587 !! html
20588 <blockquote>Line one
20589 <p>Line two
20590 </p>
20591 </blockquote>
20592
20593 !! html+tidy
20594 <blockquote>
20595 <p>Line one</p>
20596 <p>Line two</p>
20597 </blockquote>
20598 !! end
20599
20600 !! test
20601 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
20602 !! wikitext
20603 <blockquote>
20604 Line one
20605
20606 Line two
20607 </blockquote>
20608 !! html
20609 <blockquote>
20610 <p>Line one
20611 </p><p>Line two
20612 </p>
20613 </blockquote>
20614
20615 !! html+tidy
20616 <blockquote>
20617 <p>Line one</p>
20618 <p>Line two</p>
20619 </blockquote>
20620 !! end
20621
20622 !! test
20623 Paragraphs inside blockquotes/divs (no extra line breaks)
20624 !! wikitext
20625 <blockquote><div>Line one
20626
20627 Line two</div></blockquote>
20628 !! html
20629 <blockquote><div>Line one
20630 Line two</div></blockquote>
20631
20632 !! end
20633
20634 !! test
20635 Paragraphs inside blockquotes/divs (extra line break on open)
20636 !! wikitext
20637 <blockquote><div>
20638 Line one
20639
20640 Line two</div></blockquote>
20641 !! html
20642 <blockquote><div>
20643 <p>Line one
20644 </p>
20645 Line two</div></blockquote>
20646
20647 !! end
20648
20649 !! test
20650 Paragraphs inside blockquotes/divs (extra line break on close)
20651 !! wikitext
20652 <blockquote><div>Line one
20653
20654 Line two
20655 </div></blockquote>
20656 !! html
20657 <blockquote><div>Line one
20658 <p>Line two
20659 </p>
20660 </div></blockquote>
20661
20662 !! end
20663
20664 !! test
20665 Paragraphs inside blockquotes/divs (extra line break on open and close)
20666 !! wikitext
20667 <blockquote><div>
20668 Line one
20669
20670 Line two
20671 </div></blockquote>
20672 !! html
20673 <blockquote><div>
20674 <p>Line one
20675 </p><p>Line two
20676 </p>
20677 </div></blockquote>
20678
20679 !! end
20680
20681 !! test
20682 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
20683 !! options
20684 wgLinkHolderBatchSize=0
20685 !! wikitext
20686 [[meatball:1]]
20687 [[meatball:2]]
20688 [[meatball:3]]
20689 !! html
20690 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
20691 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
20692 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
20693 </p>
20694 !! end
20695
20696 !! test
20697 Free external link invading image caption
20698 !! wikitext
20699 [[Image:Foobar.jpg|thumb|http://x|hello]]
20700 !! html
20701 <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>
20702
20703 !! end
20704
20705 !! test
20706 Bug 15196: localised external link numbers
20707 !! options
20708 language=fa
20709 !! wikitext
20710 [http://en.wikipedia.org/]
20711 !! html/php
20712 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
20713 </p>
20714 !! html/parsoid
20715 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
20716 !! end
20717
20718 !! test
20719 Multibyte character in padleft
20720 !! wikitext
20721 {{padleft:-Hello|7|Æ}}
20722 !! html
20723 <p>Æ-Hello
20724 </p>
20725 !! end
20726
20727 !! test
20728 Multibyte character in padright
20729 !! wikitext
20730 {{padright:Hello-|7|Æ}}
20731 !! html
20732 <p>Hello-Æ
20733 </p>
20734 !! end
20735
20736 !!test
20737 formatdate parser function
20738 !! wikitext
20739 {{#formatdate:2009-03-24}}
20740 !! html
20741 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
20742 </p>
20743 !! end
20744
20745 !!test
20746 formatdate parser function, with default format
20747 !! wikitext
20748 {{#formatdate:2009-03-24|mdy}}
20749 !! html
20750 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
20751 </p>
20752 !! end
20753
20754 !! test
20755 Spacing of numbers in formatted dates
20756 !! wikitext
20757 {{#formatdate:January 15}}
20758 !! html
20759 <p><span class="mw-formatted-date" title="01-15">January 15</span>
20760 </p>
20761 !! end
20762
20763 !! test
20764 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
20765 !! options
20766 language=nl title=[[MediaWiki:Common.css]]
20767 !! wikitext
20768 {{#formatdate:2009-03-24|dmy}}
20769 !! html
20770 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
20771 </p>
20772 !! end
20773
20774 #
20775 #
20776 #
20777
20778 #
20779 # Edit comments
20780 #
20781
20782 !! test
20783 Edit comment with link
20784 !! options
20785 comment
20786 !! wikitext
20787 I like the [[Main Page]] a lot
20788 !! html/php
20789 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
20790 !!end
20791
20792 !! test
20793 Edit comment with link and link text
20794 !! options
20795 comment
20796 !! wikitext
20797 I like the [[Main Page|best pages]] a lot
20798 !! html/php
20799 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
20800 !!end
20801
20802 !! test
20803 Edit comment with link and link text with suffix
20804 !! options
20805 comment
20806 !! wikitext
20807 I like the [[Main Page|best page]]s a lot
20808 !! html/php
20809 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
20810 !!end
20811
20812 !! test
20813 Edit comment with section link (non-local, eg in history list)
20814 !! options
20815 comment title=[[Main Page]]
20816 !! wikitext
20817 /* External links */ removed bogus entries
20818 !! html/php
20819 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
20820 !!end
20821
20822 !! test
20823 Edit comment with section link and text before it (non-local, eg in history list)
20824 !! options
20825 comment title=[[Main Page]]
20826 !! wikitext
20827 pre-comment text /* External links */ removed bogus entries
20828 !! html/php
20829 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>
20830 !!end
20831
20832 !! test
20833 Edit comment with section link (local, eg in diff view)
20834 !! options
20835 comment local title=[[Main Page]]
20836 !! wikitext
20837 /* External links */ removed bogus entries
20838 !! html/php
20839 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
20840 !!end
20841
20842 !! test
20843 Edit comment with subpage link (bug 14080)
20844 !! options
20845 comment
20846 subpage
20847 title=[[Subpage test]]
20848 !! wikitext
20849 Poked at a [[/subpage]] here...
20850 !! html/php
20851 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
20852 !!end
20853
20854 !! test
20855 Edit comment with subpage link and link text (bug 14080)
20856 !! options
20857 comment
20858 subpage
20859 title=[[Subpage test]]
20860 !! wikitext
20861 Poked at a [[/subpage|neat little page]] here...
20862 !! html/php
20863 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
20864 !!end
20865
20866 !! test
20867 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
20868 !! options
20869 comment
20870 title=[[Subpage test]]
20871 !! wikitext
20872 Poked at a [[/subpage]] here...
20873 !! html/php
20874 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...
20875 !!end
20876
20877 !! test
20878 Edit comment with bare anchor link (local, as on diff)
20879 !! options
20880 comment
20881 local
20882 title=[[Main Page]]
20883 !! wikitext
20884 [[#section]]
20885 !! html/php
20886 <a href="#section">#section</a>
20887 !! end
20888
20889 !! test
20890 Edit comment with bare anchor link (non-local, as on history)
20891 !! options
20892 comment
20893 title=[[Main Page]]
20894 !! wikitext
20895 [[#section]]
20896 !! html/php
20897 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
20898 !! end
20899
20900 !! test
20901 Anchor starting with underscore
20902 !! options
20903 title=[[Foo]]
20904 !! wikitext
20905 [[#_ref|One]]
20906 !! html/php
20907 <p><a href="#_ref">One</a>
20908 </p>
20909 !! html/parsoid
20910 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
20911 !! end
20912
20913 !! test
20914 Id starting with underscore
20915 !! wikitext
20916 <div id="_ref"></div>
20917 !! html/*
20918 <div id="_ref"></div>
20919
20920 !! end
20921
20922 !! test
20923 Edit comment with link with more than one pipe (T99346)
20924 !! options
20925 comment
20926 !! wikitext
20927 [[Main Page|Many|pipes]]
20928 !! html
20929 <a href="/wiki/Main_Page" title="Main Page">Many|pipes</a>
20930 !! end
20931
20932 !! test
20933 Complex edit comment with link with more than one pipe (T99346)
20934 !! options
20935 comment
20936 !! wikitext
20937 Created page with "<noinclude>[[Category:Requests for permissions/Bot|{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}]]</noinclude> === [[User:MineoBot|]] 8=== {{Request for permissions/links|Mineo..."
20938 !! html
20939 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;
20940 !! end
20941
20942 !! test
20943 Space normalisation on autocomment (bug 22784)
20944 !! options
20945 comment
20946 title=[[Main Page]]
20947 !! wikitext
20948 /* __hello__world__ */
20949 !! html/php
20950 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
20951 !! end
20952
20953 !! test
20954 percent-encoding and + signs in comments (Bug 26410)
20955 !! options
20956 comment
20957 !! wikitext
20958 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
20959 !! html/php
20960 <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>
20961 !! end
20962
20963 # Parsoid doesn't support this yet: see bug 73581
20964 # but it *should* omit the 'src' attribute if the image is bad.
20965 # PHP side of tests was disabled in
20966 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
20967 # because of issues in the PHP parserTests infrastructure
20968 # (but the output below is indeed what the PHP side emits)
20969 !! test
20970 Bad images - basic functionality
20971 !! wikitext
20972 [[File:Bad.jpg]]
20973 !! DISABLED/html/php
20974 !! html/parsoid
20975 <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>
20976 !! end
20977
20978 !! test
20979 Bad images - bug 16039: text after bad image disappears
20980 !! wikitext
20981 Foo bar
20982 [[File:Bad.jpg]]
20983 Bar foo
20984 !! DISABLED/html/php
20985 <p>Foo bar
20986 </p><p>Bar foo
20987 </p>
20988 !! html/parsoid
20989 <p>Foo bar
20990 <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>
20991 Bar foo</p>
20992 !! end
20993
20994 !! test
20995 Verify that displaytitle works (bug #22501) no displaytitle
20996 !! options
20997 showtitle
20998 !! config
20999 wgAllowDisplayTitle=true
21000 wgRestrictDisplayTitle=false
21001 !! wikitext
21002 this is not the the title
21003 !! html/php
21004 Parser test
21005 <p>this is not the the title
21006 </p>
21007 !! end
21008
21009 !! test
21010 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
21011 !! options
21012 showtitle
21013 title=[[Screen]]
21014 !! config
21015 wgAllowDisplayTitle=true
21016 wgRestrictDisplayTitle=false
21017 !! wikitext
21018 this is not the the title
21019 {{DISPLAYTITLE:whatever}}
21020 !! html/php
21021 whatever
21022 <p>this is not the the title
21023 </p>
21024 !! end
21025
21026 !! test
21027 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
21028 !! options
21029 showtitle
21030 title=[[Screen]]
21031 !! config
21032 wgAllowDisplayTitle=true
21033 wgRestrictDisplayTitle=true
21034 !! wikitext
21035 this is not the the title
21036 {{DISPLAYTITLE:whatever}}
21037 !! html/php
21038 Screen
21039 <p>this is not the the title
21040 </p>
21041 !! end
21042
21043 !! test
21044 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
21045 !! options
21046 showtitle
21047 title=[[Screen]]
21048 !! config
21049 wgAllowDisplayTitle=true
21050 wgRestrictDisplayTitle=true
21051 !! wikitext
21052 this is not the the title
21053 {{DISPLAYTITLE:screen}}
21054 !! html/php
21055 screen
21056 <p>this is not the the title
21057 </p>
21058 !! end
21059
21060 !! test
21061 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
21062 !! options
21063 showtitle
21064 title=[[Screen]]
21065 !! config
21066 wgAllowDisplayTitle=false
21067 !! wikitext
21068 this is not the the title
21069 {{DISPLAYTITLE:screen}}
21070 !! html/php
21071 Screen
21072 <p>this is not the the title
21073 <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>
21074 </p>
21075 !! end
21076
21077 !! test
21078 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
21079 !! options
21080 showtitle
21081 title=[[Screen]]
21082 !! config
21083 wgAllowDisplayTitle=false
21084 !! wikitext
21085 this is not the the title
21086 !! html/php
21087 Screen
21088 <p>this is not the the title
21089 </p>
21090 !! end
21091
21092 !! test
21093 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
21094 !! options
21095 showtitle
21096 title=[[Screen]]
21097 !! config
21098 wgAllowDisplayTitle=true
21099 wgRestrictDisplayTitle=true
21100 !! wikitext
21101 this is not the the title
21102 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
21103 !! html/php
21104 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
21105 <p>this is not the the title
21106 </p>
21107 !! end
21108
21109 !! test
21110 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
21111 !! options
21112 showtitle
21113 title=[[Screen]]
21114 !! config
21115 wgAllowDisplayTitle=true
21116 wgRestrictDisplayTitle=true
21117 !! wikitext
21118 this is not the the title
21119 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
21120 !! html/php
21121 <span style="color: red;">s</span>creen
21122 <p>this is not the the title
21123 </p>
21124 !! end
21125
21126 !! test
21127 Page status indicators: Empty name is invalid
21128 !! options
21129 showindicators
21130 !! wikitext
21131 <indicator name=" "></indicator>
21132 <indicator></indicator>
21133 !! html
21134 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
21135 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
21136 </p>
21137 !! end
21138
21139 !! test
21140 Page status indicators: Weird syntaxes that are okay
21141 !! options
21142 showindicators
21143 !! wikitext
21144 <indicator name="empty" />
21145 <indicator name="name"></indicator>
21146 !! html
21147 empty=
21148 name=
21149 <p><br />
21150 </p>
21151 !! end
21152
21153 !! test
21154 Page status indicators: Torture test
21155 !! options
21156 showindicators
21157 !! wikitext
21158 <indicator name="01">hello world</indicator>
21159 <indicator name="02">[[Main Page]]</indicator>
21160 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
21161 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
21162 <indicator name="05">* foo
21163 * bar</indicator>
21164 <indicator name="06"><nowiki>foo</nowiki></indicator>
21165 <indicator name="07"> Preformatted</indicator>
21166 <indicator name="08"><div>Broken tag</indicator>
21167 <indicator name="09">{| class=wikitable
21168 | cell
21169 |}</indicator>
21170 <indicator name="10">Two
21171
21172 paragraphs</indicator>
21173 !! html
21174 01=hello world
21175 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
21176 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" />
21177 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>
21178 05=<ul><li> foo</li>
21179 <li> bar</li></ul>
21180
21181 06=foo
21182 07=<pre>Preformatted
21183 </pre>
21184 08=<div>Broken tag</div>
21185
21186 09=<table class="wikitable">
21187 <tr>
21188 <td> cell
21189 </td></tr></table>
21190
21191 10=<p>Two
21192 </p><p>paragraphs
21193 </p>
21194 <p><br />
21195 </p><p><br />
21196 </p><p><br />
21197 </p><p><br />
21198 </p><p><br />
21199 </p>
21200 !! end
21201
21202 !! test
21203 preload: check <noinclude> and <includeonly>
21204 !! options
21205 preload
21206 !! wikitext
21207 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
21208 !! html/php
21209 Hello kind world.
21210 !! end
21211
21212 !! test
21213 preload: check <onlyinclude>
21214 !! options
21215 preload
21216 !! wikitext
21217 Goodbye <onlyinclude>Hello world</onlyinclude>
21218 !! html/php
21219 Hello world
21220 !! end
21221
21222 !! test
21223 preload: can pass tags through if we want to
21224 !! options
21225 preload
21226 !! wikitext
21227 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
21228 !! html/php
21229 <includeonly>Hello world</includeonly>
21230 !! end
21231
21232 !! test
21233 preload: check that it doesn't try to do tricks
21234 !! options
21235 preload
21236 !! wikitext
21237 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
21238 !! html/php
21239 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
21240 !! end
21241
21242 !! test
21243 Play a bit with r67090 and bug 3158
21244 !! wikitext
21245 <div style="width:50% !important">&nbsp;</div>
21246 <div style="width:50%&nbsp;!important">&nbsp;</div>
21247 <div style="width:50%&#160;!important">&nbsp;</div>
21248 <div style="border : solid;">&nbsp;</div>
21249 !! html/php
21250 <div style="width:50% !important">&#160;</div>
21251 <div style="width:50% !important">&#160;</div>
21252 <div style="width:50% !important">&#160;</div>
21253 <div style="border&#160;: solid;">&#160;</div>
21254
21255 !! html/parsoid
21256 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
21257 <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>
21258 <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>
21259 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
21260
21261 !! end
21262
21263 !! test
21264 HTML5 data attributes
21265 !! wikitext
21266 <span data-foo="bar">Baz</span>
21267 <p data-abc-def_hij="">Quuz</p>
21268 !! html/php
21269 <p><span data-foo="bar">Baz</span>
21270 </p>
21271 <p data-abc-def_hij="">Quuz</p>
21272
21273 !! html/parsoid
21274 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
21275 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
21276 !! end
21277
21278 !! test
21279 Strip reserved data attributes
21280 !! wikitext
21281 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
21282 !! html/php
21283 <div data-ok="fred">d</div>
21284
21285 !! html/parsoid
21286 <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>
21287 !! end
21288
21289 !! test
21290 percent-encoding and + signs in internal links (Bug 26410)
21291 !! wikitext
21292 [[User:+%]] [[Page+title%]]
21293 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
21294 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
21295 [[%33%45]] [[%33%45+]]
21296 !! html/php
21297 <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>
21298 <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>
21299 <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>
21300 <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>
21301 </p>
21302 !! html/parsoid
21303 <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>
21304 <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>
21305 <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>
21306 <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>
21307 !! end
21308
21309 !! test
21310 Special characters in embedded file links (bug 27679)
21311 !! wikitext
21312 [[File:Contains & ampersand.jpg]]
21313 [[File:Does not exist.jpg|Title with & ampersand]]
21314 !! html/php
21315 <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>
21316 <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>
21317 </p>
21318 !! html/parsoid
21319 <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>
21320 <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>
21321 !! end
21322
21323 !! test
21324 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
21325 !! wikitext
21326 Text&apos;s been normalized?
21327 !! html
21328 <p>Text&#39;s been normalized?
21329 </p>
21330 !! end
21331
21332 !! test
21333 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
21334 !! wikitext
21335 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
21336 !! html
21337 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
21338 </p>
21339 !! end
21340
21341 !! test
21342 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
21343 !! wikitext
21344 [http://www.example.org/ ideograms]
21345 !! html
21346 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
21347 </p>
21348 !! end
21349
21350 !! test
21351 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
21352 !! wikitext
21353 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
21354 !! html
21355 <p><img src="http://www.example.org/pic.png" alt="pic.png"/> &lt;-- U+3000 (vim: ^Vu3000)
21356 </p>
21357 !! end
21358
21359 !! article
21360 Mediawiki:loop1
21361 !! text
21362 {{Identical|A}}
21363 !! endarticle
21364
21365 !! article
21366 Mediawiki:loop2
21367 !! text
21368 {{Identical|B}}
21369 !! endarticle
21370
21371 !! article
21372 Template:Identical
21373 !! text
21374 {{int:loop1}}
21375 {{int:loop2}}
21376 !! endarticle
21377
21378 !! test
21379 Bug 31098 Template which includes system messages which includes the template
21380 !! wikitext
21381 {{Identical}}
21382 !! html
21383 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
21384 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
21385 </p>
21386 !! end
21387
21388 !! test
21389 Bug31490 Turkish: ucfirst 'blah'
21390 !! options
21391 language=tr
21392 !! wikitext
21393 {{ucfirst:blah}}
21394 !! html
21395 <p>Blah
21396 </p>
21397 !! end
21398
21399 !! test
21400 Bug31490 Turkish: ucfirst 'ix'
21401 !! options
21402 language=tr
21403 !! wikitext
21404 {{ucfirst:ix}}
21405 !! html
21406 <p>İx
21407 </p>
21408 !! end
21409
21410 !! test
21411 Bug31490 Turkish: lcfirst 'BLAH'
21412 !! options
21413 language=tr
21414 !! wikitext
21415 {{lcfirst:BLAH}}
21416 !! html
21417 <p>bLAH
21418 </p>
21419 !! end
21420
21421 !! test
21422 Bug31490 Turkish: ucfırst (with a dotless i)
21423 !! options
21424 language=tr
21425 !! wikitext
21426 {{ucfırst:blah}}
21427 !! html
21428 <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>
21429 </p>
21430 !! end
21431
21432 !! test
21433 Bug31490 ucfırst (with a dotless i) with English language
21434 !! options
21435 language=en
21436 !! wikitext
21437 {{ucfırst:blah}}
21438 !! html
21439 <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>
21440 </p>
21441 !! end
21442
21443 !! test
21444 Bug 26375: TOC with italics
21445 !! options
21446 title=[[Main Page]]
21447 !! wikitext
21448 __TOC__
21449 == ''Lost'' episodes ==
21450 !! html
21451 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21452 <ul>
21453 <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>
21454 </ul>
21455 </div>
21456
21457 <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>
21458
21459 !! end
21460
21461 !! test
21462 Bug 26375: TOC with bold
21463 !! options
21464 title=[[Main Page]]
21465 !! wikitext
21466 __TOC__
21467 == '''should be bold''' then normal text ==
21468 !! html
21469 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21470 <ul>
21471 <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>
21472 </ul>
21473 </div>
21474
21475 <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>
21476
21477 !! end
21478
21479 !! test
21480 Bug 33845: Headings become cursive in TOC when they contain an image
21481 !! options
21482 title=[[Main Page]]
21483 !! wikitext
21484 __TOC__
21485 == Image [[Image:foobar.jpg]] ==
21486 !! html
21487 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21488 <ul>
21489 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
21490 </ul>
21491 </div>
21492
21493 <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>
21494
21495 !! end
21496
21497 !! test
21498 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
21499 !! options
21500 title=[[Main Page]]
21501 !! wikitext
21502 __TOC__
21503 == <blockquote>Quote</blockquote> ==
21504 !! html
21505 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21506 <ul>
21507 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
21508 </ul>
21509 </div>
21510
21511 <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>
21512
21513 !! html+tidy
21514 <p></p>
21515 <div id="toc" class="toc">
21516 <div id="toctitle">
21517 <h2>Contents</h2>
21518 </div>
21519 <ul>
21520 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
21521 </ul>
21522 </div>
21523 <p></p>
21524 <h2><span class="mw-headline" id="Quote"></span></h2>
21525 <blockquote>
21526 <p><span class="mw-headline" id="Quote">Quote</span></p>
21527 </blockquote>
21528 <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>
21529 !! end
21530
21531 !! test
21532 Unclosed tags in TOC
21533 !! options
21534 title=[[Main Page]]
21535 !! wikitext
21536 __TOC__
21537 == Proof: 2 < 3 ==
21538 <small>Hanc marginis exiguitas non caperet.</small>
21539 QED
21540 !! html
21541 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21542 <ul>
21543 <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>
21544 </ul>
21545 </div>
21546
21547 <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>
21548 <p><small>Hanc marginis exiguitas non caperet.</small>
21549 QED
21550 </p>
21551 !! end
21552
21553 !! test
21554 Multiple tags in TOC
21555 !! wikitext
21556 __TOC__
21557 == <i>Foo</i> <b>Bar</b> ==
21558
21559 == <i>Foo</i> <blockquote>Bar</blockquote> ==
21560 !! html
21561 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21562 <ul>
21563 <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>
21564 <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>
21565 </ul>
21566 </div>
21567
21568 <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>
21569 <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>
21570
21571 !! html+tidy
21572 <p></p>
21573 <div id="toc" class="toc">
21574 <div id="toctitle">
21575 <h2>Contents</h2>
21576 </div>
21577 <ul>
21578 <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>
21579 <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>
21580 </ul>
21581 </div>
21582 <p></p>
21583 <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>
21584 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
21585 <blockquote>
21586 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
21587 </blockquote>
21588 <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>
21589 !! end
21590
21591 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
21592 # html5 tag parsing.
21593 !! test
21594 Tags with parameters in TOC
21595 !! options
21596 parsoid=wt2html
21597 !! wikitext
21598 __TOC__
21599 == <sup class="in-h2">Hello</sup> ==
21600
21601 == <sup class="a > b">Evilbye</sup> ==
21602 !! html/php
21603 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21604 <ul>
21605 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
21606 <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>
21607 </ul>
21608 </div>
21609
21610 <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>
21611 <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>
21612
21613 !! html/parsoid
21614 <meta property="mw:PageProp/toc" />
21615 <h2> <sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup> </h2>
21616
21617 <h2> <sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup> </h2>
21618 !! end
21619
21620 !! test
21621 span tags with directionality in TOC
21622 !! wikitext
21623 __TOC__
21624 == <span dir="ltr">C++</span> ==
21625
21626 == <span dir="rtl">זבנג!</span> ==
21627
21628 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
21629
21630 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
21631
21632 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
21633 !! html
21634 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21635 <ul>
21636 <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>
21637 <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>
21638 <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>
21639 <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>
21640 <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>
21641 </ul>
21642 </div>
21643
21644 <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>
21645 <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>
21646 <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>
21647 <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>
21648 <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>
21649
21650 !! end
21651
21652 !! test
21653 Bug 72884: bdi element in ToC
21654 !! wikitext
21655 __TOC__
21656 == <bdi>test</bdi> ==
21657 !! html
21658 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21659 <ul>
21660 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
21661 </ul>
21662 </div>
21663
21664 <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>
21665
21666 !! end
21667
21668 !! test
21669 T35715: s/strike element in ToC
21670 !! wikitext
21671 __TOC__
21672 == <s>test</s> test <strike>test</strike> ==
21673 !! html
21674 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21675 <ul>
21676 <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>
21677 </ul>
21678 </div>
21679
21680 <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>
21681
21682 !! end
21683
21684 # Note that the html output does not have the <p></p>, but the
21685 # html+tidy output *does*. This is because the empty <p></p> is
21686 # removed by the sanitizer, but only when tidy is *not* enabled (!).
21687 !! test
21688 Empty <p> tag in TOC, removed by Sanitizer (T92892)
21689 !! wikitext
21690 __TOC__
21691 == x ==
21692 !! html
21693 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21694 <ul>
21695 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
21696 </ul>
21697 </div>
21698
21699 <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>
21700
21701 !! html+tidy
21702 <p></p>
21703 <div id="toc" class="toc">
21704 <div id="toctitle">
21705 <h2>Contents</h2>
21706 </div>
21707 <ul>
21708 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
21709 </ul>
21710 </div>
21711 <p></p>
21712 <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>
21713 !! end
21714
21715 !! article
21716 MediaWiki:Bug32057
21717 !! text
21718 == {{int:headline_sample}} ==
21719 !! endarticle
21720
21721 !! test
21722 Bug 32057: Title needed when expanding <h> nodes.
21723 !! options
21724 title=[[Main Page]]
21725 !! wikitext
21726 {{int:Bug32057}}
21727 !! html
21728 <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>
21729
21730 !! end
21731
21732 !! test
21733 Strip marker in urlencode
21734 !! wikitext
21735 {{urlencode:x<nowiki/>y}}
21736 {{urlencode:x<nowiki/>y|wiki}}
21737 {{urlencode:x<nowiki/>y|path}}
21738 {{urlencode:x<pre id="one">two</pre>y}}
21739 !! html
21740 <p>xy
21741 xy
21742 xy
21743 xy
21744 </p>
21745 !! end
21746
21747 !! test
21748 Strip marker in lc
21749 !! wikitext
21750 {{lc:x<nowiki/>y}}
21751 !! html
21752 <p>xy
21753 </p>
21754 !! end
21755
21756 !! test
21757 Strip marker in uc
21758 !! wikitext
21759 {{uc:x<nowiki/>y}}
21760 !! html
21761 <p>XY
21762 </p>
21763 !! end
21764
21765 !! test
21766 Strip marker in formatNum
21767 !! wikitext
21768 {{formatnum:1<nowiki/>2}}
21769 {{formatnum:1<nowiki/>2|R}}
21770 !! html
21771 <p>12
21772 12
21773 </p>
21774 !! end
21775
21776 !! test
21777 Check noCommafy in formatNum
21778 !! options
21779 language=be-tarask
21780 !! wikitext
21781 {{formatnum:123456.78}}
21782 {{formatnum:123456.78|NOSEP}}
21783 !! html
21784 <p>123 456,78
21785 123456.78
21786 </p>
21787 !! end
21788
21789 !! test
21790 Wrong option for formatNum (bug 56199)
21791 !! wikitext
21792 {{formatnum:1,234.56|Random}}
21793 {{formatnum:1,234.56|EVERYTHING}}
21794 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
21795 !! html
21796 <p>1,234.56
21797 1,234.56
21798 1,234.56
21799 </p>
21800 !! end
21801
21802 !! test
21803 Strip marker in grammar
21804 !! options
21805 language=fi
21806 !! wikitext
21807 {{grammar:elative|foo<nowiki/>bar}}
21808 !! html
21809 <p>foobarista
21810 </p>
21811 !! end
21812
21813 !! test
21814 Strip marker in padleft
21815 !! wikitext
21816 {{padleft:|2|x<nowiki/>y}}
21817 !! html
21818 <p>xy
21819 </p>
21820 !! end
21821
21822 !! test
21823 Strip marker in padright
21824 !! wikitext
21825 {{padright:|2|x<nowiki/>y}}
21826 !! html
21827 <p>xy
21828 </p>
21829 !! end
21830
21831 !! test
21832 Strip marker in anchorencode
21833 !! wikitext
21834 {{anchorencode:x<nowiki/>y}}
21835 !! html
21836 <p>xy
21837 </p>
21838 !! end
21839
21840 !! test
21841 nowiki inside link inside heading (bug 18295)
21842 !! wikitext
21843 ==[[foo|x<nowiki>y</nowiki>z]]==
21844 !! html
21845 <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>
21846
21847 !! end
21848
21849 !! test
21850 new support for bdi element (bug 31817)
21851 !! wikitext
21852 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
21853 !! html
21854 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
21855
21856 !!end
21857
21858 !! test
21859 Ignore pipe between table row attributes
21860 !! wikitext
21861 {|
21862 | quux
21863 |- id=foo | style='color: red'
21864 | bar
21865 |}
21866 !! html
21867 <table>
21868 <tr>
21869 <td> quux
21870 </td></tr>
21871 <tr id="foo" style="color: red">
21872 <td> bar
21873 </td></tr></table>
21874
21875 !! end
21876
21877 !!test
21878 Gallery override link with WikiLink (bug 34852)
21879 !! wikitext
21880 <gallery>
21881 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
21882 </gallery>
21883 !! html
21884 <ul class="gallery mw-gallery-traditional">
21885 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21886 <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>
21887 <div class="gallerytext">
21888 <p>caption
21889 </p>
21890 </div>
21891 </div></li>
21892 </ul>
21893
21894 !! end
21895
21896 !!test
21897 Gallery override link with absolute external link (bug 34852)
21898 !! wikitext
21899 <gallery>
21900 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
21901 </gallery>
21902 !! html
21903 <ul class="gallery mw-gallery-traditional">
21904 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21905 <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>
21906 <div class="gallerytext">
21907 <p>caption
21908 </p>
21909 </div>
21910 </div></li>
21911 </ul>
21912
21913 !! end
21914
21915 !!test
21916 Gallery override link with malicious javascript (bug 34852)
21917 !! wikitext
21918 <gallery>
21919 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
21920 </gallery>
21921 !! html
21922 <ul class="gallery mw-gallery-traditional">
21923 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21924 <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>
21925 <div class="gallerytext">
21926 <p>caption
21927 </p>
21928 </div>
21929 </div></li>
21930 </ul>
21931
21932 !! end
21933
21934 !!test
21935 Gallery with invalid title as link (bug 43964)
21936 !! wikitext
21937 <gallery>
21938 File:foobar.jpg|link=<
21939 </gallery>
21940 !! html
21941 <ul class="gallery mw-gallery-traditional">
21942 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21943 <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>
21944 <div class="gallerytext">
21945 </div>
21946 </div></li>
21947 </ul>
21948
21949 !! end
21950
21951 !!test
21952 Language parser function
21953 !! wikitext
21954 {{#language:ar}}
21955 !! html
21956 <p>العربية
21957 </p>
21958 !! end
21959
21960 !!test
21961 Padleft and padright as substr
21962 !! wikitext
21963 {{padleft:|3|abcde}}
21964 {{padright:|3|abcde}}
21965 !! html
21966 <p>abc
21967 abc
21968 </p>
21969 !! end
21970
21971 !!test
21972 Special parser function
21973 !! wikitext
21974 {{#special:RandomPage}}
21975 {{#special:BaDtItLe}}
21976 {{#special:Foobar}}
21977 !! html
21978 <p>Special:Random
21979 Special:Badtitle
21980 Special:Foobar
21981 </p>
21982 !! end
21983
21984 !!test
21985 Bug 34939 - Case insensitive link parsing ([HttP://])
21986 !! wikitext
21987 [HttP://MediaWiki.Org/]
21988 !! html/php
21989 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
21990 </p>
21991 !! html/parsoid
21992 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
21993 !! end
21994
21995 !!test
21996 Bug 34939 - Case insensitive link parsing ([HttP:// title])
21997 !! wikitext
21998 [HttP://MediaWiki.Org/ MediaWiki]
21999 !! html
22000 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
22001 </p>
22002 !! end
22003
22004 !!test
22005 Bug 34939 - Case insensitive link parsing (HttP://)
22006 !! wikitext
22007 HttP://MediaWiki.Org/
22008 !! html/php
22009 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
22010 </p>
22011 !! html/parsoid
22012 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
22013 !! end
22014
22015 !!test
22016 Disable TOC
22017 !! options
22018 notoc
22019 !! wikitext
22020 Lead
22021 == Section 1 ==
22022 == Section 2 ==
22023 == Section 3 ==
22024 == Section 4 ==
22025 == Section 5 ==
22026 !! html
22027 <p>Lead
22028 </p>
22029
22030 <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>
22031 <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>
22032 <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>
22033 <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>
22034 <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>
22035
22036 !! end
22037
22038
22039 ###
22040 ### Parsoid-specific tests
22041 ### Parsoid-PHP parser incompatibilities
22042 ###
22043 !!test
22044 1. SOL-sensitive wikitext tokens as template-args
22045 !!options
22046 parsoid=wt2html,wt2wt
22047 !! wikitext
22048 {{echo|*a}}
22049 {{echo|#a}}
22050 {{echo|:a}}
22051 !! html
22052 <span about="#mwt1" typeof="mw:Transclusion">
22053 </span><ul about="#mwt1"><li>a</li>
22054 </ul>
22055 <span about="#mwt2" typeof="mw:Transclusion">
22056 </span><ol about="#mwt2"><li>a</li>
22057 </ol>
22058 <span about="#mwt3" typeof="mw:Transclusion">
22059 </span><dl about="#mwt3"><dd>a</dd>
22060 </dl>
22061 !!end
22062
22063 #### -----------------------------------------------------------------
22064 #### Parsoid-specific functionality tests
22065 #### -----------------------------------------------------------------
22066
22067 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
22068 # We know wt2wt will fail, but we expect selser to pass.
22069 # Due to the nature of our testing, wt2wt and selser tests will enter the
22070 # blacklist and we'll catch selser regressions based on changes to the
22071 # blacklist entries for selser tests.
22072 !! test
22073 1. Bad treebuilder fixup of formatting elt is cleaned up
22074 !! options
22075 parsoid=wt2html,wt2wt
22076 !! wikitext
22077 {|
22078 |
22079 <small>
22080 [[Image:Foobar.jpg|right|Test]]
22081 </small>
22082 |}
22083 !! html/parsoid
22084 <table>
22085 <tbody><tr><td>
22086 <small>
22087 <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>
22088 </small>
22089 </td></tr>
22090 </tbody></table>
22091 !! end
22092
22093 !! test
22094 2. Bad treebuilder fixup of formatting elt is cleaned up
22095 !! options
22096 parsoid=wt2html,wt2wt
22097 !! wikitext
22098 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
22099
22100 <small>[[Image:Foobar.jpg|right|300px]]</small>
22101 !! html/parsoid
22102
22103 <p><b>foo</b></p>
22104 <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>
22105 <p><b>bar</b></p>
22106 <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>
22107 !! end
22108
22109 !! test
22110 3. Bad treebuilder fixup of formatting elt is cleaned up
22111 !! options
22112 parsoid=wt2html,wt2wt
22113 !! wikitext
22114 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
22115 !! html/parsoid
22116 <p><small><b>foo</b></small></p>
22117 <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>
22118 <p><small><b>bar</b></small></p>
22119 !! end
22120
22121 !! test
22122 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
22123 !! options
22124 parsoid=wt2html,wt2wt
22125 !! wikitext
22126 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
22127 !! html/parsoid
22128 <p><b><small></small></b></p>
22129 <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>
22130 <p></p>
22131 !! end
22132
22133 #### ----------------------------------------------------------------
22134 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
22135 #### tags. Parsoid's output for these tags differs from that of the
22136 #### PHP parser.
22137 #### ----------------------------------------------------------------
22138
22139 !!test
22140 Ref: 1. ref-location should be replaced with an index span
22141 !! wikitext
22142 A <ref>foo</ref>
22143 B <ref name="x">foo</ref>
22144 C <ref name="y" />
22145 <references />
22146 !! html/parsoid
22147 <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>
22148 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>
22149 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>
22150 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22151 <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>
22152 <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>
22153 <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>
22154 </ol>
22155 !!end
22156
22157 !!test
22158 Ref: 2. ref-tags with identical names should all get the same index
22159 !! wikitext
22160 A <ref name="x">foo</ref>
22161 B <ref name="x" />
22162 <references />
22163 !! html/parsoid
22164 <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>
22165 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>
22166 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22167 <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>
22168 </ol>
22169 !!end
22170
22171 !!test
22172 Ref: 3. spaces in ref-names should be ignored
22173 !! wikitext
22174 A <ref name="x">foo</ref>
22175 B <ref name=" x " />
22176 C <ref name= x />
22177 <references />
22178 !! html/parsoid
22179 <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>
22180 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>
22181 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>
22182 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22183 <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>
22184 </ol>
22185 !!end
22186
22187 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
22188 !!test
22189 Ref: 4. 'constructor' should be accepted as a valid ref-name
22190 !! wikitext
22191 A <ref name="constructor">foo</ref>
22192 <references />
22193 !! html/parsoid
22194 <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>
22195 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22196 <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>
22197 </ol>
22198 !!end
22199
22200 !!test
22201 Ref: 5. body should accept generic wikitext
22202 !! wikitext
22203 A <ref>
22204 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
22205 </ref>
22206
22207 <references />
22208 !! html/parsoid
22209 <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>
22210
22211 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
22212 <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>
22213 </span></li>
22214 </ol>
22215 !!end
22216
22217 !!test
22218 Ref: 6. indent-pres should not be output in ref-body
22219 !! wikitext
22220 A <ref>
22221 foo
22222 bar
22223 baz
22224 </ref>
22225
22226 <references />
22227 !! html/parsoid
22228 <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>
22229
22230 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22231 <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
22232 bar
22233 baz
22234 </span></li>
22235 </ol>
22236 !!end
22237
22238 !!test
22239 Ref: 7. No p-wrapping in ref-body
22240 !! wikitext
22241 A <ref>
22242 foo
22243
22244 bar
22245
22246
22247 baz
22248
22249
22250
22251 booz
22252 </ref>
22253
22254 <references />
22255 !! html/parsoid
22256 <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>
22257
22258 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22259 <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
22260
22261 bar
22262
22263
22264 baz
22265
22266
22267
22268 booz
22269 </span></li>
22270 </ol>
22271 !!end
22272
22273 !!test
22274 Ref: 8. transclusion wikitext has lower precedence
22275 !! wikitext
22276 A <ref> foo {{echo|</ref> B C}}
22277
22278 <references />
22279 !! html/parsoid
22280 <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>
22281 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22282 <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>
22283 </ol>
22284 !!end
22285
22286 !!test
22287 Ref: 9. unclosed comments should not leak out of ref-body
22288 !! wikitext
22289 A <ref> foo <!--</ref> B C
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 <!----></span></li>
22295 </ol>
22296 !!end
22297
22298 !!test
22299 Ref: 10. Unclosed HTML tags should not leak out of ref-body
22300 !! wikitext
22301 A <ref> <b> foo </ref> B C
22302
22303 <references />
22304 !! html/parsoid
22305 <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>
22306
22307
22308 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22309 <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>
22310 </ol>
22311 !!end
22312
22313 !!test
22314 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
22315 !! wikitext
22316 A <ref>foo</ref> B
22317 C <ref>bar</ref> D
22318 <references />
22319 !! html/parsoid
22320 <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
22321 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>
22322 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22323 <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>
22324 <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>
22325 </ol>
22326 !!end
22327
22328 !!test
22329 Ref: 12. ref-tags act as trailing newline migration barrier
22330 !! wikitext
22331 <!--the newline at the end of this line moves out of the p tag-->a
22332
22333 b<!--the newline at the end of this line stays inside the p tag--> <ref />
22334 <ref />
22335
22336 c
22337 <references />
22338 !! html/parsoid
22339 <!--the newline at the end of this line moves out of the p tag--><p>a</p>
22340
22341
22342 <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>
22343 <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>
22344
22345 <p>c</p>
22346 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22347 <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>
22348 <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>
22349 !!end
22350
22351 !!test
22352 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
22353 !! wikitext
22354 <ref>foo</ref> A
22355 <ref>bar
22356 </ref> B
22357 <references />
22358 !! html/parsoid
22359 <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
22360 <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>
22361 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22362 <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>
22363 <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
22364 </span></li>
22365 </ol>
22366 !!end
22367
22368 !!test
22369 Ref: 14. A nested ref-tag should be emitted as plain text
22370 !! wikitext
22371 <ref>foo <ref>bar</ref> baz</ref>
22372
22373 <references />
22374 !! html/parsoid
22375 <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>
22376 </p>
22377 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
22378 <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>
22379 </ol>
22380 !!end
22381
22382 !!test
22383 Ref: 15. ref-tags with identical names should get identical indexes
22384 !! wikitext
22385 A1 <ref name="a">foo</ref> A2 <ref name="a" />
22386 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
22387
22388 <references />
22389 !! html/parsoid
22390 <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>
22391 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>
22392
22393 <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>
22394 </ol>
22395 !!end
22396
22397 ## We don't bother wt2wt-ing non-standard whitespace
22398 !!test
22399 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
22400 !!options
22401 parsoid=wt2html
22402 !! wikitext
22403 A <ref >foo</ref >
22404
22405 <references />
22406 !! html/parsoid
22407 <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>
22408 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22409 <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>
22410 !!end
22411
22412 !!test
22413 Ref: 17. Generate valid HTML5 id/about attributes
22414 !!wikitext
22415 <ref name="a b">foo</ref>
22416
22417 <references />
22418 !!html/parsoid
22419 <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>
22420 </p>
22421
22422 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22423 <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>
22424 </ol>
22425 !!end
22426
22427 !!test
22428 Ref: 18. T58916: Extension attributes should be parsed as plain text
22429 !!wikitext
22430 <ref name="{{echo|a}}">foo</ref>
22431
22432 <references />
22433 !!html/parsoid
22434 <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>
22435 </p>
22436
22437 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22438 <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>
22439 </ol>
22440 !!end
22441
22442 !!test
22443 Ref: 19. ref-tags with identical name encodings should get identical indexes
22444 !! wikitext
22445 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
22446
22447 <references />
22448 !! html/parsoid
22449 <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>
22450 </p>
22451 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22452 <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>
22453 </ol>
22454 !!end
22455
22456 !!test
22457 Ref: 20. ref-tags with identical names but different content should keep it
22458 !! wikitext
22459 A <ref name="foo">Foo one</ref>
22460 B <ref name="foo">Foo two</ref>
22461 C <ref name="foo" />
22462
22463 <references />
22464 !! html/parsoid
22465 <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>
22466 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>
22467 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>
22468
22469 <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>
22470 </ol>
22471 !!end
22472
22473 !!test
22474 References: 1. references tag without any refs should be handled properly
22475 !! wikitext
22476 <references />
22477 !! html/parsoid
22478 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
22479 !!end
22480
22481 !!test
22482 References: 2. references tag with group only outputs references from that group
22483 !! wikitext
22484 A <ref group="a">foo</ref>
22485 B <ref group="b">bar</ref>
22486 C <ref>baz</ref>
22487
22488 <references group="a" />
22489 <references />
22490 <references group="b" />
22491 !! html/parsoid
22492 <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>
22493 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>
22494 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>
22495
22496 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="a" data-mw='{"name":"references","attrs":{"group":"a"}}'>
22497 <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>
22498 </ol>
22499 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'>
22500 <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>
22501 </ol>
22502 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt12" data-mw-group="b" data-mw='{"name":"references","attrs":{"group":"b"}}'>
22503 <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>
22504 </ol>
22505 !!end
22506
22507 !!test
22508 References: 3. ref list should be cleared after processing references
22509 !! wikitext
22510 A <ref>foo</ref>
22511
22512 <references />
22513
22514 B <ref>bar</ref>
22515
22516 <references />
22517 !! html/parsoid
22518 <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>
22519
22520 <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>
22521 </ol>
22522
22523 <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>
22524
22525 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22526 <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>
22527 </ol>
22528 !!end
22529
22530 !!test
22531 References: 4. only referenced group should be cleared after processing references
22532 !! wikitext
22533 A <ref group="a">afoo</ref>
22534 B <ref>bfoo</ref>
22535
22536 <references group="a" />
22537
22538 C <ref>cfoo</ref>
22539
22540 <references />
22541 !! html/parsoid
22542 <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>
22543 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>
22544
22545 <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>
22546 </ol>
22547
22548 <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>
22549
22550 <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>
22551 </ol>
22552 !!end
22553
22554 ## Don't expect this to rt since we're dropping content
22555 !! test
22556 References: 5. ref tags in references should be processed while ignoring all other content
22557 !! options
22558 parsoid=wt2html,html2html
22559 !! wikitext
22560 A <ref name="a" />
22561 B <ref name="b">bar</ref>
22562
22563 <references>
22564 <ref name="a">foo</ref>
22565 This should just get lost.
22566 </references>
22567 !! html/parsoid
22568 <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>
22569 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>
22570
22571
22572 <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>
22573 </ol>
22574 !! end
22575
22576 !! test
22577 References: 6. <references /> from a transclusion
22578 !! wikitext
22579 <ref>Foo</ref> {{echo|<references />}}
22580 !! html/parsoid
22581 <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>
22582 </ol>
22583 !! end
22584
22585 !! test
22586 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
22587 !! wikitext
22588 A <ref>foo bar for a</ref>
22589 B <ref group="X" name="b" />
22590
22591 <references />
22592
22593 <references group="X">
22594 <ref name="b">foo</ref>
22595 </references>
22596 !! html/parsoid
22597 <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>
22598 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>
22599 </p>
22600
22601 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22602 <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>
22603 </ol>
22604
22605 <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"}}'>
22606 <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>
22607 </ol>
22608 !! end
22609
22610 !! test
22611 References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
22612 !! wikitext
22613 X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
22614 <references />
22615 !! html/parsoid
22616 <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>
22617 <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>
22618 </ol>
22619 !!end
22620
22621 # This test only works in wt2html now as the <references /> are always generated
22622 # unless selser is active. Once T72722 is fixed, we should add a changes test
22623 # here to ensure that unrelated changes don't add the new <references />
22624 # when selser is active.
22625 !! test
22626 References: 9. Generate missing references list at the end
22627 !! wikitext
22628 A <ref>foo</ref>
22629 B <ref group="inexistent">bar</ref>
22630 !! html/parsoid
22631 <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>
22632 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{},"autoGenerated":true}'>
22633 <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>
22634 </ol>
22635 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="inexistent" data-mw='{"name":"references","attrs":{"group":"inexistent"},"autoGenerated":true}'>
22636 <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>
22637 </ol>
22638 !! end
22639
22640 !! test
22641 References: 10. New <references/> shouldn't be added for unrelated edits.
22642 !! options
22643 parsoid={
22644 "modes": ["selser"],
22645 "changes": [["#x", "remove"]],
22646 "selser": "noauto"
22647 }
22648 !! wikitext
22649 Unrelated text<span id="x"> that's going to disappear</span>.
22650 A <ref>foo</ref>
22651 !! wikitext/edited
22652 Unrelated text.
22653 A <ref>foo</ref>
22654 !!end
22655
22656 !! test
22657 Entities in ref name
22658 !! wikitext
22659 <ref name="test &amp; me">hi</ref>
22660 <references />
22661 !! html/parsoid
22662 <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>
22663 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22664 <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>
22665 </ol>
22666 !! end
22667
22668 ## The output here may look funny, but it's what the php parser will do. The
22669 ## unclosed references tag becomes escaped text, and then a new references
22670 ## tag is auto-generated. The test is wt2html only because it roundtrips with
22671 ## nowiki tags, and the auto-generated references tag is only dropped in
22672 ## rtTestMode.
22673 !! test
22674 Generate references for unclosed references tag
22675 !! options
22676 parsoid=wt2html
22677 !! wikitext
22678 a<ref>foo</ref>
22679
22680 <references>
22681 !! html/parsoid
22682 <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>
22683
22684 <p>&lt;references></p>
22685 <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>
22686 !! end
22687
22688 !! test
22689 New reference serializes on its own line
22690 !! options
22691 parsoid=wt2wt,html2wt
22692 !! wikitext
22693 foo
22694 <references />
22695 !! html/parsoid
22696 foo<ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
22697 !! end
22698
22699 #### ----------------------------------------------------------------
22700 #### Parsoid-only testing of Parsoid's impl of LST
22701 #### Not implemented yet, see
22702 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
22703 #### ----------------------------------------------------------------
22704
22705 !! test
22706 LST Sections: 1. Simple section start and end
22707 !! options
22708 parsoid={ "suppressErrors": true }
22709 !! wikitext
22710 <section begin="2011-05-16" />
22711 <section end="2014-04-10 (MW 1.23wmf22)" />
22712 !! html/parsoid
22713 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
22714 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
22715 !! end
22716
22717 #--------- Test stripping of empty nodes in template content ----------
22718 !!test
22719 Empty LI and TR nodes should be stripped from template content
22720 !!wikitext
22721 {{EmptyLITest}}
22722 {{EmptyTRTest}}
22723 !!html/parsoid
22724 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
22725 <li>a</li>
22726 <li>b</li>
22727 </ul>
22728 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
22729 <tbody>
22730 <tr>
22731 <td>foo</td>
22732 </tr>
22733 <tr>
22734 <td>bar</td>
22735 </tr>
22736 </tbody>
22737 </table>
22738 !!end
22739
22740 !!test
22741 Empty LI and TR nodes should not be stripped from top-level content
22742 !!wikitext
22743 * a
22744 *
22745 * b
22746 {|
22747 |-
22748 |-
22749 |foo
22750 |}
22751 !!html/parsoid
22752 <ul>
22753 <li> a</li>
22754 <li></li>
22755 <li> b</li>
22756 </ul>
22757 <table>
22758 <tbody>
22759 <tr></tr>
22760 <tr>
22761 <td>foo</td>
22762 </tr>
22763 </tbody>
22764 </table>
22765 !!end
22766
22767 !!test
22768 Empty TR nodes should not be stripped if they have any attributes set
22769 !!wikitext
22770 {{EmptyTRWithHTMLAttrTest}}
22771 !!html/parsoid
22772 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
22773 <tr align="center"></tr>
22774 <tr><td>foo</td></tr>
22775 <tr align="center"></tr>
22776 <tr><td>bar</td></tr>
22777 </table>
22778 !!end
22779
22780 #### ----------------------------------------------------------------
22781 #### The following section of tests are primarily to test
22782 #### wikitext escaping capabilities of Parsoid. Given that
22783 #### escaping can be done any number of ways, the wikitext (input)
22784 #### is always adjusted to reflect how Parsoid adds nowiki
22785 #### escape tags.
22786 ####
22787 #### We are marking several tests as parsoid-only since the
22788 #### HTML in the result section is different from what the
22789 #### PHP parser generates for it.
22790 #### ----------------------------------------------------------------
22791
22792
22793 #### --------------- Headings ---------------
22794 #### 0. Unnested
22795 #### 1. Nested inside html <h1>=foo=</h1>
22796 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
22797 #### 3. Nested inside html with wikitext split by html tags
22798 #### 4. No escape needed
22799 #### 5. Empty headings <h1></h1>
22800 #### 6. Heading chars in SOL context
22801 #### ----------------------------------------
22802 !! test
22803 Headings: 0. Unnested
22804 !! options
22805 parsoid=html2wt
22806 !! html/parsoid
22807 <p>=foo=</p>
22808
22809 <p> =foo=
22810 <!--cmt-->
22811 =foo=</p>
22812
22813 <p>=foo<i>a</i>=</p>
22814 !! wikitext
22815 <nowiki>=foo=</nowiki>
22816
22817 <nowiki> </nowiki>=foo=
22818 <!--cmt-->
22819 <nowiki>=foo=</nowiki>
22820
22821 =foo''a''<nowiki>=</nowiki>
22822 !!end
22823
22824 # New headings and existing headings are handled differently
22825 !! test
22826 Headings: 1. Nested inside html
22827 !! options
22828 parsoid=html2wt
22829 !! html/parsoid
22830 <h1>=foo=</h1>
22831 <h2>=foo=</h2>
22832 <h3>=foo=</h3>
22833
22834 <h1 data-parsoid=''>=foo=</h1>
22835 <h2 data-parsoid=''>=foo=</h2>
22836 <h3 data-parsoid=''>=foo=</h3>
22837 <h4 data-parsoid=''>=foo=</h4>
22838 <h5 data-parsoid=''>=foo=</h5>
22839 <h6 data-parsoid=''>=foo=</h6>
22840 !! wikitext
22841 = =foo= =
22842
22843 == =foo= ==
22844
22845 === =foo= ===
22846
22847 =<nowiki>=foo=</nowiki>=
22848 ==<nowiki>=foo=</nowiki>==
22849 ===<nowiki>=foo=</nowiki>===
22850 ====<nowiki>=foo=</nowiki>====
22851 =====<nowiki>=foo=</nowiki>=====
22852 ======<nowiki>=foo=</nowiki>======
22853
22854 !!end
22855
22856 !! test
22857 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
22858 !! options
22859 parsoid=html2wt
22860 !! html/parsoid
22861 <h1>foo</h1>*bar
22862 <h1>foo</h1>=bar
22863 <h1>foo</h1>=bar=
22864 !! wikitext
22865 = foo =
22866 <nowiki>*</nowiki>bar
22867
22868 = foo =
22869 =bar
22870
22871 = foo =
22872 <nowiki>=bar=</nowiki>
22873 !!end
22874
22875 !! test
22876 Headings: 3. Nested inside html with wikitext split by html tags
22877 !! options
22878 parsoid=html2wt
22879 !! html/parsoid
22880 <h1>=<b>bold</b>foo=</h1>
22881 !! wikitext
22882 = ='''bold'''foo= =
22883 !!end
22884
22885 !! test
22886 Headings: 4a. No escaping needed (testing just h1 and h2)
22887 !! options
22888 parsoid=html2wt
22889 !! html/parsoid
22890 <h1>=foo</h1>
22891 <h1>foo=</h1>
22892 <h1> =foo= </h1>
22893 <h1>=foo= bar</h1>
22894 <h2>=foo</h2>
22895 <h2>foo=</h2>
22896 <h1>=</h1>
22897 <h1><i>=</i>foo=</h1>
22898 !! wikitext
22899 = =foo =
22900
22901 = foo= =
22902
22903 = =foo= =
22904
22905 = =foo= bar =
22906
22907 == =foo ==
22908
22909 == foo= ==
22910
22911 = = =
22912
22913 = ''=''foo= =
22914 !!end
22915
22916 !! test
22917 Headings: 4b. No escaping needed (inside p-tags)
22918 !! options
22919 parsoid=html2wt
22920 !! html/parsoid
22921 <p>===
22922 =foo= x
22923 =foo= <s></s>
22924 </p>
22925 !! wikitext
22926 ===
22927 =foo= x
22928 =foo= <s></s>
22929 !!end
22930
22931 !! test
22932 Headings: 5. Empty headings
22933 !! options
22934 parsoid=html2wt
22935 !! html/parsoid
22936 <h1 data-parsoid='{}'></h1>
22937
22938 <h2 data-parsoid='{}'></h2>
22939
22940 <h3 data-parsoid='{}'></h3>
22941
22942 <h4 data-parsoid='{}'></h4>
22943
22944 <h5 data-parsoid='{}'></h5>
22945
22946 <h6 data-parsoid='{}'></h6>
22947 !! wikitext
22948 =<nowiki/>=
22949
22950 ==<nowiki/>==
22951
22952 ===<nowiki/>===
22953
22954 ====<nowiki/>====
22955
22956 =====<nowiki/>=====
22957
22958 ======<nowiki/>======
22959 !!end
22960
22961 !! test
22962 Headings: 6a. Heading chars in SOL context (with trailing spaces)
22963 !! options
22964 parsoid=html2wt
22965 !! html/parsoid
22966 <p>=a=</p>
22967
22968 <p>=a=</p>
22969
22970 <p>=a=</p>
22971 !! wikitext
22972 <nowiki>=a=</nowiki>
22973
22974 <nowiki>=a=</nowiki>
22975
22976 <nowiki>=a=</nowiki>
22977 !!end
22978
22979 !! test
22980 Headings: 6b. Heading chars in SOL context (with trailing newlines)
22981 !! options
22982 parsoid=html2wt
22983 !! html/parsoid
22984 <p>=a=
22985 b</p>
22986
22987 <p>=a=
22988 b</p>
22989
22990 <p>=a=
22991 b</p>
22992 !! wikitext
22993 <nowiki>=a=</nowiki>
22994 b
22995
22996 <nowiki>=a=</nowiki>
22997 b
22998
22999 <nowiki>=a=</nowiki>
23000 b
23001 !!end
23002
23003 !! test
23004 Headings: 6c. Heading chars in SOL context (leading newline break)
23005 !! options
23006 parsoid=html2wt
23007 !! html/parsoid
23008 <p>a
23009 =b=</p>
23010 !! wikitext
23011 a
23012 <nowiki>=b=</nowiki>
23013 !!end
23014
23015 !! test
23016 Headings: 6d. Heading chars in SOL context (with interspersed comments)
23017 !! options
23018 parsoid=html2wt
23019 !! html/parsoid
23020 <!--c0--><p>=a=</p>
23021
23022 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
23023 !! wikitext
23024 <!--c0--><nowiki>=a=</nowiki>
23025
23026 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
23027 !!end
23028
23029 !! test
23030 Headings: 6d. Heading chars in SOL context (No escaping needed)
23031 !! options
23032 parsoid=html2wt
23033 !! html/parsoid
23034 =a=<div>b</div>
23035 !! wikitext
23036 =a=<div>b</div>
23037 !!end
23038
23039 !! test
23040 Headings: 7. Insert a newline between new content and headings
23041 !! options
23042 parsoid=html2wt
23043 !! html/parsoid
23044 <h2>NEW</h2>
23045 <p>new</p>
23046 <h2 data-parsoid='{}'>A</h2>
23047 <p data-parsoid='{}'>a</p>
23048 !! wikitext
23049 == NEW ==
23050 new
23051
23052 ==A==
23053 a
23054
23055 !! end
23056
23057 #### --------------- Lists ---------------
23058 #### 0. Outside nests (*foo, etc.)
23059 #### 1. Nested inside html <ul><li>*foo</li></ul>
23060 #### 2. Inside definition lists
23061 #### 3. Only bullets at start should be escaped
23062 #### 4. No escapes needed
23063 #### 5. No unnecessary escapes
23064 #### 6. Escape bullets in SOL position
23065 #### 7. Escape bullets in a multi-line context
23066 #### ----------------------------------------
23067
23068 !! test
23069 Lists: 0. Outside nests
23070 !! options
23071 parsoid=html2wt
23072 !! html/parsoid
23073 <p>*foo</p>
23074
23075 <p>#foo</p>
23076
23077 <p>;Foo:bar</p>
23078 !! wikitext
23079 <nowiki>*</nowiki>foo
23080
23081 <nowiki>#</nowiki>foo
23082
23083 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
23084 !!end
23085
23086 ## Making these next 3 tests Parsoid-only since they are html2wt tests
23087 ## to test wikitext escaping, and insignificant whitespace diffs
23088 ## cause PHP parser tests to barf
23089 !! test
23090 Lists: 1. Nested inside html (No unnecessary escapes)
23091 !! options
23092 parsoid=html2wt
23093 !! html/parsoid
23094 <ul>
23095 <li>*foo</li>
23096 <li>#foo</li>
23097 <li>:foo</li>
23098 <li>;foo</li>
23099 <li data-parsoid='{}'>*foo</li>
23100 <li data-parsoid='{}'>#foo</li>
23101 <li data-parsoid='{}'>:foo</li>
23102 <li data-parsoid='{}'>;foo</li>
23103 </ul>
23104
23105 <ol>
23106 <li>*foo</li>
23107 <li>#foo</li>
23108 <li>:foo</li>
23109 <li>;foo</li>
23110 <li data-parsoid='{}'>*foo</li>
23111 <li data-parsoid='{}'>#foo</li>
23112 <li data-parsoid='{}'>:foo</li>
23113 <li data-parsoid='{}'>;foo</li>
23114 </ol>
23115 !! wikitext
23116 * *foo
23117 * #foo
23118 * :foo
23119 * ;foo
23120 *<nowiki>*foo</nowiki>
23121 *<nowiki>#foo</nowiki>
23122 *<nowiki>:foo</nowiki>
23123 *<nowiki>;foo</nowiki>
23124
23125 # *foo
23126 # #foo
23127 # :foo
23128 # ;foo
23129 #<nowiki>*foo</nowiki>
23130 #<nowiki>#foo</nowiki>
23131 #<nowiki>:foo</nowiki>
23132 #<nowiki>;foo</nowiki>
23133 !!end
23134
23135 !! test
23136 Lists: 2. Inside definition lists
23137 !! options
23138 parsoid=html2wt
23139 !! html/parsoid
23140 <dl><dt>;foo</dt></dl>
23141 <dl><dt>:foo</dt></dl>
23142 <dl><dt>:foo</dt>
23143 <dd>bar</dd></dl>
23144 <dl><dd>:foo</dd></dl>
23145 !! wikitext
23146 ; ;foo
23147
23148 ; <nowiki>:foo</nowiki>
23149
23150 ; <nowiki>:foo</nowiki>
23151 : bar
23152
23153 : :foo
23154 !!end
23155
23156 !! test
23157 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
23158 !! options
23159 parsoid=html2wt
23160 !! html/parsoid
23161 <ul>
23162 <li>*foo*bar</li>
23163 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
23164 </ul>
23165 !! wikitext
23166 * *foo*bar
23167 *<nowiki>*foo</nowiki>''it''*bar
23168 !!end
23169
23170 !! test
23171 Lists: 4. No escapes needed
23172 !! options
23173 parsoid=html2wt
23174 !! html/parsoid
23175 <ul>
23176 <li>foo*bar
23177 </li>
23178 </ul>
23179 <ul>
23180 <li><i>foo</i>*bar
23181 </li>
23182 </ul>
23183 <ul>
23184 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
23185 </li>
23186 </ul>
23187 <ul>
23188 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
23189 </li>
23190 </ul>
23191 !! wikitext
23192 *foo*bar
23193
23194 *''foo''*bar
23195
23196 *[[Foo]]: bar
23197
23198 *[[Foo]]*bar
23199 !!end
23200
23201 !! test
23202 Lists: 5. No unnecessary escapes
23203 !! options
23204 parsoid=html2wt
23205 !! html/parsoid
23206 <ul><li> bar <span>[[foo]]</span></li></ul>
23207 <ul><li> =bar <span>[[foo]]</span></li></ul>
23208 <ul><li> [[bar <span>[[foo]]</span></li></ul>
23209 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
23210 <ul><li> =bar <span>foo]]</span>=</li></ul>
23211 <ul><li> <s></s>: a</li></ul>
23212 <ul><li> <i>* foo</i></li></ul>
23213
23214 !! wikitext
23215 * bar <span><nowiki>[[foo]]</nowiki></span>
23216
23217 * =bar <span><nowiki>[[foo]]</nowiki></span>
23218
23219 * [[bar <span><nowiki>[[foo]]</nowiki></span>
23220
23221 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
23222
23223 * =bar <span>foo]]</span>=
23224
23225 * <s></s>: a
23226
23227 * ''* foo''
23228 !!end
23229
23230 !! test
23231 Lists: 6. Escape bullets in SOL position
23232 !! options
23233 parsoid=html2wt
23234 !! html/parsoid
23235 <p><!--cmt-->*foo</p>
23236 !! wikitext
23237 <!--cmt--><nowiki>*</nowiki>foo
23238 !!end
23239
23240 !! test
23241 Lists: 7. Escape bullets in a multi-line context
23242 !! options
23243 parsoid=html2wt
23244 !! html/parsoid
23245 <p>a
23246 *b
23247 </p>
23248 !! wikitext
23249 a
23250 <nowiki>*</nowiki>b
23251 !!end
23252
23253 !! test
23254 Lists: 8. Escape colons only if not present in tags
23255 !! options
23256 parsoid=html2wt
23257 !! html/parsoid
23258 <dl><dt>a:b<i>c:d</i></dt></dl>
23259 !! wikitext
23260 ; <nowiki>a:b</nowiki>''c:d''
23261 !! end
23262
23263 #### --------------- HRs ---------------
23264 #### 1. Single line
23265 #### -----------------------------------
23266
23267 !! test
23268 HRs: 1. Single line
23269 !! options
23270 parsoid=html2wt
23271 !! html/parsoid
23272 <hr />----
23273 <hr />=foo=
23274 <hr />*foo
23275 !! wikitext
23276 ----<nowiki>----</nowiki>
23277 ----=foo=
23278 ----*foo
23279 !! end
23280
23281 #### --------------- Tables ---------------
23282 #### 1a. Simple example
23283 #### 1b. No escaping needed (!foo)
23284 #### 1c. No escaping needed (|foo)
23285 #### 1d. No escaping needed (|}foo)
23286 ####
23287 #### 2a. Nested in td (<td>foo|bar</td>)
23288 #### 2b. Nested in td (<td>foo||bar</td>)
23289 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
23290 ####
23291 #### 3a. Nested in th (<th>foo!bar</th>)
23292 #### 3b. Nested in th (<th>foo!!bar</th>)
23293 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
23294 ####
23295 #### 4a. Escape -
23296 #### 4b. Escape +
23297 #### 4c. No escaping needed
23298 #### --------------------------------------
23299
23300 !! test
23301 Tables: 1a. Simple example
23302 !! options
23303 parsoid=html2wt
23304 !! html/parsoid
23305 <p>{|
23306 |}
23307 </p>
23308 !! wikitext
23309 <nowiki>{|</nowiki>
23310 |}
23311 !! end
23312
23313 !! test
23314 Tables: 1b. No escaping needed
23315 !! options
23316 parsoid=html2wt
23317 !! html/parsoid
23318 <p>!foo
23319 </p>
23320 !! wikitext
23321 !foo
23322 !! end
23323
23324 !! test
23325 Tables: 1c. No escaping needed
23326 !! options
23327 parsoid=html2wt
23328 !! html/parsoid
23329 <p>|foo
23330 </p>
23331 !! wikitext
23332 |foo
23333 !! end
23334
23335 !! test
23336 Tables: 1d. No escaping needed
23337 !! options
23338 parsoid=html2wt
23339 !! html/parsoid
23340 <p>|}foo
23341 </p>
23342 !! wikitext
23343 |}foo
23344 !! end
23345
23346 !! test
23347 Tables: 2a. Nested in td
23348 !! options
23349 parsoid=html2wt
23350 !! html/parsoid
23351 <table><tbody><tr>
23352 <td>foo|bar</td></tr>
23353 <tr><td>x<div>a|b</div></td>
23354 </tbody></table>
23355 !! wikitext
23356 {|
23357 |<nowiki>foo|bar</nowiki>
23358 |-
23359 |x<div><nowiki>a|b</nowiki></div>
23360 |}
23361 !! html/php+tidy
23362 <table>
23363 <tr>
23364 <td>foo|bar</td>
23365 </tr>
23366 <tr>
23367 <td>x
23368 <div>a|b</div>
23369 </td>
23370 </tr>
23371 </table>
23372 !! end
23373
23374 !! test
23375 Tables: 2b. Nested in td
23376 !! options
23377 parsoid=html2wt
23378 !! html/parsoid
23379 <table><tbody><tr>
23380 <td>foo||bar</td>
23381 <td>a<i>b||c</i></td>
23382 <td>a<i><div>b||c</div></i></td>
23383 </tr></tbody></table>
23384 !! wikitext
23385 {|
23386 |<nowiki>foo||bar</nowiki>
23387 |a''<nowiki>b||c</nowiki>''
23388 |a''<div><nowiki>b||c</nowiki></div>''
23389 |}
23390 !! html/php
23391 <table>
23392 <tr>
23393 <td>foo||bar
23394 </td>
23395 <td>a<i>b||c</i>
23396 </td>
23397 <td>a<i><div>b||c</div></i>
23398 </td></tr></table>
23399
23400 !! end
23401
23402 !! test
23403 Tables: 2c. Nested in td -- no escaping needed
23404 !! options
23405 parsoid=html2wt
23406 !! html/*
23407 <table>
23408 <tr>
23409 <td>foo!!bar
23410 </td></tr></table>
23411
23412 !! wikitext
23413 {|
23414 |foo!!bar
23415 |}
23416 !! end
23417
23418 !! test
23419 Tables: 3a. Nested in th
23420 !! options
23421 parsoid=html2wt
23422 !! html/*
23423 <table>
23424 <tr>
23425 <th>foo!bar
23426 </th></tr></table>
23427
23428 !! wikitext
23429 {|
23430 !foo!bar
23431 |}
23432 !! end
23433
23434 !! test
23435 Tables: 3b. Nested in th
23436 !! options
23437 parsoid=html2wt
23438 !! html/parsoid
23439 <table><tbody>
23440 <tr><th>foo!!bar</th>
23441 <th><i>foo|bar</i></th>
23442 <th><i>foo!!bar</i></th>
23443 <th><i><span>foo!!bar</span></i></th>
23444 </tr></tbody></table>
23445 !! wikitext
23446 {|
23447 !<nowiki>foo!!bar</nowiki>
23448 !''<nowiki>foo|bar</nowiki>''
23449 !''<nowiki>foo!!bar</nowiki>''
23450 !''<span><nowiki>foo!!bar</nowiki></span>''
23451 |}
23452 !! html/php
23453 <table>
23454 <tr>
23455 <th>foo!!bar
23456 </th>
23457 <th><i>foo|bar</i>
23458 </th>
23459 <th><i>foo!!bar</i>
23460 </th>
23461 <th><i><span>foo!!bar</span></i>
23462 </th></tr></table>
23463
23464 !! end
23465
23466 !! test
23467 Tables: 3c. Nested in th
23468 !! options
23469 parsoid=html2wt
23470 !! html/parsoid
23471 <table><tbody>
23472 <tr><th>foo||bar</th>
23473 <th><span typeof="mw:Nowiki">foo||bar</span></th>
23474 </tr></tbody></table>
23475 !! wikitext
23476 {|
23477 !<nowiki>foo||bar</nowiki>
23478 !<nowiki>foo||bar</nowiki>
23479 |}
23480 !! html/php
23481 <table>
23482 <tr>
23483 <th>foo||bar
23484 </th>
23485 <th>foo||bar
23486 </th></tr></table>
23487
23488 !! end
23489
23490 !! test
23491 Tables: 4a. Escape -
23492 !! options
23493 parsoid=html2wt
23494 !! html/*
23495 <table>
23496 <tr>
23497 <th>-bar
23498 </th></tr>
23499 <tr>
23500 <td>-bar
23501 </td></tr></table>
23502
23503 !! wikitext
23504 {|
23505 !-bar
23506 |-
23507 |<nowiki>-bar</nowiki>
23508 |}
23509 !! end
23510
23511 !! test
23512 Tables: 4b. Escape +
23513 !! options
23514 parsoid=html2wt
23515 !! html/*
23516 <table>
23517 <tr>
23518 <th>+bar
23519 </th></tr>
23520 <tr>
23521 <td>+bar
23522 </td></tr></table>
23523
23524 !! wikitext
23525 {|
23526 !+bar
23527 |-
23528 |<nowiki>+bar</nowiki>
23529 |}
23530 !! end
23531
23532 !! test
23533 Tables: 4c. No escaping needed
23534 !! options
23535 parsoid=html2wt
23536 !! html/parsoid
23537 <table><tbody>
23538 <tr><td>foo-bar</td><td>foo+bar</td></tr>
23539 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
23540 <tr><td>foo
23541 <p>bar|baz
23542 +bar
23543 -bar</p></td></tr>
23544 <tr><td>x
23545 <div>a|b</div></td>
23546 </tbody></table>
23547 !! wikitext
23548 {|
23549 |foo-bar
23550 |foo+bar
23551 |-
23552 |''foo''-bar
23553 |''foo''+bar
23554 |-
23555 |foo
23556 bar|baz
23557 +bar
23558 -bar
23559 |-
23560 |x
23561 <div>a|b</div>
23562 |}
23563 !! html/php
23564 <table>
23565 <tr>
23566 <td>foo-bar
23567 </td>
23568 <td>foo+bar
23569 </td></tr>
23570 <tr>
23571 <td><i>foo</i>-bar
23572 </td>
23573 <td><i>foo</i>+bar
23574 </td></tr>
23575 <tr>
23576 <td>foo
23577 <p>bar|baz
23578 +bar
23579 -bar
23580 </p>
23581 </td></tr>
23582 <tr>
23583 <td>x
23584 <div>a|b</div>
23585 </td></tr></table>
23586
23587 !! end
23588
23589 !! test
23590 Tables: 4d. No escaping needed
23591 !! options
23592 parsoid=html2wt
23593 !! html/parsoid
23594 <table>
23595 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
23596 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
23597 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
23598 </tbody></table>
23599 !! wikitext
23600 {|
23601 |[[Foo]]-bar
23602 ||+1
23603 ||-2
23604 |}
23605 !! html/php
23606 <table>
23607 <tr>
23608 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
23609 </td>
23610 <td>+1
23611 </td>
23612 <td>-2
23613 </td></tr></table>
23614
23615 !! end
23616
23617 !! test
23618 T97430: Don't emit empty nowiki pairs around marker meta tags
23619 !! options
23620 parsoid=html2wt
23621 !! html/parsoid
23622 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
23623 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
23624 !! wikitext
23625 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
23626 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
23627 !! end
23628
23629 !! test
23630 Unclosed xmlish element in table line shouldn't eat end delimiters
23631 !! options
23632 parsoid=html2wt
23633 !! html/parsoid
23634 <table>
23635 <tbody><tr><td> &lt;foo</td>
23636 <td> bar></td></tr>
23637 </tbody></table>
23638 !! wikitext
23639 {|
23640 | <foo
23641 | bar>
23642 |}
23643 !! html/php
23644 <table>
23645 <tr>
23646 <td> &lt;foo
23647 </td>
23648 <td> bar&gt;
23649 </td></tr></table>
23650
23651 !! end
23652
23653 #### --------------- Links ----------------
23654 #### 1. Quote marks in link text
23655 #### 2. Wikilinks: Escapes needed
23656 #### 3. Wikilinks: No escapes needed
23657 #### 4. Extlinks: Escapes needed
23658 #### 5. Extlinks: No escapes needed
23659 #### --------------------------------------
23660 !! test
23661 Links 1. WikiLinks: No escapes needed
23662 !! options
23663 parsoid=html2wt
23664 !! html/parsoid
23665 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
23666 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
23667 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
23668 !! wikitext
23669 [[Foo|Foo''boo'']]
23670 [[Foo|[Foobar]]]
23671 [[Foo|x [Foobar] x]]
23672 !! html/php
23673 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
23674 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
23675 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
23676 </p>
23677 !! end
23678
23679 !! test
23680 Links 2. WikiLinks: Escapes needed
23681 !! options
23682 parsoid=html2wt
23683 !! html/parsoid
23684 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
23685 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
23686 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
23687 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
23688 <a href="Foo" rel="mw:WikiLink">|Bar</a>
23689 <a href="Foo" rel="mw:WikiLink">]]bar</a>
23690 <a href="Foo" rel="mw:WikiLink">[[bar</a>
23691 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
23692 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
23693 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
23694 !! wikitext
23695 [[Foo|<nowiki>Foobar]</nowiki>]]
23696 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
23697 [[Foo|<nowiki>[[Bar]]</nowiki>]]
23698 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
23699 [[Foo|<nowiki>|Bar</nowiki>]]
23700 [[Foo|<nowiki>]]bar</nowiki>]]
23701 [[Foo|<nowiki>[[bar</nowiki>]]
23702 [[Foo|<nowiki>x [[ y</nowiki>]]
23703 [[Foo|<nowiki>x ]] y</nowiki>]]
23704 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
23705 !! html/php
23706 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
23707 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
23708 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
23709 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
23710 <a href="/wiki/Foo" title="Foo">|Bar</a>
23711 <a href="/wiki/Foo" title="Foo">]]bar</a>
23712 <a href="/wiki/Foo" title="Foo">[[bar</a>
23713 <a href="/wiki/Foo" title="Foo">x [[ y</a>
23714 <a href="/wiki/Foo" title="Foo">x ]] y</a>
23715 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
23716 </p>
23717 !! end
23718
23719 !! test
23720 Links 3. WikiLinks: No escapes needed
23721 !! options
23722 parsoid=html2wt
23723 !! html/parsoid
23724 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
23725 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
23726 !! wikitext
23727 [[Foo|[Foobar]]
23728 [[Foo|foo|bar]]
23729 !! html/php
23730 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
23731 <a href="/wiki/Foo" title="Foo">foo|bar</a>
23732 </p>
23733 !! end
23734
23735 !! test
23736 Links 4. ExtLinks: Escapes needed
23737 !! options
23738 parsoid=html2wt
23739 !! html/parsoid
23740 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
23741 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
23742 <p>[http://google.com]</p>
23743 <p>[http://google.com google]</p>
23744 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
23745 <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>
23746 !! wikitext
23747 [http://google.com <nowiki>[google]</nowiki>]
23748 [http://google.com <nowiki>google]</nowiki>]
23749
23750 <nowiki>[http://google.com]</nowiki>
23751
23752 <nowiki>[http://google.com google]</nowiki>
23753
23754 [http://google.com<nowiki>]</nowiki>
23755
23756 [{{echo|http://google.com}}<nowiki>]</nowiki>
23757 !! html/php
23758 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
23759 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
23760 </p><p>[http://google.com]
23761 </p><p>[http://google.com google]
23762 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
23763 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
23764 </p>
23765 !! end
23766
23767 !! test
23768 Links 5. ExtLinks: No escapes needed
23769 !! options
23770 parsoid=html2wt
23771 !! html/parsoid
23772 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
23773 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
23774 !! wikitext
23775 [http://google.com [google]
23776
23777 [[http://google.com]]
23778 !! html/php
23779 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
23780 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
23781 </p>
23782 !! end
23783
23784 !! test
23785 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
23786 !! options
23787 parsoid=html2wt
23788 !! html/parsoid
23789 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
23790 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
23791 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
23792 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
23793 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
23794 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
23795 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
23796 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
23797 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
23798 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
23799 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
23800 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
23801 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
23802 </p>
23803 !! wikitext
23804 x<nowiki/>http://example.com<nowiki/>y
23805 http://example.com<nowiki/>?x
23806 http://example.com<nowiki/>&x
23807 http://example.com<nowiki/>'x
23808 http://example.com<nowiki/>,x
23809 http://example.com<nowiki/>.x
23810 http://example.com<nowiki/>;x
23811 http://example.com<nowiki/>:x
23812 http://example.com<nowiki/>;x
23813 http://example.com<nowiki/>!x
23814 http://example.com<nowiki/>=x
23815 http://example.com<nowiki/>(x)
23816 http://example.com(x<nowiki/>)
23817 !! end
23818
23819 !! test
23820 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
23821 !! options
23822 parsoid=html2wt
23823 !! html/parsoid
23824 <p>x
23825 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
23826 y
23827 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
23828 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
23829 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
23830 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
23831 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
23832 </p>
23833 !! wikitext
23834 x
23835 http://example.com
23836 y
23837 "http://example.com"
23838 (http://example.com)
23839 (http://example.com) foo
23840 http://example.com,
23841 http://example.com, foo
23842 !! html/php
23843 <p>x
23844 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
23845 y
23846 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
23847 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
23848 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
23849 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
23850 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
23851 </p>
23852 !! end
23853
23854 !! test
23855 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
23856 !! options
23857 parsoid=html2wt
23858 !! html/parsoid
23859 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
23860 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
23861 !! wikitext
23862 http://example.com.,;:!?\
23863 -http://example.com:
23864 !! html/php
23865 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
23866 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
23867 </p>
23868 !! end
23869
23870 !! test
23871 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
23872 !! options
23873 parsoid=html2wt
23874 !! html/parsoid
23875 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
23876 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
23877 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
23878 !! wikitext
23879 RFC 123<nowiki/>4
23880 RFC 123<nowiki/>y
23881 X<nowiki/>RFC 123<nowiki/>y
23882 !! end
23883
23884 !! test
23885 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
23886 !! options
23887 parsoid=html2wt
23888 !! html/parsoid
23889 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
23890 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
23891 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
23892 </p>
23893 !! wikitext
23894 RFC 123?foo
23895 RFC 123&foo
23896 -RFC 123-
23897 !! html/php
23898 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
23899 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
23900 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
23901 </p>
23902 !! end
23903
23904 !! test
23905 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
23906 !! options
23907 parsoid=html2wt
23908 !! html/parsoid
23909 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
23910 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
23911 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
23912 !! wikitext
23913 PMID 123<nowiki/>4
23914 PMID 123<nowiki/>y
23915 X<nowiki/>PMID 123<nowiki/>y
23916 !! end
23917
23918 !! test
23919 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
23920 !! options
23921 parsoid=html2wt
23922 !! html/parsoid
23923 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
23924 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
23925 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
23926 </p>
23927 !! wikitext
23928 PMID 123?foo
23929 PMID 123&foo
23930 -PMID 123-
23931 !! html/php
23932 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
23933 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
23934 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
23935 </p>
23936 !! end
23937
23938 !! test
23939 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
23940 !! options
23941 parsoid=html2wt
23942 !! html/parsoid
23943 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
23944 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
23945 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
23946 </p>
23947 !! wikitext
23948 ISBN 1234567890<nowiki/>1
23949 ISBN 1234567890<nowiki/>x
23950 a<nowiki/>ISBN 1234567890<nowiki/>b
23951 !! end
23952
23953 !! test
23954 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
23955 !! options
23956 parsoid=html2wt
23957 !! html/parsoid
23958 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
23959 !! wikitext
23960 -ISBN 1234567890's
23961 !! html/php
23962 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
23963 </p>
23964 !! end
23965
23966 !! test
23967 Links 14. Protect link-like plain text. (Parsoid bug T78425)
23968 !! options
23969 parsoid=html2wt
23970 !! html/*
23971 <p>this is not a link: http://example.com
23972 </p>
23973 !! wikitext
23974 this is not a link: <nowiki>http://example.com</nowiki>
23975 !! end
23976
23977 !! test
23978 Links 15. Link trails can't become link prefixes.
23979 !! options
23980 language=is
23981 parsoid=html2wt
23982 !! html/parsoid
23983 <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>
23984 !! wikitext
23985 [[Söfnuður]]-[[00]]
23986 !! html/php
23987 <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>
23988 </p>
23989 !! end
23990
23991 #### --------------- Quotes ---------------
23992 #### 1. Quotes inside <b> and <i>
23993 #### 2. Link fragments separated by <i> and <b> tags
23994 #### 3. Link fragments inside <i> and <b>
23995 #### 4. No escaping needed
23996 #### --------------------------------------
23997 !! test
23998 1a. Quotes inside <b> and <i>
23999 !! options
24000 parsoid=html2wt
24001 !! html/*
24002 <p><i>'foo'</i>
24003 <i>''foo''</i>
24004 <i>'''foo'''</i>
24005 <i>foo</i>'s
24006 <b>'foo'</b>
24007 <b>''foo''</b>
24008 <b>'''foo'''</b>
24009 <b>foo'<i>bar'</i>baz</b>
24010 <b>foo</b>'s
24011 '<i>foo</i>
24012 <i>foo</i>'
24013 <i>foo'</i>'
24014 '<i>foo</i>'
24015 '<b>foo</b>
24016 <b>foo</b>'
24017 '<b>foo</b>'
24018 <i>fools'<span> errand</span></i>
24019 <i><span>fool</span>'s errand</i>
24020 '<i>foo</i> bar '<i>baz</i>
24021 a|!*#-:;+-~[]{}b'<i>x</i>
24022 </p>
24023 !! wikitext
24024 ''<nowiki/>'foo'''
24025 ''<nowiki>''foo''</nowiki>''
24026 ''<nowiki>'''foo'''</nowiki>''
24027 ''foo''<nowiki/>'s
24028 '''<nowiki/>'foo''''
24029 '''<nowiki>''foo''</nowiki>'''
24030 '''<nowiki>'''foo'''</nowiki>'''
24031 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
24032 '''foo'''<nowiki/>'s
24033 '''foo''
24034 ''foo''<nowiki/>'
24035 ''foo'''<nowiki/>'
24036 '''foo''<nowiki/>'
24037 ''''foo'''
24038 '''foo'''<nowiki/>'
24039 ''''foo'''<nowiki/>'
24040 ''fools'<span> errand</span>''
24041 ''<span>fool</span>'s errand''
24042 '<nowiki/>''foo'' bar '''baz''
24043 a|!*#-:;+-~[]{}b'''x''
24044 !! end
24045
24046 !! test
24047 1b. Quotes inside <b> and <i> with other tags on same line
24048 !! options
24049 parsoid=html2wt
24050 !! html/parsoid
24051 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
24052 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
24053 <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>
24054 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
24055 '<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>
24056 '<i>foo</i> <div title="name">test</div>
24057 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
24058 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
24059 <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>
24060 </ol>
24061 !! wikitext
24062 '''a'' foo ''[[bar]]''
24063 ''a''' foo ''[[bar]]''
24064 ''a''' foo '''{{echo|[[bar]]}}'''
24065 [[foo]] x'''[[bar]]''
24066 '''foo'' <ref>test</ref>
24067 '''foo'' <div title="name">test</div>
24068 '''foo'' and <br> bar
24069 <references />
24070 !! end
24071
24072 !! test
24073 2. Link fragments separated by <i> and <b> tags
24074 !! options
24075 parsoid=html2wt
24076 !! html/parsoid
24077 <p>[[<i>foo</i>hello]]</p>
24078 <p>[[<b>foo</b>hello]]</p>
24079 !! wikitext
24080 [[''foo''<nowiki>hello]]</nowiki>
24081
24082 [['''foo'''<nowiki>hello]]</nowiki>
24083 !! end
24084
24085 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
24086 # this is one of the shortcomings of this format
24087 !! test
24088 3. Link fragments inside <i> and <b>
24089 !! options
24090 parsoid=html2wt
24091 !! html/parsoid
24092 <p><i>[[foo</i>]]</p>
24093 <p><b>[[foo</b>]]</p>
24094 !! wikitext
24095 ''[[foo''<nowiki>]]</nowiki>
24096
24097 '''[[foo'''<nowiki>]]</nowiki>
24098 !! end
24099
24100 !! test
24101 4. No escaping needed
24102 !! options
24103 options=html2wt
24104 !! html/parsoid
24105 <p>'<span><i>bar</i></span>'
24106 '<span><b>bar</b></span>'
24107 'a:b'foo
24108 </p>
24109 !! wikitext
24110 '<span>''bar''</span>'
24111 '<span>'''bar'''</span>'
24112 'a:b'foo
24113 !! end
24114
24115 #### ----------- Paragraphs ---------------
24116 #### 1. No unnecessary escapes
24117 #### --------------------------------------
24118
24119 !! test
24120 1. No unnecessary escapes
24121 !! options
24122 parsoid=html2wt
24123 !! html/parsoid
24124 <p>bar <span>[[foo]]</span>
24125 </p><p>=bar <span>[[foo]]</span>
24126 </p><p>[[bar <span>[[foo]]</span>
24127 </p><p>]]bar <span>[[foo]]</span>
24128 </p><p>=bar <span>foo]]</span>=
24129 </p>
24130 !! wikitext
24131 bar <span><nowiki>[[foo]]</nowiki></span>
24132
24133 =bar <span><nowiki>[[foo]]</nowiki></span>
24134
24135 [[bar <span><nowiki>[[foo]]</nowiki></span>
24136
24137 ]]bar <span><nowiki>[[foo]]</nowiki></span>
24138
24139 =bar <span>foo]]</span><nowiki>=</nowiki>
24140 !!end
24141
24142 #### ----------------------- PRE --------------------------
24143 #### 1. Leading whitespace in SOL context should be escaped
24144 #### ------------------------------------------------------
24145 !! test
24146 1. Leading whitespace in SOL context should be escaped
24147 !! options
24148 parsoid=html2wt
24149 !! html/parsoid
24150 <p> a</p>
24151
24152 <p> a</p>
24153
24154 <p> a(tab)</p>
24155
24156 <p> a
24157 <!--cmt-->
24158 a</p>
24159
24160 <p>a
24161 b</p>
24162
24163 <p>a
24164 b</p>
24165
24166 <p>a
24167 b</p>
24168 !! wikitext
24169 <nowiki> </nowiki>a
24170
24171 <nowiki> </nowiki> a
24172
24173 a(tab)
24174
24175 <nowiki> </nowiki> a
24176 <!--cmt-->
24177 <nowiki> </nowiki>a
24178
24179 a
24180 <nowiki> </nowiki>b
24181
24182 a
24183 b
24184
24185 a
24186 b
24187 !! html/php
24188 <p> a
24189 </p><p> a
24190 </p><p> a(tab)
24191 </p><p> a
24192 a
24193 </p><p>a
24194 b
24195 </p><p>a
24196 b
24197 </p><p>a
24198 b
24199 </p>
24200 !! end
24201
24202 !! test
24203 2. Leading whitespace in non-indent-pre contexts should not be escaped
24204 !! options
24205 parsoid=html2wt
24206 !! html/parsoid
24207 <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>
24208 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
24209 <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>
24210 b</span></li>
24211 </ol>
24212 !! wikitext
24213 foo <ref>''a''
24214 b</ref>
24215 <references />
24216 !! end
24217
24218 !! test
24219 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
24220 !! options
24221 parsoid=html2wt
24222 !! html/parsoid
24223 <blockquote>
24224 <p>
24225 a
24226 <span>b</span>
24227 c</p>
24228 </blockquote>
24229 !! wikitext
24230 <blockquote>
24231 a
24232 <span>b</span>
24233 c
24234 </blockquote>
24235 !! end
24236
24237 !! test
24238 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
24239 !! options
24240 options=html2wt
24241 !! html/parsoid
24242 <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>
24243 !! wikitext
24244 [[File:Foobar.jpg|thumb|caption]]
24245 !! end
24246
24247 !! test
24248 5. Nowiki escaping should account for indent-pres
24249 !! options
24250 parsoid=html2wt
24251 !! html/parsoid
24252 <pre>==foo==</pre>
24253 !! wikitext
24254 ==foo==
24255 !! end
24256
24257 !!test
24258 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
24259 !! options
24260 parsoid=html2wt
24261 !! html/parsoid
24262 <pre>
24263 * foo
24264 * bar
24265 </pre>
24266 !! wikitext
24267 * foo
24268 * bar
24269 !! end
24270
24271 #### --------------- Behavior Switches --------------------
24272
24273 !! test
24274 1. Valid behavior switches should be escaped
24275 !! options
24276 parsoid=html2wt
24277 !! html/parsoid
24278 __TOC__
24279 <i>__TOC__</i>
24280 !! wikitext
24281 <nowiki>__TOC__</nowiki>
24282 ''<nowiki>__TOC__</nowiki>''
24283 !! end
24284
24285 !! test
24286 2. Invalid behavior switches should not be escaped
24287 !! options
24288 parsoid=html2wt
24289 !! html/parsoid
24290 __TOO__
24291 __|__
24292 !! wikitext
24293 __TOO__
24294 __|__
24295 !! end
24296
24297 # We use indent-pre as an indirect way to test for sol-transparent behavior.
24298 !! test
24299 Behavior switches should be SOL-transparent
24300 !! options
24301 parsoid=html2wt
24302 !! html/parsoid
24303 <meta property="mw:PageProp/toc" />
24304
24305 <!-- this one's bogus -->
24306 <pre>__TOO__</pre>
24307
24308 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
24309
24310 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
24311 !! wikitext
24312 __TOC__
24313
24314 <!-- this one's bogus -->
24315 __TOO__
24316
24317 __TOC__ foo
24318
24319 __TOC__
24320 bar
24321 !! end
24322
24323 #### --------------- HTML tags ---------------
24324 #### 1. a tags
24325 #### 2. other tags
24326 #### 3. multi-line html tag
24327 #### 4. extension tags
24328 #### -----------------------------------------
24329 !! test
24330 1. a tags
24331 !! options
24332 parsoid=html2wt
24333 !! html/parsoid
24334 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
24335 !! wikitext
24336 <a href="http://google.com">google</a>
24337 !! end
24338
24339 !! test
24340 2. other tags
24341 !! options
24342 parsoid=html2wt
24343 !! html/parsoid
24344 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
24345 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
24346 <li> &lt;td&gt;</li></ul>
24347
24348 !! wikitext
24349 * <nowiki><div>foo</div></nowiki>
24350 * <nowiki><div style="color:red">foo</div></nowiki>
24351 * <nowiki><td></nowiki>
24352 !! end
24353
24354 !! test
24355 3. multi-line html tag
24356 !! options
24357 parsoid=html2wt
24358 !! html/parsoid
24359 <p>&lt;div
24360 &gt;foo&lt;/div
24361 &gt;
24362 </p>
24363 !! wikitext
24364 <nowiki><div
24365 >foo</div
24366 ></nowiki>
24367 !! end
24368
24369 !! test
24370 4. extension tags
24371 !! options
24372 parsoid=html2wt
24373 !! html/parsoid
24374 <p>&lt;ref&gt;foo&lt;/ref&gt;
24375 </p><p>&lt;ref&gt;bar
24376 </p><p>baz&lt;/ref&gt;
24377 </p>
24378 !! wikitext
24379 <nowiki><ref>foo</ref></nowiki>
24380
24381 <nowiki><ref>bar</nowiki>
24382
24383 baz<nowiki></ref></nowiki>
24384 !! end
24385
24386 #### --------------- Others ---------------
24387 !! test
24388 Escaping nowikis
24389 !! options
24390 parsoid=html2wt
24391 !! html/parsoid
24392 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
24393 </p>
24394 !! wikitext
24395 &lt;nowiki&gt;foo&lt;/nowiki&gt;
24396 !! end
24397
24398 ## The quote-char in the input is necessary for triggering the bug
24399 !! test
24400 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
24401 !! options
24402 parsoid=html2wt
24403 !! html/parsoid
24404 <p>foo's bar :</p>
24405 !! wikitext
24406 foo's bar :
24407 !! end
24408
24409 #----------- End of wikitext escaping tests --------------
24410
24411 !! test
24412
24413 Tag-like HTML structures are passed through as text
24414 !! wikitext
24415 <x y>
24416
24417 <x.y>
24418
24419 <x-y>
24420
24421 1>2
24422
24423 x<y
24424
24425 a>b
24426
24427 1<d e>f
24428 !! html
24429 <p>&lt;x y&gt;
24430 </p><p>&lt;x.y&gt;
24431 </p><p>&lt;x-y&gt;
24432 </p><p>1&gt;2
24433 </p><p>x&lt;y
24434 </p><p>a&gt;b
24435 </p><p>1&lt;d e&gt;f
24436 </p>
24437 !! end
24438
24439 !! test
24440 HTML tag with necessary entities in attributes
24441 !! wikitext
24442 <span title="&amp;amp;">foo</span>
24443 !! html
24444 <p><span title="&amp;amp;">foo</span>
24445 </p>
24446 !! end
24447
24448 !! test
24449 HTML tag with 'unnecessary' entity encoding in attributes
24450 !! wikitext
24451 <span title="&amp;">foo</span>
24452 !! html
24453 <p><span title="&amp;">foo</span>
24454 </p>
24455 !! end
24456
24457 !! test
24458 HTML tag with broken attribute value quoting
24459 !! options
24460 parsoid=wt2html,html2html
24461 !! wikitext
24462 <span title="Hello world>Foo</span>
24463 !! html/php
24464 <p><span title="Hello world">Foo</span>
24465 </p>
24466 !! html/parsoid
24467 <p><span title="Hello world">Foo</span></p>
24468 !! end
24469
24470 !! test
24471 Self-closed tag with broken attribute value quoting
24472 !! options
24473 parsoid=wt2html,html2html
24474 !! wikitext
24475 <div title="Hello world />Foo
24476 !! html/php+tidy
24477 <div title="Hello world"></div>
24478 <p>Foo</p>
24479 !! html/parsoid
24480 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
24481 !! end
24482
24483 !! test
24484 Table with broken attribute value quoting
24485 !! options
24486 parsoid=wt2html,html2html
24487 !! wikitext
24488 {|
24489 | title="Hello world|Foo
24490 |}
24491 !! html/php
24492 <table>
24493 <tr>
24494 <td title="Hello world">Foo
24495 </td></tr></table>
24496
24497 !! html/parsoid
24498 <table>
24499 <tr>
24500 <td title="Hello world">Foo
24501 </td></tr></table>
24502
24503 !! end
24504
24505 !! test
24506 Table with broken attribute value quoting on consecutive lines
24507 !! options
24508 parsoid=wt2html,html2html
24509 !! wikitext
24510 {|
24511 | title="Hello world|Foo
24512 | style="color:red|Bar
24513 |}
24514 !! html/php
24515 <table>
24516 <tr>
24517 <td title="Hello world">Foo
24518 </td>
24519 <td style="color:red">Bar
24520 </td></tr></table>
24521
24522 !! html/parsoid
24523 <table><tbody>
24524 <tr>
24525 <td title="Hello world">Foo
24526 </td><td style="color: red">Bar
24527 </td></tr></tbody></table>
24528
24529 !! end
24530
24531 !!test
24532 Accept empty td cell attribute
24533 !! wikitext
24534 {|
24535 | align="center" | foo || |
24536 |}
24537 !! html
24538 <table>
24539 <tr>
24540 <td align="center"> foo </td>
24541 <td>
24542 </td></tr></table>
24543
24544 !!end
24545
24546 !!test
24547 Non-empty attributes in th-cells
24548 !! wikitext
24549 {|
24550 ! Foo !! style="color: red" | Bar
24551 |}
24552 !! html
24553 <table>
24554 <tr>
24555 <th> Foo </th>
24556 <th style="color: red"> Bar
24557 </th></tr></table>
24558
24559 !!end
24560
24561 !!test
24562 Accept empty attributes in th-cells
24563 !! wikitext
24564 {|
24565 !| foo !!| bar
24566 |}
24567 !! html
24568 <table>
24569 <tr>
24570 <th> foo </th>
24571 <th> bar
24572 </th></tr></table>
24573
24574 !!end
24575
24576 !!test
24577 Empty table rows go away
24578 !! wikitext
24579 {|
24580 | Hello
24581 | there
24582 |- class="foo"
24583 |-
24584 |}
24585 !! html
24586 <table>
24587 <tr>
24588 <td> Hello
24589 </td>
24590 <td> there
24591 </td></tr>
24592
24593 </table>
24594
24595 !! end
24596
24597 ###
24598 ### Parsoid-centric tests for testing RTing of inter-element separators
24599 ### Edge cases not tested by existing parser tests and specific to
24600 ### Parsoid-specific serialization strategies.
24601 ###
24602
24603 !!test
24604 RT-ed inter-element separators should be valid separators
24605 !! wikitext
24606 {|
24607 |- [[foo]]
24608 |}
24609 !! html/php
24610 <table>
24611
24612 </table>
24613
24614 !! html/parsoid
24615 <table>
24616 <tbody><tr data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
24617 </tbody></table>
24618 !!end
24619
24620 # Parsoid-only since PHP parser relies on Tidy for correct output
24621 !!test
24622 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
24623 !!options
24624 parsoid
24625 !! wikitext
24626 {|
24627 |<small>foo
24628 bar
24629 |}
24630
24631 {|
24632 |<small>foo<small>
24633 |}
24634 !! html
24635 <table>
24636 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
24637 <p>bar</p></small></td></tr>
24638 </tbody></table>
24639
24640 <table>
24641 <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>
24642 </tbody></table>
24643 !!end
24644
24645 # Note that the "style" attribute is really a template parameter here.
24646 # The = would have to be {{=}} if you wanted the literal.
24647 !!test
24648 Empty TD followed by TD with tpl-generated attribute
24649 !! wikitext
24650 {|
24651 |-
24652 |
24653 |{{echo|style='color:red'}}|foo
24654 |}
24655 !! html
24656 <table>
24657
24658 <tr>
24659 <td>
24660 </td>
24661 <td>foo
24662 </td></tr></table>
24663
24664 !!end
24665
24666 !!test
24667 Indented table with an empty td
24668 !! wikitext
24669 {|
24670 |-
24671 |
24672 |foo
24673 |}
24674 !! html
24675 <table>
24676
24677 <tr>
24678 <td>
24679 </td>
24680 <td>foo
24681 </td></tr></table>
24682
24683 !!end
24684
24685 ## We have some newline diffs RT-ing this edge case
24686 ## and it is not important enough -- we seem to be emitting
24687 ## at most 2 newlines after a </tr> and this is unrelated to
24688 ## the issue from T85627 that this is testing.
24689 !!test
24690 Indented table with blank lines in between (T85627)
24691 !! options
24692 parsoid=wt2html
24693 !! wikitext
24694 {|
24695 |foo
24696
24697
24698 |}
24699 !! html
24700 <table>
24701
24702 <tr>
24703 <td>foo
24704 </td></tr></table>
24705
24706 !!end
24707
24708 !!test
24709 Indented block & table
24710 !! wikitext
24711 <div>foo</div>
24712 {|
24713 |foo
24714 |}
24715 !! html/php
24716 <div>foo</div>
24717 <table>
24718 <tr>
24719 <td>foo
24720 </td></tr></table>
24721
24722 !! html/parsoid
24723 <div data-parsoid='{"stx":"html"}'>foo</div>
24724 <table><tbody>
24725 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
24726 </tbody></table>
24727 !!end
24728
24729 !! test
24730 Indent and comment before table row
24731 !! wikitext
24732 {|
24733 <!--hi-->|-
24734 | there
24735 |}
24736 !! html/php
24737 <table>
24738
24739 <tr>
24740 <td> there
24741 </td></tr></table>
24742
24743 !! html/parsoid
24744 <table>
24745 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
24746 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
24747 </tbody></table>
24748 !! end
24749
24750 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
24751 !!test
24752 Empty TR followed by a template-generated TR
24753 !!options
24754 parsoid
24755 !! wikitext
24756 {|
24757 |-
24758 {{echo|<tr><td>foo</td></tr>}}
24759 |}
24760 !! html
24761 <table>
24762 <tbody>
24763 <tr></tr>
24764 <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}}]}'>
24765 <td>foo</td></tr>
24766 </tbody></table>
24767 !!end
24768
24769 ## PHP and parsoid output differ for this, and since this is primarily
24770 ## for testing Parsoid's serializer, marking this Parsoid only
24771 !!test
24772 Empty TR followed by mixed-ws-comment line should RT correctly
24773 !!options
24774 parsoid
24775 !! wikitext
24776 {|
24777 |-
24778 <!--c-->
24779 |-
24780 <!--c--> <!--d-->
24781 |}
24782 !! html
24783 <table>
24784 <tbody>
24785 <tr></tr>
24786 <!--c-->
24787 <tr>
24788 <!--c--> </tr><!--d-->
24789 </tbody></table>
24790
24791 !!end
24792
24793 !!test
24794 Multi-line image caption generated by templates with/without trailing newlines
24795 !! wikitext
24796 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
24797 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
24798 !! html/parsoid
24799 <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>
24800 <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>
24801 !!end
24802
24803 !! test
24804 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
24805 !! options
24806 parsoid=html2wt
24807 !! html/parsoid
24808 <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>
24809
24810 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
24811 !! wikitext
24812 <includeonly>foo</includeonly>
24813 new para
24814
24815 [[Category:Foo]]
24816
24817 = new heading =
24818 !! end
24819
24820 ## PHP emits broken html for this, and since this is primarily
24821 ## a Parsoid serializer test, marking this Parsoid only
24822 !!test
24823 Improperly nested inline or quotes tags with whitespace in between
24824 !! wikitext
24825 <span> <s>x</span> </s>
24826 ''' ''x''' ''
24827 !! html/parsoid
24828 <p><span> <s>x</s></span><s> </s>
24829 <b> <i>x</i></b><i> </i>
24830 </p>
24831 !!end
24832
24833 !!test
24834 Encapsulate protected attributes from wt
24835 !! wikitext
24836 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
24837
24838 {| typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true"
24839 | ok
24840 |}
24841 !! html/parsoid
24842 <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>
24843
24844 <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">
24845 <tbody><tr><td data-parsoid='{"autoInsertedEnd":true}'> ok</td></tr>
24846 </tbody></table>
24847 !!end
24848
24849 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
24850 ## Having nested or stray pre tags results in the attempt to add duplicates,
24851 ## causing an assertion fail. This test tries to prevent that situation.
24852 !!test
24853 Ensure ParagraphWrapper can deal with stray closing pre tags
24854 !!options
24855 parsoid=wt2html
24856 !! wikitext
24857 plain text</pre>
24858 !! html/parsoid
24859 plain text
24860 !!end
24861
24862 !!test
24863 1. Ensure fostered text content is wrapped in element nodes
24864 !!options
24865 parsoid=wt2html
24866 !! wikitext
24867 <table>hi</table><table>ho</table>
24868 !! html/parsoid
24869 <p>hi</p>
24870 <table></table>
24871 <p>ho</p>
24872 <table></table>
24873 !!end
24874
24875 !!test
24876 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
24877 !!options
24878 parsoid=wt2html,wt2wt
24879 !! wikitext
24880 <table>
24881 <tr> || ||
24882 <td> a
24883 </table>
24884 !! html/parsoid
24885 <p> || ||
24886 </p><table>
24887 <tbody><tr><td> a</td></tr>
24888 </tbody></table>
24889 !!end
24890
24891 !!test
24892 Encapsulation properly handles null DSR information from foster box
24893 !!options
24894 parsoid=wt2html,wt2wt
24895 !! wikitext
24896 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
24897 !! html/parsoid
24898 <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>
24899 !!end
24900
24901 !!test
24902 1. Encapsulate foster-parented transclusion content
24903 !!options
24904 parsoid=wt2wt,wt2html
24905 !! wikitext
24906 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
24907 !! html/parsoid
24908 <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>
24909 <tbody>
24910 <tr>
24911 <td>bar</td>
24912 </tr>
24913 </tbody>
24914 </table>
24915 !!end
24916
24917 !!test
24918 2. Encapsulate foster-parented transclusion content
24919 !!options
24920 parsoid=wt2wt,wt2html
24921 !! wikitext
24922 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
24923 !! html/parsoid
24924 <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>
24925 <table>
24926 <tbody>
24927 <tr>
24928 <td>bar</td>
24929 </tr>
24930 </tbody>
24931 </table>
24932 !!end
24933
24934 !!test
24935 3. Encapsulate foster-parented transclusion content
24936 !!options
24937 parsoid=wt2wt,wt2html
24938 !! wikitext
24939 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
24940 !! html/parsoid
24941 <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;]}">
24942 <p>foo</p>
24943 </div>
24944 <table>
24945 <tbody>
24946 <tr>
24947 <td>bar</td>
24948 </tr>
24949 </tbody>
24950 </table>
24951 !!end
24952
24953 !!test
24954 4. Encapsulate foster-parented transclusion content
24955 !!options
24956 parsoid=wt2wt,wt2html
24957 !! wikitext
24958 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
24959 !! html/parsoid
24960 <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;]}">
24961 <p>foo</p>
24962 </div>
24963 <table>
24964 <tbody>
24965 <tr>
24966 <td>bar</td>
24967 </tr>
24968 </tbody>
24969 </table>
24970 !!end
24971
24972 !!test
24973 5. Encapsulate foster-parented transclusion content
24974 !!options
24975 parsoid=wt2wt,wt2html
24976 !! wikitext
24977 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
24978 !! html/parsoid
24979 <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>
24980 <table>
24981 <tbody>
24982 <tr>
24983 <td>
24984 <div>
24985 <p>foo</p>
24986 </div>
24987 </td>
24988 </tr>
24989 </tbody>
24990 </table>
24991 !!end
24992
24993 !!test
24994 6. Encapsulate foster-parented transclusion content
24995 !!options
24996 parsoid=wt2wt,wt2html
24997 !! wikitext
24998 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
24999 !! html/parsoid
25000 <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>
25001 <table>
25002 <tbody>
25003 <tr>
25004 <td>
25005 <div>
25006 <p>foo</p>
25007 </div>
25008 </td>
25009 </tr>
25010 </tbody>
25011 </table>
25012 <p>ok</p>
25013 !!end
25014
25015 !!test
25016 7. Encapsulate foster-parented transclusion content
25017 !!options
25018 parsoid=wt2wt,wt2html
25019 !! wikitext
25020 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
25021 !! html/parsoid
25022 <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>
25023 <table>
25024 <tbody>
25025 <tr>
25026 <td>bar</td>
25027 </tr>
25028 </tbody>
25029 </table>
25030 !!end
25031
25032 # Note that the wt is broken on purpose: the = should be {{=}} if you
25033 # don't want it to be a template parameter key.
25034 !!test
25035 8. Encapsulate foster-parented transclusion content
25036 !!options
25037 parsoid=wt2wt,wt2html
25038 !! wikitext
25039 {{echo|a
25040 }}{|{{echo|style='color:red'}}
25041 |-
25042 |b
25043 |}
25044 !! html/parsoid
25045 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
25046 <span> </span>
25047 <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>
25048 <table>
25049 <tbody>
25050 <tr>
25051 <td>b</td>
25052 </tr>
25053 </tbody>
25054 </table>
25055 !!end
25056
25057 !!test
25058 9. Encapsulate foster-parented transclusion content
25059 !!options
25060 parsoid=wt2wt,wt2html
25061 !! wikitext
25062 <table>{{echo|hi</table>hello}}
25063 !! html/parsoid
25064 <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>
25065 !!end
25066
25067 !!test
25068 Table in fosterable position
25069 !!options
25070 parsoid=wt2html
25071 !! wikitext
25072 {{OpenTable}}
25073 <div>
25074 {|
25075 |}
25076 </div>
25077 |}
25078 !! html/parsoid
25079 <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">
25080 </span>
25081 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
25082
25083 <table>
25084 </table>
25085 !!end
25086
25087 # Parsoid only for bug 64747
25088 !! test
25089 Properly encapsulate empty-content transclusions in fosterable positions
25090 !! wikitext
25091 <table>
25092 {{#if:|
25093 <td>foo</td>
25094 }}
25095 </table>
25096 !! html/parsoid
25097 <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"}]]}'>
25098
25099 </table>
25100 !! end
25101
25102 !! test
25103 Always encapsulate foster box when template range is expanded to table
25104 !! options
25105 parsoid=wt2wt
25106 !! wikitext
25107 {|
25108 hello
25109 {{OpenTable}}
25110 |}
25111 !! html/parsoid
25112
25113 !! end
25114
25115 !! test
25116 T115289: Unclosed table
25117 !! wikitext
25118 {{echo|<table>}}<!--c-->[[Category:Two]]
25119 !! html/parsoid
25120 <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>
25121 !! end
25122
25123 !! test
25124 T115289: Don't migrate newlines out of tables with fostered content
25125 !! wikitext
25126 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
25127 !! html/parsoid
25128 <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>
25129 !! end
25130
25131 !! test
25132 T73074: More fostering fun
25133 !! wikitext
25134 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
25135 !! html/parsoid
25136 <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>
25137 !! end
25138
25139 !!test
25140 Support <object> element with .data attribute
25141 !!options
25142 parsoid=html2wt
25143 !! html/parsoid
25144 <object data="test.swf"></object>
25145 !! wikitext
25146 <object data="test.swf"></object>
25147 !!end
25148
25149 !! test
25150 Don't block XML namespace declaration
25151 !! wikitext
25152 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
25153 !! html/php
25154 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
25155 </p>
25156 !! html/parsoid
25157 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
25158 !! end
25159
25160 # -----------------------------------------------------------------
25161 # The following section of tests are primarily to spec requirements
25162 # around Parsoid's serialization (old, new, edited content)
25163 #
25164 # All these tests are marked Parsoid html2wt and html2html only
25165 # ----------------------------------------------------------------
25166
25167 !! test
25168 Ignore rel attribute in a-tags during serialization to url-links
25169 !! options
25170 parsoid=html2wt
25171 !! html/parsoid
25172 <a href='http://en.wikipedia.org/wiki/Foobar'>http://en.wikipedia.org/wiki/Foobar</a>
25173 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:ExtLink'>http://en.wikipedia.org/wiki/Foobar</a>
25174 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:WikiLink'>http://en.wikipedia.org/wiki/Foobar</a>
25175 !! wikitext
25176 http://en.wikipedia.org/wiki/Foobar
25177 http://en.wikipedia.org/wiki/Foobar
25178 http://en.wikipedia.org/wiki/Foobar
25179 !! end
25180
25181 # 'mi' is a localinterwiki prefix as well as a language
25182 !! test
25183 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
25184 !! options
25185 parsoid=html2wt
25186 !! html/parsoid
25187 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
25188 !! wikitext
25189 [[Foo]]
25190 !! end
25191
25192 # See T93839
25193 !! test
25194 New wikilinks should be serialized properly
25195 !! options
25196 parsoid=html2wt
25197 !! html/parsoid
25198 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
25199 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
25200 <a href="//en.wikipedia.org/wiki/Foo">//en.wikipedia.org/wiki/Foo</a>
25201 <a href="http://en.wikipedia.org/wiki/Foo">http://en.wikipedia.org/wiki/Foo</a>
25202 <a href="//en.wikipedia.org/wiki/Foo_bar">//en.wikipedia.org/wiki/Foo bar</a>
25203 !! wikitext
25204 [[Foo]]
25205 [[Foo]]
25206 [[:en:Foo|//en.wikipedia.org/wiki/Foo]]
25207 http://en.wikipedia.org/wiki/Foo
25208 [[:en:Foo_bar|//en.wikipedia.org/wiki/Foo bar]]
25209 !! end
25210
25211 !! test
25212 New wiki links (href variations)
25213 !! options
25214 parsoid=html2wt
25215 !! html/parsoid
25216 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
25217 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
25218 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
25219 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
25220 !! wikitext
25221 [[Foo_bar]]
25222 [[Foo_bar]]
25223 [[Foo_bar]]
25224 [[Toxine bactérienne]]
25225 !! end
25226
25227 !! test
25228 New wiki links (content string variations)
25229 !! options
25230 parsoid=html2wt
25231 !! html/parsoid
25232 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
25233 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
25234 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
25235 !! wikitext
25236 [[Foo_bar]]
25237 [[Foo bar]]
25238 [[Foo_bar|./Foo_bar]]
25239 !! end
25240
25241 !! test
25242 New category links (href variations)
25243 !! options
25244 parsoid=html2wt
25245 !! html/parsoid
25246 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
25247 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
25248 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
25249 !! wikitext
25250 [[Category:Toxine bactérienne]]
25251 [[Category:Toxine bactérienne]]
25252 [[Category:Toxine bactérienne]]
25253 !! end
25254
25255 !! test
25256 New sol transparent links don't need indent-pre nowiki protection
25257 !! options
25258 parsoid=html2wt
25259 language=de
25260 !! html/parsoid
25261 <link rel="mw:PageProp/redirect" href="./Main_Page">
25262 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
25263 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
25264 !! wikitext
25265 #WEITERLEITUNG [[Main Page]]
25266 <!-- this is good --> [[Category:Good]]
25267 <!-- this is great --> [[Kategorie:Great]]
25268 !! end
25269
25270 !! test
25271 New interlanguage links (href variations)
25272 !! options
25273 parsoid=html2wt
25274 !! html/parsoid
25275 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
25276 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
25277 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
25278 !! wikitext
25279 [[es:Toxine bactérienne]]
25280 [[es:Toxine_bactérienne]]
25281 [[es:Toxine_bactérienne]]
25282 !! end
25283
25284 !! test
25285 Image: Modifying size of an image (1)
25286 !! options
25287 parsoid={
25288 "modes": ["wt2wt"],
25289 "changes": [
25290 ["img[height]", "attr", "height", "22"],
25291 ["img[width]", "attr", "width", "200"]
25292 ]
25293 }
25294 !! wikitext
25295 [[Image:Foobar.jpg|230x230px]]
25296 !! wikitext/edited
25297 [[Image:Foobar.jpg|200x200px]]
25298 !!end
25299
25300 !! test
25301 Image: Modifying size of an image (2)
25302 !! options
25303 parsoid={
25304 "modes": ["wt2wt"],
25305 "changes": [
25306 ["img[height]", "attr", "height", "100"],
25307 ["img[width]", "attr", "width", "500"]
25308 ]
25309 }
25310 !! wikitext
25311 [[Image:Foobar.jpg|230x230px]]
25312 !! wikitext/edited
25313 [[Image:Foobar.jpg|500x500px]]
25314 !!end
25315
25316 # Change in size is ignored so long as class='mw-default-size'
25317 !! test
25318 Image: Modifying size of an image (3)
25319 !! options
25320 parsoid={
25321 "modes": ["wt2wt"],
25322 "changes": [
25323 ["figure[class]", "removeClass", "mw-default-size"],
25324 ["figure img", "attr", "height", "19"],
25325 ["figure img", "attr", "width", "170"]
25326 ]
25327 }
25328 !! wikitext
25329 [[Image:Foobar.jpg|thumb]]
25330 !! wikitext/edited
25331 [[Image:Foobar.jpg|thumb|170x170px]]
25332 !!end
25333
25334 !! test
25335 Image: Modifying alignment of an image (bug 48665)
25336 !! options
25337 parsoid={
25338 "modes": ["wt2wt"],
25339 "changes": [
25340 ["figure[class]", "removeClass", "mw-halign-right"],
25341 ["figure[class]", "addClass", "mw-halign-left"]
25342 ]
25343 }
25344 !! wikitext
25345 [[Image:Foobar.jpg|thumb|caption|right]]
25346 !! wikitext/edited
25347 [[Image:Foobar.jpg|thumb|caption|left]]
25348 !! end
25349
25350 !! test
25351 Image: Modifying mw-default-size of an frameless image (bug 62805)
25352 !! options
25353 parsoid={
25354 "modes": ["wt2wt"],
25355 "changes": [
25356 ["figure.mw-default-size", "removeClass", "mw-default-size"]
25357 ]
25358 }
25359 !! wikitext
25360 [[Image:Foobar.jpg|frameless|right]]
25361 !! wikitext/edited
25362 [[Image:Foobar.jpg|frameless|right|220x220px]]
25363 !! end
25364
25365 !! test
25366 Image: Modifying valign of an image (bug 49221)
25367 !! options
25368 parsoid={
25369 "modes": ["wt2wt"],
25370 "changes": [
25371 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
25372 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
25373 ]
25374 }
25375 !! wikitext
25376 [[File:Foobar.jpg|20px|middle]]
25377 !! wikitext/edited
25378 [[File:Foobar.jpg|20px|text-top]]
25379 !! end
25380
25381 !! test
25382 Image: Modifying alt attribute of an image (bug 56400)
25383 !! options
25384 parsoid={
25385 "modes": ["wt2wt"],
25386 "changes": [
25387 ["img[alt]", "attr", "alt", "some alternate edited text"]
25388 ]
25389 }
25390 !! wikitext
25391 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
25392 !! wikitext/edited
25393 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
25394 !!end
25395
25396 !! test
25397 Image: Modifying caption of an image
25398 !! options
25399 parsoid={
25400 "modes": ["wt2wt"],
25401 "changes": [
25402 ["figcaption", "text", "new caption"]
25403 ]
25404 }
25405 !! wikitext
25406 [[Image:Foobar.jpg|thumb|original caption]]
25407 !! wikitext/edited
25408 [[Image:Foobar.jpg|thumb|new caption]]
25409 !!end
25410
25411 !! test
25412 Image: empty alt attribute (bug 48924)
25413 !! options
25414 parsoid
25415 !! wikitext
25416 [[File:Foobar.jpg|thumb|alt=|bar]]
25417 !! html
25418 <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>
25419 !! end
25420
25421 !! test
25422 Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
25423 !! options
25424 parsoid=html2wt
25425 language=ar
25426 disabled
25427 !! html/parsoid
25428 <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>
25429 !! wikitext
25430 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
25431 !! end
25432
25433 !! test
25434 Image: Block level image should have \n before and after
25435 !! wikitext
25436 123
25437 [[File:Foobar.jpg|right|thumb|150x150px]]
25438 456
25439 !! html/parsoid
25440 <p>123</p>
25441 <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>
25442 <p>456</p>
25443 !!end
25444
25445 !! test
25446 Image: New block level image should have \n before and after (existing content)
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" 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>
25454 <p>456</p>
25455 !!end
25456
25457 !! test
25458 Image: upright option (parsoid)
25459 !! wikitext
25460 [[File:Foobar.jpg|thumb|upright|caption]]
25461 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
25462 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
25463 !! html/parsoid
25464 <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>
25465 <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>
25466 <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>
25467 !!end
25468
25469 !! test
25470 Image: upright option is ignored on inline and frame images (parsoid)
25471 !! wikitext
25472 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
25473 !! html/parsoid
25474 <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>
25475 !!end
25476
25477 !! test
25478 Image: from basic HTML (1)
25479 !! options
25480 parsoid=html2wt
25481 !! html/parsoid
25482 <span typeof="mw:Image">
25483 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
25484 </span>
25485 !! wikitext
25486 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
25487 !! end
25488
25489 !! test
25490 Image: from basic HTML (2)
25491 !! options
25492 parsoid=html2wt
25493 !! html/parsoid
25494 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
25495 !! wikitext
25496 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
25497 !! end
25498
25499 !! test
25500 Image: from basic HTML (3)
25501 !! options
25502 parsoid=html2wt
25503 !! html/parsoid
25504 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
25505 !! wikitext
25506 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
25507 !! end
25508
25509 !! test
25510 Image: from basic HTML (4)
25511 !! options
25512 parsoid=html2wt
25513 !! html/parsoid
25514 <img src="./File:Foobar.jpg">
25515 !! wikitext
25516 [[File:Foobar.jpg|link=]]
25517 !! end
25518
25519 !! test
25520 Image: Invalid title as link
25521 !! wikitext
25522 [[File:Foobar.jpg|link=<]]
25523 !! html/php
25524 <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>
25525 </p>
25526 !! html/parsoid
25527 <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>
25528 !! end
25529
25530 !! test
25531 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
25532 !! options
25533 parsoid=html2wt
25534 !! html/parsoid
25535 <ul>
25536 <li><p>foo</p></li>
25537 </ul>
25538 !! wikitext
25539 * foo
25540 !! end
25541
25542 !! test
25543 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
25544 !! options
25545 parsoid=html2wt
25546 !! html/parsoid
25547 <ul> <li>foo</li></ul>
25548 !! wikitext
25549 * foo
25550 !! end
25551
25552 !! test
25553 Don't strip leading whitespace when handling indent-pre suppressing tags
25554 !! options
25555 parsoid=html2wt
25556 !! html/parsoid
25557 <table>
25558 <tr><td> indented row</td></tr>
25559 </table>
25560 <blockquote><p>
25561 <b>This is very bold of you!</b>
25562 </p>
25563 <table><tr><td>
25564 indented cell (no pre-wrapping!)
25565 </td></tr></table>
25566 </blockquote>
25567 <p>foo</p>
25568 <div>bar</div>
25569 !! wikitext
25570 {|
25571 | indented row
25572 |}
25573 <blockquote>
25574 '''This is very bold of you!'''
25575
25576 {|
25577 |
25578 indented cell (no pre-wrapping!)
25579 |}
25580 </blockquote>
25581 foo
25582 <div>bar</div>
25583 !! end
25584
25585 !! test
25586 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
25587 !! options
25588 parsoid=html2wt
25589 !! html/parsoid
25590 <p>foo</p>
25591 <span>bar</span>
25592
25593 <span>foo2
25594 </span>bar2
25595
25596 <div>foo</div>
25597 <span>bar</span>
25598
25599 <div>
25600 <span>foo</span>
25601 </div>
25602 !! wikitext
25603 foo
25604
25605 <span>bar</span>
25606
25607 <span>foo2
25608 <nowiki> </nowiki></span>bar2
25609
25610 <div>foo</div>
25611 <nowiki> </nowiki><span>bar</span>
25612
25613 <div>
25614 <nowiki> </nowiki><span>foo</span>
25615 </div>
25616 !! end
25617
25618 !! test
25619 Lists: Dont insert newlines in a serialized list item.
25620 !! options
25621 parsoid=html2wt
25622 !! html/parsoid
25623 <ul><li>a<br>b</li><li>c</li></ul>
25624 !! wikitext
25625 * a<br>b
25626 * c
25627 !! end
25628
25629 !! test
25630 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
25631 !! options
25632 parsoid={
25633 "modes": ["html2wt"],
25634 "scrubWikitext": false
25635 }
25636 !! html/parsoid
25637 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
25638 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
25639
25640 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
25641 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
25642
25643 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
25644
25645 <h2><meta property="mw:PageProp/toc" /> ok</h2>
25646 !! wikitext
25647 == hello there [[Category:A1]] ==
25648
25649 == [[Category:A2]] hi pal ==
25650
25651 == <!--foo--> [[Category:A3]] how goes it ==
25652
25653 == it goes well [[Category:A4]] <!--bar--> ==
25654
25655 ==howdy [[Category:A5]]==
25656
25657 == __TOC__ ok ==
25658 !! end
25659
25660 !! test
25661 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
25662 !! options
25663 parsoid={
25664 "modes": ["html2wt"],
25665 "scrubWikitext": true
25666 }
25667 !! html/parsoid
25668 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
25669 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
25670
25671 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
25672 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
25673
25674 <h2><meta property="mw:PageProp/toc" /> ok</h2>
25675 !! wikitext
25676 == hello there ==
25677 [[Category:A1]]
25678 [[Category:A2]]
25679
25680 == hi pal ==
25681
25682 <!--foo--> [[Category:A3]]
25683
25684 == how goes it ==
25685
25686 == it goes well ==
25687 [[Category:A4]] <!--bar-->
25688
25689 __TOC__
25690
25691 == ok ==
25692 !! end
25693
25694 !! test
25695 Headings: Don't hoist metas that come from templates
25696 !! options
25697 parsoid={
25698 "modes": ["html2wt"],
25699 "scrubWikitext": true
25700 }
25701 !! html/parsoid
25702 <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>
25703 !! wikitext
25704 == {{echo|foo [[Category:Foo]]}} ==
25705 !! end
25706
25707 !! test
25708 Headings: Category in ref isn't hoisted
25709 !! options
25710 parsoid={
25711 "modes": ["html2wt"],
25712 "scrubWikitext": true
25713 }
25714 !! html/parsoid
25715 <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>
25716
25717 <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>
25718 !! wikitext
25719 == foo <ref>bar
25720 [[Category:Baz]] </ref> ==
25721
25722 <references />
25723 !! end
25724
25725 !! test
25726 Parsoid: Serialize positional parameters with = in them as named parameter
25727 !! options
25728 parsoid=html2wt
25729 !! html/parsoid
25730 <p about="#mwt1" typeof="mw:Transclusion"
25731 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
25732
25733 <p about="#mwt1" typeof="mw:Transclusion"
25734 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
25735
25736 <!--Orig params with data-parsoid has heuristics for handling = chars-->
25737 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
25738 <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>
25739 !! wikitext
25740 {{echo|1=f=oo}}
25741
25742 {{echo|1=f=oo|2=bar}}
25743
25744 <!--Orig params with data-parsoid has heuristics for handling = chars-->
25745 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
25746 {{echo|<nowiki>f=oo</nowiki>|bar}}
25747 !! end
25748
25749 !! test
25750 Parsoid: Serialize positional parameters with = in extlink as named parameter
25751 !! options
25752 parsoid=html2wt
25753 !! html/parsoid
25754 <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>
25755 !! wikitext
25756 {{echo|1=http://stuff?is=ok}}
25757 !! end
25758
25759 !! test
25760 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
25761 !! options
25762 parsoid=html2wt
25763 !! html/parsoid
25764 <div>a<p>b</p></div>
25765 <div>a
25766 <p>b</p></div>
25767 <div>
25768 a
25769 <p>b</p></div>
25770 !! wikitext
25771 <div>a
25772 b
25773 </div>
25774 <div>a
25775 b
25776 </div>
25777 <div>
25778 a
25779
25780 b
25781 </div>
25782 !! end
25783
25784 !! test
25785 Substrings resembling wikitext in hrefs should not get nowiki escapes
25786 !! options
25787 parsoid=html2wt
25788 !! html/parsoid
25789 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
25790 !! wikitext
25791 [[Foo''bar''baz]]
25792 !! end
25793
25794 !! test
25795 Enforce single-line context in the serializer
25796 !! options
25797 parsoid=html2wt
25798 !! html/parsoid
25799 <h2>testing
25800 123</h2>
25801
25802 <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">
25803 </span><span about="#mwt1">you</span> </h2>
25804
25805 <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>
25806
25807 <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
25808 there</span></li></ol>
25809
25810 <ul><li>asd
25811 sdf</li></ul>
25812
25813 <ul><li>foo
25814 bar
25815 baz</li>
25816 <li>foo <b>bar</b>
25817 baz</li></ul>
25818
25819 <dl><dt>hi
25820 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
25821 ho</dd></dl>
25822
25823 <dl><dd> <table>
25824 <tbody><tr><td> ha
25825 ha
25826 ha</td></tr>
25827 </tbody></table></dd></dl>
25828 !! wikitext
25829 == testing 123 ==
25830
25831 == hi {{bogus|there
25832 you}} ==
25833
25834 == foo <ref>hello
25835 there</ref> ==
25836
25837 <references />
25838
25839 * asd sdf
25840
25841 * foo bar baz
25842 * foo '''bar''' baz
25843
25844 ; hi ho : hi ho
25845
25846 : {|
25847 | ha
25848 ha
25849 ha
25850 |}
25851 !! end
25852
25853 !! test
25854 Serialize new placeholder space without spans
25855 !! options
25856 parsoid=html2wt
25857 !! html/parsoid
25858 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
25859
25860 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
25861
25862 <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>
25863 !! wikitext
25864 foo : bar
25865
25866 foo : bar
25867
25868 <ref>foo : bar</ref>ok
25869 !! end
25870
25871
25872 #-----------------------
25873 # Tag minimization tests
25874 #-----------------------
25875
25876 !! test
25877 1. I/B quote minimization: wikitext-only tags should be combined
25878 !! options
25879 parsoid=html2wt
25880 !! html/parsoid
25881 <p><i>A</i><i>B</i></p>
25882 <p><b>A</b><b>B</b></p>
25883 <p><i>A</i><b><i>B</i></b></p>
25884 <p><b>A</b><i><b>B</b></i></p>
25885 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
25886 <p><i><b>A</b></i><i><b>B</b></i></p>
25887 <p><i><b>A</b></i><b><i>B</i></b></p>
25888 <p><b><i>A</i></b><i><b>B</b></i></p>
25889 !! wikitext
25890 ''AB''
25891
25892 '''AB'''
25893
25894 ''A'''B'''''
25895
25896 '''A''B'''''
25897
25898 '''A''BC''D'''
25899
25900 '''''AB'''''
25901
25902 '''''AB'''''
25903
25904 '''''AB'''''
25905 !! end
25906
25907 !! test
25908 2. I/B quote minimization: wikitext and html tags should not be combined
25909 !! options
25910 parsoid=html2wt
25911 !! html/parsoid
25912 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
25913 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
25914 !! wikitext
25915 ''A''<i>B</i>
25916
25917 ''A''<nowiki/>'''<i>B</i>'''
25918 !! end
25919
25920 !! test
25921 3. I/B quote minimization: templated content stops minimization
25922 !! options
25923 parsoid=html2wt
25924 !! html/parsoid
25925 <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>
25926 <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>
25927 !! wikitext
25928 ''A''{{echo|''B''}}
25929
25930 ''A''{{echo|'''''B'''''}}
25931 !! end
25932
25933 !! test
25934 4. I/B quote minimization: new content should be mimimized with adjacent old content
25935 !! options
25936 parsoid=html2wt
25937 !! html/parsoid
25938 <p><i>A</i><i>B</i></p>
25939 <p><b>A</b><b>B</b></p>
25940 <p><i>A</i><b><i>B</i></b></p>
25941 !! wikitext
25942 ''AB''
25943
25944 '''AB'''
25945
25946 ''A'''B'''''
25947 !! end
25948
25949 !! test
25950 5a. Merge adjacent quote nodes if they've been edited
25951 !! options
25952 parsoid={
25953 "modes": ["wt2wt", "selser"],
25954 "changes": [
25955 ["p", "contents", "remove", ":contains('b')"]
25956 ]
25957 }
25958 !! wikitext
25959 ''a''b''c''
25960 !! wikitext/edited
25961 ''ac''
25962 !! end
25963
25964 !! test
25965 5b. Merge adjacent quote nodes if they've been edited
25966 !! options
25967 parsoid={
25968 "modes": ["wt2wt", "selser"],
25969 "changes": [
25970 ["#x", "remove"]
25971 ]
25972 }
25973 !! wikitext
25974 ''a''<span id="x">b</span>''c''
25975 !! wikitext/edited
25976 ''ac''
25977 !! end
25978
25979 !! test
25980 1. Merge adjacent link nodes as long as at least one element is new
25981 !! options
25982 parsoid={
25983 "modes": ["html2wt"],
25984 "scrubWikitext": true
25985 }
25986 !! html/parsoid
25987 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25988 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25989 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
25990 !! wikitext
25991 [[Football]]
25992 [[Football]]
25993 [[Football|Foot]][[Football|ball]]
25994 !! end
25995
25996 !! test
25997 2. Merge adjacent link nodes and enable additional normalizations
25998 !! options
25999 parsoid={
26000 "modes": ["html2wt"],
26001 "scrubWikitext": true
26002 }
26003 !! html/parsoid
26004 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
26005 !! wikitext
26006 [[Football|''Football'']]
26007 !! end
26008
26009 !! test
26010 3. Don't merge adjacent link nodes if scrubWikitext is false
26011 !! options
26012 parsoid={
26013 "modes": ["html2wt"],
26014 "scrubWikitext": false
26015 }
26016 !! html/parsoid
26017 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26018 !! wikitext
26019 [[Football|Foot]][[Football|ball]]
26020 !! end
26021
26022 #------------------------------
26023 # End of tag minimization tests
26024 #------------------------------
26025
26026 !!test
26027 Bug 54262: New entities
26028 !! options
26029 parsoid=html2wt
26030 !! html/parsoid
26031 <span typeof="mw:Entity">&nbsp;</span>
26032 !! wikitext
26033 &nbsp;
26034 !! end
26035
26036 ## Note that there is no wikitext output for 'unknownproperty' ##
26037 ## Unknown magic words are silently dropped ##
26038
26039 !! test
26040 Magic words
26041 !! options
26042 parsoid=html2wt
26043 !! html/parsoid
26044 <meta property='mw:PageProp/toc' />
26045 <meta property='mw:PageProp/notoc' />
26046 <meta property='mw:PageProp/forcetoc' />
26047 <meta property='mw:PageProp/index' />
26048 <meta property='mw:PageProp/noindex' />
26049 <meta property='mw:PageProp/nogallery' />
26050 <meta property='mw:PageProp/noeditsection' />
26051 <meta property='mw:PageProp/notitleconvert' />
26052 <meta property='mw:PageProp/nocontentconvert' />
26053 <meta property='mw:PageProp/unknownproperty' />
26054 !! wikitext
26055 __TOC__
26056 __NOTOC__
26057 __FORCETOC__
26058 __INDEX__
26059 __NOINDEX__
26060 __NOGALLERY__
26061 __NOEDITSECTION__
26062 __NOTITLECONVERT__
26063 __NOCONTENTCONVERT__
26064 !! end
26065
26066 !! test
26067 Consecutive <pre>s should not get merged
26068 !! options
26069 parsoid=html2wt,html2html
26070 !! html/parsoid
26071 <pre>a</pre><pre>b</pre>
26072
26073 <pre>c
26074 </pre><pre>
26075 d</pre>
26076
26077 <pre>e
26078
26079 </pre><pre>
26080
26081 f</pre>
26082 !! wikitext
26083 a
26084
26085 b
26086
26087 c
26088
26089 d
26090
26091 e
26092
26093
26094
26095 f
26096 !! end
26097
26098 !! test
26099 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
26100 !! options
26101 parsoid=html2wt
26102 !! html/parsoid
26103 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
26104 !! wikitext
26105 [[Special:BookSources/1234567890|ISBN 1234567895]]
26106 !! end
26107
26108 !! test
26109 Edited RFC links not serializable as RFC links should serialize as extlinks
26110 !! options
26111 parsoid=html2wt
26112 !! html/parsoid
26113 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
26114 !! wikitext
26115 [//tools.ietf.org/html/rfc123 New RFC]
26116 !! end
26117
26118 !! test
26119 Edited PMID links not serializable as PMID links should serialize as extlinks
26120 !! options
26121 parsoid=html2wt
26122 !! html/parsoid
26123 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
26124 !! wikitext
26125 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
26126 !! end
26127
26128 !! test
26129 WTS of autolinks with trailing/surrounding context
26130 !! options
26131 parsoid=html2wt
26132 !! html/parsoid
26133 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
26134 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
26135 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
26136 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
26137 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
26138 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
26139 !! wikitext
26140 http://cscott.net'''foo'''
26141
26142 http://cscott.net<b>foo</b>
26143
26144 '''http://cscott.net'''
26145
26146 '''http://cscott.net '''
26147
26148 '''http://cscott.net<nowiki/>x'''
26149
26150 http://cscott.net<nowiki/>x
26151 !! end
26152
26153 !! test
26154 WTS of autolinks with nowikis (round-trip)
26155 !! wikitext
26156 x<nowiki/>http://cscott.net<nowiki/>x
26157 !! html/parsoid
26158 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
26159 !! end
26160
26161 # this is the "easy" test because it leaves in place all the
26162 # data-parsoid information indicating this is an autolink
26163 !! test
26164 WTS of autolinks with escapes (editing)
26165 !! options
26166 parsoid={
26167 "modes": ["wt2wt"],
26168 "changes": [
26169 [ "meta", "remove" ]
26170 ]
26171 }
26172 !! wikitext
26173 x<nowiki/>http://cscott.net<nowiki/>x
26174 !! wikitext/edited
26175 x<nowiki/>http://cscott.net<nowiki/>x
26176 !! end
26177
26178 !! test
26179 WTS of edited autolink-like text (T103364)
26180 !! options
26181 parsoid={
26182 "modes": ["wt2wt"],
26183 "changes": [
26184 [ "span[typeof]", "removeAttr", "typeof" ]
26185 ]
26186 }
26187 !! wikitext
26188 Not a link: <nowiki>http://example.com</nowiki>.
26189 !! wikitext/edited
26190 Not a link: <span><nowiki>http://example.com</nowiki></span>.
26191 !! end
26192
26193 !! test
26194 WTS of newly-authored autolink-like text (T103364)
26195 !! options
26196 parsoid=html2wt
26197 !! html/parsoid
26198 <p>http://example.com is not a link.</p>
26199 !! wikitext
26200 <nowiki>http://example.com</nowiki> is not a link.
26201 !! end
26202
26203 !! test
26204 WTS of autolink-like text after an autolink (T108563)
26205 !! options
26206 parsoid=html2wt
26207 !! html/parsoid
26208 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
26209 !! wikitext
26210 http://example.com <nowiki>http://example.com</nowiki> is not a link.
26211 !! end
26212
26213 !! test
26214 Magic links inside links (not autolinked)
26215 !! wikitext
26216 [[Foo|http://example.com]]
26217 [[Foo|RFC 1234]]
26218 [[Foo|PMID 1234]]
26219 [[Foo|ISBN 123456789x]]
26220
26221 [http://foo.com http://example.com]
26222 [http://foo.com RFC 1234]
26223 [http://foo.com PMID 1234]
26224 [http://foo.com ISBN 123456789x]
26225 !! html+tidy
26226 <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>
26227 <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>
26228 !! html/parsoid
26229 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
26230 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
26231 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
26232 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
26233
26234 <p><a rel="mw:ExtLink" href="http://foo.com">http://example.com</a>
26235 <a rel="mw:ExtLink" href="http://foo.com">RFC 1234</a>
26236 <a rel="mw:ExtLink" href="http://foo.com">PMID 1234</a>
26237 <a rel="mw:ExtLink" href="http://foo.com">ISBN 123456789x</a></p>
26238 !! end
26239
26240 !! test
26241 Magic links inside image captions (autolinked)
26242 !! wikitext
26243 [[File:Foobar.jpg|thumb|http://example.com]]
26244 [[File:Foobar.jpg|thumb|RFC 1234]]
26245 [[File:Foobar.jpg|thumb|PMID 1234]]
26246 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
26247 !! html+tidy
26248 <div class="thumb tright">
26249 <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>
26250 <div class="thumbcaption">
26251 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26252 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div>
26253 </div>
26254 </div>
26255 <div class="thumb tright">
26256 <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>
26257 <div class="thumbcaption">
26258 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26259 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a></div>
26260 </div>
26261 </div>
26262 <div class="thumb tright">
26263 <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>
26264 <div class="thumbcaption">
26265 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26266 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a></div>
26267 </div>
26268 </div>
26269 <div class="thumb tright">
26270 <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>
26271 <div class="thumbcaption">
26272 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26273 <a href="/wiki/Special:BookSources/123456789X" class="internal mw-magiclink-isbn">ISBN 123456789x</a></div>
26274 </div>
26275 </div>
26276 !! html/parsoid
26277 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></figcaption></figure>
26278 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a href="//tools.ietf.org/html/rfc1234" rel="mw:ExtLink">RFC 1234</a></figcaption></figure>
26279 <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>
26280 <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>
26281 !! end
26282
26283 !! test
26284 WTS of magic word text (T109371)
26285 !! options
26286 parsoid=html2wt
26287 !! html/parsoid
26288 <p>RFC 1234</p>
26289 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
26290 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
26291 !! wikitext
26292 <nowiki>RFC 1234</nowiki>
26293
26294 [http://foo.com RFC 1234]
26295
26296 [[Foo|RFC 1234]]
26297 !! end
26298
26299 !! test
26300 Edited Redirect link should emit a non-piped wikitext link
26301 !! options
26302 parsoid=html2wt
26303 !! html/parsoid
26304 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
26305 !! wikitext
26306 #REDIRECT [[Bar]]
26307 !! end
26308
26309 !! test
26310 T75121: Infer extension name from typeOf if data-mw is not present
26311 !! options
26312 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26313 !! html/parsoid
26314 <div typeOf="mw:Extension/foo"></div>
26315 !! wikitext
26316 <foo />
26317 !! end
26318
26319 # Note that the <p> wrapping isn't present in PHP parser output
26320 # The important thing for this test is that P-wrapping doesn't
26321 # interfere with the <nowiki> protection for leading - in <td>
26322 # (which isn't necessary for <th>).
26323 !! test
26324 T88318: p-wrapped dash in table.
26325 !! options
26326 parsoid=html2wt,wt2wt
26327 !! html/parsoid
26328 <table><tbody>
26329 <tr><th><p>-</p></th><th><p>- </p></th></tr>
26330 <tr><td><p>-</p></td><td><p>- </p></td></tr>
26331 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
26332 </tbody></table>
26333 !! wikitext
26334 {|
26335 !-
26336 !-
26337 |-
26338 |<nowiki>-</nowiki>
26339 |<nowiki>- </nowiki>
26340 |-
26341 |<small>-</small>
26342 |<br>
26343 -
26344 |<br>
26345 -
26346 |}
26347 !! html/php+tidy
26348 <table>
26349 <tr>
26350 <th>-</th>
26351 <th>-</th>
26352 </tr>
26353 <tr>
26354 <td>-</td>
26355 <td>-</td>
26356 </tr>
26357 <tr>
26358 <td><small>-</small></td>
26359 <td><br />
26360 <p>-</p>
26361 </td>
26362 <td><br />
26363 <p>-</p>
26364 </td>
26365 </tr>
26366 </table>
26367 !! end
26368
26369 !! test
26370 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
26371 !! options
26372 parsoid=html2wt
26373 !! html/parsoid
26374 <table id='mwAb'>
26375 <td id='mwAc'>foo</td>
26376 <td id='serialize-this'>bar</td>
26377 </table>
26378 !! wikitext
26379 {|
26380 |foo
26381 | id="serialize-this" |bar
26382 |}
26383 !! end
26384
26385 !! test
26386 Parsoid-like element ids should not be serialized to wikitext unless shadowed
26387 !! options
26388 parsoid=html2wt
26389 !! html/parsoid
26390 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
26391 !! wikitext
26392 <div id="hello">ok</div>
26393 !! end
26394
26395 !! test
26396 WTS change modes
26397 !! options
26398 parsoid={
26399 "modes": ["wt2wt"],
26400 "changes": [
26401 [ "#xyz", "before", "<b>before</b> stuff " ],
26402 [ "#xyz", "after", " stuff <i>after</i>" ],
26403 [ "#xyz", "html", "x <b>y</b> z" ]
26404 ]
26405 }
26406 !! wikitext
26407 <span id="xyz">hello</span>
26408 !! wikitext/edited
26409 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
26410 !! end
26411
26412 !! test
26413 Never serialize a-tag as html, regardless of what data-parsoid has to say
26414 !! options
26415 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26416 !! html/parsoid
26417 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
26418 !! wikitext
26419 [[Foo]]
26420 !! end
26421
26422 ## SSS FIXME: This is broken output nevertheless.
26423 ## What might be a reasonable non-broken output for this?
26424 ## This is an edge case unlikely to be seen in production
26425 ## that I am not wasting more time on this right now.
26426 !! test
26427 Never serialize a-tag as html, no matter what attributes it has
26428 !! options
26429 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26430 !! html/parsoid
26431 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
26432 !! wikitext
26433 [http://boo.org http://boohoo.org]
26434 !! end
26435
26436 # Misnested is an indication that selser can reuse the source but these have
26437 # shown to sneak through on occasion. See T101768.
26438 # The original wikitext here is: [http://test.com [[one]] two three]
26439 !! test
26440 Strip span tags added to mark misnested links
26441 !! options
26442 parsoid=html2wt
26443 !! html/parsoid
26444 <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>
26445 !! wikitext
26446 [http://test.com][[one]] two three
26447 !! end
26448
26449 !! test
26450 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
26451 !! options
26452 parsoid=html2wt
26453 !! html/parsoid
26454 <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|}"]}'>
26455 <tbody><tr><td>d
26456 </td></tr>
26457 </tbody></table>
26458 !! wikitext
26459 {{echo|a}}
26460 {|{{echo|c
26461 {{!}}d
26462 }}
26463 |}
26464 !! end
26465
26466 ## This test verifies the presence and computation of this attribute indirectly
26467 ## by making an edit and ensuring that the serialization is correct (which it would be
26468 ## only if firstWikitextNode is properly set).
26469 !! test
26470 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
26471 !! options
26472 parsoid= {
26473 "modes": ["wt2wt"],
26474 "changes": [
26475 [ "div#x", "remove" ],
26476 [ "div", "before", "<div>new</div>" ]
26477 ]
26478 }
26479 !! wikitext
26480 <div id="x">foo</div>
26481 {|
26482 {{echo|<div>boo</div>
26483 {{!}}b}}
26484 |c
26485 |}
26486 !! wikitext/edited
26487
26488 <div>new</div>
26489 {|
26490 {{echo|<div>boo</div>
26491 {{!}}b}}
26492 |c
26493 |}
26494 !! end
26495
26496 # --------------------------------------------
26497 # Tests spec'ing wikitext serialization norms |
26498 # --------------------------------------------
26499
26500 !! test
26501 1. Categories should always be serialized on their own line
26502 !! options
26503 parsoid=html2wt
26504 !! html/parsoid
26505 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
26506 !! wikitext
26507 foo
26508 [[Category:Foo]]
26509 bar
26510 !! end
26511
26512 !! test
26513 2. Categories that are part of templates should not introduce a line break
26514 !! wikitext
26515 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
26516 !! html/parsoid
26517 <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>
26518 !! end
26519
26520 # Careful while editing these next 2 tests. There are \u200f characters
26521 # before and after the <link> tags in the HTML and following some
26522 # of the categories in wikitext
26523 # Do not remove these characters in edits.
26524 #
26525 # As part of the serialization, these bidi characters will get stripped.
26526 !! test
26527 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
26528 !! options
26529 parsoid={
26530 "modes": ["html2wt"],
26531 "scrubWikitext": true
26532 }
26533 !! html/parsoid
26534 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
26535 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
26536 !! wikitext
26537 [[קטגוריה:טקסים]]
26538 [[קטגוריה: שיטות משפט]]
26539 !! end
26540
26541 !! test
26542 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
26543 !! options
26544 parsoid={
26545 "modes": ["html2wt"],
26546 "scrubWikitext": true
26547 }
26548 !! html/parsoid
26549 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
26550 !! wikitext
26551 [[קטגוריה:טקסים]]
26552 ‏y
26553 !! end
26554
26555 !! test
26556 Lists: Add space after bullets
26557 !! options
26558 parsoid=html2wt
26559 !! html/parsoid
26560 <ul>
26561 <li>foo</li>
26562 <li> bar</li>
26563 <li><span> baz</span></li>
26564 </ul>
26565 !! wikitext
26566 * foo
26567 * bar
26568 * <span> baz</span>
26569 !! end
26570
26571 !! test
26572 1. Headings: Add space before/after == (T53744)
26573 !! options
26574 parsoid=html2wt
26575 !! html/parsoid
26576 <h2>foo</h2>
26577 <h2> bar</h2>
26578 <h2>baz </h2>
26579 <h2><span> baz</span></h2>
26580 !! wikitext
26581 == foo ==
26582
26583 == bar ==
26584
26585 == baz ==
26586
26587 == <span> baz</span> ==
26588 !! end
26589
26590 !! test
26591 2. Headings: Add space before/after == even after hoisted content
26592 !! options
26593 parsoid={
26594 "modes": ["html2wt"],
26595 "scrubWikitext": true
26596 }
26597 !! html/parsoid
26598 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
26599 !! wikitext
26600 [[Category:A2]]
26601
26602 == ok ==
26603 !! end
26604
26605 !! test
26606 1. Headings: suppress newly created empty headings
26607 !! options
26608 parsoid={
26609 "modes": ["html2wt"],
26610 "scrubWikitext": true
26611 }
26612 !! html/parsoid
26613 <h2></h2>
26614 !! wikitext
26615 !! end
26616
26617 !! test
26618 2. Headings: don't suppress empty headings if scrubWikitext is false
26619 !! options
26620 parsoid=html2wt
26621 !! html/parsoid
26622 <h2></h2>
26623 !! wikitext
26624 ==<nowiki/>==
26625 !! end
26626
26627 !! test
26628 3. Headings: suppress empty headings on edits
26629 !! options
26630 parsoid={
26631 "modes": ["selser"],
26632 "scrubWikitext": true,
26633 "changes": [
26634 [ "#x", "remove"]
26635 ]
26636 }
26637 !! wikitext
26638 ==<span id="x">foo</span>==
26639 !! wikitext/edited
26640 !! end
26641
26642 !! test
26643 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
26644 !! options
26645 parsoid={
26646 "modes": ["html2wt"],
26647 "scrubWikitext": true
26648 }
26649 !! html/parsoid
26650 <h2>foo<br/>bar</h2>
26651 <h2>foo <span><br/>bar</span> baz</h2>
26652 !! wikitext
26653 == foo bar ==
26654
26655 == foo <span> bar</span> baz ==
26656 !! end
26657
26658 !! test
26659 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
26660 !! options
26661 parsoid={
26662 "modes": ["html2wt"],
26663 "scrubWikitext": false
26664 }
26665 !! html/parsoid
26666 <h2>foo<br/>bar</h2>
26667 !! wikitext
26668 == foo<br> bar ==
26669 !! end
26670
26671 !! test
26672 1. WT Quote Tags: suppress newly created empty style tags
26673 !! options
26674 parsoid={
26675 "modes": ["html2wt"],
26676 "scrubWikitext": true
26677 }
26678 !! html/parsoid
26679 <i></i><b></b>
26680 !! wikitext
26681 !! end
26682
26683 !! test
26684 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
26685 !! options
26686 parsoid=html2wt
26687 !! html/parsoid
26688 <i></i><b></b>
26689 !! wikitext
26690 ''<nowiki/>'''''<nowiki/>'''
26691 !! end
26692
26693 !! test
26694 3. WT Quote Tags: suppress empty style tags on edits
26695 !! options
26696 parsoid={
26697 "modes": ["selser"],
26698 "scrubWikitext": true,
26699 "changes": [
26700 [ "#x", "remove"]
26701 ]
26702 }
26703 !! wikitext
26704 '''<span id="x">foo</span>'''
26705 !! wikitext/edited
26706 !! end
26707
26708 !! test
26709 1. Anchors: suppress newly created empty anchors
26710 !! options
26711 parsoid={
26712 "modes": ["html2wt"],
26713 "scrubWikitext": true
26714 }
26715 !! html/parsoid
26716 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
26717 !! wikitext
26718 !! end
26719
26720 !! test
26721 2. Anchors: don't suppress empty anchors if scrubWikitext is false
26722 !! options
26723 parsoid={
26724 "modes": ["html2wt"],
26725 "scrubWikitext": false
26726 }
26727 !! html/parsoid
26728 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
26729 !! wikitext
26730 [[Test|<nowiki/>]]
26731 !! end
26732
26733 !! test
26734 3. Anchors: suppress empty anchors on edits
26735 !! options
26736 parsoid={
26737 "modes": ["selser"],
26738 "scrubWikitext": true,
26739 "changes": [
26740 [ "#x", "remove"]
26741 ]
26742 }
26743 !! wikitext
26744 [[Test|<span id="x">foo</span>]]
26745 !! wikitext/edited
26746 !! end
26747
26748 !! test
26749 3a. Anchors: do not suppress numbered extlinks
26750 !! options
26751 parsoid={
26752 "modes": ["wt2wt"],
26753 "scrubWikitext": true
26754 }
26755 !! wikitext
26756 [http://foo.com]
26757 !! html/parsoid
26758 <a rel="mw:ExtLink" href="http://foo.com"></a>
26759 !! end
26760
26761 !! test
26762 3b. Anchors: do not suppress numbered extlinks
26763 !! options
26764 parsoid={
26765 "modes": ["wt2wt"],
26766 "scrubWikitext": true,
26767 "changes": [
26768 [ "#x", "remove"]
26769 ]
26770 }
26771 !! wikitext
26772 [http://foo.com <span id="x">foo</span>]
26773 !! wikitext/edited
26774 [http://foo.com]
26775 !! end
26776
26777 !!test
26778 Normalizations should be restricted to edited content
26779 !!options
26780 parsoid={
26781 "modes": ["selser"],
26782 "scrubWikitext": true,
26783 "changes": [
26784 [ "h1", "before", "<i></i>"]
26785 ]
26786 }
26787 !!wikitext
26788 a
26789 = =
26790 b
26791 !!wikitext/edited
26792 a
26793 = =
26794 b
26795 !!end
26796
26797 !! test
26798 1. Multiple normalizations (html2wt)
26799 !! options
26800 parsoid={
26801 "modes": ["html2wt"],
26802 "scrubWikitext": true
26803 }
26804 !! html
26805 <h2><i></i></h2>
26806 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
26807 </a><b><i></i></b>x</p>
26808 !! wikitext
26809
26810 [[foo]]
26811 x
26812
26813 !! end
26814
26815 !! test
26816 2. Multiple normalizations (selser)
26817 !! options
26818 parsoid={
26819 "modes": ["selser"],
26820 "scrubWikitext": true,
26821 "changes": [
26822 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
26823 ]
26824 }
26825 !! wikitext
26826 <span id="x">foo</span>
26827 !! wikitext/edited
26828 <span id="x">foo</span>
26829
26830 x
26831 !! end
26832
26833 !! test
26834 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
26835 !! options
26836 parsoid={
26837 "modes": ["html2wt"],
26838 "scrubWikitext": true
26839 }
26840 !! html/parsoid
26841 <p> hi</p>
26842 <p> hello</p>
26843 !! wikitext
26844 hi
26845
26846 hello
26847 !! end
26848
26849 !! test
26850 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
26851 !! options
26852 parsoid=html2wt
26853 !! html/parsoid
26854 <p> hi</p>
26855 <p> hello</p>
26856 !! wikitext
26857 <nowiki> </nowiki>hi
26858
26859 <nowiki> </nowiki> hello
26860 !! end
26861
26862 !! test
26863 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
26864 !! options
26865 parsoid={
26866 "modes": ["html2wt"],
26867 "scrubWikitext": true
26868 }
26869 !! html/parsoid
26870 <p>Foo
26871 bar
26872 baz</p>
26873
26874 <table><tr><td>Foo
26875 bar
26876 baz bang</td></tr></table>
26877
26878 <p><!--boo--> foo
26879 bar</p>
26880
26881 <p> foo
26882 bar<span>boo</span></p>
26883 !! wikitext
26884 Foo
26885 bar
26886 baz
26887
26888 {|
26889 |Foo
26890 bar
26891 baz bang
26892 |}
26893
26894 <!--boo-->foo
26895 bar
26896
26897 foo
26898 bar<span>boo</span>
26899 !! end
26900
26901 !! test
26902 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
26903 !! options
26904 parsoid={
26905 "modes": ["selser"],
26906 "scrubWikitext": true,
26907 "changes": [
26908 [ "p", "html", " a\n b" ]
26909 ]
26910 }
26911 !! wikitext
26912 xyz
26913 !! wikitext/edited
26914 a
26915 b
26916 !! end
26917
26918 !! test
26919 1. New links that end in spaces
26920 !! options
26921 parsoid={
26922 "modes": ["html2wt"],
26923 "scrubWikitext": false
26924 }
26925 !! html/parsoid
26926 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
26927 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
26928 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
26929 !! wikitext
26930 [[Berlin ]]<nowiki/>is the capital of Germany.
26931
26932 [[Foo ]]'''bar'''
26933
26934 [[Boston ]] is a city.
26935 !! end
26936
26937 !! test
26938 2. New links that end in spaces
26939 !! options
26940 parsoid={
26941 "modes": ["html2wt"],
26942 "scrubWikitext": true
26943 }
26944 !! html/parsoid
26945 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
26946 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
26947 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
26948 !! wikitext
26949 [[Berlin]] is the capital of Germany.
26950
26951 [[Foo]] '''bar'''
26952
26953 [[Boston]] is a city.
26954 !! end
26955
26956 !! test
26957 1. Table cells with escapable prefixes
26958 !! options
26959 parsoid={
26960 "modes": ["html2wt"],
26961 "scrubWikitext": false
26962 }
26963 !! html
26964 <table>
26965 <tr><td>a</td></tr>
26966 <tr><td>-</td></tr>
26967 <tr><td>+</td></tr>
26968 </table>
26969 !! wikitext
26970 {|
26971 |a
26972 |-
26973 |<nowiki>-</nowiki>
26974 |-
26975 |<nowiki>+</nowiki>
26976 |}
26977 !! end
26978
26979 !! test
26980 2. Table cells with escapable prefixes
26981 !! options
26982 parsoid={
26983 "modes": ["html2wt"],
26984 "scrubWikitext": true
26985 }
26986 !! html
26987 <table>
26988 <tr><td>a</td></tr>
26989 <tr><td>-</td></tr>
26990 <tr><td>+</td></tr>
26991 </table>
26992 !! wikitext
26993 {|
26994 |a
26995 |-
26996 | -
26997 |-
26998 | +
26999 |}
27000 !! end
27001
27002 !! test
27003 3a. Table cells with escapable prefixes after edits
27004 !! options
27005 parsoid={
27006 "modes": ["selser"],
27007 "scrubWikitext": true,
27008 "changes": [
27009 [ "table tbody tr:first-child td:first-child", "remove"]
27010 ]
27011 }
27012 !! wikitext
27013 {|
27014 |a||-
27015 |}
27016 !! wikitext/edited
27017 {|
27018 | -
27019 |}
27020 !! end
27021
27022 !! test
27023 3b. Table cells with escapable prefixes after edits
27024 !! options
27025 parsoid={
27026 "modes": ["selser"],
27027 "scrubWikitext": true,
27028 "changes": [
27029 [ "table tbody tr:first-child td:first-child", "html", "-" ],
27030 [ "#x", "remove" ]
27031 ]
27032 }
27033 !! wikitext
27034 {|
27035 |pqr
27036 |<span id="x">foo</span>+
27037 |}
27038 !! wikitext/edited
27039 {|
27040 | -
27041 | +
27042 |}
27043 !! end
27044
27045 # FIXME: This test will fail because
27046 # normalization doesn't realize that the id attribute
27047 # will eliminate the escapable scenario
27048 !! test
27049 4a. Table cells without escapable prefixes after edits
27050 !! options
27051 parsoid={
27052 "modes": ["selser"],
27053 "scrubWikitext": true,
27054 "changes": [
27055 [ "#x", "html", "-" ]
27056 ]
27057 }
27058 !! wikitext
27059 {|
27060 | id="x" |abcd
27061 |}
27062 !! wikitext/edited
27063 {|
27064 | id="x" |-
27065 |}
27066 !! end
27067
27068 ## This tests normalizer's ability to discriminate between
27069 ## cells having identical content.
27070 !! test
27071 4b. Table cells without escapable prefixes after edits
27072 !! options
27073 parsoid={
27074 "modes": ["selser"],
27075 "scrubWikitext": true,
27076 "changes": [
27077 [ "td", "html", "-" ]
27078 ]
27079 }
27080 !! wikitext
27081 {|
27082 |a||b
27083 |}
27084 !! wikitext/edited
27085 {|
27086 | -||-
27087 |}
27088 !! end
27089
27090 ## This tests normalizer's ability to not be tripped by
27091 ## comments (and whitespace)
27092 !! test
27093 4c. Table cells without escapable prefixes after edits
27094 !! options
27095 parsoid={
27096 "modes": ["selser"],
27097 "scrubWikitext": true,
27098 "changes": [
27099 [ "table tbody tr td:first-child", "remove" ]
27100 ]
27101 }
27102 !! wikitext
27103 {|
27104 |-
27105 <!--foo--> |a||-
27106 |}
27107 !! wikitext/edited
27108 {|
27109 |-
27110 <!--foo--> | -
27111 |}
27112 !! end
27113
27114 ## This tests normalizer's ability to handle HTML cells
27115 !! test
27116 4d. Table cells without escapable prefixes after edits
27117 !! options
27118 parsoid={
27119 "modes": ["selser"],
27120 "scrubWikitext": true,
27121 "changes": [
27122 [ "td", "html", "-" ]
27123 ]
27124 }
27125 !! wikitext
27126 <table>
27127 <tr><td>a</td></tr>
27128 </table>
27129 !! wikitext/edited
27130 <table>
27131 <tr><td>-</td></tr>
27132 </table>
27133 !! end
27134
27135 ## T111151 Remove font elements without attributes
27136 !! test
27137 5a. font tags without attributes should be dropped in scrubWikitext mode
27138 !! options
27139 parsoid={
27140 "modes": ["html2wt"],
27141 "scrubWikitext": true
27142 }
27143 !! html
27144 <font>foo</font>
27145 <font><font>bar</font></font>
27146 <font class="x">boo</font>
27147 !! wikitext
27148 foo
27149 bar
27150 <font class="x">boo</font>
27151 !! end
27152
27153 !! test
27154 5b. font tags should not be dropped without scrubWikitext being enabled
27155 !! options
27156 parsoid={
27157 "modes": ["html2wt"],
27158 "scrubWikitext": false
27159 }
27160 !! html
27161 <font>foo</font>
27162 !! wikitext
27163 <font>foo</font>
27164 !! end
27165
27166 !! test
27167 Escape nowiki DOM elements
27168 !! options
27169 parsoid=html2wt
27170 !! html/parsoid
27171 <nowiki><i>foo</i></nowiki>
27172 !! wikitext
27173 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
27174 !! end
27175
27176 # This is meant to be an interim fix while we go about figuring out
27177 # how to not introduce these trailing <nowiki/>s in the first place.
27178 !! test
27179 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
27180 !! options
27181 parsoid=html2wt
27182 !! html/parsoid
27183 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
27184 y</p>
27185 <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>
27186 <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>
27187 !! wikitext
27188 x
27189 y
27190
27191 {{echo|
27192 1 = <nowiki/>}}
27193
27194 {{echo|
27195 1 = <nowiki/>
27196 }}
27197 !! end
27198
27199 # ---------------------------------------------------
27200 # End of tests spec'ing wikitext serialization norms |
27201 # ---------------------------------------------------
27202
27203 # T104032
27204 !! test
27205 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
27206 !! options
27207 parsoid=html2wt
27208 !! html/parsoid
27209 a<p>b</p>
27210 <b>c</b><p>d</p>
27211 <table><tr>
27212 <td>a<p>b</p></td>
27213 <td><b>c</b><p>d</p></td>
27214 </tr></table>
27215 !! wikitext
27216 a
27217
27218 b
27219
27220 '''c'''
27221
27222 d
27223 {|
27224 |a
27225 b
27226 |'''c'''
27227 d
27228 |}
27229 !! end
27230
27231 # -----------------------------------------------------------------
27232 # End of section for Parsoid-only html2wt tests for serialization
27233 # of new content
27234 # -----------------------------------------------------------------
27235
27236 # -----------------------------------------------------------------
27237 # The following section of tests are primarily to spec behavior of
27238 # the selective serializer. All these tests have manual selser
27239 # changes. The automated selser changes for all tests handle the
27240 # wide variation of changes, but these tests here capture specs
27241 # deterministically.
27242 # ----------------------------------------------------------------
27243
27244 ## T90517
27245 !! test
27246 Selser: New comments should not be lost
27247 !! options
27248 parsoid={
27249 "modes": ["selser"],
27250 "changes": [
27251 [ "#a", "after", "<!--c1-->" ],
27252 [ "#b", "before", "<!--c2-->" ]
27253 ]
27254 }
27255 !! wikitext
27256 <span id="a">a</span>
27257
27258 <span id="b">b</span>
27259 !! wikitext/edited
27260 <span id="a">a</span><!--c1-->
27261
27262 <!--c2--><span id="b">b</span>
27263 !! end
27264
27265 ## T89383
27266 !! test
27267 Selser: Check for validity of DSR before using it
27268 !! options
27269 parsoid={
27270 "modes": ["selser"],
27271 "changes": [
27272 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
27273 ]
27274 }
27275 !! wikitext
27276 <span id="a">a</span>
27277 !! wikitext/edited
27278 {{DISPLAYTITLE:foo}}
27279 <span id="a">a</span>
27280 !! end
27281
27282 !! test
27283 1. DOMDiff: Changes to <ref> content should be looked up using id
27284 !! options
27285 parsoid={
27286 "modes": ["selser"],
27287 "changes": [
27288 ["#X", "after", "bar"],
27289 ["#Y", "after", "baz"]
27290 ]
27291 }
27292 !! wikitext
27293 X <ref><span id="X">foo</span></ref>
27294 Y <ref name="a" />
27295 <references>
27296 <ref name="a"><span id="Y">foo</span></ref>
27297 </references>
27298 !! wikitext/edited
27299 X <ref><span id="X">foo</span>bar</ref>
27300 Y <ref name="a" />
27301 <references>
27302 <ref name="a"><span id="Y">foo</span>baz</ref>
27303 </references>
27304 !! end
27305
27306 !! test
27307 2. DOMDiff: Changes to <ref> content should be looked up using id
27308 !! options
27309 parsoid={
27310 "modes": ["selser"],
27311 "changes": [
27312 ["#Z", "after", "bar"]
27313 ]
27314 }
27315 !! wikitext
27316 A <ref>foo bar for a</ref>
27317 B <ref group="X" name="b" />
27318
27319 <references />
27320
27321 <references group="X">
27322 <ref name="b"><span id="Z">foo</span></ref>
27323 </references>
27324 !! wikitext/edited
27325 A <ref>foo bar for a</ref>
27326 B <ref group="X" name="b" />
27327
27328 <references />
27329
27330 <references group="X">
27331 <ref name="b"><span id="Z">foo</span>bar</ref>
27332 </references>
27333 !! end
27334
27335 !! test
27336 DOMDiff: Edits to content nested in elements with templated attributes should not be lost (T139388)
27337 !! options
27338 parsoid={
27339 "modes": ["selser"],
27340 "changes": [
27341 [ "div:first-child", "text", "bar" ]
27342 ]
27343 }
27344 !! wikitext
27345 <div style="{{1x|color:red;}}%">foo</div>
27346 !! wikitext/edited
27347 <div style="{{1x|color:red;}}%">bar</div>
27348 !! end
27349
27350 !! test
27351 Empty LI (T49673)
27352 !! wikitext
27353 * a
27354 *
27355 *
27356 * b
27357 !! html/php+tidy
27358 <ul>
27359 <li>a</li>
27360 <li class="mw-empty-elt"></li>
27361 <li class="mw-empty-elt"></li>
27362 <li>b</li>
27363 </ul>
27364 !! end
27365
27366 !! test
27367 Thumbnail output
27368 !! wikitext
27369 [[File:Thumb.png|thumb]]
27370 !! html/php+tidy
27371 <div class="thumb tright">
27372 <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>
27373 <div class="thumbcaption">
27374 <div class="magnify"><a href="/wiki/File:Thumb.png" class="internal" title="Enlarge"></a></div>
27375 </div>
27376 </div>
27377 </div>
27378 !! end
27379
27380 !! test
27381 unclosed internal link XSS (T137264)
27382 !! wikitext
27383 [[#%3Cscript%3Ealert(1)%3C/script%3E|
27384 !! html/php
27385 <p>[[#&lt;script&gt;alert(1)&lt;/script&gt;|
27386 </p>
27387 !! html/parsoid
27388 <p>[[#%3Cscript%3Ealert(1)%3C/script%3E|</p>
27389 !! end