Merge "Make Special:ConfirmEmail load the user from the master"
[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 # ill add inter-language links
18 # subpage enable subpages (disabled by default)
19 # noxml don't check for XML well-formedness
20 # title=[[XXX]] run test using article title XXX
21 # language=XXX set content language to XXX for this test
22 # variant=XXX set the variant of language for this test (eg zh-tw)
23 # disabled do not run test
24 # parsoid parsoid-specific options (not run by PHP parser unless
25 # the test includes an html/php section)
26 # php php-only test (not run by the parsoid parser unless
27 # the test includes an html/parsoid section)
28 # showtitle make the first line the title
29 # showindicators make the first lines the page status indicators
30 # comment run through Linker::formatComment() instead of main parser
31 # local format section links in edit comment text as local links
32 # notoc disable table of contents
33 # thumbsize=NNN set the default thumb size to NNNpx for this test
34 #
35 # You can also set the following parser properties via test options:
36 # wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
37 # wgLinkHolderBatchSize, wgRawHtml
38 #
39 # For testing purposes, temporary articles can created:
40 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
41 # where '/' denotes a newline.
42
43 # This is the standard article assumed to exist.
44 !! article
45 Main Page
46 !! text
47 blah blah
48 !! endarticle
49
50 !!article
51 Foo
52 !!text
53 FOO
54 !!endarticle
55
56 !!article
57 Template:Foo
58 !!text
59 FOO
60 !!endarticle
61
62 !! article
63 Template:Blank
64 !! text
65 !! endarticle
66
67 !! article
68 Template:pipe
69 !! text
70 |
71 !! endarticle
72
73 !! article
74 Template:=
75 !! text
76 <nowiki>=</nowiki>
77 !! endarticle
78
79 !!article
80 MediaWiki:bad image list
81 !!text
82 * [[File:Bad.jpg]] except [[Nasty page]]
83 !!endarticle
84
85 !! article
86 Template:inner list
87 !! text
88 * item 1
89 !! endarticle
90
91 !! article
92 Template:tbl-start
93 !! text
94 {|
95 !! endarticle
96
97 !! article
98 Template:tbl-end
99 !! text
100 |}
101 !! endarticle
102
103 !! article
104 Template:echo
105 !! text
106 {{{1}}}
107 !! endarticle
108
109 !! article
110 Template:echo_with_span
111 !! text
112 <span>{{{1}}}</span>
113 !! endarticle
114
115 !! article
116 Template:echo_with_div
117 !! text
118 <div>{{{1}}}</div>
119 !! endarticle
120
121 !! article
122 Template:blank_param
123 !! text
124 {{{1}}}
125 {{{}}}
126 !! endarticle
127
128 !! article
129 Template:table_attribs
130 !! text
131 <noinclude>
132 |</noinclude>style="color:red;"|Foo
133 !! endarticle
134
135 !! article
136 Template:table_attribs_2
137 !! text
138 <noinclude>
139 |</noinclude>style="color:red;"|Foo
140 |Bar||Baz
141 !! endarticle
142
143 !! article
144 Template:table_attribs_3
145 !! text
146 <noinclude>
147 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo
148 !! endarticle
149
150 !! article
151 Template:table_attribs_4
152 !! text
153 | style="background-color:#DC241f;" width="10px" |
154 !! endarticle
155
156 !! article
157 Template:table_attribs_5
158 !! text
159 <noinclude>
160 |</noinclude>style="color:red;"||Bar
161 !! endarticle
162
163 !! article
164 Template:table_attribs_6
165 !! text
166 style="background: <nowiki>
167
168
169 red;</nowiki>" |
170 !! endarticle
171
172 !! article
173 Template:table_attribs_7
174 !! text
175 <noinclude>
176 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo<ref>foo</ref>
177 !! endarticle
178
179 !! article
180 Template:table_header_cells
181 !! text
182 {{table_attribs}}!!style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
183 !! endarticle
184
185 !! article
186 Template:table_cells
187 !! text
188 {{table_attribs}}||style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
189 !! endarticle
190
191 !! article
192 Template:PartialTable
193 !! text
194 {|
195 |-
196 !! endarticle
197
198 !! article
199 Template:image_attribs
200 !! text
201 <noinclude>
202 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
203 !! endarticle
204
205 ## See T48811 for details
206 !! article
207 Template:mixed_attr_content_template
208 !! text
209 style="color:red;" title="T48811"
210 |-
211 |foo
212 !! endarticle
213
214 !! article
215 Template:definition_list
216 !! text
217 one
218 ::two
219 !! endarticle
220
221 !! article
222 A?b
223 !! text
224 Weirdo titles!
225 !! endarticle
226
227 !!article
228 Template:Bullet
229 !!text
230 * Bar
231 !!endarticle
232
233 !!article
234 Template:OpenTable
235 !!text
236 {|
237 !!endarticle
238
239 !!article
240 Template:EmptyLITest
241 !!text
242 *a
243 *
244 *
245 *b
246 !!endarticle
247
248 !!article
249 Template:EmptyTRTest
250 !!text
251 {|
252 |-
253 |-
254 |foo
255 |-
256 |-
257 |bar
258 |}
259 !!endarticle
260
261 !!article
262 Template:EmptyTRWithHTMLAttrTest
263 !!text
264 <table>
265 <tr align="center"></tr>
266 <tr><td>foo</td></tr>
267 <tr align="center"></tr>
268 <tr><td>bar</td></tr>
269 </table>
270 !!endarticle
271
272 ###
273 ### Basic tests
274 ###
275 !! test
276 Blank input
277 !! wikitext
278 !! html
279 !! end
280
281
282 !! test
283 Simple paragraph
284 !! wikitext
285 This is a simple paragraph.
286 !! html
287 <p>This is a simple paragraph.
288 </p>
289 !! end
290
291 !! test
292 Paragraphs with extra newline spacing
293 !! wikitext
294 foo
295
296 bar
297
298
299 baz
300
301
302
303 booz
304 !! html
305 <p>foo
306 </p><p>bar
307 </p><p><br />
308 baz
309 </p><p><br />
310 </p><p>booz
311 </p>
312 !! end
313
314 !! test
315 Paragraphs with newline spacing with comment lines in between
316 !! wikitext
317 ----
318 a
319 <!--foo-->
320 b
321 ----
322 a
323 <!--foo--><!--More than 1 comment, still stripped-->
324 b
325 ----
326 a
327 <!--foo--> <!----> <!-- bar -->
328 b
329 ----
330 a
331 <!--foo-->
332
333 b
334 ----
335 a
336
337 <!--foo-->
338 b
339 ----
340 a
341 <!--foo-->
342
343
344 b
345 ----
346 a
347
348
349 <!--foo-->
350 b
351 ----
352 !! html
353 <hr />
354 <p>a
355 b
356 </p>
357 <hr />
358 <p>a
359 b
360 </p>
361 <hr />
362 <p>a
363 b
364 </p>
365 <hr />
366 <p>a
367 </p><p>b
368 </p>
369 <hr />
370 <p>a
371 </p><p>b
372 </p>
373 <hr />
374 <p>a
375 </p><p><br />
376 b
377 </p>
378 <hr />
379 <p>a
380 </p><p><br />
381 b
382 </p>
383 <hr />
384
385 !! end
386
387 !! test
388 Paragraphs with newline spacing with non-empty white-space lines in between
389 !! wikitext
390 ----
391 a
392
393 b
394 ----
395 a
396
397
398 b
399 ----
400 !! html
401 <hr />
402 <p>a
403 </p><p>b
404 </p>
405 <hr />
406 <p>a
407 </p><p><br />
408 b
409 </p>
410 <hr />
411
412 !! end
413
414 !! test
415 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
416 !! wikitext
417 ----
418 a
419 <!--foo-->
420 b
421 ----
422 a
423 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
424 b
425 ----
426 a
427
428 <!--foo-->
429 <!--bar-->
430 b
431 ----
432 a
433
434 <!--foo-->
435 <!--bar-->
436
437 b
438 ----
439 !! html
440 <hr />
441 <p>a
442 b
443 </p>
444 <hr />
445 <p>a
446 b
447 </p>
448 <hr />
449 <p>a
450 </p><p>b
451 </p>
452 <hr />
453 <p>a
454 </p><p><br />
455 b
456 </p>
457 <hr />
458
459 !! end
460
461 !! test
462 Extra newlines: More paragraphs with indented comment
463 !! wikitext
464 a
465
466 <!--boo-->
467
468 b
469 !! html
470 <p>a
471 </p><p><br />
472 b
473 </p>
474 !!end
475
476 !! test
477 Extra newlines followed by heading
478 !! wikitext
479 a
480
481
482
483 =b=
484 [[a]]
485
486
487 =b=
488 !! html
489 <p>a
490 </p><p><br />
491 </p>
492 <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>
493 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
494 </p><p><br />
495 </p>
496 <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>
497
498 !! end
499
500 !! test
501 Extra newlines between heading and content are swallowed
502 !! wikitext
503 =b=
504
505
506
507 [[a]]
508 !! html
509 <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>
510 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
511 </p>
512 !! end
513
514 !! test
515 Parsing an URL
516 !! wikitext
517 http://fr.wikipedia.org/wiki/🍺
518 <!-- EasterEgg we love beer, better be able be able to link to it -->
519 !! html
520 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
521 </p>
522 !! end
523
524 # Note that the html+tidy output removes the spaces after the <li>,
525 # which is a bug (http://sourceforge.net/p/tidy/bugs/945/, etc).
526 # This is an issue for all tests with lists. We intentionally do
527 # *not* add html+tidy clauses for these, as we don't want to
528 # document/test the broken behavior. (Parsoid matches the non-tidy
529 # output in these cases.)
530
531 !! test
532 Simple list
533 !! wikitext
534 * Item 1
535 * Item 2
536 !! html
537 <ul><li> Item 1</li>
538 <li> Item 2</li></ul>
539
540 !! end
541
542 !! test
543 Italics and bold
544 !! wikitext
545 * plain
546 * plain''italic''plain
547 * plain''italic''plain''italic''plain
548 * plain'''bold'''plain
549 * plain'''bold'''plain'''bold'''plain
550 * plain''italic''plain'''bold'''plain
551 * plain'''bold'''plain''italic''plain
552 * plain''italic'''bold-italic'''italic''plain
553 * plain'''bold''bold-italic''bold'''plain
554 * plain'''''bold-italic'''italic''plain
555 * plain'''''bold-italic''bold'''plain
556 * plain''italic'''bold-italic'''''plain
557 * plain'''bold''bold-italic'''''plain
558 * plain l'''italic''plain
559 * plain l''''bold''' plain
560 !! html
561 <ul><li> plain</li>
562 <li> plain<i>italic</i>plain</li>
563 <li> plain<i>italic</i>plain<i>italic</i>plain</li>
564 <li> plain<b>bold</b>plain</li>
565 <li> plain<b>bold</b>plain<b>bold</b>plain</li>
566 <li> plain<i>italic</i>plain<b>bold</b>plain</li>
567 <li> plain<b>bold</b>plain<i>italic</i>plain</li>
568 <li> plain<i>italic<b>bold-italic</b>italic</i>plain</li>
569 <li> plain<b>bold<i>bold-italic</i>bold</b>plain</li>
570 <li> plain<i><b>bold-italic</b>italic</i>plain</li>
571 <li> plain<b><i>bold-italic</i>bold</b>plain</li>
572 <li> plain<i>italic<b>bold-italic</b></i>plain</li>
573 <li> plain<b>bold<i>bold-italic</i></b>plain</li>
574 <li> plain l'<i>italic</i>plain</li>
575 <li> plain l'<b>bold</b> plain</li></ul>
576
577 !! end
578
579 # this example taken from the [[simple:Moon]] article (bug 47326)
580 !! test
581 Italics and possessives (1)
582 !! wikitext
583 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
584 !! html
585 <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
586 </p>
587 !! end
588
589 # this example taken from [[en:Flaming Pie]] (bug 49926)
590 !! test
591 Italics and possessives (2)
592 !! wikitext
593 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
594 !! html
595 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
596 </p>
597 !! end
598
599 # this example taken from [[en:Dictionary]] (bug 49926)
600 !! test
601 Italics and possessives (3)
602 !! wikitext
603 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''.
604 !! html
605 <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>.
606 </p>
607 !! end
608
609
610 ###
611 ### 2-quote opening sequence tests
612 ###
613 !! test
614 Italics and bold: 2-quote opening sequence: (2,2)
615 !! wikitext
616 ''foo''
617 !! html
618 <p><i>foo</i>
619 </p>
620 !!end
621
622 !! test
623 Italics and bold: 2-quote opening sequence: (2,3)
624 !! wikitext
625 ''foo'''
626 !! html/*
627 <p><i>foo'</i>
628 </p>
629 !!end
630
631 !! test
632 Italics and bold: 2-quote opening sequence: (2,4)
633 !! options
634 parsoid=wt2html
635 !! wikitext
636 ''foo''''
637 !! html/*
638 <p><i>foo''</i>
639 </p>
640 !!end
641
642 # same html as previous, but wikitext adjusted to match parsoid html2wt
643 !! test
644 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
645 !! wikitext
646 ''foo<nowiki>''</nowiki>''
647 !! html
648 <p><i>foo''</i>
649 </p>
650 !! end
651
652 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
653 !! test
654 Italics and bold: 2-quote opening sequence: (2,5)
655 !! options
656 parsoid=wt2html
657 !! wikitext
658 ''foo'''''
659 !! html/php
660 <p><i>foo</i>
661 </p>
662 !! html/parsoid
663 <p><i>foo</i><b></b>
664 </p>
665 !!end
666
667 # same html as previous, but wikitext adjusted to match parsoid html2wt
668 !! test
669 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
670 !! wikitext
671 ''foo'''''<nowiki/>'''
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
681 ###
682 ### 3-quote opening sequence tests
683 ###
684
685 !! test
686 Italics and bold: 3-quote opening sequence: (3,2)
687 !! wikitext
688 '''foo''
689 !! html/*
690 <p>'<i>foo</i>
691 </p>
692 !!end
693
694 !! test
695 Italics and bold: 3-quote opening sequence: (3,3)
696 !! wikitext
697 '''foo'''
698 !! html
699 <p><b>foo</b>
700 </p>
701 !!end
702
703 !! test
704 Italics and bold: 3-quote opening sequence: (3,4)
705 !! wikitext
706 '''foo''''
707 !! html/*
708 <p><b>foo'</b>
709 </p>
710 !!end
711
712 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
713 !! test
714 Italics and bold: 3-quote opening sequence: (3,5)
715 !! options
716 parsoid=wt2html
717 !! wikitext
718 '''foo'''''
719 !! html/php
720 <p><b>foo</b>
721 </p>
722 !! html/parsoid
723 <p><b>foo</b><i></i>
724 </p>
725 !!end
726
727 # same html as previous, but wikitext adjusted to match parsoid html2wt
728 !! test
729 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
730 !! wikitext
731 '''foo'''''<nowiki/>''
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
741 ###
742 ### 4-quote opening sequence tests
743 ###
744
745 !! test
746 Italics and bold: 4-quote opening sequence: (4,2)
747 !! options
748 parsoid=wt2html
749 !! wikitext
750 ''''foo''
751 !! html/*
752 <p>''<i>foo</i>
753 </p>
754 !!end
755
756 # same html as previous, but wikitext adjusted to match parsoid html2wt
757 !! test
758 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
759 !! wikitext
760 <nowiki>''</nowiki>''foo''
761 !! html
762 <p>''<i>foo</i>
763 </p>
764 !! end
765
766 !! test
767 Italics and bold: 4-quote opening sequence: (4,3)
768 !! wikitext
769 ''''foo'''
770 !! html/*
771 <p>'<b>foo</b>
772 </p>
773 !!end
774
775 !! test
776 Italics and bold: 4-quote opening sequence: (4,4)
777 !! options
778 parsoid=wt2html
779 !! wikitext
780 ''''foo''''
781 !! html/*
782 <p>'<b>foo'</b>
783 </p>
784 !!end
785
786 # same html as previous, but wikitext adjusted to match parsoid html2wt
787 !! test
788 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
789 !! wikitext
790 '<nowiki/>'''foo''''
791 !! html
792 <p>'<b>foo'</b>
793 </p>
794 !! end
795
796 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
797 !! test
798 Italics and bold: 4-quote opening sequence: (4,5)
799 !! options
800 parsoid=wt2html
801 !! wikitext
802 ''''foo'''''
803 !! html/php
804 <p>'<b>foo</b>
805 </p>
806 !! html/parsoid
807 <p>'<b>foo</b><i></i>
808 </p>
809 !!end
810
811 # same html as previous, but wikitext adjusted to match parsoid html2wt
812 !! test
813 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
814 !! wikitext
815 '<nowiki/>'''foo'''''<nowiki/>''
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
825 ###
826 ### 5-quote opening sequence tests
827 ###
828
829 !! test
830 Italics and bold: 5-quote opening sequence: (5,2)
831 !! options
832 parsoid=wt2html
833 !! wikitext
834 '''''foo''
835 !! html/*
836 <p><b><i>foo</i></b>
837 </p>
838 !!end
839
840 # same html as previous, but wikitext adjusted to match parsoid html2wt
841 # skipping wt2html and html2html because it wants to put <i> before <b>
842 !! test
843 Italics and bold: 5-quote opening sequence: (5,2+3)
844 !! options
845 parsoid=wt2wt,html2wt
846 !! wikitext
847 '''''foo'''''
848 !! html
849 <p><b><i>foo</i></b>
850 </p>
851 !! end
852
853 !! test
854 Italics and bold: 5-quote opening sequence: (5,3)
855 !! options
856 parsoid=wt2html
857 !! wikitext
858 '''''foo'''
859 !! html/*
860 <p><i><b>foo</b></i>
861 </p>
862 !!end
863
864 # same html as previous, but wikitext adjusted to match parsoid html2wt
865 !! test
866 Italics and bold: 5-quote opening sequence: (5,3+2)
867 !! wikitext
868 '''''foo'''''
869 !! html
870 <p><i><b>foo</b></i>
871 </p>
872 !! end
873
874 !! test
875 Italics and bold: 5-quote opening sequence: (5,4)
876 !! options
877 parsoid=wt2html
878 !! wikitext
879 '''''foo''''
880 !! html/*
881 <p><i><b>foo'</b></i>
882 </p>
883 !!end
884
885 !! test
886 Italics and bold: 5-quote opening sequence: (5,5)
887 !! wikitext
888 '''''foo'''''
889 !! html
890 <p><i><b>foo</b></i>
891 </p>
892 !!end
893
894 !! test
895 Italics and bold: 5-quote opening sequence: (5,6)
896 !! wikitext
897 '''''foo''''''
898 !! html/*
899 <p><i><b>foo'</b></i>
900 </p>
901 !! end
902
903 ###
904 ### multiple quote sequences in a line
905 ###
906 !! test
907 Italics and bold: multiple quote sequences: (2,4,2)
908 !! options
909 parsoid=wt2html
910 !! wikitext
911 ''foo''''bar''
912 !! html/*
913 <p><i>foo'<b>bar</b></i>
914 </p>
915 !!end
916
917
918 # same html as previous, but wikitext adjusted to match parsoid html2wt
919 !! test
920 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
921 !! wikitext
922 ''foo'<nowiki/>'''bar'''''
923 !! html
924 <p><i>foo'<b>bar</b></i>
925 </p>
926 !! end
927
928
929 !! test
930 Italics and bold: multiple quote sequences: (2,4,3)
931 !! options
932 parsoid=wt2html
933 !! wikitext
934 ''foo''''bar'''
935 !! html/*
936 <p><i>foo'<b>bar</b></i>
937 </p>
938 !!end
939
940
941 # same html as previous, but wikitext adjusted to match parsoid html2wt
942 !! test
943 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
944 !! wikitext
945 ''foo'<nowiki/>'''bar'''''
946 !! html
947 <p><i>foo'<b>bar</b></i>
948 </p>
949 !! end
950
951
952 !! test
953 Italics and bold: multiple quote sequences: (2,4,4)
954 !! options
955 parsoid=wt2html
956 !! wikitext
957 ''foo''''bar''''
958 !! html/*
959 <p><i>foo'<b>bar'</b></i>
960 </p>
961 !!end
962
963
964 # same html as previous, but wikitext adjusted to match parsoid html2wt
965 !! test
966 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
967 !! wikitext
968 ''foo'<nowiki/>'''bar'<nowiki/>'''''
969 !! html
970 <p><i>foo'<b>bar'</b></i>
971 </p>
972 !! end
973
974
975 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
976 !! test
977 Italics and bold: multiple quote sequences: (3,4,2)
978 !! options
979 parsoid=wt2html
980 !! wikitext
981 '''foo''''bar''
982 !! html/php
983 <p><b>foo'</b>bar
984 </p>
985 !! html/parsoid
986 <p><b>foo'</b>bar<i></i>
987 </p>
988 !!end
989
990 # same html as previous, but wikitext adjusted to match parsoid html2wt
991 !! test
992 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
993 !! options
994 parsoid
995 !! wikitext
996 '''<nowiki>foo'</nowiki>'''bar''<nowiki/>''
997 !! html/php
998 <p><b>foo'</b>bar
999 </p>
1000 !! html/parsoid
1001 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<i></i>
1002 </p>
1003 !! end
1004
1005
1006 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1007 !! test
1008 Italics and bold: multiple quote sequences: (3,4,3)
1009 !! options
1010 parsoid=wt2html
1011 !! wikitext
1012 '''foo''''bar'''
1013 !! html/php
1014 <p><b>foo'</b>bar
1015 </p>
1016 !! html/parsoid
1017 <p><b>foo'</b>bar<b></b>
1018 </p>
1019 !!end
1020
1021 # same html as previous, but wikitext adjusted to match parsoid html2wt
1022 !! test
1023 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
1024 !! wikitext
1025 '''<nowiki>foo'</nowiki>'''bar'''<nowiki/>'''
1026 !! html/php
1027 <p><b>foo'</b>bar
1028 </p>
1029 !! html/parsoid
1030 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<b></b>
1031 </p>
1032 !! end
1033
1034 ###
1035 ### other quote tests
1036 ###
1037 !! test
1038 Italics and bold: other quote tests: (2,3,5)
1039 !! wikitext
1040 ''this is about '''foo's family'''''
1041 !! html
1042 <p><i>this is about <b>foo's family</b></i>
1043 </p>
1044 !!end
1045
1046
1047 !! test
1048 Italics and bold: other quote tests: (2,(3,3),2)
1049 !! wikitext
1050 ''this is about '''foo's''' family''
1051 !! html
1052 <p><i>this is about <b>foo's</b> family</i>
1053 </p>
1054 !!end
1055
1056
1057 !! test
1058 Italics and bold: other quote tests: (3,2,3,2)
1059 !! options
1060 parsoid=wt2html
1061 !! wikitext
1062 '''this is about ''foo'''s family''
1063 !! html/*
1064 <p><b>this is about <i>foo</i></b><i>s family</i>
1065 </p>
1066 !!end
1067
1068
1069 # same html as previous, but wikitext adjusted to match parsoid html2wt
1070 !! test
1071 Italics and bold: other quote tests: (3,2,3+2+2,2)
1072 !! wikitext
1073 '''this is about ''foo'''''<nowiki/>''s family''
1074 !! html
1075 <p><b>this is about <i>foo</i></b><i>s family</i>
1076 </p>
1077 !! end
1078
1079
1080 !! test
1081 Italics and bold: other quote tests: (3,2,3,3)
1082 !! wikitext
1083 '''this is about ''foo'''s family'''
1084 !! html/*
1085 <p>'<i>this is about </i>foo<b>s family</b>
1086 </p>
1087 !!end
1088
1089
1090 !! test
1091 Italics and bold: other quote tests: (3,(2,2),3)
1092 !! wikitext
1093 '''this is about ''foo's'' family'''
1094 !! html
1095 <p><b>this is about <i>foo's</i> family</b>
1096 </p>
1097 !!end
1098
1099
1100 !! test
1101 Italicized possessive
1102 !! wikitext
1103 The ''[[Main Page]]'''s talk page.
1104 !! html/php
1105 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1106 </p>
1107 !! html/parsoid
1108 <p>The <i><a rel="mw:WikiLink" href="Main_Page" title="Main Page">Main Page</a>'</i>s talk page.</p>
1109 !! end
1110
1111 !! test
1112 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
1113 (Requires tidy for PHP parser output to be fixed up)
1114 !! options
1115 parsoid=wt2html,wt2wt
1116 !! wikitext
1117 {|
1118 !''a!!''b
1119 |''a||''b
1120 |}
1121 !! html/php+tidy
1122 <table>
1123 <tr>
1124 <th><i>a</i></th>
1125 <th><i>b</i></th>
1126 <td><i>a</i></td>
1127 <td><i>b</i></td>
1128 </tr>
1129 </table>
1130 !! html/parsoid
1131 <table>
1132 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
1133 <td><i>a</i></td><td><i>b</i></td></tr>
1134 </tbody></table>
1135 !! end
1136
1137 ###
1138 ### Non-html5 tags
1139 ###
1140
1141 !! test
1142 Non-html5 tags should be accepted
1143 !! wikitext
1144 <center>''foo''</center>
1145 <big>''foo''</big>
1146 <font>''foo''</font>
1147 <strike>''foo''</strike>
1148 <tt>''foo''</tt>
1149 !! html
1150 <center><i>foo</i></center>
1151 <p><big><i>foo</i></big>
1152 <font><i>foo</i></font>
1153 <strike><i>foo</i></strike>
1154 <tt><i>foo</i></tt>
1155 </p>
1156 !! end
1157
1158 !! test
1159 <wbr> is valid wikitext (bug 52468)
1160 !! wikitext
1161 <wbr>
1162 !! html
1163 <p><wbr />
1164 </p>
1165 !! end
1166
1167 # <strike> is HTML4, <s> is HTML4/5.
1168 !! test
1169 <s> or <strike> for strikethrough
1170 !! wikitext
1171 <strike>strike</strike>
1172
1173 <s>s</s>
1174 !! html
1175 <p><strike>strike</strike>
1176 </p><p><s>s</s>
1177 </p>
1178 !! end
1179
1180 ## a not permitted
1181 ## i,b,br omitted
1182 !! test
1183 Text-level semantic html elements in wikitext
1184 !! wikitext
1185 <em>text</em>
1186 <strong>text</strong>
1187 <small>text</small>
1188 <s>text</s>
1189 <cite>text</cite>
1190 <q>text</q>
1191 <dfn>text</dfn>
1192 <abbr>text</abbr>
1193 <data>text</data>
1194 <time>text</time>
1195 <code>text</code>
1196 <var>text</var>
1197 <samp>text</samp>
1198 <kbd>text</kbd>
1199 <sub>text</sub>
1200 <u>text</u>
1201 <mark>text</mark>
1202 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1203 <bdi>text</bdi>
1204 <bdo>text</bdo>
1205 <span>text</span>
1206 <wbr />
1207 !! html
1208 <p><em>text</em>
1209 <strong>text</strong>
1210 <small>text</small>
1211 <s>text</s>
1212 <cite>text</cite>
1213 <q>text</q>
1214 <dfn>text</dfn>
1215 <abbr>text</abbr>
1216 <data>text</data>
1217 <time>text</time>
1218 <code>text</code>
1219 <var>text</var>
1220 <samp>text</samp>
1221 <kbd>text</kbd>
1222 <sub>text</sub>
1223 <u>text</u>
1224 <mark>text</mark>
1225 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1226 <bdi>text</bdi>
1227 <bdo>text</bdo>
1228 <span>text</span>
1229 <wbr />
1230 </p>
1231 !! end
1232
1233 # test cases taken from
1234 # http://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
1235 !! test
1236 Ruby markup (W3C-style)
1237 !! wikitext
1238 ; Mono-ruby for individual base characters
1239 : <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
1240 ; Group ruby
1241 : <ruby>今日<rt>きょう</rt></ruby>
1242 ; Jukugo ruby
1243 : <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
1244 ; Inline ruby
1245 : <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
1246 ; Double-sided ruby
1247 : <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
1248 <ruby>
1249 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1250 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1251 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1252 </ruby>
1253 !! html
1254 <dl><dt> Mono-ruby for individual base characters</dt>
1255 <dd> <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1256 <dt> Group ruby</dt>
1257 <dd> <ruby>今日<rt>きょう</rt></ruby></dd>
1258 <dt> Jukugo ruby</dt>
1259 <dd> <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1260 <dt> Inline ruby</dt>
1261 <dd> <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1262 <dt> Double-sided ruby</dt>
1263 <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>
1264 <p><ruby>
1265 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1266 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1267 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1268 </ruby>
1269 </p>
1270 !! end
1271
1272 # The next two test different paths in the sanitizer.
1273 !! test
1274 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
1275 !! wikitext
1276 <blockquote|>a</blockquote>
1277
1278 <b→> doesn't terminate </b→>
1279
1280 <bä> doesn't terminate </bä>
1281
1282 <boo> doesn't terminate </boo>
1283
1284 <s.foo> doesn't terminate </s.foo>
1285
1286 <sub-ID#1>
1287 !! html
1288 <p>&lt;blockquote|&gt;a&lt;/blockquote&gt;
1289 </p><p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1290 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1291 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1292 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1293 </p><p>&lt;sub-ID#1&gt;
1294 </p>
1295 !! end
1296
1297 # There is a tidy bug here: http://sourceforge.net/p/tidy/bugs/946/
1298 # If the non-word-character tag made it through the sanitizer, tidy
1299 # would munge it up.
1300 !! test
1301 Non-word characters don't terminate tag names + tidy
1302 !! wikitext
1303 <blockquote|>a</blockquote>
1304
1305 <b→> doesn't terminate </b→>
1306
1307 <bä> doesn't terminate </bä>
1308
1309 <boo> doesn't terminate </boo>
1310
1311 <s.foo> doesn't terminate </s.foo>
1312
1313 <sub-ID#1>
1314 !! html+tidy
1315 <p>&lt;blockquote|&gt;a</p>
1316 <p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;</p>
1317 <p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;</p>
1318 <p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;</p>
1319 <p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;</p>
1320 <p>&lt;sub-ID#1&gt;</p>
1321 !! end
1322
1323 ###
1324 ### See tests/parser/parserTestsParserHook.php for the <tåg> extension)
1325 ### This checks that HTML5 tags (with non-word characters in the tag
1326 ### name) make it safely through the parser -- the Sanitizer will
1327 ### munge them later, as it should.
1328 ###
1329 !! test
1330 Non-word characters are valid in extension tags (T19663)
1331 !! wikitext
1332 <tåg>tåg</tåg>
1333 !! html/php
1334 <pre>
1335 'tåg'
1336 array (
1337 )
1338 </pre>
1339
1340 !! end
1341
1342 !! test
1343 Isolated close tags should be treated as literal text (bug 52760)
1344 !! options
1345 parsoid=wt2html
1346 !! wikitext
1347 </b>
1348
1349 <s.foo>s</s>
1350 !! html/php+tidy
1351 <p>&lt;s.foo&gt;s</p>
1352 !! html/parsoid
1353 <p>&lt;s.foo&gt;s</p>
1354 !! end
1355
1356 ###
1357 ### Special characters
1358 ###
1359
1360 !! test
1361 Bare pipe character (bug 52363)
1362 !! wikitext
1363 |
1364 !! html
1365 <p>|
1366 </p>
1367 !! end
1368
1369 !! test
1370 Bare pipe character from a template (bug 52363)
1371 !! wikitext
1372 {{pipe}}
1373 !! html
1374 <p>|
1375 </p>
1376 !! end
1377
1378 ###
1379 ### <nowiki> test cases
1380 ###
1381
1382 !! test
1383 <nowiki> unordered list
1384 !! wikitext
1385 <nowiki>* This is not an unordered list item.</nowiki>
1386 !! html/php
1387 <p>* This is not an unordered list item.
1388 </p>
1389 !! html/parsoid
1390 <p><span typeof="mw:Nowiki">* This is not an unordered list item.</span></p>
1391 !! end
1392
1393 !! test
1394 <nowiki> spacing
1395 !! wikitext
1396 <nowiki>Lorem ipsum dolor
1397
1398 sed abit.
1399 sed nullum.
1400
1401 :and a colon
1402 </nowiki>
1403 !! html/php
1404 <p>Lorem ipsum dolor
1405
1406 sed abit.
1407 sed nullum.
1408
1409 :and a colon
1410
1411 </p>
1412 !! html/parsoid
1413 <p><span typeof="mw:Nowiki">Lorem ipsum dolor
1414
1415 sed abit.
1416 sed nullum.
1417
1418 :and a colon
1419 </span></p>
1420 !! end
1421
1422 !! test
1423 nowiki 3
1424 !! wikitext
1425 :There is not nowiki.
1426 :There is <nowiki>nowiki</nowiki>.
1427
1428 #There is not nowiki.
1429 #There is <nowiki>nowiki</nowiki>.
1430
1431 *There is not nowiki.
1432 *There is <nowiki>nowiki</nowiki>.
1433 !! html/php
1434 <dl><dd>There is not nowiki.</dd>
1435 <dd>There is nowiki.</dd></dl>
1436 <ol><li>There is not nowiki.</li>
1437 <li>There is nowiki.</li></ol>
1438 <ul><li>There is not nowiki.</li>
1439 <li>There is nowiki.</li></ul>
1440
1441 !! html/parsoid
1442 <dl><dd data-parsoid='{}'>There is not nowiki.</dd>
1443 <dd data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</dd></dl>
1444
1445 <ol><li data-parsoid='{}'>There is not nowiki.</li>
1446 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ol>
1447
1448 <ul><li data-parsoid='{}'>There is not nowiki.</li>
1449 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ul>
1450 !! end
1451
1452 !! test
1453 Entities inside <nowiki>
1454 !! wikitext
1455 <nowiki>&lt;</nowiki>
1456 !! html
1457 <p>&lt;
1458 </p>
1459 !! end
1460
1461 !! test
1462 Entities inside template parameters
1463 !! options
1464 parsoid
1465 !! wikitext
1466 {{echo|&ndash;}}
1467 !! html
1468 <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>
1469 !! end
1470
1471 !! test
1472 Properly escape nowiki when combined with other wiki markup
1473 !! options
1474 parsoid=html2wt
1475 !! html
1476 <p>* &lt;/nowiki&gt; tag</p>
1477 !! wikitext
1478 <nowiki>*</nowiki> <nowiki>&lt;/nowiki&gt;</nowiki> tag
1479 !! end
1480
1481 !! test
1482 T93824: Put escaped HTML tags inside nowiki
1483 !! options
1484 parsoid=html2wt
1485 !! html
1486 <p>&lt;h2&gt;foo&lt;/h2&gt;</p>
1487 !! wikitext
1488 <nowiki><h2>foo</h2></nowiki>
1489 !! end
1490
1491 !! test
1492 T71950: 1. Put nowiki as close to cause as possible, even with non-quote escapable chars
1493 !! options
1494 parsoid=html2wt
1495 !! html
1496 <p>This text: L'<a rel="mw:WikiLink" href="./Foo">Foo</a>
1497 This text: L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1498 This text: L'''<a rel="mw:WikiLink" href="./Foo">Foo</a>''</p>
1499 !! wikitext
1500 This text: L'[[Foo]]
1501 This text: L<nowiki>''</nowiki>[[Foo]]
1502 This text: L<nowiki>'''</nowiki>[[Foo]]<nowiki>''</nowiki>
1503 !! end
1504
1505 # This test fails because wikitext whitespace is not normalized before comparing.
1506 !! test
1507 T71950: 2. Put nowiki as close to cause as possible, after ' :'
1508 !! options
1509 parsoid=html2wt
1510 !! html
1511 <p>This text : L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1512 </p>
1513 !! wikitext
1514 This text : L<nowiki>''</nowiki>[[Foo]]
1515 !! end
1516
1517 # This test and the next one are html2wt only as they test that incorrect wikitext
1518 # passed in template arguments gets escaped or wrapped in nowikis where required.
1519 !! test
1520 T71482: Use {{!}} instead of nowiki for single pipe in template argument
1521 !! options
1522 parsoid=html2wt
1523 !! html/parsoid
1524 <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>
1525 <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>
1526 !! wikitext
1527 {{echo|foo{{!}}bar}}
1528 {{echo|<nowiki>foo|bar |[[</nowiki>}}
1529 !! end
1530
1531 !! test
1532 T53961: Output correct nowikis in template arguments
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;a [ b&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;a }} b&quot;}},&quot;i&quot;:0}}]}" about="#mwt2"></span>
1538 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a [[ b&quot;}},&quot;i&quot;:0}}]}" about="#mwt3"></span>
1539 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a | {{ ]]&quot;}},&quot;i&quot;:0}}]}" about="#mwt4"></span>
1540 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a }&quot;}},&quot;i&quot;:0}}]}" about="#mwt5"></span></p>
1541 !! wikitext
1542 {{echo|a [ b}}
1543 {{echo|a <nowiki>}}</nowiki> b}}
1544 {{echo|<nowiki>a [[ b</nowiki>}}
1545 {{echo|a {{!}} <nowiki>{{ ]]</nowiki>}}
1546 {{echo|a <nowiki>}</nowiki>}}
1547 !! end
1548
1549 !! test
1550 Cases where "!!" needs nowiki protection
1551 !! options
1552 parsoid=html2wt
1553 !! html
1554 <table>
1555 <tr><th>this needs protection !! here</th></tr>
1556 </table>
1557
1558 <table>
1559 <tr><th>this does not need
1560 protection !! here</th></tr>
1561 </table>
1562 !! wikitext
1563 {|
1564 !<nowiki>this needs protection !! here</nowiki>
1565 |}
1566
1567 {|
1568 !this does not need
1569 protection !! here
1570 |}
1571 !! end
1572
1573 ###
1574 ### Comments
1575 ###
1576 !! test
1577 Comments and Indent-Pre
1578 !! wikitext
1579 <!-- comment 1 --> asdf
1580
1581 <!-- comment 1 --> asdf
1582 <!-- comment 2 -->
1583
1584 <!-- comment 1 --> asdf
1585 <!-- comment 2 -->xyz
1586
1587 <!-- comment 1 --> asdf
1588 <!-- comment 2 --> xyz
1589 !! html
1590 <pre>asdf
1591 </pre>
1592 <pre>asdf
1593 </pre>
1594 <pre>asdf
1595 </pre>
1596 <p>xyz
1597 </p>
1598 <pre>asdf
1599 xyz
1600 </pre>
1601 !! end
1602
1603 !! test
1604 Comment test 2a
1605 !! wikitext
1606 asdf
1607 <!-- comment 1 -->
1608 jkl
1609 !! html
1610 <p>asdf
1611 jkl
1612 </p>
1613 !! end
1614
1615 !! test
1616 Comment test 2b
1617 !! wikitext
1618 asdf
1619 <!-- comment 1 -->
1620
1621 jkl
1622 !! html
1623 <p>asdf
1624 </p><p>jkl
1625 </p>
1626 !! end
1627
1628 !! test
1629 Comment test 3
1630 !! wikitext
1631 asdf
1632 <!-- comment 1 -->
1633 <!-- comment 2 -->
1634 jkl
1635 !! html
1636 <p>asdf
1637 jkl
1638 </p>
1639 !! end
1640
1641 !! test
1642 Comment test 4
1643 !! wikitext
1644 asdf<!-- comment 1 -->jkl
1645 !! html
1646 <p>asdfjkl
1647 </p>
1648 !! end
1649
1650 !! test
1651 Comment spacing
1652 !! wikitext
1653 a
1654 <!-- foo --> b <!-- bar -->
1655 c
1656 !! html
1657 <p>a
1658 </p>
1659 <pre> b
1660 </pre>
1661 <p>c
1662 </p>
1663 !! end
1664
1665 !! test
1666 Comment whitespace
1667 !! wikitext
1668 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1669 !! html
1670
1671 !! end
1672
1673 !! test
1674 Comment semantics and delimiters
1675 !! wikitext
1676 <!-- --><!----><!-----><!------>
1677 !! html/php
1678
1679 !! html/parsoid
1680 <!-- --><!----><!--&#x2D;--><!--&#x2D;&#x2D;-->
1681 !! end
1682
1683 !! test
1684 Comment semantics and delimiters, redux
1685 !! wikitext
1686 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1687 -- foo -- funky huh? ... -->
1688 !! html/php
1689
1690 !! html/parsoid
1691 <!-- In SGML every "foo" here would actually show up in the text &#x2D;&#x2D; foo &#x2D;&#x2D; bar
1692 &#x2D;&#x2D; foo &#x2D;&#x2D; funky huh? ... -->
1693 !! end
1694
1695 !! test
1696 Comment semantics and delimiters: directors cut
1697 !! wikitext
1698 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1699 everything starting with < followed by !-- until the first -- and > we see,
1700 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1701 -->-->
1702 !! html/php
1703 <p>--&gt;
1704 </p>
1705 !! html/parsoid
1706 <!-- ... However we like to keep things simple and somewhat XML&#x2D;ish so we eat
1707 everything starting with < followed by !&#x2D;&#x2D; until the first &#x2D;&#x2D; and &#x3E; we see,
1708 that wouldn't be valid XML however, since in XML &#x2D;&#x2D; has to terminate a comment
1709 --><p>--></p>
1710 !! end
1711
1712 !! test
1713 Comment semantics: nesting
1714 !! wikitext
1715 <!--<!-- no, we're not going to do anything fancy here -->-->
1716 !! html/php
1717 <p>--&gt;
1718 </p>
1719 !! html/parsoid
1720 <!--<!&#x2D;&#x2D; no, we're not going to do anything fancy here --><p>--></p>
1721 !! end
1722
1723 # Parsoid closes the unclosed comment, even if it means a slight
1724 # round-trip diff.
1725 !! test
1726 Comment semantics: unclosed comment at end
1727 !! options
1728 parsoid=wt2html,html2html
1729 !! wikitext
1730 <!--This comment will run out to the end of the document
1731 !! html/php
1732
1733 !! html/parsoid
1734 <!--This comment will run out to the end of the document-->
1735 !! end
1736
1737 !! test
1738 Comment semantics: normalize comments to play nice with XML and browsers
1739 !! wikitext
1740 <!-- Browsers --!> think this is closed -->
1741 <!--> This would normally be text -->
1742 <!---> As would this -->
1743 <!-- XML doesn't like trailing dashes -------->
1744 <!-- Nor doubled hyphens -- anywhere in the data -->
1745 But this is not a comment.
1746 !! html/php
1747 <p>But this is not a comment.
1748 </p>
1749 !! html/parsoid
1750 <!-- Browsers &#x2D;&#x2D;!&#x3E; think this is closed -->
1751 <!--&#x3E; This would normally be text -->
1752 <!--&#x2D;&#x3E; As would this -->
1753 <!-- XML doesn't like trailing dashes &#x2D;&#x2D;&#x2D;&#x2D;&#x2D;&#x2D;-->
1754 <!-- Nor doubled hyphens &#x2D;&#x2D; anywhere in the data -->
1755 <p>But this is not a comment.</p>
1756 !! end
1757
1758 !! test
1759 Comment semantics: round-trip even text which contains encoded -->
1760 !! wikitext
1761 <!-- hello & goodbye - > --&gt; --&amp;gt; --&xx -->
1762 !! html/parsoid
1763 <!-- hello &#x26; goodbye &#x2D; &#x3E; &#x2D;&#x2D;&#x3E; &#x2D;&#x2D;&#x26;gt; &#x2D;&#x2D;&#x26;xx -->
1764 !! end
1765
1766 !! test
1767 Comment in template title
1768 !! wikitext
1769 {{f<!---->oo}}
1770 !! html
1771 <p>FOO
1772 </p>
1773 !! end
1774
1775 !! test
1776 Comment on its own line post-expand
1777 !! wikitext
1778 a
1779 {{blank}}<!---->
1780 b
1781 !! html
1782 <p>a
1783 </p><p>b
1784 </p>
1785 !! end
1786
1787 !! test
1788 Comment on its own line post-expand with non-significant whitespace
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 Multiple comments should still parse as SOL-transparent
1801 !! options
1802 parsoid=wt2html,wt2wt
1803 !! wikitext
1804 <!--c1-->*a
1805 <!--c2--><!--c3--><!--c4-->*b
1806 !! html
1807 <!--c1--><ul>
1808 <li>a
1809 </li>
1810 <!--c2--><!--c3--><!--c4-->
1811 <li>b
1812 </li>
1813 </ul>
1814 !! end
1815
1816 ###
1817 ### paragraph wrapping tests
1818 ###
1819 !! test
1820 No block tags
1821 !! wikitext
1822 a
1823
1824 b
1825 !! html
1826 <p>a
1827 </p><p>b
1828 </p>
1829 !! end
1830
1831 !! test
1832 Block tag on one line (<div>)
1833 !! wikitext
1834 a <div>foo</div>
1835
1836 b
1837 !! html
1838 a <div>foo</div>
1839 <p>b
1840 </p>
1841 !! html+tidy
1842 <p>a</p>
1843 <div>foo</div>
1844 <p>b</p>
1845 !! end
1846
1847 !! test
1848 Block tag on one line (<blockquote>)
1849 !! wikitext
1850 a <blockquote>foo</blockquote>
1851
1852 b
1853 !! html
1854 a <blockquote>foo</blockquote>
1855 <p>b
1856 </p>
1857 !! html+tidy
1858 <p>a</p>
1859 <blockquote>
1860 <p>foo</p>
1861 </blockquote>
1862 <p>b</p>
1863 !! end
1864
1865 !! test
1866 Block tag on both lines (<div>)
1867 !! wikitext
1868 a <div>foo</div>
1869
1870 b <div>foo</div>
1871 !! html
1872 a <div>foo</div>
1873 b <div>foo</div>
1874
1875 !! html+tidy
1876 <p>a</p>
1877 <div>foo</div>
1878 <p>b</p>
1879 <div>foo</div>
1880 !! end
1881
1882 !! test
1883 Block tag on both lines (<blockquote>)
1884 !! wikitext
1885 a <blockquote>foo</blockquote>
1886
1887 b <blockquote>foo</blockquote>
1888 !! html
1889 a <blockquote>foo</blockquote>
1890 b <blockquote>foo</blockquote>
1891
1892 !! html+tidy
1893 <p>a</p>
1894 <blockquote>
1895 <p>foo</p>
1896 </blockquote>
1897 <p>b</p>
1898 <blockquote>
1899 <p>foo</p>
1900 </blockquote>
1901 !! end
1902
1903 !! test
1904 Multiple lines without block tags
1905 !! wikitext
1906 <div>foo</div> a
1907 b
1908 c
1909 d<!--foo--> e
1910 x <div>foo</div> z
1911 !! html
1912 <div>foo</div> a
1913 <p>b
1914 c
1915 d e
1916 </p>
1917 x <div>foo</div> z
1918
1919 !! html+tidy
1920 <div>foo</div>
1921 <p>a</p>
1922 <p>b c d e</p>
1923 <p>x</p>
1924 <div>foo</div>
1925 <p>z</p>
1926 !! end
1927
1928 # Tidy strips out the empty <div> tags. Parsoid doesn't.
1929 # So, we have a separate section for Parsoid. We don't want
1930 # to mimic this stripping behavior in Parsoid. It affects
1931 # editing experience and also requires us to maintain additional
1932 # info for RT-ing.
1933 !! test
1934 Empty lines between lines with block tags
1935 !! wikitext
1936 <div></div>
1937
1938
1939 <div></div>a
1940
1941 b
1942 <div>a</div>b
1943
1944 <div>b</div>d
1945
1946
1947 <div>e</div>
1948 !! html
1949 <div></div>
1950 <p><br />
1951 </p>
1952 <div></div>a
1953 <p>b
1954 </p>
1955 <div>a</div>b
1956 <div>b</div>d
1957 <p><br />
1958 </p>
1959 <div>e</div>
1960
1961 !! html+tidy
1962 <p><br /></p>
1963 <p>a</p>
1964 <p>b</p>
1965 <div>a</div>
1966 <p>b</p>
1967 <div>b</div>
1968 <p>d</p>
1969 <p><br /></p>
1970 <div>e</div>
1971 !! html/parsoid
1972 <div data-parsoid='{"stx":"html"}'></div>
1973
1974 <p><br /></p>
1975 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
1976
1977 <p>b</p>
1978 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
1979
1980 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
1981
1982 <p><br /></p>
1983 <div data-parsoid='{"stx":"html"}'>e</div>
1984 !! end
1985
1986 ## PHP parser emits output which is broken
1987 !! test
1988 Unclosed HTML p-tags should be handled properly
1989 !! wikitext
1990 <div><p>foo</div>
1991 a
1992
1993 b
1994 !! html/php+tidy
1995 <div>
1996 <p>foo</p>
1997 </div>
1998 <p>a</p>
1999 <p>b</p>
2000 !! html/parsoid
2001 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
2002 <p>a</p>
2003 <p>b</p>
2004 !! end
2005
2006 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
2007 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
2008 ## them for now.
2009 !! test
2010 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
2011 !! options
2012 parsoid=wt2html
2013 !! wikitext
2014 a [[Category:A1]] [[Category:A2]]
2015 [[Category:A3]]
2016 [[Category:A4]]
2017 !! html/parsoid
2018 <p>a</p>
2019 <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"/>
2020 !! end
2021
2022 !! test
2023 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
2024 !! options
2025 parsoid=wt2html
2026 !! wikitext
2027 [[Category:A1]]a
2028 !! html/parsoid
2029 <link rel="mw:PageProp/Category" href="Category:A1"/><p>a</p>
2030 !! end
2031
2032 ###
2033 ### Preformatted text
2034 ###
2035 !! test
2036 Preformatted text
2037 !! wikitext
2038 This is some
2039 Preformatted text
2040 With ''italic''
2041 And '''bold'''
2042 And a [[Main Page|link]]
2043 !! html
2044 <pre>This is some
2045 Preformatted text
2046 With <i>italic</i>
2047 And <b>bold</b>
2048 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
2049 </pre>
2050 !! end
2051
2052 !! test
2053 Tabs don't trigger preformatted text
2054 !! wikitext
2055 This is not
2056 preformatted text.
2057 This is preformatted text.
2058 So is this.
2059 !! html
2060 <p> This is not
2061 preformatted text.
2062 </p>
2063 <pre>This is preformatted text.
2064 So is this.
2065 </pre>
2066 !! end
2067
2068 !! test
2069 Ident preformatting with inline content
2070 !! wikitext
2071 a
2072 ''b''
2073 !! html
2074 <pre>a
2075 <i>b</i>
2076 </pre>
2077 !! end
2078
2079 !! test
2080 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
2081 !! wikitext
2082 <pre><nowiki>
2083 <b>
2084 <cite>
2085 <em>
2086 </nowiki></pre>
2087 !! html
2088 <pre>
2089 &lt;b&gt;
2090 &lt;cite&gt;
2091 &lt;em&gt;
2092 </pre>
2093
2094 !! end
2095
2096 !! test
2097 Regression with preformatted in <center>
2098 !! wikitext
2099 <center>
2100 Blah
2101 </center>
2102 !! html
2103 <center>
2104 <pre>Blah
2105 </pre>
2106 </center>
2107
2108 !! end
2109
2110 !! test
2111 Bug 52763: Preformatted in <blockquote>
2112 !! wikitext
2113 <blockquote>
2114 Blah
2115 {|
2116 |
2117 indented cell (no pre-wrapping!)
2118 |}
2119 </blockquote>
2120 !! html
2121 <blockquote>
2122 <p> Blah
2123 </p>
2124 <table>
2125 <tr>
2126 <td>
2127 <p> indented cell (no pre-wrapping!)
2128 </p>
2129 </td></tr></table>
2130 </blockquote>
2131
2132 !! end
2133
2134 !! test
2135 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
2136 !! wikitext
2137 <blockquote>
2138 Foo
2139
2140 Bar
2141 </blockquote>
2142 !! html
2143 <blockquote>
2144 <p>Foo
2145 </p><p>Bar
2146 </p>
2147 </blockquote>
2148
2149 !! end
2150
2151 !! test
2152 Bug 15491: <ins>/<del> in blockquote
2153 !! wikitext
2154 <blockquote>
2155 Foo <del>bar</del> <ins>baz</ins> quux
2156 </blockquote>
2157 !! html
2158 <blockquote>
2159 <p>Foo <del>bar</del> <ins>baz</ins> quux
2160 </p>
2161 </blockquote>
2162
2163 !! end
2164
2165 # Note that the p-wrapping is newline sensitive, which could be
2166 # considered a bug: tidy will wrap only the 'Foo' in the example
2167 # below in a <p> tag. (see comment 23-25 of bug #6200)
2168 !! test
2169 Bug 15491: <ins>/<del> in blockquote (2)
2170 !! wikitext
2171 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2172 </blockquote>
2173 !! html
2174 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2175 </blockquote>
2176
2177 !! html+tidy
2178 <blockquote>
2179 <p>Foo</p>
2180 <del>bar</del> <ins>baz</ins> quux</blockquote>
2181 !! end
2182
2183 !! test
2184 <pre> with attributes (bug 3202)
2185 !! wikitext
2186 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2187 !! html
2188 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2189
2190 !! end
2191
2192 !! test
2193 <pre> with width attribute (bug 3202)
2194 !! wikitext
2195 <pre width="8">Narrow screen goodies</pre>
2196 !! html
2197 <pre width="8">Narrow screen goodies</pre>
2198
2199 !! end
2200
2201 !! test
2202 <pre> with forbidden attribute (bug 3202)
2203 !! wikitext
2204 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
2205 !! html
2206 <pre width="8">Narrow screen goodies</pre>
2207
2208 !! end
2209
2210 !! test
2211 Entities inside <pre>
2212 !! wikitext
2213 <pre>&lt;</pre>
2214 !! html
2215 <pre>&lt;</pre>
2216
2217 !! end
2218
2219 !! test
2220 <pre> with forbidden attribute values (bug 3202)
2221 !! wikitext
2222 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
2223 !! html
2224 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
2225
2226 !! end
2227
2228 !! test
2229 <nowiki> inside <pre> (bug 13238)
2230 !! wikitext
2231 <pre>
2232 <nowiki>
2233 </pre>
2234 <pre>
2235 <nowiki></nowiki>
2236 </pre>
2237 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
2238 !! html
2239 <pre>
2240 &lt;nowiki&gt;
2241 </pre>
2242 <pre>
2243
2244 </pre>
2245 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2246
2247 !! end
2248
2249 !! test
2250 <nowiki> and <pre> preference (first one wins)
2251 !! wikitext
2252 <pre>
2253 <nowiki>
2254 </pre>
2255 </nowiki>
2256 </pre>
2257
2258 <nowiki>
2259 <pre>
2260 <nowiki>
2261 </pre>
2262 </nowiki>
2263 </pre>
2264
2265 !! html/php
2266 <pre>
2267 &lt;nowiki&gt;
2268 </pre>
2269 <p>&lt;/nowiki&gt;
2270 &lt;/pre&gt;
2271 </p><p>
2272 &lt;pre&gt;
2273 &lt;nowiki&gt;
2274 &lt;/pre&gt;
2275
2276 &lt;/pre&gt;
2277 </p>
2278 !! html/parsoid
2279 <pre data-parsoid='{"stx":"html","strippedNL":true}'>&lt;nowiki>
2280 </pre>
2281 <p><span typeof="mw:Placeholder" data-parsoid='{"src":"&lt;/nowiki>"}'>&lt;/nowiki></span>
2282 &lt;/pre></p>
2283
2284 <p><span typeof="mw:Nowiki">
2285 &lt;pre>
2286 &lt;nowiki>
2287 &lt;/pre>
2288 </span>
2289 &lt;/pre></p>
2290 !! end
2291
2292 !! test
2293 </pre> inside nowiki
2294 !! wikitext
2295 <nowiki></pre></nowiki>
2296 !! html
2297 <p>&lt;/pre&gt;
2298 </p>
2299 !! end
2300
2301 # Parsoid doesn't strip empty tags, like Tidy does.
2302 !! test
2303 Empty pre; pre inside other HTML tags (bug 54946)
2304 !! options
2305 parsoid=wt2html,wt2wt
2306 !! wikitext
2307 a
2308
2309 <div><pre>
2310 foo
2311 </pre></div>
2312 <pre></pre>
2313 !! html/php
2314 <p>a
2315 </p>
2316 <div><pre>
2317 foo
2318 </pre></div>
2319 <pre></pre>
2320
2321 !! html/php+tidy
2322 <p>a</p>
2323 <div>
2324 <pre>
2325 foo
2326 </pre></div>
2327 !! html/parsoid
2328 <p>a</p>
2329
2330 <div><pre>foo
2331 </pre></div>
2332 <pre></pre>
2333 !! end
2334
2335 !! test
2336 HTML pre followed by indent-pre
2337 !! wikitext
2338 <pre>foo</pre>
2339 bar
2340 !! html
2341 <pre>foo</pre>
2342 <pre>bar
2343 </pre>
2344 !! end
2345
2346 !!test
2347 Block tag pre
2348 !!options
2349 parsoid
2350 !! wikitext
2351 <p><pre>foo</pre></p>
2352 !! html
2353 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2354 !!end
2355
2356 !!test
2357 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2358 !! wikitext
2359 {{echo|}}
2360 !! html
2361
2362 !!end
2363
2364 !!test
2365 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2366 !! wikitext
2367 {{echo|
2368 foo}}
2369 !! html
2370 <p>foo
2371 </p>
2372 !!end
2373
2374 !! test
2375 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2376 !! wikitext
2377 {{echo|a
2378 b}}
2379 !! html
2380 <pre>a
2381 </pre>
2382 <p>b
2383 </p>
2384 !!end
2385
2386 !! test
2387 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2388 !! wikitext
2389 {{echo|a
2390 b
2391 c
2392 d
2393 e
2394 }}
2395 !! html
2396 <pre>a
2397 </pre>
2398 <p>b
2399 c
2400 </p>
2401 <pre>d
2402 </pre>
2403 <p>e
2404 </p>
2405 !!end
2406
2407 !!test
2408 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2409 !! wikitext
2410 {{echo| foo}}
2411
2412 {{echo| foo}}{{echo| bar}}
2413
2414 {{echo| foo}}
2415 {{echo| bar}}
2416
2417 {{echo|<!--cmt--> foo}}
2418
2419 <!--cmt-->{{echo| foo}}
2420
2421 {{echo|{{echo| }}bar}}
2422 !! html
2423 <pre>foo
2424 </pre>
2425 <pre>foo bar
2426 </pre>
2427 <pre>foo
2428 bar
2429 </pre>
2430 <pre>foo
2431 </pre>
2432 <pre>foo
2433 </pre>
2434 <pre>bar
2435 </pre>
2436 !!end
2437
2438 !! test
2439 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2440 !! wikitext
2441 {{echo| }}a
2442
2443 {{echo|
2444 }}a
2445
2446 {{echo|
2447 b}}
2448
2449 {{echo|a
2450 }}b
2451
2452 {{echo|a
2453 }} b
2454 !! html
2455 <pre>a
2456 </pre>
2457 <p><br />
2458 </p>
2459 <pre>a
2460 </pre>
2461 <p><br />
2462 </p>
2463 <pre>b
2464 </pre>
2465 <p>a
2466 </p>
2467 <pre>b
2468 </pre>
2469 <p>a
2470 </p>
2471 <pre>b
2472 </pre>
2473 !!end
2474
2475 !! test
2476 Things that look like <pre> tags aren't treated as such
2477 !! wikitext
2478 Barack Obama <President> of the United States
2479 <President></President>
2480 !! html
2481 <p>Barack Obama &lt;President&gt; of the United States
2482 &lt;President&gt;&lt;/President&gt;
2483 </p>
2484 !! end
2485
2486 ## PHP parser discards the "<pre " string
2487 !! test
2488 Handle broken pre-like tags (bug 64025)
2489 !! options
2490 parsoid=wt2html
2491 !! wikitext
2492 {{echo|<pre <pre>x</pre>}}
2493
2494 <table><pre </table>
2495 !! html/php
2496 <pre>x</pre>
2497 <table><pre></pre></table>
2498
2499 !! html/parsoid
2500 <pre about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"a":{"&lt;pre":null},"sa":{"&lt;pre":""},"stx":"html","pi":[[{"k":"1","spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;pre &lt;pre>x&lt;/pre>"}},"i":0}}]}'>x</pre>
2501
2502
2503 <p>&lt;pre </p>
2504
2505 <table></table>
2506 !! end
2507
2508 !! test
2509 Parsoid: handle pre with space after attribute
2510 !! options
2511 parsoid=wt2html
2512 !! wikitext
2513 <pre style="width:50%;" >{{echo|foo}}</pre>
2514 !! html
2515 <pre style="width:50%;">{{echo|foo}}</pre>
2516 !! end
2517
2518 # TODO / maybe: fix wt2wt for this
2519 !! test
2520 Parsoid: Don't paragraph-wrap fosterable content
2521 !! options
2522 parsoid=wt2html
2523 !! wikitext
2524 {|
2525 <td></td>
2526 <td></td>
2527
2528
2529
2530 |}
2531 !! html
2532 <table>
2533
2534 <tbody>
2535 <tr>
2536 <td></td>
2537
2538 <td></td></tr>
2539
2540
2541
2542 </tbody></table>
2543 !! end
2544
2545 !! test
2546 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2547 !! options
2548 parsoid=wt2html
2549 !! wikitext
2550 {|
2551 <td>
2552 <td>
2553 </td>
2554
2555
2556
2557 |}
2558 !! html
2559 <table>
2560
2561 <tbody>
2562 <tr>
2563 <td></td>
2564
2565 <td>
2566 </td></tr>
2567
2568
2569
2570 </tbody></table>
2571 !! end
2572
2573
2574 #--------------------------------------------------------------------
2575 # Transclusion parameter whitespace stripping tests
2576 # Behavior is different for positional and named parameters
2577 #--------------------------------------------------------------------
2578 !! test
2579 Templates: Strip leading and trailing whitespace from named-param values
2580 !! wikitext
2581 {{echo|1= a }}
2582
2583 {{echo|1= {{echo|b}} }}
2584
2585 {{echo| 1 =
2586 c }}
2587
2588 {{echo| 1 =
2589 * d
2590 }}
2591 !! html
2592 <p>a
2593 </p><p>b
2594 </p><p>c
2595 </p>
2596 <ul><li> d</li></ul>
2597
2598 !! end
2599
2600 !! test
2601 Templates: Don't strip whitespace from positional-param values
2602 !! wikitext
2603 {{echo|a }}
2604
2605 {{echo|{{echo|b}} }}
2606
2607 {{echo| c
2608 }}
2609
2610 {{echo| {{echo|d}}
2611 }}
2612
2613 {{echo|
2614 e}}
2615
2616 {{echo|
2617 * f}}
2618
2619 {{echo|
2620 }}g
2621 !! html
2622 <p>a
2623 </p><p>b
2624 </p>
2625 <pre>c
2626 </pre>
2627 <p><br />
2628 </p>
2629 <pre>d
2630 </pre>
2631 <p><br />
2632 </p>
2633 <pre>e
2634 </pre>
2635 <p><br />
2636 </p>
2637 <ul><li> f</li></ul>
2638 <p><br />
2639 </p>
2640 <pre>g
2641 </pre>
2642 !! end
2643
2644 !! test
2645 Templates: Handle empty comment-and-ws-only lines correctly
2646 !! wikitext
2647 {{echo|foo
2648 <!--should be ignored-->
2649 <!--should be ignored as well-->
2650 bar}}
2651 !! html
2652 <p>foo
2653 bar
2654 </p>
2655 !! end
2656
2657 !! test
2658 Templates: Handle comments in the target
2659 !! wikitext
2660 {{echo
2661 <!-- should be ignored -->
2662 |foo}}
2663
2664 {{echo<!-- should be ignored -->
2665 |foo}}
2666
2667 {{echo<!-- should be ignored -->|foo}}
2668
2669 {{<!-- should be ignored -->echo|foo}}
2670 !!html/parsoid
2671 <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>
2672
2673 <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>
2674
2675 <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>
2676
2677 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2678 !!end
2679
2680 !! test
2681 Templates: Handle comments in parameter names (bug 67657)
2682 !! wikitext
2683 {{echo|1
2684 <!-- should be ignored -->
2685 =foo}}
2686
2687 {{echo|
2688 <!-- should be ignored -->
2689 1 = foo}}
2690
2691 {{echo|1<!-- should be ignored --> = foo}}
2692
2693 {{echo|<!-- should be ignored -->1 = foo}}
2694 !!html/parsoid
2695 <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>
2696
2697 <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>
2698
2699 <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>
2700
2701 <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>
2702 !!end
2703
2704 !! test
2705 Templates: Other wikitext in parameter names (bug 67657)
2706 !! wikitext
2707 {{echo|''1''=foo}}
2708 !!html/parsoid
2709 <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>
2710 !!html/php
2711 <p>{{{1}}}
2712 </p>
2713 !!end
2714
2715 #--------------------------------------------------------------------
2716 # Transclusion parameter escaping tests
2717 #--------------------------------------------------------------------
2718 !! test
2719 Templates: Parsoid parameter escaping test 1
2720 !! options
2721 parsoid
2722 !! wikitext
2723 {{echo|[foo]|{{echo|[bar]}}}}
2724 !! html
2725 <p about="#mwt1" typeof="mw:Transclusion"
2726 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2727 !! end
2728
2729 !! test
2730 Parsoid: Pipes in external links in template parameter
2731 !! options
2732 parsoid
2733 !! wikitext
2734 {{echo|[{{echo|http://example.com}} link]}}
2735 !! html
2736 <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>
2737 !! end
2738
2739 !! test
2740 Parsoid: pipe in transclusion parameter
2741 !! options
2742 parsoid
2743 !! wikitext
2744 {{echo|http://foo.com/a&#124;b}}
2745 !! html
2746 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2747 typeof="mw:Transclusion"
2748 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>
2749 !! end
2750
2751 !! test
2752 Parsoid: Pipe in external link target and content in template parameter
2753 !! options
2754 parsoid=html2wt,wt2wt
2755 !! wikitext
2756 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2757 !! html
2758 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2759 typeof="mw:Transclusion"
2760 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2761 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2762 !! end
2763
2764 !! test
2765 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2766 !! options
2767 parsoid
2768 !! wikitext
2769 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2770 !! html
2771 <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>
2772 !! end
2773
2774 !! test
2775 Templates: Don't escape already nowiki-escaped text in template parameters
2776 !! options
2777 parsoid=html2wt,wt2wt
2778 !! wikitext
2779 {{echo|foo<nowiki>|</nowiki>bar}}
2780 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2781 {{echo|<nowiki></nowiki>}}
2782 !! html
2783 <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>
2784 <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>
2785 <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>
2786 </p>
2787 !! end
2788
2789 ## Bug 52824
2790 !! test
2791 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2792 !! options
2793 parsoid=html2wt,wt2wt
2794 !! wikitext
2795 {{echo|{{echo|1=bar}}}}
2796 !! html
2797 <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>
2798 !! end
2799
2800 ## Bug 56733
2801 !! test
2802 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2803 !! options
2804 parsoid
2805 !! wikitext
2806 {{echo|a : b}}
2807 !! html
2808 <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>
2809 !! end
2810
2811 ## Bug T73412
2812 !! test
2813 Templates: Preserve blank parameter names
2814 !! wikitext
2815 {{echo|=foo}}
2816 !! html/php
2817 <p>{{{1}}}
2818 </p>
2819 !! html/parsoid
2820 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2821 !! end
2822
2823 !! test
2824 Templates: Preserve blank parameter names in other positions
2825 !! wikitext
2826 {{blank_param|bar|=foo}}
2827 !! html/php
2828 <p>bar
2829 foo
2830 </p>
2831 !! html/parsoid
2832 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]},{"k":"","named":true,"spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"blank_param","href":"./Template:Blank_param"},"params":{"1":{"wt":"bar"},"":{"wt":"foo"}},"i":0}}]}'>bar
2833 foo</p>
2834 !! end
2835
2836 ###
2837 ### Parsoid-centric tests for testing RT edge cases for pre
2838 ###
2839
2840 !!test
2841 1a. Indent-Pre and Comments
2842 !! wikitext
2843 a
2844 <!--a-->
2845 c
2846 !! html
2847 <pre>a
2848 </pre>
2849 <p>c
2850 </p>
2851 !!end
2852
2853 !!test
2854 1b. Indent-Pre and Comments
2855 !! wikitext
2856 a
2857 <!--a-->
2858 c
2859 !! html
2860 <pre>a
2861 </pre>
2862 <p>c
2863 </p>
2864 !!end
2865
2866 !!test
2867 1c. Indent-Pre and Comments
2868 !! wikitext
2869 <!--a--> a
2870
2871 <!--a--> a
2872 !! html
2873 <pre> a
2874 </pre>
2875 <pre> a
2876 </pre>
2877 !!end
2878
2879 !!test
2880 1d. Indent-Pre and Comments
2881 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2882 !! wikitext
2883 <!--a--> a
2884
2885 <!--b-->b
2886 !! html
2887 <pre>a
2888 </pre>
2889 <pre>b
2890 </pre>
2891 !!end
2892
2893 !!test
2894 2a. Indent-Pre and tables
2895 !! wikitext
2896 {|
2897 |-
2898 !h1!!h2
2899 |foo||bar
2900 |}
2901 !! html
2902 <table>
2903
2904 <tr>
2905 <th>h1</th>
2906 <th>h2
2907 </th>
2908 <td>foo</td>
2909 <td>bar
2910 </td></tr></table>
2911
2912 !!end
2913
2914 !!test
2915 2b. Indent-Pre and tables
2916 !! wikitext
2917 {|
2918 |-
2919 |foo
2920 |}
2921 !! html
2922 <table>
2923
2924 <tr>
2925 <td>foo
2926 </td></tr></table>
2927
2928 !!end
2929
2930 !!test
2931 2c. Indent-Pre and tables (bug 42252)
2932 !! wikitext
2933 {|
2934 |+ foo
2935 ! | bar
2936 |}
2937 !! html
2938 <table>
2939 <caption> foo
2940 </caption>
2941 <tr>
2942 <th> bar
2943 </th></tr></table>
2944
2945 !!end
2946
2947 !!test
2948 2d. Indent-Pre and tables
2949 !! wikitext
2950 a
2951 {|
2952 | b
2953 |}
2954 !! html/php
2955 <pre>a
2956 </pre>
2957 <table>
2958 <tr>
2959 <td> b
2960 </td></tr></table>
2961
2962 !! html/parsoid
2963 <pre>a</pre>
2964 <table>
2965 <tbody><tr><td> b</td></tr>
2966 </tbody></table>
2967 !!end
2968
2969 !!test
2970 2e. Indent-Pre and table-line syntax
2971 !! wikitext
2972 a
2973 | b
2974 | c
2975 !! html/php
2976 <pre>a
2977 | b
2978 | c
2979 </pre>
2980 !!end
2981
2982 !!test
2983 2f. Indent-pre started by table-line syntax
2984 !! wikitext
2985 a
2986 | b
2987 | c
2988 !! html/php
2989 <p>a
2990 </p>
2991 <pre>| b
2992 | c
2993 </pre>
2994 !! html/parsoid
2995 <p>a</p>
2996 <pre>
2997 | b
2998 | c</pre>
2999 !!end
3000
3001 !!test
3002 3a. Indent-Pre and block tags (single-line html)
3003 !! wikitext
3004 a <p> foo </p>
3005 b <div> foo </div>
3006 c <blockquote> foo </blockquote>
3007 <span> foo </span>
3008 !! html
3009 a <p> foo </p>
3010 b <div> foo </div>
3011 c <blockquote> foo </blockquote>
3012 <pre><span> foo </span>
3013 </pre>
3014 !! html/parsoid
3015 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
3016 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3017 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
3018 <pre><span> foo </span>
3019 </pre>
3020 !! html+tidy
3021 <p>a</p>
3022 <p>foo</p>
3023 <p>b</p>
3024 <div>foo</div>
3025 <p>c</p>
3026 <blockquote>
3027 <p>foo</p>
3028 </blockquote>
3029 <pre>
3030 <span> foo </span>
3031 </pre>
3032 !! end
3033
3034 !!test
3035 3b. Indent-Pre and block tags (multi-line html)
3036 !! wikitext
3037 a <span>foo</span>
3038 b <div> foo </div>
3039 !! html
3040 <pre>a <span>foo</span>
3041 </pre>
3042 b <div> foo </div>
3043
3044 !! html/parsoid
3045 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3046 b <div data-parsoid='{"stx":"html"}'> foo </div>
3047 !! html+tidy
3048 <pre>
3049 a <span>foo</span>
3050 </pre>
3051 <p>b</p>
3052 <div>foo</div>
3053 !!end
3054
3055 !!test
3056 3c. Indent-Pre and block tags (pre-content on separate line)
3057 !! wikitext
3058 <p>
3059 foo
3060 </p>
3061
3062 <div>
3063 foo
3064 </div>
3065
3066 <center>
3067 foo
3068 </center>
3069
3070 <blockquote>
3071 foo
3072 </blockquote>
3073
3074 <blockquote>
3075 <pre>
3076 foo
3077 </pre>
3078 </blockquote>
3079
3080 <table><tr><td>
3081 foo
3082 </td></tr></table>
3083
3084 <ul><li>
3085 foo
3086 </li></ul>
3087
3088 !! html
3089 <p>
3090 foo
3091 </p>
3092 <div>
3093 <pre>foo
3094 </pre>
3095 </div>
3096 <center>
3097 <pre>foo
3098 </pre>
3099 </center>
3100 <blockquote>
3101 <p> foo
3102 </p>
3103 </blockquote>
3104 <blockquote>
3105 <pre>
3106 foo
3107 </pre>
3108 </blockquote>
3109 <table><tr><td>
3110 <pre>foo
3111 </pre>
3112 </td></tr></table>
3113 <ul><li>
3114 foo
3115 </li></ul>
3116
3117 !!end
3118
3119 !!test
3120 4. Indent-Pre and extension tags
3121 !! wikitext
3122 a <gallery>
3123 File:foobar.jpg
3124 </gallery>
3125 !! html
3126 a <ul class="gallery mw-gallery-traditional">
3127 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
3128 <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>
3129 <div class="gallerytext">
3130 </div>
3131 </div></li>
3132 </ul>
3133
3134 !! html+tidy
3135 <p>a</p>
3136 <ul class="gallery mw-gallery-traditional">
3137 <li class="gallerybox" style="width: 155px">
3138 <div style="width: 155px">
3139 <div class="thumb" style="width: 150px;">
3140 <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>
3141 </div>
3142 <div class="gallerytext"></div>
3143 </div>
3144 </li>
3145 </ul>
3146 !!end
3147
3148 !! test
3149 Table wikitext syntax outside wiki-tables
3150 !! wikitext
3151 a
3152 ! not a table heading
3153 |- not a table row
3154 | not a table cell
3155 | class="foo bar" | baz
3156 b
3157 |}
3158 |-
3159 c
3160 !! html
3161 <p>a
3162 ! not a table heading
3163 |- not a table row
3164 | not a table cell
3165 | class="foo bar" | baz
3166 b
3167 |}
3168 |-
3169 c
3170 </p>
3171 !! end
3172
3173 !!test
3174 Render paragraphs when indent-pre is suppressed in blocklevels
3175 !! wikitext
3176 <blockquote>
3177 foo
3178
3179 bar
3180 </blockquote>
3181 !! html
3182 <blockquote>
3183 <p> foo
3184 </p><p> bar
3185 </p>
3186 </blockquote>
3187
3188 !!end
3189
3190 !!test
3191 4. Multiple spaces at start-of-line
3192 !! wikitext
3193 <p> foo </p>
3194 foo
3195 {|
3196 |foo
3197 |}
3198 !! html
3199 <p> foo </p>
3200 <pre> foo
3201 </pre>
3202 <table>
3203 <tr>
3204 <td>foo
3205 </td></tr></table>
3206
3207 !!end
3208
3209 ## NOTE: the leading white-space chars on empty line are significant
3210 !! test
3211 5a. White-space in indent-pre
3212 !! wikitext
3213 a<br />
3214
3215 b
3216 !! html
3217 <pre>a<br />
3218
3219 b
3220 </pre>
3221 !! end
3222
3223 ## NOTE: the leading white-space chars on empty line are significant
3224 !! test
3225 5b. White-space in indent-pre
3226 !! wikitext
3227 a
3228
3229 b
3230
3231
3232 c
3233 !! html
3234 <pre>a
3235
3236 b
3237
3238
3239 c
3240 </pre>
3241 !! end
3242
3243 !! test
3244 5c. White-space in indent-pre
3245 !! wikitext
3246 ''a''
3247 ''b''
3248 ''c''
3249 !! html
3250 <pre><i>a</i>
3251 <i>b</i>
3252 <i>c</i>
3253 </pre>
3254 !! end
3255
3256 !! test
3257 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3258 !! wikitext
3259 a
3260
3261 <!-- continue -->
3262 b
3263
3264 c
3265
3266 d
3267 !! html
3268 <pre>a
3269
3270 b
3271 </pre>
3272 <pre>c
3273
3274 </pre>
3275 <p>d
3276 </p>
3277 !! end
3278
3279 !! test
3280 7a. Indent-pre and category links
3281 !! options
3282 parsoid=wt2html,wt2wt
3283 !! wikitext
3284 [[Category:foo]] <!-- No pre-wrapping -->
3285 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3286 !! html/parsoid
3287 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3288 <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 -->
3289 !! end
3290
3291 !! test
3292 7b. Indent-pre and category links
3293 !! options
3294 parsoid=wt2html,wt2wt
3295 !! wikitext
3296 [[Category:foo]] a
3297 [[Category:foo]] {{echo|b}}
3298 !! html
3299 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3300 <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>
3301 !! end
3302
3303 !! test
3304 Indent-Pre: Newlines in comments shouldn't affect sol state
3305 !! wikitext
3306 a <!--
3307 foo
3308 --> b
3309 !! html/parsoid
3310 <p>a <!--
3311 foo
3312 --> b</p>
3313 !! end
3314
3315 ###
3316 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3317 ###
3318
3319 !!test
3320 HTML-pre: 1. embedded newlines
3321 !! wikitext
3322 <pre>foo</pre>
3323
3324 <pre>
3325 foo
3326 </pre>
3327
3328 <pre>
3329
3330 foo
3331 </pre>
3332
3333 <pre>
3334
3335
3336 foo
3337 </pre>
3338 !! html
3339 <pre>foo</pre>
3340 <pre>
3341 foo
3342 </pre>
3343 <pre>
3344
3345 foo
3346 </pre>
3347 <pre>
3348
3349
3350 foo
3351 </pre>
3352
3353 !! html/parsoid
3354 <pre data-parsoid='{"stx":"html"}'>foo</pre>
3355
3356 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
3357 foo
3358 </pre>
3359
3360 <pre data-parsoid='{"stx":"html"}'>
3361
3362 foo
3363 </pre>
3364
3365 <pre data-parsoid='{"stx":"html"}'>
3366
3367
3368 foo
3369 </pre>
3370 !!end
3371
3372 !! test
3373 HTML-pre: big spaces
3374 !! wikitext
3375 <pre>
3376
3377
3378
3379
3380 haha
3381
3382
3383
3384
3385 haha
3386
3387
3388
3389
3390 </pre>
3391 !! html
3392 <pre>
3393
3394
3395
3396
3397 haha
3398
3399
3400
3401
3402 haha
3403
3404
3405
3406
3407 </pre>
3408
3409 !! html/parsoid
3410 <pre data-parsoid='{"stx":"html"}'>
3411
3412
3413
3414
3415 haha
3416
3417
3418
3419
3420 haha
3421
3422
3423
3424
3425 </pre>
3426 !! end
3427
3428 !!test
3429 HTML-pre: 2: indented text
3430 !! wikitext
3431 <pre>
3432 foo
3433 </pre>
3434 !! html
3435 <pre>
3436 foo
3437 </pre>
3438
3439 !!end
3440
3441 !!test
3442 HTML-pre: 3: other wikitext
3443 !! wikitext
3444 <pre>
3445 * foo
3446 # bar
3447 = no-h =
3448 '' no-italic ''
3449 [[ NoLink ]]
3450 </pre>
3451 !! html/php
3452 <pre>
3453 * foo
3454 # bar
3455 = no-h =
3456 '' no-italic ''
3457 [[ NoLink ]]
3458 </pre>
3459
3460 !! html/parsoid
3461 <pre data-parsoid='{"stx":"html","strippedNL":true}'>* foo
3462 # bar
3463 = no-h =
3464 '' no-italic ''
3465 [[ NoLink ]]
3466 </pre>
3467 !!end
3468
3469 ###
3470 ### Definition lists
3471 ###
3472 !! test
3473 Simple definition
3474 !! wikitext
3475 ; name : Definition
3476 !! html
3477 <dl><dt> name&#160;</dt>
3478 <dd> Definition</dd></dl>
3479
3480 !! end
3481
3482 !! test
3483 Definition list for indentation only
3484 !! wikitext
3485 : Indented text
3486 !! html
3487 <dl><dd> Indented text</dd></dl>
3488
3489 !! end
3490
3491 !! test
3492 Definition list with no space
3493 !! wikitext
3494 ;name:Definition
3495 !! html
3496 <dl><dt>name</dt>
3497 <dd>Definition</dd></dl>
3498
3499 !!end
3500
3501 !! test
3502 Definition list with URL link
3503 !! wikitext
3504 ; http://example.com/ : definition
3505 !! html
3506 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3507 <dd> definition</dd></dl>
3508
3509 !! end
3510
3511 !! test
3512 Definition list with bracketed URL link
3513 !! wikitext
3514 ;[http://www.example.com/ Example]:Something about it
3515 !! html
3516 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3517 <dd>Something about it</dd></dl>
3518
3519 !! end
3520
3521 !! test
3522 Definition list with wikilink containing colon
3523 !! wikitext
3524 ; [[Help:FAQ]]: The least-read page on Wikipedia
3525 !! html
3526 <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>
3527 <dd> The least-read page on Wikipedia</dd></dl>
3528
3529 !! end
3530
3531 # At Brion's and JeLuF's insistence... :)
3532 !! test
3533 Definition list with news link containing colon
3534 !! wikitext
3535 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
3536 !! html/php
3537 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3538 <dd> This isn't even a real newsgroup!</dd></dl>
3539
3540 !! html/parsoid
3541 <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>
3542 !! end
3543
3544 !! test
3545 Malformed definition list with colon
3546 !! wikitext
3547 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3548 !! html
3549 <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>
3550
3551 !! end
3552
3553 !! test
3554 Definition lists: colon in external link text
3555 !! wikitext
3556 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3557 !! html
3558 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3559 <dd> OK, I made that up</dd></dl>
3560
3561 !! end
3562
3563 !! test
3564 Definition lists: colon in HTML attribute
3565 !! wikitext
3566 ;<b style="display: inline">bold</b>
3567 !! html
3568 <dl><dt><b style="display: inline">bold</b></dt></dl>
3569
3570 !! end
3571
3572 !! test
3573 Definition lists: self-closed tag
3574 !! wikitext
3575 ;one<br/>two : two-line fun
3576 !! html
3577 <dl><dt>one<br />two&#160;</dt>
3578 <dd> two-line fun</dd></dl>
3579
3580 !! end
3581
3582 !! test
3583 Bug 11748: Literal closing tags
3584 !! wikitext
3585 <dl>
3586 <dt>test 1</dt>
3587 <dd>test test test test test</dd>
3588 <dt>test 2</dt>
3589 <dd>test test test test test</dd>
3590 </dl>
3591 !! html
3592 <dl>
3593 <dt>test 1</dt>
3594 <dd>test test test test test</dd>
3595 <dt>test 2</dt>
3596 <dd>test test test test test</dd>
3597 </dl>
3598
3599 !! end
3600
3601 !! test
3602 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3603 !! wikitext
3604 <ul><li>
3605 ; term : description
3606 * unordered
3607 </li></ul>
3608 !! html
3609 <ul><li>
3610 <dl><dt> term&#160;</dt>
3611 <dd> description</dd></dl>
3612 <ul><li> unordered</li></ul>
3613 </li></ul>
3614
3615 !! end
3616
3617 !! test
3618
3619 Definition list with empty definition and following paragraph
3620 !! wikitext
3621 ; term:
3622 Paragraph text
3623 !! html
3624 <dl><dt> term</dt>
3625 <dd></dd></dl>
3626 <p>Paragraph text
3627 </p>
3628 !! end
3629
3630 !! test
3631 Nested definition lists using html syntax
3632 !! wikitext
3633 <dl><dt>x</dt>
3634 <dd>a</dd>
3635 <dd>b</dd></dl>
3636
3637 !! end
3638
3639 !! test
3640 Definition Lists: No nesting: Multiple dd's
3641 !! wikitext
3642 ;x
3643 :a
3644 :b
3645 !! html
3646 <dl><dt>x</dt>
3647 <dd>a</dd>
3648 <dd>b</dd></dl>
3649
3650 !! end
3651
3652 !! test
3653 Definition Lists: Indentation: Regular
3654 !! wikitext
3655 :i1
3656 ::i2
3657 :::i3
3658 !! html
3659 <dl><dd>i1
3660 <dl><dd>i2
3661 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3662
3663 !! end
3664
3665 !! test
3666 Definition Lists: Indentation: Missing 1st level
3667 !! wikitext
3668 ::i2
3669 :::i3
3670 !! html
3671 <dl><dd><dl><dd>i2
3672 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3673
3674 !! end
3675
3676 !! test
3677 Definition Lists: Indentation: Multi-level indent
3678 !! wikitext
3679 :::i3
3680 !! html
3681 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3682
3683 !! end
3684
3685 !! test
3686 Definition Lists: Hacky use to indent tables
3687 !! wikitext
3688 ::{|
3689 |foo
3690 |bar
3691 |}
3692 this text
3693 should be left alone
3694 !! html
3695 <dl><dd><dl><dd><table>
3696 <tr>
3697 <td>foo
3698 </td>
3699 <td>bar
3700 </td></tr></table></dd></dl></dd></dl>
3701 <p>this text
3702 should be left alone
3703 </p>
3704 !! end
3705
3706 !! test
3707 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3708 !! wikitext
3709 <!-- foo -->
3710 ::{|
3711 |foo
3712 |bar
3713 |}<!-- bar -->
3714 this text
3715 should be left alone
3716 !! html/parsoid
3717 <!-- foo -->
3718 <dl><dd><dl><dd><table><tr>
3719 <td>foo</td>
3720 <td>bar</td>
3721 </tr></table><!-- bar --></dd></dl></dd></dl>
3722 <p>this text
3723 should be left alone</p>
3724 !! end
3725
3726 !! test
3727 Definition Lists: Hacky use to indent tables, with comment before table
3728 !! wikitext
3729 ::<!-- foo -->{|
3730 |foo
3731 |}
3732 !! html/parsoid
3733 <dl><dd><dl><dd><!-- foo --><table><tr>
3734 <td>foo</td>
3735 </tr></table></dd></dl></dd></dl>
3736 !! end
3737
3738 # The trailing whitespace in this test is to catch a regression in
3739 # Parsoid after T54473.
3740 !! test
3741 Definition Lists: Hacky use to indent tables (WS-insensitive)
3742 !! wikitext
3743 : {|
3744 |a
3745 |}
3746 !! html/php
3747 <dl><dd><table>
3748 <tr>
3749 <td>a
3750 </td></tr></table></dd></dl>
3751
3752 !! html/parsoid
3753 <dl><dd> <table>
3754 <tbody><tr><td>a</td></tr>
3755 </tbody></table> </dd></dl>
3756 !! end
3757
3758 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3759 ## as an empty dt item. It also ignores all but the last ";" when followed
3760 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3761 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3762 ## ";"s.
3763 ##
3764 ## Ex: ";;t2 ::d2" is transformed into:
3765 ##
3766 ## <dl>
3767 ## <dt>t2 </dt>
3768 ## <dd>
3769 ## <dl>
3770 ## <dt></dt>
3771 ## <dd>d2</dd>
3772 ## </dl>
3773 ## </dd>
3774 ## </dl>
3775 ##
3776 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3777 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3778 ##
3779 ## <dl>
3780 ## <dt>
3781 ## <dl>
3782 ## <dt>t2 </dt>
3783 ## <dd>:d2</dd>
3784 ## </dl>
3785 ## </dt>
3786 ## </dl>
3787 ##
3788 ## All Parsoid only definition list tests have this difference.
3789 ##
3790 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
3791 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3792
3793 !! test
3794 Table / list interaction: indented table with lists in table contents
3795 !! wikitext
3796 :{|
3797 |-
3798 | a
3799 * b
3800 |-
3801 | c
3802 * d
3803 |}
3804 !! html
3805 <dl><dd><table>
3806
3807 <tr>
3808 <td> a
3809 <ul><li> b</li></ul>
3810 </td></tr>
3811 <tr>
3812 <td> c
3813 <ul><li> d</li></ul>
3814 </td></tr></table></dd></dl>
3815
3816 !! end
3817
3818 !!test
3819 Table / list interaction: lists nested in tables nested in indented lists
3820 !! wikitext
3821 :{|
3822 |
3823 :a
3824 :b
3825 |
3826 *c
3827 *d
3828 |}
3829
3830 *e
3831 *f
3832 !! html
3833 <dl><dd><table>
3834 <tr>
3835 <td>
3836 <dl><dd>a</dd>
3837 <dd>b</dd></dl>
3838 </td>
3839 <td>
3840 <ul><li>c</li>
3841 <li>d</li></ul>
3842 </td></tr></table></dd></dl>
3843 <ul><li>e</li>
3844 <li>f</li></ul>
3845
3846 !!end
3847
3848 !! test
3849 Definition Lists: Nesting: Multi-level (Parsoid only)
3850 !! options
3851 parsoid
3852 !! wikitext
3853 ;t1 :d1
3854 ;;t2 ::d2
3855 ;;;t3 :::d3
3856 !! html
3857 <dl>
3858 <dt>t1 </dt>
3859 <dd>d1</dd>
3860 <dt>
3861 <dl>
3862 <dt>t2 </dt>
3863 <dd>:d2</dd>
3864 <dt>
3865 <dl>
3866 <dt>t3 </dt>
3867 <dd>::d3</dd>
3868 </dl>
3869 </dt>
3870 </dl>
3871 </dt>
3872 </dl>
3873
3874
3875 !! end
3876
3877
3878 !! test
3879 Definition Lists: Nesting: Test 2 (Parsoid only)
3880 !! options
3881 parsoid
3882 !! wikitext
3883 ;t1
3884 ::d2
3885 !! html
3886 <dl>
3887 <dt>t1</dt>
3888 <dd>
3889 <dl>
3890 <dd>d2</dd>
3891 </dl>
3892 </dd>
3893 </dl>
3894
3895 !! end
3896
3897
3898 !! test
3899 Definition Lists: Nesting: Test 3 (Parsoid only)
3900 !! options
3901 parsoid
3902 !! wikitext
3903 :;t1
3904 ::::d2
3905 !! html
3906 <dl>
3907 <dd>
3908 <dl>
3909 <dt>t1</dt>
3910 <dd>
3911 <dl>
3912 <dd>
3913 <dl>
3914 <dd>d2</dd>
3915 </dl>
3916 </dd>
3917 </dl>
3918 </dd>
3919 </dl>
3920 </dd>
3921 </dl>
3922
3923 !! end
3924
3925
3926 !! test
3927 Definition Lists: Nesting: Test 4
3928 !! wikitext
3929 ::;t3
3930 :::d3
3931 !! html
3932 <dl><dd><dl><dd><dl><dt>t3</dt>
3933 <dd>d3</dd></dl></dd></dl></dd></dl>
3934
3935 !! end
3936
3937
3938 ## The Parsoid team believes the following three test exposes a
3939 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
3940 ## wrong to close the <dl> after the <dt> containing the <ul>.)
3941 ## It also exposes a "misfeature" in tidy, which doesn't like
3942 ## <dl> tags with a single <dt> child; it converts the <dt> into
3943 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
3944 !! test
3945 Definition Lists: Mixed Lists: Test 1
3946 !! wikitext
3947 :;* foo
3948 ::* bar
3949 :; baz
3950 !! html/php
3951 <dl><dd><dl><dt><ul><li> foo</li>
3952 <li> bar</li></ul></dt></dl>
3953 <dl><dt> baz</dt></dl></dd></dl>
3954
3955 !! html/php+tidy
3956 <dl>
3957 <dd>
3958 <dl>
3959 <dd>
3960 <ul>
3961 <li>foo</li>
3962 <li>bar</li>
3963 </ul>
3964 </dd>
3965 </dl>
3966 <dl>
3967 <dt>baz</dt>
3968 </dl>
3969 </dd>
3970 </dl>
3971 !! html/parsoid
3972 <dl>
3973 <dd><dl>
3974 <dt><ul>
3975 <li> foo
3976 </li>
3977 </ul></dt>
3978 <dd><ul>
3979 <li> bar
3980 </li>
3981 </ul></dd>
3982 <dt> baz</dt>
3983 </dl></dd>
3984 </dl>
3985 !! end
3986
3987 !! test
3988 Definition Lists: Mixed Lists: Test 2
3989 !! wikitext
3990 *: d1
3991 *: d2
3992 !! html
3993 <ul><li><dl><dd> d1</dd>
3994 <dd> d2</dd></dl></li></ul>
3995
3996 !! end
3997
3998
3999 !! test
4000 Definition Lists: Mixed Lists: Test 3
4001 !! wikitext
4002 *::: d1
4003 *::: d2
4004 !! html
4005 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
4006 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
4007
4008 !! end
4009
4010
4011 !! test
4012 Definition Lists: Mixed Lists: Test 4
4013 !! wikitext
4014 *;d1 :d2
4015 *;d3 :d4
4016 !! html
4017 <ul><li><dl><dt>d1&#160;</dt>
4018 <dd>d2</dd>
4019 <dt>d3&#160;</dt>
4020 <dd>d4</dd></dl></li></ul>
4021
4022 !! end
4023
4024
4025 !! test
4026 Definition Lists: Mixed Lists: Test 5
4027 !! wikitext
4028 *:d1
4029 *:: d2
4030 !! html
4031 <ul><li><dl><dd>d1
4032 <dl><dd> d2</dd></dl></dd></dl></li></ul>
4033
4034 !! end
4035
4036
4037 !! test
4038 Definition Lists: Mixed Lists: Test 6
4039 !! wikitext
4040 #*:d1
4041 #*::: d3
4042 !! html
4043 <ol><li><ul><li><dl><dd>d1
4044 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4045
4046 !! end
4047
4048
4049 !! test
4050 Definition Lists: Mixed Lists: Test 7
4051 !! wikitext
4052 :* d1
4053 :* d2
4054 !! html
4055 <dl><dd><ul><li> d1</li>
4056 <li> d2</li></ul></dd></dl>
4057
4058 !! end
4059
4060
4061 !! test
4062 Definition Lists: Mixed Lists: Test 8
4063 !! wikitext
4064 :* d1
4065 ::* d2
4066 !! html
4067 <dl><dd><ul><li> d1</li></ul>
4068 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
4069
4070 !! end
4071
4072
4073 !! test
4074 Definition Lists: Mixed Lists: Test 9
4075 !! wikitext
4076 *;foo :bar
4077 !! html
4078 <ul><li><dl><dt>foo&#160;</dt>
4079 <dd>bar</dd></dl></li></ul>
4080
4081 !! end
4082
4083
4084 !! test
4085 Definition Lists: Mixed Lists: Test 10
4086 !! wikitext
4087 *#;foo :bar
4088 !! html
4089 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4090 <dd>bar</dd></dl></li></ol></li></ul>
4091
4092 !! end
4093
4094 # The Parsoid team disagrees with the PHP parser's seemingly-random
4095 # rules regarding dd/dt on the next two tests. Parsoid is more
4096 # consistent, and recognizes the shared nesting and keeps the
4097 # still-open tags around until the nesting is complete.
4098 # (And tidy again converts <dt> to <dd> before 'bar'.)
4099
4100 !! test
4101 Definition Lists: Mixed Lists: Test 11
4102 !! wikitext
4103 *#*#;*;;foo :bar
4104 *#*#;boo :baz
4105 !! html/php
4106 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4107 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4108 <dl><dt>boo&#160;</dt>
4109 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4110
4111 !! html/php+tidy
4112 <ul>
4113 <li>
4114 <ol>
4115 <li>
4116 <ul>
4117 <li>
4118 <ol>
4119 <li>
4120 <dl>
4121 <dt>foo&#160;</dt>
4122 <dd>
4123 <ul>
4124 <li>
4125 <dl>
4126 <dd>
4127 <dl>
4128 <dt>bar</dt>
4129 </dl>
4130 </dd>
4131 </dl>
4132 </li>
4133 </ul>
4134 </dd>
4135 </dl>
4136 <dl>
4137 <dt>boo&#160;</dt>
4138 <dd>baz</dd>
4139 </dl>
4140 </li>
4141 </ol>
4142 </li>
4143 </ul>
4144 </li>
4145 </ol>
4146 </li>
4147 </ul>
4148 !! html/parsoid
4149 <ul>
4150 <li>
4151 <ol>
4152 <li>
4153 <ul>
4154 <li>
4155 <ol>
4156 <li>
4157 <dl>
4158 <dt>
4159 <ul>
4160 <li>
4161 <dl>
4162 <dt>
4163 <dl>
4164 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4165 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4166 </dl></dt>
4167 </dl></li>
4168 </ul></dt>
4169 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4170 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4171 </dl></li>
4172 </ol></li>
4173 </ul></li>
4174 </ol></li>
4175 </ul>
4176 !! end
4177
4178
4179 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
4180 # From whitelist:
4181 # * The test is wrong, there are two colons where there should be :;
4182 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4183 !! test
4184 Definition Lists: Weird Ones: Test 1
4185 !! wikitext
4186 *#;*::;; foo : bar (who uses this?)
4187 !! html/php
4188 <ul><li><ol><li><dl><dt> foo&#160;</dt>
4189 <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>
4190
4191 !! html/php+tidy
4192 <ul>
4193 <li>
4194 <ol>
4195 <li>
4196 <dl>
4197 <dt>foo&#160;</dt>
4198 <dd>
4199 <ul>
4200 <li>
4201 <dl>
4202 <dd>
4203 <dl>
4204 <dd>
4205 <dl>
4206 <dd>
4207 <dl>
4208 <dt>bar (who uses this?)</dt>
4209 </dl>
4210 </dd>
4211 </dl>
4212 </dd>
4213 </dl>
4214 </dd>
4215 </dl>
4216 </li>
4217 </ul>
4218 </dd>
4219 </dl>
4220 </li>
4221 </ol>
4222 </li>
4223 </ul>
4224 !! html/parsoid
4225 <ul>
4226 <li>
4227 <ol>
4228 <li>
4229 <dl>
4230 <dt>
4231 <ul>
4232 <li>
4233 <dl>
4234 <dd>
4235 <dl>
4236 <dd>
4237 <dl>
4238 <dt>
4239 <dl>
4240 <dt> foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span></dt>
4241 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
4242 </dl></dt>
4243 </dl></dd>
4244 </dl></dd>
4245 </dl></li>
4246 </ul></dt>
4247 </dl></li>
4248 </ol></li>
4249 </ul>
4250 !! end
4251
4252 !! test
4253 Definition Lists: colons occurring in tags
4254 !! wikitext
4255 ;a:b
4256 ;'''a:b'''
4257 ;<i>a:b</i>
4258 ;<span>a:b</span>
4259 ;<div>a:b</div>
4260 ;<div>a
4261 :b</div>
4262 ;{{echo|a:b}}
4263 ;{{echo|''a:b''}}
4264 ;;;''a:b''
4265 !! html+tidy
4266 <dl>
4267 <dt>a</dt>
4268 <dd>b</dd>
4269 <dt><b>a:b</b></dt>
4270 <dt><i>a:b</i></dt>
4271 <dt><span>a:b</span></dt>
4272 <dd>
4273 <div>a:b</div>
4274 </dd>
4275 <dd>
4276 <div>a
4277 <dl>
4278 <dd>b</dd>
4279 </dl>
4280 </div>
4281 </dd>
4282 <dt>a</dt>
4283 <dd>b</dd>
4284 <dt><i>a:b</i></dt>
4285 </dl>
4286 <dl>
4287 <dd>
4288 <dl>
4289 <dd>
4290 <dl>
4291 <dt><i>a:b</i></dt>
4292 </dl>
4293 </dd>
4294 </dl>
4295 </dd>
4296 </dl>
4297 !! html/parsoid
4298 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4299 <dt><b>a:b</b></dt>
4300 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4301 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4302 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4303 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4304 <dd>b</dd>
4305 <dt><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a:b"}},"i":0}}]}'>a:b</span></dt>
4306 <dt><i about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&#39;&#39;a:b&#39;&#39;"}},"i":0}}]}'>a:b</i>
4307 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4308 !! end
4309
4310 !! test
4311 Definition Lists: colons and tables 1
4312 !! wikitext
4313 :{|
4314 | x
4315 |}
4316 :{|
4317 | y
4318 |}
4319 !! html
4320 <dl><dd><table>
4321 <tr>
4322 <td> x
4323 </td></tr></table></dd></dl>
4324 <dl><dd><table>
4325 <tr>
4326 <td> y
4327 </td></tr></table></dd></dl>
4328
4329 !! end
4330
4331 # Parsoid's output (as documented below) differs from php's in this case.
4332 # This is probably a bug. If we fixup parsoid to match php's output, the
4333 # above test should pass and the below test case can be removed. It is
4334 # unclear which output is more desirable.
4335
4336 !! test
4337 Definition Lists: colons and tables 2
4338 !! wikitext
4339 :{|
4340 | x
4341 |}
4342 :{|
4343 | y
4344 |}
4345 !! html/parsoid
4346 <dl><dd><table>
4347 <tr>
4348 <td> x
4349 </td></tr></table></dd>
4350 <dd><table>
4351 <tr>
4352 <td> y
4353 </td></tr></table></dd></dl>
4354 !! end
4355
4356 !! test
4357 Definition Lists: template interaction
4358 !! wikitext
4359 ::{{definition_list}}
4360
4361 :one
4362 ::{{definition_list}}
4363 :::two
4364 :::three
4365 ::four
4366 !! html/parsoid
4367 <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">
4368 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4369
4370 <dl><dd data-parsoid='{}'>one
4371 <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">
4372 </span><dd about="#mwt2">two
4373 <dl><dd>two</dd>
4374 <dd>three</dd></dl></dd>
4375 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4376 !! end
4377
4378
4379 ###
4380 ### External links
4381 ###
4382 !! test
4383 External links: non-bracketed
4384 !! wikitext
4385 Non-bracketed: http://example.com
4386 !! html
4387 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4388 </p>
4389 !! end
4390
4391 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4392 !! test
4393 External links: numbered
4394 !! wikitext
4395 Numbered: [http://example.com]
4396 Numbered: [http://example.net]
4397 Numbered: [http://example.com]
4398 !! html/php
4399 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4400 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4401 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4402 </p>
4403 !! html/parsoid
4404 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
4405 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
4406 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
4407 !!end
4408
4409 !! test
4410 External links: specified text
4411 !! wikitext
4412 Specified text: [http://example.com link]
4413 !! html
4414 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4415 </p>
4416 !!end
4417
4418 !! test
4419 External links: trail
4420 !! wikitext
4421 Linktrails should not work for external links: [http://example.com link]s
4422 !! html
4423 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4424 </p>
4425 !! end
4426
4427 !! test
4428 External links: dollar sign in URL
4429 !! wikitext
4430 http://example.com/1$2345
4431 !! html
4432 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4433 </p>
4434 !! end
4435
4436 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4437 !! test
4438 External links: dollar sign in URL (autonumber)
4439 !! wikitext
4440 [http://example.com/1$2345]
4441 !! html/php
4442 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4443 </p>
4444 !! html/parsoid
4445 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4446 !!end
4447
4448 !! test
4449 External links: open square bracket forbidden in URL (bug 4377)
4450 !! options
4451 parsoid=wt2html,wt2wt,html2html
4452 !! wikitext
4453 http://example.com/1[2345
4454 !! html/php
4455 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4456 </p>
4457 !! html/parsoid
4458 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4459 !! end
4460
4461 !! test
4462 External links: open square bracket forbidden in URL (named) (bug 4377)
4463 !! options
4464 parsoid=wt2html,html2html
4465 !! wikitext
4466 [http://example.com/1[2345]
4467 !! html/php
4468 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4469 </p>
4470 !! html/parsoid
4471 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4472 !!end
4473
4474 # parsoid adds a space before the link name
4475 !! test
4476 External links: open square bracket forbidden in URL (named) (bug 4377)
4477 Parsoid variant.
4478 !! wikitext
4479 [http://example.com/1 [2345]
4480 !! html
4481 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4482 </p>
4483 !!end
4484
4485 !! test
4486 External links: nowiki in URL link text (bug 6230)
4487 !! wikitext
4488 [http://example.com/ <nowiki>''example site''</nowiki>]
4489 !! html
4490 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4491 </p>
4492 !! end
4493
4494 !! test
4495 External links: newline forbidden in text (bug 6230 regression check)
4496 !! wikitext
4497 [http://example.com/ first
4498 second]
4499 !! html
4500 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4501 second]
4502 </p>
4503 !!end
4504
4505 !! test
4506 External links: Pipe char between url and text
4507 !! wikitext
4508 [http://example.com | link]
4509 !! html
4510 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4511 </p>
4512 !!end
4513
4514 !! test
4515 External links: protocol-relative URL in brackets
4516 !! wikitext
4517 [//example.com/ Test]
4518 !! html
4519 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4520 </p>
4521 !! end
4522
4523 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4524 !! test
4525 External links: protocol-relative URL in brackets without text
4526 !! wikitext
4527 [//example.com]
4528 !! html/php
4529 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4530 </p>
4531 !! html/parsoid
4532 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4533 !! end
4534
4535 !! test
4536 External links: protocol-relative URL in free text is left alone
4537 !! wikitext
4538 //example.com/Foo
4539 !! html
4540 <p>//example.com/Foo
4541 </p>
4542 !!end
4543
4544 !! test
4545 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
4546 !! wikitext
4547 foo//example.com/Foo
4548 !! html
4549 <p>foo//example.com/Foo
4550 </p>
4551 !! end
4552
4553 !! test
4554 External links: with no contents
4555 !! wikitext
4556 [http://en.wikipedia.org/wiki/Foo]
4557
4558 [[wikipedia:Foo|Bar]]
4559
4560 [[wikipedia:Foo|<span>Bar</span>]]
4561 !! html/php
4562 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4563 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4564 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4565 </p>
4566 !! html/parsoid
4567 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4568 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4569 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4570 !! end
4571
4572 !! test
4573 External links: Free with trailing punctuation
4574 !! wikitext
4575 http://example.com,
4576 http://example.com;
4577 http://example.com\
4578 http://example.com.
4579 http://example.com:
4580 http://example.com!
4581 http://example.com?
4582 http://example.com)
4583 http://example.com/url_with_(brackets)
4584 (http://example.com/url_without_brackets)
4585 http://example.com/url_with_entity&nbsp;
4586 http://example.com/url_with_entity&#xA0;
4587 http://example.com/url_with_entity&#160;
4588 http://example.com/url_with_entity&lt;
4589 http://example.com/url_with_entity&#x3C;
4590 http://example.com/url_with_entity&#60;
4591 !! html/php
4592 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4593 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4594 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4595 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4596 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4597 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4598 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4599 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4600 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4601 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4602 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4603 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4604 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4605 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4606 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity%3C">http://example.com/url_with_entity%3C</a>
4607 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity%3C">http://example.com/url_with_entity%3C</a>
4608 </p>
4609 !! html/parsoid
4610 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>,
4611 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>;
4612 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>\
4613 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>.
4614 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:
4615 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>!
4616 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>?
4617 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)
4618 <a rel="mw:ExtLink" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4619 (<a rel="mw:ExtLink" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4620 <a rel="mw:ExtLink" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4621 <a rel="mw:ExtLink" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4622 <a rel="mw:ExtLink" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4623 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity">&lt;</span>
4624 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&lt;">http://example.com/url_with_entity&lt;</a>
4625 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&lt;">http://example.com/url_with_entity&lt;</a></p>
4626 !! end
4627
4628 !! test
4629 External links: No preceding word characters allowed (bug 65278)
4630 !! wikitext
4631 NOPEhttp://example.com
4632 N0http://example.com
4633 ok:http://example.com
4634 ok-http://example.com
4635 !! html
4636 <p>NOPEhttp://example.com
4637 N0http://example.com
4638 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4639 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4640 </p>
4641 !! end
4642
4643 !! test
4644 External image
4645 !! wikitext
4646 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4647 !! html
4648 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4649 </p>
4650 !! end
4651
4652 !! test
4653 External image from https
4654 !! wikitext
4655 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4656 !! html
4657 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4658 </p>
4659 !! end
4660
4661 !! test
4662 External image (when not allowed)
4663 !! options
4664 wgAllowExternalImages=0
4665 !! wikitext
4666 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4667 !! html
4668 <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>
4669 </p>
4670 !! end
4671
4672 !! test
4673 Link to non-http image, no img tag
4674 !! wikitext
4675 Link to non-http image, no img tag: ftp://example.com/test.jpg
4676 !! html
4677 <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>
4678 </p>
4679 !! end
4680
4681 !! test
4682 External links: terminating separator
4683 !! wikitext
4684 Terminating separator: http://example.com/thing,
4685 !! html
4686 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4687 </p>
4688 !! end
4689
4690 !! test
4691 External links: intervening separator
4692 !! wikitext
4693 Intervening separator: http://example.com/1,2,3
4694 !! html
4695 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4696 </p>
4697 !! end
4698
4699 !! test
4700 External links: old bug with URL in query
4701 !! wikitext
4702 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4703 !! html
4704 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4705 </p>
4706 !! end
4707
4708 !! test
4709 External links: old URL-in-URL bug, mixed protocols
4710 !! wikitext
4711 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4712 !! html
4713 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4714 </p>
4715 !!end
4716
4717 !! test
4718 External links: URL in text
4719 !! wikitext
4720 URL in text: [http://example.com http://example.com]
4721 !! html
4722 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4723 </p>
4724 !! end
4725
4726 !! test
4727 External links: Clickable images
4728 !! wikitext
4729 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4730 !! html/php
4731 <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>
4732 </p>
4733 !! html/parsoid
4734 <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>
4735 !! end
4736
4737 !! test
4738 External links: raw ampersand
4739 !! wikitext
4740 Old &amp; use: http://x&y
4741 !! html
4742 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4743 </p>
4744 !! end
4745
4746 !! test
4747 External links: encoded ampersand
4748 !! wikitext
4749 Old &amp; use: http://x&amp;y
4750 !! html/php
4751 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4752 </p>
4753 !! html/parsoid
4754 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4755 !! end
4756
4757 !! test
4758 External links: encoded equals (bug 6102)
4759 !! wikitext
4760 http://example.com/?foo&#61;bar
4761 !! html/php
4762 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4763 </p>
4764 !! html/parsoid
4765 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4766 !! end
4767
4768 ##
4769 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4770 ## does it number them. As discussed in bug 53505, we can identify
4771 ## autonumbered links via CSS.
4772 ##
4773
4774 !! test
4775 External links: [raw ampersand]
4776 !! wikitext
4777 Old &amp; use: [http://x&y]
4778 !! html/php
4779 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4780 </p>
4781 !! html/parsoid
4782 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4783 !! end
4784
4785 # note that parsoid html is identical to [raw ampersand] case; so html2wt
4786 # mode will return the [raw ampersand] wikitext
4787 !! test
4788 External links: [encoded ampersand]
4789 !! options
4790 parsoid=wt2html,wt2wt,html2html
4791 !! wikitext
4792 Old &amp; use: [http://x&amp;y]
4793 !! html/php
4794 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4795 </p>
4796 !! html/parsoid
4797 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4798 !! end
4799
4800 !! test
4801 External links: [raw equals]
4802 !! wikitext
4803 [http://example.com/?foo=bar]
4804 !! html/php
4805 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4806 </p>
4807 !! html/parsoid
4808 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4809 !! end
4810
4811 # note that parsoid html is identical to [raw equals] case; so html2wt
4812 # mode will return the [raw equals] wikitext
4813 !! test
4814 External links: [encoded equals] (bug 6102)
4815 !! options
4816 parsoid=wt2html,wt2wt,html2html
4817 !! wikitext
4818 [http://example.com/?foo&#61;bar]
4819 !! html/php
4820 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4821 </p>
4822 !! html/parsoid
4823 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4824 !! end
4825
4826 # xxx parsoid strips the IDN character, so the round-trip tests will
4827 # obviously fail and are disabled. --cscott
4828 !! test
4829 External links: [IDN ignored character reference in hostname; strip it right off]
4830 !! options
4831 parsoid=wt2html,wt2wt,html2html
4832 !! wikitext
4833 [http://e&zwnj;xample.com/]
4834 !! html/php
4835 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
4836 </p>
4837 !! html/parsoid
4838 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
4839 !! end
4840
4841 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
4842 # Where an external link could easily circumvent the sanitization of the text of
4843 # a link like this (where an IDN-ignore character is in the URL somewhere), this
4844 # test demands a higher standard. That's a bit strange.
4845 #
4846 # Example:
4847 #
4848 # http://e‌xample.com -> [http://example.com|http://example.com]
4849 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
4850 #
4851 # The first example is sanitized, but the second is not. Any security benefits
4852 # from this production are trivial to circumvent. Either remove this test and
4853 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
4854 # the test accordingly.
4855 #
4856 # All our love,
4857 # The Parsoid team.
4858 # xxx parsoid strips the IDN character, so the round-trip tests will
4859 # obviously fail and are disabled. --cscott
4860 !! test
4861 External links: IDN ignored character reference in hostname; strip it right off
4862 !! options
4863 parsoid=wt2html,html2html
4864 !! wikitext
4865 http://e&zwnj;xample.com/
4866 !! html/php
4867 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
4868 </p>
4869 !! html/parsoid
4870 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
4871 !! end
4872
4873 !! test
4874 External links: www.jpeg.org (bug 554)
4875 !! wikitext
4876 http://www.jpeg.org
4877 !! html
4878 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
4879 </p>
4880 !! end
4881
4882 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4883 !! test
4884 External links: URL within URL (original bug 2)
4885 !! wikitext
4886 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
4887 !! html/php
4888 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
4889 </p>
4890 !! html/parsoid
4891 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
4892 !! end
4893
4894 !! test
4895 BUG 361: URL inside bracketed URL
4896 !! wikitext
4897 [http://www.example.com/foo http://www.example.com/bar]
4898 !! html
4899 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
4900 </p>
4901 !! end
4902
4903 !! test
4904 BUG 361: URL within URL, not bracketed
4905 !! wikitext
4906 http://www.example.com/foo?=http://www.example.com/bar
4907 !! html
4908 <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>
4909 </p>
4910 !! end
4911
4912 !! test
4913 BUG 289: ">"-token in URL-tail
4914 !! wikitext
4915 http://www.example.com/<hello>
4916 !! html
4917 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
4918 </p>
4919 !!end
4920
4921 !! test
4922 BUG 289: literal ">"-token in URL-tail
4923 !! wikitext
4924 http://www.example.com/<b>html</b>
4925 !! html/php
4926 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
4927 </p>
4928 !! html/parsoid
4929 <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>
4930 !! end
4931
4932 !! test
4933 BUG 289: ">"-token in bracketed URL
4934 !! wikitext
4935 [http://www.example.com/<hello> stuff]
4936 !! html
4937 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
4938 </p>
4939 !!end
4940
4941 !! test
4942 BUG 289: literal ">"-token in bracketed URL
4943 !! wikitext
4944 [http://www.example.com/<b>html</b> stuff]
4945 !! html
4946 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
4947 </p>
4948 !!end
4949
4950 !! test
4951 BUG 289: literal double quote at end of URL
4952 !! wikitext
4953 http://www.example.com/"hello"
4954 !! html
4955 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
4956 </p>
4957 !!end
4958
4959 !! test
4960 BUG 289: literal double quote in bracketed URL
4961 !! wikitext
4962 [http://www.example.com/"hello" stuff]
4963 !! html
4964 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
4965 </p>
4966 !!end
4967
4968 !! test
4969 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
4970 !! wikitext
4971 [http://www.example.com test]
4972 !! html
4973 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
4974 </p>
4975 !! end
4976
4977 !! test
4978 External links: link text with spaces
4979 !! wikitext
4980 [http://www.example.com a b c]
4981 [http://www.example.com ''a'' ''b'']
4982 !! html
4983 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
4984 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
4985 </p>
4986 !! end
4987
4988 !! test
4989 External links: wiki links within external link (Bug 3695)
4990 !! wikitext
4991 [http://example.com [[wikilink]] embedded in ext link]
4992 !! html/php
4993 <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>
4994 </p>
4995 !! html/parsoid
4996 <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>
4997 !! end
4998
4999 !! test
5000 BUG 787: Links with one slash after the url protocol are invalid
5001 !! wikitext
5002 http:/example.com
5003
5004 [http:/example.com title]
5005 !! html
5006 <p>http:/example.com
5007 </p><p>[http:/example.com title]
5008 </p>
5009 !! end
5010
5011 !! test
5012 Bracketed external links with template-generated invalid target
5013 !! wikitext
5014 [{{echo|http:/example.com}} title]
5015 !! html
5016 <p>[http:/example.com title]
5017 </p>
5018 !! end
5019
5020 !! test
5021 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
5022 !! wikitext
5023 ''[http://example.com text'']
5024 [http://example.com '''text]'''
5025 ''Something [http://example.com in italic'']
5026 ''Something [http://example.com mixed''''', even bold]'''
5027 '''''Now [http://example.com both''''']
5028 !! html
5029 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5030 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5031 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5032 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5033 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5034 </p>
5035 !! end
5036
5037
5038 !! test
5039 Bug 4781: %26 in URL
5040 !! wikitext
5041 http://www.example.com/?title=AT%26T
5042 !! html/php
5043 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5044 </p>
5045 !! html/parsoid
5046 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
5047 !! end
5048
5049 # According to http://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5050 # % is actually legal in HTML5. Any change in output would need testing though.
5051 !! test
5052 Bug 4781, 5267: %25 in URL
5053 !! wikitext
5054 http://www.example.com/?title=100%25_Bran
5055 !! html/php
5056 <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>
5057 </p>
5058 !! html/parsoid
5059 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
5060 !! end
5061
5062 !! test
5063 Bug 4781, 5267: %28, %29 in URL
5064 !! wikitext
5065 http://www.example.com/?title=Ben-Hur_%281959_film%29
5066 !! html/php
5067 <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>
5068 </p>
5069 !! html/parsoid
5070 <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>
5071 !! end
5072
5073
5074 !! test
5075 Bug 4781: %26 in autonumber URL
5076 !! wikitext
5077 [http://www.example.com/?title=AT%26T]
5078 !! html/php
5079 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5080 </p>
5081 !! html/parsoid
5082 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
5083 !! end
5084
5085 !! test
5086 Bug 4781, 5267: %26 in autonumber URL
5087 !! wikitext
5088 [http://www.example.com/?title=100%25_Bran]
5089 !! html/php
5090 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5091 </p>
5092 !! html/parsoid
5093 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
5094 !! end
5095
5096 !! test
5097 Bug 4781, 5267: %28, %29 in autonumber URL
5098 !! wikitext
5099 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5100 !! html/php
5101 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5102 </p>
5103 !! html/parsoid
5104 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5105 !! end
5106
5107
5108 !! test
5109 Bug 4781: %26 in bracketed URL
5110 !! wikitext
5111 [http://www.example.com/?title=AT%26T link]
5112 !! html/php
5113 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5114 </p>
5115 !! html/parsoid
5116 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
5117 !! end
5118
5119 !! test
5120 Bug 4781, 5267: %25 in bracketed URL
5121 !! wikitext
5122 [http://www.example.com/?title=100%25_Bran link]
5123 !! html
5124 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5125 </p>
5126 !! end
5127
5128 !! test
5129 Bug 4781, 5267: %28, %29 in bracketed URL
5130 !! wikitext
5131 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5132 !! html/php
5133 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5134 </p>
5135 !! html/parsoid
5136 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5137 !! end
5138
5139 !! test
5140 External link containing a period in the anchor. (bug 63947)
5141 !! wikitext
5142 [//foo.org/bar#baz. bang]
5143
5144 [//foo.org/bar. bang]
5145 !! html/php
5146 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5147 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5148 </p>
5149 !! html/parsoid
5150 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
5151 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
5152 !! end
5153
5154 !! test
5155 External link containing a single quote. (bug 63947)
5156 !! wikitext
5157 [//foo.org/bar'baz]
5158
5159 [//foo.org/bar'baz bang]
5160 !! html/php
5161 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
5162 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
5163 </p>
5164 !! html/parsoid
5165 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
5166 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
5167 !! end
5168
5169
5170 !! test
5171 External link containing a period in the anchor. (bug 63947)
5172 !! wikitext
5173 [//foo.org/bar#baz. bang]
5174
5175 [//foo.org/bar. bang]
5176 !! html/php
5177 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5178 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5179 </p>
5180 !! html/parsoid
5181 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
5182 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
5183 !! end
5184
5185 !! test
5186 External link containing a single quote. (bug 63947)
5187 !! wikitext
5188 [//foo.org/bar'baz]
5189
5190 [//foo.org/bar'baz bang]
5191 !! html/php
5192 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
5193 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
5194 </p>
5195 !! html/parsoid
5196 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
5197 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
5198 !! end
5199
5200
5201 !! test
5202 External link containing double-single-quotes in text '' (bug 4598 sanity check)
5203 !! wikitext
5204 Some [http://example.com/ pretty ''italics'' and stuff]!
5205 !! html
5206 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5207 </p>
5208 !! end
5209
5210 !! test
5211 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
5212 !! wikitext
5213 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5214 !! html
5215 <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>
5216 </p>
5217 !! end
5218
5219 !! test
5220 External link containing double-single-quotes with no space separating the url from text in italics
5221 !! wikitext
5222 [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]].]
5223 !! html/php
5224 <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>
5225 </p>
5226 !! html/php+tidy
5227 <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>
5228 !! html/parsoid
5229 <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>
5230 !! end
5231
5232 !! test
5233 External link with comments in link text
5234 !! wikitext
5235 [http://www.google.com Google <!-- comment -->]
5236 !! html
5237 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5238 </p>
5239 !! end
5240
5241 !! test
5242 URL-encoding in URL functions (single parameter)
5243 !! wikitext
5244 {{localurl:Some page|amp=&}}
5245 !! html
5246 <p>/index.php?title=Some_page&amp;amp=&amp;
5247 </p>
5248 !! end
5249
5250 !! test
5251 URL-encoding in URL functions (multiple parameters)
5252 !! wikitext
5253 {{localurl:Some page|q=?&amp=&}}
5254 !! html
5255 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5256 </p>
5257 !! end
5258
5259 !! test
5260 Brackets in urls
5261 !! wikitext
5262 http://example.com/index.php?foozoid%5B%5D=bar
5263
5264 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5265 !! html/php
5266 <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>
5267 </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>
5268 </p>
5269 !! html/parsoid
5270 <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>
5271
5272 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
5273 !! end
5274
5275 !! test
5276 IPv6 urls (bug 21261)
5277 !! options
5278 disabled
5279 !! wikitext
5280 http://[2404:130:0:1000::187:2]/index.php
5281 !! html
5282 <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>
5283 </p>
5284 !! end
5285
5286 !! test
5287 Non-extlinks in brackets
5288 !! wikitext
5289 [foo]
5290 [foo bar]
5291 [foo ''bar'']
5292 [fool's] errand
5293 [fool's errand]
5294 [{{echo|foo}}]
5295 [{{echo|foo}} bar]
5296 [{{echo|foo}} ''bar'']
5297 [{{echo|foo}}l's] errand
5298 [{{echo|foo}}l's errand]
5299 [url={{echo|foo}}]
5300 [url=http://example.com]
5301 !! html
5302 <p>[foo]
5303 [foo bar]
5304 [foo <i>bar</i>]
5305 [fool's] errand
5306 [fool's errand]
5307 [foo]
5308 [foo bar]
5309 [foo <i>bar</i>]
5310 [fool's] errand
5311 [fool's errand]
5312 [url=foo]
5313 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5314 </p>
5315 !! end
5316
5317 !! test
5318 Percent encoding in external links
5319 !! wikitext
5320 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
5321 !! html/php
5322 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
5323 </p>
5324 !! html/parsoid
5325 <p><a rel="mw:ExtLink"
5326 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
5327 !! end
5328
5329 !! test
5330 Use url link syntax for links where the content is equal the link target
5331 !! wikitext
5332 http://example.com
5333 !! html/php
5334 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5335 </p>
5336 !! html/parsoid
5337 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5338 !! end
5339
5340 !! test
5341 Parenthesis in external links, especially URL links
5342 !! wikitext
5343 http://example.com)
5344
5345 http://example.com/test)
5346
5347 http://example.com/(test)
5348
5349 http://example.com/((test)
5350
5351 (http://example.com/(test))
5352
5353 (http://example.com/(test)))))
5354
5355 http://example.com/a)b
5356
5357 [http://example.com) foo]
5358 !! html/php
5359 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5360 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
5361 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
5362 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
5363 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
5364 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
5365 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
5366 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5367 </p>
5368 !! html/parsoid
5369 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
5370 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
5371 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
5372 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
5373 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
5374 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
5375 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
5376 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
5377 !! end
5378
5379 !! test
5380 Parenthesis in external links, w/ transclusion or comment
5381 !! wikitext
5382 (http://example.com/{{echo|hi}})
5383
5384 (http://example.com<!-- hi -->)
5385 !! html/php
5386 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5387 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5388 </p>
5389 !! html/parsoid
5390 <p>(<a typeof="mw:ExpandedAttrs" about="#mwt2" rel="mw:ExtLink" href="http://example.com/hi" data-parsoid='{"stx":"url","a":{"href":"http://example.com/hi"},"sa":{"href":"http://example.com/{{echo|hi}}"}}' data-mw='{"attribs":[[{"txt":"href"},{"html":"http://example.com/&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[20,31,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;hi&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">hi&lt;/span>"}]]}'>http://example.com/hi</a>)</p>
5391
5392 <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>
5393 !! end
5394
5395 !! test
5396 Serialize <a> tags with invalid link targets as plain text
5397 !! options
5398 parsoid=html2wt
5399 !! html
5400 <a rel="mw:WikiLink" href="[[foo]]">text</a>
5401 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
5402 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
5403 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
5404 !! wikitext
5405 text
5406 <nowiki>*</nowiki>text
5407 <nowiki>[[foo]]</nowiki>
5408 <nowiki>*a [[foo]]</nowiki>
5409 !! end
5410
5411 !! test
5412 mw:ExtLink -vs- mw:WikiLink (T94723)
5413 !! options
5414 parsoid=html2wt
5415 !! html/parsoid
5416 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"},"dsr":[0,11,6,2]}'>Bar</a>
5417 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
5418 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5419 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5420 <p>
5421 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5422 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5423 </p>
5424 !! wikitext
5425 [[Foo|Bar]]
5426 [[Foo|Bar]]
5427 [[wikipedia:Foo|Bar]]
5428 [[wikipedia:Foo|Bar]]
5429
5430 [[wikipedia:European_Robin|European Robin]]
5431 [[wikipedia:European_Robin|European Robin]]
5432 !! end
5433
5434 !! test
5435 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
5436 !! options
5437 parsoid=wt2wt
5438 !! wikitext
5439 [http://en.wikipedia.org/wiki/European_Robin European Robin]
5440 !! html/parsoid
5441 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
5442 !! end
5443
5444
5445 ###
5446 ### Quotes
5447 ###
5448
5449 !! test
5450 Quotes
5451 !! wikitext
5452 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5453
5454 Normal text. '''''Bold italic text.''''' Normal text.
5455 !! html
5456 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5457 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5458 </p>
5459 !! end
5460
5461
5462 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5463 # parser strips. The wikitext contains just the first half of the bold
5464 # quote pair.
5465 !! test
5466 Unclosed and unmatched quotes
5467 !! wikitext
5468 '''''Bold italic text '''with bold deactivated''' in between.'''''
5469
5470 '''''Bold italic text ''with italic deactivated'' in between.'''''
5471
5472 '''Bold text..
5473
5474 ..spanning two paragraphs (should not work).'''
5475
5476 '''Bold tag left open
5477
5478 ''Italic tag left open
5479
5480 Normal text.
5481
5482 <!-- Unmatching number of opening, closing tags: -->
5483 '''This year''''s election ''should'' beat '''last year''''s.
5484
5485 ''Tom'''s car is bigger than ''Susan'''s.
5486
5487 Plain ''italic'''s plain
5488 !! html/php
5489 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5490 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5491 </p><p><b>Bold text..</b>
5492 </p><p>..spanning two paragraphs (should not work).
5493 </p><p><b>Bold tag left open</b>
5494 </p><p><i>Italic tag left open</i>
5495 </p><p>Normal text.
5496 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5497 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5498 </p><p>Plain <i>italic'</i>s plain
5499 </p>
5500 !! html/parsoid
5501 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5502 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5503 </p><p><b>Bold text..</b>
5504 </p><p>..spanning two paragraphs (should not work).<b></b>
5505 </p><p><b>Bold tag left open</b>
5506 </p><p><i>Italic tag left open</i>
5507 </p><p>Normal text.
5508 </p>
5509 <!-- Unmatching number of opening, closing tags: -->
5510 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5511 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5512 </p><p>Plain <i>italic'</i>s plain
5513 </p>
5514 !! end
5515
5516 ###
5517 ### Tables
5518 ###
5519 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5520 ###
5521
5522 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5523 # is the bare minimum required by the spec, see:
5524 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5525 # Parsoid team replies: empty table tags are legal in HTML5
5526 !! test
5527 A table with no data.
5528 !! options
5529 parsoid=wt2html
5530 !! wikitext
5531 {||}
5532 !! html/php
5533
5534 !! html/parsoid
5535 <table></table>
5536
5537 !! end
5538
5539 !! test
5540 A table with stray table end tags on start tag line (wt2html)
5541 !! options
5542 parsoid=wt2html
5543 !! wikitext
5544 {|style="color: red;"|}
5545
5546 {|style="color: red;" |}
5547 |foo
5548 |}
5549
5550 {|style="color: red;"|} id="foo"
5551 |foo
5552 |}
5553
5554 {|style="color: red;" |} id="foo"
5555 |foo
5556 |}
5557 !! html
5558 <table style="color: red;"></table>
5559
5560 <table style="color: red;">
5561 <tbody><tr>
5562 <td>foo</td>
5563 </tr></tbody>
5564 </table>
5565
5566 <table style="color: red;" id="foo">
5567 <tbody><tr>
5568 <td>foo</td>
5569 </tr></tbody>
5570 </table>
5571
5572 <table style="color: red;" id="foo">
5573 <tbody><tr>
5574 <td>foo</td>
5575 </tr></tbody>
5576 </table>
5577
5578 !! end
5579
5580 !! test
5581 A table with no data (take 2)
5582 !! wikitext
5583 {|
5584 |}
5585 !! html/parsoid
5586 <table></table>
5587 !! end
5588
5589 # A table with nothing but a caption is invalid XHTML, we might want to render
5590 # this as <p>caption</p>
5591 # Parsoid team replies: table with only a caption is legal in HTML5
5592 !! test
5593 A table with nothing but a caption
5594 !! wikitext
5595 {|
5596 |+ caption
5597 |}
5598 !! html/php
5599 <table>
5600 <caption> caption
5601 </caption><tr><td></td></tr></table>
5602
5603 !! html/parsoid
5604 <table><caption> caption</caption></table>
5605 !! end
5606
5607 !! test
5608 A table with caption with default-spaced attributes and a table row
5609 !! wikitext
5610 {|
5611 |+ style="color: red;" | caption1
5612 |-
5613 | foo
5614 |}
5615 !! html
5616 <table>
5617 <caption style="color: red;"> caption1
5618 </caption>
5619 <tr>
5620 <td> foo
5621 </td></tr></table>
5622
5623 !! end
5624
5625 !! test
5626 A table with captions with non-default spaced attributes and a table row
5627 !! wikitext
5628 {|
5629 |+style="color: red;"|caption2
5630 |+ style="color: red;"| caption3
5631 |-
5632 | foo
5633 |}
5634 !! html
5635 <table>
5636 <caption style="color: red;">caption2
5637 </caption>
5638 <caption style="color: red;"> caption3
5639 </caption>
5640 <tr>
5641 <td> foo
5642 </td></tr></table>
5643
5644 !! end
5645
5646 !! test
5647 Table td-cell syntax variations
5648 !! wikitext
5649 {|
5650 | foo bar foo | baz
5651 | foo bar foo || baz
5652 | style='color:red;' | baz
5653 | style='color:red;' || baz
5654 |}
5655 !! html
5656 <table>
5657 <tr>
5658 <td> baz
5659 </td>
5660 <td> foo bar foo </td>
5661 <td> baz
5662 </td>
5663 <td style="color:red;"> baz
5664 </td>
5665 <td> style='color:red;' </td>
5666 <td> baz
5667 </td></tr></table>
5668
5669 !! end
5670
5671 !! test
5672 Simple table
5673 !! wikitext
5674 {|
5675 | 1 || 2
5676 |-
5677 | 3 || 4
5678 |}
5679 !! html
5680 <table>
5681 <tr>
5682 <td> 1 </td>
5683 <td> 2
5684 </td></tr>
5685 <tr>
5686 <td> 3 </td>
5687 <td> 4
5688 </td></tr></table>
5689
5690 !! end
5691
5692 !! test
5693 Simple table but with multiple dashes for row wikitext
5694 !! wikitext
5695 {|
5696 | foo
5697 |-----
5698 | bar
5699 |}
5700 !! html
5701 <table>
5702 <tr>
5703 <td> foo
5704 </td></tr>
5705 <tr>
5706 <td> bar
5707 </td></tr></table>
5708
5709 !! end
5710
5711 !! test
5712 Multiplication table
5713 !! wikitext
5714 {| border="1" cellpadding="2"
5715 |+Multiplication table
5716 |-
5717 ! &times; !! 1 !! 2 !! 3
5718 |-
5719 ! 1
5720 | 1 || 2 || 3
5721 |-
5722 ! 2
5723 | 2 || 4 || 6
5724 |-
5725 ! 3
5726 | 3 || 6 || 9
5727 |-
5728 ! 4
5729 | 4 || 8 || 12
5730 |-
5731 ! 5
5732 | 5 || 10 || 15
5733 |}
5734 !! html
5735 <table border="1" cellpadding="2">
5736 <caption>Multiplication table
5737 </caption>
5738 <tr>
5739 <th> &#215; </th>
5740 <th> 1 </th>
5741 <th> 2 </th>
5742 <th> 3
5743 </th></tr>
5744 <tr>
5745 <th> 1
5746 </th>
5747 <td> 1 </td>
5748 <td> 2 </td>
5749 <td> 3
5750 </td></tr>
5751 <tr>
5752 <th> 2
5753 </th>
5754 <td> 2 </td>
5755 <td> 4 </td>
5756 <td> 6
5757 </td></tr>
5758 <tr>
5759 <th> 3
5760 </th>
5761 <td> 3 </td>
5762 <td> 6 </td>
5763 <td> 9
5764 </td></tr>
5765 <tr>
5766 <th> 4
5767 </th>
5768 <td> 4 </td>
5769 <td> 8 </td>
5770 <td> 12
5771 </td></tr>
5772 <tr>
5773 <th> 5
5774 </th>
5775 <td> 5 </td>
5776 <td> 10 </td>
5777 <td> 15
5778 </td></tr></table>
5779
5780 !! end
5781
5782 !! test
5783 Accept "||" in table headings
5784 !! wikitext
5785 {|
5786 !h1 || h2
5787 |}
5788 !! html
5789 <table>
5790 <tr>
5791 <th>h1 </th>
5792 <th> h2
5793 </th></tr></table>
5794
5795 !! end
5796
5797 !! test
5798 Accept "!!" in table data
5799 !! wikitext
5800 {|
5801 | Foo!! ||
5802 |}
5803 !! html
5804 <table>
5805 <tr>
5806 <td> Foo!! </td>
5807 <td>
5808 </td></tr></table>
5809
5810 !! html/parsoid
5811 <table>
5812 <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>
5813 </tbody></table>
5814 !! end
5815
5816 !! test
5817 Accept "||" in indented table headings
5818 !! wikitext
5819 :{|
5820 !h1 || h2
5821 |}
5822 !! html
5823 <dl><dd><table>
5824 <tr>
5825 <th>h1 </th>
5826 <th> h2
5827 </th></tr></table></dd></dl>
5828
5829 !! end
5830
5831 !! test
5832 Accept "!!" in templates
5833 !! wikitext
5834 {|
5835 !a {{echo|b!!c}}
5836 |}
5837 !! html/php
5838 <table>
5839 <tr>
5840 <th>a b</th>
5841 <th>c
5842 </th></tr></table>
5843
5844 !! html/parsoid
5845 <table>
5846 <tbody><tr><th typeof="mw:Transclusion" about="#mwt1" data-parsoid='{"autoInsertedEnd":true,"pi":[[{"k":"1","spc":["","","",""]}]]}' 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>
5847 !! end
5848
5849 !! test
5850 Accept "!!" in table headings after newline
5851 !! wikitext
5852 {|
5853 !a
5854 b!!c
5855 |}
5856 !! html/php
5857 <table>
5858 <tr>
5859 <th>a
5860 <p>b!!c
5861 </p>
5862 </th></tr></table>
5863
5864 !! html/parsoid
5865 <table>
5866 <tbody><tr><th>a
5867 <p>b!!c</p></th></tr>
5868 </tbody></table>
5869 !! end
5870
5871 !! test
5872 Accept "!!" in table data of mixed wikitext / html syntax
5873 !! wikitext
5874 {|
5875 !a
5876 <tr><td>b!!c</td></tr>
5877 |}
5878 !! html+tidy
5879 <table>
5880 <tr>
5881 <th>a</th>
5882 </tr>
5883 <tr>
5884 <td>b!!c</td>
5885 </tr>
5886 </table>
5887 !! html/parsoid
5888 <table>
5889 <tbody><tr><th>a</th></tr>
5890 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
5891 </tbody></table>
5892 !! end
5893
5894 !! test
5895 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
5896 !! wikitext
5897 {|
5898 !| h1
5899 || a
5900 |}
5901 !! html
5902 <table>
5903 <tr>
5904 <th> h1
5905 </th>
5906 <td> a
5907 </td></tr></table>
5908
5909 !! end
5910
5911 !!test
5912 Accept "| !" at start of line in tables (ignore !-attribute)
5913 !! wikitext
5914 {|
5915 |-
5916 | !style="color:red" | bar
5917 |}
5918 !! html
5919 <table>
5920
5921 <tr>
5922 <td> bar
5923 </td></tr></table>
5924
5925 !!end
5926
5927 !!test
5928 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 +/-
5929 !! wikitext
5930 {|
5931 |-
5932 |style='color:red;'|+1
5933 |style='color:blue;'|-1
5934 |-
5935 | 1 || 2 || 3
5936 | 1 ||+2 ||-3
5937 |-
5938 | +1
5939 | -1
5940 |}
5941 !! html
5942 <table>
5943
5944 <tr>
5945 <td style="color:red;">+1
5946 </td>
5947 <td style="color:blue;">-1
5948 </td></tr>
5949 <tr>
5950 <td> 1 </td>
5951 <td> 2 </td>
5952 <td> 3
5953 </td>
5954 <td> 1 </td>
5955 <td>+2 </td>
5956 <td>-3
5957 </td></tr>
5958 <tr>
5959 <td> +1
5960 </td>
5961 <td> -1
5962 </td></tr></table>
5963
5964 !!end
5965
5966 !! test
5967 Table rowspan
5968 !! wikitext
5969 {| border=1
5970 | Cell 1, row 1
5971 |rowspan=2| Cell 2, row 1 (and 2)
5972 | Cell 3, row 1
5973 |-
5974 | Cell 1, row 2
5975 | Cell 3, row 2
5976 |}
5977 !! html
5978 <table border="1">
5979 <tr>
5980 <td> Cell 1, row 1
5981 </td>
5982 <td rowspan="2"> Cell 2, row 1 (and 2)
5983 </td>
5984 <td> Cell 3, row 1
5985 </td></tr>
5986 <tr>
5987 <td> Cell 1, row 2
5988 </td>
5989 <td> Cell 3, row 2
5990 </td></tr></table>
5991
5992 !! end
5993
5994 !! test
5995 Nested table
5996 !! wikitext
5997 {| border=1
5998 | &alpha;
5999 |
6000 {| bgcolor=#ABCDEF border=2
6001 |nested
6002 |-
6003 |table
6004 |}
6005 |the original table again
6006 |}
6007 !! html
6008 <table border="1">
6009 <tr>
6010 <td> &#945;
6011 </td>
6012 <td>
6013 <table bgcolor="#ABCDEF" border="2">
6014 <tr>
6015 <td>nested
6016 </td></tr>
6017 <tr>
6018 <td>table
6019 </td></tr></table>
6020 </td>
6021 <td>the original table again
6022 </td></tr></table>
6023
6024 !! end
6025
6026 !! test
6027 Invalid attributes in table cell (bug 1830)
6028 !! wikitext
6029 {|
6030 |Cell:|broken
6031 |}
6032 !! html
6033 <table>
6034 <tr>
6035 <td>broken
6036 </td></tr></table>
6037
6038 !! end
6039
6040 !! test
6041 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6042 !! wikitext
6043 {|
6044 | title="foo" |bar
6045 | title="foo<nowiki>|</nowiki>" |bar
6046 | title="foo<nowiki>|</nowiki>" bar
6047 |}
6048 !! html
6049 <table>
6050 <tr>
6051 <td title="foo">bar
6052 </td>
6053 <td title="foo&#124;">bar
6054 </td>
6055 <td> title="foo|" bar
6056 </td></tr></table>
6057
6058 !! end
6059
6060 # The "|}" to close the table is missing from the input, so parsoid's
6061 # *2wt modes will fail.
6062 !! test
6063 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
6064 !! options
6065 parsoid=wt2html,html2html
6066 !! wikitext
6067 {|
6068 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6069 !! html/php
6070 <table>
6071 <tr>
6072 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6073 <td>]" onmouseover="alert(document.cookie)"&gt;test
6074 </td>
6075 </tr>
6076 </table>
6077
6078 !! html/parsoid
6079 <table><tbody>
6080 <tr>
6081 <td><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
6082 !! end
6083
6084 # FIXME: The php output is broken.
6085 !! test
6086 ! and || in td attributes should not be parsed as <th>/<td>
6087 !! wikitext
6088 {|
6089 | style="color: red !important;" data-contrived="put this here ||" | foo
6090 |}
6091 !! html/php
6092 <table>
6093 <tr>
6094 <td> style="color: red !important;" data-contrived="put this here </td>
6095 <td> foo
6096 </td></tr></table>
6097
6098 !! html/parsoid
6099 <table>
6100 <tbody><tr><td style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"autoInsertedEnd":true}'> foo</td></tr>
6101 </tbody></table>
6102 !! end
6103
6104 !! test
6105 Indented table markup mixed with indented pre content (proposed in bug 6200)
6106 !! wikitext
6107 <table>
6108 <tr>
6109 <td>
6110 Text that should be rendered preformatted
6111 </td>
6112 </tr>
6113 </table>
6114 !! html
6115 <table>
6116 <tr>
6117 <td>
6118 <pre>Text that should be rendered preformatted
6119 </pre>
6120 </td>
6121 </tr>
6122 </table>
6123
6124 !! end
6125
6126 !! test
6127 1. Template-generated table cell attributes and cell content
6128 !! wikitext
6129 {|
6130 |{{table_attribs}}
6131 | {{table_attribs}}
6132 || {{table_attribs_5}}
6133 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6134 |align=center {{table_attribs}}
6135 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6136 |}
6137 !! html
6138 <table>
6139 <tr>
6140 <td style="color:red;">Foo
6141 </td>
6142 <td style="color:red;">Foo
6143 </td>
6144 <td> style="color:red;"</td>
6145 <td>Bar
6146 </td>
6147 <td style="color:red;">Foo
6148 </td>
6149 <td align="center" style="color:red;">Foo
6150 </td>
6151 <td align="center" style="color:red;">Foo
6152 </td></tr></table>
6153
6154 !! end
6155
6156 !! test
6157 2. Template-generated table cell attributes and cell content
6158 !! wikitext
6159 {|
6160 |{{table_attribs_2}}
6161 |}
6162 !! html/php
6163 <table>
6164 <tr>
6165 <td style="color:red;">Foo
6166 </td>
6167 <td>Bar</td>
6168 <td>Baz
6169 </td></tr></table>
6170
6171 !! html/parsoid
6172 <table>
6173 <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>
6174 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6175 </tbody></table>
6176 !! end
6177
6178 !! test
6179 3. Template-generated table cell attributes and cell content
6180 !! wikitext
6181 {|
6182 !align=center {{table_header_cells}}
6183 |-
6184 |align=center {{table_cells}}
6185 |}
6186 !! html/php
6187 <table>
6188 <tr>
6189 <th align="center" style="color:red;">Foo</th>
6190 <th style="color:red;"><i>Bar</i></th>
6191 <th style="color:brown;"><i>Foo</i> and Baz
6192 </th></tr>
6193 <tr>
6194 <td align="center" style="color:red;">Foo</td>
6195 <td style="color:red;"><i>Bar</i></td>
6196 <td style="color:brown;"><i>Foo</i> and Baz
6197 </td></tr></table>
6198
6199 !! html/parsoid
6200 <table>
6201 <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>
6202 <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>
6203 </tbody></table>
6204 !! end
6205
6206 !! test
6207 4. Template-generated table cell attributes and cell content inside a templated table
6208 !! wikitext
6209 {{tbl-start}}
6210 !align=center {{table_header_cells}}
6211 |-
6212 |align=center {{table_cells}}
6213 {{tbl-end}}
6214 !! html/php
6215 <table>
6216 <tr>
6217 <th align="center" style="color:red;">Foo</th>
6218 <th style="color:red;"><i>Bar</i></th>
6219 <th style="color:brown;"><i>Foo</i> and Baz
6220 </th></tr>
6221 <tr>
6222 <td align="center" style="color:red;">Foo</td>
6223 <td style="color:red;"><i>Bar</i></td>
6224 <td style="color:brown;"><i>Foo</i> and Baz
6225 </td></tr></table>
6226
6227 !! html/parsoid
6228 <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}}]}'>
6229 <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>
6230 <tr>
6231 <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>
6232 </tbody></table>
6233 !! end
6234
6235 ## Edge case fix to prevent future regressions
6236 !! test
6237 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
6238 !! wikitext
6239 {|
6240 |{{table_attribs_7}}
6241 |}
6242 <references />
6243 !! html/parsoid
6244 <table>
6245 <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>
6246 </tbody></table>
6247 <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>
6248 !! end
6249
6250 !! test
6251 Table with row followed by newlines and table heading
6252 !! wikitext
6253 {|
6254 |-
6255
6256 ! foo
6257 |}
6258 !! html
6259 <table>
6260
6261
6262 <tr>
6263 <th> foo
6264 </th></tr></table>
6265
6266 !! end
6267
6268 !! test
6269 Table with empty line following the start tag
6270 !! wikitext
6271 {|
6272
6273 |-
6274 | foo
6275 |}
6276 !! html
6277 <table>
6278
6279
6280 <tr>
6281 <td> foo
6282 </td></tr></table>
6283
6284 !! end
6285
6286 # FIXME: Preserve the attribute properly (with an empty string as value) in
6287 # the PHP parser. Parsoid implements the behavior below.
6288 !! test
6289 Table attributes with empty value
6290 !! wikitext
6291 {|
6292 | style=| hello
6293 |}
6294 !! html/parsoid
6295 <table>
6296 <tbody>
6297 <tr>
6298 <td style=""> hello
6299 </td></tr></tbody></table>
6300
6301 !! end
6302
6303 !! test
6304 Wikitext table with a lot of comments
6305 !! wikitext
6306 {|
6307 <!-- c0 -->
6308 | foo
6309 <!-- c1 -->
6310 |-<!-- c2 -->
6311 <!-- c3 -->
6312 |<!-- c4 -->
6313 <!-- c5 -->
6314 |}
6315 !! html
6316 <table>
6317 <tr>
6318 <td> foo
6319 </td></tr>
6320 <tr>
6321 <td>
6322 </td></tr></table>
6323
6324 !! end
6325
6326 !! test
6327 Wikitext table comments represented in parsoid dom
6328 !! wikitext
6329 {|<!--c1--><!--c2-->
6330 |-<!--c3-->
6331 | x
6332 |}
6333 !! html/php+tidy
6334 <table>
6335 <tr>
6336 <td>x</td>
6337 </tr>
6338 </table>
6339 !! html/parsoid
6340 <table><!--c1--><!--c2-->
6341 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
6342 <td data-parsoid='{"autoInsertedEnd":true}'> x</td></tr>
6343 </tbody></table>
6344 !! end
6345
6346 !! test
6347 Wikitext table with double-line table cell
6348 !! wikitext
6349 {|
6350 |a
6351 b
6352 |}
6353 !! html
6354 <table>
6355 <tr>
6356 <td>a
6357 <p>b
6358 </p>
6359 </td></tr></table>
6360
6361 !! end
6362
6363 !! test
6364 Table cell with a single comment
6365 !! wikitext
6366 {|
6367 | <!-- c1 -->
6368 | a
6369 |}
6370 !! html
6371 <table>
6372 <tr>
6373 <td>
6374 </td>
6375 <td> a
6376 </td></tr></table>
6377
6378 !! end
6379
6380 !! test
6381 Table-cell after a comment-only-empty-line
6382 !! wikitext
6383 {|
6384 |a
6385 <!--c1-->
6386 <!--c2-->| b
6387 |}
6388 !! html
6389 <table>
6390 <tr>
6391 <td>a
6392 </td>
6393 <td> b
6394 </td></tr></table>
6395
6396 !! html/parsoid
6397 <table>
6398 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
6399 <!--c1-->
6400 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
6401 </tbody></table>
6402
6403 !! end
6404
6405 !! test
6406 Build table with {{!}}
6407 !! wikitext
6408 {{{!}} class="wikitable"
6409 ! header
6410 ! second header
6411 {{!}}- style="color:red;"
6412 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
6413 {{!}}}
6414 !! html
6415 <table class="wikitable">
6416 <tr>
6417 <th> header
6418 </th>
6419 <th> second header
6420 </th></tr>
6421 <tr style="color:red;">
6422 <td> data </td>
6423 <td style="color:red;"> second data
6424 </td></tr></table>
6425
6426 !! end
6427
6428 !! test
6429 Build table with pipe as data
6430 !! wikitext
6431 {| class="wikitable"
6432 ! header
6433 ! second header
6434 |- style="color:red;"
6435 | data || style="color:red;" | second data
6436 |-
6437 | style="color:red;" | data with | || style="color:red;" | second data with |
6438 |-
6439 || data with | ||| second data with |
6440 |}
6441 !! html
6442 <table class="wikitable">
6443 <tr>
6444 <th> header
6445 </th>
6446 <th> second header
6447 </th></tr>
6448 <tr style="color:red;">
6449 <td> data </td>
6450 <td style="color:red;"> second data
6451 </td></tr>
6452 <tr>
6453 <td style="color:red;"> data with | </td>
6454 <td style="color:red;"> second data with |
6455 </td></tr>
6456 <tr>
6457 <td> data with | </td>
6458 <td> second data with |
6459 </td></tr></table>
6460
6461 !! end
6462
6463 !! test
6464 Build table with wikilink
6465 !! wikitext
6466 {| class="wikitable"
6467 ! header || second header
6468 |- style="color:red;"
6469 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
6470 |-
6471 | data || second data [[Main Page|link|text with pipe]]
6472 |}
6473 !! html
6474 <table class="wikitable">
6475 <tr>
6476 <th> header </th>
6477 <th> second header
6478 </th></tr>
6479 <tr style="color:red;">
6480 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
6481 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
6482 </td></tr>
6483 <tr>
6484 <td> data </td>
6485 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
6486 </td></tr></table>
6487
6488 !! end
6489
6490 # The expected HTML structure in this test is debatable. The PHP parser does
6491 # not parse this kind of table at all. The main focus for Parsoid is on
6492 # round-tripping, so this output is ok for now. TODO: revisit!
6493 !! test
6494 Wikitext table with html-syntax row
6495 !! wikitext
6496 {|
6497 |-
6498 <td>foo</td>
6499 |}
6500 !! html/parsoid
6501 <table>
6502 <tbody>
6503 <tr>
6504 <td>foo</td></tr></tbody></table>
6505 !! end
6506
6507 ## Note that Parsoid output differs from PHP and PHP+tidy here.
6508 ## The lack of <tr> tags in the PHP output is arguably a bug in the
6509 ## PHP parser, which tidy then compounds by fostering the content
6510 ## entirely out of the table. Parsoid recognizes the table context
6511 ## and generates <tr> and <td> wrappers as needed. Hopefully nobody
6512 ## depends on PHP's treatment of broken table markup!
6513 !! test
6514 Implicit <td> after a |-
6515 !! options
6516 parsoid=wt2html,html2html
6517 !! wikitext
6518 {|
6519 |-
6520 a
6521 |}
6522 !! html/php
6523 <table>
6524
6525 a
6526 </table>
6527
6528 !! html/php+tidy
6529 <p>a</p>
6530 !! html/parsoid
6531 <table>
6532 <tr><td>a</td></tr>
6533 </table>
6534 !! end
6535
6536 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
6537 !! test
6538 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
6539 !! options
6540 parsoid=wt2html,html2html
6541 !! wikitext
6542 {|
6543 |-
6544 |
6545 a
6546 |-
6547 b
6548 |}
6549 !! html/php
6550 <table>
6551
6552 <tr>
6553 <td>
6554 <pre>a
6555 </pre>
6556 </td></tr>
6557 b
6558 </table>
6559
6560 !! html/php+tidy
6561 <p>b</p>
6562 <table>
6563 <tr>
6564 <td>
6565 <pre>
6566 a
6567 </pre></td>
6568 </tr>
6569 </table>
6570 !! html/parsoid
6571 <table>
6572 <tbody>
6573 <tr><td><pre>a</pre></td></tr>
6574 <tr><td> b</td></tr>
6575 </tbody>
6576 </table>
6577 !! end
6578
6579 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
6580 # Parsoid generates the missing <td>, so wt2wt won't succeed.
6581 !! test
6582 Lists should be recognized in an implicit <td> context
6583 !! options
6584 parsoid=wt2html,html2html
6585 !! wikitext
6586 {|
6587 |-
6588 *a
6589 |}
6590 !! html/php
6591 <table>
6592
6593 <ul><li>a</li></ul>
6594 </table>
6595
6596 !! html/php+tidy
6597 <ul>
6598 <li>a</li>
6599 </ul>
6600 !! html/parsoid
6601 <table>
6602 <tr>
6603 <td><ul>
6604 <li>a</li>
6605 </ul></td>
6606 </tr>
6607 </table>
6608 !! end
6609
6610 !! test
6611 Table cells not properly parsed in an implicit-td context
6612 !! wikitext
6613 {|
6614 |-
6615 {{table_attribs_4}} || a || b
6616 |}
6617 !! html/php+tidy
6618 <table>
6619 <tr>
6620 <td style="background-color:#DC241f;" width="10px"></td>
6621 <td>a</td>
6622 <td>b</td>
6623 </tr>
6624 </table>
6625 !! html/parsoid
6626 <table>
6627 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
6628 <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>
6629 </tbody></table>
6630 !! end
6631
6632 !! test
6633 Parsoid: Round-trip tables directly followed by content (bug 51219)
6634 !! options
6635 parsoid=wt2html,wt2wt
6636 !! wikitext
6637 {|
6638 |foo
6639 |} bar
6640
6641 {|
6642 |baz
6643 |}<b>quux</b>
6644 !! html+tidy
6645 <table>
6646 <tr>
6647 <td>foo</td>
6648 </tr>
6649 </table>
6650 <p>bar</p>
6651 <table>
6652 <tr>
6653 <td>baz</td>
6654 </tr>
6655 </table>
6656 <p><b>quux</b></p>
6657 !! end
6658
6659 !! test
6660 Parsoid: Default to a newline after tables in new content (bug 51219)
6661 !! options
6662 parsoid=html2wt
6663 !! html
6664 <table><tbody>
6665 <tr><td>foo</td></tr></tbody></table> bar
6666 <table><tbody>
6667 <tr><td>baz</td></tr></tbody></table><b>quux</b>
6668 !! wikitext
6669 {|
6670 |foo
6671 |}
6672 <nowiki> </nowiki>bar
6673 {|
6674 |baz
6675 |}
6676 '''quux'''
6677 !! end
6678
6679 !! test
6680 Parsoid: newline inducing block nodes don't suppress <nowiki>
6681 !! options
6682 parsoid=html2wt
6683 !! html
6684 a<h1>foo</h1>
6685 !! wikitext
6686 <nowiki> </nowiki>a
6687
6688 = foo =
6689 !! end
6690
6691 !! test
6692 Parsoid: Row-syntax table headings followed by comment & table cells
6693 !! options
6694 parsoid=wt2html,wt2wt
6695 !! wikitext
6696 {|
6697 ! foo || bar
6698 <!-- foo --> || baz || quux
6699 |}
6700 !! html/php
6701 <table>
6702 <tr>
6703 <th> foo </th>
6704 <th> bar
6705 </th>
6706 <td> baz </td>
6707 <td> quux
6708 </td></tr></table>
6709
6710 !! html/parsoid
6711 <table>
6712 <tbody><tr><th> foo </th><th> bar
6713 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
6714 </tbody></table>
6715 !! end
6716
6717
6718 # PHP throws away the (semi-broken) "foo" class here; Parsoid
6719 # preserves it.
6720 !!test
6721 Parsoid: Recover better from broken table attributes
6722 !!options
6723 parsoid=wt2html
6724 !!wikitext
6725 {| class="foo
6726 | class="bar" |
6727 foo
6728 |}
6729 !!html/php+tidy
6730 <table>
6731 <tr>
6732 <td class="bar">
6733 <p>foo</p>
6734 </td>
6735 </tr>
6736 </table>
6737 !!html/parsoid
6738 <table class="foo">
6739 <tr>
6740 <td class="bar">
6741 <p>foo</p></td></tr>
6742 </tbody></table>
6743 !!end
6744
6745 !! test
6746 Strip unsupported table tags
6747 !! options
6748 parsoid=html2wt
6749 !! html
6750 <table>
6751 <thead>
6752 <tr>
6753 <th>Month</th>
6754 <th>Savings</th>
6755 </tr>
6756 </thead>
6757 <tbody>
6758 <tr>
6759 <td>January</td>
6760 <td>$100</td>
6761 </tr>
6762 <tr>
6763 <td>February</td>
6764 <td>$80</td>
6765 </tr>
6766 </tbody>
6767 <tfoot>
6768 <tr>
6769 <td>Sum</td>
6770 <td>$180</td>
6771 </tr>
6772 </tfoot>
6773 </table>
6774 !! wikitext
6775 {|
6776
6777 !Month
6778 !Savings
6779
6780 |January
6781 |$100
6782
6783 |-
6784 |February
6785 |$80
6786
6787 |Sum
6788 |$180
6789
6790 |}
6791 !! end
6792
6793 !!test
6794 Testing serialization after deletion of table cells
6795 !!options
6796 parsoid={
6797 "modes": ["wt2wt", "selser"],
6798 "changes": [
6799 ["#x", "remove"]
6800 ]
6801 }
6802 !!wikitext
6803 {|
6804 !h1 !!h2 !!h3
6805 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
6806 |}
6807 !! wikitext/edited
6808 {|
6809 !h1 !!h2 !!h3
6810 |c2 |||c3
6811 |}
6812 !!end
6813
6814 ###
6815 ### Internal links
6816 ###
6817 !! test
6818 Plain link, capitalized
6819 !! wikitext
6820 [[Main Page]]
6821 !! html
6822 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6823 </p>
6824 !! end
6825
6826 !! test
6827 Plain link, uncapitalized
6828 !! wikitext
6829 [[main Page]]
6830 !! html
6831 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
6832 </p>
6833 !! end
6834
6835 !! test
6836 Piped link
6837 !! wikitext
6838 [[Main Page|The Main Page]]
6839 !! html
6840 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
6841 </p>
6842 !! end
6843
6844 !! test
6845 Piped link with comment in link text
6846 !! wikitext
6847 [[Main Page|The Main<!--front--> Page]]
6848 !! html
6849 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
6850 </p>
6851 !! end
6852
6853 !! test
6854 Piped link with multiple pipe characters in link text
6855 !! wikitext
6856 [[Main Page||The|Main|Page|]]
6857 !! html/php
6858 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
6859 </p>
6860 !! html/parsoid
6861 <p><a rel="mw:WikiLink" href="Main_Page" title="Main Page">|The|Main|Page|</a></p>
6862 !! end
6863
6864 !! test
6865 Broken link
6866 !! wikitext
6867 [[Zigzagzogzagzig]]
6868 !! html
6869 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
6870 </p>
6871 !! end
6872
6873 !! test
6874 Broken link with fragment
6875 !! wikitext
6876 [[Zigzagzogzagzig#zug]]
6877 !! html
6878 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
6879 </p>
6880 !! end
6881
6882 !! test
6883 Special page link with fragment
6884 !! wikitext
6885 [[Special:Version#anchor]]
6886 !! html
6887 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
6888 </p>
6889 !! end
6890
6891 !! test
6892 Nonexistent special page link with fragment
6893 !! wikitext
6894 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
6895 !! html
6896 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
6897 </p>
6898 !! end
6899
6900 !! test
6901 Link with prefix
6902 !! wikitext
6903 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
6904 !! html
6905 <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>
6906 </p>
6907 !! end
6908
6909 !! test
6910 Link with suffix
6911 !! wikitext
6912 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
6913 !! html
6914 <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>!!!
6915 </p>
6916 !! end
6917
6918 !! article
6919 prefixed article
6920 !! text
6921 Some text
6922 !! endarticle
6923
6924 !! test
6925 Bug 43661: Piped links with identical prefixes
6926 !! wikitext
6927 [[prefixed article|prefixed articles with spaces]]
6928
6929 [[prefixed article|prefixed articlesaoeu]]
6930
6931 [[Main Page|Main Page test]]
6932 !! html
6933 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
6934 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
6935 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
6936 </p>
6937 !! end
6938
6939
6940 !! test
6941 Link with HTML entity in suffix / tail
6942 !! wikitext
6943 [[Main Page]]&quot;, [[Main Page]]&#97;
6944 !! html/php
6945 <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;
6946 </p>
6947 !! html/parsoid
6948 <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>
6949 !! end
6950
6951 !! test
6952 Link with 3 brackets
6953 !! wikitext
6954 [[[Main Page]]]
6955 !! html
6956 <p>[[[Main Page]]]
6957 </p>
6958 !! end
6959
6960 !! test
6961 Link with 4 brackets
6962 !! wikitext
6963 [[[[Main Page]]]]
6964 !! html
6965 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
6966 </p>
6967 !! end
6968
6969 !! test
6970 Piped link with 3 brackets
6971 !! wikitext
6972 [[[main page|the main page]]]
6973 !! html
6974 <p>[[[main page|the main page]]]
6975 </p>
6976 !! end
6977
6978 !! test
6979 Piped link with extlink-like text
6980 !! wikitext
6981 [[Main Page|[bar]]]
6982 [[Main Page|This is a [bar]]]
6983 !! html/php
6984 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
6985 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
6986 </p>
6987 !! html/parsoid
6988 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
6989 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a></p>
6990 !! end
6991
6992 !! test
6993 Link with multiple pipes
6994 !! wikitext
6995 [[Main Page|The|Main|Page]]
6996 !! html
6997 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
6998 </p>
6999 !! end
7000
7001 # Note that parsoid does not munge anchor text; all non-space
7002 # characters are valid in HTML5 ids.
7003 !! test
7004 Anchor containing a #. (bug 63430)
7005 !! wikitext
7006 [[Main Page#And#Link]]
7007 !! html/php
7008 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
7009 </p>
7010 !! html/parsoid
7011 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link" title="Main Page">Main Page#And#Link</a></p>
7012 !! end
7013
7014 !! test
7015 Link to namespaces
7016 !! wikitext
7017 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7018 !! html
7019 <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>
7020 </p>
7021 !! end
7022
7023 !! test
7024 Link with space in namespace
7025 !! wikitext
7026 [[User talk:Foo bar]]
7027 !! html
7028 <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>
7029 </p>
7030 !! end
7031
7032 !! article
7033 MemoryAlpha:AlphaTest
7034 !! text
7035 This is an article in the MemoryAlpha namespace
7036 (which shadows the memoryalpha interwiki link).
7037 !! endarticle
7038
7039 !! test
7040 Namespace takes precedence over interwiki link (bug 51680)
7041 !! wikitext
7042 [[MemoryAlpha:AlphaTest]]
7043 !! html
7044 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7045 </p>
7046 !! end
7047
7048 # The previous test doesn't work correctly in html2*, due to not recognizing the
7049 # link as an internal one. This one checks for the correct behavior.
7050 !! test
7051 Link to namespace preferred over interwiki with correct rel attribute
7052 !! options
7053 parsoid=html2wt,html2html
7054 !! html
7055 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7056 !! wikitext
7057 [[MemoryAlpha:AlphaTest]]
7058 !! end
7059
7060 !! test
7061 Piped link to namespace
7062 !! wikitext
7063 [[Meta:Disclaimers|The disclaimers]]
7064 !! html
7065 <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>
7066 </p>
7067 !! end
7068
7069 !! test
7070 Link containing }
7071 !! wikitext
7072 [[Usually caused by a typo (oops}]]
7073 !! html
7074 <p>[[Usually caused by a typo (oops}]]
7075 </p>
7076 !! end
7077
7078 !! article
7079 7% Solution
7080 !! text
7081 Just a test of an article title containing a percent.
7082 !! endarticle
7083
7084 !! test
7085 Link containing % (not as a hex sequence)
7086 !! wikitext
7087 [[7% Solution]]
7088 !! html/php
7089 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7090 </p>
7091 !! html/parsoid
7092 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
7093 !! end
7094
7095 # note that the parsoid HTML is identical to the previous test output,
7096 # so the previous test ensures that the html2wt mode will generate the
7097 # "not as a hex sequence" wikitext.
7098 !! test
7099 Link containing % as a single hex sequence interpreted to char
7100 !! options
7101 parsoid=wt2wt,wt2html,html2html
7102 !! wikitext
7103 [[7%25 Solution]]
7104 !! html/php
7105 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7106 </p>
7107 !! html/parsoid
7108 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
7109 !!end
7110
7111 !! test
7112 Link containing % as a double hex sequence interpreted to hex sequence
7113 !! wikitext
7114 [[7%2525 Solution]]
7115 !! html
7116 <p>[[7%2525 Solution]]
7117 </p>
7118 !!end
7119
7120 # note that parsoid does not munge anchor text; all non-space
7121 # characters are valid in HTML5 anchors.
7122 !! test
7123 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7124 Example for such a section: == < ==
7125 !! wikitext
7126 [[%23%3c]][[%23%3e]]
7127 !! html/php
7128 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7129 </p>
7130 !! html/parsoid
7131 <p><a rel="mw:WikiLink" href="./Main%20Page#%3C" title="Main Page">#&lt;</a><a rel="mw:WikiLink" href="./Main%20Page#%3E" title="Main Page">#></a></p>
7132 !! end
7133
7134 !! test
7135 Link containing "<#" and ">#" as a hex sequences
7136 !! wikitext
7137 [[%3c%23]][[%3e%23]]
7138 !! html
7139 <p>[[%3c%23]][[%3e%23]]
7140 </p>
7141 !! end
7142
7143 !! test
7144 Link containing an equals sign
7145 !! wikitext
7146 [[Special:BookSources/isbn=4-00-026157-6]]
7147 !! html/php
7148 <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>
7149 </p>
7150 !! html/parsoid
7151 <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>
7152 !! end
7153
7154 !! article
7155 Foo~bar
7156 !! text
7157 Just a test of an article title containing a tilde.
7158 !! endarticle
7159
7160 # note that links containing signatures, like [[Foo~~~~]], are
7161 # massaged by the pre-save transform (PST) and so the tildes are never
7162 # seen by the parser.
7163 !! test
7164 Link containing a tilde
7165 !! wikitext
7166 [[Foo~bar]]
7167 !! html/php
7168 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
7169 </p>
7170 !! html/parsoid
7171 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
7172 !! end
7173
7174 !! test
7175 Link containing double-single-quotes '' (bug 4598)
7176 !! wikitext
7177 [[Lista d''e paise d''o munno]]
7178 !! html/php
7179 <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>
7180 </p>
7181 !! html/parsoid
7182 <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>
7183 !! end
7184
7185 !! test
7186 Link containing double-single-quotes '' in text (bug 4598 sanity check)
7187 !! wikitext
7188 Some [[Link|pretty ''italics'' and stuff]]!
7189 !! html/php
7190 <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>!
7191 </p>
7192 !! html/parsoid
7193 <p>Some <a rel="mw:WikiLink" href="Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
7194 !! end
7195
7196 !! test
7197 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
7198 !! wikitext
7199 ''Some [[Link|pretty ''italics'' and stuff]]!''
7200 !! html
7201 <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>
7202 </p>
7203 !! end
7204
7205 !! test
7206 Link with double quotes in title part (literal) and alternate part (interpreted)
7207 !! wikitext
7208 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
7209
7210 [[''Pentecoste'']]
7211
7212 [[''Pentecoste''|Pentecoste]]
7213
7214 [[''Pentecoste''|''Pentecoste'']]
7215 !! html/php
7216 <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>
7217 </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>
7218 </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>
7219 </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>
7220 </p>
7221 !! html/parsoid
7222 <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>
7223 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
7224 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
7225 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
7226 !! end
7227
7228 !! test
7229 Broken image links with HTML captions (bug 39700)
7230 !! wikitext
7231 [[File:Nonexistent|<script></script>]]
7232 [[File:Nonexistent|100x100px|<script></script>]]
7233 [[File:Nonexistent|&lt;]]
7234 [[File:Nonexistent|a<i>b</i>c]]
7235 !! html/php
7236 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7237 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7238 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
7239 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
7240 </p>
7241 !! html/parsoid
7242 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&lt;script>&lt;/script>"}'><a href="./File:Nonexistent"><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220"/></a></span>
7243 <span typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&lt;script>&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"/></a></span>
7244 <span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&amp;lt;"}'><a href="./File:Nonexistent"><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220"/></a></span>
7245 <span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"a&lt;i>b&lt;/i>c"}'><a href="./File:Nonexistent"><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220"/></a></span></p>
7246 !! end
7247
7248 !! test
7249 Plain link to URL
7250 !! wikitext
7251 [[http://www.example.com]]
7252 !! html/php
7253 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
7254 </p>
7255 !! html/parsoid
7256 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
7257 !! end
7258
7259 !! test
7260 Plain link to URL with link text
7261 !! wikitext
7262 [[http://www.example.com Link text]]
7263 !! html
7264 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
7265 </p>
7266 !! end
7267
7268 !! test
7269 Plain link to protocol-relative URL
7270 !! wikitext
7271 [[//www.example.com]]
7272 !! html/php
7273 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
7274 </p>
7275 !! html/parsoid
7276 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
7277 !! end
7278
7279 !! test
7280 Plain link to protocol-relative URL with link text
7281 !! wikitext
7282 [[//www.example.com Link text]]
7283 !! html
7284 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
7285 </p>
7286 !! end
7287
7288 !! test
7289 Plain link to page with question mark in title
7290 !! wikitext
7291 [[A?b]]
7292
7293 [[A?b|Baz]]
7294 !! html
7295 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
7296 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
7297 </p>
7298 !! end
7299
7300
7301 # I'm fairly sure the expected result here is wrong.
7302 # We want these to be URL links, not pseudo-pages with URLs for titles....
7303 # However the current output is also pretty screwy.
7304 #
7305 # ----
7306 # I'm changing it to match the current output--it arguably makes more
7307 # sense in the light of the test above. Old expected result was:
7308 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
7309 #</p>
7310 # But I think this test is bordering on "garbage in, garbage out" anyway.
7311 # -- wtm
7312 !! test
7313 Piped link to URL
7314 !! wikitext
7315 Piped link to URL: [[http://www.example.com|an example URL]]
7316 !! html/php
7317 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
7318 </p>
7319 !! html/parsoid
7320 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
7321 !! end
7322
7323 !! test
7324 BUG 2: [[page|http://url/]] should link to page, not http://url/
7325 !! wikitext
7326 [[Main Page|http://url/]]
7327 !! html/php
7328 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
7329 </p>
7330 !! html/parsoid
7331 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
7332 !! end
7333
7334 # Parsoid does not mark self-links, by design.
7335 !! test
7336 BUG 337: Escaped self-links should be bold
7337 !! options
7338 title=[[Bug462]]
7339 !! wikitext
7340 [[Bu&#103;462]] [[Bug462]]
7341 !! html/php
7342 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
7343 </p>
7344 !! html/php+tidy
7345 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
7346 !! html/parsoid
7347 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
7348 !! end
7349
7350 !! test
7351 Self-link to section should not be bold
7352 !! options
7353 title=[[Main Page]]
7354 !! wikitext
7355 [[Main Page#section]]
7356 !! html
7357 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
7358 </p>
7359 !! end
7360
7361 !! article
7362 00
7363 !! text
7364 This is 00.
7365 !! endarticle
7366
7367 !!test
7368 Self-link to numeric title
7369 !!options
7370 title=[[0]]
7371 !! wikitext
7372 [[0]]
7373 !! html
7374 <p><strong class="selflink">0</strong>
7375 </p>
7376 !!end
7377
7378 !!test
7379 Link to numeric-equivalent title
7380 !!options
7381 title=[[0]]
7382 !! wikitext
7383 [[00]]
7384 !! html
7385 <p><a href="/wiki/00" title="00">00</a>
7386 </p>
7387 !!end
7388
7389 !! test
7390 <nowiki> inside a link
7391 !! wikitext
7392 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
7393 !! html
7394 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
7395 </p>
7396 !! end
7397
7398 !! test
7399 Non-breaking spaces in title
7400 !! wikitext
7401 [[&nbsp; Main &nbsp; Page &nbsp;]]
7402 !! html
7403 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
7404 </p>
7405 !!end
7406
7407 !! test
7408 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
7409 !! options
7410 language=ca
7411 !! wikitext
7412 '''[[Main Page]]'''
7413 !! html
7414 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
7415 </p>
7416 !! end
7417
7418 !! test
7419 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
7420 !! options
7421 language=ca
7422 !! wikitext
7423 ''[[Main Page]]''
7424 !! html
7425 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
7426 </p>
7427 !! end
7428
7429 !! test
7430 Internal link with en linktrail: no apostrophes (bug 27473)
7431 !! options
7432 language=en
7433 !! wikitext
7434 [[Something]]'nice
7435 !! html
7436 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
7437 </p>
7438 !! end
7439
7440 !! test
7441 Internal link with ca linktrail with apostrophes (bug 27473)
7442 !! options
7443 language=ca
7444 !! wikitext
7445 [[Something]]'nice
7446 !! html
7447 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
7448 </p>
7449 !! end
7450
7451 !! test
7452 Internal link with kaa linktrail with apostrophes (bug 27473)
7453 !! options
7454 language=kaa
7455 !! wikitext
7456 [[Something]]'nice
7457 !! html
7458 <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>
7459 </p>
7460 !! end
7461
7462 !! test
7463 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
7464 !! wikitext
7465 [[User:Foo/Test/63636:Bar|Test]]
7466 !! html/php
7467 <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>
7468 </p>
7469 !! html/parsoid
7470 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
7471 !! end
7472
7473 !! test
7474 Purely hash wikilink
7475 !! options
7476 title=[[User:test/123]]
7477 !! wikitext
7478 [[#a|b]]
7479 !! html/php
7480 <p><a href="#a">b</a>
7481 </p>
7482 !! html/parsoid
7483 <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>
7484 !! end
7485
7486 !! test
7487 1. Interaction of linktrail and template encapsulation
7488 !! options
7489 parsoid
7490 !! wikitext
7491 {{echo|[[Foo]]}}l
7492 !! html
7493 <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>
7494 !! end
7495
7496 !! test
7497 2. Interaction of linktrail and template encapsulation
7498 !! options
7499 parsoid
7500 !! wikitext
7501 {{echo|Some [[Fool]]}}s
7502 !! html
7503 <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","spc":["","","",""]}]]}'>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>
7504 !! end
7505
7506 !! test
7507 3. Interaction of linktrail and template encapsulation
7508 !! options
7509 parsoid
7510 !! wikitext
7511 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
7512 !! html
7513 <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","spc":["","","",""]}]]}'>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>
7514 !! end
7515
7516 !! article
7517 Söfnuður
7518 !! text
7519 Test.
7520 !! endarticle
7521
7522 !! test
7523 Internal link with is link prefix
7524 !! options
7525 language=is
7526 !! wikitext
7527 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
7528 !! html
7529 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
7530 </p>
7531 !! end
7532
7533 !! article
7534 Mótmælendatrú
7535 !! text
7536 Test.
7537 !! endarticle
7538
7539 !! test
7540 Internal link with is link trail and link prefix
7541 !! options
7542 language=is
7543 !! wikitext
7544 [[mótmælendatrú|xxx]]ar
7545 [[mótmælendatrú]]ar
7546 mótmælenda[[söfnuður]]
7547 mótmælenda[[söfnuður|söfnuðir]]
7548 mótmælenda[[söfnuður|söfnuðir]]xxx
7549 !! html
7550 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
7551 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
7552 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
7553 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
7554 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
7555 </p>
7556 !! end
7557
7558 !! test
7559 Parsoid link trail escaping
7560 !! options
7561 parsoid=html2wt,html2html
7562 !! html
7563 <p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p>
7564 !! wikitext
7565 [[apple]]<nowiki/>s
7566 !! end
7567
7568 !! test
7569 Parsoid link prefix escaping
7570 !! options
7571 language=is
7572 parsoid=html2wt,html2html
7573 !! html
7574 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p>
7575 !! wikitext
7576 Aðrir mótmælenda<nowiki/>[[söfnuður]]
7577 !! end
7578
7579 !! test
7580 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
7581 !! wikitext
7582 [[Foo| bar]]
7583
7584 [[Foo| ''bar'']]
7585
7586 [http://wp.org foo]
7587
7588 [http://wp.org ''foo'']
7589 !! html
7590 <p><a href="/wiki/Foo" title="Foo"> bar</a>
7591 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
7592 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
7593 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
7594 </p>
7595 !! end
7596
7597 !! test
7598 Parsoid: Scoped parsing should handle mixed transclusions and plain text
7599 !! options
7600 parsoid
7601 !! wikitext
7602 [[Foo|{{echo|a}} b {{echo|c}}]]
7603 !! html
7604 <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>
7605 !! end
7606
7607 !! test
7608 Link with angle bracket after anchor
7609 !! wikitext
7610 [[Foo#<bar>]]
7611 !! html/php
7612 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
7613 </p>
7614 !! html/parsoid
7615 <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>
7616 !! end
7617
7618 ###
7619 ### Interwiki links (see maintenance/interwiki.sql)
7620 ###
7621
7622 !! test
7623 Inline interwiki link
7624 !! options
7625 parsoid=wt2html,wt2wt,html2html
7626 !! wikitext
7627 [[MeatBall:SoftSecurity]]
7628 !! html/php
7629 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
7630 </p>
7631 !! html/parsoid
7632 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
7633 !! end
7634
7635 !! test
7636 Inline interwiki link with empty title (bug 2372)
7637 !! options
7638 parsoid=wt2html,wt2wt,html2html
7639 !! wikitext
7640 [[MeatBall:]]
7641 !! html/php
7642 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
7643 </p>
7644 !! html/parsoid
7645 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
7646 !! end
7647
7648 !! test
7649 Interwiki link encoding conversion (bug 1636)
7650 !! wikitext
7651 *[[Wikipedia:ro:Olteni&#0355;a]]
7652 *[[Wikipedia:ro:Olteni&#355;a]]
7653 !! html
7654 <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>
7655 <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>
7656
7657 !! html+tidy
7658 <ul>
7659 <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>
7660 <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>
7661 </ul>
7662 !! end
7663
7664 !! test
7665 Interwiki link with fragment (bug 2130)
7666 !! wikitext
7667 [[MeatBall:SoftSecurity#foo]]
7668 !! html
7669 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
7670 </p>
7671 !! end
7672
7673 # Ideally the wikipedia: prefix here should be proto-relative too
7674 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
7675 # define the 'en' prefix, and originally the test used 'wikipedia',
7676 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
7677 # article.
7678 !! test
7679 Different interwiki prefixes mapping to the same URL
7680 !! wikitext
7681 [[:en:Foo]]
7682
7683 [[:en:Foo|Foo]]
7684
7685 [[wikipedia:Foo]]
7686
7687 [[:wikipedia:Foo|Foo]]
7688
7689 [[wikipedia:en:Foo]]
7690
7691 [[:wikipedia:en:Foo]]
7692
7693 [[ wikiPEdia :Foo]]
7694 !! html/parsoid
7695 <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>
7696
7697 <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>
7698
7699 <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>
7700
7701 <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>
7702
7703 <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>
7704
7705 <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>
7706
7707 <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>
7708 !! end
7709
7710 !! test
7711 Interwiki links that cannot be represented in wiki syntax
7712 !! wikitext
7713 [[meatball:ok]]
7714 [[meatball:ok#foo|ok with fragment]]
7715 [[meatball:ok_as_well?|ok ending with ? mark]]
7716 [http://de.wikipedia.org/wiki/Foo?action=history has query]
7717 [http://de.wikipedia.org/wiki/#foo is just fragment]
7718
7719 !! html/php
7720 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
7721 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
7722 <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>
7723 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
7724 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
7725 </p>
7726 !! html/parsoid
7727 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
7728 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
7729 <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>
7730 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
7731 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
7732 !! end
7733
7734 !! test
7735 Interwiki links: trail
7736 !! wikitext
7737 [[wikipedia:Foo|Ba]]r
7738 !! html/php
7739 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
7740 </p>
7741 !! html/parsoid
7742 <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>
7743 !! end
7744
7745 !! test
7746 Local interwiki link
7747 !! options
7748 parsoid=wt2html,wt2wt,html2html
7749 !! wikitext
7750 [[local:Template:Foo]]
7751 !! html/php
7752 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
7753 </p>
7754 !! html/parsoid
7755 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
7756 !! end
7757
7758 # Parsoid does not mark self-links, by design.
7759 !! test
7760 Local interwiki link: self-link to current page
7761 !! options
7762 title=[[Main Page]]
7763 parsoid=wt2html,wt2wt,html2html
7764 !! wikitext
7765 [[local:Main Page]]
7766 !! html/php
7767 <p><strong class="selflink">local:Main Page</strong>
7768 </p>
7769 !! html/parsoid
7770 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
7771 !! end
7772
7773 !! test
7774 Local interwiki link: prefix only (bug 64167)
7775 !! options
7776 parsoid=wt2html,wt2wt,html2html
7777 !! wikitext
7778 [[local:]]
7779 !! html/php
7780 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
7781 </p>
7782 !! html/parsoid
7783 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
7784 !! end
7785
7786 !! test
7787 Local interwiki link: with additional interwiki prefix (bug 61357)
7788 !! options
7789 parsoid=wt2html,wt2wt,html2html
7790 !! wikitext
7791 [[local:meatball:Hello]]
7792 !! html/php
7793 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
7794 </p>
7795 !! html/parsoid
7796 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
7797 !! end
7798
7799 !! test
7800 Multiple local interwiki link prefixes
7801 !! wikitext
7802 [[local:local:local:local:mi:local:Foo]]
7803 !! options
7804 parsoid=wt2html,wt2wt,html2html
7805 !! html/php
7806 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
7807 </p>
7808 !! html/parsoid
7809 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
7810 !! end
7811
7812 ###
7813 ### Interlanguage links
7814 ### Language links (so that searching for '### language' matches..)
7815 ###
7816
7817 !! test
7818 Interlanguage link
7819 !! options
7820 parsoid=wt2html,wt2wt,html2html
7821 !! wikitext
7822 Blah blah blah
7823 [[zh:Chinese]]
7824 !! html/php
7825 <p>Blah blah blah
7826 </p>
7827 !! html/parsoid
7828 <p>Blah blah blah</p>
7829 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7830 !! end
7831
7832 !! test
7833 Interlanguage link with spacing
7834 !! options
7835 parsoid=wt2html,wt2wt,html2html
7836 !! wikitext
7837 Blah blah blah
7838 [[ zh : Chinese ]]
7839 !! html/php
7840 <p>Blah blah blah
7841 </p>
7842 !! html/parsoid
7843 <p>Blah blah blah</p>
7844 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7845 !! end
7846
7847 !! test
7848 Double interlanguage link
7849 !! options
7850 parsoid=wt2html,wt2wt,html2html
7851 !! wikitext
7852 Blah blah blah
7853 [[es:Spanish]]
7854 [[zh:Chinese]]
7855 !! html/php
7856 <p>Blah blah blah
7857 </p>
7858 !! html/parsoid
7859 <p>Blah blah blah</p>
7860 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
7861 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7862 !! end
7863
7864 !! test
7865 Interlanguage link variations
7866 !! options
7867 parsoid=wt2html,wt2wt,html2html
7868 !! wikitext
7869 Blah blah blah
7870 [[ es :Spanish]]
7871 [[ ZH :Chinese]]
7872 [[es:Foo_bar]]
7873 !! html/php
7874 <p>Blah blah blah
7875 </p>
7876 !! html/parsoid
7877 <p>Blah blah blah</p>
7878 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
7879 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
7880 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
7881 !! end
7882
7883 !! test
7884 Space and question mark encoding in interlanguage links (T95473)
7885 !! options
7886 parsoid=wt2html,wt2wt,html2html
7887 !! wikitext
7888 Blah blah blah
7889 [[es:Foo bar?]]
7890 !! html/php
7891 <p>Blah blah blah
7892 </p>
7893 !! html/parsoid
7894 <p>Blah blah blah</p>
7895 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
7896 !! end
7897
7898 !! test
7899 Interlanguage link, with prefix links
7900 !! options
7901 language=ln
7902 !! wikitext
7903 Blah blah blah
7904 [[zh:Chinese]]
7905 !! html/php
7906 <p>Blah blah blah
7907 </p>
7908 !! html/parsoid
7909 <p>Blah blah blah</p>
7910 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7911 !! end
7912
7913 !! test
7914 Double interlanguage link, with prefix links (bug 8897)
7915 !! options
7916 language=ln
7917 !! wikitext
7918 Blah blah blah
7919 [[es:Spanish]]
7920 [[zh:Chinese]]
7921 !! html/php
7922 <p>Blah blah blah
7923 </p>
7924 !! html/parsoid
7925 <p>Blah blah blah</p>
7926 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
7927 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7928 !! end
7929
7930 !! test
7931 "Extra" interlanguage links (bug 32189 / gerrit 111390)
7932 !! wikitext
7933 Blah blah blah
7934 [[mul:Article]]
7935 !! html/php
7936 <p>Blah blah blah
7937 </p>
7938 !! html/parsoid
7939 <p>Blah blah blah</p>
7940 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
7941 !! end
7942
7943 !! test
7944 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
7945 !! options
7946 language=ln
7947 !! wikitext
7948 [[WW&nbsp;II]]
7949 !! html
7950 <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>
7951 </p>
7952 !! end
7953
7954 !! test
7955 Parsoid bug 53221: Wikilinks should be properly entity-escaped
7956 !! options
7957 parsoid=html2wt
7958 !! html
7959 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
7960 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
7961 !! wikitext
7962 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
7963
7964 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
7965 !! end
7966
7967 !! test
7968 Parsoid: handle constructor well
7969 !! wikitext
7970 [[constructor]]
7971
7972 [[constructor:foo]]
7973 !! html/php
7974 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
7975 </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>
7976 </p>
7977 !! html/parsoid
7978 <p><a rel="mw:WikiLink" href="./Constructor" title="Constructor" data-parsoid="{&quot;stx&quot;:&quot;simple&quot;,&quot;a&quot;:{&quot;href&quot;:&quot;./Constructor&quot;},&quot;sa&quot;:{&quot;href&quot;:&quot;constructor&quot;}}">constructor</a></p>
7979
7980 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid="{&quot;stx&quot;:&quot;simple&quot;,&quot;a&quot;:{&quot;href&quot;:&quot;./Foo&quot;},&quot;sa&quot;:{&quot;href&quot;:&quot;constructor:foo&quot;}}">constructor:foo</a></p>
7981 !! end
7982
7983 !! article
7984 ko:
7985 !! text
7986 Test.
7987 !! endarticle
7988
7989 # Note that `ko` isn't a known interlanguage prefix
7990 !! test
7991 Parsoid: recognize interlanguage links without a target page
7992 !! options
7993 ill
7994 !! wikitext
7995 [[es:]]
7996
7997 [[ko:]]
7998 !! html/php
7999 es:
8000 !! html/parsoid
8001 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
8002
8003 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8004 !! end
8005
8006 # Note that `ko` isn't a known interwiki prefix
8007 !! test
8008 Parsoid: recognize interwiki links without a target page
8009 !! options
8010 parsoid=wt2html,wt2wt,html2html
8011 !! wikitext
8012 [[:es:]]
8013
8014 [[:ko:]]
8015 !! html/php
8016 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
8017 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
8018 </p>
8019 !! html/parsoid
8020 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
8021 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8022 !! end
8023
8024 !! test
8025 Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
8026 !! wikitext
8027 [[mi:Foo]]
8028 !! html/php
8029 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
8030 </p>
8031 !! html/parsoid
8032 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
8033 !! end
8034
8035 !! test
8036 Interlanguage link with preceding local interwiki link (bug 68085)
8037 !! options
8038 parsoid=wt2html,wt2wt,html2html
8039 !! wikitext
8040 Blah blah blah
8041 [[local:es:Spanish]]
8042 !! html/php
8043 <p>Blah blah blah
8044 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
8045 </p>
8046 !! html/parsoid
8047 <p>Blah blah blah
8048 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
8049 !! end
8050
8051 !! test
8052 Looks like an interlanguage link, but is actually a local interwiki
8053 !! options
8054 parsoid=wt2html,wt2wt,html2html
8055 !! wikitext
8056 Blah blah blah
8057 [[mi:Template:Foo]]
8058 !! html/php
8059 <p>Blah blah blah
8060 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
8061 </p>
8062 !! html/parsoid
8063 <p>Blah blah blah
8064 <a rel="mw:WikiLink" href="Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
8065 !! end
8066
8067 ###
8068 ### Redirects, Parsoid-only
8069 ###
8070
8071 !! test
8072 1. Simple redirect to page
8073 !! wikitext
8074 #REDIRECT [[Main Page]]
8075 !! html/parsoid
8076 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8077 !! end
8078
8079 !! test
8080 2. Other redirect variants
8081 !! wikitext
8082 #REDIRECT [[Main_Page]]
8083 !! html/parsoid
8084 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
8085 !! end
8086
8087 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
8088 # This tests the Parsoid bail-out code.
8089 !! test
8090 3. Other redirect variants
8091 !! wikitext
8092 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
8093 !! html/parsoid
8094 <ol><li data-parsoid>REDIRECT [[[[Bar]]]]</li></ol>
8095 !! end
8096
8097 !! test
8098 4. Redirect to a templated destination
8099 !! wikitext
8100 #REDIRECT [[{{echo|Foo}}bar]]
8101 !! html/parsoid
8102 <link typeof="mw:ExpandedAttrs" rel="mw:PageProp/redirect" href="./Foobar" data-mw='{"attribs":[[{"txt":"href"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[12,24,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;Foo&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">Foo&lt;/span>bar"}]]}'/>
8103 !! end
8104
8105 !! test
8106 Empty redirect
8107 !! options
8108 parsoid=wt2html,wt2wt
8109 !! wikitext
8110 #REDIRECT [[]]
8111 !! html/parsoid
8112 <ol>
8113 <li>REDIRECT [[]]</li></ol>
8114 !! end
8115
8116 !! test
8117 Optional colon in #REDIRECT
8118 !! options
8119 # the colon is archaic syntax. we support it for wt2html, but we
8120 # don't care that it roundtrips back to the modern syntax.
8121 parsoid=wt2html,html2html
8122 !! wikitext
8123 #REDIRECT:[[Main Page]]
8124 !! html/parsoid
8125 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8126 !! end
8127
8128 !! test
8129 Whitespace in #REDIRECT with optional colon
8130 !! options
8131 # the colon and gratuitous whitespace is archaic syntax. we support
8132 # it for wt2html, but we don't care that it roundtrips back to the
8133 # modern syntax (without extra whitespace)
8134 parsoid=wt2html,html2html
8135 !! wikitext
8136
8137 #REDIRECT
8138 :
8139 [[Main Page]]
8140 !! html/parsoid
8141 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8142 !! end
8143
8144 !! test
8145 Piped link in #REDIRECT
8146 !! options
8147 # content after piped link is ignored. we support this syntax,
8148 # but don't care that the piped link is lost when we roundtrip this.
8149 parsoid=wt2html
8150 !! wikitext
8151 #REDIRECT [[Main Page|bar]]
8152 !! html/parsoid
8153 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8154 !! end
8155
8156 !! test
8157 Redirect to category (T104502)
8158 !! options
8159 parsoid=wt2html,wt2wt
8160 !! wikitext
8161 #REDIRECT [[Category:Foo]]
8162 !! html/parsoid
8163 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8164 !! end
8165
8166 !! test
8167 Redirect to category with URL encoding (T104502)
8168 !! options
8169 parsoid=wt2html
8170 !! wikitext
8171 #REDIRECT [[Category%3AFoo]]
8172 !! html/parsoid
8173 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8174 !! end
8175
8176 !! test
8177 Redirect to category page
8178 !! wikitext
8179 #REDIRECT [[:Category:Foo]]
8180 !! html/parsoid
8181 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8182 !! end
8183
8184 !! test
8185 Redirect to image page (1)
8186 !! wikitext
8187 #REDIRECT [[File:Wiki.png]]
8188 !! html/parsoid
8189 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
8190 !! end
8191
8192 !! test
8193 Redirect to image page (2)
8194 !! wikitext
8195 #REDIRECT [[Image:Wiki.png]]
8196 !! html/parsoid
8197 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
8198 !! end
8199
8200 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
8201 # Next test confirms this.
8202 !! test
8203 Redirect to language (1) (T104918)
8204 !! options
8205 parsoid=wt2html,wt2wt,html2html
8206 !! wikitext
8207 #REDIRECT [[en:File:Wiki.png]]
8208 !! html/parsoid
8209 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8210 !! end
8211
8212 !! test
8213 Redirect to language (2) (T104918)
8214 !! wikitext
8215 #REDIRECT [[:en:File:Wiki.png]]
8216 !! html/parsoid
8217 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8218 !! end
8219
8220 !! test
8221 Redirect to interwiki (T104918)
8222 !! wikitext
8223 #REDIRECT [[meatball:File:Wiki.png]]
8224 !! html/parsoid
8225 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
8226 !! end
8227
8228 !! test
8229 Non-English #REDIRECT
8230 !! options
8231 language=is
8232 !! wikitext
8233 #TILVÍSUN [[Main Page]]
8234 !! html/parsoid
8235 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
8236 !! end
8237
8238 !! test
8239 Redirect syntax under text isn't considered a redirect
8240 !! wikitext
8241 some text
8242 #redirect [[Main Page]]
8243 !! html/parsoid
8244 <p>some text</p>
8245 <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>
8246 !! end
8247
8248 # FIXME: Should hoist the redirect to the top of the page and ensure there
8249 # is only one.
8250 !! test
8251 New redirect
8252 !! options
8253 parsoid=html2wt
8254 !! html/parsoid
8255 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
8256 !! wikitext
8257 Foo
8258 #REDIRECT [[Foo]]
8259 !! end
8260
8261 ##
8262 ## XHTML tidiness
8263 ###
8264
8265 !! test
8266 <br> to <br />
8267 !! wikitext
8268 1<br>2<br />3
8269 !! html
8270 <p>1<br />2<br />3
8271 </p>
8272 !! end
8273
8274 !! test
8275 Broken br tag sanitization
8276 !! wikitext
8277 </br>
8278 !! html/php
8279 <p>&lt;/br&gt;
8280 </p>
8281 !! end
8282
8283 # TODO: Fix html2html mode (bug 51055)!
8284 !! test
8285 Parsoid: Broken br tag recognition
8286 !! options
8287 parsoid=wt2html
8288 !! wikitext
8289 </br>
8290
8291 <br/ >
8292 !! html+tidy
8293 <p><br /></p>
8294 <p><br /></p>
8295 !! end
8296
8297 !! test
8298 Incorrecly removing closing slashes from correctly formed XHTML
8299 !! wikitext
8300 <br style="clear:both;" />
8301 !! html
8302 <p><br style="clear:both;" />
8303 </p>
8304 !! end
8305
8306 !! test
8307 Failing to transform badly formed HTML into correct XHTML
8308 !! wikitext
8309 <br style="clear: left;">
8310 <br style="clear: right;">
8311 <br style="clear: both;">
8312 !! html
8313 <p><br style="clear: left;" />
8314 <br style="clear: right;" />
8315 <br style="clear: both;" />
8316 </p>
8317 !!end
8318
8319 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
8320 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
8321 !! test
8322 Handling html with a div self-closing tag
8323 !! wikitext
8324 <div title />
8325 <div title/>
8326 <div title/ >
8327 <div title=bar />
8328 <div title=bar/>
8329 <div title=bar/ >
8330 !! html/php
8331 <p>&lt;div title /&gt;
8332 &lt;div title/&gt;
8333 </p>
8334 <div>
8335 <p>&lt;div title=bar /&gt;
8336 &lt;div title=bar/&gt;
8337 </p>
8338 <div title="bar/"></div>
8339 </div>
8340
8341 !! html/parsoid
8342 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8343 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8344 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
8345 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8346 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8347 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
8348 !! end
8349
8350 !! test
8351 Handling html with a br self-closing tag
8352 !! wikitext
8353 <br title />
8354 <br title/>
8355 <br title/ >
8356 <br title=bar />
8357 <br title=bar/>
8358 <br title=bar/ >
8359 !! html/php
8360 <p><br title="" />
8361 <br title="" />
8362 <br />
8363 <br title="bar" />
8364 <br title="bar" />
8365 <br title="bar/" />
8366 </p>
8367 !! html/parsoid
8368 <p><br title="" />
8369 <br title="" />
8370 <br title="" />
8371 <br title="bar" />
8372 <br title="bar" />
8373 <br title="bar/" />
8374 </p>
8375 !! end
8376
8377 !! test
8378 Horizontal ruler (should it add that extra space?)
8379 !! wikitext
8380 <hr>
8381 <hr >
8382 foo <hr
8383 > bar
8384 !! html+tidy
8385 <hr />
8386 <hr />
8387 <p>foo</p>
8388 <hr />
8389 <p>bar</p>
8390 !! end
8391
8392 !! test
8393 Horizontal ruler -- 4+ dashes render hr
8394 !! wikitext
8395 ----
8396 !! html
8397 <hr />
8398
8399 !! end
8400
8401 !! test
8402 Horizontal ruler -- eats additional dashes on the same line
8403 !! wikitext
8404 ---------
8405 !! html
8406 <hr />
8407
8408 !! end
8409
8410 !! test
8411 Horizontal ruler -- does not collapse dashes on consecutive lines
8412 !! wikitext
8413 ----
8414 ----
8415 !! html
8416 <hr />
8417 <hr />
8418
8419 !! end
8420
8421 !! test
8422 Horizontal ruler -- <4 dashes render as plain text
8423 !! wikitext
8424 ---
8425 !! html
8426 <p>---
8427 </p>
8428 !! end
8429
8430 !! test
8431 Horizontal ruler -- Supports content following dashes on same line
8432 !! wikitext
8433 ---- Foo
8434 !! html
8435 <hr /> Foo
8436
8437 !! html+tidy
8438 <hr />
8439 <p>Foo</p>
8440 !! end
8441
8442 ###
8443 ### Block-level elements
8444 ###
8445 !! test
8446 Common list
8447 !! wikitext
8448 *Common list
8449 * item 2
8450 *item 3
8451 !! html
8452 <ul><li>Common list</li>
8453 <li> item 2</li>
8454 <li>item 3</li></ul>
8455
8456 !! end
8457
8458 !! test
8459 Numbered list
8460 !! wikitext
8461 #Numbered list
8462 #item 2
8463 # item 3
8464 !! html
8465 <ol><li>Numbered list</li>
8466 <li>item 2</li>
8467 <li> item 3</li></ol>
8468
8469 !! end
8470
8471 !! test
8472 Mixed list
8473 !! wikitext
8474 *Mixed list
8475 *# with numbers
8476 ** and bullets
8477 *# and numbers
8478 *bullets again
8479 **bullet level 2
8480 ***bullet level 3
8481 ***#Number on level 4
8482 **bullet level 2
8483 **#Number on level 3
8484 **#Number on level 3
8485 *#number level 2
8486 *Level 1
8487 *** Level 3
8488 #** Level 3, but ordered
8489 !! html
8490 <ul><li>Mixed list
8491 <ol><li> with numbers</li></ol>
8492 <ul><li> and bullets</li></ul>
8493 <ol><li> and numbers</li></ol></li>
8494 <li>bullets again
8495 <ul><li>bullet level 2
8496 <ul><li>bullet level 3
8497 <ol><li>Number on level 4</li></ol></li></ul></li>
8498 <li>bullet level 2
8499 <ol><li>Number on level 3</li>
8500 <li>Number on level 3</li></ol></li></ul>
8501 <ol><li>number level 2</li></ol></li>
8502 <li>Level 1
8503 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
8504 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
8505
8506 !! end
8507
8508 !! test
8509 Nested lists 1
8510 !! wikitext
8511 *foo
8512 **bar
8513 !! html
8514 <ul><li>foo
8515 <ul><li>bar</li></ul></li></ul>
8516
8517 !! end
8518
8519 !! test
8520 Nested lists 2
8521 !! wikitext
8522 **foo
8523 *bar
8524 !! html
8525 <ul><li><ul><li>foo</li></ul></li>
8526 <li>bar</li></ul>
8527
8528 !! end
8529
8530 !! test
8531 Nested lists 3 (first element empty)
8532 !! wikitext
8533 *
8534 **bar
8535 !! html
8536 <ul><li>
8537 <ul><li>bar</li></ul></li></ul>
8538
8539 !! end
8540
8541 !! test
8542 Nested lists 4 (first element empty)
8543 !! wikitext
8544 **
8545 *bar
8546 !! html
8547 <ul><li><ul><li></li></ul></li>
8548 <li>bar</li></ul>
8549
8550 !! end
8551
8552 !! test
8553 Nested lists 5 (both elements empty)
8554 !! wikitext
8555 **
8556 *
8557 !! html
8558 <ul><li><ul><li></li></ul></li>
8559 <li></li></ul>
8560
8561 !! end
8562
8563 !! test
8564 Nested lists 6 (both elements empty)
8565 !! wikitext
8566 *
8567 **
8568 !! html
8569 <ul><li>
8570 <ul><li></li></ul></li></ul>
8571
8572 !! end
8573
8574 !! test
8575 Nested lists 7 (skip initial nesting levels)
8576 !! wikitext
8577 *** foo
8578 !! html
8579 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
8580
8581 !! end
8582
8583 !! test
8584 Nested lists 8 (multiple nesting transitions)
8585 !! wikitext
8586 * foo
8587 *** bar
8588 ** baz
8589 * boo
8590 !! html
8591 <ul><li> foo
8592 <ul><li><ul><li> bar</li></ul></li>
8593 <li> baz</li></ul></li>
8594 <li> boo</li></ul>
8595
8596 !! end
8597
8598 !! test
8599 Nested lists 9 (extension interaction)
8600 !! options
8601 parsoid
8602 !! wikitext
8603 *<references />
8604 !! html/parsoid
8605 <ul><li data-parsoid='{}'><ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
8606 !! end
8607
8608 !! test
8609 1. Lists with start-of-line-transparent tokens before bullets: Comments
8610 !! wikitext
8611 *foo
8612 *<!--cmt-->bar
8613 <!--cmt-->*baz
8614 !! html
8615 <ul><li>foo</li>
8616 <li>bar</li>
8617 <li>baz</li></ul>
8618
8619 !! end
8620
8621 !! test
8622 2. Lists with start-of-line-transparent tokens before bullets: Template close
8623 !! wikitext
8624 *foo {{echo|bar
8625 }}*baz
8626 !! html
8627 <ul><li>foo bar</li>
8628 <li>baz</li></ul>
8629
8630 !! end
8631
8632 !! test
8633 List items are not parsed correctly following a <pre> block (bug 785)
8634 !! wikitext
8635 * <pre>foo</pre>
8636 * <pre>bar</pre>
8637 * zar
8638 !! html/php
8639 <ul><li> <pre>foo</pre></li>
8640 <li> <pre>bar</pre></li>
8641 <li> zar</li></ul>
8642
8643 !! html/parsoid
8644 <ul><li> <pre data-parsoid='{"stx":"html"}'>foo</pre></li>
8645 <li> <pre data-parsoid='{"stx":"html"}'>bar</pre></li>
8646 <li> zar</li></ul>
8647 !! end
8648
8649 !! test
8650 List items from template
8651 !! wikitext
8652
8653 {{inner list}}
8654 * item 2
8655
8656 * item 0
8657 {{inner list}}
8658 * item 2
8659
8660 * item 0
8661 * notSOL{{inner list}}
8662 * item 2
8663 !! html
8664 <ul><li> item 1</li>
8665 <li> item 2</li></ul>
8666 <ul><li> item 0</li>
8667 <li> item 1</li>
8668 <li> item 2</li></ul>
8669 <ul><li> item 0</li>
8670 <li> notSOL</li>
8671 <li> item 1</li>
8672 <li> item 2</li></ul>
8673
8674 !! end
8675
8676 !! test
8677 List interrupted by empty line or heading
8678 !! wikitext
8679 * foo
8680
8681 ** bar
8682 == A heading ==
8683 * Another list item
8684 !! html
8685 <ul><li> foo</li></ul>
8686 <ul><li><ul><li> bar</li></ul></li></ul>
8687 <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>
8688 <ul><li> Another list item</li></ul>
8689
8690 !!end
8691
8692 !!test
8693 Multiple list tags generated by templates
8694 !! wikitext
8695 {{echo|<li>}}a
8696 {{echo|<li>}}b
8697 {{echo|<li>}}c
8698 !! html
8699 <li>a
8700 <li>b
8701 <li>c</li>
8702 </li>
8703 </li>
8704
8705 !! html+tidy
8706 <ul>
8707 <li>a</li>
8708 <li>b</li>
8709 <li>c</li>
8710 </ul>
8711 !!end
8712
8713 !!test
8714 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
8715 !! wikitext
8716 *a
8717 <!--This line will NOT split the list-->
8718 *b
8719 <!--This line will NOT split the list either-->
8720 *c
8721 <!--foo--> <!----> <!--This line NOT split the list either-->
8722 *d
8723 !! html
8724 <ul><li>a</li>
8725 <li>b</li>
8726 <li>c</li>
8727 <li>d</li></ul>
8728
8729 !!end
8730
8731 !!test
8732 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
8733 !! wikitext
8734 *a
8735 <!--This line will NOT split the list-->
8736 *b
8737 <!--This line will NOT split the list either-->
8738 *c
8739 <!--foo--> <!----> <!--This line NOT split the list
8740 either-->
8741 *d
8742 !! html
8743 <ul><li>a</li>
8744 <li>b</li>
8745 <li>c</li>
8746 <li>d</li></ul>
8747
8748 !!end
8749
8750 !!test
8751 Test the li-hack
8752 (The PHP parser relies on Tidy for the hack)
8753 !!options
8754 parsoid=wt2html,wt2wt
8755 !! wikitext
8756 * foo
8757 * <li>li-hack
8758 * {{echo|<li>templated li-hack}}
8759 * <!--foo--> <li> unsupported li-hack with preceding comments
8760
8761 <ul>
8762 <li><li>not a li-hack
8763 </li>
8764 </ul>
8765 !! html+tidy
8766 <ul>
8767 <li>foo</li>
8768 <li>li-hack</li>
8769 <li>templated li-hack</li>
8770 <li>unsupported li-hack with preceding comments</li>
8771 </ul>
8772 <ul>
8773 <li>not a li-hack</li>
8774 </ul>
8775 !!end
8776
8777 !! test
8778 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
8779 !! options
8780 parsoid
8781 !! wikitext
8782 # foo
8783 ## bar
8784 * foo
8785 ** bar
8786 : foo
8787 :: bar
8788 !! html
8789 <ol>
8790 <li> foo<ol>
8791 <li> bar</li>
8792 </ol></li>
8793 </ol><ul>
8794 <li> foo<ul>
8795 <li> bar</li>
8796 </ul></li>
8797 </ul><dl>
8798 <dd> foo<dl>
8799 <dd> bar</dd>
8800 </dl></dd>
8801 </dl>
8802 !! end
8803
8804 !! test
8805 Parsoid: Test of whitespace serialization with Templated bullets
8806 !! options
8807 parsoid
8808 !! wikitext
8809 * {{bullet}}
8810 !! html
8811 <ul>
8812 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
8813 </ul>
8814 !! end
8815
8816 # ------------------------------------------------------------------------
8817 # The next set of tests are about Parsoid's ability to handle badly nested
8818 # tags (parse, minimize scope of fixup, and roundtrip back)
8819 # ------------------------------------------------------------------------
8820
8821 !! test
8822 Unbalanced closing block tags break a list
8823 (php parser relies on Tidy to fix up)
8824 !! wikitext
8825 <div>
8826 *a</div><div>
8827 *b</div>
8828 !! html+tidy
8829 <div>
8830 <ul>
8831 <li>a</li>
8832 </ul>
8833 </div>
8834 <div>
8835 <ul>
8836 <li>b</li>
8837 </ul>
8838 </div>
8839 !! end
8840
8841 # Parsoid fails this test, but it might be tricky to support properly.
8842 # See bug 68395.
8843 !! test
8844 Unbalanced closing non-block tags don't break a list
8845 (php parser relies on Tidy to fix up)
8846 !! wikitext
8847 <span>
8848 *a</span><span>
8849 *b</span>
8850 !! html/php+tidy
8851 <ul>
8852 <li><span>a</span></li>
8853 <li><span>b</span></li>
8854 </ul>
8855 !! html/parsoid
8856 <span>
8857 <ul>
8858 <li>a<span></span>
8859 </li>
8860 <li>b
8861 </li>
8862 </ul>
8863 </span>
8864 !! end
8865
8866 !! test
8867 Unclosed formatting tags that straddle lists are closed and reopened
8868 (php parser relies on Tidy to fix up)
8869 !! options
8870 parsoid=wt2html,wt2wt,html2html
8871 !! wikitext
8872 # <s> a
8873 # b </s>
8874 !! html/php+tidy
8875 <ol>
8876 <li><s>a</s></li>
8877 <li><s>b</s></li>
8878 </ol>
8879 !! html/parsoid
8880 <ol><li> <s> a</s></li>
8881 <li><s> b </s></li></ol>
8882 !! end
8883
8884 # See bug 68395.
8885 !!test
8886 1. List embedded in a formatting tag
8887 !! wikitext
8888 <small>
8889 * foo
8890 </small>
8891 !! html/php+tidy
8892 <ul>
8893 <li><small>foo</small></li>
8894 </ul>
8895 !! html/parsoid
8896 <small>
8897 <ul>
8898 <li> foo</li>
8899 </ul>
8900 </small>
8901 !!end
8902
8903 ## Ugly Parsoid output here
8904 ## Not sure what the right output is.
8905 !!test
8906 2. List embedded in a formatting tag
8907 !! wikitext
8908 <small>
8909 *a
8910 *b</small>
8911 !! html/php+tidy
8912 <ul>
8913 <li><small>a</small></li>
8914 <li><small>b</small></li>
8915 </ul>
8916 !! html/parsoid
8917 <small></small>
8918 <ul><small>
8919 <li>a</li>
8920 </small>
8921 <li><small>b</small></li>
8922 </ul>
8923 !!end
8924
8925 # Ugly Parsoid and PHP parser output here
8926 # Not sure if we want to make this a test!
8927 #
8928 ## !!test
8929 ## 3. Unclosed formatting tags in list elements
8930 ## !! wikitext
8931 ## *<small>a
8932 ## *<small>b
8933 ## !! html/php+tidy
8934 ## <ul>
8935 ## <li><small>a</small></li>
8936 ## <li><small><small>b</small></small></li>
8937 ## </ul>
8938 ## !! html/parsoid
8939 ## <ul>
8940 ## <li><small>a</small></li>
8941 ## <small>
8942 ## <li><small>b</small></li>
8943 ## </small></ul>
8944 ## !!end
8945
8946 # This is a bug in the PHP parser + tidy combination.
8947 # (The </tr> tag gets parsed as text and html-escaped by PHP,
8948 # and then fostered out of the table by tidy.)
8949 # We believe the Parsoid output to be correct.
8950 !! test
8951 Table with missing opening <tr> tag
8952 !! options
8953 parsoid=wt2html,wt2wt
8954 !! wikitext
8955 <table>
8956 <td>foo</td>
8957 </tr>
8958 </table>
8959 !! html+tidy
8960 <table>
8961 <tr>
8962 <td>foo</td>
8963 </tr>
8964 </table>
8965 !! end
8966
8967 ###
8968 ### Magic Words
8969 ###
8970
8971 # Note that the current date is hard-coded as
8972 # 1970-01-01T00:02:03Z (a Thursday)
8973 # when running parser tests. The timezone is also fixed to GMT, so
8974 # local date will be identical to current date.
8975
8976 !! test
8977 Magic Word: {{CURRENTDAY}}
8978 !! wikitext
8979 {{CURRENTDAY}}
8980 !! html
8981 <p>1
8982 </p>
8983 !! end
8984
8985 !! test
8986 Magic Word: {{CURRENTDAY2}}
8987 !! wikitext
8988 {{CURRENTDAY2}}
8989 !! html
8990 <p>01
8991 </p>
8992 !! end
8993
8994 !! test
8995 Magic Word: {{CURRENTDAYNAME}}
8996 !! wikitext
8997 {{CURRENTDAYNAME}}
8998 !! html
8999 <p>Thursday
9000 </p>
9001 !! end
9002
9003 !! test
9004 Magic Word: {{CURRENTDOW}}
9005 !! wikitext
9006 {{CURRENTDOW}}
9007 !! html
9008 <p>4
9009 </p>
9010 !! end
9011
9012 !! test
9013 Magic Word: {{CURRENTMONTH}}
9014 !! wikitext
9015 {{CURRENTMONTH}}
9016 !! html
9017 <p>01
9018 </p>
9019 !! end
9020
9021 !! test
9022 Magic Word: {{CURRENTMONTH1}}
9023 !! wikitext
9024 {{CURRENTMONTH1}}
9025 !! html
9026 <p>1
9027 </p>
9028 !! end
9029
9030 !! test
9031 Magic Word: {{CURRENTMONTHABBREV}}
9032 !! wikitext
9033 {{CURRENTMONTHABBREV}}
9034 !! html
9035 <p>Jan
9036 </p>
9037 !! end
9038
9039 !! test
9040 Magic Word: {{CURRENTMONTHNAME}}
9041 !! wikitext
9042 {{CURRENTMONTHNAME}}
9043 !! html
9044 <p>January
9045 </p>
9046 !! end
9047
9048 !! test
9049 Magic Word: {{CURRENTMONTHNAMEGEN}}
9050 !! wikitext
9051 {{CURRENTMONTHNAMEGEN}}
9052 !! html
9053 <p>January
9054 </p>
9055 !! end
9056
9057 !! test
9058 Magic Word: {{CURRENTTIME}}
9059 !! wikitext
9060 {{CURRENTTIME}}
9061 !! html
9062 <p>00:02
9063 </p>
9064 !! end
9065
9066 !! test
9067 Magic Word: {{CURRENTHOUR}}
9068 !! wikitext
9069 {{CURRENTHOUR}}
9070 !! html
9071 <p>00
9072 </p>
9073 !! end
9074
9075 !! test
9076 Magic Word: {{CURRENTWEEK}} (@bug 4594)
9077 !! wikitext
9078 {{CURRENTWEEK}}
9079 !! html
9080 <p>1
9081 </p>
9082 !! end
9083
9084 !! test
9085 Magic Word: {{CURRENTYEAR}}
9086 !! wikitext
9087 {{CURRENTYEAR}}
9088 !! html
9089 <p>1970
9090 </p>
9091 !! end
9092
9093 !! test
9094 Magic Word: {{CURRENTTIMESTAMP}}
9095 !! wikitext
9096 {{CURRENTTIMESTAMP}}
9097 !! html
9098 <p>19700101000203
9099 </p>
9100 !! end
9101
9102 !! test
9103 Magic Words LOCAL (UTC)
9104 !! wikitext
9105 * {{LOCALMONTH}}
9106 * {{LOCALMONTH1}}
9107 * {{LOCALMONTHNAME}}
9108 * {{LOCALMONTHNAMEGEN}}
9109 * {{LOCALMONTHABBREV}}
9110 * {{LOCALDAY}}
9111 * {{LOCALDAY2}}
9112 * {{LOCALDAYNAME}}
9113 * {{LOCALYEAR}}
9114 * {{LOCALTIME}}
9115 * {{LOCALHOUR}}
9116 * {{LOCALWEEK}}
9117 * {{LOCALDOW}}
9118 * {{LOCALTIMESTAMP}}
9119 !! html
9120 <ul><li> 01</li>
9121 <li> 1</li>
9122 <li> January</li>
9123 <li> January</li>
9124 <li> Jan</li>
9125 <li> 1</li>
9126 <li> 01</li>
9127 <li> Thursday</li>
9128 <li> 1970</li>
9129 <li> 00:02</li>
9130 <li> 00</li>
9131 <li> 1</li>
9132 <li> 4</li>
9133 <li> 19700101000203</li></ul>
9134
9135 !! end
9136
9137 !! test
9138 Magic Word: {{FULLPAGENAME}}
9139 !! options
9140 title=[[User:Ævar Arnfjörð Bjarmason]]
9141 !! wikitext
9142 {{FULLPAGENAME}}
9143 !! html
9144 <p>User:Ævar Arnfjörð Bjarmason
9145 </p>
9146 !! end
9147
9148 !! test
9149 Magic Word: {{FULLPAGENAMEE}}
9150 !! options
9151 title=[[User:Ævar Arnfjörð Bjarmason]]
9152 !! wikitext
9153 {{FULLPAGENAMEE}}
9154 !! html
9155 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9156 </p>
9157 !! end
9158
9159 !! test
9160 Magic Word: {{TALKSPACE}}
9161 !! options
9162 title=[[User:Ævar Arnfjörð Bjarmason]]
9163 !! wikitext
9164 {{TALKSPACE}}
9165 !! html
9166 <p>User talk
9167 </p>
9168 !! end
9169
9170 !! test
9171 Magic Word: {{TALKSPACE}}, same namespace
9172 !! options
9173 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9174 !! wikitext
9175 {{TALKSPACE}}
9176 !! html
9177 <p>User talk
9178 </p>
9179 !! end
9180
9181 !! test
9182 Magic Word: {{TALKSPACE}}, main namespace
9183 !! options
9184 title=[[Parser Test]]
9185 !! wikitext
9186 {{TALKSPACE}}
9187 !! html
9188 <p>Talk
9189 </p>
9190 !! end
9191
9192 !! test
9193 Magic Word: {{TALKSPACEE}}
9194 !! options
9195 title=[[User:Ævar Arnfjörð Bjarmason]]
9196 !! wikitext
9197 {{TALKSPACEE}}
9198 !! html
9199 <p>User_talk
9200 </p>
9201 !! end
9202
9203 !! test
9204 Magic Word: {{SUBJECTSPACE}}
9205 !! options
9206 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9207 !! wikitext
9208 {{SUBJECTSPACE}}
9209 !! html
9210 <p>User
9211 </p>
9212 !! end
9213
9214 !! test
9215 Magic Word: {{SUBJECTSPACE}}, same namespace
9216 !! options
9217 title=[[User:Ævar Arnfjörð Bjarmason]]
9218 !! wikitext
9219 {{SUBJECTSPACE}}
9220 !! html
9221 <p>User
9222 </p>
9223 !! end
9224
9225 !! test
9226 Magic Word: {{SUBJECTSPACE}}, main namespace
9227 !! options
9228 title=[[Parser Test]]
9229 !! wikitext
9230 {{SUBJECTSPACE}}
9231 !! html
9232
9233 !! end
9234
9235 !! test
9236 Magic Word: {{SUBJECTSPACEE}}
9237 !! options
9238 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9239 !! wikitext
9240 {{SUBJECTSPACEE}}
9241 !! html
9242 <p>User
9243 </p>
9244 !! end
9245
9246 !! test
9247 Magic Word: {{NAMESPACE}}
9248 !! options
9249 title=[[User:Ævar Arnfjörð Bjarmason]]
9250 !! wikitext
9251 {{NAMESPACE}}
9252 !! html
9253 <p>User
9254 </p>
9255 !! end
9256
9257 !! test
9258 Magic Word: {{NAMESPACEE}}
9259 !! options
9260 title=[[User:Ævar Arnfjörð Bjarmason]]
9261 !! wikitext
9262 {{NAMESPACEE}}
9263 !! html
9264 <p>User
9265 </p>
9266 !! end
9267
9268 !! test
9269 Magic Word: {{NAMESPACENUMBER}}
9270 !! options
9271 title=[[User:Ævar Arnfjörð Bjarmason]]
9272 !! wikitext
9273 {{NAMESPACENUMBER}}
9274 !! html
9275 <p>2
9276 </p>
9277 !! end
9278
9279 !! test
9280 Magic Word: {{SUBPAGENAME}}
9281 !! options
9282 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9283 !! wikitext
9284 {{SUBPAGENAME}}
9285 !! html
9286 <p>sub ö
9287 </p>
9288 !! end
9289
9290 !! test
9291 Magic Word: {{SUBPAGENAMEE}}
9292 !! options
9293 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9294 !! wikitext
9295 {{SUBPAGENAMEE}}
9296 !! html
9297 <p>sub_%C3%B6
9298 </p>
9299 !! end
9300
9301 !! test
9302 Magic Word: {{ROOTPAGENAME}}
9303 !! options
9304 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9305 !! wikitext
9306 {{ROOTPAGENAME}}
9307 !! html
9308 <p>Ævar Arnfjörð Bjarmason
9309 </p>
9310 !! end
9311
9312 !! test
9313 Magic Word: {{ROOTPAGENAMEE}}
9314 !! options
9315 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9316 !! wikitext
9317 {{ROOTPAGENAMEE}}
9318 !! html
9319 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9320 </p>
9321 !! end
9322
9323 !! test
9324 Magic Word: {{BASEPAGENAME}}
9325 !! options
9326 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9327 !! wikitext
9328 {{BASEPAGENAME}}
9329 !! html
9330 <p>Ævar Arnfjörð Bjarmason
9331 </p>
9332 !! end
9333
9334 !! test
9335 Magic Word: {{BASEPAGENAMEE}}
9336 !! options
9337 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9338 !! wikitext
9339 {{BASEPAGENAMEE}}
9340 !! html
9341 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9342 </p>
9343 !! end
9344
9345 !! test
9346 Magic Word: {{TALKPAGENAME}}
9347 !! options
9348 title=[[User:Ævar Arnfjörð Bjarmason]]
9349 !! wikitext
9350 {{TALKPAGENAME}}
9351 !! html
9352 <p>User talk:Ævar Arnfjörð Bjarmason
9353 </p>
9354 !! end
9355
9356 !! test
9357 Magic Word: {{TALKPAGENAMEE}}
9358 !! options
9359 title=[[User:Ævar Arnfjörð Bjarmason]]
9360 !! wikitext
9361 {{TALKPAGENAMEE}}
9362 !! html
9363 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9364 </p>
9365 !! end
9366
9367 !! test
9368 Magic Word: {{SUBJECTPAGENAME}}
9369 !! options
9370 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9371 !! wikitext
9372 {{SUBJECTPAGENAME}}
9373 !! html
9374 <p>User:Ævar Arnfjörð Bjarmason
9375 </p>
9376 !! end
9377
9378 !! test
9379 Magic Word: {{SUBJECTPAGENAMEE}}
9380 !! options
9381 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9382 !! wikitext
9383 {{SUBJECTPAGENAMEE}}
9384 !! html
9385 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9386 </p>
9387 !! end
9388
9389 !! test
9390 Magic Word: {{NUMBEROFFILES}}
9391 !! wikitext
9392 {{NUMBEROFFILES}}
9393 !! html
9394 <p>5
9395 </p>
9396 !! end
9397
9398 !! test
9399 Magic Word: {{PAGENAME}}
9400 !! options
9401 title=[[User:Ævar Arnfjörð Bjarmason]]
9402 !! wikitext
9403 {{PAGENAME}}
9404 !! html
9405 <p>Ævar Arnfjörð Bjarmason
9406 </p>
9407 !! end
9408
9409 !! test
9410 Magic Word: {{PAGENAME}} with metacharacters
9411 !! options
9412 title=[['foo & bar = baz']]
9413 !! wikitext
9414 ''{{PAGENAME}}''
9415 !! html/php
9416 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
9417 </p>
9418 !! html+tidy
9419 <p><i>'foo &amp; bar = baz'</i></p>
9420 !! end
9421
9422 !! test
9423 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
9424 !! options
9425 title=[[*RFC 1234 http://example.com/]]
9426 !! wikitext
9427 {{PAGENAME}}
9428 !! html/php
9429 <p>&#42;RFC&#32;1234 http&#58;//example.com/
9430 </p>
9431 !! html+tidy
9432 <p>*RFC 1234 http://example.com/</p>
9433 !! end
9434
9435 !! test
9436 Magic Word: {{PAGENAMEE}}
9437 !! options
9438 title=[[User:Ævar Arnfjörð Bjarmason]]
9439 !! wikitext
9440 {{PAGENAMEE}}
9441 !! html
9442 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9443 </p>
9444 !! end
9445
9446 !! test
9447 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
9448 !! options
9449 title=[[*RFC 1234 http://example.com/]]
9450 !! wikitext
9451 {{PAGENAMEE}}
9452 !! html/php
9453 <p>&#42;RFC_1234_http&#58;//example.com/
9454 </p>
9455 !! html+tidy
9456 <p>*RFC_1234_http://example.com/</p>
9457 !! end
9458
9459 !! test
9460 Magic Word: {{REVISIONID}}
9461 !! wikitext
9462 {{REVISIONID}}
9463 !! html
9464 <p>1337
9465 </p>
9466 !! end
9467
9468 !! test
9469 Magic Word: {{SCRIPTPATH}}
9470 !! wikitext
9471 {{SCRIPTPATH}}
9472 !! html
9473 <p>/
9474 </p>
9475 !! end
9476
9477 !! test
9478 Magic Word: {{STYLEPATH}}
9479 !! wikitext
9480 {{STYLEPATH}}
9481 !! html
9482 <p>/skins
9483 </p>
9484 !! end
9485
9486 !! test
9487 Magic Word: {{SERVER}}
9488 !! wikitext
9489 {{SERVER}}
9490 !! html
9491 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9492 </p>
9493 !! end
9494
9495 !! test
9496 Magic Word: {{SERVERNAME}}
9497 !! wikitext
9498 {{SERVERNAME}}
9499 !! html
9500 <p>example.org
9501 </p>
9502 !! end
9503
9504 !! test
9505 Magic Word: {{SITENAME}}
9506 !! wikitext
9507 {{SITENAME}}
9508 !! html
9509 <p>MediaWiki
9510 </p>
9511 !! end
9512
9513 !! test
9514 Case-sensitive magic words, when cased differently, should just be template transclusions
9515 !! wikitext
9516 {{CurrentMonth}}
9517 {{currentday}}
9518 {{cURreNTweEK}}
9519 {{currentHour}}
9520 !! html
9521 <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>
9522 <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>
9523 <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>
9524 <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>
9525 </p>
9526 !! end
9527
9528 !! test
9529 Case-insensitive magic words should still work with weird casing.
9530 !! wikitext
9531 {{sErVeRNaMe}}
9532 {{LCFirst:AOEU}}
9533 {{ucFIRST:aoeu}}
9534 {{SERver}}
9535 !! html
9536 <p>example.org
9537 aOEU
9538 Aoeu
9539 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9540 </p>
9541 !! end
9542
9543 # From plwiki:PLOS_ONE
9544 !! test
9545 Parsoid: Page property magic word with magic word contents
9546 !! wikitext
9547 {{DISPLAYTITLE:''{{PAGENAME}}''}}
9548 !! html/parsoid
9549 <meta property="mw:PageProp/displaytitle" content="Main Page" about="#mwt2" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"content"},{"html":"&lt;i data-parsoid=\"{&amp;quot;dsr&amp;quot;:[15,31,2,2]}\">&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[]],&amp;quot;dsr&amp;quot;:[17,29,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;PAGENAME&amp;quot;,&amp;quot;function&amp;quot;:&amp;quot;pagename&amp;quot;},&amp;quot;params&amp;quot;:{},&amp;quot;i&amp;quot;:0}}]}\">Main Page&lt;/span>&lt;/i>"}]]}'/>
9550 !! end
9551
9552 !! test
9553 Parsoid: Template-generated DISPLAYTITLE
9554 !! wikitext
9555 {{{{echo|DISPLAYTITLE}}:Foo}}
9556 !! html/parsoid
9557 <meta property="mw:PageProp/displaytitle" content="Foo" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"dsr":[0,29,null,null],"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"{{echo|DISPLAYTITLE}}:Foo"},"params":{},"i":0}}]}'/>
9558 !! end
9559
9560 !! test
9561 Namespace 1 {{ns:1}}
9562 !! wikitext
9563 {{ns:1}}
9564 !! html
9565 <p>Talk
9566 </p>
9567 !! end
9568
9569 !! test
9570 Namespace 1 {{ns:01}}
9571 !! wikitext
9572 {{ns:01}}
9573 !! html
9574 <p>Talk
9575 </p>
9576 !! end
9577
9578 !! test
9579 Namespace 0 {{ns:0}} (bug 4783)
9580 !! wikitext
9581 {{ns:0}}
9582 !! html
9583
9584 !! end
9585
9586 !! test
9587 Namespace 0 {{ns:00}} (bug 4783)
9588 !! wikitext
9589 {{ns:00}}
9590 !! html
9591
9592 !! end
9593
9594 !! test
9595 Namespace -1 {{ns:-1}}
9596 !! wikitext
9597 {{ns:-1}}
9598 !! html
9599 <p>Special
9600 </p>
9601 !! end
9602
9603 !! test
9604 Namespace User {{ns:User}}
9605 !! wikitext
9606 {{ns:User}}
9607 !! html
9608 <p>User
9609 </p>
9610 !! end
9611
9612 !! test
9613 Namespace User talk {{ns:User_talk}}
9614 !! wikitext
9615 {{ns:User_talk}}
9616 !! html
9617 <p>User talk
9618 </p>
9619 !! end
9620
9621 !! test
9622 Namespace User talk {{ns:uSeR tAlK}}
9623 !! wikitext
9624 {{ns:uSeR tAlK}}
9625 !! html
9626 <p>User talk
9627 </p>
9628 !! end
9629
9630 !! test
9631 Namespace File {{ns:File}}
9632 !! wikitext
9633 {{ns:File}}
9634 !! html
9635 <p>File
9636 </p>
9637 !! end
9638
9639 !! test
9640 Namespace File {{ns:Image}}
9641 !! wikitext
9642 {{ns:Image}}
9643 !! html
9644 <p>File
9645 </p>
9646 !! end
9647
9648 !! test
9649 Namespace (lang=de) Benutzer {{ns:User}}
9650 !! options
9651 language=de
9652 !! wikitext
9653 {{ns:User}}
9654 !! html
9655 <p>Benutzer
9656 </p>
9657 !! end
9658
9659 !! test
9660 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
9661 !! options
9662 language=de
9663 !! wikitext
9664 {{ns:3}}
9665 !! html
9666 <p>Benutzer Diskussion
9667 </p>
9668 !! end
9669
9670
9671 !! test
9672 Urlencode
9673 !! wikitext
9674 {{urlencode:hi world?!}}
9675 {{urlencode:hi world?!|WIKI}}
9676 {{urlencode:hi world?!|PATH}}
9677 {{urlencode:hi world?!|QUERY}}
9678 !! html
9679 <p>hi+world%3F%21
9680 hi_world%3F!
9681 hi%20world%3F%21
9682 hi+world%3F%21
9683 </p>
9684 !! end
9685
9686 !! test
9687 Magic Word: prioritize type info over data-parsoid
9688 !! options
9689 parsoid=html2wt
9690 !! html/parsoid
9691 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
9692 !! wikitext
9693 __FORCETOC__
9694 !! end
9695
9696 !! test
9697 Magic Word: serialize on separate line (parsoid)
9698 !! options
9699 parsoid=wt2wt,html2wt
9700 !! wikitext
9701 foo
9702 __NOTOC__
9703 bar
9704 !! html
9705 foo<meta property="mw:PageProp/notoc"/>bar
9706 !! end
9707
9708 !! test
9709 Magic Word: rt non-english wikis
9710 !! options
9711 parsoid=wt2wt
9712 language=de
9713 !! wikitext
9714 __NOEDITSECTION__
9715 !! html
9716 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
9717 !! end
9718
9719 !!test
9720 __proto__ is treated as normal wikitext (T105997)
9721 !!wikitext
9722 __proto__
9723 !!html
9724 <p>__proto__
9725 </p>
9726 !!end
9727
9728 ###
9729 ### Magic links
9730 ###
9731 !! test
9732 Magic links: internal link to RFC (bug 479)
9733 !! wikitext
9734 [[RFC 123]]
9735 !! html
9736 <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>
9737 </p>
9738 !! end
9739
9740 !! test
9741 Magic links: RFC (bug 479)
9742 !! wikitext
9743 RFC 822
9744 !! html
9745 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
9746 </p>
9747 !! end
9748
9749 !! test
9750 Magic links: RFC (bug 65278)
9751 !! wikitext
9752 This is RFC 822 but thisRFC 822 is not RFC 822linked.
9753 !! html
9754 <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.
9755 </p>
9756 !! end
9757
9758 !! test
9759 Magic links: RFC (w/ non-newline whitespace, bug 28950/29025)
9760 !! wikitext
9761 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
9762 RFC
9763 822
9764 !! html
9765 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
9766 RFC
9767 822
9768 </p>
9769 !! end
9770
9771 !! test
9772 Magic links: ISBN (bug 1937)
9773 !! wikitext
9774 ISBN 0-306-40615-2
9775 !! html
9776 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
9777 </p>
9778 !! end
9779
9780 !! test
9781 Magic links: ISBN (bug 65278)
9782 !! wikitext
9783 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
9784 !! html/php
9785 <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.
9786 </p>
9787 !! html/parsoid
9788 <p>This is <a href="./Special:BookSources/9780316098113" rel="mw:ExtLink">ISBN 978-0-316-09811-3</a> but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.</p>
9789 !! end
9790
9791 !! test
9792 Magic links: ISBN (w/ non-newline whitespace, bug 28950/29025)
9793 !! wikitext
9794 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
9795 ISBN
9796 9780316098113
9797 ISBN 978
9798 0316098113
9799 !! html
9800 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
9801 ISBN
9802 9780316098113
9803 ISBN 978
9804 0316098113
9805 </p>
9806 !! end
9807
9808 !! test
9809 Magic links: PMID incorrectly converts space to underscore
9810 !! wikitext
9811 PMID 1234
9812 !! html
9813 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
9814 </p>
9815 !! end
9816
9817 !! test
9818 Magic links: PMID (bug 65278)
9819 !! wikitext
9820 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
9821 !! html
9822 <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.
9823 </p>
9824 !! end
9825
9826 !! test
9827 Magic links: PMID (w/ non-newline whitespace, bug 28950/29025)
9828 !! wikitext
9829 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
9830 PMID
9831 1234
9832 !! html
9833 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
9834 PMID
9835 1234
9836 </p>
9837 !! end
9838
9839 ###
9840 ### Templates
9841 ####
9842
9843 !! test
9844 Nonexistent template
9845 !! wikitext
9846 {{thistemplatedoesnotexist}}
9847 !! html
9848 <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>
9849 </p>
9850 !! end
9851
9852 !! test
9853 Template with invalid target containing tags
9854 !! wikitext
9855 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
9856 !! html
9857 <p>{{a<b>b</b>|foo|a=b|a = b}}
9858 </p>
9859 !! end
9860
9861 !! test
9862 Template with invalid target containing unclosed tag
9863 !! wikitext
9864 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
9865 !! html
9866 <p>{{a<b>|foo|a=b|a = b}}</b>
9867 </p>
9868 !! end
9869
9870 !! test
9871 Template with invalid target containing wikilink
9872 !! wikitext
9873 {{[[Main Page]]}}
9874 !! html/php
9875 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
9876 </p>
9877 !! html/parsoid
9878 <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>
9879 !! end
9880
9881 !! test
9882 Template with just whitespace in it, bug #68421
9883 !! wikitext
9884 {{echo|{{ }}}}
9885 !! html/parsoid
9886 <p><span typeof="mw:Transclusion mw:Nowiki" about="#mwt1" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{ }}"}},"i":0}}]}'>{{ }}</span></p>
9887 !! end
9888
9889 !! article
9890 Template:test
9891 !! text
9892 This is a test template
9893 !! endarticle
9894
9895 !! test
9896 Simple template
9897 !! wikitext
9898 {{test}}
9899 !! html
9900 <p>This is a test template
9901 </p>
9902 !! end
9903
9904 !! test
9905 Template with explicit namespace
9906 !! wikitext
9907 {{Template:test}}
9908 !! html
9909 <p>This is a test template
9910 </p>
9911 !! end
9912
9913
9914 !! article
9915 Template:paramtest
9916 !! text
9917 This is a test template with parameter {{{param}}}
9918 !! endarticle
9919
9920 !! test
9921 Template parameter
9922 !! wikitext
9923 {{paramtest|param=foo}}
9924 !! html
9925 <p>This is a test template with parameter foo
9926 </p>
9927 !! end
9928
9929 !! article
9930 Template:paramtestnum
9931 !! text
9932 [[{{{1}}}|{{{2}}}]]
9933 !! endarticle
9934
9935 !! test
9936 Template unnamed parameter
9937 !! wikitext
9938 {{paramtestnum|Main Page|the main page}}
9939 !! html
9940 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
9941 </p>
9942 !! end
9943
9944 !! article
9945 Template:templatesimple
9946 !! text
9947 (test)
9948 !! endarticle
9949
9950 !! article
9951 Template:templateredirect
9952 !! text
9953 #redirect [[Template:templatesimple]]
9954 !! endarticle
9955
9956 !! article
9957 Template:templateasargtestnum
9958 !! text
9959 {{{{{1}}}}}
9960 !! endarticle
9961
9962 !! article
9963 Template:templateasargtest
9964 !! text
9965 {{template{{{templ}}}}}
9966 !! endarticle
9967
9968 !! article
9969 Template:templateasargtest2
9970 !! text
9971 {{{{{templ}}}}}
9972 !! endarticle
9973
9974 !! test
9975 Template with template name as unnamed argument
9976 !! wikitext
9977 {{templateasargtestnum|templatesimple}}
9978 !! html
9979 <p>(test)
9980 </p>
9981 !! end
9982
9983 !! test
9984 Template with template name as argument
9985 !! wikitext
9986 {{templateasargtest|templ=simple}}
9987 !! html
9988 <p>(test)
9989 </p>
9990 !! end
9991
9992 !! test
9993 Template with template name as argument (2)
9994 !! wikitext
9995 {{templateasargtest2|templ=templatesimple}}
9996 !! html
9997 <p>(test)
9998 </p>
9999 !! end
10000
10001 !! article
10002 Template:templateasargtestdefault
10003 !! text
10004 {{{{{templ|templatesimple}}}}}
10005 !! endarticle
10006
10007 !! article
10008 Template:templa
10009 !! text
10010 '''templ'''
10011 !! endarticle
10012
10013 !! test
10014 Template with default value
10015 !! wikitext
10016 {{templateasargtestdefault}}
10017 !! html
10018 <p>(test)
10019 </p>
10020 !! end
10021
10022 !! test
10023 Template with default value (value set)
10024 !! wikitext
10025 {{templateasargtestdefault|templ=templa}}
10026 !! html
10027 <p><b>templ</b>
10028 </p>
10029 !! end
10030
10031 !! test
10032 Template redirect
10033 !! wikitext
10034 {{templateredirect}}
10035 !! html/php
10036 <p>(test)
10037 </p>
10038 !! html/parsoid
10039 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
10040 !! end
10041
10042 !! test
10043 Template with argument in separate line
10044 !! wikitext
10045 {{ templateasargtest |
10046 templ = simple }}
10047 !! html
10048 <p>(test)
10049 </p>
10050 !! end
10051
10052 !! test
10053 Template with complex template as argument
10054 !! wikitext
10055 {{paramtest|
10056 param ={{ templateasargtest |
10057 templ = simple }}}}
10058 !! html
10059 <p>This is a test template with parameter (test)
10060 </p>
10061 !! end
10062
10063 !! test
10064 Template with thumb image (with link in description)
10065 !! wikitext
10066 {{paramtest|param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
10067 !! html/php
10068 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>
10069
10070 !! html+tidy
10071 <p>This is a test template with parameter</p>
10072 <div class="thumb tright">
10073 <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>
10074 <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>
10075 </div>
10076 </div>
10077 !! html/parsoid
10078 <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>
10079 !! end
10080
10081 !! article
10082 Template:complextemplate
10083 !! text
10084 {{{1}}} {{paramtest|
10085 param ={{{param}}}}}
10086 !! endarticle
10087
10088 !! test
10089 Template with complex arguments
10090 !! wikitext
10091 {{complextemplate|
10092 param ={{ templateasargtest |
10093 templ = simple }}|[[Template:complextemplate|link]]}}
10094 !! html
10095 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
10096 </p>
10097 !! end
10098
10099 !! test
10100 BUG 553: link with two variables in a piped link
10101 !! wikitext
10102 {|
10103 |[[{{{1}}}|{{{2}}}]]
10104 |}
10105 !! html
10106 <table>
10107 <tr>
10108 <td>[[{{{1}}}|{{{2}}}]]
10109 </td></tr></table>
10110
10111 !! end
10112
10113 !! test
10114 Magic variable as template parameter
10115 !! wikitext
10116 {{paramtest|param={{SITENAME}}}}
10117 !! html
10118 <p>This is a test template with parameter MediaWiki
10119 </p>
10120 !! end
10121
10122 !! article
10123 Template:linktest
10124 !! text
10125 [[{{{param}}}|link]]
10126 !! endarticle
10127
10128 !! test
10129 Template parameter as link source
10130 !! wikitext
10131 {{linktest|param=Main Page}}
10132 !! html
10133 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
10134 </p>
10135 !! end
10136
10137 !!article
10138 Template:paramtest2
10139 !! text
10140 including another template, {{paramtest|param={{{arg}}}}}
10141 !! endarticle
10142
10143 !! test
10144 Template passing argument to another template
10145 !! wikitext
10146 {{paramtest2|arg='hmm'}}
10147 !! html
10148 <p>including another template, This is a test template with parameter 'hmm'
10149 </p>
10150 !! end
10151
10152 !! article
10153 Template:Linktest2
10154 !! text
10155 Main Page
10156 !! endarticle
10157
10158 !! test
10159 Template as link source
10160 !! wikitext
10161 [[{{linktest2}}]]
10162
10163 [[{{linktest2}}|Main Page]]
10164
10165 [[{{linktest2}}]]Page
10166 !! html
10167 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10168 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10169 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
10170 </p>
10171 !! end
10172
10173
10174 !! article
10175 Template:loop1
10176 !! text
10177 {{loop2}}
10178 !! endarticle
10179
10180 !! article
10181 Template:loop2
10182 !! text
10183 {{loop1}}
10184 !! endarticle
10185
10186 !! test
10187 Template infinite loop
10188 !! wikitext
10189 {{loop1}}
10190 !! html
10191 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
10192 </p>
10193 !! end
10194
10195 !! test
10196 Template from main namespace
10197 !! wikitext
10198 {{:Main Page}}
10199 !! html
10200 <p>blah blah
10201 </p>
10202 !! end
10203
10204 !! article
10205 Template:table
10206 !! text
10207 {|
10208 | 1 || 2
10209 |-
10210 | 3 || 4
10211 |}
10212 !! endarticle
10213
10214 !! test
10215 BUG 529: Template with table, not included at beginning of line
10216 !! wikitext
10217 foo {{table}}
10218 !! html
10219 <p>foo
10220 </p>
10221 <table>
10222 <tr>
10223 <td> 1 </td>
10224 <td> 2
10225 </td></tr>
10226 <tr>
10227 <td> 3 </td>
10228 <td> 4
10229 </td></tr></table>
10230
10231 !! end
10232
10233 !! test
10234 BUG 523: Template shouldn't eat newline (or add an extra one before table)
10235 !! wikitext
10236 foo
10237 {{table}}
10238 !! html
10239 <p>foo
10240 </p>
10241 <table>
10242 <tr>
10243 <td> 1 </td>
10244 <td> 2
10245 </td></tr>
10246 <tr>
10247 <td> 3 </td>
10248 <td> 4
10249 </td></tr></table>
10250
10251 !! end
10252
10253 !! test
10254 BUG 41: Template parameters shown as broken links
10255 !! wikitext
10256 {{{parameter}}}
10257 !! html
10258 <p>{{{parameter}}}
10259 </p>
10260 !! end
10261
10262 !! test
10263 Template with targets containing wikilinks
10264 !! wikitext
10265 {{[[foo]]}}
10266
10267 {{[[{{echo|foo}}]]}}
10268
10269 {{{{echo|[[foo}}]]}}
10270 !! html
10271 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10272 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10273 </p><p>{{[[foo}}]]
10274 </p>
10275 !! end
10276
10277 !! article
10278 Template:''
10279 !! text
10280 bar
10281 !! endarticle
10282
10283 !! test
10284 Templates: Double quotes as template target
10285 !! wikitext
10286 foo {{''}} baz
10287 !! html/php
10288 <p>foo bar baz
10289 </p>
10290 !! html/parsoid
10291 <p>foo <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"&#39;&#39;"},"params":{},"i":0}}]}'>bar</span> baz
10292 </p>
10293 !! end
10294
10295 !! article
10296 Template:MSGNW test
10297 !! text
10298 ''None'' of '''this''' should be
10299 * interpreted
10300 but rather passed unmodified
10301 {{test}}
10302 <gallery>
10303 File:Foobar.jpg
10304 </gallery>
10305 !! endarticle
10306
10307 # hmm, fix this or just deprecate msgnw and document its behavior?
10308 !! test
10309 msgnw keyword
10310 !! wikitext
10311 {{msgnw:MSGNW test}}
10312 !! html/php
10313 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
10314 &#42; interpreted
10315 &#32;but rather passed unmodified
10316 &#123;&#123;test&#125;&#125;
10317 &#60;gallery&#62;
10318 File:Foobar.jpg
10319 &#60;/gallery&#62;
10320 </p>
10321 !! end
10322
10323 !! test
10324 int keyword
10325 !! wikitext
10326 {{int:youhavenewmessages|lots of money|not!}}
10327 !! html
10328 <p>You have lots of money (not!).
10329 </p>
10330 !! end
10331
10332 !! article
10333 Template:Includes
10334 !! text
10335 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
10336 !! endarticle
10337
10338 !! test
10339 <includeonly> and <noinclude> being included
10340 !! wikitext
10341 {{Includes}}
10342 !! html
10343 <p>Foobar
10344 </p>
10345 !! end
10346
10347 !! article
10348 Template:Includes2
10349 !! text
10350 <onlyinclude>Foo</onlyinclude>bar
10351 !! endarticle
10352
10353 !! test
10354 <onlyinclude> being included
10355 !! wikitext
10356 {{Includes2}}
10357 !! html
10358 <p>Foo
10359 </p>
10360 !! end
10361
10362
10363 !! article
10364 Template:Includes3
10365 !! text
10366 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
10367 !! endarticle
10368
10369 !! test
10370 <onlyinclude> and <includeonly> being included
10371 !! wikitext
10372 {{Includes3}}
10373 !! html
10374 <p>Foo
10375 </p>
10376 !! end
10377
10378 !! test
10379 <includeonly> and <noinclude> on a page
10380 !! wikitext
10381 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
10382 !! html
10383 <p>Foozar
10384 </p>
10385 !! end
10386
10387 !! test
10388 Un-closed <noinclude>
10389 !! wikitext
10390 <noinclude>
10391 !! html
10392 !! end
10393
10394 !! test
10395 <onlyinclude> on a page
10396 !! wikitext
10397 <onlyinclude>Foo</onlyinclude>bar
10398 !! html
10399 <p>Foobar
10400 </p>
10401 !! end
10402
10403 !! test
10404 Un-closed <onlyinclude>
10405 !! wikitext
10406 <onlyinclude>
10407 !! html
10408 !! end
10409
10410 !!test
10411 Self-closed noinclude, includeonly, onlyinclude tags
10412 !! wikitext
10413 <noinclude />
10414 <includeonly />
10415 <onlyinclude />
10416 !! html
10417 <p><br />
10418 </p>
10419 !!end
10420
10421 !!test
10422 Unbalanced includeonly and noinclude tags
10423 !! wikitext
10424 {|
10425 |a</noinclude>
10426 |b</noinclude></noinclude>
10427 |c</noinclude></includeonly>
10428 |d</includeonly></includeonly>
10429 |}
10430 !! html
10431 <table>
10432 <tr>
10433 <td>a
10434 </td>
10435 <td>b
10436 </td>
10437 <td>c&lt;/includeonly&gt;
10438 </td>
10439 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
10440 </td></tr></table>
10441
10442 !!end
10443
10444 !! article
10445 Template:Includeonly section
10446 !! text
10447 <includeonly>
10448 ==Includeonly section==
10449 </includeonly>
10450 ==Section T-1==
10451 !!endarticle
10452
10453 !! test
10454 Bug 6563: Edit link generation for section shown by <includeonly>
10455 !! wikitext
10456 {{includeonly section}}
10457 !! html
10458 <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>
10459 <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>
10460
10461 !! end
10462
10463 # Uses same input as the contents of [[Template:Includeonly section]]
10464 !! test
10465 Bug 6563: Section extraction for section shown by <includeonly>
10466 !! options
10467 section=T-2
10468 !! wikitext
10469 <includeonly>
10470 ==Includeonly section==
10471 </includeonly>
10472 ==Section T-2==
10473 !! html
10474 ==Section T-2==
10475 !! end
10476
10477 !! test
10478 Bug 6563: Edit link generation for section suppressed by <includeonly>
10479 !! wikitext
10480 <includeonly>
10481 ==Includeonly section==
10482 </includeonly>
10483 ==Section 1==
10484 !! html
10485 <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>
10486
10487 !! end
10488
10489 !! test
10490 Bug 6563: Section extraction for section suppressed by <includeonly>
10491 !! options
10492 section=1
10493 !! wikitext
10494 <includeonly>
10495 ==Includeonly section==
10496 </includeonly>
10497 ==Section 1==
10498 !! html
10499 ==Section 1==
10500 !! end
10501
10502 !! test
10503 Un-closed <includeonly>
10504 !! wikitext
10505 <includeonly>
10506 !! html
10507 !! end
10508
10509 !! test
10510 Includes and comments at SOL
10511 !! wikitext
10512 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
10513
10514 <noinclude>
10515 some
10516 </noinclude>* stuff
10517 * here
10518
10519 <includeonly>can have stuff</includeonly>=== here ===
10520
10521 !! html/php
10522 <h2><span class="mw-headline" id="hu">hu</span></h2>
10523 <p>some
10524 </p>
10525 <ul><li> stuff</li>
10526 <li> here</li></ul>
10527 <h3><span class="mw-headline" id="here">here</span></h3>
10528
10529 !! html/parsoid
10530 <!-- 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>
10531
10532 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
10533 <p>some</p>
10534 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
10535 <li> here</li></ul>
10536
10537 <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>
10538
10539 !! end
10540
10541 # TODO: test with DOM fragment reuse!
10542 !! test
10543 Parsoid: DOM fragment reuse
10544 !! options
10545 parsoid=wt2wt,wt2html
10546 !! wikitext
10547 a{{echo|b<table></table>c}}d
10548
10549 a{{echo|b
10550 <table></table>
10551 c}}d
10552
10553 {{echo|a
10554
10555 <table></table>
10556
10557 b}}
10558 !! html
10559 <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","spc":["","","",""]}]]}'>ab</p><table about="#mwt1" data-parsoid='{"stx":"html"}'></table><p about="#mwt1">cd</p>
10560
10561 <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","spc":["","","",""]}]]}'>ab</p><span about="#mwt2">
10562 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
10563 </span><p about="#mwt2">cd</p>
10564
10565 <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","spc":["","","",""]}]]}'>a</p><span about="#mwt3">
10566
10567 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
10568
10569 </span><p about="#mwt3">b</p>
10570 !! end
10571
10572 !! test
10573 Parsoid: Merge double tds (bug 50603)
10574 !! options
10575 parsoid
10576 !! wikitext
10577 {|
10578 |{{echo|{{!}} foo}}
10579 |}
10580 !! html
10581 <table><tbody>
10582 <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>
10583 </tbody></table>
10584 !! end
10585
10586 !! test
10587 Parsoid: Merge double tds in nested transclusion content (bug 50603)
10588 !! options
10589 parsoid
10590 !! wikitext
10591 {{echo|<div>}}
10592 {|
10593 |{{echo|{{!}} foo}}
10594 |}
10595 {{echo|</div>}}
10596 !! html
10597 <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}}]}'>
10598 <table><tbody>
10599 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
10600 </tbody></table>
10601 </div>
10602 !! end
10603
10604 ###
10605 ### <includeonly> and <noinclude> in attributes
10606 ###
10607 !!test
10608 0. includeonly around the entire attribute
10609 !! wikitext
10610 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
10611 !! html
10612 <p><span id="v2">bar</span>
10613 </p>
10614 !!end
10615
10616 !!test
10617 1. includeonly in html attr key
10618 !! wikitext
10619 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
10620 !! html
10621 <p><span id="foo">bar</span>
10622 </p>
10623 !!end
10624
10625 !!test
10626 2. includeonly in html attr value
10627 !! wikitext
10628 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
10629 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
10630 !! html
10631 <p><span id="v1">bar</span>
10632 <span id="v1">bar</span>
10633 </p>
10634 !!end
10635
10636 !!test
10637 3. includeonly in part of an attr value
10638 !! wikitext
10639 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
10640 !! html
10641 <p><span style="color:red;">bar</span>
10642 </p>
10643 !!end
10644
10645 !!test
10646 4. includeonly in table attributes
10647 !! wikitext
10648 {|
10649 |- <noinclude>
10650 |-
10651 |a
10652 </noinclude>
10653 |- <includeonly>
10654 |-
10655 |b
10656 </includeonly>
10657 |}
10658 !! html
10659 <table>
10660
10661
10662 <tr>
10663 <td>a
10664 </td></tr>
10665 </table>
10666
10667 !!end
10668
10669 ###
10670 ### Token Stream Patcher tests
10671 ###
10672 ### These tests won't always pass wt2wt and other modes because
10673 ### on serialization, the table will be output on a new line.
10674 ### For now, we are blacklisting them, and using this to test selser.
10675 ###
10676
10677 !!test
10678 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
10679 !!options
10680 parsoid=wt2html,wt2wt
10681 !!wikitext
10682 {{echo|}}{| width = '100%'
10683 |foo
10684 |}
10685 !!html/parsoid
10686 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
10687 <tbody><tr><td>foo</td></tr>
10688 </tbody></table>
10689 !!end
10690
10691 !!test
10692 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
10693 !!options
10694 parsoid=wt2html,wt2wt
10695 !!wikitext
10696 <includeonly>a</includeonly>{| {{{b}}}
10697 |c
10698 |}
10699 !!html/parsoid
10700 <meta typeof="mw:Includes/IncludeOnly"/><meta typeof="mw:Includes/IncludeOnly/End"/><table about="#mwt2" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"{{{b}}}","html":"&lt;span about=\"#mwt1\" typeof=\"mw:Param\" data-parsoid=\"{&amp;quot;dsr&amp;quot;:[31,38,null,null],&amp;quot;src&amp;quot;:&amp;quot;{{{b}}}&amp;quot;}\">{{{b}}}&lt;/span>"},{"html":""}]]}' data-parsoid='{"a":{"{{{b}}}":null},"sa":{"{{{b}}}":""}}'>
10701 <tbody><tr><td>c</td></tr>
10702 </tbody></table>
10703
10704 !!end
10705
10706 ###
10707 ### Testing parsing of templates where a template arg
10708 ### has the same name as the template itself.
10709 ###
10710
10711 !! article
10712 Template:quote
10713 !! text
10714 {{{quote|{{{1}}}}}}
10715 !! endarticle
10716
10717 !!test
10718 Templates: Template Name/Arg clash: 1. Use of positional param
10719 !! wikitext
10720 {{quote|foo}}
10721 !! html
10722 <p>foo
10723 </p>
10724 !!end
10725
10726 !!test
10727 Templates: Template Name/Arg clash: 2. Use of named param
10728 !! wikitext
10729 {{quote|quote=foo}}
10730 !! html
10731 <p>foo
10732 </p>
10733 !!end
10734
10735 !!test
10736 Templates: Template Name/Arg clash: 3. Use of named param with empty input
10737 !! wikitext
10738 {{quote|quote}}
10739 !! html
10740 <p>quote
10741 </p>
10742 !!end
10743
10744 ###
10745 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
10746 ###
10747
10748 !!test
10749 Templates: 1. Simple use
10750 !! wikitext
10751 {{echo|Foo}}
10752 !! html
10753 <p>Foo
10754 </p>
10755 !!end
10756
10757 !!test
10758 Templates: 2. Inside a block tag
10759 !! wikitext
10760 <div>{{echo|Foo}}</div>
10761 <blockquote>{{echo|Foo}}</blockquote>
10762 !! html
10763 <div>Foo</div>
10764 <blockquote>Foo</blockquote>
10765
10766 !! html+tidy
10767 <div>Foo</div>
10768 <blockquote>
10769 <p>Foo</p>
10770 </blockquote>
10771 !!end
10772
10773 !!test
10774 Templates: P-wrapping: 1a. Templates on consecutive lines
10775 !! wikitext
10776 {{echo|Foo}}
10777 {{echo|bar}}
10778 !! html
10779 <p>Foo
10780 bar
10781 </p>
10782 !!end
10783
10784 !!test
10785 Templates: P-wrapping: 1b. Templates on consecutive lines
10786 !! wikitext
10787 Foo
10788
10789 {{echo|bar}}
10790 {{echo|baz}}
10791 !! html
10792 <p>Foo
10793 </p><p>bar
10794 baz
10795 </p>
10796 !!end
10797
10798 !!test
10799 Templates: P-wrapping: 1c. Templates on consecutive lines
10800 !! wikitext
10801 {{echo|Foo}}
10802 {{echo|bar}} <div>baz</div>
10803 !! html
10804 <p>Foo
10805 </p>
10806 bar <div>baz</div>
10807
10808 !! html+tidy
10809 <p>Foo</p>
10810 <p>bar</p>
10811 <div>baz</div>
10812 !! end
10813
10814 !!test
10815 Templates: P-wrapping: 1d. Template preceded by comment-only line
10816 !!options
10817 parsoid
10818 !! wikitext
10819 <!-- foo -->
10820 {{echo|Bar}}
10821 !! html
10822 <!-- foo -->
10823
10824 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
10825 !!end
10826
10827 !!test
10828 Templates: Inline Text: 1. Multiple template uses
10829 !! wikitext
10830 {{echo|Foo}}bar{{echo|baz}}
10831 !! html
10832 <p>Foobarbaz
10833 </p>
10834 !!end
10835
10836 !!test
10837 Templates: Inline Text: 2. Back-to-back template uses
10838 !! wikitext
10839 {{echo|Foo}}{{echo|bar}}
10840 !! html
10841 <p>Foobar
10842 </p>
10843 !!end
10844
10845 !!test
10846 Templates: Block Tags: 1. Multiple template uses
10847 !! wikitext
10848 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
10849 !! html
10850 <div>Foo</div><div>bar</div><div>baz</div>
10851
10852 !!end
10853
10854 !!test
10855 Templates: Block Tags: 2. Back-to-back template uses
10856 !! wikitext
10857 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
10858 !! html
10859 <div>Foo</div><div>bar</div>
10860
10861 !!end
10862
10863 # This is an edge case relating to paragraph wrapping.
10864 !!test
10865 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
10866 !! wikitext
10867 {{echo|a
10868 b</p>}}
10869 !! html/parsoid
10870 <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
10871 b</p>
10872 !!end
10873
10874 !!test
10875 Templates: Links: 1. Simple example
10876 !! wikitext
10877 {{echo|[[Foo|bar]]}}
10878 !! html
10879 <p><a href="/wiki/Foo" title="Foo">bar</a>
10880 </p>
10881 !!end
10882
10883 !!test
10884 Templates: Links: 2. Generation of link href
10885 !! wikitext
10886 [[{{echo|Foo}}|bar]]
10887 !! html
10888 <p><a href="/wiki/Foo" title="Foo">bar</a>
10889 </p>
10890 !!end
10891
10892 !!test
10893 Templates: Links: 3. Generation of part of a link href
10894 !! wikitext
10895 [[Fo{{echo|o}}|bar]]
10896
10897 [[Foo{{echo|bar}}]]
10898
10899 [[Foo{{echo|bar}}baz]]
10900
10901 [[Foo{{echo|bar}}|bar]]
10902
10903 [[:Foo{{echo|bar}}]]
10904
10905 [[:Foo{{echo|bar}}|bar]]
10906 !! html
10907 <p><a href="/wiki/Foo" title="Foo">bar</a>
10908 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
10909 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
10910 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
10911 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
10912 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
10913 </p>
10914 !!end
10915
10916 !!test
10917 Templates: Links: 4. Multiple templates generating link href
10918 !! wikitext
10919 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
10920 !! html
10921 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
10922 </p>
10923 !!end
10924
10925 !!test
10926 Templates: Links: 5. Generation of link text
10927 !! wikitext
10928 [[Foo|{{echo|bar}}]]
10929 !! html
10930 <p><a href="/wiki/Foo" title="Foo">bar</a>
10931 </p>
10932 !!end
10933
10934 !!test
10935 Templates: Links: 5. Nested templates (only outermost template should be marked)
10936 !! wikitext
10937 {{echo|[[{{echo|Foo}}|bar]]}}
10938 !! html
10939 <p><a href="/wiki/Foo" title="Foo">bar</a>
10940 </p>
10941 !!end
10942
10943 !!test
10944 Templates: HTML Tag: 1. Generation of HTML attr. key
10945 !! wikitext
10946 <div {{echo|style}}="color:red;">foo</div>
10947 !! html
10948 <div style="color:red;">foo</div>
10949
10950 !!end
10951
10952 !!test
10953 Templates: HTML Tag: 2. Generation of HTML attr. value
10954 !! wikitext
10955 <div style={{echo|'color:red;'}}>foo</div>
10956 !! html
10957 <div style="color:red;">foo</div>
10958
10959 !!end
10960
10961 !!test
10962 Templates: HTML Tag: 3. Generation of HTML attr key and value
10963 !! wikitext
10964 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
10965 !! html
10966 <div style="color:red;">foo</div>
10967
10968 !!end
10969
10970 !!test
10971 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
10972 !! wikitext
10973 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
10974 !! html
10975 <div title="This is a long title with just one piece templated">foo</div>
10976
10977 !!end
10978
10979 !!test
10980 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
10981 !! wikitext
10982 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
10983 !! html
10984 <div title="This is a long title with just one piece templated">foo</div>
10985
10986 !!end
10987
10988 !!test
10989 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
10990 !! wikitext
10991 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
10992 !! html
10993 <div title="This is a long title with just one piece templated">foo</div>
10994
10995 !!end
10996
10997 # SSS FIXME: While it is great we added support for all this,
10998 # do we want to make this part of the spec? Maybe we want to
10999 # deprecate this kind of usage in the future?
11000 !!test
11001 Templates: HTML Tag: 7. Generation of partial attribute key string
11002 !! wikitext
11003 <div st{{echo|yle}}="color:red;">foo</div>
11004 !! html
11005 <div style="color:red;">foo</div>
11006
11007 !!end
11008
11009 !! test
11010 Templates: HTML Tag: 8. Template-generated attribute (k=v)
11011 !! wikitext
11012 <div {{echo|1=id="v1"}}>bar</div>
11013 !! html
11014 <div id="v1">bar</div>
11015
11016 !!end
11017
11018 !! test
11019 Templates: HTML Tag: 9. Multiple template-generated attributes
11020 !! wikitext
11021 <div {{echo|1=id="v1" title="foo"}}>bar</div>
11022 !! html
11023 <div id="v1" title="foo">bar</div>
11024
11025 !!end
11026
11027 !! test
11028 Templates: Support for templates generating attributes and content
11029 !! wikitext
11030 {| {{mixed_attr_content_template}}
11031 |-
11032 |bar
11033 |}
11034 !! html/php
11035 <table style="color:red;" title="T48811">
11036
11037 <tr>
11038 <td>foo
11039 </td></tr>
11040 <tr>
11041 <td>bar
11042 </td></tr></table>
11043
11044 !! html/parsoid
11045 <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|}"]}'>
11046 <tbody><tr>
11047 <td>foo</td></tr>
11048 <tr>
11049 <td>bar</td></tr>
11050 </tbody></table>
11051 !!end
11052
11053 !! test
11054 1. Entities and nowikis inside templated attributes should be handled correctly
11055 !! wikitext
11056 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
11057 !! html/php
11058 <div style="background:#f9f9f9;">foo</div>
11059
11060 !! html/parsoid
11061 <div style="background:#f9f9f9;" about="#mwt3" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html"}' data-mw='{"attribs":[[{"txt":"style","html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[5,49,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;style{{=}}\\&amp;quot;background:&amp;amp;#35;f9f9f9;\\&amp;quot;&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">style&lt;/span>&lt;span typeof=\"mw:Nowiki\" about=\"#mwt1\" data-parsoid=\"{}\">=&lt;/span>&lt;span about=\"#mwt1\" data-parsoid=\"{}\">\"background:&lt;/span>&lt;span typeof=\"mw:Entity\" about=\"#mwt1\" data-parsoid=\"{&amp;quot;src&amp;quot;:&amp;quot;&amp;amp;#35;&amp;quot;,&amp;quot;srcContent&amp;quot;:&amp;quot;#&amp;quot;}\">#&lt;/span>&lt;span about=\"#mwt1\" data-parsoid=\"{}\">f9f9f9;\"&lt;/span>"},{"html":""}]]}'>foo</div>
11062 !! end
11063
11064 !! test
11065 2. Entities and nowikis inside templated attributes should be handled correctly
11066 !! wikitext
11067 {|
11068 |{{table_attribs_3}}
11069 |}
11070 !! html/php
11071 <table>
11072 <tr>
11073 <td style="background:#f9f9f9;">Foo
11074 </td></tr></table>
11075
11076 !! html/parsoid
11077 <table>
11078 <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>
11079 </tbody></table>
11080 !! end
11081
11082 !! test
11083 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11084 !! wikitext
11085 {{tbl-start}}
11086 |{{table_attribs_3}}
11087 {{tbl-end}}
11088 !! html/php
11089 <table>
11090 <tr>
11091 <td style="background:#f9f9f9;">Foo
11092 </td></tr></table>
11093
11094 !! html/parsoid
11095 <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}}]}'>
11096 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
11097 </tbody></table>
11098 !! end
11099
11100 # T107622
11101 !! test
11102 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11103 !! wikitext
11104 {|
11105 | {{table_attribs_6}} hi
11106 |}
11107 !! html/php
11108 <table>
11109 <tr>
11110 <td style="background: red;"> hi
11111 </td></tr></table>
11112
11113 !! html/parsoid
11114 <table>
11115 <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>
11116 </tbody></table>
11117 !! end
11118
11119 !!test
11120 Templates: HTML Tables: 1. Generating start of a HTML table
11121 !! wikitext
11122 {{echo|<table><tr><td>foo</td>}}</tr></table>
11123 !! html
11124 <table><tr><td>foo</td></tr></table>
11125
11126 !!end
11127
11128 !!test
11129 Templates: HTML Tables: 2a. Generating middle of a HTML table
11130 !! wikitext
11131 <table><tr>{{echo|<td>foo</td>}}</tr></table>
11132 !! html
11133 <table><tr><td>foo</td></tr></table>
11134
11135 !!end
11136
11137 !!test
11138 Templates: HTML Tables: 2b. Generating middle of a HTML table
11139 !! wikitext
11140 <table>{{echo|<tr><td>foo</td></tr>}}</table>
11141 !! html
11142 <table><tr><td>foo</td></tr></table>
11143
11144 !!end
11145
11146 !!test
11147 Templates: HTML Tables: 3. Generating end of a HTML table
11148 !! wikitext
11149 <table><tr>{{echo|<td>foo</td></tr></table>}}
11150 !! html
11151 <table><tr><td>foo</td></tr></table>
11152
11153 !!end
11154
11155 !!test
11156 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
11157 !! wikitext
11158 {{echo|<table>}}<tr><td>foo</td></tr></table>
11159 !! html
11160 <table><tr><td>foo</td></tr></table>
11161
11162 !!end
11163
11164 !!test
11165 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
11166 !! wikitext
11167 <table>{{echo|<tr>}}<td>foo</td></tr></table>
11168 !! html
11169 <table><tr><td>foo</td></tr></table>
11170
11171 !!end
11172
11173 !!test
11174 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
11175 !! wikitext
11176 <table><tr>{{echo|<td>}}foo</td></tr></table>
11177 !! html
11178 <table><tr><td>foo</td></tr></table>
11179
11180 !!end
11181
11182 !!test
11183 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
11184 !! wikitext
11185 <table><tr><td>foo{{echo|</td>}}</tr></table>
11186 !! html
11187 <table><tr><td>foo</td></tr></table>
11188
11189 !!end
11190
11191 !!test
11192 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
11193 !! wikitext
11194 <table><tr><td>foo</td>{{echo|</tr>}}</table>
11195 !! html
11196 <table><tr><td>foo</td></tr></table>
11197
11198 !!end
11199
11200 !!test
11201 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
11202 !! wikitext
11203 <table><tr><td>foo</td></tr>{{echo|</table>}}
11204 !! html
11205 <table><tr><td>foo</td></tr></table>
11206
11207 !!end
11208
11209 !!test
11210 Templates: HTML Tables: 5. Proper fostering of categories from inside
11211 !!options
11212 parsoid=wt2html,wt2wt
11213 !! wikitext
11214 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
11215 <!--Two categories (Bug 50330)-->
11216 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
11217 !! html
11218 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
11219 <!--Two categories (Bug 50330)-->
11220 <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>
11221 !!end
11222
11223 !!test
11224 Templates: Wiki Tables: 1a. Fostering of entire template content
11225 !! wikitext
11226 {|
11227 {{echo|a}}
11228 |}
11229 !! html
11230 <table>
11231 a
11232 <tr><td></td></tr></table>
11233
11234 !! html+tidy
11235 <p>a</p>
11236 <table>
11237 <tr>
11238 <td></td>
11239 </tr>
11240 </table>
11241 !! end
11242
11243 !!test
11244 Templates: Wiki Tables: 1b. Fostering of entire template content
11245 !! wikitext
11246 {|
11247 {{echo|<div>}}
11248 foo
11249 {{echo|</div>}}
11250 |}
11251 !! html
11252 <table>
11253 <div>
11254 <p>foo
11255 </p>
11256 </div>
11257 <tr><td></td></tr></table>
11258
11259 !! html+tidy
11260 <div>
11261 <p>foo</p>
11262 </div>
11263 <table>
11264 <tr>
11265 <td></td>
11266 </tr>
11267 </table>
11268 !! end
11269
11270 !!test
11271 Templates: Wiki Tables: 2. Fostering of partial template content
11272 !! wikitext
11273 {|
11274 {{echo|a
11275 <div>b</div>}}
11276 |}
11277 !! html
11278 <table>
11279 a
11280 <div>b</div>
11281 <tr><td></td></tr></table>
11282
11283 !! html+tidy
11284 <p>a</p>
11285 <div>b</div>
11286 <table>
11287 <tr>
11288 <td></td>
11289 </tr>
11290 </table>
11291 !! end
11292
11293 !!test
11294 Templates: Wiki Tables: 3. td-content via multiple templates
11295 !! wikitext
11296 {|
11297 {{echo|{{pipe}}a}}{{echo|b}}
11298 |}
11299 !! html
11300 <table>
11301 <tr>
11302 <td>ab
11303 </td></tr></table>
11304
11305 !!end
11306
11307 !!test
11308 Templates: Wiki Tables: 4. Templated tags, no content
11309 !! wikitext
11310 {{tbl-start}}
11311 {{tbl-end}}
11312 !! html
11313 <table>
11314 <tr><td></td></tr></table>
11315
11316 !!end
11317
11318 !!test
11319 Templates: Wiki Tables: 5. Templated tags, regular td-tags
11320 !! wikitext
11321 {{tbl-start}}
11322 |foo
11323 {{tbl-end}}
11324 !! html
11325 <table>
11326 <tr>
11327 <td>foo
11328 </td></tr></table>
11329
11330 !!end
11331
11332 !!test
11333 Templates: Wiki Tables: 6. Templated tags, templated td-tags
11334 !! wikitext
11335 {{tbl-start}}
11336 {{!}}foo
11337 {{tbl-end}}
11338 !! html
11339 <table>
11340 <tr>
11341 <td>foo
11342 </td></tr></table>
11343
11344 !!end
11345
11346 ## This test case is very specific to Parsoid's internals
11347 ## and is hence only tested for Parsoid's code. Parsoid uses
11348 ## a <meta> marker tag for <ref> tags and they are expanded
11349 ## much later. We are verifying that this <meta> tag usage
11350 ## doesn't prevent foster parenting.
11351 !!test
11352 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
11353 !!wikitext
11354 {{PartialTable}}<ref>foo</ref>
11355 |}
11356
11357 <references />
11358 !!html/parsoid
11359 <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">
11360 <tbody>
11361 </tbody></table>
11362
11363 <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>
11364 !!end
11365
11366 !! test
11367 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
11368 !! wikitext
11369 {{echo|
11370 {{{!}}
11371 {{!}}-}}
11372 <onlyinclude>
11373 |foo
11374 </onlyinclude>
11375 {{!}}}
11376 !! html/parsoid
11377 <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{{!}}}"]}'>
11378 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
11379 <tbody><tr>
11380
11381 <td>foo
11382 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
11383 </tbody></table>
11384 !! end
11385
11386 !!test
11387 Templates: Lists: Multi-line list-items via templates
11388 !! wikitext
11389 *{{echo|a {{nonexistent|
11390 unused}}}}
11391 *{{echo|b {{nonexistent|
11392 unused}}}}
11393 !! html
11394 <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>
11395 <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>
11396
11397 !!end
11398
11399 !!test
11400 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
11401 !! wikitext
11402 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
11403 !! html
11404 <p><i>ab</i>c<i>d</i>e
11405 </p>
11406 !!end
11407
11408 !!test
11409 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
11410 (PHP parser generates misnested html)
11411 !! wikitext
11412 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
11413 !! html/parsoid
11414 <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>
11415 !!end
11416
11417 !!test
11418 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
11419 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
11420 !! options
11421 parsoid=wt2html,wt2wt
11422 !! wikitext
11423 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
11424 !! html
11425 <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>
11426 <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>
11427 <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>
11428 !!end
11429
11430 !!test
11431 Templates: Ugly nesting: 4. Divs opened/closed across templates
11432 !! wikitext
11433 a<div>b{{echo|c</div>d}}e
11434 !! html
11435 a<div>bc</div>de
11436
11437 !! html+tidy
11438 <p>a</p>
11439 <div>bc</div>
11440 <p>de</p>
11441 !! end
11442
11443 !!test
11444 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
11445 (Parsoid-centric)
11446 !! options
11447 parsoid
11448 !! wikitext
11449 {|
11450 |{{echo|foo</table>}}
11451 |bar
11452 |}
11453 !! html
11454 <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|}"]}'>
11455
11456 <tbody>
11457 <tr>
11458 <td>foo</td></tr></tbody></table><span about="#mwt1">
11459 </span><span about="#mwt1">|bar</span><span about="#mwt1">
11460 |}</span>
11461 !!end
11462
11463 !!test
11464 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
11465 (Parsoid-centric)
11466 !! options
11467 parsoid
11468 !! wikitext
11469 <table>
11470 <tr>
11471 <td>
11472 <table>
11473 <tr>
11474 <td>1. {{echo|foo </table>}}</td>
11475 <td> bar </td>
11476 <td>2. {{echo|baz </table>}}</td>
11477 </tr>
11478 <tr>
11479 <td>abc</td>
11480 </tr>
11481 </table>
11482 </td>
11483 </tr>
11484 <tr>
11485 <td>xyz</td>
11486 </tr>
11487 </table>
11488 !! html
11489 <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>"]}'>
11490 <tbody><tr>
11491 <td>
11492 <table>
11493 <tbody><tr>
11494 <td>1. foo </td></tr></tbody></table></td>
11495 <td> bar </td>
11496 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
11497 </span><span about="#mwt2">
11498 </span><span about="#mwt2">
11499 </span><span about="#mwt2">abc</span><span about="#mwt2">
11500 </span><span about="#mwt2">
11501 </span><span about="#mwt2">
11502 </span><span about="#mwt2">
11503 </span><span about="#mwt2">
11504 </span><span about="#mwt2">
11505 </span><span about="#mwt2">xyz</span><span about="#mwt2">
11506 </span><span about="#mwt2">
11507 </span>
11508 !!end
11509
11510 !! test
11511 Templates: Ugly templates: 3. newline-only template parameter
11512 !! wikitext
11513 foo {{echo|
11514 }}
11515 !! html
11516 <p>foo
11517 </p>
11518 !! end
11519
11520 # This looks like a bug: a single newline triggers p/br for some reason.
11521 !! test
11522 Templates: Ugly templates: 4. newline-only template parameter inconsistency
11523 !! wikitext
11524 {{echo|
11525 }}
11526 !! html
11527 <p><br />
11528 </p>
11529 !! end
11530
11531 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
11532 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
11533 !! test
11534 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
11535 !! wikitext
11536 {{echo|<table>}}
11537 {{echo|<div>foo}}
11538 {{echo|</table>}}
11539 !! html/parsoid
11540 <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","spc":["","","",""]}],[{"k":"1","spc":["","","",""]}],[{"k":"1","spc":["","","",""]}]]}'>foo
11541 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
11542 </table>
11543 !! end
11544
11545 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
11546 # that are "identical" and generate nesting cycles in the algorithm
11547 !! test
11548 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
11549 !! wikitext
11550 {{echo|<table><tr><td><table>}}
11551 {{echo|<div>}}
11552 {{echo|</div>}}
11553 !! html/parsoid
11554 <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","spc":["","","",""]}],[{"k":"1","spc":["","","",""]}],[{"k":"1","spc":["","","",""]}]]}'><tbody><tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'><div data-parsoid='{"stx":"html"}'>
11555 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
11556 </table></td></tr></tbody></table>
11557 !! end
11558
11559 !!test
11560 Parser Functions: 1. Simple example
11561 !! wikitext
11562 {{uc:foo}}
11563 !! html
11564 <p>FOO
11565 </p>
11566 !!end
11567
11568 !!test
11569 Parser Functions: 2. Nested use (only outermost should be marked up)
11570 !! wikitext
11571 {{uc:{{lc:FOO}}}}
11572 !! html
11573 <p>FOO
11574 </p>
11575 !!end
11576
11577 ###
11578 ### Pre-save transform tests
11579 ###
11580 !! test
11581 pre-save transform: subst:
11582 !! options
11583 pst
11584 !! wikitext
11585 {{subst:test}}
11586 !! html/php
11587 This is a test template
11588 !! end
11589
11590 !! test
11591 pre-save transform: normal template
11592 !! options
11593 pst
11594 !! wikitext
11595 {{test}}
11596 !! html/php
11597 {{test}}
11598 !! end
11599
11600 !! test
11601 pre-save transform: nonexistent template
11602 !! options
11603 pst
11604 !! wikitext
11605 {{thistemplatedoesnotexist}}
11606 !! html/php
11607 {{thistemplatedoesnotexist}}
11608 !! end
11609
11610 !! test
11611 pre-save transform: subst magic variables
11612 !! options
11613 pst
11614 !! wikitext
11615 {{subst:SITENAME}}
11616 !! html/php
11617 MediaWiki
11618 !! end
11619
11620 # This is bug 89, which I fixed. -- wtm
11621 !! test
11622 pre-save transform: subst: templates with parameters
11623 !! options
11624 pst
11625 !! wikitext
11626 {{subst:paramtest|param="something else"}}
11627 !! html/php
11628 This is a test template with parameter "something else"
11629 !! end
11630
11631 !! article
11632 Template:nowikitest
11633 !! text
11634 <nowiki>'''not wiki'''</nowiki>
11635 !! endarticle
11636
11637 !! test
11638 pre-save transform: nowiki in subst (bug 1188)
11639 !! options
11640 pst
11641 !! wikitext
11642 {{subst:nowikitest}}
11643 !! html/php
11644 <nowiki>'''not wiki'''</nowiki>
11645 !! end
11646
11647 !! article
11648 Template:commenttest
11649 !! text
11650 This template has <!-- a comment --> in it.
11651 !! endarticle
11652
11653 !! test
11654 pre-save transform: comment in subst (bug 1936)
11655 !! options
11656 pst
11657 !! wikitext
11658 {{subst:commenttest}}
11659 !! html/php
11660 This template has <!-- a comment --> in it.
11661 !! end
11662
11663 !! test
11664 pre-save transform: unclosed tag
11665 !! options
11666 pst noxml
11667 !! wikitext
11668 <nowiki>'''not wiki'''
11669 !! html/php
11670 <nowiki>'''not wiki'''
11671 !! end
11672
11673 !! test
11674 pre-save transform: mixed tag case
11675 !! options
11676 pst noxml
11677 !! wikitext
11678 <NOwiki>'''not wiki'''</noWIKI>
11679 !! html/php
11680 <NOwiki>'''not wiki'''</noWIKI>
11681 !! end
11682
11683 !! test
11684 pre-save transform: unclosed comment in <nowiki>
11685 !! options
11686 pst noxml
11687 !! wikitext
11688 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
11689 !! html/php
11690 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
11691 !!end
11692
11693 # Leading @ in this template definition works around a limitation
11694 # in parsoid's parserTests which otherwise strips the <span> from the
11695 # result (confusing it for a template wrapper)
11696 !! article
11697 Template:dangerous
11698 !!text
11699 @<span onmouseover="alert('crap')">Oh no</span>
11700 !!endarticle
11701
11702 !!test
11703 (confirming safety of fix for subst bug 1936)
11704 !! wikitext
11705 {{Template:dangerous}}
11706 !! html
11707 <p>@<span>Oh no</span>
11708 </p>
11709 !! end
11710
11711 !! test
11712 pre-save transform: comment containing gallery (bug 5024)
11713 !! options
11714 pst
11715 !! wikitext
11716 <!-- <gallery>data</gallery> -->
11717 !! html/php
11718 <!-- <gallery>data</gallery> -->
11719 !!end
11720
11721 !! test
11722 pre-save transform: comment containing extension
11723 !! options
11724 pst
11725 !! wikitext
11726 <!-- <tag>data</tag> -->
11727 !! html/php
11728 <!-- <tag>data</tag> -->
11729 !!end
11730
11731 !! test
11732 pre-save transform: comment containing nowiki
11733 !! options
11734 pst
11735 !! wikitext
11736 <!-- <nowiki>data</nowiki> -->
11737 !! html/php
11738 <!-- <nowiki>data</nowiki> -->
11739 !!end
11740
11741 !! test
11742 pre-save transform: <noinclude> in subst (bug 3298)
11743 !! options
11744 pst
11745 !! wikitext
11746 {{subst:Includes}}
11747 !! html/php
11748 Foobar
11749 !! end
11750
11751 !! test
11752 pre-save transform: <onlyinclude> in subst (bug 3298)
11753 !! options
11754 pst
11755 !! wikitext
11756 {{subst:Includes2}}
11757 !! html/php
11758 Foo
11759 !! end
11760
11761 !! article
11762 Template:SubstTest
11763 !!text
11764 {{<includeonly>subst:</includeonly>Includes}}
11765 !! endarticle
11766
11767 !! article
11768 Template:SafeSubstTest
11769 !! text
11770 {{<includeonly>safesubst:</includeonly>Includes}}
11771 !! endarticle
11772
11773 !! test
11774 bug 22297: safesubst: works during PST
11775 !! options
11776 pst
11777 !! wikitext
11778 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
11779 !! html/php
11780 FoobarFoobar
11781 !! end
11782
11783 !! test
11784 bug 22297: safesubst: works during normal parse
11785 !! wikitext
11786 {{SafeSubstTest}}
11787 !! html
11788 <p>Foobar
11789 </p>
11790 !! end
11791
11792 !! test
11793 subst: does not work during normal parse
11794 !! wikitext
11795 {{SubstTest}}
11796 !! html
11797 <p>{{subst:Includes}}
11798 </p>
11799 !! end
11800
11801 !! test
11802 pre-save transform: context links ("pipe trick")
11803 !! options
11804 pst
11805 !! wikitext
11806 [[Article (context)|]]
11807 [[Bar:Article|]]
11808 [[:Bar:Article|]]
11809 [[Bar:Article (context)|]]
11810 [[:Bar:Article (context)|]]
11811 [[|Article]]
11812 [[|Article (context)]]
11813 [[Bar:X (Y) Z|]]
11814 [[:Bar:X (Y) Z|]]
11815 !! html/php
11816 [[Article (context)|Article]]
11817 [[Bar:Article|Article]]
11818 [[:Bar:Article|Article]]
11819 [[Bar:Article (context)|Article]]
11820 [[:Bar:Article (context)|Article]]
11821 [[Article]]
11822 [[Article (context)]]
11823 [[Bar:X (Y) Z|X (Y) Z]]
11824 [[:Bar:X (Y) Z|X (Y) Z]]
11825 !! end
11826
11827 !! test
11828 pre-save transform: context links ("pipe trick") with interwiki prefix
11829 !! options
11830 pst
11831 !! wikitext
11832 [[interwiki:Article|]]
11833 [[:interwiki:Article|]]
11834 [[interwiki:Bar:Article|]]
11835 [[:interwiki:Bar:Article|]]
11836 !! html/php
11837 [[interwiki:Article|Article]]
11838 [[:interwiki:Article|Article]]
11839 [[interwiki:Bar:Article|Bar:Article]]
11840 [[:interwiki:Bar:Article|Bar:Article]]
11841 !! end
11842
11843 !! test
11844 pre-save transform: context links ("pipe trick") with parens in title
11845 !! options
11846 pst title=[[Somearticle (context)]]
11847 !! wikitext
11848 [[|Article]]
11849 !! html/php
11850 [[Article (context)|Article]]
11851 !! end
11852
11853 !! test
11854 pre-save transform: context links ("pipe trick") with comma in title
11855 !! options
11856 pst title=[[Someplace, Somewhere]]
11857 !! wikitext
11858 [[|Otherplace]]
11859 [[Otherplace, Elsewhere|]]
11860 [[Otherplace, Elsewhere, Anywhere|]]
11861 !! html/php
11862 [[Otherplace, Somewhere|Otherplace]]
11863 [[Otherplace, Elsewhere|Otherplace]]
11864 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
11865 !! end
11866
11867 !! test
11868 pre-save transform: context links ("pipe trick") with parens and comma
11869 !! options
11870 pst title=[[Someplace (IGNORED), Somewhere]]
11871 !! wikitext
11872 [[|Otherplace]]
11873 [[Otherplace (place), Elsewhere|]]
11874 !! html/php
11875 [[Otherplace, Somewhere|Otherplace]]
11876 [[Otherplace (place), Elsewhere|Otherplace]]
11877 !! end
11878
11879 !! test
11880 pre-save transform: context links ("pipe trick") with comma and parens
11881 !! options
11882 pst title=[[Who, me? (context)]]
11883 !! wikitext
11884 [[|Yes, you.]]
11885 [[Me, Myself, and I (1937 song)|]]
11886 !! html/php
11887 [[Yes, you. (context)|Yes, you.]]
11888 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
11889 !! end
11890
11891 !! test
11892 pre-save transform: context links ("pipe trick") with namespace
11893 !! options
11894 pst title=[[Ns:Somearticle]]
11895 !! wikitext
11896 [[|Article]]
11897 !! html/php
11898 [[Ns:Article|Article]]
11899 !! end
11900
11901 !! test
11902 pre-save transform: context links ("pipe trick") with namespace and parens
11903 !! options
11904 pst title=[[Ns:Somearticle (context)]]
11905 !! wikitext
11906 [[|Article]]
11907 !! html/php
11908 [[Ns:Article (context)|Article]]
11909 !! end
11910
11911 !! test
11912 pre-save transform: context links ("pipe trick") with namespace and comma
11913 !! options
11914 pst title=[[Ns:Somearticle, Context, Whatever]]
11915 !! wikitext
11916 [[|Article]]
11917 !! html/php
11918 [[Ns:Article, Context, Whatever|Article]]
11919 !! end
11920
11921 !! test
11922 pre-save transform: context links ("pipe trick") with namespace, comma and parens
11923 !! options
11924 pst title=[[Ns:Somearticle, Context (context)]]
11925 !! wikitext
11926 [[|Article]]
11927 !! html/php
11928 [[Ns:Article (context)|Article]]
11929 !! end
11930
11931 !! test
11932 pre-save transform: context links ("pipe trick") with namespace, parens and comma
11933 !! options
11934 pst title=[[Ns:Somearticle (IGNORED), Context]]
11935 !! wikitext
11936 [[|Article]]
11937 !! html/php
11938 [[Ns:Article, Context|Article]]
11939 !! end
11940
11941 !! test
11942 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
11943 !! options
11944 pst
11945 !! wikitext
11946 [[Article(context)|]]
11947 [[Bar:Article(context)|]]
11948 [[:Bar:Article(context)|]]
11949 [[|Article(context)]]
11950 [[Bar:X(Y)Z|]]
11951 [[:Bar:X(Y)Z|]]
11952 !! html/php
11953 [[Article(context)|Article]]
11954 [[Bar:Article(context)|Article]]
11955 [[:Bar:Article(context)|Article]]
11956 [[Article(context)]]
11957 [[Bar:X(Y)Z|X(Y)Z]]
11958 [[:Bar:X(Y)Z|X(Y)Z]]
11959 !! end
11960
11961 !! test
11962 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
11963 !! options
11964 pst
11965 !! wikitext
11966 [[Article (context)|]]
11967 [[Bar:Article (context)|]]
11968 [[:Bar:Article (context)|]]
11969 [[|Article (context)]]
11970 [[Bar:X (Y) Z|]]
11971 [[:Bar:X (Y) Z|]]
11972 !! html/php
11973 [[Article (context)|Article]]
11974 [[Bar:Article (context)|Article]]
11975 [[:Bar:Article (context)|Article]]
11976 [[Article (context)]]
11977 [[Bar:X (Y) Z|X (Y) Z]]
11978 [[:Bar:X (Y) Z|X (Y) Z]]
11979 !! end
11980
11981 !! test
11982 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
11983 !! options
11984 pst
11985 !! wikitext
11986 [[Article(context)|]]
11987 [[Bar:Article(context)|]]
11988 [[:Bar:Article(context)|]]
11989 [[|Article(context)]]
11990 [[Bar:X(Y)Z|]]
11991 [[:Bar:X(Y)Z|]]
11992 !! html/php
11993 [[Article(context)|Article]]
11994 [[Bar:Article(context)|Article]]
11995 [[:Bar:Article(context)|Article]]
11996 [[Article(context)]]
11997 [[Bar:X(Y)Z|X(Y)Z]]
11998 [[:Bar:X(Y)Z|X(Y)Z]]
11999 !! end
12000
12001 !! test
12002 pre-save transform: context links ("pipe trick") with commas (bug 21660)
12003 !! options
12004 pst
12005 !! wikitext
12006 [[Article (context), context|]]
12007 [[Article (context),context|]]
12008 [[Bar:Article (context), context|]]
12009 [[Bar:Article (context),context|]]
12010 [[:Bar:Article (context), context|]]
12011 [[:Bar:Article (context),context|]]
12012 !! html/php
12013 [[Article (context), context|Article]]
12014 [[Article (context),context|Article]]
12015 [[Bar:Article (context), context|Article]]
12016 [[Bar:Article (context),context|Article]]
12017 [[:Bar:Article (context), context|Article]]
12018 [[:Bar:Article (context),context|Article]]
12019 !! end
12020
12021 !! test
12022 pre-save transform: trim trailing empty lines
12023 !! options
12024 pst
12025 !! wikitext
12026 Empty lines are trimmed
12027
12028
12029
12030
12031 !! html/php
12032 Empty lines are trimmed
12033 !! end
12034
12035 !! test
12036 pre-save transform: Signature expansion
12037 !! options
12038 pst
12039 !! wikitext
12040 * ~~~
12041 * <noinclude>~~~</noinclude>
12042 * <includeonly>~~~</includeonly>
12043 * <onlyinclude>~~~</onlyinclude>
12044 !! html/php
12045 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
12046 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
12047 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
12048 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
12049 !! end
12050
12051
12052 !! test
12053 pre-save transform: Signature expansion in nowiki tags (bug 93)
12054 !! options
12055 pst disabled
12056 !! wikitext
12057 Shall not expand:
12058
12059 <nowiki>~~~~</nowiki>
12060
12061 <includeonly><nowiki>~~~~</nowiki></includeonly>
12062
12063 <noinclude><nowiki>~~~~</nowiki></noinclude>
12064
12065 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12066
12067 {{subst:Foo}} shall be converted to FOO
12068
12069 As well as inside noinclude/onlyinclude
12070 <noinclude>{{subst:Foo}}</noinclude>
12071 <onlyinclude>{{subst:Foo}}</onlyinclude>
12072
12073 But not inside includeonly
12074 <includeonly>{{subst:Foo}}</includeonly>
12075 !! html/php
12076 Shall not expand:
12077
12078 <nowiki>~~~~</nowiki>
12079
12080 <includeonly><nowiki>~~~~</nowiki></includeonly>
12081
12082 <noinclude><nowiki>~~~~</nowiki></noinclude>
12083
12084 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12085
12086 FOO shall be converted to FOO
12087
12088 As well as inside noinclude/onlyinclude
12089 <noinclude>FOO</noinclude>
12090 <onlyinclude>FOO</onlyinclude>
12091
12092 But not inside includeonly
12093 <includeonly>{{subst:Foo}}</includeonly>
12094 !! end
12095
12096 !! test
12097 Parsoid: Recognize nowiki with trailing space in tags
12098 !! options
12099 parsoid=wt2html
12100 !! wikitext
12101 <nowiki ><div>[[foo]]</nowiki >
12102
12103 a<nowiki / >b
12104
12105 c<nowiki />d
12106
12107 e<nowiki/ >f
12108 !! html
12109 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12110 <p>ab</p>
12111 <p>cd</p>
12112 <p>ef</p>
12113 !! end
12114
12115 !! test
12116 Parsoid: Recognize nowiki with odd capitalization
12117 !! options
12118 parsoid=wt2html
12119 !! wikitext
12120 <noWikI ><div>[[foo]]</Nowiki >
12121 !! html
12122 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12123 !! end
12124
12125
12126 !! test
12127 Parsoid: Escape nowiki with trailing space in tags
12128 !! options
12129 parsoid=html2wt
12130 !! html
12131 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
12132 <p>a&lt;nowiki /&gt;b</p>
12133 <p>c&lt;nowiki/ &gt;d</p>
12134 !! wikitext
12135 &lt;nowiki &gt; foo &lt;/nowiki &gt;
12136
12137 a&lt;nowiki /&gt;b
12138
12139 c&lt;nowiki/ &gt;d
12140 !! end
12141
12142 !! test
12143 Parsoid: Escape weird noWikI capitalizations
12144 !! options
12145 parsoid=html2wt
12146 !! html
12147 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
12148 !! wikitext
12149 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
12150 !! end
12151
12152 ###
12153 ### Message transform tests
12154 ###
12155 !! test
12156 message transform: magic variables
12157 !! options
12158 msg
12159 !! wikitext
12160 {{SITENAME}}
12161 !! html
12162 MediaWiki
12163 !! end
12164
12165 !! test
12166 message transform: should not transform wiki markup
12167 !! options
12168 msg
12169 !! wikitext
12170 ''test''
12171 !! html
12172 ''test''
12173 !! end
12174
12175 !! test
12176 message transform: <noinclude> in transcluded template (bug 4926)
12177 !! options
12178 msg
12179 !! wikitext
12180 {{Includes}}
12181 !! html
12182 Foobar
12183 !! end
12184
12185 !! test
12186 message transform: <onlyinclude> in transcluded template (bug 4926)
12187 !! options
12188 msg
12189 !! wikitext
12190 {{Includes2}}
12191 !! html
12192 Foo
12193 !! end
12194
12195 !! test
12196 {{#special:}} page name, known
12197 !! options
12198 msg
12199 !! wikitext
12200 {{#special:Recentchanges}}
12201 !! html
12202 Special:RecentChanges
12203 !! end
12204
12205 !! test
12206 {{#special:}} page name with subpage, known
12207 !! options
12208 msg
12209 !! wikitext
12210 {{#special:Recentchanges/param}}
12211 !! html
12212 Special:RecentChanges/param
12213 !! end
12214
12215 !! test
12216 {{#special:}} page name, unknown
12217 !! options
12218 msg
12219 !! wikitext
12220 {{#special:foobar nonexistent}}
12221 !! html
12222 Special:Foobar nonexistent
12223 !! end
12224
12225 !! test
12226 {{#speciale:}} page name, known
12227 !! options
12228 msg
12229 !! wikitext
12230 {{#speciale:Recentchanges}}
12231 !! html
12232 Special:RecentChanges
12233 !! end
12234
12235 !! test
12236 {{#speciale:}} page name with subpage, known
12237 !! options
12238 msg
12239 !! wikitext
12240 {{#speciale:Recentchanges/param}}
12241 !! html
12242 Special:RecentChanges/param
12243 !! end
12244
12245 !! test
12246 {{#speciale:}} page name, unknown
12247 !! options
12248 msg
12249 !! wikitext
12250 {{#speciale:foobar nonexistent}}
12251 !! html
12252 Special:Foobar_nonexistent
12253 !! end
12254
12255 ###
12256 ### Images
12257 ###
12258 ### For Parsoid-specific tests, see
12259 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
12260
12261 !! test
12262 Simple image
12263 !! options
12264 parsoid=wt2html,wt2wt,html2html
12265 !! wikitext
12266 [[Image:foobar.jpg]]
12267 !! html/php
12268 <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>
12269 </p>
12270 !! html/parsoid
12271 <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>
12272 !! end
12273
12274 !! test
12275 Simple image (using File: namespace, now canonical)
12276 !! wikitext
12277 [[File:Foobar.jpg]]
12278 !! html/php
12279 <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>
12280 </p>
12281 !! html/parsoid
12282 <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>
12283 !! end
12284
12285 !! test
12286 Right-aligned image
12287 !! wikitext
12288 [[File:Foobar.jpg|right]]
12289 !! html/php
12290 <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>
12291
12292 !! html/parsoid
12293 <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>
12294 !! end
12295
12296 !! test
12297 Image with caption
12298 !! wikitext
12299 [[File:Foobar.jpg|right|Caption text]]
12300 !! html/php
12301 <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>
12302
12303 !! html/parsoid
12304 <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>
12305 !! end
12306
12307 !! test
12308 Image with caption, bug 53312 #1
12309 !! wikitext
12310 [[File:Foobar.jpg|right|Caption page stuff]]
12311 !! html/php
12312 <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>
12313
12314 !! html/parsoid
12315 <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>
12316 !! end
12317
12318 !! test
12319 Image with caption, bug 53312 #2
12320 !! wikitext
12321 [[File:Foobar.jpg|right|Caption page=]]
12322 !! html/php
12323 <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>
12324
12325 !! html/parsoid
12326 <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>
12327 !! end
12328
12329 !! test
12330 Image with caption, bug 53312 #3
12331 !! wikitext
12332 [[File:Foobar.jpg|right|Caption page=stuff]]
12333 !! html/php
12334 <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>
12335
12336 !! html/parsoid
12337 <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>
12338 !! end
12339
12340 !! test
12341 Allow empty links in image captions (Bug 60753)
12342 !! options
12343 thumbsize=220
12344 !! wikitext
12345 [[File:Foobar.jpg|thumb|Caption [[Link1]]
12346 [[]]
12347 [[Link2]]
12348 ]]
12349 !! html/php
12350 <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>
12351
12352 !! html/parsoid
12353 <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>
12354 [[]]
12355 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
12356 </figcaption></figure>
12357 !! end
12358
12359 !! test
12360 Titles in unlinked images (T23454)
12361 !! wikitext
12362 [[File:Foobar.jpg|link=|stuff]]
12363 !! html/php
12364 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
12365 </p>
12366 !! end
12367
12368 !! test
12369 Link with empty target
12370 !! wikitext
12371 [[]]
12372 !! html
12373 <p>[[]]
12374 </p>
12375 !! end
12376
12377 !! test
12378 Image with link trail
12379 !! wikitext
12380 Linktrails should not work for images: [[File:Foobar.jpg]]s
12381 !! html/php
12382 <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
12383 </p>
12384 !! html/parsoid
12385 <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>
12386 !! end
12387
12388 !! test
12389 Image with empty attribute
12390 !! options
12391 parsoid=wt2html,wt2wt,html2html
12392 !! wikitext
12393 [[File:Foobar.jpg|right||Caption text]]
12394 !! html/php
12395 <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>
12396
12397 !! html/parsoid
12398 <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>
12399 !! end
12400
12401 !! test
12402 1. Block image with individual attributes from templates
12403 !! wikitext
12404 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
12405 !! html/php
12406 <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>
12407
12408 !! html/parsoid
12409 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt2" data-mw='{"attribs":[["thumbnail",{"html":"thumb"}],["width",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[24,38,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;137px&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">137px&lt;/span>"}]]}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="16" width="137"/></a><figcaption>This is a caption</figcaption></figure>
12410 !! end
12411
12412 !! test
12413 2. Block Image with individual attributes from templates
12414 !! wikitext
12415 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
12416 !! html/php
12417 <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>
12418
12419 !! html/parsoid
12420 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt3" data-mw='{"attribs":[["thumbnail",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[18,32,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;thumb&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">thumb&lt;/span>"}],["width",{"html":"&lt;span about=\"#mwt2\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[33,47,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;137px&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">137px&lt;/span>"}]]}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="16" width="137"/></a><figcaption>This is a caption</figcaption></figure>
12421 !! end
12422
12423 !! test
12424 3. Inline image with individual attributes from templates
12425 !! wikitext
12426 [[File:Foobar.jpg|{{echo|50px}}]]
12427 !! html/php
12428 <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>
12429 </p>
12430 !! html/parsoid
12431 <p><span typeof="mw:Image mw:ExpandedAttrs" about="#mwt2" data-parsoid='{"optList":[{"ck":"width","ak":"{{echo|50px}}"}]}' data-mw='{"attribs":[["width",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[18,31,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;50px&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">50px&lt;/span>"}]]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></span></p>
12432 !! end
12433
12434 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
12435 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
12436 !! test
12437 Image with multiple attributes from the same template
12438 !! wikitext
12439 [[File:Foobar.jpg|{{image_attribs}}]]
12440 !! html/php
12441 <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>
12442
12443 !! html/parsoid
12444 <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>
12445 !! end
12446
12447 !! test
12448 Image with link tails
12449 !! options
12450 thumbsize=220
12451 !! wikitext
12452 123[[File:Foobar.jpg]]456
12453 123[[File:Foobar.jpg|right]]456
12454 123[[File:Foobar.jpg|thumb]]456
12455 !! html/php
12456 <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
12457 </p>
12458 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
12459 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
12460
12461 !! html/php+tidy
12462 <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>
12463 <p>123</p>
12464 <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>
12465 <p>456 123</p>
12466 <div class="thumb tright">
12467 <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>
12468 <div class="thumbcaption">
12469 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
12470 </div>
12471 </div>
12472 </div>
12473 <p>456</p>
12474 !! html/parsoid
12475 <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>
12476 <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>
12477 <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>
12478 !! end
12479
12480 !! test
12481 Image with multiple captions -- only last one is accepted
12482 !! wikitext
12483 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
12484 !! html/php
12485 <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>
12486
12487 !! html/parsoid
12488 <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>
12489 !! end
12490
12491 !! test
12492 Image with multiple widths -- use last
12493 !! wikitext
12494 [[File:Foobar.jpg|200px|300px|caption]]
12495 !! html/php
12496 <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>
12497 </p>
12498 !! html/parsoid
12499 <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>
12500 !! end
12501
12502 !! test
12503 Image with multiple alignments -- use first (bug 48664)
12504 !! options
12505 thumbsize=220
12506 !! wikitext
12507 [[File:Foobar.jpg|thumb|left|right|center|caption]]
12508
12509 [[File:Foobar.jpg|middle|text-top|caption]]
12510 !! html/php
12511 <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>
12512 <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>
12513 </p>
12514 !! html/parsoid
12515 <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>
12516 <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>
12517 !! end
12518
12519 !! test
12520 Image with width attribute at different positions
12521 !! wikitext
12522 [[File:Foobar.jpg|200px|right|Caption]]
12523 [[File:Foobar.jpg|right|200px|Caption]]
12524 [[File:Foobar.jpg|right|Caption|200px]]
12525 !! html/php
12526 <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>
12527 <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>
12528 <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>
12529
12530 !! html/parsoid
12531 <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>
12532 <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>
12533 <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>
12534 !! end
12535
12536 # a sad bit of backward-compatibility
12537 !! test
12538 Image with size specified with pxpx (bug 13500, 51628)
12539 !! options
12540 parsoid=wt2html,wt2wt,html2html
12541 !! wikitext
12542 [[File:Foobar.jpg|20pxpx]]
12543 [[File:Foobar.jpg|200x20pxpx]]
12544 !! html/php
12545 <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>
12546 <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>
12547 </p>
12548 !! html/parsoid
12549 <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>
12550 !! end
12551
12552 !! test
12553 Image with link parameter, wiki target
12554 !! wikitext
12555 [[File:Foobar.jpg|link=Main Page]]
12556 !! html/php
12557 <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>
12558 </p>
12559 !! html/parsoid
12560 <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>
12561 !! end
12562
12563 # parsoid bug 49293 (part 1)
12564 !! test
12565 Image with link parameter, URL target
12566 !! wikitext
12567 [[File:Foobar.jpg|link=http://example.com/]]
12568 !! html/php
12569 <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>
12570 </p>
12571 !! html/parsoid
12572 <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>
12573 !! end
12574
12575 # parsoid bug 49293 (part 2)
12576 !! test
12577 Image with link parameter, protocol-less URL target
12578 !! wikitext
12579 [[File:Foobar.jpg|link=//example.com/]]
12580 !! html/php
12581 <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>
12582 </p>
12583 !! html/parsoid
12584 <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>
12585 !! end
12586
12587 !! test
12588 Image with link parameter, wgExternalLinkTarget
12589 !! wikitext
12590 [[Image:foobar.jpg|link=http://example.com/]]
12591 !! config
12592 wgExternalLinkTarget='foobar'
12593 !! html
12594 <p><a href="http://example.com/" target="foobar" rel="nofollow"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
12595 </p>
12596 !! end
12597
12598 !! test
12599 Image with link parameter, wgNoFollowLinks set to false
12600 !! wikitext
12601 [[Image:foobar.jpg|link=http://example.com/]]
12602 !! config
12603 wgNoFollowLinks=false
12604 !! html
12605 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
12606 </p>
12607 !! end
12608
12609 !! test
12610 Image with link parameter, wgNoFollowDomainExceptions
12611 !! wikitext
12612 [[Image:foobar.jpg|link=http://example.com/]]
12613 !! config
12614 wgNoFollowDomainExceptions='example.com'
12615 !! html
12616 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
12617 </p>
12618 !! end
12619
12620 !! test
12621 Image with link parameter, wgExternalLinkTarget, unnamed parameter
12622 !! wikitext
12623 [[Image:foobar.jpg|link=http://example.com/|Title]]
12624 !! config
12625 wgExternalLinkTarget='foobar'
12626 !! html
12627 <p><a href="http://example.com/" title="Title" target="foobar" rel="nofollow"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
12628 </p>
12629 !! end
12630
12631 !! test
12632 Image with empty link parameter
12633 !! wikitext
12634 [[File:Foobar.jpg|link=]]
12635 !! html/php
12636 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
12637 </p>
12638 !! html/parsoid
12639 <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>
12640 !! end
12641
12642 !! test
12643 Image with link parameter (wiki target) and unnamed parameter
12644 !! wikitext
12645 [[File:Foobar.jpg|link=Main_Page|Title]]
12646 !! html/php
12647 <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>
12648 </p>
12649 !! html/parsoid
12650 <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>
12651 !! end
12652
12653 !! test
12654 Image with link parameter (URL target) and unnamed parameter
12655 !! wikitext
12656 [[File:Foobar.jpg|link=http://example.com/|Title]]
12657 !! html/php
12658 <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>
12659 </p>
12660 !! html/parsoid
12661 <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>
12662 !! end
12663
12664 !! test
12665 Thumbnail image with link parameter
12666 !! options
12667 thumbsize=220
12668 parsoid=wt2html,wt2wt,html2html
12669 !! wikitext
12670 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
12671 !! html/php
12672 <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>
12673
12674 !! html/parsoid
12675 <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>
12676 !! end
12677
12678 !! test
12679 Manually-specified thumbnail image
12680 !! options
12681 thumbsize=220
12682 !! wikitext
12683 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
12684 !! html/php
12685 <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>
12686
12687 !! html/parsoid
12688 <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>
12689 !! end
12690
12691 !! test
12692 Manually-specified thumbnail image with explicit link to wiki page
12693 !! options
12694 thumbsize=220
12695 parsoid=wt2html,wt2wt,html2html
12696 !! wikitext
12697 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
12698 !! html/php
12699 <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>
12700
12701 !! html/parsoid
12702 <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>
12703 !! end
12704
12705 !! test
12706 Manually-specified thumbnail image with explicit link to url
12707 !! options
12708 thumbsize=220
12709 parsoid=wt2html,wt2wt,html2html
12710 !! wikitext
12711 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
12712 !! html/php
12713 <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>
12714
12715 !! html/parsoid
12716 <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>
12717 !! end
12718
12719 !! test
12720 Manually-specified thumbnail image with explicit no link
12721 !! options
12722 thumbsize=220
12723 parsoid=wt2html,wt2wt,html2html
12724 !! wikitext
12725 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
12726 !! html/php
12727 <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>
12728
12729 !! html/parsoid
12730 <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>
12731 !! end
12732
12733 !! test
12734 Manually-specified thumbnail image with explicit link and alt text
12735 !! options
12736 thumbsize=220
12737 parsoid=wt2html,wt2wt,html2html
12738 !! wikitext
12739 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
12740 !! html/php
12741 <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>
12742
12743 !! html/parsoid
12744 <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>
12745 !! end
12746
12747 !! test
12748 Image with frame and link
12749 !! options
12750 parsoid=wt2html,wt2wt,html2html
12751 !! wikitext
12752 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
12753 !! html/php
12754 <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>
12755
12756 !! html/parsoid
12757 <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>
12758 !! end
12759
12760 !! test
12761 Image with frame and link and explicit alt
12762 !! options
12763 parsoid=wt2html,wt2wt,html2html
12764 !! wikitext
12765 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
12766 !! html/php
12767 <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>
12768
12769 !! html/parsoid
12770 <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>
12771 !! end
12772
12773 !! test
12774 Image with wiki markup in implicit alt
12775 !! options
12776 parsoid=wt2html,wt2wt,html2html
12777 !! wikitext
12778 [[Image:Foobar.jpg|testing '''bold''' in alt]]
12779
12780 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
12781 !! html/php
12782 <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>
12783 </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>
12784 </p>
12785 !! html/parsoid
12786 <p><span class="mw-default-size" typeof="mw:Image" data-mw="{&quot;caption&quot;:&quot;testing '''bold''' in alt&quot;}"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
12787 <p><span class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img alt="testing bold in alt" resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
12788 !! end
12789
12790 !! test
12791 Alt image option should handle most kinds of wikitext without barfing
12792 !! wikitext
12793 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
12794 !! html/php
12795 <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>
12796
12797 !! html/parsoid
12798 <figure class="mw-default-size" typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt2" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"This is the image caption"},{"ck":"alt","ak":"alt=This is a [[link]] and a {{echo|&#39;&#39;bold template&#39;&#39;}}."}]}' data-mw='{"attribs":[["thumbnail",{"html":"thumb"}],["alt",{"html":"alt=This is a &lt;a rel=\"mw:WikiLink\" href=\"./Link\" title=\"Link\" data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;simple&amp;quot;,&amp;quot;a&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;./Link&amp;quot;},&amp;quot;sa&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;link&amp;quot;},&amp;quot;dsr&amp;quot;:[65,73,2,2]}\">link&lt;/a> and a &lt;i about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;dsr&amp;quot;:[80,106,null,null],&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;&#39;&#39;bold template&#39;&#39;&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">bold template&lt;/i>."}]]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img alt="This is a link and a bold template." resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"alt":"This is a link and a bold template.","resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"alt":"alt=This is a [[link]] and a {{echo|&#39;&#39;bold template&#39;&#39;}}.","resource":"Image:Foobar.jpg"}}'/></a><figcaption>This is the image caption</figcaption></figure>
12799 !! end
12800
12801 ###################
12802 # Conflicting image format options.
12803 # First option specified should 'win'.
12804 # All three cases in each test should be identical.
12805
12806 !! test
12807 Image with 'frameless' first.
12808 !! options
12809 parsoid=wt2html,wt2wt,html2html
12810 !! wikitext
12811 [[File:Foobar.jpg|frameless|caption]]
12812
12813 [[File:Foobar.jpg|frameless|frame|caption]]
12814
12815 [[File:Foobar.jpg|frameless|thumb|caption]]
12816 !! html/php
12817 <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>
12818 </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>
12819 </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>
12820 </p>
12821 !! html/parsoid
12822 <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>
12823 <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>
12824 <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>
12825 !! end
12826
12827 !! test
12828 Image with 'frame' first.
12829 !! options
12830 parsoid=wt2html,wt2wt,html2html
12831 !! wikitext
12832 [[File:Foobar.jpg|frame|caption]]
12833 [[File:Foobar.jpg|frame|frameless|caption]]
12834 [[File:Foobar.jpg|frame|thumb|caption]]
12835 !! html/php
12836 <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>
12837 <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>
12838 <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>
12839
12840 !! html/parsoid
12841 <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>
12842 <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>
12843 <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>
12844 !! end
12845
12846 !! test
12847 Image with 'thumb' first.
12848 !! options
12849 parsoid=wt2html,wt2wt,html2html
12850 !! wikitext
12851 [[File:Foobar.jpg|thumb|caption]]
12852 [[File:Foobar.jpg|thumb|frameless|caption]]
12853 [[File:Foobar.jpg|thumb|frame|caption]]
12854 !! html/php
12855 <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>
12856 <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>
12857 <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>
12858
12859 !! html/parsoid
12860 <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>
12861 <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>
12862 <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>
12863 !! end
12864
12865 ###################
12866 # Image sizing.
12867 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
12868 # and https://bugzilla.wikimedia.org/show_bug.cgi?id=62258
12869 # Foobar has actual size of 1941x220
12870 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
12871 # a scalable format.
12872 # 2. Framed images always ignore size options; always render at default size.
12873 # 3. "Unspecified format" and border are the only types which can be
12874 # enlarged.
12875
12876 !! test
12877 Image: "unspecified format" and border enlarge
12878 !! options
12879 parsoid=wt2html,wt2wt,html2html
12880 !! wikitext
12881 [[File:Foobar.jpg|2000px]]
12882
12883 [[File:Foobar.jpg|border|2000px]]
12884 !! html/php
12885 <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>
12886 </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>
12887 </p>
12888 !! html/parsoid
12889 <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>
12890 <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>
12891 !! end
12892
12893 !! test
12894 Image: "unspecified format" and border reduce
12895 !! options
12896 parsoid=wt2html,wt2wt,html2html
12897 !! wikitext
12898 [[File:Foobar.jpg|1000px]]
12899
12900 [[File:Foobar.jpg|border|1000px]]
12901 !! html/php
12902 <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>
12903 </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>
12904 </p>
12905 !! html/parsoid
12906 <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>
12907 <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>
12908 !! end
12909
12910 !! test
12911 Image: thumbs reduce
12912 !! options
12913 parsoid=wt2html,wt2wt,html2html
12914 !! wikitext
12915 [[File:Foobar.jpg|thumb|50px]]
12916 !! html/php
12917 <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>
12918
12919 !! html/parsoid
12920 <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>
12921 !! end
12922
12923 !! test
12924 Image: bitmap thumbs can't be enlarged past original size, but vector can.
12925 !! options
12926 parsoid=wt2html,wt2wt,html2html
12927 !! wikitext
12928 [[File:Foobar.jpg|thumb|2000px]]
12929
12930 [[File:Foobar.svg|thumb|2000px]]
12931 !! html/php
12932 <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>
12933 <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>
12934
12935 !! html/parsoid
12936 <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>
12937 <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>
12938 !! end
12939
12940 !! test
12941 Image: frameless can reduce in size
12942 !! options
12943 parsoid=wt2html,wt2wt,html2html
12944 !! wikitext
12945 [[File:Foobar.jpg|frameless|50px]]
12946 !! html/php
12947 <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>
12948 </p>
12949 !! html/parsoid
12950 <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>
12951 !! end
12952
12953 !! test
12954 Image: bitmap frameless can't be enlarged past original size, but vector can
12955 !! options
12956 parsoid=wt2html,wt2wt,html2html
12957 !! wikitext
12958 [[File:Foobar.jpg|frameless|2000px]]
12959
12960 [[File:Foobar.svg|frameless|2000px]]
12961 !! html/php
12962 <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>
12963 </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>
12964 </p>
12965 !! html/parsoid
12966 <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>
12967 <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>
12968 !! end
12969
12970 !! test
12971 Image: framed images are always unscaled.
12972 !! options
12973 parsoid=wt2html,wt2wt,html2html
12974 !! wikitext
12975 [[File:Foobar.jpg|frame]]
12976
12977 [[File:Foobar.jpg|frame|50px]]
12978
12979 [[File:Foobar.jpg|frame|50x50px]]
12980
12981 [[File:Foobar.jpg|frame|2000px]]
12982 !! html/php
12983 <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>
12984 <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>
12985 <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>
12986 <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>
12987
12988 !! html/parsoid
12989 <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>
12990 <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>
12991 <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>
12992 <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>
12993 !! end
12994
12995 ###################
12996
12997 !! test
12998 Link to image page- image page normally doesn't exists, hence edit link
12999 Add test with existing image page
13000 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
13001 !! wikitext
13002 [[:Image:test]]
13003 !! html
13004 <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>
13005 </p>
13006 !! end
13007
13008 !! test
13009 bug 18784 Link to non-existent image page with caption should use caption as link text
13010 !! wikitext
13011 [[:Image:test|caption]]
13012 !! html
13013 <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>
13014 </p>
13015 !! end
13016
13017 !! test
13018 Frameless image caption with a free URL
13019 !! wikitext
13020 [[File:Foobar.jpg|http://example.com]]
13021 !! html/php
13022 <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>
13023 </p>
13024 !! html/parsoid
13025 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"http://example.com"}'><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>
13026 !! end
13027
13028 !! test
13029 Thumbnail image caption with a free URL
13030 !! options
13031 thumbsize=220
13032 !! wikitext
13033 [[File:Foobar.jpg|thumb|http://example.com]]
13034 !! html/php
13035 <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>
13036
13037 !! html/parsoid
13038 <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>
13039 !! end
13040
13041 !! test
13042 Thumbnail image caption with a free URL and explicit alt
13043 !! options
13044 thumbsize=220
13045 parsoid=wt2html,wt2wt,html2html
13046 !! wikitext
13047 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
13048 !! html/php
13049 <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>
13050
13051 !! html/parsoid
13052 <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>
13053 !! end
13054
13055 !! test
13056 SVG thumbnails with no language set
13057 !! options
13058 !! wikitext
13059 [[File:Foobar.svg|thumb|caption]]
13060 !! html/php
13061 <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>
13062
13063 !! html/parsoid
13064 <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>
13065 !! end
13066
13067 !! test
13068 SVG thumbnails with language de
13069 !! options
13070 parsoid=wt2html,wt2wt,html2html
13071 !! wikitext
13072 [[File:Foobar.svg|thumb|caption|lang=de]]
13073 !! html/php
13074 <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>
13075
13076 !! html/parsoid
13077 <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>
13078 !! end
13079
13080 !! test
13081 SVG thumbnails with invalid language code
13082 !! options
13083 parsoid=wt2html,wt2wt,html2html
13084 !! wikitext
13085 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
13086 !! html/php
13087 <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>
13088
13089 !! html/parsoid
13090 <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>
13091 !! end
13092
13093 !! test
13094 BUG 1887: A ISBN with a thumbnail
13095 !! wikitext
13096 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
13097 !! html/php
13098 <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>
13099
13100 !! html/parsoid
13101 <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:ExtLink">ISBN 1235467890</a></figcaption></figure>
13102 !! end
13103
13104 !! test
13105 BUG 1887: A RFC with a thumbnail
13106 !! wikitext
13107 [[File:Foobar.jpg|thumb|This is RFC 12354]]
13108 !! html/php
13109 <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>
13110
13111 !! html/parsoid
13112 <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>
13113 !! end
13114
13115 !! test
13116 BUG 1887: A mailto link with a thumbnail
13117 !! wikitext
13118 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
13119 !! html/php
13120 <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>
13121
13122 !! html/parsoid
13123 <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>
13124 !! end
13125
13126 # Pending resolution to bug 368
13127 !! test
13128 BUG 648: Frameless image caption with a link
13129 !! wikitext
13130 [[File:Foobar.jpg|text with a [[link]] in it]]
13131 !! html/php
13132 <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>
13133 </p>
13134 !! html/parsoid
13135 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"text with a [[link]] in it"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13136 !! end
13137
13138 !! test
13139 BUG 648: Frameless image caption with a link (suffix)
13140 !! wikitext
13141 [[File:Foobar.jpg|text with a [[link]]foo in it]]
13142 !! html/php
13143 <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>
13144 </p>
13145 !! html/parsoid
13146 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"text with a [[link]]foo in it"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13147 !! end
13148
13149 !! test
13150 BUG 648: Frameless image caption with an interwiki link
13151 !! wikitext
13152 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
13153 !! html/php
13154 <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>
13155 </p>
13156 !! html/parsoid
13157 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"text with a [[MeatBall:Link]] in it"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13158 !! end
13159
13160 !! test
13161 BUG 648: Frameless image caption with a piped interwiki link
13162 !! wikitext
13163 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
13164 !! html/php
13165 <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>
13166 </p>
13167 !! html/parsoid
13168 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"text with a [[MeatBall:Link|link]] in it"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13169 !! end
13170
13171 !! test
13172 Escape HTML special chars in image alt text
13173 !! wikitext
13174 [[File:Foobar.jpg|& < > "]]
13175 !! html/php
13176 <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>
13177 </p>
13178 !! html/parsoid
13179 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"&amp; &lt; > \""}'><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>
13180 !! end
13181
13182 !! test
13183 BUG 499: Alt text should have &#1234;, not &amp;1234;
13184 !! wikitext
13185 [[File:Foobar.jpg|&#9792;]]
13186 !! html/php
13187 <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>
13188 </p>
13189 !! html/parsoid
13190 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"&amp;#9792;"}'><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>
13191 !! end
13192
13193 !! test
13194 Broken image caption with link
13195 !! options
13196 parsoid=wt2html,wt2wt,html2html
13197 !! wikitext
13198 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
13199 !! html/php
13200 <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.
13201 </p>
13202 !! html/parsoid
13203 <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>
13204 !! end
13205
13206 !! test
13207 Image caption containing another image
13208 !! wikitext
13209 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
13210 !! html/php
13211 <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>
13212
13213 !! html/parsoid
13214 <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>
13215 !! end
13216
13217 !! test
13218 Image: caption containing a newline
13219 !! wikitext
13220 [[File:Foobar.jpg|This
13221 *is some text]]
13222 !! html/php
13223 <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>
13224 </p>
13225 !! html/parsoid
13226 <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>
13227 !!end
13228
13229 !!test
13230 Image: caption containing leading space
13231 (The leading space should not trigger nowiki escaping in wt2wt mode)
13232 !! wikitext
13233 [[File:Foobar.jpg|thumb| bar]]
13234 !! html/php
13235 <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>
13236
13237 !! html/parsoid
13238 <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>
13239 !!end
13240
13241 !! test
13242 Image: caption containing a table
13243 !! options
13244 parsoid=wt2html,wt2wt,html2html
13245 !! wikitext
13246 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
13247 {|
13248 ! Foo !! Bar
13249 |-
13250 | Foo1 || Bar1
13251 |}
13252 and some more text.]]
13253 !! html/php
13254 <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>
13255
13256 !! html/parsoid
13257 <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
13258 <table>
13259 <tbody>
13260 <tr><th>Foo </th><th>Bar</th></tr>
13261 <tr>
13262 <td>Foo1 </td>
13263 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
13264 !! end
13265
13266 !! test
13267 Bug 3090: External links other than http: in image captions
13268 !! wikitext
13269 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
13270 !! html/php
13271 <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>
13272
13273 !! html/parsoid
13274 <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>
13275 !! end
13276
13277 !! test
13278 Custom class
13279 !! options
13280 parsoid=wt2html,wt2wt,html2html
13281 !! wikitext
13282 [[Image:foobar.jpg|a|class=b]]
13283 !! html/php
13284 <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>
13285 </p>
13286 !! html/parsoid
13287 <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>
13288 !! end
13289
13290 !! test
13291 Localized image handling (1).
13292 !! options
13293 parsoid=wt2html,wt2wt,html2html
13294 language=es
13295 !! wikitext
13296 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
13297 !! html/php
13298 <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>
13299
13300 !! html/parsoid
13301 <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>
13302 !! end
13303
13304 !! test
13305 Localized image handling (2).
13306 !! options
13307 thumbsize=220
13308 parsoid=wt2html,wt2wt,html2html
13309 language=es
13310 !! wikitext
13311 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
13312 !! html/php
13313 <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>
13314
13315 !! html/parsoid
13316 <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>
13317 !! end
13318
13319 !! test
13320 "border", "frameless" and "class" attributes on an image.
13321 !! options
13322 thumbsize=220
13323 parsoid=wt2html,wt2wt,html2html
13324 !! wikitext
13325 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
13326 !! html/php
13327 <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>
13328 </p>
13329 !! html/parsoid
13330 <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>
13331 !! end
13332
13333 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
13334 !! test
13335 Invalid image attributes (bug 62500)
13336 !! options
13337 thumbsize=220
13338 parsoid=wt2html,wt2wt,html2html
13339 !! wikitext
13340 [[File:Foobar.jpg|thumb|float|left|caption]]
13341
13342 [[File:Foobar.jpg|thumb|righ|caption]]
13343
13344 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
13345 !! html/php
13346 <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>
13347 <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>
13348 <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>
13349
13350 !! html/parsoid
13351 <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>
13352 <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>
13353 <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>
13354 !! end
13355
13356 !! article
13357 File:Barfoo.jpg
13358 !! text
13359 #REDIRECT [[File:Barfoo.jpg]]
13360 !! endarticle
13361
13362 # FIXME: Parsoid should run this test -- but we'd need to teach the
13363 # mockAPI about the redirected Barfoo.jpg image.
13364 !! test
13365 Redirected image
13366 !! wikitext
13367 [[Image:Barfoo.jpg]]
13368 !! html/php
13369 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
13370 </p>
13371 !! end
13372
13373 !! test
13374 Missing image with uploads disabled
13375 !! options
13376 wgEnableUploads=0
13377 !! wikitext
13378 [[File:Foobaz.jpg]]
13379 !! html/php
13380 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
13381 </p>
13382 !! html/parsoid
13383 <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>
13384 !! end
13385
13386 # Parsoid-specific testing for images
13387 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
13388 # Currently imperfect due to a flaw in the Parsoid testrunner
13389 # Work in progress
13390 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
13391 # image tests.
13392
13393 !! test
13394 Parsoid-specific image handling - simple image with size and middle alignment
13395 !! wikitext
13396 [[File:Foobar.jpg|middle|50px]]
13397 !! html/parsoid
13398 <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>
13399 !! end
13400
13401 !! test
13402 Parsoid-specific image handling - simple image with size, middle alignment,
13403 non-standard namespace alias
13404 !! options
13405 parsoid=wt2wt,wt2html,html2html
13406 !! wikitext
13407 [[Image:Foobar.jpg|middle|50px]]
13408 !! html/parsoid
13409 <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>
13410 !! end
13411
13412 !! test
13413 Parsoid-specific image handling - simple image with size and middle alignment
13414 (existing content)
13415 !! wikitext
13416 [[File:Foobar.jpg|50px|middle]]
13417 !! html/parsoid
13418 <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>
13419 !! end
13420
13421 !! test
13422 Parsoid-specific image handling - simple image with size and middle alignment
13423 and non-standard namespace name
13424 !! options
13425 parsoid=wt2html,wt2wt,html2html
13426 !! wikitext
13427 [[Image:Foobar.jpg|50px|middle]]
13428 !! html/parsoid
13429 <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>
13430 !! end
13431
13432 !! test
13433 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
13434 !! wikitext
13435 [[File:Foobar.jpg|500x10px|baseline|caption]]
13436 !! html/parsoid
13437 <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>
13438 !! end
13439
13440 !! test
13441 Parsoid-specific image handling - simple image with border and size spec
13442 !! wikitext
13443 [[File:Foobar.jpg|50px|border|caption]]
13444 !! html/parsoid
13445 <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>
13446 !! end
13447
13448 !! test
13449 Parsoid-specific image handling - thumbnail with halign, valign, and caption
13450 !! wikitext
13451 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
13452 !! html/parsoid
13453 <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>
13454 !! end
13455
13456 !! test
13457 Parsoid-specific image handling - thumbnail with halign, valign, and caption
13458 (existing content)
13459 !! wikitext
13460 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
13461 !! html/parsoid
13462 <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>
13463 !! end
13464
13465 !! test
13466 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
13467 !! wikitext
13468 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
13469 !! html/parsoid
13470 <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>
13471 !! end
13472
13473 !! test
13474 Parsoid-specific image handling - thumbnail with specific size, halign,
13475 valign, and caption (existing content)
13476 !! wikitext
13477 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
13478 !! html/parsoid
13479 <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>
13480 !! end
13481
13482 !! test
13483 Parsoid-specific image handling - framed image with specific size and caption
13484 (size is ignored)
13485 !! options
13486 parsoid=wt2html,wt2wt,html2html
13487 !! wikitext
13488 [[File:Foobar.jpg|frame|500x50px|caption]]
13489 !! html/parsoid
13490 <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>
13491 !! end
13492
13493 !! test
13494 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
13495 (size is ignored)
13496 !! options
13497 parsoid=wt2html,wt2wt,html2html
13498 !! wikitext
13499 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
13500 !! html/parsoid
13501 <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>
13502 !! end
13503
13504 !! test
13505 Parsoid-specific image handling - frameless image with specific size, border, and caption
13506 !! wikitext
13507 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
13508 !! html/parsoid
13509 <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>
13510 !! end
13511
13512 !! test
13513 Parsoid-specific image handling - simple image with a formatted caption
13514 !! wikitext
13515 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
13516 !! html/parsoid
13517 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"&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>"}'><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>
13518 !! end
13519
13520 !! test
13521 Parsoid-specific image handling - caption with a template in it
13522 !! wikitext
13523 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
13524 !! html/parsoid
13525 <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>
13526 !! end
13527
13528 !! test
13529 Parsoid-specific image handling - caption with unbalanced tags in it
13530 !! options
13531 parsoid=wt2html,wt2wt,html2html
13532 !! wikitext
13533 foo
13534 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
13535 bar
13536 !! html/parsoid
13537 <p>foo</p>
13538 <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>
13539 <p>bar</p>
13540 !! end
13541
13542 !! test
13543 Parsoid-specific image handling - empty caption (1)
13544 !! options
13545 parsoid=wt2html,wt2wt
13546 !! wikitext
13547 [[File:Foobar.jpg|thumb|]]
13548 !! html/parsoid
13549 <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>
13550 !! end
13551
13552 # empty captions don't get serialized unless we're in the "round trip" case
13553 !! test
13554 Parsoid-specific image handling - empty caption (2)
13555 !! options
13556 parsoid=html2wt
13557 !! html/parsoid
13558 <figure class="mw-default-size" typeof="mw:Image/Thumb">
13559 <a href="./File:Foobar.jpg">
13560 <img resource="./File:Foobar.jpg"
13561 src="//example.com/images/3/3a/Foobar.jpg"
13562 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
13563 height="25" width="220"/>
13564 </a>
13565 <figcaption></figcaption>
13566 </figure>
13567 !! wikitext
13568 [[File:Foobar.jpg|thumb]]
13569 !! end
13570
13571 !! test
13572 Parsoid-specific image handling - whitespace caption
13573 !! wikitext
13574 [[File:Foobar.jpg|thumb| ]]
13575 !! html/parsoid
13576 <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>
13577 !! end
13578
13579 !! test
13580 Parsoid-specific image handling - lang option
13581 !! wikitext
13582 foo
13583 [[File:Foobar.svg|lang=de|caption]]
13584 bar
13585 !! html/parsoid
13586 <p>foo
13587 <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>
13588 bar</p>
13589 !! end
13590
13591
13592 ###
13593 ### Subpages
13594 ###
13595 !! article
13596 Subpage test/subpage
13597 !! text
13598 foo
13599 !! endarticle
13600
13601 !! test
13602 Subpage link
13603 !! options
13604 subpage title=[[Subpage test]]
13605 !! wikitext
13606 [[/subpage]]
13607 !! html
13608 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
13609 </p>
13610 !! end
13611
13612 !! test
13613 Subpage noslash link
13614 !! options
13615 subpage title=[[Subpage test]]
13616 !! wikitext
13617 [[/subpage/]]
13618 !! html
13619 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
13620 </p>
13621 !! end
13622
13623 !! article
13624 Subpage test/1/2/subpage
13625 !! text
13626 blah
13627 !! endarticle
13628
13629 !! test
13630 Relative subpage noslash link
13631 !! options
13632 parsoid=wt2wt,wt2html,html2html
13633 subpage title=[[Subpage test/1/2/3/4]]
13634 !! wikitext
13635 [[../../subpage/]]
13636
13637 [[../../subpage]]
13638 !! html/php
13639 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
13640 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
13641 </p>
13642 !! html/parsoid
13643 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
13644 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
13645 !! end
13646
13647 !! test
13648 Parsoid: dot-slash prefixed wikilinks
13649 !! wikitext
13650 [[./foo]]
13651
13652 [[././bar]]
13653
13654 [[././baz/]]
13655 !! html/php
13656 <p>[[./foo]]
13657 </p><p>[[././bar]]
13658 </p><p>[[././baz/]]
13659 </p>
13660 !! html/parsoid
13661 <p>[[./foo]]
13662 </p><p>[[././bar]]
13663 </p><p>[[././baz/]]
13664 </p>
13665 !! end
13666
13667 !! test
13668 Render invalid page names as plain text (bug 51090)
13669 !! wikitext
13670 [[./../foo|bar]]
13671 [[foo�|bar]]
13672 [[foo/.|bar]]
13673 [[foo/..|bar]]
13674 [[foo~~~bar]]
13675 [[foo>bar]]
13676 [[foo[bar]]
13677 [[.]]
13678 [[..]]
13679 [[foo././bar]]
13680
13681 [[{{echo|./../foo}}|bar]]
13682 [[{{echo|foo/.}}|bar]]
13683 [[{{echo|foo/..}}|bar]]
13684 [[{{echo|foo~~~~bar}}]]
13685 [[{{echo|foo>bar}}]]
13686 [[{{echo|foo././bar}}]]
13687 [[{{echo|foo{bar}}]]
13688 [[{{echo|foo}bar}}]]
13689 [[{{echo|foo[bar}}]]
13690 [[{{echo|foo]bar}}]]
13691 [[{{echo|foo<bar}}]]
13692 !!html/php
13693 <p>[[./../foo|bar]]
13694 [[foo�|bar]]
13695 [[foo/.|bar]]
13696 [[foo/..|bar]]
13697 [[foo~~~bar]]
13698 [[foo&gt;bar]]
13699 [[foo[bar]]
13700 [[.]]
13701 [[..]]
13702 [[foo././bar]]
13703 </p><p>[[./../foo|bar]]
13704 [[foo/.|bar]]
13705 [[foo/..|bar]]
13706 [[foo~~~~bar]]
13707 [[foo&gt;bar]]
13708 [[foo././bar]]
13709 [[foo{bar]]
13710 [[foo}bar]]
13711 [[foo[bar]]
13712 [[foo]bar]]
13713 [[foo&lt;bar]]
13714 </p>
13715 !!html/parsoid
13716 <p>[[./../foo|bar]]
13717 [[foo�|bar]]
13718 [[foo/.|bar]]
13719 [[foo/..|bar]]
13720 [[foo~~~bar]]
13721 [[foo>bar]]
13722 [[foo[bar]]
13723 [[.]]
13724 [[..]]
13725 [[foo././bar]]</p>
13726
13727 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
13728 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
13729 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
13730 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
13731 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
13732 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
13733 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
13734 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
13735 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
13736 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
13737 [[<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>
13738 !!end
13739
13740 !! test
13741 Disabled subpages
13742 !! wikitext
13743 [[/subpage]]
13744 !! html
13745 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
13746 </p>
13747 !! end
13748
13749 !! test
13750 BUG 561: {{/Subpage}}
13751 !! options
13752 subpage title=[[Page]]
13753 !! wikitext
13754 {{/Subpage}}
13755 !! html
13756 <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>
13757 </p>
13758 !! end
13759
13760 ###
13761 ### Categories
13762 ###
13763 !! article
13764 Category:MediaWiki User's Guide
13765 !! text
13766 blah
13767 !! endarticle
13768
13769 !! test
13770 Link to category
13771 !! wikitext
13772 [[:Category:MediaWiki User's Guide]]
13773 !! html
13774 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
13775 </p>
13776 !! end
13777
13778 !! test
13779 Simple category
13780 !! options
13781 cat
13782 !! wikitext
13783 [[Category:MediaWiki User's Guide]]
13784 !! html
13785 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
13786 !! end
13787
13788 !! test
13789 PAGESINCATEGORY invalid title fatal (r33546 fix)
13790 !! wikitext
13791 {{PAGESINCATEGORY:<bogus>}}
13792 !! html
13793 <p>0
13794 </p>
13795 !! end
13796
13797 !! test
13798 Category with different sort key
13799 !! options
13800 cat
13801 !! wikitext
13802 [[Category:MediaWiki User's Guide|Foo]]
13803 !! html
13804 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
13805 !! end
13806
13807 !! test
13808 Category with identical sort key
13809 !! options
13810 cat
13811 !! wikitext
13812 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
13813 !! html
13814 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
13815 !! end
13816
13817 !! test
13818 Category with empty sort key
13819 !! options
13820 cat
13821 pst
13822 !! wikitext
13823 [[Category:MediaWiki User's Guide|]]
13824 !! html
13825 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
13826 !! end
13827
13828 !! test
13829 Category with empty sort key and parentheses
13830 !! options
13831 cat
13832 pst
13833 !! wikitext
13834 [[Category:Foo (bar)|]]
13835 !! html
13836 [[Category:Foo (bar)|Foo]]
13837 !! end
13838
13839 !! test
13840 Category with link tail
13841 !! options
13842 cat
13843 pst
13844 !! wikitext
13845 123[[Category:Foo]]456
13846 !! html
13847 123[[Category:Foo]]456
13848 !! end
13849
13850 !! test
13851 Category with template
13852 !! options
13853 cat
13854 pst
13855 !! wikitext
13856 [[Category:{{echo|Foo}}]]
13857 !! html
13858 [[Category:{{echo|Foo}}]]
13859 !! end
13860
13861 !! test
13862 Category with template in sort key
13863 !! options
13864 cat
13865 pst
13866 !! wikitext
13867 [[Category:Foo|{{echo|Bar}}]]
13868 !! html
13869 [[Category:Foo|{{echo|Bar}}]]
13870 !! end
13871
13872 !! test
13873 Category with template in sort key and title
13874 !! options
13875 cat
13876 pst
13877 !! wikitext
13878 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
13879 !! html
13880 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
13881 !! end
13882
13883 !! test
13884 Category / paragraph interactions
13885 !! wikitext
13886 Foo [[Category:Baz]] Bar
13887
13888 Foo [[Category:Baz]]
13889 Bar
13890
13891 Foo
13892 [[Category:Baz]]
13893 Bar
13894
13895 Foo
13896 [[Category:Baz]] Bar
13897
13898 Foo
13899 [[Category:Baz]]
13900 [[Category:Baz]]
13901 [[Category:Baz]]
13902 Bar
13903
13904 [[Category:Baz]]
13905 [[Category:Baz]]
13906 [[Category:Baz]]
13907
13908 [[Category:Baz]]
13909 {{echo|[[Category:Baz]]}}
13910 [[Category:Baz]]
13911 !! html
13912 <p>Foo Bar
13913 </p><p>Foo
13914 Bar
13915 </p><p>Foo
13916 Bar
13917 </p><p>Foo Bar
13918 </p><p>Foo
13919 Bar
13920 </p>
13921 !! end
13922
13923 ## The whitespace on the empty line is part of the test. Please do not delete
13924 !! test
13925 1. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
13926 !! options
13927 parsoid=wt2html,wt2wt
13928 !! wikitext
13929 This
13930
13931 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
13932
13933 {{echo|[[Category:Foo]] and so should this!}}
13934 !! html
13935 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
13936 </p>
13937 !! html/parsoid
13938 <p>This
13939
13940 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
13941
13942 <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>
13943 !! end
13944
13945 ## Parsoid will not try to wt2wt this while preserving newlines because
13946 ## it suppresses excess newlines within list items -- and we don't want to
13947 ## introduce a special case just for categories, which is, in reality somewhat
13948 ## odd behavior -- categories are unlikely to be used in list items like this
13949 ## in top-level pages and are only likely to show up in template-generated
13950 ## list items where this RT-ing is a non-issue.
13951 ##
13952 ## The whitespace on the empty line is part of the test. Please do not delete
13953 !! test
13954 2. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
13955 !! options
13956 parsoid=wt2html
13957 !! wikitext
13958 * This
13959
13960 [[Category:Foo]] and this should be part of the same list item
13961 * So should this
13962
13963 {{echo|[[Category:Foo]] and this should be part of the same list item}}
13964 !! html
13965 <ul><li>This and this should be part of the same list item</li>
13966 <li>So should this and this should be part of the same list item</li></ul>
13967 !! html/parsoid
13968 <ul>
13969 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
13970 <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>
13971 </ul>
13972 !! end
13973
13974 ## Newlines and categories that follow the last item of a list
13975 ## are treated differently because this (list followed by categories)
13976 ## is an extremely common pattern on wikis.
13977 !! test
13978 3. Categories and newlines: newline suppression for last list item should RT properly
13979 !! wikitext
13980 * a
13981 * b
13982
13983 [[Category:Foo]]
13984
13985 [[Category:Bar]]
13986 [[Category:Baz]]
13987 !! html/parsoid
13988 <ul><li> a</li>
13989 <li> b</li></ul>
13990
13991 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
13992
13993 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
13994 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
13995 !! end
13996
13997 !! test
13998 4. Categories and newlines: newline suppression for last list item should RT properly
13999 !! wikitext
14000 * a
14001 **** b
14002
14003 [[Category:Foo]]
14004 !! html/parsoid
14005 <ul><li> a
14006 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
14007
14008 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14009 !! end
14010
14011 ## only wt2html for this to make sure the algo only applies to the rightmost path
14012 !! test
14013 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
14014 !! options
14015 parsoid=wt2html
14016 !! wikitext
14017 * a
14018 ** b
14019 [[Category:Foo]]
14020 * c
14021 ** d
14022 [[Category:Foo]]
14023 !! html/parsoid
14024 <ul><li> a
14025 <ul><li> b
14026 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
14027 <li> c
14028 <ul><li> d</li></ul></li></ul>
14029 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14030 !! end
14031
14032 !! test
14033 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
14034 !! wikitext
14035 * a [[Category:Foo]]
14036 !! html/parsoid
14037 <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>
14038 !! end
14039
14040 # This test also demonstrates because of newline+category tunneling
14041 # through the list hander, template wrapping doesn't expand to the
14042 # containing list when the list item swallows the category.
14043 !! test
14044 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
14045 !! wikitext
14046 * {{echo|a
14047 [[Category:Foo]]}}
14048 !! html/parsoid
14049 <ul><li> <span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n[[Category:Foo]]"}},"i":0}}]}'>a</span><span about="#mwt1">
14050 </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>
14051 !! end
14052
14053 !! test
14054 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
14055 !! wikitext
14056 * a
14057
14058 {{echo|[[Category:Foo]]
14059 [[Category:Bar]]}}
14060 [[Category:Baz]]
14061 !! html/parsoid
14062 <ul><li> a</li></ul>
14063
14064 <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","spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Category:Foo]]\n[[Category:Bar]]"}},"i":0}}]}'/><span about="#mwt1">
14065 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14066 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14067 !! end
14068
14069 !! test
14070 Parsoid: Serialize link to category page with colon escape
14071 !! options
14072 parsoid
14073 !! wikitext
14074
14075 [[:Category:Foo]]
14076 [[:Category:Foo|Bar]]
14077 !! html
14078 <p>
14079 <a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Category:Foo</a>
14080 <a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Bar</a>
14081 </p>
14082 !! end
14083
14084 # html2wt localizes the "Category" namespace.
14085 # XXX the <link> element needs an empty data-parsoid attribute, or
14086 # else the html2html test fails because spaces are inserted.
14087 !! test
14088 Link prefix/suffixes aren't applied to category links
14089 !! options
14090 parsoid=wt2html,wt2wt,html2html
14091 language=is
14092 !! wikitext
14093 x[[Category:Foo]]y
14094 !! html/php
14095 <p>xy
14096 </p>
14097 !! html/parsoid
14098 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
14099 !! end
14100
14101 !! test
14102 Parsoid: Serialize link to file page with colon escape
14103 !! options
14104 parsoid
14105 !! wikitext
14106
14107 [[:File:Foo.png]]
14108 [[:File:Foo.png|Bar]]
14109 !! html
14110 <p>
14111 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
14112 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
14113 </p>
14114 !! end
14115
14116 !! test
14117 Parsoid: Serialize a genuine category link without colon escape
14118 !! options
14119 parsoid
14120 !! wikitext
14121 [[Category:Foo]]
14122 [[Category:Foo|Bar]]
14123 !! html
14124 <link rel="mw:PageProp/Category" href="Category:Foo">
14125 <link rel="mw:PageProp/Category" href="Category:Foo#Bar">
14126 !! end
14127
14128 !! test
14129 Normalize hrefs properly before testing for invalid link targets (bug 70894)
14130 !! options
14131 parsoid=html2wt
14132 !! html
14133 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
14134 !! wikitext
14135 [[Category:Toxine bactérienne]]
14136 !! end
14137
14138 !! test
14139 Parsoid: Defaultsort
14140 !! wikitext
14141 {{DEFAULTSORT:Foo}}
14142 !! html/parsoid
14143 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
14144 !! end
14145
14146 !! test
14147 Parsoid: Defaultsort (template-generated)
14148 !! wikitext
14149 {{{{echo|DEFAULTSORT}}:Foo}}
14150 !! html/parsoid
14151 <meta property="mw:PageProp/categorydefaultsort" content="Foo" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"dsr":[0,28,null,null],"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"{{echo|DEFAULTSORT}}:Foo"},"params":{},"i":0}}]}'/>
14152 !! end
14153
14154 ###
14155 ### Inter-language links
14156 ###
14157 !! test
14158 Interlanguage links
14159 !! options
14160 ill
14161 !! wikitext
14162 [[es:Alimento]]
14163 [[fr:Nourriture]]
14164 [[zh:食品]]
14165 !! html/php
14166 es:Alimento fr:Nourriture zh:食品
14167 !! html/parsoid
14168 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
14169 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
14170 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
14171 !! end
14172
14173 !! test
14174 Duplicate interlanguage links (bug 24502)
14175 !! options
14176 ill
14177 !! wikitext
14178 [[es:1]]
14179 [[es:2]]
14180 [[fr:1]]
14181 [[fr:2]]
14182 !! html/php
14183 es:1 fr:1
14184 !! html/parsoid
14185 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
14186 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
14187 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
14188 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
14189 !! end
14190
14191 ###
14192 ### Sections
14193 ###
14194 !! test
14195 Basic section headings
14196 !! wikitext
14197 == Headline 1 ==
14198 Some text
14199
14200 ==Headline 2==
14201 More
14202 ===Smaller headline===
14203 Blah blah
14204 !! html
14205 <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>
14206 <p>Some text
14207 </p>
14208 <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>
14209 <p>More
14210 </p>
14211 <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>
14212 <p>Blah blah
14213 </p>
14214 !! end
14215
14216 !! test
14217 Section headings with TOC
14218 !! wikitext
14219 == Headline 1 ==
14220 === Subheadline 1 ===
14221 ===== Skipping a level =====
14222 ====== Skipping a level ======
14223
14224 == Headline 2 ==
14225 Some text
14226 ===Another headline===
14227 !! html
14228 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14229 <ul>
14230 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
14231 <ul>
14232 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
14233 <ul>
14234 <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>
14235 <ul>
14236 <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>
14237 </ul>
14238 </li>
14239 </ul>
14240 </li>
14241 </ul>
14242 </li>
14243 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
14244 <ul>
14245 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
14246 </ul>
14247 </li>
14248 </ul>
14249 </div>
14250
14251 <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>
14252 <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>
14253 <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>
14254 <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>
14255 <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>
14256 <p>Some text
14257 </p>
14258 <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>
14259
14260 !! end
14261
14262 !! test
14263 TOC anchors don't collide
14264 !! wikitext
14265 __FORCETOC__
14266 == Headline 2 ==
14267 == Headline ==
14268 == Headline 2 ==
14269 == Headline ==
14270 !! html/php
14271 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14272 <ul>
14273 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
14274 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
14275 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
14276 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
14277 </ul>
14278 </div>
14279
14280 <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>
14281 <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>
14282 <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>
14283 <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>
14284
14285 !! end
14286
14287 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
14288 !! test
14289 Handling of sections up to level 6 and beyond
14290 !! wikitext
14291 = Level 1 Heading=
14292 == Level 2 Heading==
14293 === Level 3 Heading===
14294 ==== Level 4 Heading====
14295 ===== Level 5 Heading=====
14296 ====== Level 6 Heading======
14297 ======= Level 7 Heading=======
14298 ======== Level 8 Heading========
14299 ========= Level 9 Heading=========
14300 ========== Level 10 Heading==========
14301 !! html
14302 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14303 <ul>
14304 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
14305 <ul>
14306 <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>
14307 <ul>
14308 <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>
14309 <ul>
14310 <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>
14311 <ul>
14312 <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>
14313 <ul>
14314 <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>
14315 <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>
14316 <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>
14317 <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>
14318 <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>
14319 </ul>
14320 </li>
14321 </ul>
14322 </li>
14323 </ul>
14324 </li>
14325 </ul>
14326 </li>
14327 </ul>
14328 </li>
14329 </ul>
14330 </div>
14331
14332 <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>
14333 <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>
14334 <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>
14335 <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>
14336 <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>
14337 <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>
14338 <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>
14339 <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>
14340 <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>
14341 <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>
14342
14343 !! end
14344
14345 !! test
14346 TOC regression (T11764)
14347 !! wikitext
14348 == title 1 ==
14349 === title 1.1 ===
14350 ==== title 1.1.1 ====
14351 === title 1.2 ===
14352 == title 2 ==
14353 === title 2.1 ===
14354 !! html
14355 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14356 <ul>
14357 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14358 <ul>
14359 <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>
14360 <ul>
14361 <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>
14362 </ul>
14363 </li>
14364 <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>
14365 </ul>
14366 </li>
14367 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
14368 <ul>
14369 <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>
14370 </ul>
14371 </li>
14372 </ul>
14373 </div>
14374
14375 <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>
14376 <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>
14377 <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>
14378 <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>
14379 <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>
14380 <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>
14381
14382 !! end
14383
14384 !! test
14385 TOC for heading containing <span id="..."></span> (T96153)
14386 !! wikitext
14387 __FORCETOC__
14388 ==<span id="old-anchor"></span>New title==
14389 !! html/php
14390 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14391 <ul>
14392 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
14393 </ul>
14394 </div>
14395
14396 <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>
14397
14398 !! end
14399
14400 !! test
14401 TOC with wgMaxTocLevel=3 (bug 6204)
14402 !! options
14403 wgMaxTocLevel=3
14404 !! wikitext
14405 == title 1 ==
14406 === title 1.1 ===
14407 ==== title 1.1.1 ====
14408 === title 1.2 ===
14409 == title 2 ==
14410 === title 2.1 ===
14411 !! html
14412 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14413 <ul>
14414 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14415 <ul>
14416 <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>
14417 <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>
14418 </ul>
14419 </li>
14420 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
14421 <ul>
14422 <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>
14423 </ul>
14424 </li>
14425 </ul>
14426 </div>
14427
14428 <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>
14429 <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>
14430 <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>
14431 <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>
14432 <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>
14433 <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>
14434
14435 !! end
14436
14437 !! test
14438 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
14439 !! options
14440 wgMaxTocLevel=3
14441 !! wikitext
14442 ==Section 1==
14443 ===Section 1.1===
14444 ====Section 1.1.1====
14445 ====Section 1.1.1.1====
14446 ==Section 2==
14447 !! html
14448 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14449 <ul>
14450 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
14451 <ul>
14452 <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>
14453 </ul>
14454 </li>
14455 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
14456 </ul>
14457 </div>
14458
14459 <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>
14460 <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>
14461 <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>
14462 <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>
14463 <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>
14464
14465 !! end
14466
14467
14468 !! test
14469 Resolving duplicate section names
14470 !! wikitext
14471 == Foo bar ==
14472 == Foo bar ==
14473 !! html
14474 <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>
14475 <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>
14476
14477 !! end
14478
14479 !! test
14480 Resolving duplicate section names with differing case (bug 10721)
14481 !! wikitext
14482 == Foo bar ==
14483 == Foo Bar ==
14484 !! html
14485 <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>
14486 <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>
14487
14488 !! end
14489
14490 !! article
14491 Template:sections
14492 !! text
14493 ===Section 1===
14494 ==Section 2==
14495 !! endarticle
14496
14497 !! test
14498 Template with sections, __NOTOC__
14499 !! wikitext
14500 __NOTOC__
14501 ==Section 0==
14502 {{sections}}
14503 ==Section 4==
14504 !! html
14505 <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>
14506 <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>
14507 <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>
14508 <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>
14509
14510 !! end
14511
14512 !! test
14513 __NOEDITSECTION__ keyword
14514 !! wikitext
14515 __NOEDITSECTION__
14516 ==Section 1==
14517 ==Section 2==
14518 !! html
14519 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
14520 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
14521
14522 !! end
14523
14524 !! test
14525 Link inside a section heading
14526 !! wikitext
14527 ==Section with a [[Main Page|link]] in it==
14528 !! html
14529 <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>
14530
14531 !! end
14532
14533 !! test
14534 TOC regression (T14077)
14535 !! wikitext
14536 __TOC__
14537 == title 1 ==
14538 === title 1.1 ===
14539 == title 2 ==
14540 !! html
14541 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14542 <ul>
14543 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14544 <ul>
14545 <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>
14546 </ul>
14547 </li>
14548 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
14549 </ul>
14550 </div>
14551
14552 <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>
14553 <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>
14554 <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>
14555
14556 !! end
14557
14558 !! test
14559 BUG 1219 URL next to image (good)
14560 !! wikitext
14561 http://example.com [[File:Foobar.jpg]]
14562 !! html/php
14563 <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>
14564 </p>
14565 !! html/parsoid
14566 <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>
14567 !!end
14568
14569 !! test
14570 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
14571 !! wikitext
14572 ===
14573 The line above must have a trailing space!
14574 === <!--
14575 --> <!-- -->
14576 But just in case it doesn't...
14577 !! html
14578 <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>
14579 <p>The line above must have a trailing space!
14580 </p>
14581 <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>
14582 <p>But just in case it doesn't...
14583 </p>
14584 !! end
14585
14586 !! test
14587 Header with special characters (bug 25462)
14588 !! wikitext
14589 The tooltips shall not show entities to the user (ie. be double escaped)
14590
14591 == text > text ==
14592 section 1
14593
14594 == text < text ==
14595 section 2
14596
14597 == text & text ==
14598 section 3
14599
14600 == text ' text ==
14601 section 4
14602
14603 == text " text ==
14604 section 5
14605 !! html
14606 <p>The tooltips shall not show entities to the user (ie. be double escaped)
14607 </p>
14608 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14609 <ul>
14610 <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>
14611 <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>
14612 <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>
14613 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
14614 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
14615 </ul>
14616 </div>
14617
14618 <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>
14619 <p>section 1
14620 </p>
14621 <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>
14622 <p>section 2
14623 </p>
14624 <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>
14625 <p>section 3
14626 </p>
14627 <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>
14628 <p>section 4
14629 </p>
14630 <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>
14631 <p>section 5
14632 </p>
14633 !! end
14634
14635 !! test
14636 Header with space, plus and underscore as entity
14637 !! wikitext
14638 Id should not contain + for spaces
14639
14640 == Space between Text ==
14641 section 1
14642
14643 == Space-Entity&#32;between&#32;Text ==
14644 section 2
14645
14646 == Plus+between+Text ==
14647 section 3
14648
14649 == Plus-Entity&#43;between&#43;Text ==
14650 section 4
14651
14652 == Underscore_between_Text ==
14653 section 5
14654
14655 == Underscore-Entity&#95;between&#95;Text ==
14656 section 6
14657
14658 [[#Space between Text]]
14659 [[#Space-Entity&#32;between&#32;Text]]
14660 [[#Plus+between+Text]]
14661 [[#Plus-Entity&#43;between&#43;Text]]
14662 [[#Underscore_between_Text]]
14663 [[#Underscore-Entity&#95;between&#95;Text]]
14664 !! html
14665 <p>Id should not contain + for spaces
14666 </p>
14667 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14668 <ul>
14669 <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>
14670 <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>
14671 <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>
14672 <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>
14673 <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>
14674 <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>
14675 </ul>
14676 </div>
14677
14678 <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>
14679 <p>section 1
14680 </p>
14681 <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>
14682 <p>section 2
14683 </p>
14684 <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>
14685 <p>section 3
14686 </p>
14687 <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>
14688 <p>section 4
14689 </p>
14690 <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>
14691 <p>section 5
14692 </p>
14693 <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>
14694 <p>section 6
14695 </p><p><a href="#Space_between_Text">#Space between Text</a>
14696 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
14697 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
14698 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
14699 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
14700 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
14701 </p>
14702 !! end
14703
14704 !! test
14705 Headers with excess '=' characters
14706 (Are similar tests necessary beyond the 1st level?)
14707 !! wikitext
14708 =foo==
14709 ==foo=
14710 =''italic'' heading==
14711 ==''italic'' heading=
14712 !! html
14713 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14714 <ul>
14715 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
14716 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
14717 <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>
14718 <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>
14719 </ul>
14720 </div>
14721
14722 <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>
14723 <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>
14724 <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>
14725 <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>
14726
14727 !! end
14728
14729 !! test
14730 HTML headers vs TOC (bug 23393)
14731 (__NOEDITSECTION__ for clearer output, doesn't matter here)
14732 !! wikitext
14733 <h1>Header 1</h1>
14734 == Header 1.1 ==
14735 == Header 1.2 ==
14736
14737 <h1>Header 2
14738 </h1>
14739 == Header 2.1 ==
14740 == Header 2.2 ==
14741 __NOEDITSECTION__
14742 !! html
14743 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14744 <ul>
14745 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
14746 <ul>
14747 <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>
14748 <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>
14749 </ul>
14750 </li>
14751 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
14752 <ul>
14753 <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>
14754 <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>
14755 </ul>
14756 </li>
14757 </ul>
14758 </div>
14759
14760 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
14761 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
14762 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
14763 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
14764 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
14765 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
14766
14767 !! end
14768
14769 !! test
14770 Single-line or multiline-comments can follow headings
14771 !! options
14772 parsoid=wt2html,wt2wt
14773 !! wikitext
14774 ==foo==<!---->
14775 ==bar==<!--c1-->
14776 ==baz==<!--
14777 c2
14778 c3-->
14779 !! html
14780 <h2><span class="mw-headline" id="foo">foo</span></h2>
14781 <h2><span class="mw-headline" id="bar">bar</span></h2>
14782 <h2><span class="mw-headline" id="baz">baz</span></h2>
14783
14784 !! end
14785
14786 !! test
14787 BUG 1219 URL next to image (broken)
14788 !! wikitext
14789 http://example.com[[File:Foobar.jpg]]
14790 !! html/php
14791 <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>
14792 </p>
14793 !! html/parsoid
14794 <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>
14795 !!end
14796
14797 !! test
14798 Bug 1186 news: in the middle of text
14799 !! wikitext
14800 http://en.wikinews.org/wiki/Wikinews:Workplace
14801 !! html
14802 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
14803 </p>
14804 !!end
14805
14806
14807 !! test
14808 Namespaced link must have a title
14809 !! wikitext
14810 [[Project:]]
14811 !! html
14812 <p>[[Project:]]
14813 </p>
14814 !!end
14815
14816 !! test
14817 Namespaced link must have a title (bad fragment version)
14818 !! wikitext
14819 [[Project:#fragment]]
14820 !! html
14821 <p>[[Project:#fragment]]
14822 </p>
14823 !!end
14824
14825
14826 ###
14827 ### HTML tags and HTML attributes
14828 ###
14829
14830 !! test
14831 div with no attributes
14832 !! wikitext
14833 <div>HTML rocks</div>
14834 !! html
14835 <div>HTML rocks</div>
14836
14837 !! end
14838
14839 !! test
14840 div with double-quoted attribute
14841 !! wikitext
14842 <div id="rock">HTML rocks</div>
14843 !! html
14844 <div id="rock">HTML rocks</div>
14845
14846 !! end
14847
14848 !! test
14849 div with single-quoted attribute
14850 !! wikitext
14851 <div id='rock'>HTML rocks</div>
14852 !! html
14853 <div id="rock">HTML rocks</div>
14854
14855 !! end
14856
14857 !! test
14858 div with unquoted attribute
14859 !! wikitext
14860 <div id=rock>HTML rocks</div>
14861 !! html
14862 <div id="rock">HTML rocks</div>
14863
14864 !! end
14865
14866 !! test
14867 div with illegal double attributes
14868 !! wikitext
14869 <div id="a" id="b">HTML rocks</div>
14870 !! html
14871 <div id="b">HTML rocks</div>
14872
14873 !!end
14874
14875 # FIXME: produce empty string instead of "class" in the PHP parser, following
14876 # the HTML5 spec.
14877 !! test
14878 div with empty attribute value, space before equals
14879 !! options
14880 parsoid
14881 !! wikitext
14882 <div class =>HTML rocks</div>
14883 !! html
14884 <div class="">HTML rocks</div>
14885
14886 !! end
14887
14888 !! test
14889 div with multiple empty attribute values
14890 !! options
14891 parsoid
14892 !! wikitext
14893 <div id= title=>HTML rocks</div>
14894 !! html
14895 <div id="" title="">HTML rocks</div>
14896
14897 !! end
14898
14899 !! test
14900 table with multiple empty attribute values
14901 !! options
14902 parsoid
14903 !! wikitext
14904 {| title= id=
14905 | hi
14906 |}
14907 !! html
14908 <table title="" id="">
14909 <tbody><tr><td> hi</td></tr>
14910 </tbody></table>
14911 !! end
14912
14913 !! test
14914 div with braces in attribute value
14915 !! wikitext
14916 <div title="{}">Foo</div>
14917 !! html/php
14918 <div title="&#123;}">Foo</div>
14919
14920 !! html/parsoid
14921 <div title="{}">Foo</div>
14922 !! end
14923
14924 # This it very inconsistent in the PHP parser: it returns
14925 # class="class" if there is a space between the name and the equal sign (see
14926 # 'div with empty attribute value, space before equals'), but strips the
14927 # attribute completely if the space is missing. We hope that not much content
14928 # depends on this, so are implementing the behavior below in Parsoid for
14929 # consistencies' sake.
14930 # FIXME: fix this behavior in the PHP parser?
14931 !! test
14932 div with empty attribute value, no space before equals
14933 !! options
14934 parsoid=wt2html,html2html
14935 !! wikitext
14936 <div class=>HTML rocks</div>
14937 !! html/php
14938 <div>HTML rocks</div>
14939
14940 !! html/parsoid
14941 <div class="">HTML rocks</div>
14942 !! end
14943
14944 !! test
14945 HTML multiple attributes correction
14946 !! wikitext
14947 <p class="error" class="awesome">Awesome!</p>
14948 !! html
14949 <p class="awesome">Awesome!</p>
14950
14951 !!end
14952
14953 !! test
14954 Table multiple attributes correction
14955 !! wikitext
14956 {|
14957 !+ class="error" class="awesome"| status
14958 |}
14959 !! html
14960 <table>
14961 <tr>
14962 <th class="awesome"> status
14963 </th></tr></table>
14964
14965 !!end
14966
14967 !! test
14968 DIV IN UPPERCASE
14969 !! wikitext
14970 <DIV ID="x">HTML ROCKS</DIV>
14971 !! html
14972 <div id="x">HTML ROCKS</div>
14973
14974 !!end
14975
14976 !! test
14977 Non-ASCII pseudo-tags are rendered as text
14978 !! wikitext
14979 <khyô>
14980 !! html
14981 <p>&lt;khyô&gt;
14982 </p>
14983 !! end
14984
14985 !! test
14986 Pseudo-tag with URL 'name' renders as url link
14987 !! wikitext
14988 <http://example.com/>
14989 !! html
14990 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
14991 </p>
14992 !! end
14993
14994 !! test
14995 text with amp in the middle of nowhere
14996 !! wikitext
14997 Remember AT&T?
14998 !! html
14999 <p>Remember AT&amp;T?
15000 </p>
15001 !! end
15002
15003 !! test
15004 text with character entity: eacute
15005 !! wikitext
15006 I always thought &eacute; was a cute letter.
15007 !! html
15008 <p>I always thought &#233; was a cute letter.
15009 </p>
15010 !! html+tidy
15011 <p>I always thought é was a cute letter.</p>
15012 !! end
15013
15014 !! test
15015 text with entity-escaped character entity-like string: eacute
15016 !! wikitext
15017 I always thought &amp;eacute; was a cute letter.
15018 !! html
15019 <p>I always thought &amp;eacute; was a cute letter.
15020 </p>
15021 !! end
15022
15023 !! test
15024 text with undefined character entity: xacute
15025 !! wikitext
15026 I always thought &xacute; was a cute letter.
15027 !! html
15028 <p>I always thought &amp;xacute; was a cute letter.
15029 </p>
15030 !! end
15031
15032 # TODO: generalize to PHP parser?
15033 !! test
15034 HTML5 tags
15035 !! options
15036 parsoid
15037 !! wikitext
15038 <data value="5">five</data>
15039 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
15040 <mark>This highlighted text</mark>
15041 !! html
15042 <p><data value="5">five</data>
15043 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
15044 <mark>This highlighted text</mark></p>
15045 !! end
15046
15047 !! test
15048 HTML tag with leading space is parsed as text
15049 !! wikitext
15050 < div>foo< /div>
15051 !! html
15052 <p>&lt; div&gt;foo&lt; /div&gt;
15053 </p>
15054 !! end
15055
15056 ###
15057 ### Nesting tests (see bug 41545, 50604, 51081)
15058 ###
15059
15060 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
15061 # Note that html2wt is considerably more difficult if we use <b> in
15062 # the test case, instead of <big>
15063 !! test
15064 Ensure that HTML adoption agency algorithm is properly implemented.
15065 !! wikitext
15066 <big>X<big>Y</big>Z</big>
15067 !! html
15068 <p><big>X<big>Y</big>Z</big>
15069 </p>
15070 !! end
15071
15072 # This was bug 41545 in the PHP parser.
15073 # Note that tidy doesn't handle this correctly.
15074 !! test
15075 Nesting of <kbd>
15076 !! wikitext
15077 <kbd>X<kbd>Y</kbd>Z</kbd>
15078 !! html
15079 <p><kbd>X<kbd>Y</kbd>Z</kbd>
15080 </p>
15081 !! end
15082
15083 # The following cases were bug 51081 in the PHP parser.
15084 # Note that there are some other nestable tags (b, i, etc) which are
15085 # not covered; see bug 51081 for discussion.
15086
15087 # Note that tidy doesn't handle this correctly.
15088 !! test
15089 Nesting of <em>
15090 !! wikitext
15091 <em>X<em>Y</em>Z</em>
15092 !! html
15093 <p><em>X<em>Y</em>Z</em>
15094 </p>
15095 !! end
15096
15097 # Note that tidy doesn't handle this correctly.
15098 !! test
15099 Nesting of <strong>
15100 !! wikitext
15101 <strong>X<strong>Y</strong>Z</strong>
15102 !! html
15103 <p><strong>X<strong>Y</strong>Z</strong>
15104 </p>
15105 !! end
15106
15107 !! test
15108 Nesting of <q>
15109 !! wikitext
15110 <q>X<q>Y</q>Z</q>
15111 !! html+tidy
15112 <p><q>X<q>Y</q>Z</q></p>
15113 !! end
15114
15115 # Note that tidy doesn't handle this correctly.
15116 !! test
15117 Nesting of <ruby>
15118 !! wikitext
15119 <ruby>X<ruby>Y</ruby>Z</ruby>
15120 !! html
15121 <p><ruby>X<ruby>Y</ruby>Z</ruby>
15122 </p>
15123 !! end
15124
15125 # Note that tidy doesn't handle this correctly.
15126 !! test
15127 Nesting of <bdo>
15128 !! wikitext
15129 <bdo>X<bdo>Y</bdo>Z</bdo>
15130 !! html
15131 <p><bdo>X<bdo>Y</bdo>Z</bdo>
15132 </p>
15133 !! end
15134
15135
15136 ###
15137 ### Media links
15138 ###
15139
15140 !! test
15141 Media link
15142 !! wikitext
15143 [[Media:Foobar.jpg]]
15144 !! html
15145 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
15146 </p>
15147 !! end
15148
15149 !! test
15150 Media link with text
15151 !! wikitext
15152 [[Media:Foobar.jpg|A neat file to look at]]
15153 !! html
15154 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
15155 </p>
15156 !! end
15157
15158 # FIXME: this is still bad HTML tag nesting
15159 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
15160 !! test
15161 Media link with nasty text
15162 !! wikitext
15163 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
15164 !! html
15165 <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>
15166
15167 !! html+tidy
15168 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
15169 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
15170 !! end
15171
15172 !! test
15173 Media link to nonexistent file (bug 1702)
15174 !! wikitext
15175 [[Media:No such.jpg]]
15176 !! html
15177 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
15178 </p>
15179 !! end
15180
15181 !! test
15182 Image link to nonexistent file (bug 1850 - good)
15183 !! wikitext
15184 [[File:No_such.jpg]]
15185 !! html/php
15186 <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>
15187 </p>
15188 !! html/parsoid
15189 <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>
15190 !! end
15191
15192 !! test
15193 :Image link to nonexistent file (bug 1850 - bad)
15194 !! wikitext
15195 [[:Image:No such.jpg]]
15196 !! html/php
15197 <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>
15198 </p>
15199 !! html/parsoid
15200 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
15201 !! end
15202
15203
15204
15205 !! test
15206 Character reference normalization in link text (bug 1938)
15207 !! wikitext
15208 [[Main Page|this&that]]
15209 !! html
15210 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
15211 </p>
15212 !!end
15213
15214 !! article
15215 אַ
15216 !! text
15217 Test for unicode normalization
15218
15219 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
15220 !! endarticle
15221
15222 !! test
15223 (bug 19451) Links should refer to the normalized form.
15224 !! wikitext
15225 [[&#xFB2E;]]
15226 [[&#x5d0;&#x5b7;]]
15227 [[&#x5d0;ַ]]
15228 [[א&#x5b7;]]
15229 [[אַ]]
15230 !! html
15231 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
15232 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
15233 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
15234 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
15235 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
15236 </p>
15237 !! end
15238
15239 !! test
15240 Empty attribute crash test (bug 2067)
15241 !! wikitext
15242 <font color="">foo</font>
15243 !! html
15244 <p><font color="">foo</font>
15245 </p>
15246 !! end
15247
15248 !! test
15249 Empty attribute crash test single-quotes (bug 2067)
15250 !! wikitext
15251 <font color=''>foo</font>
15252 !! html
15253 <p><font color="">foo</font>
15254 </p>
15255 !! end
15256
15257 !! test
15258 Attribute test: equals, then nothing
15259 !! wikitext
15260 <font color=>foo</font>
15261 !! html
15262 <p><font>foo</font>
15263 </p>
15264 !! end
15265
15266 !! test
15267 Attribute test: unquoted value
15268 !! wikitext
15269 <font color=x>foo</font>
15270 !! html
15271 <p><font color="x">foo</font>
15272 </p>
15273 !! end
15274
15275 !! test
15276 Attribute test: unquoted but illegal value (hash)
15277 !! wikitext
15278 <font color=#x>foo</font>
15279 !! html
15280 <p><font color="#x">foo</font>
15281 </p>
15282 !! end
15283
15284 # Parsoid does not serialize to empty attribute syntax,
15285 # so wt2wt and html2wt cases are skipped
15286 !! test
15287 Attribute test: no value (T54330)
15288 !! options
15289 parsoid=wt2html,html2html
15290 !! wikitext
15291 <font color>foo</font>
15292 !! html/php
15293 <p><font color="">foo</font>
15294 </p>
15295 !! html/parsoid
15296 <p><font color="">foo</font></p>
15297 !! end
15298
15299 !! test
15300 Bug 2095: link with three closing brackets
15301 !! wikitext
15302 [[Main Page]]]
15303 !! html/php
15304 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
15305 </p>
15306 !! html/parsoid
15307 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
15308 !! end
15309
15310 !! test
15311 Bug 2095: link with pipe and three closing brackets
15312 !! wikitext
15313 [[Main Page|link]]]
15314 !! html/php
15315 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
15316 </p>
15317 !! html/parsoid
15318 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
15319 !! end
15320
15321 !! test
15322 Bug 2095: link with pipe and three closing brackets, version 2
15323 !! wikitext
15324 [[Main Page|[http://example.com/]]]
15325 !! html/php
15326 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
15327 </p>
15328 !! html/parsoid
15329 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
15330 !! end
15331
15332
15333 ###
15334 ### Safety
15335 ###
15336
15337 !! article
15338 Template:Dangerous attribute
15339 !! text
15340 " onmouseover="alert(document.cookie)
15341 !! endarticle
15342
15343 !! article
15344 Template:Dangerous style attribute
15345 !! text
15346 border-size: expression(alert(document.cookie))
15347 !! endarticle
15348
15349 !! article
15350 Template:Div style
15351 !! text
15352 <div style="float: right; {{{1}}}">Magic div</div>
15353 !! endarticle
15354
15355 !! test
15356 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
15357 !! wikitext
15358 <div title="{{test}}"></div>
15359 !! html
15360 <div title="This is a test template"></div>
15361
15362 !! end
15363
15364 # Parsoid has enough context to handle this case
15365 !! test
15366 Bug 2304: HTML attribute safety (dangerous template; 2309)
15367 !! wikitext
15368 <div title="{{dangerous attribute}}"></div>
15369 !! html/php
15370 <div title=""></div>
15371
15372 !! html/parsoid
15373 <div title='" onmouseover="alert(document.cookie)' about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html","a":{"title":"\" onmouseover=\"alert(document.cookie)"},"sa":{"title":"{{dangerous attribute}}"}}' data-mw='{"attribs":[[{"txt":"title"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[]],&amp;quot;dsr&amp;quot;:[12,35,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;dangerous attribute&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Dangerous_attribute&amp;quot;},&amp;quot;params&amp;quot;:{},&amp;quot;i&amp;quot;:0}}]}\">\" onmouseover=\"alert(document.cookie)&lt;/span>"}]]}'></div>
15374 !! end
15375
15376 !! test
15377 Bug 2304: HTML attribute safety (dangerous style template; 2309)
15378 !! wikitext
15379 <div style="{{dangerous style attribute}}"></div>
15380 !! html
15381 <div style="/* insecure input */"></div>
15382
15383 !! end
15384
15385 !! test
15386 Bug 2304: HTML attribute safety (safe parameter; 2309)
15387 !! wikitext
15388 {{div style|width: 200px}}
15389 !! html
15390 <div style="float: right; width: 200px">Magic div</div>
15391
15392 !! end
15393
15394 !! test
15395 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
15396 !! wikitext
15397 {{div style|width: expression(alert(document.cookie))}}
15398 !! html
15399 <div style="/* insecure input */">Magic div</div>
15400
15401 !! end
15402
15403 !! test
15404 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
15405 !! wikitext
15406 {{div style|"><script>alert(document.cookie)</script>}}
15407 !! html
15408 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
15409
15410 !! end
15411
15412 !! test
15413 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
15414 !! wikitext
15415 {{div style|" ><script>alert(document.cookie)</script>}}
15416 !! html
15417 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
15418
15419 !! end
15420
15421 !! test
15422 Bug 2304: HTML attribute safety (link)
15423 !! wikitext
15424 <div title="[[Main Page]]"></div>
15425 !! html
15426 <div title="&#91;&#91;Main Page]]"></div>
15427
15428 !! end
15429
15430 !! test
15431 Bug 2304: HTML attribute safety (italics)
15432 !! wikitext
15433 <div title="''foobar''"></div>
15434 !! html
15435 <div title="&#39;&#39;foobar&#39;&#39;"></div>
15436
15437 !! end
15438
15439 !! test
15440 Bug 2304: HTML attribute safety (bold)
15441 !! wikitext
15442 <div title="'''foobar'''"></div>
15443 !! html
15444 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
15445
15446 !! end
15447
15448
15449 !! test
15450 Bug 2304: HTML attribute safety (ISBN)
15451 !! wikitext
15452 <div title="ISBN 1234567890"></div>
15453 !! html
15454 <div title="&#73;SBN 1234567890"></div>
15455
15456 !! end
15457
15458 !! test
15459 Bug 2304: HTML attribute safety (RFC)
15460 !! wikitext
15461 <div title="RFC 1234"></div>
15462 !! html
15463 <div title="&#82;FC 1234"></div>
15464
15465 !! end
15466
15467 !! test
15468 Bug 2304: HTML attribute safety (PMID)
15469 !! wikitext
15470 <div title="PMID 1234567890"></div>
15471 !! html
15472 <div title="&#80;MID 1234567890"></div>
15473
15474 !! end
15475
15476 !! test
15477 Bug 2304: HTML attribute safety (web link)
15478 !! wikitext
15479 <div title="http://example.com/"></div>
15480 !! html
15481 <div title="http&#58;//example.com/"></div>
15482
15483 !! end
15484
15485 !! test
15486 Bug 2304: HTML attribute safety (named web link)
15487 !! wikitext
15488 <div title="[http://example.com/ link]"></div>
15489 !! html
15490 <div title="&#91;http&#58;//example.com/ link]"></div>
15491
15492 !! end
15493
15494 !! test
15495 Bug 3244: HTML attribute safety (extension; safe)
15496 !! wikitext
15497 <div style="<nowiki>background:blue</nowiki>"></div>
15498 !! html
15499 <div style="background:blue"></div>
15500
15501 !! end
15502
15503 !! test
15504 Bug 3244: HTML attribute safety (extension; unsafe)
15505 !! wikitext
15506 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
15507 !! html
15508 <div style="/* insecure input */"></div>
15509
15510 !! end
15511
15512 # More MSIE fun discovered by Tom Gilder
15513
15514 !! test
15515 MSIE CSS safety test: spurious slash
15516 !! wikitext
15517 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
15518 !! html
15519 <div style="/* insecure input */">evil</div>
15520
15521 !! end
15522
15523 !! test
15524 MSIE CSS safety test: hex code
15525 !! wikitext
15526 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
15527 !! html
15528 <div style="/* insecure input */">evil</div>
15529
15530 !! end
15531
15532 !! test
15533 MSIE CSS safety test: comment in url
15534 !! wikitext
15535 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
15536 !! html
15537 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
15538
15539 !! end
15540
15541 !! test
15542 MSIE CSS safety test: comment in expression
15543 !! wikitext
15544 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
15545 !! html
15546 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
15547
15548 !! end
15549
15550 !! test
15551 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
15552 !! wikitext
15553 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
15554 !! html
15555 <p style="/* invalid control char */">A</p>
15556
15557 !! end
15558
15559 !! test
15560 MSIE 6 CSS safety test: Fullwidth (bug 55332)
15561 !! wikitext
15562 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
15563 <div style="top:EXPRESSION(alert())">B</div>
15564 !! html
15565 <p style="/* insecure input */">A</p>
15566 <div style="/* insecure input */">B</div>
15567
15568 !! end
15569
15570 !! test
15571 MSIE 6 CSS safety test: IPA extensions (bug 55332)
15572 !! wikitext
15573 <div style="background-image:uʀʟ(javascript:alert())">A</div>
15574 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
15575 !! html
15576 <div style="/* insecure input */">A</div>
15577 <p style="/* insecure input */">B</p>
15578
15579 !! end
15580
15581 !! test
15582 MSIE 6 CSS safety test: sup/sub script (bug 55332)
15583 !! wikitext
15584 <div style="background-image:url⁽javascript:alert())">A</div>
15585 <div style="background-image:url₍javascript:alert())">B</div>
15586 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
15587 !! html
15588 <div style="/* insecure input */">A</div>
15589 <div style="/* insecure input */">B</div>
15590 <p style="/* insecure input */">C</p>
15591
15592 !! end
15593
15594 !! test
15595 Opera -o-link CSS
15596 !! wikitext
15597 <div
15598 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;"
15599 style="-o-link:attr(title);-o-link-source:current">X</div>
15600 !! html
15601 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
15602
15603 !! end
15604
15605 !! test
15606 MSIE 6 CSS safety test: Repetition markers (bug 55332)
15607 !! wikitext
15608 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
15609 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
15610 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
15611 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
15612 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
15613 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
15614 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
15615 !! html
15616 <p style="/* insecure input */">A</p>
15617 <p style="/* insecure input */">B</p>
15618 <p style="/* insecure input */">C</p>
15619 <p style="/* insecure input */">D</p>
15620 <p style="/* insecure input */">E</p>
15621 <p style="/* insecure input */">F</p>
15622 <p style="/* insecure input */">G</p>
15623
15624 !! end
15625
15626 !! test
15627 Table attribute legitimate extension
15628 !! wikitext
15629 {|
15630 !+ style="<nowiki>color:blue</nowiki>"| status
15631 |}
15632 !! html
15633 <table>
15634 <tr>
15635 <th style="color:blue"> status
15636 </th></tr></table>
15637
15638 !!end
15639
15640 !! test
15641 Table attribute safety
15642 !! wikitext
15643 {|
15644 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
15645 |}
15646 !! html
15647 <table>
15648 <tr>
15649 <th style="/* insecure input */"> status
15650 </th></tr></table>
15651
15652 !! end
15653
15654 !! test
15655 CSS line continuation 1
15656 !! wikitext
15657 <div style="background-image: u\&#10;rl(test.jpg);"></div>
15658 !! html
15659 <div style="/* insecure input */"></div>
15660
15661 !! end
15662
15663 !! test
15664 CSS line continuation 2
15665 !! wikitext
15666 <div style="background-image: u\&#13;rl(test.jpg); "></div>
15667 !! html
15668 <div style="/* insecure input */"></div>
15669
15670 !! end
15671
15672 !! article
15673 Template:Identity
15674 !! text
15675 {{{1}}}
15676 !! endarticle
15677
15678 !! test
15679 Expansion of multi-line templates in attribute values (bug 6255)
15680 !! wikitext
15681 <div style="background: {{identity|#00FF00}}">-</div>
15682 !! html
15683 <div style="background: #00FF00">-</div>
15684
15685 !! end
15686
15687
15688 !! test
15689 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
15690 !! wikitext
15691 <div style="background:
15692 #00FF00">-</div>
15693 !! html/php
15694 <div style="background: #00FF00">-</div>
15695
15696 !! html/parsoid
15697 <div style="background:
15698 #00FF00">-</div>
15699 !! end
15700
15701 !! test
15702 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
15703 !! wikitext
15704 <div style="background: &#10;#00FF00">-</div>
15705 !! html
15706 <div style="background: &#10;#00FF00">-</div>
15707
15708 !! end
15709
15710 !! test
15711 evil <math>-wiki-tags without Extension:Math enabled
15712 !! wikitext
15713 <math><img src="some evil external link"><script>some_evil_javascript();</script></math>
15714 !! html+tidy
15715 <p>&lt;math&gt;&lt;img src="some evil external link"&gt;&lt;script&gt;some_evil_javascript();&lt;/script&gt;&lt;/math&gt;</p>
15716 !! end
15717
15718 ###
15719 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
15720 ###
15721 !! test
15722 Parser hook: empty input
15723 !! wikitext
15724 <tag></tag>
15725 !! html/php
15726 <pre>
15727 ''
15728 array (
15729 )
15730 </pre>
15731
15732 !! end
15733
15734 !! test
15735 Parser hook: empty input using terminated empty elements
15736 !! wikitext
15737 <tag/>
15738 !! html/php
15739 <pre>
15740 NULL
15741 array (
15742 )
15743 </pre>
15744
15745 !! end
15746
15747 !! test
15748 Parser hook: empty input using terminated empty elements (space before)
15749 !! wikitext
15750 <tag />
15751 !! html/php
15752 <pre>
15753 NULL
15754 array (
15755 )
15756 </pre>
15757
15758 !! end
15759
15760 !! test
15761 Parser hook: basic input
15762 !! wikitext
15763 <tag>input</tag>
15764 !! html/php
15765 <pre>
15766 'input'
15767 array (
15768 )
15769 </pre>
15770
15771 !! end
15772
15773
15774 !! test
15775 Parser hook: case insensitive
15776 !! wikitext
15777 <TAG>input</TAG>
15778 !! html/php
15779 <pre>
15780 'input'
15781 array (
15782 )
15783 </pre>
15784
15785 !! end
15786
15787
15788 !! test
15789 Parser hook: case insensitive, redux
15790 !! wikitext
15791 <TaG>input</TAg>
15792 !! html/php
15793 <pre>
15794 'input'
15795 array (
15796 )
15797 </pre>
15798
15799 !! end
15800
15801 !! test
15802 Parser hook: nested tags
15803 !! options
15804 noxml
15805 !! wikitext
15806 <tag><tag></tag></tag>
15807 !! html/php
15808 <pre>
15809 '<tag>'
15810 array (
15811 )
15812 </pre>&lt;/tag&gt;
15813
15814 !! end
15815
15816 !! test
15817 Parser hook: basic arguments
15818 !! wikitext
15819 <tag width=200 height = "100" depth = '50' square></tag>
15820 !! html/php
15821 <pre>
15822 ''
15823 array (
15824 'width' => '200',
15825 'height' => '100',
15826 'depth' => '50',
15827 'square' => '',
15828 )
15829 </pre>
15830
15831 !! end
15832
15833 !! test
15834 Parser hook: argument containing a forward slash (bug 5344)
15835 !! wikitext
15836 <tag filename='/tmp/bla'></tag>
15837 !! html/php
15838 <pre>
15839 ''
15840 array (
15841 'filename' => '/tmp/bla',
15842 )
15843 </pre>
15844
15845 !! end
15846
15847 !! test
15848 Parser hook: empty input using terminated empty elements (bug 2374)
15849 !! wikitext
15850 <tag foo=bar/>text
15851 !! html/php
15852 <pre>
15853 NULL
15854 array (
15855 'foo' => 'bar',
15856 )
15857 </pre>text
15858
15859 !! end
15860
15861 # </tag> should be output literally since there is no matching tag that begins it
15862 !! test
15863 Parser hook: basic arguments using terminated empty elements (bug 2374)
15864 !! wikitext
15865 <tag width=200 height = "100" depth = '50' square/>
15866 other stuff
15867 </tag>
15868 !! html/php
15869 <pre>
15870 NULL
15871 array (
15872 'width' => '200',
15873 'height' => '100',
15874 'depth' => '50',
15875 'square' => '',
15876 )
15877 </pre>
15878 <p>other stuff
15879 &lt;/tag&gt;
15880 </p>
15881 !! end
15882
15883 ###
15884 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
15885 ###
15886
15887 !! test
15888 Parser hook: static parser hook not inside a comment
15889 !! wikitext
15890 <statictag>hello, world</statictag>
15891 <statictag action=flush/>
15892 !! html/php
15893 <p>hello, world
15894 </p>
15895 !! end
15896
15897
15898 !! test
15899 Parser hook: static parser hook inside a comment
15900 !! wikitext
15901 <!-- <statictag>hello, world</statictag> -->
15902 <statictag action=flush/>
15903 !! html/php
15904 <p><br />
15905 </p>
15906 !! end
15907
15908 # Nested template calls; this case was broken by Parser.php rev 1.506,
15909 # since reverted.
15910
15911 !! article
15912 Template:One-parameter
15913 !! text
15914 (My parameter is: {{{1}}})
15915 !! endarticle
15916
15917 !! article
15918 Template:Map-one-parameter
15919 !! text
15920 {{{{{1}}}|{{{2}}}}}
15921 !! endarticle
15922
15923 !! test
15924 Nested template calls
15925 !! wikitext
15926 {{Map-one-parameter|One-parameter|param}}
15927 !! html
15928 <p>(My parameter is: param)
15929 </p>
15930 !! end
15931
15932
15933 ###
15934 ### Sanitizer
15935 ###
15936
15937 # HTML+Tidy effectively strips out the empty tags completely
15938 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
15939 # which Tidy would have done for the PHP parser had there been content inside it.
15940 !! test
15941 Sanitizer: Closing of open tags
15942 !! wikitext
15943 <s></s><table></table>
15944 !! html
15945 <s></s><table></table>
15946
15947 !! html/parsoid
15948 <p><s></s></p><table></table>
15949 !! end
15950
15951 !! test
15952 Sanitizer: Closing of open but not closed tags
15953 !! wikitext
15954 <s>foo
15955 !! html
15956 <p><s>foo</s>
15957 </p>
15958 !! end
15959
15960 !! test
15961 Sanitizer: Closing of closed but not open tags
15962 !! options
15963 parsoid=wt2html
15964 !! wikitext
15965 </s>
15966 !! html/php+tidy
15967 !! html/parsoid
15968 !! end
15969
15970 !! test
15971 Sanitizer: Closing of closed but not open table tags
15972 !! options
15973 parsoid=wt2html
15974 !! wikitext
15975 Table not started</td></tr></table>
15976 !! html/php+tidy
15977 <p>Table not started</p>
15978 !! html/parsoid
15979 <p>Table not started</p>
15980 !! end
15981
15982 !! test
15983 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
15984 !! wikitext
15985 <span id="æ: v">byte</span>[[#æ: v|backlink]]
15986 !! html
15987 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
15988 </p>
15989 !! end
15990
15991 # In HTML5, the restrictions are that id must contain at least one character,
15992 # and must not contain any space characters.
15993 !! test
15994 Sanitizer: Validating the contents of the id attribute (bug 4515)
15995 !! options
15996 disabled
15997 !! wikitext
15998 <br id="" /><br id="a space" />
15999 !! html
16000 Something ...
16001 !! end
16002
16003 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
16004 !! test
16005 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
16006 !! options
16007 disabled
16008 !! wikitext
16009 <br id="foo" /><br id="foo" />
16010 !! html
16011 Something need to be done. foo-2 ?
16012 !! end
16013
16014 !! test
16015 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
16016 !! wikitext
16017 <div itemscope>
16018 <meta itemprop="hello" content="world">
16019 <meta http-equiv="refresh" content="5">
16020 <meta itemprop="hello" http-equiv="refresh" content="5">
16021 <link itemprop="hello" href="{{SERVER}}">
16022 <link rel="stylesheet" href="{{SERVER}}">
16023 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
16024 </div>
16025 !! html
16026 <div itemscope="">
16027 <p> <meta itemprop="hello" content="world" />
16028 &lt;meta http-equiv="refresh" content="5"&gt;
16029 <meta itemprop="hello" content="5" />
16030 </p>
16031 <link itemprop="hello" href="http&#58;//example.org" />
16032 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
16033 <link itemprop="hello" href="http&#58;//example.org" />
16034 </div>
16035
16036 !! end
16037
16038 !! test
16039 Language converter: output gets cut off unexpectedly (bug 5757)
16040 !! options
16041 language=zh
16042 !! wikitext
16043 this bit is safe: }-
16044
16045 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
16046
16047 then we get cut off here: }-
16048
16049 all additional text is vanished
16050 !! html
16051 <p>this bit is safe: }-
16052 </p><p>but if we add a conversion instance: xxx
16053 </p><p>then we get cut off here: }-
16054 </p><p>all additional text is vanished
16055 </p>
16056 !! end
16057
16058 !! test
16059 Self closed html pairs (bug 5487)
16060 !! options
16061 !! wikitext
16062 <center><font id="bug" />Centered text</center>
16063 <div><font id="bug2" />In div text</div>
16064 !! html
16065 <center>&lt;font id="bug" /&gt;Centered text</center>
16066 <div>&lt;font id="bug2" /&gt;In div text</div>
16067
16068 !! end
16069
16070 #
16071 #
16072 #
16073
16074 !! test
16075 Punctuation: nbsp before exclamation
16076 !! wikitext
16077 C'est grave !
16078 !! html
16079 <p>C'est grave&#160;!
16080 </p>
16081 !! end
16082
16083 !! test
16084 Punctuation: CSS !important (bug 11874)
16085 !! wikitext
16086 <div style="width:50% !important">important</div>
16087 !! html
16088 <div style="width:50% !important">important</div>
16089
16090 !!end
16091
16092 !! test
16093 Punctuation: CSS ! important (bug 11874; with space after)
16094 !! wikitext
16095 <div style="width:50% ! important">important</div>
16096 !! html
16097 <div style="width:50% ! important">important</div>
16098
16099 !!end
16100
16101 !! test
16102 HTML bullet list, closed tags (bug 5497)
16103 !! wikitext
16104 <ul>
16105 <li>One</li>
16106 <li>Two</li>
16107 </ul>
16108 !! html/php
16109 <ul>
16110 <li>One</li>
16111 <li>Two</li>
16112 </ul>
16113
16114 !! html/parsoid
16115 <ul data-parsoid='{"stx":"html"}'>
16116 <li data-parsoid='{"stx":"html"}'>One</li>
16117 <li data-parsoid='{"stx":"html"}'>Two</li>
16118 </ul>
16119
16120 !! end
16121
16122 !! test
16123 HTML bullet list, unclosed tags (bug 5497)
16124 !! wikitext
16125 <ul>
16126 <li>One
16127 <li>Two
16128 </ul>
16129 !! html/php+tidy
16130 <ul>
16131 <li>One</li>
16132 <li>Two</li>
16133 </ul>
16134 !! html/parsoid
16135 <ul data-parsoid='{"stx":"html"}'>
16136 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
16137 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
16138 </ul>
16139
16140 !! end
16141
16142 !! test
16143 HTML ordered list, closed tags (bug 5497)
16144 !! wikitext
16145 <ol>
16146 <li>One</li>
16147 <li>Two</li>
16148 </ol>
16149 !! html/php
16150 <ol>
16151 <li>One</li>
16152 <li>Two</li>
16153 </ol>
16154
16155 !! html/parsoid
16156 <ol data-parsoid='{"stx":"html"}'>
16157 <li data-parsoid='{"stx":"html"}'>One</li>
16158 <li data-parsoid='{"stx":"html"}'>Two</li>
16159 </ol>
16160
16161 !! end
16162
16163 !! test
16164 HTML ordered list, unclosed tags (bug 5497)
16165 !! options
16166 !! wikitext
16167 <ol>
16168 <li>One
16169 <li>Two
16170 </ol>
16171 !! html/php+tidy
16172 <ol>
16173 <li>One</li>
16174 <li>Two</li>
16175 </ol>
16176 !! html/parsoid
16177 <ol data-parsoid='{"stx":"html"}'>
16178 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
16179 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
16180 </ol>
16181
16182 !! end
16183
16184 !! test
16185 HTML nested bullet list, closed tags (bug 5497)
16186 !! wikitext
16187 <ul>
16188 <li>One</li>
16189 <li>Two:
16190 <ul>
16191 <li>Sub-one</li>
16192 <li>Sub-two</li>
16193 </ul>
16194 </li>
16195 </ul>
16196 !! html
16197 <ul>
16198 <li>One</li>
16199 <li>Two:
16200 <ul>
16201 <li>Sub-one</li>
16202 <li>Sub-two</li>
16203 </ul>
16204 </li>
16205 </ul>
16206
16207 !! end
16208
16209 !! test
16210 HTML nested bullet list, open tags (bug 5497)
16211 !! wikitext
16212 <ul>
16213 <li>One
16214 <li>Two:
16215 <ul>
16216 <li>Sub-one
16217 <li>Sub-two
16218 </ul>
16219 </ul>
16220 !! html/php+tidy
16221 <ul>
16222 <li>One</li>
16223 <li>Two:
16224 <ul>
16225 <li>Sub-one</li>
16226 <li>Sub-two</li>
16227 </ul>
16228 </li>
16229 </ul>
16230 !! html/parsoid
16231 <ul>
16232 <li>One
16233 </li>
16234 <li>Two:
16235 <ul>
16236 <li>Sub-one
16237 </li>
16238 <li>Sub-two
16239 </li>
16240 </ul>
16241 </li>
16242 </ul>
16243
16244 !! end
16245
16246 !! test
16247 HTML nested ordered list, closed tags (bug 5497)
16248 !! wikitext
16249 <ol>
16250 <li>One</li>
16251 <li>Two:
16252 <ol>
16253 <li>Sub-one</li>
16254 <li>Sub-two</li>
16255 </ol>
16256 </li>
16257 </ol>
16258 !! html
16259 <ol>
16260 <li>One</li>
16261 <li>Two:
16262 <ol>
16263 <li>Sub-one</li>
16264 <li>Sub-two</li>
16265 </ol>
16266 </li>
16267 </ol>
16268
16269 !! end
16270
16271 !! test
16272 HTML nested ordered list, open tags (bug 5497)
16273 !! wikitext
16274 <ol>
16275 <li>One
16276 <li>Two:
16277 <ol>
16278 <li>Sub-one
16279 <li>Sub-two
16280 </ol>
16281 </ol>
16282 !! html/php
16283 <ol>
16284 <li>One
16285 <li>Two:
16286 <ol>
16287 <li>Sub-one
16288 <li>Sub-two
16289 </ol>
16290 </ol>
16291
16292 !! html/parsoid
16293 <ol>
16294 <li>One
16295 </li>
16296 <li>Two:
16297 <ol>
16298 <li>Sub-one
16299 </li>
16300 <li>Sub-two
16301 </li>
16302 </ol>
16303 </li>
16304 </ol>
16305
16306 !! end
16307
16308 !! test
16309 HTML ordered list item with parameters oddity
16310 !! wikitext
16311 <ol><li id="fragment">One</li>
16312 </ol>
16313 !! html
16314 <ol><li id="fragment">One</li>
16315 </ol>
16316
16317 !! end
16318
16319 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
16320 !!test
16321 bug 5918: autonumbering
16322 !! wikitext
16323 [http://first/] [http://second] [ftp://ftp]
16324
16325 ftp://inlineftp
16326
16327 [mailto:enclosed@mail.tld With target]
16328
16329 [mailto:enclosed@mail.tld]
16330
16331 mailto:inline@mail.tld
16332 !! html/php
16333 <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>
16334 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
16335 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
16336 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
16337 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
16338 </p>
16339 !! html/parsoid
16340 <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>
16341 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
16342 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
16343 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
16344 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
16345 !! end
16346
16347
16348 #
16349 # Security and HTML correctness
16350 # From Nick Jenkins' fuzz testing
16351 #
16352
16353 !! test
16354 Fuzz testing: Parser13
16355 !! wikitext
16356 {|
16357 | http://a|
16358 !! html
16359 <table>
16360 <tr>
16361 <td>
16362 </td>
16363 </tr>
16364 </table>
16365
16366 !! end
16367
16368 !! test
16369 Fuzz testing: Parser14
16370 !! wikitext
16371 == onmouseover= ==
16372 http://__TOC__
16373 !! html
16374 <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>
16375 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16376 <ul>
16377 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
16378 </ul>
16379 </div>
16380
16381
16382 !! html+tidy
16383 <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>
16384 <p>http://</p>
16385 <div id="toc" class="toc">
16386 <div id="toctitle">
16387 <h2>Contents</h2>
16388 </div>
16389 <ul>
16390 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
16391 </ul>
16392 </div>
16393 <p></p>
16394 !! end
16395
16396 !! test
16397 Fuzz testing: Parser14-table
16398 !! wikitext
16399 ==a==
16400 {| STYLE=__TOC__
16401 !! html
16402 <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>
16403 <table style="&#95;_TOC&#95;_">
16404 <tr><td></td></tr>
16405 </table>
16406
16407 !! html+tidy
16408 <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>
16409 <table style="__TOC__">
16410 <tr>
16411 <td></td>
16412 </tr>
16413 </table>
16414 !! end
16415
16416 # Known to produce bogus xml (extra </td>)
16417 !! test
16418 Fuzz testing: Parser16
16419 !! options
16420 noxml
16421 !! wikitext
16422 {|
16423 !https://||||||
16424 !! html
16425 <table>
16426 <tr>
16427 <th>https://</th>
16428 <th></th>
16429 <th></th>
16430 <th>
16431 </td>
16432 </tr>
16433 </table>
16434
16435 !! html+tidy
16436 <table>
16437 <tr>
16438 <th>https://</th>
16439 <th></th>
16440 <th></th>
16441 <th></th>
16442 </tr>
16443 </table>
16444 !! end
16445
16446 !! test
16447 Fuzz testing: Parser21
16448 !! wikitext
16449 {|
16450 ! irc://{{ftp://a" onmouseover="alert('hello world');"
16451 |
16452 !! html
16453 <table>
16454 <tr>
16455 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
16456 </th>
16457 <td>
16458 </td>
16459 </tr>
16460 </table>
16461
16462 !! end
16463
16464 !! test
16465 Fuzz testing: Parser22
16466 !! wikitext
16467 http://===r:::https://b
16468
16469 {|
16470 !! html
16471 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
16472 </p>
16473 <table>
16474 <tr><td></td></tr>
16475 </table>
16476
16477 !! end
16478
16479 # Known to produce bad XML for now
16480 !! test
16481 Fuzz testing: Parser24
16482 !! options
16483 noxml
16484 !! wikitext
16485 {|
16486 {{{|
16487 <u CLASS=
16488 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
16489 <br style="onmouseover='alert(document.cookie);' " />
16490
16491 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
16492 |
16493 !! html
16494 <table>
16495 {{{|
16496 <u class="&#124;">}}}} &gt;
16497 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
16498
16499 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
16500 <tr>
16501 <td></u>
16502 </td>
16503 </tr>
16504 </table>
16505
16506 !! end
16507
16508 # Note: the current result listed for this is not what the original one was,
16509 # but the original bug was JavaScript injection, which is fixed in any case.
16510 # It's not clear that the original result listed was any more correct than the
16511 # current one. Original result:
16512 # <p>{{{|
16513 # </p>
16514 # <li class="&#124;&#124;">
16515 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
16516 !!test
16517 Fuzz testing: Parser25 (bug 6055)
16518 !! wikitext
16519 {{{
16520 |
16521 <LI CLASS=||
16522 >
16523 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
16524 !! html
16525 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
16526 </p>
16527 !! end
16528
16529 !!test
16530 Fuzz testing: URL adjacent extension (with space, clean)
16531 !! wikitext
16532 http://example.com <nowiki>junk</nowiki>
16533 !! html/php
16534 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
16535 </p>
16536 !! html/parsoid
16537 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
16538 !! end
16539
16540 !!test
16541 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
16542 !! wikitext
16543 http://example.com<nowiki>junk</nowiki>
16544 !! html/php
16545 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
16546 </p>
16547 !! html/parsoid
16548 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
16549 !! end
16550
16551 !!test
16552 Fuzz testing: URL adjacent extension (no space, dirty; pre)
16553 !! wikitext
16554 http://example.com<pre>junk</pre>
16555 !! html/php
16556 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
16557
16558 !! html/php+tidy
16559 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
16560 <pre>
16561 junk
16562 </pre>
16563 !! html/parsoid
16564 <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>
16565 !!end
16566
16567 !!test
16568 Fuzz testing: image with bogus manual thumbnail
16569 !! wikitext
16570 [[Image:foobar.jpg|thumbnail= ]]
16571 !! html/php
16572 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
16573
16574 !! html/parsoid
16575 <figure class="mw-default-size" typeof="mw:Error mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"manualthumb","ak":"thumbnail= "}],"dsr":[0,32,2,2]}' data-mw='{"errors":[{"key":"missing-thumbnail","message":"This thumbnail does not exist.","params":{"name":""}}],"thumb":""}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{},"dsr":[2,30,null,null]}'><img resource="./File:Foobar.jpg" src="./Special:FilePath/" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"220"},"sa":{"resource":"Image:foobar.jpg"}}'/></a></figure>
16576 !!end
16577
16578 !! test
16579 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
16580 !! wikitext
16581 <pre dir="&#10;"></pre>
16582 !! html
16583 <pre dir="&#10;"></pre>
16584
16585 !! end
16586
16587 !! test
16588 Parsing optional HTML elements (Bug 6171)
16589 !! options
16590 !! wikitext
16591 <table>
16592 <tr>
16593 <td> Some tabular data</td>
16594 <td> More tabular data ...
16595 <td> And yet som tabular data</td>
16596 </tr>
16597 </table>
16598 !! html
16599 <table>
16600 <tr>
16601 <td> Some tabular data</td>
16602 <td> More tabular data ...
16603 </td><td> And yet som tabular data</td>
16604 </tr>
16605 </table>
16606
16607 !! end
16608
16609 !! test
16610 Correct handling of <td>, <tr> (Bug 6171)
16611 !! options
16612 !! wikitext
16613 <table>
16614 <tr>
16615 <td> Some tabular data</td>
16616 <td> More tabular data ...</td>
16617 <td> And yet som tabular data</td>
16618 </tr>
16619 </table>
16620 !! html
16621 <table>
16622 <tr>
16623 <td> Some tabular data</td>
16624 <td> More tabular data ...</td>
16625 <td> And yet som tabular data</td>
16626 </tr>
16627 </table>
16628
16629 !! end
16630
16631
16632 !! test
16633 Parsing crashing regression (fr:JavaScript)
16634 !! wikitext
16635 </body></x>
16636 !! html
16637 <p>&lt;/body&gt;&lt;/x&gt;
16638 </p>
16639 !! end
16640
16641 !! test
16642 Inline wiki vs wiki block nesting
16643 !! wikitext
16644 '''Bold paragraph
16645
16646 New wiki paragraph
16647 !! html
16648 <p><b>Bold paragraph</b>
16649 </p><p>New wiki paragraph
16650 </p>
16651 !! end
16652
16653 # FIXME: The current php output is documented
16654 # and desired output is the parsoid target.
16655 !! test
16656 Inline HTML vs wiki block nesting
16657 !! wikitext
16658 <b>Bold paragraph
16659
16660 New wiki paragraph
16661 !! html/php
16662 <p><b>Bold paragraph
16663 </p><p>New wiki paragraph</b>
16664 </p>
16665 !! html/parsoid
16666 <p><b>Bold paragraph</b>
16667 </p><p>New wiki paragraph
16668 </p>
16669 !! end
16670
16671 # Original result was this:
16672 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
16673 # </p>
16674 # While that might be marginally more intuitive, maybe, the six-apostrophe
16675 # construct is clearly pathological and the result stated here (which is what
16676 # the parser actually does) is about as reasonable as anything.
16677 !!test
16678 Mixing markup for italics and bold
16679 !! options
16680 !! wikitext
16681 '''bold''''''bold''bolditalics'''''
16682 !! html
16683 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
16684 </p>
16685 !! end
16686
16687
16688 !! article
16689 Xyzzyx
16690 !! text
16691 Article for special page transclusion test
16692 !! endarticle
16693
16694 !! test
16695 Special page transclusion
16696 !! options
16697 !! wikitext
16698 {{Special:Prefixindex/Xyzzyx}}
16699 !! html
16700 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
16701
16702 !! end
16703
16704 !! test
16705 Special page transclusion twice (bug 5021)
16706 !! options
16707 !! wikitext
16708 {{Special:Prefixindex/Xyzzyx}}
16709 {{Special:Prefixindex/Xyzzyx}}
16710 !! html
16711 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
16712 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
16713
16714 !! end
16715
16716 !! test
16717 Transclusion of default MediaWiki message
16718 !! wikitext
16719 {{MediaWiki:Mainpage}}
16720 !! html
16721 <p>Main Page
16722 </p>
16723 !! end
16724
16725 !! test
16726 Transclusion of nonexistent MediaWiki message
16727 !! wikitext
16728 {{MediaWiki:Mainpagexxx}}
16729 !! html
16730 <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>
16731 </p>
16732 !! end
16733
16734 !! test
16735 Transclusion of MediaWiki message with underscore
16736 !! wikitext
16737 {{MediaWiki:history_short}}
16738 !! html
16739 <p>History
16740 </p>
16741 !! end
16742
16743 !! test
16744 Transclusion of MediaWiki message with space
16745 !! wikitext
16746 {{MediaWiki:history short}}
16747 !! html
16748 <p>History
16749 </p>
16750 !! end
16751
16752 !! test
16753 Invalid header with following text
16754 !! wikitext
16755 = x = y
16756 !! html
16757 <p>= x = y
16758 </p>
16759 !! end
16760
16761
16762 !! test
16763 Section extraction test (section 0)
16764 !! options
16765 section=0
16766 !! wikitext
16767 start
16768 ==a==
16769 ===aa===
16770 ====aaa====
16771 ==b==
16772 ===ba===
16773 ===bb===
16774 ====bba====
16775 ===bc===
16776 ==c==
16777 ===ca===
16778 !! html/php
16779 start
16780 !! end
16781
16782 !! test
16783 Section extraction test (section 1)
16784 !! options
16785 section=1
16786 !! wikitext
16787 start
16788 ==a==
16789 ===aa===
16790 ====aaa====
16791 ==b==
16792 ===ba===
16793 ===bb===
16794 ====bba====
16795 ===bc===
16796 ==c==
16797 ===ca===
16798 !! html/php
16799 ==a==
16800 ===aa===
16801 ====aaa====
16802 !! end
16803
16804 !! test
16805 Section extraction test (section 2)
16806 !! options
16807 section=2
16808 !! wikitext
16809 start
16810 ==a==
16811 ===aa===
16812 ====aaa====
16813 ==b==
16814 ===ba===
16815 ===bb===
16816 ====bba====
16817 ===bc===
16818 ==c==
16819 ===ca===
16820 !! html/php
16821 ===aa===
16822 ====aaa====
16823 !! end
16824
16825 !! test
16826 Section extraction test (section 3)
16827 !! options
16828 section=3
16829 !! wikitext
16830 start
16831 ==a==
16832 ===aa===
16833 ====aaa====
16834 ==b==
16835 ===ba===
16836 ===bb===
16837 ====bba====
16838 ===bc===
16839 ==c==
16840 ===ca===
16841 !! html/php
16842 ====aaa====
16843 !! end
16844
16845 !! test
16846 Section extraction test (section 4)
16847 !! options
16848 section=4
16849 !! wikitext
16850 start
16851 ==a==
16852 ===aa===
16853 ====aaa====
16854 ==b==
16855 ===ba===
16856 ===bb===
16857 ====bba====
16858 ===bc===
16859 ==c==
16860 ===ca===
16861 !! html/php
16862 ==b==
16863 ===ba===
16864 ===bb===
16865 ====bba====
16866 ===bc===
16867 !! end
16868
16869 !! test
16870 Section extraction test (section 5)
16871 !! options
16872 section=5
16873 !! wikitext
16874 start
16875 ==a==
16876 ===aa===
16877 ====aaa====
16878 ==b==
16879 ===ba===
16880 ===bb===
16881 ====bba====
16882 ===bc===
16883 ==c==
16884 ===ca===
16885 !! html/php
16886 ===ba===
16887 !! end
16888
16889 !! test
16890 Section extraction test (section 6)
16891 !! options
16892 section=6
16893 !! wikitext
16894 start
16895 ==a==
16896 ===aa===
16897 ====aaa====
16898 ==b==
16899 ===ba===
16900 ===bb===
16901 ====bba====
16902 ===bc===
16903 ==c==
16904 ===ca===
16905 !! html/php
16906 ===bb===
16907 ====bba====
16908 !! end
16909
16910 !! test
16911 Section extraction test (section 7)
16912 !! options
16913 section=7
16914 !! wikitext
16915 start
16916 ==a==
16917 ===aa===
16918 ====aaa====
16919 ==b==
16920 ===ba===
16921 ===bb===
16922 ====bba====
16923 ===bc===
16924 ==c==
16925 ===ca===
16926 !! html/php
16927 ====bba====
16928 !! end
16929
16930 !! test
16931 Section extraction test (section 8)
16932 !! options
16933 section=8
16934 !! wikitext
16935 start
16936 ==a==
16937 ===aa===
16938 ====aaa====
16939 ==b==
16940 ===ba===
16941 ===bb===
16942 ====bba====
16943 ===bc===
16944 ==c==
16945 ===ca===
16946 !! html/php
16947 ===bc===
16948 !! end
16949
16950 !! test
16951 Section extraction test (section 9)
16952 !! options
16953 section=9
16954 !! wikitext
16955 start
16956 ==a==
16957 ===aa===
16958 ====aaa====
16959 ==b==
16960 ===ba===
16961 ===bb===
16962 ====bba====
16963 ===bc===
16964 ==c==
16965 ===ca===
16966 !! html/php
16967 ==c==
16968 ===ca===
16969 !! end
16970
16971 !! test
16972 Section extraction test (section 10)
16973 !! options
16974 section=10
16975 !! wikitext
16976 start
16977 ==a==
16978 ===aa===
16979 ====aaa====
16980 ==b==
16981 ===ba===
16982 ===bb===
16983 ====bba====
16984 ===bc===
16985 ==c==
16986 ===ca===
16987 !! html/php
16988 ===ca===
16989 !! end
16990
16991 !! test
16992 Section extraction test (nonexistent section 11)
16993 !! options
16994 section=11
16995 !! wikitext
16996 start
16997 ==a==
16998 ===aa===
16999 ====aaa====
17000 ==b==
17001 ===ba===
17002 ===bb===
17003 ====bba====
17004 ===bc===
17005 ==c==
17006 ===ca===
17007 !! html/php
17008 !! end
17009
17010 !! test
17011 Section extraction test with bogus heading (section 1)
17012 !! options
17013 section=1
17014 !! wikitext
17015 ==a==
17016 ==bogus== not a legal section
17017 ==b==
17018 !! html/php
17019 ==a==
17020 ==bogus== not a legal section
17021 !! end
17022
17023 !! test
17024 Section extraction test with bogus heading (section 2)
17025 !! options
17026 section=2
17027 !! wikitext
17028 ==a==
17029 ==bogus== not a legal section
17030 ==b==
17031 !! html/php
17032 ==b==
17033 !! end
17034
17035 !! test
17036 Section extraction test with comment after heading (section 1)
17037 !! options
17038 section=1
17039 !! wikitext
17040 ==a==
17041 ==b== <!-- -->
17042 ==c==
17043 !! html/php
17044 ==a==
17045 !! end
17046
17047 !! test
17048 Section extraction test with comment after heading (section 2)
17049 !! options
17050 section=2
17051 !! wikitext
17052 ==a==
17053 ==b== <!-- -->
17054 ==c==
17055 !! html/php
17056 ==b== <!-- -->
17057 !! end
17058
17059 !! test
17060 Section extraction test with bogus <nowiki> heading (section 1)
17061 !! options
17062 section=1
17063 !! wikitext
17064 ==a==
17065 ==bogus== <nowiki>not a legal section</nowiki>
17066 ==b==
17067 !! html/php
17068 ==a==
17069 ==bogus== <nowiki>not a legal section</nowiki>
17070 !! end
17071
17072 !! test
17073 Section extraction test with bogus <nowiki> heading (section 2)
17074 !! options
17075 section=2
17076 !! wikitext
17077 ==a==
17078 ==bogus== <nowiki>not a legal section</nowiki>
17079 ==b==
17080 !! html/php
17081 ==b==
17082 !! end
17083
17084 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
17085 # instead of respecting commented sections
17086 !! test
17087 Section extraction prefixed by comment (section 1)
17088 !! options
17089 section=1
17090 !! wikitext
17091 <!-- -->==sec1==
17092 ==sec2==
17093 !! html/php
17094 ==sec2==
17095 !!end
17096
17097 !! test
17098 Section extraction prefixed by comment (section 2)
17099 !! options
17100 section=2
17101 !! wikitext
17102 <!-- -->==sec1==
17103 ==sec2==
17104 !! html/php
17105
17106 !!end
17107
17108 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
17109 # instead of respecting HTML-style headings
17110 !! test
17111 Section extraction, mixed wiki and html (section 1)
17112 !! options
17113 section=1
17114 !! wikitext
17115 <h2>unmarked</h2>
17116 unmarked
17117 ==1==
17118 one
17119 ==2==
17120 two
17121 !! html/php
17122 ==1==
17123 one
17124 !! end
17125
17126 !! test
17127 Section extraction, mixed wiki and html (section 2)
17128 !! options
17129 section=2
17130 !! wikitext
17131 <h2>unmarked</h2>
17132 unmarked
17133 ==1==
17134 one
17135 ==2==
17136 two
17137 !! html/php
17138 ==2==
17139 two
17140 !! end
17141
17142
17143 # Formerly testing for bug 3342
17144 !! test
17145 Section extraction, heading surrounded by <noinclude>
17146 !! options
17147 section=1
17148 !! wikitext
17149 <noinclude>==unmarked==</noinclude>
17150 ==marked==
17151 !! html/php
17152 ==marked==
17153 !!end
17154
17155 # Test behavior of bug 19910
17156 !! test
17157 Sectiion with all-equals
17158 !! options
17159 section=2
17160 !! wikitext
17161 ===
17162 The line above must have a trailing space
17163 === <!--
17164 --> <!-- -->
17165 But just in case it doesn't...
17166 !! html/php
17167 === <!--
17168 --> <!-- -->
17169 But just in case it doesn't...
17170 !! end
17171
17172 !! test
17173 Section replacement test (section 0)
17174 !! options
17175 replace=0,"xxx"
17176 !! wikitext
17177 start
17178 ==a==
17179 ===aa===
17180 ====aaa====
17181 ==b==
17182 ===ba===
17183 ===bb===
17184 ====bba====
17185 ===bc===
17186 ==c==
17187 ===ca===
17188 !! html/php
17189 xxx
17190
17191 ==a==
17192 ===aa===
17193 ====aaa====
17194 ==b==
17195 ===ba===
17196 ===bb===
17197 ====bba====
17198 ===bc===
17199 ==c==
17200 ===ca===
17201 !! end
17202
17203 !! test
17204 Section replacement test (section 1)
17205 !! options
17206 replace=1,"xxx"
17207 !! wikitext
17208 start
17209 ==a==
17210 ===aa===
17211 ====aaa====
17212 ==b==
17213 ===ba===
17214 ===bb===
17215 ====bba====
17216 ===bc===
17217 ==c==
17218 ===ca===
17219 !! html/php
17220 start
17221 xxx
17222
17223 ==b==
17224 ===ba===
17225 ===bb===
17226 ====bba====
17227 ===bc===
17228 ==c==
17229 ===ca===
17230 !! end
17231
17232 !! test
17233 Section replacement test (section 2)
17234 !! options
17235 replace=2,"xxx"
17236 !! wikitext
17237 start
17238 ==a==
17239 ===aa===
17240 ====aaa====
17241 ==b==
17242 ===ba===
17243 ===bb===
17244 ====bba====
17245 ===bc===
17246 ==c==
17247 ===ca===
17248 !! html/php
17249 start
17250 ==a==
17251 xxx
17252
17253 ==b==
17254 ===ba===
17255 ===bb===
17256 ====bba====
17257 ===bc===
17258 ==c==
17259 ===ca===
17260 !! end
17261
17262 !! test
17263 Section replacement test (section 3)
17264 !! options
17265 replace=3,"xxx"
17266 !! wikitext
17267 start
17268 ==a==
17269 ===aa===
17270 ====aaa====
17271 ==b==
17272 ===ba===
17273 ===bb===
17274 ====bba====
17275 ===bc===
17276 ==c==
17277 ===ca===
17278 !! html/php
17279 start
17280 ==a==
17281 ===aa===
17282 xxx
17283
17284 ==b==
17285 ===ba===
17286 ===bb===
17287 ====bba====
17288 ===bc===
17289 ==c==
17290 ===ca===
17291 !! end
17292
17293 !! test
17294 Section replacement test (section 4)
17295 !! options
17296 replace=4,"xxx"
17297 !! wikitext
17298 start
17299 ==a==
17300 ===aa===
17301 ====aaa====
17302 ==b==
17303 ===ba===
17304 ===bb===
17305 ====bba====
17306 ===bc===
17307 ==c==
17308 ===ca===
17309 !! html/php
17310 start
17311 ==a==
17312 ===aa===
17313 ====aaa====
17314 xxx
17315
17316 ==c==
17317 ===ca===
17318 !! end
17319
17320 !! test
17321 Section replacement test (section 5)
17322 !! options
17323 replace=5,"xxx"
17324 !! wikitext
17325 start
17326 ==a==
17327 ===aa===
17328 ====aaa====
17329 ==b==
17330 ===ba===
17331 ===bb===
17332 ====bba====
17333 ===bc===
17334 ==c==
17335 ===ca===
17336 !! html/php
17337 start
17338 ==a==
17339 ===aa===
17340 ====aaa====
17341 ==b==
17342 xxx
17343
17344 ===bb===
17345 ====bba====
17346 ===bc===
17347 ==c==
17348 ===ca===
17349 !! end
17350
17351 !! test
17352 Section replacement test (section 6)
17353 !! options
17354 replace=6,"xxx"
17355 !! wikitext
17356 start
17357 ==a==
17358 ===aa===
17359 ====aaa====
17360 ==b==
17361 ===ba===
17362 ===bb===
17363 ====bba====
17364 ===bc===
17365 ==c==
17366 ===ca===
17367 !! html/php
17368 start
17369 ==a==
17370 ===aa===
17371 ====aaa====
17372 ==b==
17373 ===ba===
17374 xxx
17375
17376 ===bc===
17377 ==c==
17378 ===ca===
17379 !! end
17380
17381 !! test
17382 Section replacement test (section 7)
17383 !! options
17384 replace=7,"xxx"
17385 !! wikitext
17386 start
17387 ==a==
17388 ===aa===
17389 ====aaa====
17390 ==b==
17391 ===ba===
17392 ===bb===
17393 ====bba====
17394 ===bc===
17395 ==c==
17396 ===ca===
17397 !! html/php
17398 start
17399 ==a==
17400 ===aa===
17401 ====aaa====
17402 ==b==
17403 ===ba===
17404 ===bb===
17405 xxx
17406
17407 ===bc===
17408 ==c==
17409 ===ca===
17410 !! end
17411
17412 !! test
17413 Section replacement test (section 8)
17414 !! options
17415 replace=8,"xxx"
17416 !! wikitext
17417 start
17418 ==a==
17419 ===aa===
17420 ====aaa====
17421 ==b==
17422 ===ba===
17423 ===bb===
17424 ====bba====
17425 ===bc===
17426 ==c==
17427 ===ca===
17428 !! html/php
17429 start
17430 ==a==
17431 ===aa===
17432 ====aaa====
17433 ==b==
17434 ===ba===
17435 ===bb===
17436 ====bba====
17437 xxx
17438
17439 ==c==
17440 ===ca===
17441 !!end
17442
17443 !! test
17444 Section replacement test (section 9)
17445 !! options
17446 replace=9,"xxx"
17447 !! wikitext
17448 start
17449 ==a==
17450 ===aa===
17451 ====aaa====
17452 ==b==
17453 ===ba===
17454 ===bb===
17455 ====bba====
17456 ===bc===
17457 ==c==
17458 ===ca===
17459 !! html/php
17460 start
17461 ==a==
17462 ===aa===
17463 ====aaa====
17464 ==b==
17465 ===ba===
17466 ===bb===
17467 ====bba====
17468 ===bc===
17469 xxx
17470 !! end
17471
17472 !! test
17473 Section replacement test (section 10)
17474 !! options
17475 replace=10,"xxx"
17476 !! wikitext
17477 start
17478 ==a==
17479 ===aa===
17480 ====aaa====
17481 ==b==
17482 ===ba===
17483 ===bb===
17484 ====bba====
17485 ===bc===
17486 ==c==
17487 ===ca===
17488 !! html/php
17489 start
17490 ==a==
17491 ===aa===
17492 ====aaa====
17493 ==b==
17494 ===ba===
17495 ===bb===
17496 ====bba====
17497 ===bc===
17498 ==c==
17499 xxx
17500 !! end
17501
17502 !! test
17503 Section replacement test with initial whitespace (bug 13728)
17504 !! options
17505 replace=2,"xxx"
17506 !! wikitext
17507 Preformatted initial line
17508 ==a==
17509 ===a===
17510 !! html/php
17511 Preformatted initial line
17512 ==a==
17513 xxx
17514 !! end
17515
17516
17517 !! test
17518 Section extraction, heading followed by pre with 20 spaces (bug 6398)
17519 !! options
17520 section=1
17521 !! wikitext
17522 ==a==
17523 a
17524 !! html/php
17525 ==a==
17526 a
17527 !! end
17528
17529 !! test
17530 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
17531 !! options
17532 section=1
17533 !! wikitext
17534 ==a==
17535 a
17536 !! html/php
17537 ==a==
17538 a
17539 !! end
17540
17541
17542 !! test
17543 Section extraction, <pre> around bogus header (bug 10309)
17544 !! options
17545 noxml section=2
17546 !! wikitext
17547 == Section One ==
17548 <pre>
17549 =======
17550 </pre>
17551
17552 == Section Two ==
17553 stuff
17554 !! html/php
17555 == Section Two ==
17556 stuff
17557 !! end
17558
17559 !! test
17560 Section replacement, <pre> around bogus header (bug 10309)
17561 !! options
17562 noxml replace=2,"xxx"
17563 !! wikitext
17564 == Section One ==
17565 <pre>
17566 =======
17567 </pre>
17568
17569 == Section Two ==
17570 stuff
17571 !! html/php
17572 == Section One ==
17573 <pre>
17574 =======
17575 </pre>
17576
17577 xxx
17578 !! end
17579
17580
17581 !! test
17582 Handling of &#x0A; in URLs
17583 !! wikitext
17584 ** irc://&#x0A;a
17585 !! html/php
17586 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
17587
17588 !! html/parsoid
17589 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
17590 a">irc://
17591 a</a></li></ul></li></ul>
17592 !! end
17593
17594 !! test
17595 Handling of %0A in URLs
17596 !! wikitext
17597 ** irc://%0Aa
17598 !! html/php
17599 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
17600
17601 !! html/parsoid
17602 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
17603 !! end
17604
17605
17606 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
17607 !! test
17608 5 quotes, code coverage +1 line
17609 !! options
17610 parsoid=wt2html
17611 !! wikitext
17612 '''''
17613 !! html/php
17614 !! html/parsoid
17615 <p><b><i></i></b></p>
17616 !! end
17617
17618 # same html as previous, but wikitext adjusted to match parsoid html2wt
17619 # note that wt2html and html2html will put the <i> before the <b>
17620 !! test
17621 5 quotes, code coverage +1 line w/ nowiki (1)
17622 !! options
17623 parsoid=wt2wt,html2wt
17624 !! wikitext
17625 '''''<nowiki/>'''''
17626 !! html/php
17627 <p><i></i>
17628 </p>
17629 !! html/parsoid
17630 <p><b><i></i></b></p>
17631 !! end
17632
17633 # same as previous, just swapping the <i> and <b>
17634 !! test
17635 5 quotes, code coverage +1 line w/ nowiki (2)
17636 !! wikitext
17637 '''''<nowiki/>'''''
17638 !! html/php
17639 <p><i></i>
17640 </p>
17641 !! html/parsoid
17642 <p><i><b></b></i></p>
17643 !! end
17644
17645 !! test
17646 Special:Search page linking.
17647 !! wikitext
17648 {{Special:search}}
17649 !! html
17650 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
17651 </p>
17652 !! end
17653
17654 !! test
17655 {{!}} is a magic word
17656 !! wikitext
17657 {{!}} is a magic word there and {{!}} is still a magic word here
17658 !! html/php
17659 <p>| is a magic word there and | is still a magic word here
17660 </p>
17661 !! html/parsoid
17662 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"!","href":"./Template:!"},"params":{},"i":0}}]}' data-parsoid='{"pi":[[]]}'>|</span> is a magic word there and <span about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"!","href":"./Template:!"},"params":{},"i":0}}]}' data-parsoid='{"pi":[[]]}'>|</span> is still a magic word here</p>
17663 !! end
17664
17665 !! test
17666 Say the magic word
17667 !! options
17668 title=[[Parser test]]
17669 !! wikitext
17670 * {{PAGENAME}}
17671 * {{PAGENAMEE}}
17672 * {{FULLPAGENAME}}
17673 * {{FULLPAGENAMEE}}
17674 * {{BASEPAGENAME}}
17675 * {{BASEPAGENAMEE}}
17676 * {{SUBPAGENAME}}
17677 * {{SUBPAGENAMEE}}
17678 * {{ROOTPAGENAME}}
17679 * {{ROOTPAGENAMEE}}
17680 * {{TALKPAGENAME}}
17681 * {{TALKPAGENAMEE}}
17682 * {{SUBJECTPAGENAME}}
17683 * {{SUBJECTPAGENAMEE}}
17684 * {{NAMESPACEE}}
17685 * {{NAMESPACE}}
17686 * {{NAMESPACENUMBER}}
17687 * {{TALKSPACE}}
17688 * {{TALKSPACEE}}
17689 * {{SUBJECTSPACE}}
17690 * {{SUBJECTSPACEE}}
17691 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
17692 !! html
17693 <ul><li> Parser test</li>
17694 <li> Parser_test</li>
17695 <li> Parser test</li>
17696 <li> Parser_test</li>
17697 <li> Parser test</li>
17698 <li> Parser_test</li>
17699 <li> Parser test</li>
17700 <li> Parser_test</li>
17701 <li> Parser test</li>
17702 <li> Parser_test</li>
17703 <li> Talk:Parser test</li>
17704 <li> Talk:Parser_test</li>
17705 <li> Parser test</li>
17706 <li> Parser_test</li>
17707 <li> </li>
17708 <li> </li>
17709 <li> 0</li>
17710 <li> Talk</li>
17711 <li> Talk</li>
17712 <li> </li>
17713 <li> </li>
17714 <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>
17715
17716 !! end
17717 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
17718
17719 !! test
17720 Gallery
17721 !! wikitext
17722 <gallery>
17723 image1.png |
17724 image2.gif|||||
17725
17726 image3|
17727 image4 |300px| centre
17728 image5.svg| http://///////
17729 [[x|xx]]]]
17730 * image6
17731 </gallery>
17732 !! html
17733 <ul class="gallery mw-gallery-traditional">
17734 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17735 <div class="thumb" style="height: 150px;">Image1.png</div>
17736 <div class="gallerytext">
17737 </div>
17738 </div></li>
17739 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17740 <div class="thumb" style="height: 150px;">Image2.gif</div>
17741 <div class="gallerytext">
17742 <p>||||
17743 </p>
17744 </div>
17745 </div></li>
17746 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17747 <div class="thumb" style="height: 150px;">Image3</div>
17748 <div class="gallerytext">
17749 </div>
17750 </div></li>
17751 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17752 <div class="thumb" style="height: 150px;">Image4</div>
17753 <div class="gallerytext">
17754 <p>300px| centre
17755 </p>
17756 </div>
17757 </div></li>
17758 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17759 <div class="thumb" style="height: 150px;">Image5.svg</div>
17760 <div class="gallerytext">
17761 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
17762 </p>
17763 </div>
17764 </div></li>
17765 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17766 <div class="thumb" style="height: 150px;">* image6</div>
17767 <div class="gallerytext">
17768 </div>
17769 </div></li>
17770 </ul>
17771
17772 !! end
17773
17774 !! test
17775 Gallery (with options)
17776 !! wikitext
17777 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
17778 File:Nonexistent.jpg|caption
17779 File:Nonexistent.jpg
17780 image:foobar.jpg|some '''caption''' [[Main Page]]
17781 image:foobar.jpg
17782 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
17783 </gallery>
17784 !! html
17785 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
17786 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
17787 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17788 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
17789 <div class="gallerytext">
17790 <p>caption
17791 </p>
17792 </div>
17793 </div></li>
17794 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17795 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
17796 <div class="gallerytext">
17797 </div>
17798 </div></li>
17799 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17800 <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>
17801 <div class="gallerytext">
17802 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
17803 </p>
17804 </div>
17805 </div></li>
17806 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17807 <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>
17808 <div class="gallerytext">
17809 </div>
17810 </div></li>
17811 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17812 <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>
17813 <div class="gallerytext">
17814 <p>Blabla|blabla.
17815 </p>
17816 </div>
17817 </div></li>
17818 </ul>
17819
17820 !! end
17821
17822 !! test
17823 Gallery with link that has fragment
17824 !! wikitext
17825 <gallery>
17826 image:foobar.jpg|link=Main_Page
17827 image:foobar.jpg|link=Main_Page#section
17828 image:foobar.jpg|link=Main Page#section|caption
17829 </gallery>
17830 !! html
17831 <ul class="gallery mw-gallery-traditional">
17832 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17833 <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>
17834 <div class="gallerytext">
17835 </div>
17836 </div></li>
17837 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17838 <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>
17839 <div class="gallerytext">
17840 </div>
17841 </div></li>
17842 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17843 <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>
17844 <div class="gallerytext">
17845 <p>caption
17846 </p>
17847 </div>
17848 </div></li>
17849 </ul>
17850
17851 !! end
17852
17853 !! test
17854 Gallery with wikitext inside caption
17855 !! wikitext
17856 <gallery>
17857 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
17858 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
17859 </gallery>
17860 !! html
17861 <ul class="gallery mw-gallery-traditional">
17862 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17863 <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>
17864 <div class="gallerytext">
17865 <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>
17866 </p>
17867 </div>
17868 </div></li>
17869 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17870 <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>
17871 <div class="gallerytext">
17872 <p>This is a test template
17873 </p>
17874 </div>
17875 </div></li>
17876 </ul>
17877
17878 !! end
17879
17880 !! test
17881 gallery (with showfilename option)
17882 !! wikitext
17883 <gallery showfilename>
17884 File:Nonexistent.jpg|caption
17885 File:Nonexistent.jpg
17886 image:foobar.jpg|some '''caption''' [[Main Page]]
17887 File:Foobar.jpg
17888 </gallery>
17889 !! html
17890 <ul class="gallery mw-gallery-traditional">
17891 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17892 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
17893 <div class="gallerytext">
17894 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
17895 caption
17896 </p>
17897 </div>
17898 </div></li>
17899 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17900 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
17901 <div class="gallerytext">
17902 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
17903 </p>
17904 </div>
17905 </div></li>
17906 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17907 <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>
17908 <div class="gallerytext">
17909 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
17910 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
17911 </p>
17912 </div>
17913 </div></li>
17914 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17915 <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>
17916 <div class="gallerytext">
17917 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
17918 </p>
17919 </div>
17920 </div></li>
17921 </ul>
17922
17923 !! end
17924
17925 !! test
17926 Gallery (with namespace-less filenames)
17927 !! wikitext
17928 <gallery>
17929 File:Nonexistent.jpg
17930 Nonexistent.jpg
17931 image:foobar.jpg
17932 foobar.jpg
17933 </gallery>
17934 !! html
17935 <ul class="gallery mw-gallery-traditional">
17936 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17937 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
17938 <div class="gallerytext">
17939 </div>
17940 </div></li>
17941 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17942 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
17943 <div class="gallerytext">
17944 </div>
17945 </div></li>
17946 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17947 <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>
17948 <div class="gallerytext">
17949 </div>
17950 </div></li>
17951 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17952 <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>
17953 <div class="gallerytext">
17954 </div>
17955 </div></li>
17956 </ul>
17957
17958 !! end
17959
17960 !! test
17961 HTML Hex character encoding (spells the word "JavaScript")
17962 !! options
17963 parsoid=wt2html,wt2wt,html2html
17964 !! wikitext
17965 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
17966 !! html/php
17967 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
17968 </p>
17969 !! html/php+tidy
17970 <p>JavaScript</p>
17971 !! html/parsoid
17972 <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>
17973 !! end
17974
17975 !! test
17976 HTML Hex character encoding bogus encoding (bug 26437 regression check)
17977 !! wikitext
17978 &#xsee;&#XSEE;
17979 !! html/php
17980 <p>&amp;#xsee;&amp;#XSEE;
17981 </p>
17982 !! html/parsoid
17983 <p>&amp;#xsee;&amp;#XSEE;</p>
17984 !! end
17985
17986 !! test
17987 HTML Hex character encoding mixed case
17988 !! options
17989 parsoid=wt2html,wt2wt,html2html
17990 !! wikitext
17991 &#xEE;&#Xee;
17992 !! html/php
17993 <p>&#xee;&#xee;
17994 </p>
17995 !! html/php+tidy
17996 <p>îî</p>
17997 !! html/parsoid
17998 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
17999 !! end
18000
18001 !! test
18002 __FORCETOC__ override
18003 !! wikitext
18004 __NEWSECTIONLINK__
18005 __FORCETOC__
18006 !! html/php
18007 <p><br />
18008 </p>
18009 !! end
18010
18011 !! test
18012 ISBN code coverage
18013 !! wikitext
18014 ISBN 978-0-1234-56&#x20;789
18015 !! html
18016 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
18017 </p>
18018 !! html+tidy
18019 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
18020 !! html/parsoid
18021 <p><a href="./Special:BookSources/9780123456" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978-0-1234-56</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#x20;","srcContent":" "}'> </span>789</p>
18022 !! end
18023
18024 !! test
18025 ISBN followed by 5 spaces
18026 !! wikitext
18027 ISBN
18028 !! html
18029 <p>ISBN
18030 </p>
18031 !! end
18032
18033 !! test
18034 Double ISBN
18035 !! wikitext
18036 ISBN ISBN 1234567890
18037 !! html/php
18038 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18039 </p>
18040 !! html/parsoid
18041 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
18042 !! end
18043
18044 !! test
18045 ISBN with an X
18046 !! wikitext
18047 ISBN 3-462-04561-X
18048 ISBN 080442957X
18049 ISBN 978080442957X
18050 !! html/php
18051 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
18052 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
18053 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
18054 </p>
18055 !! html/parsoid
18056 <p><a href="./Special:BookSources/346204561X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
18057 <a href="./Special:BookSources/080442957X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
18058 <a href="./Special:BookSources/978080442957X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a></p>
18059 !! end
18060
18061 !! test
18062 ISBN with empty prefix (parsoid test)
18063 !! wikitext
18064 ISBN 1234567890
18065 !! html/php
18066 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18067 </p>
18068 !! html/parsoid
18069 <p><a href="Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567890</a></p>
18070 !! end
18071
18072 !! test
18073 Bug 22905: <abbr> followed by ISBN followed by </a>
18074 !! wikitext
18075 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
18076 !! html/php
18077 <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>
18078 </p>
18079 !! html/parsoid
18080 <p><abbr data-parsoid='{"stx":"html"}'>(fr)</abbr> <a href="./Special:BookSources/2753300917" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 2753300917</a> <a rel="mw:ExtLink" href="http://www.example.com">example.com</a></p>
18081 !! end
18082
18083 !! test
18084 Double RFC
18085 !! wikitext
18086 RFC RFC 1234
18087 !! html
18088 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
18089 </p>
18090 !! end
18091
18092 !! test
18093 Double RFC with a wiki link
18094 !! wikitext
18095 RFC [[RFC 1234]]
18096 !! html
18097 <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>
18098 </p>
18099 !! end
18100
18101 !! test
18102 RFC code coverage
18103 !! wikitext
18104 RFC 983&#x20;987
18105 !! html
18106 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
18107 </p>
18108 !! html+tidy
18109 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
18110 !! end
18111
18112 !! test
18113 Centre-aligned image
18114 !! wikitext
18115 [[Image:foobar.jpg|centre]]
18116 !! html
18117 <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>
18118
18119 !!end
18120
18121 !! test
18122 None-aligned image
18123 !! wikitext
18124 [[Image:foobar.jpg|none]]
18125 !! html
18126 <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>
18127
18128 !!end
18129
18130 !! test
18131 Width + Height sized image (using px) (height is ignored)
18132 !! wikitext
18133 [[Image:foobar.jpg|640x480px]]
18134 !! html
18135 <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>
18136 </p>
18137 !!end
18138
18139 !! test
18140 Width-sized image (using px, no following whitespace)
18141 !! wikitext
18142 [[Image:foobar.jpg|640px]]
18143 !! html
18144 <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>
18145 </p>
18146 !!end
18147
18148 !! test
18149 Width-sized image (using px, with following whitespace - test regression from r39467)
18150 !! wikitext
18151 [[Image:foobar.jpg|640px ]]
18152 !! html
18153 <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>
18154 </p>
18155 !!end
18156
18157 !! test
18158 Width-sized image (using px, with preceding whitespace - test regression from r39467)
18159 !! wikitext
18160 [[Image:foobar.jpg| 640px]]
18161 !! html
18162 <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>
18163 </p>
18164 !!end
18165
18166 !! test
18167 Image with page parameter
18168 !! options
18169 djvu
18170 !! wikitext
18171 [[File:LoremIpsum.djvu|page=2]]
18172 !! html/php
18173 <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>
18174 </p>
18175 !! html/parsoid
18176 <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>
18177 !! end
18178
18179 !! test
18180 Another italics / bold test
18181 !! wikitext
18182 ''' ''x'
18183 !! html
18184 <pre>'<i> </i>x'
18185 </pre>
18186 !!end
18187
18188 # FIXME: The php output seems broken. It's interleaving some open/close tags.
18189 !! test
18190 dt/dd/dl test
18191 !! wikitext
18192 :;;;::
18193 !! html/php
18194 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
18195
18196 !! html/parsoid
18197 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
18198
18199 !!end
18200
18201
18202 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
18203 !! test
18204 Images with the "|" character in the comment
18205 !! wikitext
18206 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
18207 !! html/php
18208 <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>
18209
18210 !! html/parsoid
18211 <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>
18212 !! end
18213
18214 !! test
18215 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
18216 !! wikitext
18217 <html><script>alert(1);</script></html>
18218 !! html
18219 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
18220 </p>
18221 !! end
18222
18223 !! test
18224 HTML with raw HTML ($wgRawHtml==true)
18225 !! options
18226 wgRawHtml=1
18227 !! wikitext
18228 <html><script>alert(1);</script></html>
18229 !! html
18230 <p><script>alert(1);</script>
18231 </p>
18232 !! end
18233
18234 !! test
18235 Parents of subpages, one level up
18236 !! options
18237 subpage title=[[Subpage test/L1/L2/L3]]
18238 !! wikitext
18239 [[../|L2]]
18240 !! html
18241 <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>
18242 </p>
18243 !! end
18244
18245
18246 !! test
18247 Parents of subpages, one level up, not named
18248 !! options
18249 subpage title=[[Subpage test/L1/L2/L3]]
18250 !! wikitext
18251 [[../]]
18252 !! html
18253 <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>
18254 </p>
18255 !! end
18256
18257
18258
18259 !! test
18260 Parents of subpages, two levels up
18261 !! options
18262 subpage title=[[Subpage test/L1/L2/L3]]
18263 !! wikitext
18264 [[../../|L1]]2
18265
18266 [[../../|L1]]l
18267 !! html
18268 <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
18269 </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>
18270 </p>
18271 !! end
18272
18273 !! test
18274 Parents of subpages, two levels up, without trailing slash or name.
18275 !! options
18276 subpage title=[[Subpage test/L1/L2/L3]]
18277 !! wikitext
18278 [[../..]]
18279 !! html
18280 <p>[[../..]]
18281 </p>
18282 !! end
18283
18284 !! test
18285 Parents of subpages, two levels up, with lots of extra trailing slashes.
18286 !! options
18287 subpage title=[[Subpage test/L1/L2/L3]]
18288 !! wikitext
18289 [[../../////]]
18290 !! html
18291 <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>
18292 </p>
18293 !! end
18294
18295 !! article
18296 Subpage test/L1/L2/L3Sibling
18297 !! text
18298 Sibling article
18299 !! endarticle
18300
18301 !! test
18302 Transclusion of a sibling page (one level up)
18303 !! options
18304 subpage title=[[Subpage test/L1/L2/L3]]
18305 !! wikitext
18306 {{../L3Sibling}}
18307 !! html
18308 <p>Sibling article
18309 </p>
18310 !! end
18311
18312 !! test
18313 Transclusion of a child page
18314 !! options
18315 subpage title=[[Subpage test/L1/L2]]
18316 !! wikitext
18317 {{/L3Sibling}}
18318 !! html
18319 <p>Sibling article
18320 </p>
18321 !! end
18322
18323 !! test
18324 Non-transclusion because of too many up levels
18325 !! options
18326 subpage title=[[Subpage test/L1/L2/L3]]
18327 !! wikitext
18328 {{../../../../More than parent}}
18329 !! html
18330 <p>{{../../../../More than parent}}
18331 </p>
18332 !! end
18333
18334 !! test
18335 Definition list code coverage
18336 !! wikitext
18337 ; title : def
18338 ; title : def
18339 ;title: def
18340 !! html/php
18341 <dl><dt> title &#160;</dt>
18342 <dd> def</dd>
18343 <dt> title&#160;</dt>
18344 <dd> def</dd>
18345 <dt>title</dt>
18346 <dd> def</dd></dl>
18347
18348 !! html/parsoid
18349 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
18350 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
18351 <dt>title</dt><dd> def</dd></dl>
18352 !! end
18353
18354 !! test
18355 Don't fall for the self-closing div
18356 !! wikitext
18357 <div>hello world</div/>
18358 !! html
18359 <div>hello world</div>
18360
18361 !! end
18362
18363 !! test
18364 MSGNW magic word
18365 !! wikitext
18366 {{MSGNW:msg}}
18367 !! html/php
18368 <p>&#91;&#91;:Template:Msg&#93;&#93;
18369 </p>
18370 !! end
18371
18372 !! test
18373 RAW magic word
18374 !! wikitext
18375 {{RAW:QUERTY}}
18376 !! html
18377 <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>
18378 </p>
18379 !! end
18380
18381 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
18382 !! test
18383 Always escape literal '>' in output, not just after '<'
18384 !! wikitext
18385 ><>
18386 !! html
18387 <p>&gt;&lt;&gt;
18388 </p>
18389 !! end
18390
18391 !! test
18392 Template caching
18393 !! wikitext
18394 {{Test}}
18395 {{Test}}
18396 !! html
18397 <p>This is a test template
18398 This is a test template
18399 </p>
18400 !! end
18401
18402
18403 !! article
18404 MediaWiki:Fake
18405 !! text
18406 ==header==
18407 !! endarticle
18408
18409 !! test
18410 Inclusion of !userCanEdit() content
18411 !! wikitext
18412 {{MediaWiki:Fake}}
18413 !! html
18414 <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>
18415
18416 !! end
18417
18418
18419 !! test
18420 Out-of-order TOC heading levels
18421 !! wikitext
18422 ==2==
18423 ======6======
18424 ===3===
18425 =1=
18426 =====5=====
18427 ==2==
18428 !! html
18429 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18430 <ul>
18431 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
18432 <ul>
18433 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
18434 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
18435 </ul>
18436 </li>
18437 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
18438 <ul>
18439 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
18440 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
18441 </ul>
18442 </li>
18443 </ul>
18444 </div>
18445
18446 <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>
18447 <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>
18448 <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>
18449 <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>
18450 <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>
18451 <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>
18452
18453 !! end
18454
18455
18456 !! test
18457 ISBN with a dummy number
18458 !! wikitext
18459 ISBN ---
18460 !! html
18461 <p>ISBN ---
18462 </p>
18463 !! end
18464
18465
18466 !! test
18467 ISBN with space-delimited number
18468 !! wikitext
18469 ISBN 92 9017 032 8
18470 !! html
18471 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
18472 </p>
18473 !! end
18474
18475
18476 !! test
18477 ISBN with multiple spaces, no number
18478 !! wikitext
18479 ISBN foo
18480 !! html
18481 <p>ISBN foo
18482 </p>
18483 !! end
18484
18485
18486 !! test
18487 ISBN length
18488 !! wikitext
18489 ISBN 123456789
18490
18491 ISBN 1234567890
18492
18493 ISBN 12345678901
18494 !! html
18495 <p>ISBN 123456789
18496 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18497 </p><p>ISBN 12345678901
18498 </p>
18499 !! end
18500
18501
18502 !! test
18503 ISBN with trailing year (bug 8110)
18504 !! wikitext
18505 ISBN 1-234-56789-0 - 2006
18506
18507 ISBN 1 234 56789 0 - 2006
18508 !! html
18509 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
18510 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
18511 </p>
18512 !! end
18513
18514
18515 !! test
18516 anchorencode
18517 !! wikitext
18518 {{anchorencode:foo bar©#%n}}
18519 !! html
18520 <p>foo_bar.C2.A9.23.25n
18521 </p>
18522 !! end
18523
18524 !! test
18525 anchorencode trims spaces
18526 !! wikitext
18527 {{anchorencode: __pretty__please__}}
18528 !! html
18529 <p>pretty_please
18530 </p>
18531 !! end
18532
18533 !! test
18534 anchorencode deals with links
18535 !! wikitext
18536 {{anchorencode: [[hello|world]] [[hi]]}}
18537 !! html
18538 <p>world_hi
18539 </p>
18540 !! end
18541
18542 !! test
18543 anchorencode deals with templates
18544 !! wikitext
18545 {{anchorencode: {{Foo}} }}
18546 !! html
18547 <p>FOO
18548 </p>
18549 !! end
18550
18551 !! test
18552 anchorencode encodes like the TOC generator: (bug 18431)
18553 !! wikitext
18554 === _ +:.3A%3A&&amp;]] ===
18555 {{anchorencode: _ +:.3A%3A&&amp;]] }}
18556 __NOEDITSECTION__
18557 !! html
18558 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
18559 <p>.2B:.3A.253A.26.26.5D.5D
18560 </p>
18561 !! end
18562
18563 !! test
18564 Bug 6200: blockquotes and paragraph formatting
18565 !! wikitext
18566 <blockquote>
18567 foo
18568 </blockquote>
18569
18570 bar
18571
18572 baz
18573 !! html
18574 <blockquote>
18575 <p>foo
18576 </p>
18577 </blockquote>
18578 <p>bar
18579 </p>
18580 <pre>baz
18581 </pre>
18582 !! end
18583
18584 !! test
18585 Bug 8293: Use of center tag ruins paragraph formatting
18586 !! wikitext
18587 <center>
18588 foo
18589 </center>
18590
18591 bar
18592
18593 baz
18594 !! html
18595 <center>
18596 <p>foo
18597 </p>
18598 </center>
18599 <p>bar
18600 </p>
18601 <pre>baz
18602 </pre>
18603 !! end
18604
18605 !!test
18606 Parsing of overlapping (improperly nested) inline html tags
18607 !! wikitext
18608 <span><s>x</span></s>
18609 !! html/php
18610 <p><span><s>x&lt;/span&gt;</s></span>
18611 </p>
18612 !! html/parsoid
18613 <p><span><s>x</s></span>
18614 </p>
18615 !!end
18616
18617 ###
18618 ### Language variants related tests
18619 ###
18620 !! test
18621 Self-link in language variants
18622 !! options
18623 title=[[Dunav]] language=sr
18624 !! wikitext
18625 Both [[Dunav]] and [[Дунав]] are names for this river.
18626 !! html
18627 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
18628 </p>
18629 !!end
18630
18631 !! article
18632 Дуна
18633 !! text
18634 content
18635 !! endarticle
18636
18637 !! test
18638 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
18639 !! options
18640 title=[[Duna]] language=sr
18641 !! wikitext
18642 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
18643 !! html
18644 <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.
18645 </p>
18646 !! end
18647
18648 !! test
18649 Link to a section of a variant of this title shouldn't be parsed as self-link
18650 !! options
18651 title=[[Duna]] language=sr
18652 !! wikitext
18653 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
18654 !! html
18655 <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.
18656 </p>
18657 !! end
18658
18659 !! test
18660 Link to pages in language variants
18661 !! options
18662 language=sr
18663 !! wikitext
18664 Main Page can be written as [[Маин Паге]]
18665 !! html
18666 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
18667 </p>
18668 !!end
18669
18670
18671 !! test
18672 Multiple links to pages in language variants
18673 !! options
18674 language=sr
18675 !! wikitext
18676 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
18677 !! html
18678 <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>.
18679 </p>
18680 !!end
18681
18682
18683 !! test
18684 Simple template in language variants
18685 !! options
18686 language=sr
18687 !! wikitext
18688 {{тест}}
18689 !! html
18690 <p>This is a test template
18691 </p>
18692 !! end
18693
18694
18695 !! test
18696 Template with explicit namespace in language variants
18697 !! options
18698 language=sr
18699 !! wikitext
18700 {{Template:тест}}
18701 !! html
18702 <p>This is a test template
18703 </p>
18704 !! end
18705
18706
18707 !! test
18708 Basic test for template parameter in language variants
18709 !! options
18710 language=sr
18711 !! wikitext
18712 {{парамтест|param=foo}}
18713 !! html
18714 <p>This is a test template with parameter foo
18715 </p>
18716 !! end
18717
18718
18719 !! test
18720 Simple category in language variants
18721 !! options
18722 language=sr cat
18723 !! wikitext
18724 [[Category:МедиаWики Усер'с Гуиде]]
18725 !! html
18726 <a href="/wiki/%D0%9A%D0%B0%D1%82%D0%B5%D0%B3%D0%BE%D1%80%D0%B8%D1%98%D0%B0:MediaWiki_User%27s_Guide" title="Категорија:MediaWiki User's Guide">MediaWiki User's Guide</a>
18727 !! end
18728
18729
18730 !! article
18731 Category:分类
18732 !! text
18733 blah
18734 !! endarticle
18735
18736 !! article
18737 Category:分類
18738 !! text
18739 blah
18740 !! endarticle
18741
18742 !! test
18743 Don't convert blue categorylinks to another variant (bug 33210)
18744 !! options
18745 language=zh cat
18746 !! wikitext
18747 [[A]][[Category:分类]]
18748 !! html
18749 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
18750 !! end
18751
18752
18753 !! test
18754 Stripping -{}- tags (language variants)
18755 !! options
18756 language=sr
18757 !! wikitext
18758 Latin proverb: -{Ne nuntium necare}-
18759 !! html
18760 <p>Latin proverb: Ne nuntium necare
18761 </p>
18762 !! end
18763
18764
18765 !! test
18766 Prevent conversion with -{}- tags (language variants)
18767 !! options
18768 language=sr variant=sr-ec
18769 !! wikitext
18770 Latinski: -{Ne nuntium necare}-
18771 !! html
18772 <p>Латински: Ne nuntium necare
18773 </p>
18774 !! end
18775
18776
18777 !! test
18778 Prevent conversion of text with -{}- tags (language variants)
18779 !! options
18780 language=sr variant=sr-ec
18781 !! wikitext
18782 Latinski: -{Ne nuntium necare}-
18783 !! html
18784 <p>Латински: Ne nuntium necare
18785 </p>
18786 !! end
18787
18788
18789 !! test
18790 Prevent conversion of links with -{}- tags (language variants)
18791 !! options
18792 language=sr variant=sr-ec
18793 !! wikitext
18794 -{[[Main Page]]}-
18795 !! html
18796 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18797 </p>
18798 !! end
18799
18800
18801 !! test
18802 -{}- tags within headlines (within html for parserConvert())
18803 !! options
18804 language=sr variant=sr-ec
18805 !! wikitext
18806 == -{Naslov}- ==
18807 !! html
18808 <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>
18809
18810 !! end
18811
18812
18813 !! test
18814 Explicit definition of language variant alternatives
18815 !! options
18816 language=zh variant=zh-tw
18817 !! wikitext
18818 -{zh:China;zh-tw:Taiwan}-, not China
18819 !! html
18820 <p>Taiwan, not China
18821 </p>
18822 !! end
18823
18824
18825 !! test
18826 Conversion around HTML tags
18827 !! options
18828 language=sr variant=sr-ec
18829 !! wikitext
18830 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
18831 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
18832 !! html
18833 <p>
18834 <span title="ЛаCтин">ски</span>
18835 </p>
18836 !! end
18837
18838
18839 !! test
18840 Explicit session-wise language variant mapping (A flag and - flag)
18841 !! options
18842 language=zh variant=zh-tw
18843 !! wikitext
18844 Taiwan is not China.
18845 But -{A|zh:China;zh-tw:Taiwan}- is China,
18846 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
18847 and -{China}- is China.
18848 !! html
18849 <p>Taiwan is not China.
18850 But Taiwan is Taiwan,
18851 (This should be stripped!)
18852 and China is China.
18853 </p>
18854 !! end
18855
18856 !! test
18857 Explicit session-wise language variant mapping (H flag for hide)
18858 !! options
18859 language=zh variant=zh-tw
18860 !! wikitext
18861 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
18862 Taiwan is China.
18863 !! html
18864 <p>(This should be stripped!)
18865 Taiwan is Taiwan.
18866 </p>
18867 !! end
18868
18869 !! test
18870 Adding explicit conversion rule for title (T flag)
18871 !! options
18872 language=zh variant=zh-tw showtitle
18873 !! wikitext
18874 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
18875 !! html
18876 Taiwan
18877 <p>Should be stripped!
18878 </p>
18879 !! end
18880
18881 !! test
18882 Testing that changing the language variant here in the tests actually works
18883 !! options
18884 language=zh variant=zh showtitle
18885 !! wikitext
18886 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
18887 !! html
18888 China
18889 <p>Should be stripped!
18890 </p>
18891 !! end
18892
18893 !! test
18894 Recursive conversion of alt and title attrs shouldn't clear converter state
18895 !! options
18896 language=zh variant=zh-cn showtitle
18897 !! wikitext
18898 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
18899 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
18900 !! html
18901 China
18902 <p>
18903 Should be stripped<span title="Exclamation">!</span>
18904 </p>
18905 !! end
18906
18907 !! test
18908 Bug 24072: more test on conversion rule for title
18909 !! options
18910 language=zh variant=zh-tw showtitle
18911 !! wikitext
18912 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
18913 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
18914 !! html
18915 Taiwan
18916 <p>This should be stripped!
18917 This won't take interferes with the title rule.
18918 </p>
18919 !! end
18920
18921 !! test
18922 Partly disable title conversion if variant == main language code
18923 !! options
18924 language=zh variant=zh title=[[ZH]] showtitle
18925 !! wikitext
18926 -{T|zh-cn:CN;zh-tw:TW}-
18927 !! html
18928 ZH
18929 <p>
18930 </p>
18931 !! end
18932
18933 !! test
18934 Partly disable title conversion if variant == main language code, more
18935 !! options
18936 language=zh variant=zh title=[[ZH]] showtitle
18937 !! wikitext
18938 -{T|TW}-
18939 !! html
18940 ZH
18941 <p>
18942 </p>
18943 !! end
18944
18945 !! test
18946 Raw output of variant escape tags (R flag)
18947 !! options
18948 language=zh variant=zh-tw
18949 !! wikitext
18950 Raw: -{R|zh:China;zh-tw:Taiwan}-
18951 !! html
18952 <p>Raw: zh:China;zh-tw:Taiwan
18953 </p>
18954 !! end
18955
18956 !! test
18957 Strings evaluating false shouldn't be ignored by Language converter (T51072)
18958 !! options
18959 language=zh variant=zh-cn
18960 !! input
18961 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
18962 !! result
18963 <p>0
18964 </p>
18965 !! end
18966
18967 !! test
18968 Conversion rules from [numeric-only string] to [something else] (T48634)
18969 !! options
18970 language=zh variant=zh-cn
18971 !! input
18972 -{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
18973 !! result
18974 <p>D12345EE12345
18975 </p>
18976 !! end
18977
18978 !! test
18979 Bidirectional converter rule entries with an empty value should be ignored (T53551)
18980 !! options
18981 language=zh variant=zh-cn
18982 !! input
18983 -{H|zh-cn:foo;zh-tw:;}-foobar
18984 !! result
18985 <p>foobar
18986 </p>
18987 !! end
18988
18989 !! test
18990 Unidirectional converter rule entries with an empty "from" string should be ignored (T53551)
18991 !! options
18992 language=zh variant=zh-cn
18993 !! input
18994 -{H|=>zh-cn:foo;}-foobar
18995 !! result
18996 <p>foobar
18997 </p>
18998 !! end
18999
19000 !! test
19001 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
19002 !! options
19003 language=zh variant=zh-cn
19004 !! input
19005 -{H|}-foobar
19006 !! result
19007 <p>foobar
19008 </p>
19009 !! end
19010
19011 !! test
19012 Nested using of manual convert syntax
19013 !! options
19014 language=zh variant=zh-hk
19015 !! wikitext
19016 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
19017 !! html
19018 <p>Nested: Hello Hong Kong!
19019 </p>
19020 !! end
19021
19022 !! test
19023 Proper conversion of text in external links
19024 !! options
19025 language=sr variant=sr-ec
19026 !! wikitext
19027 http://www.google.com
19028 gopher://www.google.com
19029 [http://www.google.com http://www.google.com]
19030 [gopher://www.google.com gopher://www.google.com]
19031 [https://www.google.com irc://www.google.com]
19032 [ftp://www.google.com www.google.com/ftp://dir]
19033 [//www.google.com www.google.com]
19034 !! html
19035 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
19036 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
19037 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
19038 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
19039 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
19040 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
19041 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
19042 </p>
19043 !! end
19044
19045 !! test
19046 Do not convert roman numbers to language variants
19047 !! options
19048 language=sr variant=sr-ec
19049 !! wikitext
19050 Fridrih IV je car.
19051 !! html
19052 <p>Фридрих IV је цар.
19053 </p>
19054 !! end
19055
19056 !! test
19057 Unclosed language converter markup "-{"
19058 !! options
19059 language=sr
19060 !! wikitext
19061 -{T|hello
19062 !! html
19063 <p>-{T|hello
19064 </p>
19065 !! end
19066
19067 !! test
19068 Don't convert raw rule "-{R|=&gt;}-" to "=>"
19069 !! options
19070 language=sr
19071 !! wikitext
19072 -{R|=&gt;}-
19073 !! html
19074 <p>=&gt;
19075 </p>
19076 !!end
19077
19078 !! test
19079 Don't break link parsing if language converter markup is in the caption.
19080 !! options
19081 language=sr variant=sr-ec
19082 !! wikitext
19083 [[Main Page|-{R|main page}-]]
19084 !! html
19085 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
19086 </p>
19087 !! end
19088
19089 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19090 !! test
19091 Don't break image parsing if language converter markup is in the caption.
19092 !! options
19093 language=sr
19094 !! wikitext
19095 [[File:Foobar.jpg|-{R|caption}-]]
19096 !! html/parsoid
19097 <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>
19098 </p>
19099 !! end
19100
19101 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19102 !! test
19103 Don't break list handling if language converter markup is in the item.
19104 !! options
19105 language=zh variant=zh-cn
19106 !! wikitext
19107 ;-{zh-cn:AAA;zh-tw:BBB}-
19108 !! html/php
19109 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
19110
19111 !! html/parsoid
19112 <dl><dt>AAA
19113 </dt></dl>
19114 !! end
19115
19116 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19117 !! test
19118 Don't break table handling if language converter markup is in the cell.
19119 !! options
19120 language=sr variant=sr-ec
19121 !! wikitext
19122 {|
19123 |-
19124 | -{R|B}-
19125 |}
19126 !! html/php
19127 <table>
19128
19129 <tr>
19130 <td>Б}-
19131 </td></tr></table>
19132
19133 !! html/parsoid
19134 <table>
19135
19136 <tr>
19137 <td> B
19138 </td></tr></table>
19139
19140 !! end
19141
19142 !! test
19143 Bug 529: Uncovered bullet
19144 !! wikitext
19145 * Foo {{bullet}}
19146 !! html
19147 <ul><li> Foo </li>
19148 <li> Bar</li></ul>
19149
19150 !! end
19151
19152 # Plain MediaWiki does not remove empty lists, but tidy actually does.
19153 # Templates in Wikipedia rely on this behavior, as tidy has always been
19154 # enabled there. These tests are normally run *without* tidy, so specify the
19155 # full output here.
19156 # To test realistic parsing behavior, apply a tidy-like transformation to both
19157 # the expected output and your parser's output.
19158 !! test
19159 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
19160 !! wikitext
19161 ******* Foo {{bullet}}
19162 !! html
19163 <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>
19164 <li> Bar</li></ul>
19165
19166 !! end
19167
19168 !! test
19169 Bug 529: Uncovered table already at line-start
19170 !! wikitext
19171 x
19172
19173 {{table}}
19174 y
19175 !! html
19176 <p>x
19177 </p>
19178 <table>
19179 <tr>
19180 <td> 1 </td>
19181 <td> 2
19182 </td></tr>
19183 <tr>
19184 <td> 3 </td>
19185 <td> 4
19186 </td></tr></table>
19187 <p>y
19188 </p>
19189 !! end
19190
19191 !! test
19192 Bug 529: Uncovered bullet in parser function result
19193 !! wikitext
19194 * Foo {{lc:{{bullet}} }}
19195 !! html
19196 <ul><li> Foo </li>
19197 <li> bar</li></ul>
19198
19199 !! end
19200
19201 !! test
19202 Bug 5678: Double-parsed template argument
19203 !! wikitext
19204 {{lc:{{{1}}}|hello}}
19205 !! html
19206 <p>{{{1}}}
19207 </p>
19208 !! end
19209
19210 !! test
19211 Bug 5678: Double-parsed template invocation
19212 !! wikitext
19213 {{lc:{{paramtest {{!}} param = hello }} }}
19214 !! html
19215 <p>{{paramtest | param = hello }}
19216 </p>
19217 !! end
19218
19219 !! test
19220 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
19221 !! options
19222 language=cs
19223 title=[[Main Page]]
19224 !! wikitext
19225 {{PRVNÍVELKÉ:ěščř}}
19226 {{prvnívelké:ěščř}}
19227 {{PRVNÍMALÉ:ěščř}}
19228 {{prvnímalé:ěščř}}
19229 {{MALÁ:ěščř}}
19230 {{malá:ěščř}}
19231 {{VELKÁ:ěščř}}
19232 {{velká:ěščř}}
19233 !! html
19234 <p>Ěščř
19235 Ěščř
19236 ěščř
19237 ěščř
19238 ěščř
19239 ěščř
19240 ĚŠČŘ
19241 ĚŠČŘ
19242 </p>
19243 !! end
19244
19245 !! test
19246 Morwen/13: Unclosed link followed by heading
19247 !! wikitext
19248 [[link
19249 ==heading==
19250 !! html
19251 <p>[[link
19252 </p>
19253 <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>
19254
19255 !! end
19256
19257 !! test
19258 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
19259 !! wikitext
19260 {{foo|
19261 =heading=
19262 !! html
19263 <p>{{foo|
19264 </p>
19265 <h1><span class="mw-headline" id="heading">heading</span></h1>
19266
19267 !! end
19268
19269 !! test
19270 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
19271 !! wikitext
19272 {{foo|
19273 ==heading==
19274 !! html
19275 <p>{{foo|
19276 </p>
19277 <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>
19278
19279 !! end
19280
19281 !! test
19282 Tildes in comments
19283 !! options
19284 pst
19285 !! wikitext
19286 <!-- ~~~~ -->
19287 !! html
19288 <!-- ~~~~ -->
19289 !! end
19290
19291 !! test
19292 Paragraphs inside divs (no extra line breaks)
19293 !! wikitext
19294 <div>Line one
19295
19296 Line two</div>
19297 !! html
19298 <div>Line one
19299 Line two</div>
19300
19301 !! end
19302
19303 !! test
19304 Paragraphs inside divs (extra line break on open)
19305 !! wikitext
19306 <div>
19307 Line one
19308
19309 Line two</div>
19310 !! html
19311 <div>
19312 <p>Line one
19313 </p>
19314 Line two</div>
19315
19316 !! end
19317
19318 !! test
19319 Paragraphs inside divs (extra line break on close)
19320 !! wikitext
19321 <div>Line one
19322
19323 Line two
19324 </div>
19325 !! html
19326 <div>Line one
19327 <p>Line two
19328 </p>
19329 </div>
19330
19331 !! end
19332
19333 !! test
19334 Paragraphs inside divs (extra line break on open and close)
19335 !! wikitext
19336 <div>
19337 Line one
19338
19339 Line two
19340 </div>
19341 !! html
19342 <div>
19343 <p>Line one
19344 </p><p>Line two
19345 </p>
19346 </div>
19347
19348 !! end
19349
19350 !! test
19351 Nesting tags, paragraphs on lines which begin with <div>
19352 !! wikitext
19353 <div></div><strong>A
19354 B</strong>
19355 !! html/php+tidy
19356 <p><strong>A</strong></p>
19357 <p><strong>B</strong></p>
19358 !! html/parsoid
19359 <div></div>
19360 <p><strong>A
19361 B</strong>
19362 </p>
19363 !! end
19364
19365 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
19366 !! test
19367 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
19368 !! wikitext
19369 <blockquote>Line one
19370
19371 Line two</blockquote>
19372 !! html
19373 <blockquote>Line one
19374 Line two</blockquote>
19375
19376 !! html+tidy
19377 <blockquote>
19378 <p>Line one Line two</p>
19379 </blockquote>
19380 !! end
19381
19382 !! test
19383 Bug 6200: paragraphs inside blockquotes (extra line break on open)
19384 !! wikitext
19385 <blockquote>
19386 Line one
19387
19388 Line two</blockquote>
19389 !! html
19390 <blockquote>
19391 <p>Line one
19392 </p>
19393 Line two</blockquote>
19394
19395 !! html+tidy
19396 <blockquote>
19397 <p>Line one</p>
19398 Line two</blockquote>
19399 !! end
19400
19401 !! test
19402 Bug 6200: paragraphs inside blockquotes (extra line break on close)
19403 !! wikitext
19404 <blockquote>Line one
19405
19406 Line two
19407 </blockquote>
19408 !! html
19409 <blockquote>Line one
19410 <p>Line two
19411 </p>
19412 </blockquote>
19413
19414 !! html+tidy
19415 <blockquote>
19416 <p>Line one</p>
19417 <p>Line two</p>
19418 </blockquote>
19419 !! end
19420
19421 !! test
19422 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
19423 !! wikitext
19424 <blockquote>
19425 Line one
19426
19427 Line two
19428 </blockquote>
19429 !! html
19430 <blockquote>
19431 <p>Line one
19432 </p><p>Line two
19433 </p>
19434 </blockquote>
19435
19436 !! html+tidy
19437 <blockquote>
19438 <p>Line one</p>
19439 <p>Line two</p>
19440 </blockquote>
19441 !! end
19442
19443 !! test
19444 Paragraphs inside blockquotes/divs (no extra line breaks)
19445 !! wikitext
19446 <blockquote><div>Line one
19447
19448 Line two</div></blockquote>
19449 !! html
19450 <blockquote><div>Line one
19451 Line two</div></blockquote>
19452
19453 !! end
19454
19455 !! test
19456 Paragraphs inside blockquotes/divs (extra line break on open)
19457 !! wikitext
19458 <blockquote><div>
19459 Line one
19460
19461 Line two</div></blockquote>
19462 !! html
19463 <blockquote><div>
19464 <p>Line one
19465 </p>
19466 Line two</div></blockquote>
19467
19468 !! end
19469
19470 !! test
19471 Paragraphs inside blockquotes/divs (extra line break on close)
19472 !! wikitext
19473 <blockquote><div>Line one
19474
19475 Line two
19476 </div></blockquote>
19477 !! html
19478 <blockquote><div>Line one
19479 <p>Line two
19480 </p>
19481 </div></blockquote>
19482
19483 !! end
19484
19485 !! test
19486 Paragraphs inside blockquotes/divs (extra line break on open and close)
19487 !! wikitext
19488 <blockquote><div>
19489 Line one
19490
19491 Line two
19492 </div></blockquote>
19493 !! html
19494 <blockquote><div>
19495 <p>Line one
19496 </p><p>Line two
19497 </p>
19498 </div></blockquote>
19499
19500 !! end
19501
19502 !! test
19503 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
19504 !! options
19505 wgLinkHolderBatchSize=0
19506 !! wikitext
19507 [[meatball:1]]
19508 [[meatball:2]]
19509 [[meatball:3]]
19510 !! html
19511 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
19512 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
19513 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
19514 </p>
19515 !! end
19516
19517 !! test
19518 Free external link invading image caption
19519 !! wikitext
19520 [[Image:Foobar.jpg|thumb|http://x|hello]]
19521 !! html
19522 <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>
19523
19524 !! end
19525
19526 !! test
19527 Bug 15196: localised external link numbers
19528 !! options
19529 language=fa
19530 !! wikitext
19531 [http://en.wikipedia.org/]
19532 !! html/php
19533 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
19534 </p>
19535 !! html/parsoid
19536 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
19537 !! end
19538
19539 !! test
19540 Multibyte character in padleft
19541 !! wikitext
19542 {{padleft:-Hello|7|Æ}}
19543 !! html
19544 <p>Æ-Hello
19545 </p>
19546 !! end
19547
19548 !! test
19549 Multibyte character in padright
19550 !! wikitext
19551 {{padright:Hello-|7|Æ}}
19552 !! html
19553 <p>Hello-Æ
19554 </p>
19555 !! end
19556
19557 !!test
19558 formatdate parser function
19559 !! wikitext
19560 {{#formatdate:2009-03-24}}
19561 !! html
19562 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
19563 </p>
19564 !! end
19565
19566 !!test
19567 formatdate parser function, with default format
19568 !! wikitext
19569 {{#formatdate:2009-03-24|mdy}}
19570 !! html
19571 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
19572 </p>
19573 !! end
19574
19575 !! test
19576 Spacing of numbers in formatted dates
19577 !! wikitext
19578 {{#formatdate:January 15}}
19579 !! html
19580 <p><span class="mw-formatted-date" title="01-15">January 15</span>
19581 </p>
19582 !! end
19583
19584 !! test
19585 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
19586 !! options
19587 language=nl title=[[MediaWiki:Common.css]]
19588 !! wikitext
19589 {{#formatdate:2009-03-24|dmy}}
19590 !! html
19591 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
19592 </p>
19593 !! end
19594
19595 #
19596 #
19597 #
19598
19599 #
19600 # Edit comments
19601 #
19602
19603 !! test
19604 Edit comment with link
19605 !! options
19606 comment
19607 !! wikitext
19608 I like the [[Main Page]] a lot
19609 !! html
19610 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
19611 !!end
19612
19613 !! test
19614 Edit comment with link and link text
19615 !! options
19616 comment
19617 !! wikitext
19618 I like the [[Main Page|best pages]] a lot
19619 !! html
19620 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
19621 !!end
19622
19623 !! test
19624 Edit comment with link and link text with suffix
19625 !! options
19626 comment
19627 !! wikitext
19628 I like the [[Main Page|best page]]s a lot
19629 !! html
19630 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
19631 !!end
19632
19633 !! test
19634 Edit comment with section link (non-local, eg in history list)
19635 !! options
19636 comment title=[[Main Page]]
19637 !! wikitext
19638 /* External links */ removed bogus entries
19639 !! html
19640 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
19641 !!end
19642
19643 !! test
19644 Edit comment with section link and text before it (non-local, eg in history list)
19645 !! options
19646 comment title=[[Main Page]]
19647 !! wikitext
19648 pre-comment text /* External links */ removed bogus entries
19649 !! html
19650 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>
19651 !!end
19652
19653 !! test
19654 Edit comment with section link (local, eg in diff view)
19655 !! options
19656 comment local title=[[Main Page]]
19657 !! wikitext
19658 /* External links */ removed bogus entries
19659 !! html
19660 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
19661 !!end
19662
19663 !! test
19664 Edit comment with subpage link (bug 14080)
19665 !! options
19666 comment
19667 subpage
19668 title=[[Subpage test]]
19669 !! wikitext
19670 Poked at a [[/subpage]] here...
19671 !! html
19672 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
19673 !!end
19674
19675 !! test
19676 Edit comment with subpage link and link text (bug 14080)
19677 !! options
19678 comment
19679 subpage
19680 title=[[Subpage test]]
19681 !! wikitext
19682 Poked at a [[/subpage|neat little page]] here...
19683 !! html
19684 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
19685 !!end
19686
19687 !! test
19688 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
19689 !! options
19690 comment
19691 title=[[Subpage test]]
19692 !! wikitext
19693 Poked at a [[/subpage]] here...
19694 !! html
19695 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...
19696 !!end
19697
19698 !! test
19699 Edit comment with bare anchor link (local, as on diff)
19700 !! options
19701 comment
19702 local
19703 title=[[Main Page]]
19704 !! wikitext
19705 [[#section]]
19706 !! html
19707 <a href="#section">#section</a>
19708 !! end
19709
19710 !! test
19711 Edit comment with bare anchor link (non-local, as on history)
19712 !! options
19713 comment
19714 title=[[Main Page]]
19715 !! wikitext
19716 [[#section]]
19717 !! html
19718 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
19719 !! end
19720
19721 !! test
19722 Anchor starting with underscore
19723 !! wikitext
19724 [[#_ref|One]]
19725 !! html
19726 <p><a href="#_ref">One</a>
19727 </p>
19728 !! end
19729
19730 !! test
19731 Id starting with underscore
19732 !! wikitext
19733 <div id="_ref"></div>
19734 !! html
19735 <div id="_ref"></div>
19736
19737 !! end
19738
19739 !! test
19740 Space normalisation on autocomment (bug 22784)
19741 !! options
19742 comment
19743 title=[[Main Page]]
19744 !! wikitext
19745 /* __hello__world__ */
19746 !! html
19747 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
19748 !! end
19749
19750 !! test
19751 percent-encoding and + signs in comments (Bug 26410)
19752 !! options
19753 comment
19754 !! wikitext
19755 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
19756 !! html/php
19757 <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>
19758 !! end
19759
19760 # Parsoid doesn't support this yet: see bug 73581
19761 # but it *should* omit the 'src' attribute if the image is bad.
19762 # PHP side of tests was disabled in
19763 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
19764 # because of issues in the PHP parserTests infrastructure
19765 # (but the output below is indeed what the PHP side emits)
19766 !! test
19767 Bad images - basic functionality
19768 !! wikitext
19769 [[File:Bad.jpg]]
19770 !! DISABLED/html/php
19771 !! html/parsoid
19772 <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>
19773 !! end
19774
19775 !! test
19776 Bad images - bug 16039: text after bad image disappears
19777 !! wikitext
19778 Foo bar
19779 [[File:Bad.jpg]]
19780 Bar foo
19781 !! DISABLED/html/php
19782 <p>Foo bar
19783 </p><p>Bar foo
19784 </p>
19785 !! html/parsoid
19786 <p>Foo bar
19787 <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>
19788 Bar foo</p>
19789 !! end
19790
19791 !! test
19792 Verify that displaytitle works (bug #22501) no displaytitle
19793 !! options
19794 showtitle
19795 !! config
19796 wgAllowDisplayTitle=true
19797 wgRestrictDisplayTitle=false
19798 !! wikitext
19799 this is not the the title
19800 !! html/php
19801 Parser test
19802 <p>this is not the the title
19803 </p>
19804 !! end
19805
19806 !! test
19807 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
19808 !! options
19809 showtitle
19810 title=[[Screen]]
19811 !! config
19812 wgAllowDisplayTitle=true
19813 wgRestrictDisplayTitle=false
19814 !! wikitext
19815 this is not the the title
19816 {{DISPLAYTITLE:whatever}}
19817 !! html/php
19818 whatever
19819 <p>this is not the the title
19820 </p>
19821 !! end
19822
19823 !! test
19824 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
19825 !! options
19826 showtitle
19827 title=[[Screen]]
19828 !! config
19829 wgAllowDisplayTitle=true
19830 wgRestrictDisplayTitle=true
19831 !! wikitext
19832 this is not the the title
19833 {{DISPLAYTITLE:whatever}}
19834 !! html/php
19835 Screen
19836 <p>this is not the the title
19837 </p>
19838 !! end
19839
19840 !! test
19841 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
19842 !! options
19843 showtitle
19844 title=[[Screen]]
19845 !! config
19846 wgAllowDisplayTitle=true
19847 wgRestrictDisplayTitle=true
19848 !! wikitext
19849 this is not the the title
19850 {{DISPLAYTITLE:screen}}
19851 !! html/php
19852 screen
19853 <p>this is not the the title
19854 </p>
19855 !! end
19856
19857 !! test
19858 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
19859 !! options
19860 showtitle
19861 title=[[Screen]]
19862 !! config
19863 wgAllowDisplayTitle=false
19864 !! wikitext
19865 this is not the the title
19866 {{DISPLAYTITLE:screen}}
19867 !! html/php
19868 Screen
19869 <p>this is not the the title
19870 <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>
19871 </p>
19872 !! end
19873
19874 !! test
19875 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
19876 !! options
19877 showtitle
19878 title=[[Screen]]
19879 !! config
19880 wgAllowDisplayTitle=false
19881 !! wikitext
19882 this is not the the title
19883 !! html/php
19884 Screen
19885 <p>this is not the the title
19886 </p>
19887 !! end
19888
19889 !! test
19890 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
19891 !! options
19892 showtitle
19893 title=[[Screen]]
19894 !! config
19895 wgAllowDisplayTitle=true
19896 wgRestrictDisplayTitle=true
19897 !! wikitext
19898 this is not the the title
19899 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
19900 !! html/php
19901 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
19902 <p>this is not the the title
19903 </p>
19904 !! end
19905
19906 !! test
19907 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
19908 !! options
19909 showtitle
19910 title=[[Screen]]
19911 !! config
19912 wgAllowDisplayTitle=true
19913 wgRestrictDisplayTitle=true
19914 !! wikitext
19915 this is not the the title
19916 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
19917 !! html/php
19918 <span style="color: red;">s</span>creen
19919 <p>this is not the the title
19920 </p>
19921 !! end
19922
19923 !! test
19924 Page status indicators: Empty name is invalid
19925 !! options
19926 showindicators
19927 !! wikitext
19928 <indicator name=" "></indicator>
19929 <indicator></indicator>
19930 !! html
19931 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
19932 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
19933 </p>
19934 !! end
19935
19936 !! test
19937 Page status indicators: Weird syntaxes that are okay
19938 !! options
19939 showindicators
19940 !! wikitext
19941 <indicator name="empty" />
19942 <indicator name="name"></indicator>
19943 !! html
19944 empty=
19945 name=
19946 <p><br />
19947 </p>
19948 !! end
19949
19950 !! test
19951 Page status indicators: Torture test
19952 !! options
19953 showindicators
19954 !! wikitext
19955 <indicator name="01">hello world</indicator>
19956 <indicator name="02">[[Main Page]]</indicator>
19957 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
19958 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
19959 <indicator name="05">* foo
19960 * bar</indicator>
19961 <indicator name="06"><nowiki>foo</nowiki></indicator>
19962 <indicator name="07"> Preformatted</indicator>
19963 <indicator name="08"><div>Broken tag</indicator>
19964 <indicator name="09">{| class=wikitable
19965 | cell
19966 |}</indicator>
19967 <indicator name="10">Two
19968
19969 paragraphs</indicator>
19970 !! html
19971 01=hello world
19972 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19973 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" />
19974 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>
19975 05=<ul><li> foo</li>
19976 <li> bar</li></ul>
19977
19978 06=foo
19979 07=<pre>Preformatted
19980 </pre>
19981 08=<div>Broken tag</div>
19982
19983 09=<table class="wikitable">
19984 <tr>
19985 <td> cell
19986 </td></tr></table>
19987
19988 10=<p>Two
19989 </p><p>paragraphs
19990 </p>
19991 <p><br />
19992 </p><p><br />
19993 </p><p><br />
19994 </p><p><br />
19995 </p><p><br />
19996 </p>
19997 !! end
19998
19999 !! test
20000 preload: check <noinclude> and <includeonly>
20001 !! options
20002 preload
20003 !! wikitext
20004 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
20005 !! html/php
20006 Hello kind world.
20007 !! end
20008
20009 !! test
20010 preload: check <onlyinclude>
20011 !! options
20012 preload
20013 !! wikitext
20014 Goodbye <onlyinclude>Hello world</onlyinclude>
20015 !! html/php
20016 Hello world
20017 !! end
20018
20019 !! test
20020 preload: can pass tags through if we want to
20021 !! options
20022 preload
20023 !! wikitext
20024 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
20025 !! html/php
20026 <includeonly>Hello world</includeonly>
20027 !! end
20028
20029 !! test
20030 preload: check that it doesn't try to do tricks
20031 !! options
20032 preload
20033 !! wikitext
20034 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
20035 !! html/php
20036 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
20037 !! end
20038
20039 !! test
20040 Play a bit with r67090 and bug 3158
20041 !! wikitext
20042 <div style="width:50% !important">&nbsp;</div>
20043 <div style="width:50%&nbsp;!important">&nbsp;</div>
20044 <div style="width:50%&#160;!important">&nbsp;</div>
20045 <div style="border : solid;">&nbsp;</div>
20046 !! html/php
20047 <div style="width:50% !important">&#160;</div>
20048 <div style="width:50% !important">&#160;</div>
20049 <div style="width:50% !important">&#160;</div>
20050 <div style="border&#160;: solid;">&#160;</div>
20051
20052 !! html/parsoid
20053 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
20054 <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>
20055 <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>
20056 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
20057
20058 !! end
20059
20060 !! test
20061 HTML5 data attributes
20062 !! wikitext
20063 <span data-foo="bar">Baz</span>
20064 <p data-abc-def_hij="">Quuz</p>
20065 !! html
20066 <p><span data-foo="bar">Baz</span>
20067 </p>
20068 <p data-abc-def_hij="">Quuz</p>
20069
20070 !! end
20071
20072 !! test
20073 percent-encoding and + signs in internal links (Bug 26410)
20074 !! wikitext
20075 [[User:+%]] [[Page+title%]]
20076 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
20077 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
20078 [[%33%45]] [[%33%45+]]
20079 !! html/php
20080 <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>
20081 <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>
20082 <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>
20083 <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>
20084 </p>
20085 !! html/parsoid
20086 <p><a rel="mw:WikiLink" href="./User:+%25" title="User:+%">User:+%</a> <a rel="mw:WikiLink" href="Page+title%25" title="Page+title%">Page+title%</a>
20087 <a rel="mw:WikiLink" href="%25+" title="%+">%+</a> <a rel="mw:WikiLink" href="%25+" title="%+">%20</a> <a rel="mw:WikiLink" href="%25+" title="%+">%+ </a> <a rel="mw:WikiLink" href="%25+r" title="%+r">%+r</a>
20088 <a rel="mw:WikiLink" href="%25" title="%">%</a> <a rel="mw:WikiLink" href="+" title="+">+</a> <span class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"bogus","ak":"foo"},{"ck":"caption","ak":"[[bar]]"}]}' data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"[[bar]]"}'><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>
20089 <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>
20090 !! end
20091
20092 !! test
20093 Special characters in embedded file links (bug 27679)
20094 !! wikitext
20095 [[File:Contains & ampersand.jpg]]
20096 [[File:Does not exist.jpg|Title with & ampersand]]
20097 !! html/php
20098 <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>
20099 <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>
20100 </p>
20101 !! html/parsoid
20102 <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>
20103 <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; 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>
20104 !! end
20105
20106 !! test
20107 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
20108 !! wikitext
20109 Text&apos;s been normalized?
20110 !! html
20111 <p>Text&#39;s been normalized?
20112 </p>
20113 !! end
20114
20115 !! test
20116 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
20117 !! wikitext
20118 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
20119 !! html
20120 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
20121 </p>
20122 !! end
20123
20124 !! test
20125 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
20126 !! wikitext
20127 [http://www.example.org/ ideograms]
20128 !! html
20129 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
20130 </p>
20131 !! end
20132
20133 !! test
20134 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
20135 !! wikitext
20136 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
20137 !! html
20138 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
20139 </p>
20140 !! end
20141
20142 !! article
20143 Mediawiki:loop1
20144 !! text
20145 {{Identical|A}}
20146 !! endarticle
20147
20148 !! article
20149 Mediawiki:loop2
20150 !! text
20151 {{Identical|B}}
20152 !! endarticle
20153
20154 !! article
20155 Template:Identical
20156 !! text
20157 {{int:loop1}}
20158 {{int:loop2}}
20159 !! endarticle
20160
20161 !! test
20162 Bug 31098 Template which includes system messages which includes the template
20163 !! wikitext
20164 {{Identical}}
20165 !! html
20166 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
20167 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
20168 </p>
20169 !! end
20170
20171 !! test
20172 Bug31490 Turkish: ucfirst 'blah'
20173 !! options
20174 language=tr
20175 !! wikitext
20176 {{ucfirst:blah}}
20177 !! html
20178 <p>Blah
20179 </p>
20180 !! end
20181
20182 !! test
20183 Bug31490 Turkish: ucfirst 'ix'
20184 !! options
20185 language=tr
20186 !! wikitext
20187 {{ucfirst:ix}}
20188 !! html
20189 <p>İx
20190 </p>
20191 !! end
20192
20193 !! test
20194 Bug31490 Turkish: lcfirst 'BLAH'
20195 !! options
20196 language=tr
20197 !! wikitext
20198 {{lcfirst:BLAH}}
20199 !! html
20200 <p>bLAH
20201 </p>
20202 !! end
20203
20204 !! test
20205 Bug31490 Turkish: ucfırst (with a dotless i)
20206 !! options
20207 language=tr
20208 !! wikitext
20209 {{ucfırst:blah}}
20210 !! html
20211 <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>
20212 </p>
20213 !! end
20214
20215 !! test
20216 Bug31490 ucfırst (with a dotless i) with English language
20217 !! options
20218 language=en
20219 !! wikitext
20220 {{ucfırst:blah}}
20221 !! html
20222 <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>
20223 </p>
20224 !! end
20225
20226 !! test
20227 Bug 26375: TOC with italics
20228 !! options
20229 title=[[Main Page]]
20230 !! wikitext
20231 __TOC__
20232 == ''Lost'' episodes ==
20233 !! html
20234 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20235 <ul>
20236 <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>
20237 </ul>
20238 </div>
20239
20240 <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>
20241
20242 !! end
20243
20244 !! test
20245 Bug 26375: TOC with bold
20246 !! options
20247 title=[[Main Page]]
20248 !! wikitext
20249 __TOC__
20250 == '''should be bold''' then normal text ==
20251 !! html
20252 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20253 <ul>
20254 <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>
20255 </ul>
20256 </div>
20257
20258 <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>
20259
20260 !! end
20261
20262 !! test
20263 Bug 33845: Headings become cursive in TOC when they contain an image
20264 !! options
20265 title=[[Main Page]]
20266 !! wikitext
20267 __TOC__
20268 == Image [[Image:foobar.jpg]] ==
20269 !! html
20270 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20271 <ul>
20272 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
20273 </ul>
20274 </div>
20275
20276 <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>
20277
20278 !! end
20279
20280 !! test
20281 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
20282 !! options
20283 title=[[Main Page]]
20284 !! wikitext
20285 __TOC__
20286 == <blockquote>Quote</blockquote> ==
20287 !! html
20288 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20289 <ul>
20290 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
20291 </ul>
20292 </div>
20293
20294 <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>
20295
20296 !! html+tidy
20297 <p></p>
20298 <div id="toc" class="toc">
20299 <div id="toctitle">
20300 <h2>Contents</h2>
20301 </div>
20302 <ul>
20303 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
20304 </ul>
20305 </div>
20306 <p></p>
20307 <h2><span class="mw-headline" id="Quote"></span></h2>
20308 <blockquote>
20309 <p><span class="mw-headline" id="Quote">Quote</span></p>
20310 </blockquote>
20311 <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>
20312 !! end
20313
20314 !! test
20315 Unclosed tags in TOC
20316 !! options
20317 title=[[Main Page]]
20318 !! wikitext
20319 __TOC__
20320 == Proof: 2 < 3 ==
20321 <small>Hanc marginis exiguitas non caperet.</small>
20322 QED
20323 !! html
20324 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20325 <ul>
20326 <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>
20327 </ul>
20328 </div>
20329
20330 <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>
20331 <p><small>Hanc marginis exiguitas non caperet.</small>
20332 QED
20333 </p>
20334 !! end
20335
20336 !! test
20337 Multiple tags in TOC
20338 !! wikitext
20339 __TOC__
20340 == <i>Foo</i> <b>Bar</b> ==
20341
20342 == <i>Foo</i> <blockquote>Bar</blockquote> ==
20343 !! html
20344 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20345 <ul>
20346 <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>
20347 <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>
20348 </ul>
20349 </div>
20350
20351 <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>
20352 <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>
20353
20354 !! html+tidy
20355 <p></p>
20356 <div id="toc" class="toc">
20357 <div id="toctitle">
20358 <h2>Contents</h2>
20359 </div>
20360 <ul>
20361 <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>
20362 <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>
20363 </ul>
20364 </div>
20365 <p></p>
20366 <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>
20367 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
20368 <blockquote>
20369 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
20370 </blockquote>
20371 <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>
20372 !! end
20373
20374 !! test
20375 Tags with parameters in TOC
20376 !! wikitext
20377 __TOC__
20378 == <sup class="in-h2">Hello</sup> ==
20379
20380 == <sup class="a > b">Evilbye</sup> ==
20381 !! html
20382 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20383 <ul>
20384 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
20385 <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>
20386 </ul>
20387 </div>
20388
20389 <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>
20390 <h2><span class="mw-headline" id="b.22.3EEvilbye"><sup> 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>
20391
20392 !! end
20393
20394 !! test
20395 span tags with directionality in TOC
20396 !! wikitext
20397 __TOC__
20398 == <span dir="ltr">C++</span> ==
20399
20400 == <span dir="rtl">זבנג!</span> ==
20401
20402 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
20403
20404 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
20405
20406 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
20407 !! html
20408 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20409 <ul>
20410 <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>
20411 <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>
20412 <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>
20413 <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>
20414 <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>
20415 </ul>
20416 </div>
20417
20418 <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>
20419 <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>
20420 <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>
20421 <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>
20422 <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>
20423
20424 !! end
20425
20426 !! test
20427 Bug 72884: bdi element in ToC
20428 !! wikitext
20429 __TOC__
20430 == <bdi>test</bdi> ==
20431 !! html
20432 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20433 <ul>
20434 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
20435 </ul>
20436 </div>
20437
20438 <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>
20439
20440 !! end
20441
20442 # Note that the html output does not have the <p></p>, but the
20443 # html+tidy output *does*. This is because the empty <p></p> is
20444 # removed by the sanitizer, but only when tidy is *not* enabled (!).
20445 !! test
20446 Empty <p> tag in TOC, removed by Sanitizer (T92892)
20447 !! wikitext
20448 __TOC__
20449 == x ==
20450 !! html
20451 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20452 <ul>
20453 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
20454 </ul>
20455 </div>
20456
20457 <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>
20458
20459 !! html+tidy
20460 <p></p>
20461 <div id="toc" class="toc">
20462 <div id="toctitle">
20463 <h2>Contents</h2>
20464 </div>
20465 <ul>
20466 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
20467 </ul>
20468 </div>
20469 <p></p>
20470 <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>
20471 !! end
20472
20473 !! article
20474 MediaWiki:Bug32057
20475 !! text
20476 == {{int:headline_sample}} ==
20477 !! endarticle
20478
20479 !! test
20480 Bug 32057: Title needed when expanding <h> nodes.
20481 !! options
20482 title=[[Main Page]]
20483 !! wikitext
20484 {{int:Bug32057}}
20485 !! html
20486 <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>
20487
20488 !! end
20489
20490 !! test
20491 Strip marker in urlencode
20492 !! wikitext
20493 {{urlencode:x<nowiki/>y}}
20494 {{urlencode:x<nowiki/>y|wiki}}
20495 {{urlencode:x<nowiki/>y|path}}
20496 {{urlencode:x<pre id="one">two</pre>y}}
20497 !! html
20498 <p>xy
20499 xy
20500 xy
20501 xy
20502 </p>
20503 !! end
20504
20505 !! test
20506 Strip marker in lc
20507 !! wikitext
20508 {{lc:x<nowiki/>y}}
20509 !! html
20510 <p>xy
20511 </p>
20512 !! end
20513
20514 !! test
20515 Strip marker in uc
20516 !! wikitext
20517 {{uc:x<nowiki/>y}}
20518 !! html
20519 <p>XY
20520 </p>
20521 !! end
20522
20523 !! test
20524 Strip marker in formatNum
20525 !! wikitext
20526 {{formatnum:1<nowiki/>2}}
20527 {{formatnum:1<nowiki/>2|R}}
20528 !! html
20529 <p>12
20530 12
20531 </p>
20532 !! end
20533
20534 !! test
20535 Check noCommafy in formatNum
20536 !! options
20537 language=be-tarask
20538 !! wikitext
20539 {{formatnum:123456.78}}
20540 {{formatnum:123456.78|NOSEP}}
20541 !! html
20542 <p>123 456,78
20543 123456.78
20544 </p>
20545 !! end
20546
20547 !! test
20548 Wrong option for formatNum (bug 56199)
20549 !! wikitext
20550 {{formatnum:1,234.56|Random}}
20551 {{formatnum:1,234.56|EVERYTHING}}
20552 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
20553 !! html
20554 <p>1,234.56
20555 1,234.56
20556 1,234.56
20557 </p>
20558 !! end
20559
20560 !! test
20561 Strip marker in grammar
20562 !! options
20563 language=fi
20564 !! wikitext
20565 {{grammar:elative|foo<nowiki/>bar}}
20566 !! html
20567 <p>foobarista
20568 </p>
20569 !! end
20570
20571 !! test
20572 Strip marker in padleft
20573 !! wikitext
20574 {{padleft:|2|x<nowiki/>y}}
20575 !! html
20576 <p>xy
20577 </p>
20578 !! end
20579
20580 !! test
20581 Strip marker in padright
20582 !! wikitext
20583 {{padright:|2|x<nowiki/>y}}
20584 !! html
20585 <p>xy
20586 </p>
20587 !! end
20588
20589 !! test
20590 Strip marker in anchorencode
20591 !! wikitext
20592 {{anchorencode:x<nowiki/>y}}
20593 !! html
20594 <p>xy
20595 </p>
20596 !! end
20597
20598 !! test
20599 nowiki inside link inside heading (bug 18295)
20600 !! wikitext
20601 ==[[foo|x<nowiki>y</nowiki>z]]==
20602 !! html
20603 <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>
20604
20605 !! end
20606
20607 !! test
20608 new support for bdi element (bug 31817)
20609 !! wikitext
20610 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
20611 !! html
20612 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
20613
20614 !!end
20615
20616 !! test
20617 Ignore pipe between table row attributes
20618 !! wikitext
20619 {|
20620 | quux
20621 |- id=foo | style='color: red'
20622 | bar
20623 |}
20624 !! html
20625 <table>
20626 <tr>
20627 <td> quux
20628 </td></tr>
20629 <tr id="foo" style="color: red">
20630 <td> bar
20631 </td></tr></table>
20632
20633 !! end
20634
20635 !!test
20636 Gallery override link with WikiLink (bug 34852)
20637 !! wikitext
20638 <gallery>
20639 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
20640 </gallery>
20641 !! html
20642 <ul class="gallery mw-gallery-traditional">
20643 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20644 <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>
20645 <div class="gallerytext">
20646 <p>caption
20647 </p>
20648 </div>
20649 </div></li>
20650 </ul>
20651
20652 !! end
20653
20654 !!test
20655 Gallery override link with absolute external link (bug 34852)
20656 !! wikitext
20657 <gallery>
20658 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
20659 </gallery>
20660 !! html
20661 <ul class="gallery mw-gallery-traditional">
20662 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20663 <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>
20664 <div class="gallerytext">
20665 <p>caption
20666 </p>
20667 </div>
20668 </div></li>
20669 </ul>
20670
20671 !! end
20672
20673 !!test
20674 Gallery override link with malicious javascript (bug 34852)
20675 !! wikitext
20676 <gallery>
20677 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
20678 </gallery>
20679 !! html
20680 <ul class="gallery mw-gallery-traditional">
20681 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20682 <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>
20683 <div class="gallerytext">
20684 <p>caption
20685 </p>
20686 </div>
20687 </div></li>
20688 </ul>
20689
20690 !! end
20691
20692 !!test
20693 Gallery with invalid title as link (bug 43964)
20694 !! wikitext
20695 <gallery>
20696 File:foobar.jpg|link=<
20697 </gallery>
20698 !! html
20699 <ul class="gallery mw-gallery-traditional">
20700 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20701 <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>
20702 <div class="gallerytext">
20703 </div>
20704 </div></li>
20705 </ul>
20706
20707 !! end
20708
20709 !!test
20710 Language parser function
20711 !! wikitext
20712 {{#language:ar}}
20713 !! html
20714 <p>العربية
20715 </p>
20716 !! end
20717
20718 !!test
20719 Padleft and padright as substr
20720 !! wikitext
20721 {{padleft:|3|abcde}}
20722 {{padright:|3|abcde}}
20723 !! html
20724 <p>abc
20725 abc
20726 </p>
20727 !! end
20728
20729 !!test
20730 Special parser function
20731 !! wikitext
20732 {{#special:RandomPage}}
20733 {{#special:BaDtItLe}}
20734 {{#special:Foobar}}
20735 !! html
20736 <p>Special:Random
20737 Special:Badtitle
20738 Special:Foobar
20739 </p>
20740 !! end
20741
20742 !!test
20743 Bug 34939 - Case insensitive link parsing ([HttP://])
20744 !! wikitext
20745 [HttP://MediaWiki.Org/]
20746 !! html/php
20747 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
20748 </p>
20749 !! html/parsoid
20750 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
20751 !! end
20752
20753 !!test
20754 Bug 34939 - Case insensitive link parsing ([HttP:// title])
20755 !! wikitext
20756 [HttP://MediaWiki.Org/ MediaWiki]
20757 !! html
20758 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
20759 </p>
20760 !! end
20761
20762 !!test
20763 Bug 34939 - Case insensitive link parsing (HttP://)
20764 !! wikitext
20765 HttP://MediaWiki.Org/
20766 !! html/php
20767 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
20768 </p>
20769 !! html/parsoid
20770 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
20771 !! end
20772
20773 !!test
20774 Disable TOC
20775 !! options
20776 notoc
20777 !! wikitext
20778 Lead
20779 == Section 1 ==
20780 == Section 2 ==
20781 == Section 3 ==
20782 == Section 4 ==
20783 == Section 5 ==
20784 !! html
20785 <p>Lead
20786 </p>
20787
20788 <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>
20789 <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>
20790 <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>
20791 <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>
20792 <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>
20793
20794 !! end
20795
20796
20797 ###
20798 ### Parsoid-specific tests
20799 ### Parsoid-PHP parser incompatibilities
20800 ###
20801 !!test
20802 1. SOL-sensitive wikitext tokens as template-args
20803 !!options
20804 parsoid=wt2html,wt2wt
20805 !! wikitext
20806 {{echo|*a}}
20807 {{echo|#a}}
20808 {{echo|:a}}
20809 !! html
20810 <span about="#mwt1" typeof="mw:Transclusion">
20811 </span><ul about="#mwt1"><li>a</li>
20812 </ul>
20813 <span about="#mwt2" typeof="mw:Transclusion">
20814 </span><ol about="#mwt2"><li>a</li>
20815 </ol>
20816 <span about="#mwt3" typeof="mw:Transclusion">
20817 </span><dl about="#mwt3"><dd>a</dd>
20818 </dl>
20819 !!end
20820
20821 #### -----------------------------------------------------------------
20822 #### Parsoid-specific functionality tests
20823 #### -----------------------------------------------------------------
20824
20825 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
20826 # We know wt2wt will fail, but we expect selser to pass.
20827 # Due to the nature of our testing, wt2wt and selser tests will enter the
20828 # blacklist and we'll catch selser regressions based on changes to the
20829 # blacklist entries for selser tests.
20830 !! test
20831 1. Bad treebuilder fixup of formatting elt is cleaned up
20832 !! options
20833 parsoid=wt2html,wt2wt
20834 !! wikitext
20835 {|
20836 |
20837 <small>
20838 [[Image:Foobar.jpg|right|Test]]
20839 </small>
20840 |}
20841 !! html/parsoid
20842 <table>
20843 <tbody><tr><td>
20844 <small>
20845 <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>
20846 </small>
20847 </td></tr>
20848 </tbody></table>
20849 !! end
20850
20851 !! test
20852 2. Bad treebuilder fixup of formatting elt is cleaned up
20853 !! options
20854 parsoid=wt2html,wt2wt
20855 !! wikitext
20856 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
20857
20858 <small>[[Image:Foobar.jpg|right|300px]]</small>
20859 !! html/parsoid
20860
20861 <p><b>foo</b></p>
20862 <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>
20863 <p><b>bar</b></p>
20864 <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>
20865 !! end
20866
20867 !! test
20868 3. Bad treebuilder fixup of formatting elt is cleaned up
20869 !! options
20870 parsoid=wt2html,wt2wt
20871 !! wikitext
20872 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
20873 !! html/parsoid
20874 <p><small><b>foo</b></small></p>
20875 <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>
20876 <p><small><b>bar</b></small></p>
20877 !! end
20878
20879 !! test
20880 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
20881 !! options
20882 parsoid=wt2html,wt2wt
20883 !! wikitext
20884 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
20885 !! html/parsoid
20886 <p><b><small></small></b></p>
20887 <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>
20888 <p></p>
20889 !! end
20890
20891 #### ----------------------------------------------------------------
20892 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
20893 #### tags. Parsoid's output for these tags differs from that of the
20894 #### PHP parser.
20895 #### ----------------------------------------------------------------
20896
20897 !!test
20898 Ref: 1. ref-location should be replaced with an index span
20899 !!options
20900 parsoid
20901 !! wikitext
20902 A <ref>foo</ref>
20903 B <ref name="x">foo</ref>
20904 C <ref name="y" />
20905 <references />
20906 !! html
20907 <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>
20908 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>
20909 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>
20910 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
20911 <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>
20912 <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>
20913 <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>
20914 </ol>
20915 !!end
20916
20917 !!test
20918 Ref: 2. ref-tags with identical names should all get the same index
20919 !!options
20920 parsoid
20921 !! wikitext
20922 A <ref name="x">foo</ref>
20923 B <ref name="x" />
20924 <references />
20925 !! html
20926 <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>
20927 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>
20928 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
20929 <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>
20930 </ol>
20931 !!end
20932
20933 !!test
20934 Ref: 3. spaces in ref-names should be ignored
20935 !!options
20936 parsoid
20937 !! wikitext
20938 A <ref name="x">foo</ref>
20939 B <ref name=" x " />
20940 C <ref name= x />
20941 <references />
20942 !! html
20943 <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>
20944 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>
20945 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>
20946 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
20947 <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>
20948 </ol>
20949 !!end
20950
20951 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
20952 !!test
20953 Ref: 4. 'constructor' should be accepted as a valid ref-name
20954 !!options
20955 parsoid
20956 !! wikitext
20957 A <ref name="constructor">foo</ref>
20958 <references />
20959 !! html
20960 <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>
20961 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20962 <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>
20963 </ol>
20964 !!end
20965
20966 !!test
20967 Ref: 5. body should accept generic wikitext
20968 !!options
20969 parsoid
20970 !! wikitext
20971 A <ref>
20972 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
20973 </ref>
20974
20975 <references />
20976 !! html
20977 <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>
20978
20979 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
20980 <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>
20981 </span></li>
20982 </ol>
20983 !!end
20984
20985 !!test
20986 Ref: 6. indent-pres should not be output in ref-body
20987 !!options
20988 parsoid
20989 !! wikitext
20990 A <ref>
20991 foo
20992 bar
20993 baz
20994 </ref>
20995
20996 <references />
20997 !! html
20998 <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>
20999
21000 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21001 <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
21002 bar
21003 baz
21004 </span></li>
21005 </ol>
21006 !!end
21007
21008 !!test
21009 Ref: 7. No p-wrapping in ref-body
21010 !!options
21011 parsoid
21012 !! wikitext
21013 A <ref>
21014 foo
21015
21016 bar
21017
21018
21019 baz
21020
21021
21022
21023 booz
21024 </ref>
21025
21026 <references />
21027 !! html
21028 <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>
21029
21030 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21031 <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
21032
21033 bar
21034
21035
21036 baz
21037
21038
21039
21040 booz
21041 </span></li>
21042 </ol>
21043 !!end
21044
21045 !!test
21046 Ref: 8. transclusion wikitext has lower precedence
21047 !!options
21048 parsoid
21049 !! wikitext
21050 A <ref> foo {{echo|</ref> B C}}
21051
21052 <references />
21053 !! html
21054 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> B C<span typeof="mw:Nowiki">}}</span></p>
21055 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21056 <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 typeof="mw:Nowiki" data-parsoid='{"src":"{{","dsr":[12,14,0,0]}'>{{</span>echo|</span></li>
21057 </ol>
21058 !!end
21059
21060 !!test
21061 Ref: 9. unclosed comments should not leak out of ref-body
21062 !!options
21063 parsoid
21064 !! wikitext
21065 A <ref> foo <!--</ref> B C
21066 <references />
21067 !! html
21068 <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>
21069 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21070 <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>
21071 </ol>
21072 !!end
21073
21074 !!test
21075 Ref: 10. Unclosed HTML tags should not leak out of ref-body
21076 !!options
21077 parsoid
21078 !! wikitext
21079 A <ref> <b> foo </ref> B C
21080
21081 <references />
21082 !! html
21083 <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>
21084
21085
21086 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21087 <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>
21088 </ol>
21089 !!end
21090
21091 !!test
21092 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
21093 !!options
21094 parsoid
21095 !! wikitext
21096 A <ref>foo</ref> B
21097 C <ref>bar</ref> D
21098 <references />
21099 !! html
21100 <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
21101 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>
21102 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21103 <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>
21104 <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>
21105 </ol>
21106 !!end
21107
21108 !!test
21109 Ref: 12. ref-tags act as trailing newline migration barrier
21110 !! wikitext
21111 <!--the newline at the end of this line moves out of the p tag-->a
21112
21113 b<!--the newline at the end of this line stays inside the p tag--> <ref />
21114 <ref />
21115
21116 c
21117 <references />
21118 !! html/parsoid
21119 <!--the newline at the end of this line moves out of the p tag--><p>a</p>
21120
21121
21122 <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>
21123 <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>
21124
21125 <p>c</p>
21126 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21127 <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>
21128 <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>
21129 !!end
21130
21131 !!test
21132 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
21133 !!options
21134 parsoid
21135 !! wikitext
21136 <ref>foo</ref> A
21137 <ref>bar
21138 </ref> B
21139 <references />
21140 !! html
21141 <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
21142 <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>
21143 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21144 <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>
21145 <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
21146 </span></li>
21147 </ol>
21148 !!end
21149
21150 !!test
21151 Ref: 14. A nested ref-tag should be emitted as plain text
21152 !!options
21153 parsoid
21154 !! wikitext
21155 <ref>foo <ref>bar</ref> baz</ref>
21156
21157 <references />
21158 !! html
21159 <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>
21160 </p>
21161 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21162 <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>
21163 </ol>
21164 !!end
21165
21166 !!test
21167 Ref: 15. ref-tags with identical names should get identical indexes
21168 !!options
21169 parsoid
21170 !! wikitext
21171 A1 <ref name="a">foo</ref> A2 <ref name="a" />
21172 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
21173
21174 <references />
21175 !! html
21176 <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>
21177 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>
21178
21179 <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>
21180 </ol>
21181 !!end
21182
21183 ## We don't bother wt2wt-ing non-standard whitespace
21184 !!test
21185 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
21186 !!options
21187 parsoid=wt2html
21188 !! wikitext
21189 A <ref >foo</ref >
21190
21191 <references />
21192 !! html
21193 <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>
21194 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21195 <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>
21196 !!end
21197
21198 !!test
21199 Ref: 17. Generate valid HTML5 id/about attributes
21200 !!options
21201 parsoid
21202 !!wikitext
21203 <ref name="a b">foo</ref>
21204
21205 <references />
21206 !!html
21207 <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>
21208 </p>
21209
21210 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21211 <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>
21212 </ol>
21213 !!end
21214
21215 !!test
21216 Ref: 18. T58916: Extension attributes should be parsed as plain text
21217 !!options
21218 parsoid
21219 !!wikitext
21220 <ref name="{{echo|a}}">foo</ref>
21221
21222 <references />
21223 !!html
21224 <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>
21225 </p>
21226
21227 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21228 <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>
21229 </ol>
21230 !!end
21231
21232 !!test
21233 Ref: 19. ref-tags with identical name encodings should get identical indexes
21234 !!options
21235 parsoid
21236 !! wikitext
21237 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
21238
21239 <references />
21240 !! html
21241 <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>
21242 </p>
21243 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21244 <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>
21245 </ol>
21246 !!end
21247
21248 !!test
21249 Ref: 20. ref-tags with identical names but different content should keep it
21250 !!options
21251 parsoid
21252 !! wikitext
21253 A <ref name="foo">Foo one</ref>
21254 B <ref name="foo">Foo two</ref>
21255 C <ref name="foo" />
21256
21257 <references />
21258 !! html
21259 <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>
21260 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>
21261 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>
21262
21263 <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>
21264 </ol>
21265 !!end
21266
21267 !!test
21268 References: 1. references tag without any refs should be handled properly
21269 !! wikitext
21270 <references />
21271 !! html/parsoid
21272 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
21273 !!end
21274
21275 !!test
21276 References: 2. references tag with group only outputs references from that group
21277 !! wikitext
21278 A <ref group="a">foo</ref>
21279 B <ref group="b">bar</ref>
21280 C <ref>baz</ref>
21281
21282 <references group="a" />
21283 <references />
21284 <references group="b" />
21285 !! html/parsoid
21286 <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>
21287 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>
21288 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>
21289
21290 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="a" data-mw='{"name":"references","attrs":{"group":"a"}}'>
21291 <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>
21292 </ol>
21293 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'>
21294 <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>
21295 </ol>
21296 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt12" data-mw-group="b" data-mw='{"name":"references","attrs":{"group":"b"}}'>
21297 <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>
21298 </ol>
21299 !!end
21300
21301 !!test
21302 References: 3. ref list should be cleared after processing references
21303 !! wikitext
21304 A <ref>foo</ref>
21305
21306 <references />
21307
21308 B <ref>bar</ref>
21309
21310 <references />
21311 !! html/parsoid
21312 <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>
21313
21314 <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>
21315 </ol>
21316
21317 <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>
21318
21319 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21320 <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>
21321 </ol>
21322 !!end
21323
21324 !!test
21325 References: 4. only referenced group should be cleared after processing references
21326 !! wikitext
21327 A <ref group="a">afoo</ref>
21328 B <ref>bfoo</ref>
21329
21330 <references group="a" />
21331
21332 C <ref>cfoo</ref>
21333
21334 <references />
21335 !! html/parsoid
21336 <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>
21337 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>
21338
21339 <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>
21340 </ol>
21341
21342 <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>
21343
21344 <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>
21345 </ol>
21346 !!end
21347
21348 !!test
21349 References: 5. ref tags in references should be processed while ignoring all other content
21350 !! wikitext
21351 A <ref name="a" />
21352 B <ref name="b">bar</ref>
21353
21354 <references>
21355 <ref name="a">foo</ref>
21356 This should just get lost.
21357 </references>
21358 !! html/parsoid
21359 <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>
21360 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>
21361
21362
21363 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","body":{"extsrc":"&lt;ref name=\"a\">foo&lt;/ref>\nThis should just get lost.","html":"\n&lt;span about=\"#mwt8\" class=\"mw-ref\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid=&#39;{\"dsr\":[59,82,14,6]}&#39; data-mw=&#39;{\"name\":\"ref\",\"body\":{\"id\":\"mw-reference-text-cite_note-a-1\"},\"attrs\":{\"name\":\"a\"}}&#39;>&lt;a href=\"#cite_note-a-1\" style=\"counter-reset: mw-Ref 1;\">&lt;span class=\"mw-reflink-text\">[1]&lt;/span>&lt;/a>&lt;/span>\n"},"attrs":{}}'><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>
21364 </ol>
21365 !!end
21366
21367 !!test
21368 References: 6. <references /> from a transclusion
21369 !! wikitext
21370 <ref>Foo</ref> {{echo|<references />}}
21371 !! html/parsoid
21372 <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>
21373 </ol>
21374 !!end
21375
21376 !! test
21377 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
21378 !! wikitext
21379 A <ref>foo bar for a</ref>
21380 B <ref group="X" name="b" />
21381
21382 <references />
21383
21384 <references group="X">
21385 <ref name="b">foo</ref>
21386 </references>
21387 !! html/parsoid
21388 <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>
21389 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>
21390 </p>
21391
21392 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21393 <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>
21394 </ol>
21395
21396 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="X" data-mw='{"name":"references","body":{"extsrc":"&lt;ref name=\"b\">foo&lt;/ref>","html":"\n&lt;span about=\"#mwt10\" class=\"mw-ref\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid=&#39;{\"dsr\":[96,119,14,6]}&#39; data-mw=&#39;{\"name\":\"ref\",\"body\":{\"id\":\"mw-reference-text-cite_note-b-2\"},\"attrs\":{\"name\":\"b\"}}&#39;>&lt;a href=\"#cite_note-b-2\" style=\"counter-reset: mw-Ref 1;\" data-mw-group=\"X\">&lt;span class=\"mw-reflink-text\">[X 1]&lt;/span>&lt;/a>&lt;/span>\n"},"attrs":{"group":"X"}}'>
21397 <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>
21398 </ol>
21399 !! end
21400
21401 !! test
21402 References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
21403 !! wikitext
21404 X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
21405 <references />
21406 !! html/parsoid
21407 <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>
21408 <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>
21409 </ol>
21410 !!end
21411
21412 # This test only works in wt2html now as the <references /> are always generated
21413 # unless selser is active. Once T72722 is fixed, we should add a changes test
21414 # here to ensure that unrelated changes don't add the new <references /> in
21415 # wt2wt.
21416 !! test
21417 References: 9. Generate missing references list at the end
21418 !! wikitext
21419 A <ref>foo</ref>
21420 B <ref group="inexistent">bar</ref>
21421 !! html/parsoid
21422 <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>
21423 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21424 <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>
21425 </ol>
21426 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="inexistent" data-mw='{"name":"references","attrs":{"group":"inexistent"}}'>
21427 <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>
21428 </ol>
21429 !! end
21430
21431 !! test
21432 References: 10. New <references/> shouldn't be added for unrelated edits.
21433 !! options
21434 parsoid={
21435 "modes": ["selser"],
21436 "changes": [["#x", "remove"]],
21437 "selser": "noauto"
21438 }
21439 !! wikitext
21440 Unrelated text<span id="x"> that's going to disappear</span>.
21441 A <ref>foo</ref>
21442 !! wikitext/edited
21443 Unrelated text.
21444 A <ref>foo</ref>
21445 !!end
21446
21447 !! test
21448 Entities in ref name
21449 !! wikitext
21450 <ref name="test &amp; me">hi</ref>
21451 <references />
21452 !! html/parsoid
21453 <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>
21454 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21455 <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>
21456 </ol>
21457 !! end
21458
21459 # This test is wt2html only because we're permitting the serializer to produce
21460 # dirty diffs, normalizing the unclosed references to the self-closed version.
21461 !! test
21462 Generate references for unclosed references tag
21463 !! options
21464 parsoid=wt2html
21465 !! wikitext
21466 a<ref>foo</ref>
21467
21468 <references>
21469 !! html/parsoid
21470 <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>
21471 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21472 <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>
21473 !! end
21474
21475 !! test
21476 New reference serializes on its own line
21477 !! options
21478 parsoid=wt2wt,html2wt
21479 !! wikitext
21480 foo
21481 <references />
21482 !! html/parsoid
21483 foo<ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
21484 !! end
21485
21486 #### ----------------------------------------------------------------
21487 #### Parsoid-only testing of Parsoid's impl of LST
21488 #### Not implemented yet, see
21489 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
21490 #### ----------------------------------------------------------------
21491
21492 !!test
21493 LST Sections: 1. Simple section start and end
21494 !! wikitext
21495 <section begin="2011-05-16" />
21496 <section end="2014-04-10 (MW 1.23wmf22)" />
21497 !! html/parsoid
21498 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
21499 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
21500 !! end
21501
21502 #--------- Test stripping of empty nodes in template content ----------
21503 !!test
21504 Empty LI and TR nodes should be stripped from template content
21505 !!wikitext
21506 {{EmptyLITest}}
21507 {{EmptyTRTest}}
21508 !!html/parsoid
21509 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
21510 <li>a</li>
21511 <li>b</li>
21512 </ul>
21513 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
21514 <tbody>
21515 <tr>
21516 <td>foo</td>
21517 </tr>
21518 <tr>
21519 <td>bar</td>
21520 </tr>
21521 </tbody>
21522 </table>
21523 !!end
21524
21525 !!test
21526 Empty LI and TR nodes should not be stripped from top-level content
21527 !!wikitext
21528 * a
21529 *
21530 * b
21531 {|
21532 |-
21533 |-
21534 |foo
21535 |}
21536 !!html/parsoid
21537 <ul>
21538 <li> a</li>
21539 <li></li>
21540 <li> b</li>
21541 </ul>
21542 <table>
21543 <tbody>
21544 <tr></tr>
21545 <tr>
21546 <td>foo</td>
21547 </tr>
21548 </tbody>
21549 </table>
21550 !!end
21551
21552 !!test
21553 Empty TR nodes should not be stripped if they have any attributes set
21554 !!wikitext
21555 {{EmptyTRWithHTMLAttrTest}}
21556 !!html/parsoid
21557 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
21558 <tr align="center"></tr>
21559 <tr><td>foo</td></tr>
21560 <tr align="center"></tr>
21561 <tr><td>bar</td></tr>
21562 </table>
21563 !!end
21564
21565 #### ----------------------------------------------------------------
21566 #### The following section of tests are primarily to test
21567 #### wikitext escaping capabilities of Parsoid. Given that
21568 #### escaping can be done any number of ways, the wikitext (input)
21569 #### is always adjusted to reflect how Parsoid adds nowiki
21570 #### escape tags.
21571 ####
21572 #### We are marking several tests as parsoid-only since the
21573 #### HTML in the result section is different from what the
21574 #### PHP parser generates for it.
21575 #### ----------------------------------------------------------------
21576
21577
21578 #### --------------- Headings ---------------
21579 #### 0. Unnested
21580 #### 1. Nested inside html <h1>=foo=</h1>
21581 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
21582 #### 3. Nested inside html with wikitext split by html tags
21583 #### 4. No escape needed
21584 #### 5. Empty headings <h1></h1>
21585 #### 6. Heading chars in SOL context
21586 #### ----------------------------------------
21587 !! test
21588 Headings: 0. Unnested
21589 !! options
21590 parsoid
21591 !! wikitext
21592 <nowiki>=foo=</nowiki>
21593
21594 <nowiki> =foo= </nowiki>
21595 <!--cmt-->
21596 <nowiki>=foo=</nowiki>
21597
21598 =foo''a''<nowiki>=</nowiki>
21599 !! html
21600 <p><span typeof="mw:Nowiki">=foo=</span></p>
21601
21602 <p><span typeof="mw:Nowiki"> =foo= </span>
21603 <!--cmt-->
21604 <span typeof="mw:Nowiki">=foo=</span></p>
21605
21606 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
21607 !!end
21608
21609 # New headings and existing headings are handled differently
21610 !! test
21611 Headings: 1. Nested inside html
21612 !! options
21613 parsoid=html2wt
21614 !! html
21615 <h1>=foo=</h1>
21616 <h2>=foo=</h2>
21617 <h3>=foo=</h3>
21618
21619 <h1 data-parsoid=''>=foo=</h1>
21620 <h2 data-parsoid=''>=foo=</h2>
21621 <h3 data-parsoid=''>=foo=</h3>
21622 <h4 data-parsoid=''>=foo=</h4>
21623 <h5 data-parsoid=''>=foo=</h5>
21624 <h6 data-parsoid=''>=foo=</h6>
21625 !! wikitext
21626 = =foo= =
21627
21628 == =foo= ==
21629
21630 === =foo= ===
21631
21632 =<nowiki>=foo=</nowiki>=
21633 ==<nowiki>=foo=</nowiki>==
21634 ===<nowiki>=foo=</nowiki>===
21635 ====<nowiki>=foo=</nowiki>====
21636 =====<nowiki>=foo=</nowiki>=====
21637 ======<nowiki>=foo=</nowiki>======
21638
21639 !!end
21640
21641 !! test
21642 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
21643 !! options
21644 parsoid=html2wt
21645 !! html
21646 <h1>foo</h1>*bar
21647 <h1>foo</h1>=bar
21648 <h1>foo</h1>=bar=
21649 !! wikitext
21650 = foo =
21651 <nowiki>*</nowiki>bar
21652
21653 = foo =
21654 =bar
21655
21656 = foo =
21657 <nowiki>=bar=</nowiki>
21658 !!end
21659
21660 !! test
21661 Headings: 3. Nested inside html with wikitext split by html tags
21662 !! options
21663 parsoid=html2wt,wt2wt
21664 !! wikitext
21665 = ='''bold'''<nowiki>foo=</nowiki> =
21666 !! html/parsoid
21667 <h1>=<b>bold</b>foo=</h1>
21668 !!end
21669
21670 !! test
21671 Headings: 4a. No escaping needed (testing just h1 and h2)
21672 !! wikitext
21673 = =foo =
21674
21675 = foo= =
21676
21677 = =foo= =
21678
21679 = =foo= bar =
21680
21681 == =foo ==
21682
21683 == foo= ==
21684
21685 = = =
21686
21687 = ''=''foo= =
21688 !! html/parsoid
21689 <h1>=foo</h1>
21690 <h1>foo=</h1>
21691 <h1> =foo= </h1>
21692 <h1>=foo= bar</h1>
21693 <h2>=foo</h2>
21694 <h2>foo=</h2>
21695 <h1>=</h1>
21696 <h1><i>=</i>foo=</h1>
21697 !!end
21698
21699 !! test
21700 Headings: 4b. No escaping needed (inside p-tags)
21701 !! options
21702 parsoid=html2wt
21703 !! html
21704 <p>===
21705 =foo= x
21706 =foo= <s></s>
21707 </p>
21708 !! wikitext
21709 ===
21710 =foo= x
21711 =foo= <s></s>
21712 !!end
21713
21714 !! test
21715 Headings: 5. Empty headings
21716 !! wikitext
21717 =<nowiki/>=
21718
21719 ==<nowiki/>==
21720
21721 ===<nowiki/>===
21722
21723 ====<nowiki/>====
21724
21725 =====<nowiki/>=====
21726
21727 ======<nowiki/>======
21728 !! html/parsoid
21729 <h1 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h1>
21730
21731 <h2 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h2>
21732
21733 <h3 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h3>
21734
21735 <h4 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h4>
21736
21737 <h5 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h5>
21738
21739 <h6 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h6>
21740 !!end
21741
21742 !! test
21743 Headings: 6a. Heading chars in SOL context (with trailing spaces)
21744 !! wikitext
21745 <nowiki>=a=</nowiki>
21746
21747 <nowiki>=a=</nowiki>
21748
21749 <nowiki>=a=</nowiki>
21750
21751 <nowiki>=a=</nowiki>
21752 !! html/php
21753 <p>=a=
21754 </p><p>=a=
21755 </p><p>=a=
21756 </p><p>=a=
21757 </p>
21758 !! html/parsoid
21759 <p><span typeof="mw:Nowiki">=a=</span></p>
21760
21761 <p><span typeof="mw:Nowiki">=a=</span></p>
21762
21763 <p><span typeof="mw:Nowiki">=a=</span></p>
21764
21765 <p><span typeof="mw:Nowiki">=a=</span></p>
21766 !!end
21767
21768 !! test
21769 Headings: 6b. Heading chars in SOL context (with trailing newlines)
21770 !! wikitext
21771 <nowiki>=a=
21772 b</nowiki>
21773
21774 <nowiki>=a=
21775 b</nowiki>
21776
21777 <nowiki>=a=
21778 b</nowiki>
21779
21780 <nowiki>=a=
21781 b</nowiki>
21782 !! html/php
21783 <p>=a=
21784 b
21785 </p><p>=a=
21786 b
21787 </p><p>=a=
21788 b
21789 </p><p>=a=
21790 b
21791 </p>
21792 !! html/parsoid
21793 <p><span typeof="mw:Nowiki">=a=
21794 b</span></p>
21795
21796 <p><span typeof="mw:Nowiki">=a=
21797 b</span></p>
21798
21799 <p><span typeof="mw:Nowiki">=a=
21800 b</span></p>
21801
21802 <p><span typeof="mw:Nowiki">=a=
21803 b</span></p>
21804 !!end
21805
21806 !! test
21807 Headings: 6c. Heading chars in SOL context (leading newline break)
21808 !! wikitext
21809 a
21810 <nowiki>=b=</nowiki>
21811 !! html/php
21812 <p>a
21813 =b=
21814 </p>
21815 !! html/parsoid
21816 <p>a
21817 <span typeof="mw:Nowiki">=b=</span>
21818 !!end
21819
21820 !! test
21821 Headings: 6d. Heading chars in SOL context (with interspersed comments)
21822 !! wikitext
21823 <!--c0--><nowiki>=a=</nowiki>
21824
21825 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
21826 !! html/php
21827 <p>=a=
21828 </p><p>=a=
21829 </p>
21830 !! html/parsoid
21831 <!--c0--><p><span typeof="mw:Nowiki">=a=</span></p>
21832
21833 <!--c1--><p><span typeof="mw:Nowiki">=a=</span></p> <!--c2--> <!--c3-->
21834 !!end
21835
21836 !! test
21837 Headings: 6d. Heading chars in SOL context (No escaping needed)
21838 !! options
21839 parsoid=html2wt
21840 !! html/parsoid
21841 =a=<div>b</div>
21842 !! wikitext
21843 =a=<div>b</div>
21844 !!end
21845
21846 !! test
21847 Headings: 7. Insert a newline between new content and headings
21848 !! options
21849 parsoid=html2wt
21850 !! html/parsoid
21851 <h2>NEW</h2>
21852 <p>new</p>
21853 <h2 data-parsoid='{}'>A</h2>
21854 <p data-parsoid='{}'>a</p>
21855 !! wikitext
21856 == NEW ==
21857 new
21858
21859 ==A==
21860 a
21861
21862 !! end
21863
21864 #### --------------- Lists ---------------
21865 #### 0. Outside nests (*foo, etc.)
21866 #### 1. Nested inside html <ul><li>*foo</li></ul>
21867 #### 2. Inside definition lists
21868 #### 3. Only bullets at start should be escaped
21869 #### 4. No escapes needed
21870 #### 5. No unnecessary escapes
21871 #### 6. Escape bullets in SOL position
21872 #### 7. Escape bullets in a multi-line context
21873 #### ----------------------------------------
21874
21875 !! test
21876 Lists: 0. Outside nests
21877 !! wikitext
21878 <nowiki>*</nowiki>foo
21879
21880 <nowiki>#</nowiki>foo
21881
21882 <nowiki>;Foo:</nowiki>bar
21883 !! html/php
21884 <p>*foo
21885 </p><p>#foo
21886 </p><p>;Foo:bar
21887 </p>
21888 !! html/parsoid
21889 <p><span typeof="mw:Nowiki">*</span>foo</p>
21890
21891 <p><span typeof="mw:Nowiki">#</span>foo</p>
21892
21893 <p><span typeof="mw:Nowiki">;Foo:</span>bar</p>
21894 !!end
21895
21896 !! test
21897 Lists: 1. Nested inside html
21898 !! wikitext
21899 *<nowiki>*foo</nowiki>
21900
21901 *<nowiki>#foo</nowiki>
21902
21903 *<nowiki>:foo</nowiki>
21904
21905 *<nowiki>;foo</nowiki>
21906
21907 #<nowiki>*foo</nowiki>
21908
21909 #<nowiki>#foo</nowiki>
21910
21911 #<nowiki>:foo</nowiki>
21912
21913 #<nowiki>;foo</nowiki>
21914 !! html
21915 <ul><li>*foo</li></ul>
21916 <ul><li>#foo</li></ul>
21917 <ul><li>:foo</li></ul>
21918 <ul><li>;foo</li></ul>
21919 <ol><li>*foo</li></ol>
21920 <ol><li>#foo</li></ol>
21921 <ol><li>:foo</li></ol>
21922 <ol><li>;foo</li></ol>
21923
21924 !!end
21925
21926 !! test
21927 Lists: 2. Inside definition lists
21928 !! wikitext
21929 ;<nowiki>;foo</nowiki>
21930
21931 ;<nowiki>:foo</nowiki>
21932
21933 ;<nowiki>:foo</nowiki>
21934 :bar
21935
21936 :<nowiki>:foo</nowiki>
21937 !! html
21938 <dl><dt>;foo</dt></dl>
21939 <dl><dt>:foo</dt></dl>
21940 <dl><dt>:foo</dt>
21941 <dd>bar</dd></dl>
21942 <dl><dd>:foo</dd></dl>
21943
21944 !!end
21945
21946 !! test
21947 Lists: 3. Only bullets at start of text should be escaped
21948 !! wikitext
21949 *<nowiki>*foo*bar</nowiki>
21950
21951 *<nowiki>*foo</nowiki>''it''*bar
21952 !! html
21953 <ul><li>*foo*bar</li></ul>
21954 <ul><li>*foo<i>it</i>*bar</li></ul>
21955
21956 !!end
21957
21958 !! test
21959 Lists: 4. No escapes needed
21960 !! options
21961 parsoid
21962 !! wikitext
21963 *foo*bar
21964
21965 *''foo''*bar
21966
21967 *[[Foo]]: bar
21968
21969 *[[Foo]]*bar
21970 !! html
21971 <ul>
21972 <li>foo*bar
21973 </li>
21974 </ul>
21975 <ul>
21976 <li><i>foo</i>*bar
21977 </li>
21978 </ul>
21979 <ul>
21980 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
21981 </li>
21982 </ul>
21983 <ul>
21984 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
21985 </li>
21986 </ul>
21987 !!end
21988
21989 !! test
21990 Lists: 5. No unnecessary escapes
21991 !! wikitext
21992 * bar <span><nowiki>[[foo]]</nowiki></span>
21993
21994 * =bar <span><nowiki>[[foo]]</nowiki></span>
21995
21996 * [[bar <span><nowiki>[[foo]]</nowiki></span>
21997
21998 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
21999
22000 * =bar <span>foo]]</span>=
22001
22002 * <s></s>: a
22003
22004 * ''* foo''
22005 !! html
22006 <ul><li> bar <span>[[foo]]</span></li></ul>
22007 <ul><li> =bar <span>[[foo]]</span></li></ul>
22008 <ul><li> [[bar <span>[[foo]]</span></li></ul>
22009 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
22010 <ul><li> =bar <span>foo]]</span>=</li></ul>
22011 <ul><li> <s></s>: a</li></ul>
22012 <ul><li> <i>* foo</i></li></ul>
22013
22014 !!end
22015
22016 !! test
22017 Lists: 6. Escape bullets in SOL position
22018 !! options
22019 parsoid=html2wt
22020 !! html
22021 <p><!--cmt-->*foo</p>
22022 !! wikitext
22023 <!--cmt--><nowiki>*</nowiki>foo
22024 !!end
22025
22026 !! test
22027 Lists: 7. Escape bullets in a multi-line context
22028 !! wikitext
22029 a
22030 <nowiki>*</nowiki>b
22031 !! html
22032 <p>a
22033 *b
22034 </p>
22035 !!end
22036
22037 !! test
22038 Lists: 8. Escape colons only if not present in tags
22039 !! options
22040 parsoid=html2wt
22041 !! html
22042 <dl><dt>a:b<i>c:d</i></dt></dl>
22043 !! wikitext
22044 ; <nowiki>a:b</nowiki>''c:d''
22045 !! end
22046
22047 #### --------------- HRs ---------------
22048 #### 1. Single line
22049 #### -----------------------------------
22050
22051 !! test
22052 HRs: 1. Single line
22053 !! wikitext
22054 ----<nowiki>----</nowiki>
22055 ----=foo=
22056 ----*foo
22057 !! html+tidy
22058 <hr />
22059 <p>----</p>
22060 <hr />
22061 <p>=foo=</p>
22062 <hr />
22063 <p>*foo</p>
22064 !! end
22065
22066 #### --------------- Tables ---------------
22067 #### 1a. Simple example
22068 #### 1b. No escaping needed (!foo)
22069 #### 1c. No escaping needed (|foo)
22070 #### 1d. No escaping needed (|}foo)
22071 ####
22072 #### 2a. Nested in td (<td>foo|bar</td>)
22073 #### 2b. Nested in td (<td>foo||bar</td>)
22074 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
22075 ####
22076 #### 3a. Nested in th (<th>foo!bar</th>)
22077 #### 3b. Nested in th (<th>foo!!bar</th>)
22078 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
22079 ####
22080 #### 4a. Escape -
22081 #### 4b. Escape +
22082 #### 4c. No escaping needed
22083 #### --------------------------------------
22084
22085 !! test
22086 Tables: 1a. Simple example
22087 !! wikitext
22088 <nowiki>{|
22089 |}</nowiki>
22090 !! html
22091 <p>{|
22092 |}
22093 </p>
22094 !! end
22095
22096 !! test
22097 Tables: 1b. No escaping needed
22098 !! wikitext
22099 !foo
22100 !! html
22101 <p>!foo
22102 </p>
22103 !! end
22104
22105 !! test
22106 Tables: 1c. No escaping needed
22107 !! wikitext
22108 |foo
22109 !! html
22110 <p>|foo
22111 </p>
22112 !! end
22113
22114 !! test
22115 Tables: 1d. No escaping needed
22116 !! wikitext
22117 |}foo
22118 !! html
22119 <p>|}foo
22120 </p>
22121 !! end
22122
22123 !! test
22124 Tables: 2a. Nested in td
22125 !! options
22126 parsoid=html2wt
22127 !! html/parsoid
22128 <table><tbody><tr>
22129 <td>foo|bar</td></tr>
22130 <tr><td>x<div>a|b</div></td>
22131 </tbody></table>
22132 !! wikitext
22133 {|
22134 |<nowiki>foo|bar</nowiki>
22135 |-
22136 |x<div><nowiki>a|b</nowiki></div>
22137 |}
22138 !! html/php+tidy
22139 <table>
22140 <tr>
22141 <td>foo|bar</td>
22142 </tr>
22143 <tr>
22144 <td>x
22145 <div>a|b</div>
22146 </td>
22147 </tr>
22148 </table>
22149 !! end
22150
22151 !! test
22152 Tables: 2b. Nested in td
22153 !! options
22154 parsoid=html2wt
22155 !! html/parsoid
22156 <table><tbody><tr>
22157 <td>foo||bar</td>
22158 <td>a<i>b||c</i></td>
22159 <td>a<i><div>b||c</div></i></td>
22160 </tr></tbody></table>
22161 !! wikitext
22162 {|
22163 |<nowiki>foo||bar</nowiki>
22164 |a''<nowiki>b||c</nowiki>''
22165 |a''<div><nowiki>b||c</nowiki></div>''
22166 |}
22167 !! html/php
22168 <table>
22169 <tr>
22170 <td>foo||bar
22171 </td>
22172 <td>a<i>b||c</i>
22173 </td>
22174 <td>a<i><div>b||c</div></i>
22175 </td></tr></table>
22176
22177 !! end
22178
22179 !! test
22180 Tables: 2c. Nested in td -- no escaping needed
22181 !! wikitext
22182 {|
22183
22184 |foo!!bar
22185 |}
22186 !! html/*
22187 <table>
22188
22189 <tr>
22190 <td>foo!!bar
22191 </td></tr></table>
22192
22193 !! end
22194
22195 !! test
22196 Tables: 3a. Nested in th
22197 !! wikitext
22198 {|
22199
22200 !foo!bar
22201 |}
22202 !! html/*
22203 <table>
22204
22205 <tr>
22206 <th>foo!bar
22207 </th></tr></table>
22208
22209 !! end
22210
22211 !! test
22212 Tables: 3b. Nested in th
22213 !! options
22214 parsoid=html2wt
22215 !! html/parsoid
22216 <table><tbody>
22217 <tr><th>foo!!bar</th>
22218 <th><i>foo|bar</i></th>
22219 <th><i>foo!!bar</i></th>
22220 <th><i><span>foo!!bar</span></i></th>
22221 </tr></tbody></table>
22222 !! wikitext
22223 {|
22224 !<nowiki>foo!!bar</nowiki>
22225 !''<nowiki>foo|bar</nowiki>''
22226 !''<nowiki>foo!!bar</nowiki>''
22227 !''<span><nowiki>foo!!bar</nowiki></span>''
22228 |}
22229 !! html/php
22230 <table>
22231 <tr>
22232 <th>foo!!bar
22233 </th>
22234 <th><i>foo|bar</i>
22235 </th>
22236 <th><i>foo!!bar</i>
22237 </th>
22238 <th><i><span>foo!!bar</span></i>
22239 </th></tr></table>
22240
22241 !! end
22242
22243 !! test
22244 Tables: 3c. Nested in th
22245 !! options
22246 parsoid=html2wt
22247 !! html/parsoid
22248 <table><tbody>
22249 <tr><th>foo||bar</th>
22250 <th><span typeof="mw:Nowiki">foo||bar</span></th>
22251 </tr></tbody></table>
22252 !! wikitext
22253 {|
22254 !<nowiki>foo||bar</nowiki>
22255 !<nowiki>foo||bar</nowiki>
22256 |}
22257 !! html/php
22258 <table>
22259 <tr>
22260 <th>foo||bar
22261 </th>
22262 <th>foo||bar
22263 </th></tr></table>
22264
22265 !! end
22266
22267 !! test
22268 Tables: 4a. Escape -
22269 !! options
22270 parsoid=html2wt
22271 !! html/*
22272 <table>
22273
22274 <tr>
22275 <th>-bar
22276 </th></tr>
22277 <tr>
22278 <td>-bar
22279 </td></tr></table>
22280
22281 !! wikitext
22282 {|
22283
22284 !-bar
22285
22286 |-
22287 |<nowiki>-bar</nowiki>
22288 |}
22289 !! end
22290
22291 !! test
22292 Tables: 4b. Escape +
22293 !! options
22294 parsoid=html2wt
22295 !! html/*
22296 <table>
22297
22298 <tr>
22299 <th>+bar
22300 </th></tr>
22301 <tr>
22302 <td>+bar
22303 </td></tr></table>
22304
22305 !! wikitext
22306 {|
22307
22308 !+bar
22309
22310 |-
22311 |<nowiki>+bar</nowiki>
22312 |}
22313 !! end
22314
22315 !! test
22316 Tables: 4c. No escaping needed
22317 !! wikitext
22318 {|
22319 |foo-bar
22320 |foo+bar
22321 |-
22322 |''foo''-bar
22323 |''foo''+bar
22324 |-
22325 |foo
22326 bar|baz
22327 +bar
22328 -bar
22329 |-
22330 |x
22331 <div>a|b</div>
22332 |}
22333 !! html/php
22334 <table>
22335 <tr>
22336 <td>foo-bar
22337 </td>
22338 <td>foo+bar
22339 </td></tr>
22340 <tr>
22341 <td><i>foo</i>-bar
22342 </td>
22343 <td><i>foo</i>+bar
22344 </td></tr>
22345 <tr>
22346 <td>foo
22347 <p>bar|baz
22348 +bar
22349 -bar
22350 </p>
22351 </td></tr>
22352 <tr>
22353 <td>x
22354 <div>a|b</div>
22355 </td></tr></table>
22356
22357 !! html/parsoid
22358 <table><tbody>
22359 <tr><td>foo-bar</td><td>foo+bar</td></tr>
22360 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
22361 <tr><td>foo
22362 <p>bar|baz
22363 +bar
22364 -bar</p></td></tr>
22365 <tr><td>x
22366 <div>a|b</div></td>
22367 </tbody></table>
22368 !! end
22369
22370 !! test
22371 Tables: 4d. No escaping needed
22372 !! wikitext
22373 {|
22374 |[[Foo]]-bar
22375 ||+1
22376 ||-2
22377 |}
22378 !! html/php
22379 <table>
22380 <tr>
22381 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
22382 </td>
22383 <td>+1
22384 </td>
22385 <td>-2
22386 </td></tr></table>
22387
22388 !! html/parsoid
22389 <table>
22390 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
22391 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
22392 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
22393 </tbody></table>
22394 !! end
22395
22396 !! test
22397 Tables: Digest broken attributes on table and tr tag
22398 !! options
22399 parsoid=wt2html
22400 !! wikitext
22401 {| || |} ++
22402 |- || || ++ --
22403 |- > [
22404 |}
22405 !! html
22406 <table>
22407 <tbody>
22408 <tr></tr>
22409 <tr></tr>
22410 </tbody></table>
22411 !! end
22412
22413 !! test
22414 T97430: Don't emit empty nowiki pairs around marker meta tags
22415 !! options
22416 parsoid=html2wt
22417 !! html
22418 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
22419 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
22420 !! wikitext
22421 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
22422 <nowiki>|</nowiki>** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
22423 !! end
22424
22425 !! test
22426 Unclosed xmlish element in table line shouldn't eat end delimiters
22427 !! wikitext
22428 {|
22429 | <foo
22430 | bar>
22431 |}
22432 !! html/php
22433 <table>
22434 <tr>
22435 <td> &lt;foo
22436 </td>
22437 <td> bar&gt;
22438 </td></tr></table>
22439
22440 !! html/parsoid
22441 <table>
22442 <tbody><tr><td> &lt;foo</td>
22443 <td> bar></td></tr>
22444 </tbody></table>
22445 !! end
22446
22447 #### --------------- Links ----------------
22448 #### 1. Quote marks in link text
22449 #### 2. Wikilinks: Escapes needed
22450 #### 3. Wikilinks: No escapes needed
22451 #### 4. Extlinks: Escapes needed
22452 #### 5. Extlinks: No escapes needed
22453 #### --------------------------------------
22454 !! test
22455 Links 1. WikiLinks: No escapes needed
22456 !! wikitext
22457 [[Foo|Foo''boo'']]
22458 [[Foo|[Foobar]]]
22459 [[Foo|x [Foobar] x]]
22460 !! html/php
22461 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
22462 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
22463 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
22464 </p>
22465 !! html/parsoid
22466 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
22467 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
22468 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
22469 !! end
22470
22471 !! test
22472 Links 2. WikiLinks: Escapes needed
22473 !! options
22474 parsoid=html2wt
22475 !! html/parsoid
22476 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
22477 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
22478 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
22479 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
22480 <a href="Foo" rel="mw:WikiLink">|Bar</a>
22481 <a href="Foo" rel="mw:WikiLink">]]bar</a>
22482 <a href="Foo" rel="mw:WikiLink">[[bar</a>
22483 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
22484 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
22485 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
22486 !! wikitext
22487 [[Foo|<nowiki>Foobar]</nowiki>]]
22488 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
22489 [[Foo|<nowiki>[[Bar]]</nowiki>]]
22490 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
22491 [[Foo|<nowiki>|Bar</nowiki>]]
22492 [[Foo|<nowiki>]]bar</nowiki>]]
22493 [[Foo|<nowiki>[[bar</nowiki>]]
22494 [[Foo|<nowiki>x [[ y</nowiki>]]
22495 [[Foo|<nowiki>x ]] y</nowiki>]]
22496 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
22497 !! html/php
22498 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
22499 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
22500 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
22501 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
22502 <a href="/wiki/Foo" title="Foo">|Bar</a>
22503 <a href="/wiki/Foo" title="Foo">]]bar</a>
22504 <a href="/wiki/Foo" title="Foo">[[bar</a>
22505 <a href="/wiki/Foo" title="Foo">x [[ y</a>
22506 <a href="/wiki/Foo" title="Foo">x ]] y</a>
22507 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
22508 </p>
22509 !! end
22510
22511 !! test
22512 Links 3. WikiLinks: No escapes needed
22513 !! wikitext
22514 [[Foo|[Foobar]]
22515 [[Foo|foo|bar]]
22516 !! html/php
22517 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
22518 <a href="/wiki/Foo" title="Foo">foo|bar</a>
22519 </p>
22520 !! html/parsoid
22521 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
22522 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
22523 !! end
22524
22525 !! test
22526 Links 4. ExtLinks: Escapes needed
22527 !! options
22528 parsoid=html2wt
22529 !! html/parsoid
22530 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
22531 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
22532 <p>[http://google.com]</p>
22533 <p>[http://google.com google]</p>
22534 !! wikitext
22535 [http://google.com <nowiki>[google]</nowiki>]
22536 [http://google.com <nowiki>google]</nowiki>]
22537
22538 <nowiki>[http://google.com]</nowiki>
22539
22540 <nowiki>[http://google.com google]</nowiki>
22541
22542 !! html/php
22543 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
22544 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
22545 </p><p>[http://google.com]
22546 </p><p>[http://google.com google]
22547 </p>
22548 !! end
22549
22550 !! test
22551 Links 5. ExtLinks: No escapes needed
22552 !! wikitext
22553 [http://google.com [google]
22554 !! html/php
22555 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
22556 </p>
22557 !! html/parsoid
22558 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
22559 !! end
22560
22561 !! test
22562 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
22563 !! html/parsoid
22564 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
22565 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
22566 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
22567 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
22568 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
22569 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
22570 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
22571 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
22572 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
22573 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
22574 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
22575 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
22576 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
22577 </p>
22578 !! wikitext
22579 x<nowiki/>http://example.com<nowiki/>y
22580 http://example.com<nowiki/>?x
22581 http://example.com<nowiki/>&x
22582 http://example.com<nowiki/>'x
22583 http://example.com<nowiki/>,x
22584 http://example.com<nowiki/>.x
22585 http://example.com<nowiki/>;x
22586 http://example.com<nowiki/>:x
22587 http://example.com<nowiki/>;x
22588 http://example.com<nowiki/>!x
22589 http://example.com<nowiki/>=x
22590 http://example.com<nowiki/>(x)
22591 http://example.com(x<nowiki/>)
22592 !! end
22593
22594 !! test
22595 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
22596 !! html/parsoid
22597 <p>x
22598 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
22599 y
22600 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
22601 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
22602 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
22603 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
22604 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
22605 </p>
22606 !! wikitext
22607 x
22608 http://example.com
22609 y
22610 "http://example.com"
22611 (http://example.com)
22612 (http://example.com) foo
22613 http://example.com,
22614 http://example.com, foo
22615 !! html/php
22616 <p>x
22617 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
22618 y
22619 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
22620 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
22621 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
22622 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
22623 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
22624 </p>
22625 !! end
22626
22627 !! test
22628 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
22629 !! html/parsoid
22630 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
22631 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
22632 !! wikitext
22633 http://example.com.,;:!?\
22634 -http://example.com:
22635 !! html/php
22636 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
22637 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
22638 </p>
22639 !! end
22640
22641 !! test
22642 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
22643 !! html/parsoid
22644 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
22645 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
22646 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
22647 !! wikitext
22648 RFC 123<nowiki/>4
22649 RFC 123<nowiki/>y
22650 X<nowiki/>RFC 123<nowiki/>y
22651 !! end
22652
22653 !! test
22654 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
22655 !! html/parsoid
22656 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
22657 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
22658 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
22659 </p>
22660 !! wikitext
22661 RFC 123?foo
22662 RFC 123&foo
22663 -RFC 123-
22664 !! html/php
22665 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
22666 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
22667 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
22668 </p>
22669 !! end
22670
22671 !! test
22672 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
22673 !! html/parsoid
22674 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
22675 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
22676 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
22677 !! wikitext
22678 PMID 123<nowiki/>4
22679 PMID 123<nowiki/>y
22680 X<nowiki/>PMID 123<nowiki/>y
22681 !! end
22682
22683 !! test
22684 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
22685 !! html/parsoid
22686 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
22687 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
22688 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
22689 </p>
22690 !! wikitext
22691 PMID 123?foo
22692 PMID 123&foo
22693 -PMID 123-
22694 !! html/php
22695 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
22696 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
22697 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
22698 </p>
22699 !! end
22700
22701 !! test
22702 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
22703 !! html/parsoid
22704 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
22705 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
22706 a<a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
22707 </p>
22708 !! wikitext
22709 ISBN 1234567890<nowiki/>1
22710 ISBN 1234567890<nowiki/>x
22711 a<nowiki/>ISBN 1234567890<nowiki/>b
22712 !! end
22713
22714 !! test
22715 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
22716 !! html/parsoid
22717 <p>-<a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
22718 !! wikitext
22719 -ISBN 1234567890's
22720 !! html/php
22721 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
22722 </p>
22723 !! end
22724
22725 !! test
22726 Links 14. Protect link-like plain text. (Parsoid bug T78425)
22727 !! options
22728 parsoid=html2wt
22729 !! html/*
22730 <p>this is not a link: http://example.com
22731 </p>
22732 !! wikitext
22733 this is not a link: <nowiki>http://example.com</nowiki>
22734 !! end
22735
22736 !! test
22737 Links 15. Link trails can't become link prefixes.
22738 !! options
22739 language=is
22740 !! wikitext
22741 [[Söfnuður]]-[[00]]
22742 !! html/php
22743 <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>
22744 </p>
22745 !! html/parsoid
22746 <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>
22747 !! end
22748
22749 #### --------------- Quotes ---------------
22750 #### 1. Quotes inside <b> and <i>
22751 #### 2. Link fragments separated by <i> and <b> tags
22752 #### 3. Link fragments inside <i> and <b>
22753 #### 4. No escaping needed
22754 #### --------------------------------------
22755 !! test
22756 1a. Quotes inside <b> and <i>
22757 !! options
22758 parsoid=html2wt,wt2wt
22759 !! wikitext
22760 ''<nowiki/>'foo'''
22761 ''<nowiki>''foo''</nowiki>''
22762 ''<nowiki>'''foo'''</nowiki>''
22763 ''foo''<nowiki/>'s
22764 '''<nowiki/>'foo''''
22765 '''<nowiki>''foo''</nowiki>'''
22766 '''<nowiki>'''foo'''</nowiki>'''
22767 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
22768 '''foo'''<nowiki/>'s
22769 '''foo''
22770 ''foo''<nowiki/>'
22771 ''foo'''<nowiki/>'
22772 '''foo''<nowiki/>'
22773 ''''foo'''
22774 '''foo'''<nowiki/>'
22775 ''''foo'''<nowiki/>'
22776 ''fools'<span> errand</span>''
22777 ''<span>fool</span>'s errand''
22778 '<nowiki/>''foo'' bar '''baz''
22779 a|!*#-:;+-~[]{}b'''x''
22780 !! html/*
22781 <p><i>'foo'</i>
22782 <i>''foo''</i>
22783 <i>'''foo'''</i>
22784 <i>foo</i>'s
22785 <b>'foo'</b>
22786 <b>''foo''</b>
22787 <b>'''foo'''</b>
22788 <b>foo'<i>bar'</i>baz</b>
22789 <b>foo</b>'s
22790 '<i>foo</i>
22791 <i>foo</i>'
22792 <i>foo'</i>'
22793 '<i>foo</i>'
22794 '<b>foo</b>
22795 <b>foo</b>'
22796 '<b>foo</b>'
22797 <i>fools'<span> errand</span></i>
22798 <i><span>fool</span>'s errand</i>
22799 '<i>foo</i> bar '<i>baz</i>
22800 a|!*#-:;+-~[]{}b'<i>x</i>
22801 </p>
22802 !! end
22803
22804 !! test
22805 1b. Quotes inside <b> and <i> with other tags on same line
22806 !! options
22807 parsoid=html2wt,wt2wt
22808 !! wikitext
22809 '''a'' foo ''[[bar]]''
22810 ''a''' foo ''[[bar]]''
22811 ''a''' foo '''{{echo|[[bar]]}}'''
22812 [[foo]] x'''[[bar]]''
22813 '''foo'' <ref>test</ref>
22814 '''foo'' <div title="name">test</div>
22815 '''foo'' and <br> bar
22816 <references />
22817 !! html
22818 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
22819 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
22820 <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>
22821 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
22822 '<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>
22823 '<i>foo</i> <div title="name">test</div>
22824 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
22825 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
22826 <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>
22827 </ol>
22828 !! end
22829
22830 !! test
22831 2. Link fragments separated by <i> and <b> tags
22832 !! wikitext
22833 [[''foo''<nowiki>hello]]</nowiki>
22834
22835 [['''foo'''<nowiki>hello]]</nowiki>
22836 !! html
22837 <p>[[<i>foo</i>hello]]
22838 </p><p>[[<b>foo</b>hello]]
22839 </p>
22840 !! end
22841
22842 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
22843 # this is one of the shortcomings of this format
22844 !! test
22845 3. Link fragments inside <i> and <b>
22846 !! wikitext
22847 ''[[foo''<nowiki>]]</nowiki>
22848
22849 '''[[foo'''<nowiki>]]</nowiki>
22850 !! html
22851 <p><i>[[foo</i>]]
22852 </p><p><b>[[foo</b>]]
22853 </p>
22854 !! end
22855
22856 !! test
22857 4. No escaping needed
22858 !! wikitext
22859 '<span>''bar''</span>'
22860 '<span>'''bar'''</span>'
22861 'a:b'foo
22862 !! html
22863 <p>'<span><i>bar</i></span>'
22864 '<span><b>bar</b></span>'
22865 'a:b'foo
22866 </p>
22867 !! end
22868
22869 #### ----------- Paragraphs ---------------
22870 #### 1. No unnecessary escapes
22871 #### --------------------------------------
22872
22873 !! test
22874 1. No unnecessary escapes
22875 !! wikitext
22876 bar <span><nowiki>[[foo]]</nowiki></span>
22877
22878 =bar <span><nowiki>[[foo]]</nowiki></span>
22879
22880 [[bar <span><nowiki>[[foo]]</nowiki></span>
22881
22882 ]]bar <span><nowiki>[[foo]]</nowiki></span>
22883
22884 =bar <span>foo]]</span><nowiki>=</nowiki>
22885 !! html
22886 <p>bar <span>[[foo]]</span>
22887 </p><p>=bar <span>[[foo]]</span>
22888 </p><p>[[bar <span>[[foo]]</span>
22889 </p><p>]]bar <span>[[foo]]</span>
22890 </p><p>=bar <span>foo]]</span>=
22891 </p>
22892 !!end
22893
22894 #### ----------------------- PRE --------------------------
22895 #### 1. Leading whitespace in SOL context should be escaped
22896 #### ------------------------------------------------------
22897 !! test
22898 1. Leading whitespace in SOL context should be escaped
22899 !! options
22900 parsoid
22901 !! wikitext
22902 <nowiki> </nowiki>a
22903
22904 <nowiki> </nowiki> a
22905
22906 <nowiki> </nowiki>a(tab)
22907
22908 <nowiki> </nowiki> a
22909 <!--cmt-->
22910 <nowiki> </nowiki> a
22911
22912 a
22913 <nowiki> </nowiki>b
22914
22915 a
22916 <nowiki> </nowiki>b
22917
22918 a
22919 <nowiki> </nowiki> b
22920 !! html
22921 <p> a</p>
22922 <p> a</p>
22923 <p> a(tab)</p>
22924 <p> a</p>
22925 <p><!--cmt--> a</p>
22926 <p>a
22927 b</p>
22928 <p>a
22929 b</p>
22930 <p>a
22931 b</p>
22932 !! end
22933
22934 !! test
22935 2. Leading whitespace in non-indent-pre contexts should not be escaped
22936 !! options
22937 parsoid
22938 !! wikitext
22939 foo <ref>''a''
22940 b</ref>
22941 <references />
22942 !! html
22943 <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>
22944 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22945 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text"><i data-parsoid='{"dsr":[9,14,2,2]}'>a</i>
22946 b</span></li>
22947 </ol>
22948 !! end
22949
22950 !! test
22951 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
22952 !! options
22953 parsoid
22954 !! wikitext
22955 <blockquote>
22956 a
22957 <span>b</span>
22958 c
22959 </blockquote>
22960 !! html
22961 <blockquote>
22962 <p>
22963 a
22964 <span>b</span>
22965 c</p>
22966 </blockquote>
22967 !! end
22968
22969 !! test
22970 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
22971 !! options
22972 parsoid
22973 !! wikitext
22974 [[File:Foobar.jpg|thumb|caption]]
22975 !! html/parsoid
22976 <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>
22977 !! end
22978
22979 !! test
22980 5. Nowiki escaping should account for indent-pres
22981 !! options
22982 parsoid=html2wt
22983 !! html
22984 <pre>==foo==</pre>
22985 !! wikitext
22986 ==foo==
22987 !! end
22988
22989 !!test
22990 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
22991 !! options
22992 parsoid
22993 !! wikitext
22994 * foo
22995 * bar
22996 !! html
22997 <pre>
22998 * foo
22999 * bar
23000 </pre>
23001 !! end
23002
23003 #### --------------- Behavior Switches --------------------
23004
23005 !! test
23006 1. Valid behavior switches should be escaped
23007 !! options
23008 parsoid=html2wt
23009 !! html
23010 __TOC__
23011 <i>__TOC__</i>
23012 !! wikitext
23013 <nowiki>__TOC__</nowiki>
23014 ''<nowiki>__TOC__</nowiki>''
23015 !! end
23016
23017 !! test
23018 2. Invalid behavior switches should not be escaped
23019 !! options
23020 parsoid=html2wt
23021 !! html
23022 __TOO__
23023 __|__
23024 !! wikitext
23025 __TOO__
23026 __|__
23027 !! end
23028
23029 # We use indent-pre as an indirect way to test for sol-transparent behavior.
23030 !! test
23031 Behavior switches should be SOL-transparent
23032 !! wikitext
23033 __TOC__
23034
23035 <!-- this one's bogus -->
23036 __TOO__
23037
23038 __TOC__ foo
23039
23040 __TOC__ bar
23041 !! html/parsoid
23042 <meta property="mw:PageProp/toc" />
23043
23044 <!-- this one's bogus -->
23045 <pre>__TOO__</pre>
23046
23047 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
23048
23049 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
23050 !! end
23051
23052 #### --------------- HTML tags ---------------
23053 #### 1. a tags
23054 #### 2. other tags
23055 #### 3. multi-line html tag
23056 #### 4. extension tags
23057 #### -----------------------------------------
23058 !! test
23059 1. a tags
23060 !! options
23061 parsoid
23062 !! wikitext
23063 <a href="http://google.com">google</a>
23064 !! html
23065 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
23066 !! end
23067
23068 !! test
23069 2. other tags
23070 !! wikitext
23071 * <nowiki><div>foo</div></nowiki>
23072 * <nowiki><div style="color:red">foo</div></nowiki>
23073 * <nowiki><td></nowiki>
23074 !! html
23075 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
23076 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
23077 <li> &lt;td&gt;</li></ul>
23078
23079 !! end
23080
23081 !! test
23082 3. multi-line html tag
23083 !! wikitext
23084 <nowiki><div
23085 >foo</div
23086 ></nowiki>
23087 !! html
23088 <p>&lt;div
23089 &gt;foo&lt;/div
23090 &gt;
23091 </p>
23092 !! end
23093
23094 !! test
23095 4. extension tags
23096 !! wikitext
23097 <nowiki><ref>foo</ref></nowiki>
23098
23099 <nowiki><ref>bar</nowiki>
23100
23101 baz<nowiki></ref></nowiki>
23102 !! html
23103 <p>&lt;ref&gt;foo&lt;/ref&gt;
23104 </p><p>&lt;ref&gt;bar
23105 </p><p>baz&lt;/ref&gt;
23106 </p>
23107 !! end
23108
23109 #### --------------- Others ---------------
23110 !! test
23111 Escaping nowikis
23112 !! wikitext
23113 &lt;nowiki&gt;foo&lt;/nowiki&gt;
23114 !! html
23115 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
23116 </p>
23117 !! end
23118
23119 ## The quote-char in the input is necessary for triggering the bug
23120 !! test
23121 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
23122 !! options
23123 parsoid=wt2wt,html2wt
23124 !! wikitext
23125 foo's bar :
23126 !! html
23127 <p>foo's bar :</p>
23128 !! end
23129
23130 !! test
23131
23132 Tag-like HTML structures are passed through as text
23133 !! wikitext
23134 <x y>
23135
23136 <x.y>
23137
23138 <x-y>
23139
23140 1>2
23141
23142 x<y
23143
23144 a>b
23145
23146 1<d e>f
23147 !! html
23148 <p>&lt;x y&gt;
23149 </p><p>&lt;x.y&gt;
23150 </p><p>&lt;x-y&gt;
23151 </p><p>1&gt;2
23152 </p><p>x&lt;y
23153 </p><p>a&gt;b
23154 </p><p>1&lt;d e&gt;f
23155 </p>
23156 !! end
23157
23158 !! test
23159 HTML tag with necessary entities in attributes
23160 !! wikitext
23161 <span title="&amp;amp;">foo</span>
23162 !! html
23163 <p><span title="&amp;amp;">foo</span>
23164 </p>
23165 !! end
23166
23167 !! test
23168 HTML tag with 'unnecessary' entity encoding in attributes
23169 !! wikitext
23170 <span title="&amp;">foo</span>
23171 !! html
23172 <p><span title="&amp;">foo</span>
23173 </p>
23174 !! end
23175
23176 !! test
23177 HTML tag with broken attribute value quoting
23178 !! wikitext
23179 <span title="Hello world>Foo</span>
23180 !! html/php
23181 <p><span>Foo</span>
23182 </p>
23183 !! html/parsoid
23184 <p><span title="Hello world">Foo</span>
23185 </p>
23186 !! end
23187
23188 !! test
23189 Parsoid-only: HTML tag with broken attribute value quoting
23190 !! options
23191 parsoid
23192 !! wikitext
23193 <span title="Hello world>Foo</span>
23194 !! html
23195 <p><span title="Hello world">Foo</span>
23196 </p>
23197 !! end
23198
23199 !! test
23200 Table with broken attribute value quoting
23201 !! wikitext
23202 {|
23203 | title="Hello world|Foo
23204 |}
23205 !! html/php
23206 <table>
23207 <tr>
23208 <td>Foo
23209 </td></tr></table>
23210
23211 !! html/parsoid
23212 <table>
23213 <tr>
23214 <td title="Hello world">Foo
23215 </td></tr></table>
23216
23217 !! end
23218
23219 !! test
23220 Table with broken attribute value quoting on consecutive lines
23221 !! wikitext
23222 {|
23223 | title="Hello world|Foo
23224 | style="color:red|Bar
23225 |}
23226 !! html/php
23227 <table>
23228 <tr>
23229 <td>Foo
23230 </td>
23231 <td>Bar
23232 </td></tr></table>
23233
23234 !! html/parsoid
23235 <table><tbody>
23236 <tr>
23237 <td title="Hello world">Foo
23238 </td><td style="color: red">Bar
23239 </td></tr></tbody></table>
23240
23241 !! end
23242
23243 !! test
23244 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
23245 !! options
23246 parsoid
23247 !! wikitext
23248 {{}}
23249 !! html
23250 {{}}
23251 !! end
23252
23253 !! test
23254 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
23255 !! options
23256 parsoid
23257 !! wikitext
23258 }}{{
23259 !! html
23260 }}{{
23261 !! end
23262
23263 !!test
23264 Accept empty td cell attribute
23265 !! wikitext
23266 {|
23267 | align="center" | foo || |
23268 |}
23269 !! html
23270 <table>
23271 <tr>
23272 <td align="center"> foo </td>
23273 <td>
23274 </td></tr></table>
23275
23276 !!end
23277
23278 !!test
23279 Non-empty attributes in th-cells
23280 !! wikitext
23281 {|
23282 ! Foo !! style="color: red" | Bar
23283 |}
23284 !! html
23285 <table>
23286 <tr>
23287 <th> Foo </th>
23288 <th style="color: red"> Bar
23289 </th></tr></table>
23290
23291 !!end
23292
23293 !!test
23294 Accept empty attributes in th-cells
23295 !! wikitext
23296 {|
23297 !| foo !!| bar
23298 |}
23299 !! html
23300 <table>
23301 <tr>
23302 <th> foo </th>
23303 <th> bar
23304 </th></tr></table>
23305
23306 !!end
23307
23308 !!test
23309 Empty table rows go away
23310 !! wikitext
23311 {|
23312 | Hello
23313 | there
23314 |- class="foo"
23315 |-
23316 |}
23317 !! html
23318 <table>
23319 <tr>
23320 <td> Hello
23321 </td>
23322 <td> there
23323 </td></tr>
23324
23325 </table>
23326
23327 !! end
23328
23329 ###
23330 ### Parsoid-centric tests for testing RTing of inter-element separators
23331 ### Edge cases not tested by existing parser tests and specific to
23332 ### Parsoid-specific serialization strategies.
23333 ###
23334
23335 !!test
23336 RT-ed inter-element separators should be valid separators
23337 !! wikitext
23338 {|
23339 |- [[foo]]
23340 |}
23341 !! html
23342 <table>
23343
23344 </table>
23345
23346 !!end
23347
23348 # Parsoid-only since PHP parser relies on Tidy for correct output
23349 !!test
23350 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
23351 !!options
23352 parsoid
23353 !! wikitext
23354 {|
23355 |<small>foo
23356 bar
23357 |}
23358
23359 {|
23360 |<small>foo<small>
23361 |}
23362 !! html
23363 <table>
23364 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
23365 <p>bar</p></small></td></tr>
23366 </tbody></table>
23367
23368 <table>
23369 <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>
23370 </tbody></table>
23371 !!end
23372
23373 # Note that the "style" attribute is really a template parameter here.
23374 # The = would have to be {{=}} if you wanted the literal.
23375 !!test
23376 Empty TD followed by TD with tpl-generated attribute
23377 !! wikitext
23378 {|
23379 |-
23380 |
23381 |{{echo|style='color:red'}}|foo
23382 |}
23383 !! html
23384 <table>
23385
23386 <tr>
23387 <td>
23388 </td>
23389 <td>foo
23390 </td></tr></table>
23391
23392 !!end
23393
23394 !!test
23395 Indented table with an empty td
23396 !! wikitext
23397 {|
23398 |-
23399 |
23400 |foo
23401 |}
23402 !! html
23403 <table>
23404
23405 <tr>
23406 <td>
23407 </td>
23408 <td>foo
23409 </td></tr></table>
23410
23411 !!end
23412
23413 ## We have some newline diffs RT-ing this edge case
23414 ## and it is not important enough -- we seem to be emitting
23415 ## at most 2 newlines after a </tr> and this is unrelated to
23416 ## the issue from T85627 that this is testing.
23417 !!test
23418 Indented table with blank lines in between (T85627)
23419 !! options
23420 parsoid=wt2html
23421 !! wikitext
23422 {|
23423 |foo
23424
23425
23426 |}
23427 !! html
23428 <table>
23429
23430 <tr>
23431 <td>foo
23432 </td></tr></table>
23433
23434 !!end
23435
23436 !!test
23437 Indented block & table
23438 !! wikitext
23439 <div>foo</div>
23440 {|
23441 |foo
23442 |}
23443 !! html/php
23444 <div>foo</div>
23445 <table>
23446 <tr>
23447 <td>foo
23448 </td></tr></table>
23449
23450 !! html/parsoid
23451 <div data-parsoid='{"stx":"html"}'>foo</div>
23452 <table><tbody>
23453 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
23454 </tbody></table>
23455 !!end
23456
23457 !! test
23458 Indent and comment before table row
23459 !! wikitext
23460 {|
23461 <!--hi-->|-
23462 | there
23463 |}
23464 !! html/php
23465 <table>
23466
23467 <tr>
23468 <td> there
23469 </td></tr></table>
23470
23471 !! html/parsoid
23472 <table>
23473 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
23474 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
23475 </tbody></table>
23476 !! end
23477
23478 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
23479 !!test
23480 Empty TR followed by a template-generated TR
23481 !!options
23482 parsoid
23483 !! wikitext
23484 {|
23485 |-
23486 {{echo|<tr><td>foo</td></tr>}}
23487 |}
23488 !! html
23489 <table>
23490 <tbody>
23491 <tr></tr>
23492 <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}}]}'>
23493 <td>foo</td></tr>
23494 </tbody></table>
23495 !!end
23496
23497 ## PHP and parsoid output differ for this, and since this is primarily
23498 ## for testing Parsoid's serializer, marking this Parsoid only
23499 !!test
23500 Empty TR followed by mixed-ws-comment line should RT correctly
23501 !!options
23502 parsoid
23503 !! wikitext
23504 {|
23505 |-
23506 <!--c-->
23507 |-
23508 <!--c--> <!--d-->
23509 |}
23510 !! html
23511 <table>
23512 <tbody>
23513 <tr></tr>
23514 <!--c-->
23515 <tr>
23516 <!--c--> </tr><!--d-->
23517 </tbody></table>
23518
23519 !!end
23520
23521 !!test
23522 Multi-line image caption generated by templates with/without trailing newlines
23523 !! wikitext
23524 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
23525 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
23526 !! html/parsoid
23527 <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>
23528 <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>
23529 !!end
23530
23531 !! test
23532 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
23533 !! options
23534 parsoid=html2wt
23535 !! html/parsoid
23536 <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>
23537
23538 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
23539 !! wikitext
23540 <includeonly>foo</includeonly>
23541 new para
23542
23543 [[Category:Foo]]
23544
23545 = new heading =
23546 !! end
23547
23548 ## PHP emits broken html for this, and since this is primarily
23549 ## a Parsoid serializer test, marking this Parsoid only
23550 !!test
23551 Improperly nested inline or quotes tags with whitespace in between
23552 !! wikitext
23553 <span> <s>x</span> </s>
23554 ''' ''x''' ''
23555 !! html/parsoid
23556 <p><span> <s>x</s></span><s> </s>
23557 <b> <i>x</i></b><i> </i>
23558 </p>
23559 !!end
23560
23561 !!test
23562 Encapsulate protected attributes from wt
23563 !! wikitext
23564 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
23565 !! html/parsoid
23566 <body><div data-x-typeof="mw:placeholder stuff" data-x-data-mw="whoo" data-x-data-parsoid="weird" data-x-data-parsoid-other="no" data-x-about="time" data-x-rel="mw:true">foo</div>
23567 </body>
23568 !!end
23569
23570 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
23571 ## Having nested or stray pre tags results in the attempt to add duplicates,
23572 ## causing an assertion fail. This test tries to prevent that situation.
23573 !!test
23574 Ensure ParagraphWrapper can deal with stray closing pre tags
23575 !!options
23576 parsoid=wt2html
23577 !! wikitext
23578 plain text</pre>
23579 !! html/parsoid
23580 plain text
23581 !!end
23582
23583 !!test
23584 1. Ensure fostered text content is wrapped in element nodes
23585 !!options
23586 parsoid=wt2html
23587 !! wikitext
23588 <table>hi</table><table>ho</table>
23589 !! html/parsoid
23590 <p>hi</p>
23591 <table></table>
23592 <p>ho</p>
23593 <table></table>
23594 !!end
23595
23596 !!test
23597 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
23598 !!options
23599 parsoid=wt2html,wt2wt
23600 !! wikitext
23601 <table>
23602 <tr> || ||
23603 <td> a
23604 </table>
23605 !! html/parsoid
23606 <p> || ||
23607 </p><table>
23608 <tbody><tr><td> a</td></tr>
23609 </tbody></table>
23610 !!end
23611
23612 !!test
23613 Encapsulation properly handles null DSR information from foster box
23614 !!options
23615 parsoid=wt2html,wt2wt
23616 !! wikitext
23617 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
23618 !! html/parsoid
23619 <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>
23620 !!end
23621
23622 !!test
23623 1. Encapsulate foster-parented transclusion content
23624 !!options
23625 parsoid=wt2wt,wt2html
23626 !! wikitext
23627 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
23628 !! html/parsoid
23629 <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>
23630 <tbody>
23631 <tr>
23632 <td>bar</td>
23633 </tr>
23634 </tbody>
23635 </table>
23636 !!end
23637
23638 !!test
23639 2. Encapsulate foster-parented transclusion content
23640 !!options
23641 parsoid=wt2wt,wt2html
23642 !! wikitext
23643 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
23644 !! html/parsoid
23645 <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>
23646 <table>
23647 <tbody>
23648 <tr>
23649 <td>bar</td>
23650 </tr>
23651 </tbody>
23652 </table>
23653 !!end
23654
23655 !!test
23656 3. Encapsulate foster-parented transclusion content
23657 !!options
23658 parsoid=wt2wt,wt2html
23659 !! wikitext
23660 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
23661 !! html/parsoid
23662 <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;]}">
23663 <p>foo</p>
23664 </div>
23665 <table>
23666 <tbody>
23667 <tr>
23668 <td>bar</td>
23669 </tr>
23670 </tbody>
23671 </table>
23672 !!end
23673
23674 !!test
23675 4. Encapsulate foster-parented transclusion content
23676 !!options
23677 parsoid=wt2wt,wt2html
23678 !! wikitext
23679 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
23680 !! html/parsoid
23681 <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;]}">
23682 <p>foo</p>
23683 </div>
23684 <table>
23685 <tbody>
23686 <tr>
23687 <td>bar</td>
23688 </tr>
23689 </tbody>
23690 </table>
23691 !!end
23692
23693 !!test
23694 5. Encapsulate foster-parented transclusion content
23695 !!options
23696 parsoid=wt2wt,wt2html
23697 !! wikitext
23698 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
23699 !! html/parsoid
23700 <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>
23701 <table>
23702 <tbody>
23703 <tr>
23704 <td>
23705 <div>
23706 <p>foo</p>
23707 </div>
23708 </td>
23709 </tr>
23710 </tbody>
23711 </table>
23712 !!end
23713
23714 !!test
23715 6. Encapsulate foster-parented transclusion content
23716 !!options
23717 parsoid=wt2wt,wt2html
23718 !! wikitext
23719 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
23720 !! html/parsoid
23721 <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>
23722 <table>
23723 <tbody>
23724 <tr>
23725 <td>
23726 <div>
23727 <p>foo</p>
23728 </div>
23729 </td>
23730 </tr>
23731 </tbody>
23732 </table>
23733 <p>ok</p>
23734 !!end
23735
23736 !!test
23737 7. Encapsulate foster-parented transclusion content
23738 !!options
23739 parsoid=wt2wt,wt2html
23740 !! wikitext
23741 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
23742 !! html/parsoid
23743 <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>
23744 <table>
23745 <tbody>
23746 <tr>
23747 <td>bar</td>
23748 </tr>
23749 </tbody>
23750 </table>
23751 !!end
23752
23753 # Note that the wt is broken on purpose: the = should be {{=}} if you
23754 # don't want it to be a template parameter key.
23755 !!test
23756 8. Encapsulate foster-parented transclusion content
23757 !!options
23758 parsoid=wt2wt,wt2html
23759 !! wikitext
23760 {{echo|a
23761 }}{|{{echo|style='color:red'}}
23762 |-
23763 |b
23764 |}
23765 !! html/parsoid
23766 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
23767 <span> </span>
23768 <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>
23769 <table>
23770 <tbody>
23771 <tr>
23772 <td>b</td>
23773 </tr>
23774 </tbody>
23775 </table>
23776 !!end
23777
23778 !!test
23779 9. Encapsulate foster-parented transclusion content
23780 !!options
23781 parsoid=wt2wt,wt2html
23782 !! wikitext
23783 <table>{{echo|hi</table>hello}}
23784 !! html/parsoid
23785 <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","spc":["","","",""]}]]}'>hi</p><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><p about="#mwt2">hello</p>
23786 !!end
23787
23788 !!test
23789 Table in fosterable position
23790 !!options
23791 parsoid=wt2html,wt2wt
23792 !! wikitext
23793 {{OpenTable}}
23794 <div>
23795 {|
23796 |}
23797 </div>
23798 |}
23799 !! html/parsoid
23800 <div about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"OpenTable","href":"./Template:OpenTable"},"params":{},"i":0}},"\n&lt;div>"]}' data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[]]}'></div><span about="#mwt1">
23801 </span>
23802 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
23803
23804 <table>
23805 </table>
23806 !!end
23807
23808 # Parsoid only for bug 64747
23809 !! test
23810 Properly encapsulate empty-content transclusions in fosterable positions
23811 !! wikitext
23812 <table>
23813 {{#if:|
23814 <td>foo</td>
23815 }}
23816 </table>
23817 !! html/parsoid
23818 <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","spc":["","","",""]}]]}'>
23819
23820 </table>
23821 !! end
23822
23823 !!test
23824 Support <object> element with .data attribute
23825 !!options
23826 parsoid=html2wt
23827 !! html/parsoid
23828 <object data="test.swf"></object>
23829 !! wikitext
23830 <object data="test.swf"></object>
23831 !!end
23832
23833 !! test
23834 Don't block XML namespace declaration
23835 !! wikitext
23836 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
23837 !! html/php
23838 <p><span>MediaWiki</span>
23839 </p>
23840 !! html/parsoid
23841 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
23842 !! end
23843
23844 # -----------------------------------------------------------------
23845 # The following section of tests are primarily to spec requirements
23846 # around serialization of new/edited content.
23847 #
23848 # All these tests are marked Parsoid html2wt and html2html only
23849 # ----------------------------------------------------------------
23850
23851 # 'mi' is a localinterwiki prefix as well as a language
23852 !! test
23853 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
23854 !! options
23855 parsoid=html2wt
23856 !! html
23857 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
23858 !! wikitext
23859 [[Foo]]
23860 !! end
23861
23862 # See T93839
23863 !! test
23864 New wikilinks should be serialized properly
23865 !! options
23866 parsoid=html2wt
23867 !! html
23868 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
23869 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
23870 !! wikitext
23871 [[Foo]]
23872 [[Foo]]
23873 !! end
23874
23875 !! test
23876 New wiki links (href variations)
23877 !! options
23878 parsoid=html2wt
23879 !! html
23880 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
23881 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
23882 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
23883 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
23884 !! wikitext
23885 [[Foo_bar]]
23886 [[Foo_bar]]
23887 [[Foo_bar]]
23888 [[Toxine bactérienne]]
23889 !! end
23890
23891 !! test
23892 New wiki links (content string variations)
23893 !! options
23894 parsoid=html2wt
23895 !! html
23896 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
23897 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
23898 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
23899 !! wikitext
23900 [[Foo_bar]]
23901 [[Foo bar]]
23902 [[Foo_bar|./Foo_bar]]
23903 !! end
23904
23905 !! test
23906 New category links (href variations)
23907 !! options
23908 parsoid=html2wt
23909 !! html
23910 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
23911 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
23912 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
23913 !! wikitext
23914 [[Category:Toxine bactérienne]]
23915 [[Category:Toxine bactérienne]]
23916 [[Category:Toxine bactérienne]]
23917 !! end
23918
23919 !! test
23920 New sol transparent links don't need indent-pre nowiki protection
23921 !! options
23922 parsoid=html2wt
23923 language=de
23924 !! html
23925 <link rel="mw:PageProp/redirect" href="./Main_Page">
23926 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
23927 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
23928 !! wikitext
23929 #WEITERLEITUNG [[Main Page]]
23930 <!-- this is good --> [[Category:Good]]
23931 <!-- this is great --> [[Kategorie:Great]]
23932 !! end
23933
23934 !! test
23935 New interlanguage links (href variations)
23936 !! options
23937 parsoid=html2wt
23938 !! html
23939 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
23940 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
23941 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
23942 !! wikitext
23943 [[es:Toxine bactérienne]]
23944 [[es:Toxine_bactérienne]]
23945 [[es:Toxine_bactérienne]]
23946 !! end
23947
23948 !! test
23949 Image: Modifying size of an image (1)
23950 !! options
23951 parsoid={
23952 "modes": ["wt2wt"],
23953 "changes": [
23954 ["img[height]", "attr", "height", "22"],
23955 ["img[width]", "attr", "width", "200"]
23956 ]
23957 }
23958 !! wikitext
23959 [[Image:Foobar.jpg|230x230px]]
23960 !! wikitext/edited
23961 [[Image:Foobar.jpg|200x200px]]
23962 !!end
23963
23964 !! test
23965 Image: Modifying size of an image (2)
23966 !! options
23967 parsoid={
23968 "modes": ["wt2wt"],
23969 "changes": [
23970 ["img[height]", "attr", "height", "100"],
23971 ["img[width]", "attr", "width", "500"]
23972 ]
23973 }
23974 !! wikitext
23975 [[Image:Foobar.jpg|230x230px]]
23976 !! wikitext/edited
23977 [[Image:Foobar.jpg|500x500px]]
23978 !!end
23979
23980 # Change in size is ignored so long as class='mw-default-size'
23981 !! test
23982 Image: Modifying size of an image (3)
23983 !! options
23984 parsoid={
23985 "modes": ["wt2wt"],
23986 "changes": [
23987 ["figure[class]", "removeClass", "mw-default-size"],
23988 ["figure img", "attr", "height", "19"],
23989 ["figure img", "attr", "width", "170"]
23990 ]
23991 }
23992 !! wikitext
23993 [[Image:Foobar.jpg|thumb]]
23994 !! wikitext/edited
23995 [[Image:Foobar.jpg|thumb|170x170px]]
23996 !!end
23997
23998 !! test
23999 Image: Modifying alignment of an image (bug 48665)
24000 !! options
24001 parsoid={
24002 "modes": ["wt2wt"],
24003 "changes": [
24004 ["figure[class]", "removeClass", "mw-halign-right"],
24005 ["figure[class]", "addClass", "mw-halign-left"]
24006 ]
24007 }
24008 !! wikitext
24009 [[Image:Foobar.jpg|thumb|caption|right]]
24010 !! wikitext/edited
24011 [[Image:Foobar.jpg|thumb|caption|left]]
24012 !! end
24013
24014 !! test
24015 Image: Modifying mw-default-size of an frameless image (bug 62805)
24016 !! options
24017 parsoid={
24018 "modes": ["wt2wt"],
24019 "changes": [
24020 ["figure.mw-default-size", "removeClass", "mw-default-size"]
24021 ]
24022 }
24023 !! wikitext
24024 [[Image:Foobar.jpg|frameless|right]]
24025 !! wikitext/edited
24026 [[Image:Foobar.jpg|frameless|right|220x220px]]
24027 !! end
24028
24029 !! test
24030 Image: Modifying valign of an image (bug 49221)
24031 !! options
24032 parsoid={
24033 "modes": ["wt2wt"],
24034 "changes": [
24035 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
24036 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
24037 ]
24038 }
24039 !! wikitext
24040 [[File:Foobar.jpg|20px|middle]]
24041 !! wikitext/edited
24042 [[File:Foobar.jpg|20px|text-top]]
24043 !! end
24044
24045 !! test
24046 Image: Modifying alt attribute of an image (bug 56400)
24047 !! options
24048 parsoid={
24049 "modes": ["wt2wt"],
24050 "changes": [
24051 ["img[alt]", "attr", "alt", "some alternate edited text"]
24052 ]
24053 }
24054 !! wikitext
24055 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
24056 !! wikitext/edited
24057 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
24058 !!end
24059
24060 !! test
24061 Image: Modifying caption of an image
24062 !! options
24063 parsoid={
24064 "modes": ["wt2wt"],
24065 "changes": [
24066 ["figcaption", "text", "new caption"]
24067 ]
24068 }
24069 !! wikitext
24070 [[Image:Foobar.jpg|thumb|original caption]]
24071 !! wikitext/edited
24072 [[Image:Foobar.jpg|thumb|new caption]]
24073 !!end
24074
24075 !! test
24076 Image: empty alt attribute (bug 48924)
24077 !! options
24078 parsoid
24079 !! wikitext
24080 [[File:Foobar.jpg|thumb|alt=|bar]]
24081 !! html
24082 <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>
24083 !! end
24084
24085 #!! test
24086 #Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
24087 #!! options
24088 #parsoid=html2wt
24089 #language=ar
24090 #!! html
24091 #<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>
24092 #!! wikitext
24093 #[[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
24094 #!! end
24095
24096 !! test
24097 Image: Block level image should have \n before and after
24098 !! wikitext
24099 123
24100 [[File:Foobar.jpg|right|thumb|150x150px]]
24101 456
24102 !! html/parsoid
24103 <p>123</p>
24104 <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>
24105 <p>456</p>
24106 !!end
24107
24108 !! test
24109 Image: New block level image should have \n before and after (existing content)
24110 !! wikitext
24111 123
24112 [[File:Foobar.jpg|right|thumb|150x150px]]
24113 456
24114 !! html/parsoid
24115 <p>123</p>
24116 <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>
24117 <p>456</p>
24118 !!end
24119
24120 !! test
24121 Image: upright option (parsoid)
24122 !! wikitext
24123 [[File:Foobar.jpg|thumb|upright|caption]]
24124 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
24125 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
24126 !! html/parsoid
24127 <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>
24128 <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>
24129 <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>
24130 !!end
24131
24132 !! test
24133 Image: upright option is ignored on inline and frame images (parsoid)
24134 !! wikitext
24135 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
24136 !! html/parsoid
24137 <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>
24138 !!end
24139
24140 !! test
24141 Image: from basic HTML (1)
24142 !! options
24143 parsoid=html2wt
24144 !! html/parsoid
24145 <span typeof="mw:Image">
24146 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
24147 </span>
24148 !! wikitext
24149 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
24150 !! end
24151
24152 !! test
24153 Image: from basic HTML (2)
24154 !! options
24155 parsoid=html2wt
24156 !! html/parsoid
24157 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
24158 !! wikitext
24159 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
24160 !! end
24161
24162 !! test
24163 Image: from basic HTML (3)
24164 !! options
24165 parsoid=html2wt
24166 !! html/parsoid
24167 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
24168 !! wikitext
24169 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
24170 !! end
24171
24172 !! test
24173 Image: from basic HTML (4)
24174 !! options
24175 parsoid=html2wt
24176 !! html/parsoid
24177 <img src="./File:Foobar.jpg">
24178 !! wikitext
24179 [[File:Foobar.jpg|link=]]
24180 !! end
24181
24182 !! test
24183 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
24184 !! options
24185 parsoid=html2wt
24186 !! html
24187 <ul>
24188 <li><p>foo</p></li>
24189 </ul>
24190 !! wikitext
24191 * foo
24192 !! end
24193
24194 !! test
24195 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
24196 !! options
24197 parsoid=html2wt
24198 !! html
24199 <ul> <li>foo</li></ul>
24200 !! wikitext
24201 * foo
24202 !! end
24203
24204 !! test
24205 Don't strip leading whitespace when handling indent-pre suppressing tags
24206 !! options
24207 parsoid=html2wt
24208 !! html
24209 <table>
24210 <tr><td> indented row</td></tr>
24211 </table>
24212 <blockquote><p>
24213 <b>This is very bold of you!</b>
24214 </p>
24215 <table><tr><td>
24216 indented cell (no pre-wrapping!)
24217 </td></tr></table>
24218 </blockquote>
24219 <p>foo</p>
24220 <div>bar</div>
24221 !! wikitext
24222 {|
24223 | indented row
24224 |}
24225 <blockquote>
24226 '''This is very bold of you!'''
24227
24228 {|
24229 |
24230 indented cell (no pre-wrapping!)
24231 |}
24232 </blockquote>
24233 foo
24234 <div>bar</div>
24235 !! end
24236
24237 !! test
24238 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
24239 !! options
24240 parsoid=html2wt
24241 !! wikitext
24242 foo
24243 <nowiki> </nowiki><span>bar</span>
24244
24245 <span>foo2
24246 <nowiki> </nowiki></span>bar2
24247
24248 <div>foo</div>
24249 <nowiki> </nowiki><span>bar</span>
24250
24251 <div>
24252 <nowiki> </nowiki><span>foo</span>
24253 </div>
24254 !! html
24255 <p>foo</p>
24256 <span>bar</span>
24257
24258 <span>foo2
24259 </span>bar2
24260
24261 <div>foo</div>
24262 <span>bar</span>
24263
24264 <div>
24265 <span>foo</span>
24266 </div>
24267 !! end
24268
24269 !! test
24270 Lists: Dont insert newlines in a serialized list item.
24271 !! options
24272 parsoid=html2wt
24273 !! html
24274 <ul><li>a<br>b</li><li>c</li></ul>
24275 !! wikitext
24276 * a<br>b
24277 * c
24278 !! end
24279
24280 !! test
24281 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
24282 !! options
24283 parsoid={
24284 "modes": ["html2wt"],
24285 "scrubWikitext": false
24286 }
24287 !! html
24288 <h2>hello there<link href="Category:A1" rel="mw:PageProp/Category" /></h2>
24289 <h2><link href="Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
24290
24291 <h2><!--foo--> <link href="Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
24292 <h2>it goes well <link href="Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
24293
24294 <h2 data-parsoid='{}'>howdy<link href="Category:A5" rel="mw:PageProp/Category" /></h2>
24295
24296 <h2><meta property="mw:PageProp/toc" /> ok</h2>
24297 !! wikitext
24298 == hello there [[Category:A1]] ==
24299
24300 == [[Category:A2]] hi pal ==
24301
24302 == <!--foo--> [[Category:A3]] how goes it ==
24303
24304 == it goes well [[Category:A4]] <!--bar--> ==
24305
24306 ==howdy [[Category:A5]] ==
24307
24308 == __TOC__ ok ==
24309 !! end
24310
24311 !! test
24312 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
24313 !! options
24314 parsoid={
24315 "modes": ["html2wt"],
24316 "scrubWikitext": true
24317 }
24318 !! html
24319 <h2>hello there<link href="Category:A1" rel="mw:PageProp/Category" /></h2>
24320 <h2><link href="Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
24321
24322 <h2><!--foo--> <link href="Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
24323 <h2>it goes well <link href="Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
24324
24325 <h2 data-parsoid='{}'>howdy<link href="Category:A5" rel="mw:PageProp/Category" /></h2>
24326
24327 <h2><meta property="mw:PageProp/toc" /> ok</h2>
24328 !! wikitext
24329 == hello there ==
24330 [[Category:A1]]
24331 [[Category:A2]]
24332
24333 == hi pal ==
24334
24335 <!--foo--> [[Category:A3]]
24336
24337 == how goes it ==
24338
24339 == it goes well ==
24340 [[Category:A4]] <!--bar-->
24341
24342 ==howdy [[Category:A5]] ==
24343
24344 __TOC__
24345
24346 == ok ==
24347 !! end
24348
24349 !! test
24350 Headings: Don't hoist metas that come from templates
24351 !! options
24352 parsoid={
24353 "modes": ["html2wt"],
24354 "scrubWikitext": true
24355 }
24356 !! html
24357 <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>
24358 !! wikitext
24359 == {{echo|foo [[Category:Foo]]}} ==
24360 !! end
24361
24362 !! test
24363 Headings: Category in ref isn't hoisted
24364 !! options
24365 parsoid={
24366 "modes": ["html2wt"],
24367 "scrubWikitext": true
24368 }
24369 !! html
24370 <h2> foo <span about="#mwt2" class="reference" 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">[1]</a></span> </h2>
24371
24372 <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>
24373 !! wikitext
24374 == foo <ref>bar
24375 [[Category:Baz]] </ref> ==
24376
24377 <references />
24378 !! end
24379
24380 !! test
24381 Parsoid: Serialize positional parameters with = in them as named parameter
24382 !! options
24383 parsoid=html2wt
24384 !! html
24385 <p about="#mwt1" typeof="mw:Transclusion"
24386 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
24387
24388 <p about="#mwt1" typeof="mw:Transclusion"
24389 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
24390
24391 <!--Orig params with data-parsoid has heuristics for handling = chars-->
24392 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
24393 <p data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]},{"k":"2","spc":["","","",""]}]]}' 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>
24394 !! wikitext
24395 {{echo|1 = f=oo}}
24396
24397 {{echo|1 = f=oo|2 = bar}}
24398
24399 <!--Orig params with data-parsoid has heuristics for handling = chars-->
24400 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
24401 {{echo|<nowiki>f=oo</nowiki>|bar}}
24402 !! end
24403
24404 !! test
24405 Parsoid: Serialize positional parameters with = in extlink as named parameter
24406 !! options
24407 parsoid=html2wt
24408 !! html
24409 <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>
24410 !! wikitext
24411 {{echo|1 = http://stuff?is=ok}}
24412 !! end
24413
24414 !! test
24415 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
24416 !! options
24417 parsoid=html2wt
24418 !! html
24419 <div>a<p>b</p></div>
24420 <div>a
24421 <p>b</p></div>
24422 <div>
24423 a
24424 <p>b</p></div>
24425 !! wikitext
24426 <div>a
24427 b
24428 </div>
24429 <div>a
24430 b
24431 </div>
24432 <div>
24433 a
24434
24435 b
24436 </div>
24437 !! end
24438
24439 !! test
24440 Substrings resembling wikitext in hrefs should not get nowiki escapes
24441 !! options
24442 parsoid=html2wt
24443 !! html
24444 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
24445 !! wikitext
24446 [[Foo''bar''baz]]
24447 !! end
24448
24449 !! test
24450 Enforce single-line context in the serializer
24451 !! options
24452 parsoid=html2wt
24453 !! html
24454 <h2>testing
24455 123</h2>
24456
24457 <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">
24458 </span><span about="#mwt1">you</span> </h2>
24459
24460 <h2> foo <span about="#mwt2" class="reference" 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">[1]</a></span> </h2>
24461
24462 <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
24463 there</span></li></ol>
24464
24465 <ul><li>asd
24466 sdf</li></ul>
24467
24468 <ul><li>foo
24469 bar
24470 baz</li>
24471 <li>foo <b>bar</b>
24472 baz</li></ul>
24473
24474 <dl><dt>hi
24475 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
24476 ho</dd></dl>
24477
24478 <dl><dd> <table>
24479 <tbody><tr><td> ha
24480 ha
24481 ha</td></tr>
24482 </tbody></table></dd></dl>
24483 !! wikitext
24484 == testing 123 ==
24485
24486 == hi {{bogus|there
24487 you}} ==
24488
24489 == foo <ref>hello
24490 there</ref> ==
24491
24492 <references />
24493
24494 * asd sdf
24495
24496 * foo bar baz
24497 * foo '''bar''' baz
24498
24499 ; hi ho : hi ho
24500
24501 : {|
24502 | ha
24503 ha
24504 ha
24505 |}
24506 !! end
24507
24508 !! test
24509 Serialize new placeholder space without spans
24510 !! options
24511 parsoid=html2wt
24512 !! html
24513 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
24514
24515 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
24516
24517 <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>
24518 !! wikitext
24519 foo : bar
24520
24521 foo : bar
24522
24523 <ref>foo : bar</ref>ok
24524 !! end
24525
24526
24527 #-----------------------
24528 # Tag minimization tests
24529 #-----------------------
24530
24531 !! test
24532 1. I/B quote minimization: wikitext-only tags should be combined
24533 !! options
24534 parsoid=html2wt
24535 !! html
24536 <p><i>A</i><i>B</i></p>
24537 <p><b>A</b><b>B</b></p>
24538 <p><i>A</i><b><i>B</i></b></p>
24539 <p><b>A</b><i><b>B</b></i></p>
24540 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
24541 <p><i><b>A</b></i><i><b>B</b></i></p>
24542 <p><i><b>A</b></i><b><i>B</i></b></p>
24543 <p><b><i>A</i></b><i><b>B</b></i></p>
24544 !! wikitext
24545 ''AB''
24546
24547 '''AB'''
24548
24549 ''A'''B'''''
24550
24551 '''A''B'''''
24552
24553 '''A''BC''D'''
24554
24555 '''''AB'''''
24556
24557 '''''AB'''''
24558
24559 '''''AB'''''
24560 !! end
24561
24562 !! test
24563 2. I/B quote minimization: wikitext and html tags should not be combined
24564 !! options
24565 parsoid=html2wt
24566 !! html
24567 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
24568 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
24569 !! wikitext
24570 ''A''<i>B</i>
24571
24572 ''A''<nowiki/>'''<i>B</i>'''
24573 !! end
24574
24575 !! test
24576 3. I/B quote minimization: templated content stops minimization
24577 !! options
24578 parsoid=html2wt
24579 !! html
24580 <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>
24581 <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>
24582 !! wikitext
24583 ''A''{{echo|''B''}}
24584
24585 ''A''{{echo|'''''B'''''}}
24586 !! end
24587
24588 !! test
24589 4. I/B quote minimization: new content should be mimimized with adjacent old content
24590 !! options
24591 parsoid=html2wt
24592 !! html
24593 <p><i>A</i><i>B</i></p>
24594 <p><b>A</b><b>B</b></p>
24595 <p><i>A</i><b><i>B</i></b></p>
24596 !! wikitext
24597 ''AB''
24598
24599 '''AB'''
24600
24601 ''A'''B'''''
24602 !! end
24603
24604 !! test
24605 5a. Merge adjacent quote nodes if they've been edited
24606 !! options
24607 parsoid={
24608 "modes": ["wt2wt", "selser"],
24609 "changes": [
24610 ["p", "contents", "remove", ":contains('b')"]
24611 ]
24612 }
24613 !! wikitext
24614 ''a''b''c''
24615 !! wikitext/edited
24616 ''ac''
24617 !! end
24618
24619 !! test
24620 5b. Merge adjacent quote nodes if they've been edited
24621 !! options
24622 parsoid={
24623 "modes": ["wt2wt", "selser"],
24624 "changes": [
24625 ["#x", "remove"]
24626 ]
24627 }
24628 !! wikitext
24629 ''a''<span id="x">b</span>''c''
24630 !! wikitext/edited
24631 ''ac''
24632 !! end
24633
24634 !! test
24635 1. Merge adjacent link nodes as long as at least one element is new
24636 !! options
24637 parsoid={
24638 "modes": ["html2wt"],
24639 "scrubWikitext": true
24640 }
24641 !! html
24642 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
24643 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
24644 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
24645 !! wikitext
24646 [[Football]]
24647 [[Football]]
24648 [[Football|Foot]][[Football|ball]]
24649 !! end
24650
24651 !! test
24652 2. Merge adjacent link nodes and enable additional normalizations
24653 !! options
24654 parsoid={
24655 "modes": ["html2wt"],
24656 "scrubWikitext": true
24657 }
24658 !! html
24659 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
24660 !! wikitext
24661 [[Football|''Football'']]
24662 !! end
24663
24664 !! test
24665 3. Don't merge adjacent link nodes if scrubWikitext is false
24666 !! options
24667 parsoid={
24668 "modes": ["html2wt"],
24669 "scrubWikitext": false
24670 }
24671 !! html
24672 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
24673 !! wikitext
24674 [[Football|Foot]][[Football|ball]]
24675 !! end
24676
24677 #------------------------------
24678 # End of tag minimization tests
24679 #------------------------------
24680
24681 !!test
24682 Bug 54262: New entities
24683 !! options
24684 parsoid=html2wt
24685 !! wikitext
24686 &nbsp;
24687 !! html
24688 <span typeof="mw:Entity">&nbsp;</span>
24689 !! end
24690
24691 ## Note that there is no wikitext output for 'unknownproperty' ##
24692 ## Unknown magic words are silently dropped ##
24693
24694 !! test
24695 Magic words
24696 !! options
24697 parsoid=html2wt
24698 !! html/parsoid
24699 <meta property='mw:PageProp/toc' />
24700 <meta property='mw:PageProp/notoc' />
24701 <meta property='mw:PageProp/forcetoc' />
24702 <meta property='mw:PageProp/index' />
24703 <meta property='mw:PageProp/noindex' />
24704 <meta property='mw:PageProp/nogallery' />
24705 <meta property='mw:PageProp/noeditsection' />
24706 <meta property='mw:PageProp/notitleconvert' />
24707 <meta property='mw:PageProp/nocontentconvert' />
24708 <meta property='mw:PageProp/unknownproperty' />
24709 !! wikitext
24710 __TOC__
24711 __NOTOC__
24712 __FORCETOC__
24713 __INDEX__
24714 __NOINDEX__
24715 __NOGALLERY__
24716 __NOEDITSECTION__
24717 __NOTITLECONVERT__
24718 __NOCONTENTCONVERT__
24719 !! end
24720
24721 !! test
24722 Consecutive <pre>s should not get merged
24723 !! options
24724 parsoid=html2wt,html2html
24725 !! html
24726 <pre>a</pre><pre>b</pre>
24727
24728 <pre>c
24729 </pre><pre>
24730 d</pre>
24731
24732 <pre>e
24733
24734 </pre><pre>
24735
24736 f</pre>
24737 !! wikitext
24738 a
24739
24740 b
24741
24742 c
24743
24744 d
24745
24746 e
24747
24748
24749
24750 f
24751 !! end
24752
24753 !! test
24754 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
24755 !! options
24756 parsoid=html2wt
24757 !! html
24758 <a rel="mw:ExtLink" href="./Special:BookSources/1234567890">ISBN 1234567895</a>
24759 !! wikitext
24760 [[Special:BookSources/1234567890|ISBN 1234567895]]
24761 !! end
24762
24763 !! test
24764 Edited RFC links not serializable as RFC links should serialize as extlinks
24765 !! options
24766 parsoid=html2wt
24767 !! html
24768 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
24769 !! wikitext
24770 [//tools.ietf.org/html/rfc123 New RFC]
24771 !! end
24772
24773 !! test
24774 Edited PMID links not serializable as PMID links should serialize as extlinks
24775 !! options
24776 parsoid=html2wt
24777 !! html
24778 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
24779 !! wikitext
24780 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
24781 !! end
24782
24783 !! test
24784 WTS of autolinks with trailing/surrounding context
24785 !! options
24786 parsoid=html2wt
24787 !! html/parsoid
24788 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
24789 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
24790 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
24791 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
24792 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
24793 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
24794 !! wikitext
24795 http://cscott.net<nowiki/>'''foo'''
24796
24797 http://cscott.net<b>foo</b>
24798
24799 '''http://cscott.net<nowiki/>'''
24800
24801 '''http://cscott.net '''
24802
24803 '''http://cscott.net<nowiki/>x'''
24804
24805 http://cscott.net<nowiki/>x
24806 !! end
24807
24808 !! test
24809 WTS of autolinks with nowikis (round-trip)
24810 !! wikitext
24811 x<nowiki/>http://cscott.net<nowiki/>x
24812 !! html/parsoid
24813 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
24814 !! end
24815
24816 # this is the "easy" test because it leaves in place all the
24817 # data-parsoid information indicating this is an autolink
24818 !! test
24819 WTS of autolinks with escapes (editing)
24820 !! options
24821 parsoid={
24822 "modes": ["wt2wt"],
24823 "changes": [
24824 [ "meta", "remove" ]
24825 ]
24826 }
24827 !! wikitext
24828 x<nowiki/>http://cscott.net<nowiki/>x
24829 !! wikitext/edited
24830 x<nowiki/>http://cscott.net<nowiki/>x
24831 !! end
24832
24833 !! test
24834 WTS of edited autolink-like text (T103364)
24835 !! options
24836 parsoid={
24837 "modes": ["wt2wt"],
24838 "changes": [
24839 [ "span[typeof]", "removeAttr", "typeof" ]
24840 ]
24841 }
24842 !! wikitext
24843 Not a link: <nowiki>http://example.com</nowiki>.
24844 !! wikitext/edited
24845 Not a link: <span><nowiki>http://example.com</nowiki></span>.
24846 !! end
24847
24848 !! test
24849 WTS of newly-authored autolink-like text (T103364)
24850 !! options
24851 parsoid=html2wt
24852 !! html/parsoid
24853 <p>http://example.com is not a link.</p>
24854 !! wikitext
24855 <nowiki>http://example.com is not a link.</nowiki>
24856 !! end
24857
24858 !! test
24859 Edited Redirect link should emit a non-piped wikitext link
24860 !! options
24861 parsoid=html2wt
24862 !! html
24863 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
24864 !! wikitext
24865 #REDIRECT [[Bar]]
24866 !! end
24867
24868 !! test
24869 T75121: Infer extension name from typeOf if data-mw is not present
24870 !! options
24871 parsoid=html2wt
24872 !! html
24873 <div typeOf="mw:Extension/foo"></div>
24874 !! wikitext
24875 <foo />
24876 !! end
24877
24878 # Note that the <p> wrapping isn't present in PHP parser output
24879 # The important thing for this test is that P-wrapping doesn't
24880 # interfere with the <nowiki> protection for leading - in <td>
24881 # (which isn't necessary for <th>).
24882 !! test
24883 T88318: p-wrapped dash in table.
24884 !! options
24885 parsoid=html2wt,wt2wt
24886 !! html/parsoid
24887 <table><tbody>
24888 <tr><th><p>-</p></th><th><p>- </p></th></tr>
24889 <tr><td><p>-</p></td><td><p>- </p></td></tr>
24890 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
24891 </tbody></table>
24892 !! wikitext
24893 {|
24894 !-
24895 !-
24896 |-
24897 |<nowiki>-</nowiki>
24898 |<nowiki>- </nowiki>
24899 |-
24900 |<small>-</small>
24901 |<br>
24902 -
24903 |<br>
24904 -
24905 |}
24906 !! html/php+tidy
24907 <table>
24908 <tr>
24909 <th>-</th>
24910 <th>-</th>
24911 </tr>
24912 <tr>
24913 <td>-</td>
24914 <td>-</td>
24915 </tr>
24916 <tr>
24917 <td><small>-</small></td>
24918 <td><br />
24919 <p>-</p>
24920 </td>
24921 <td><br />
24922 <p>-</p>
24923 </td>
24924 </tr>
24925 </table>
24926 !! end
24927
24928 !! test
24929 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
24930 !! options
24931 parsoid=html2wt
24932 !! html
24933 <table id='mwAb'>
24934 <td id='mwAc'>foo</td>
24935 <td id='serialize-this'>bar</td>
24936 </table>
24937 !! wikitext
24938 {|
24939 |foo
24940 | id="serialize-this" |bar
24941 |}
24942 !! end
24943
24944 !! test
24945 Parsoid-like element ids should not be serialized to wikitext unless shadowed
24946 !! options
24947 parsoid=html2wt
24948 !! html
24949 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
24950 !! wikitext
24951 <div id="hello">ok</div>
24952 !! end
24953
24954 !! test
24955 WTS change modes
24956 !! options
24957 parsoid={
24958 "modes": ["wt2wt"],
24959 "changes": [
24960 [ "#xyz", "before", "<b>before</b> stuff " ],
24961 [ "#xyz", "after", " stuff <i>after</i>" ],
24962 [ "#xyz", "html", "x <b>y</b> z" ]
24963 ]
24964 }
24965 !! wikitext
24966 <span id="xyz">hello</span>
24967 !! wikitext/edited
24968 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
24969 !! end
24970
24971 !! test
24972 Never serialize a-tag as html, regardless of what data-parsoid has to say
24973 !! options
24974 parsoid=html2wt
24975 !! html
24976 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
24977 !! wikitext
24978 [[Foo]]
24979 !! end
24980
24981 ## SSS FIXME: This is broken output nevertheless.
24982 ## What might be a reasonable non-broken output for this?
24983 ## This is an edge case unlikely to be seen in production
24984 ## that I am not wasting more time on this right now.
24985 !! test
24986 Never serialize a-tag as html, no matter what attributes it has
24987 !! options
24988 parsoid=html2wt
24989 !! html
24990 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
24991 !! wikitext
24992 [http://boo.org http://boohoo.org]
24993 !! end
24994
24995 # --------------------------------------------
24996 # Tests spec'ing wikitext serialization norms |
24997 # --------------------------------------------
24998
24999 !! test
25000 Lists: Add space after bullets
25001 !! options
25002 parsoid=html2wt
25003 !! html
25004 <ul>
25005 <li>foo</li>
25006 <li> bar</li>
25007 <li><span> baz</span></li>
25008 </ul>
25009 !! wikitext
25010 * foo
25011 * bar
25012 * <span> baz</span>
25013 !! end
25014
25015 !! test
25016 1. Headings: Add space before/after == (T53744)
25017 !! options
25018 parsoid=html2wt
25019 !! html
25020 <h2>foo</h2>
25021 <h2> bar</h2>
25022 <h2>baz </h2>
25023 <h2><span> baz</span></h2>
25024 !! wikitext
25025 == foo ==
25026
25027 == bar ==
25028
25029 == baz ==
25030
25031 == <span> baz</span> ==
25032 !! end
25033
25034 !! test
25035 2. Headings: Add space before/after == even after hoisted content
25036 !! options
25037 parsoid={
25038 "modes": ["html2wt"],
25039 "scrubWikitext": true
25040 }
25041 !! html
25042 <h2> <link href="Category:A2" rel="mw:PageProp/Category" />ok</h2>
25043 !! wikitext
25044 [[Category:A2]]
25045
25046 == ok ==
25047 !! end
25048
25049 !! test
25050 1. Headings: suppress newly created empty headings
25051 !! options
25052 parsoid={
25053 "modes": ["html2wt"],
25054 "scrubWikitext": true
25055 }
25056 !! html
25057 <h2></h2>
25058 !! wikitext
25059 !! end
25060
25061 !! test
25062 2. Headings: don't suppress empty headings if scrubWikitext is false
25063 !! options
25064 parsoid=html2wt
25065 !! html
25066 <h2></h2>
25067 !! wikitext
25068 ==<nowiki/>==
25069 !! end
25070
25071 !! test
25072 3. Headings: don't suppress empty headings for existing headings even if scrubWikitext is true
25073 !! options
25074 parsoid={
25075 "modes": ["html2wt"],
25076 "scrubWikitext": true
25077 }
25078 !! html
25079 <h2 data-parsoid='{}'></h2>
25080 !! wikitext
25081 ==<nowiki/>==
25082 !! end
25083
25084 !! test
25085 1. WT Quote Tags: suppress newly created empty style tags
25086 !! options
25087 parsoid={
25088 "modes": ["html2wt"],
25089 "scrubWikitext": true
25090 }
25091 !! html
25092 <i></i><b></b>
25093 !! wikitext
25094 !! end
25095
25096 !! test
25097 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
25098 !! options
25099 parsoid=html2wt
25100 !! html
25101 <i></i><b></b>
25102 !! wikitext
25103 ''<nowiki/>'''''<nowiki/>'''
25104 !! end
25105
25106 !! test
25107 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
25108 !! options
25109 parsoid={
25110 "modes": ["html2wt"],
25111 "scrubWikitext": true
25112 }
25113 !! html
25114 <p> hi</p>
25115 <p> hello</p>
25116 !! wikitext
25117 hi
25118
25119 hello
25120 !! end
25121
25122 !! test
25123 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
25124 !! options
25125 parsoid=html2wt
25126 !! html
25127 <p> hi</p>
25128 <p> hello</p>
25129 !! wikitext
25130 <nowiki> </nowiki>hi
25131
25132 <nowiki> </nowiki> hello
25133 !! end
25134
25135 !! test
25136 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
25137 !! options
25138 parsoid={
25139 "modes": ["html2wt"],
25140 "scrubWikitext": true
25141 }
25142 !! html/parsoid
25143 <p>Foo
25144 bar
25145 baz</p>
25146
25147 <table><tr><td>Foo
25148 bar
25149 baz bang</td></tr></table>
25150
25151 <p><!--boo--> foo
25152 bar</p>
25153
25154 <p> foo
25155 bar<span>boo</span></p>
25156 !! wikitext
25157 Foo
25158 bar
25159 baz
25160
25161 {|
25162 |Foo
25163 bar
25164 baz bang
25165 |}
25166
25167 <!--boo-->foo
25168 bar
25169
25170 foo
25171 bar<span>boo</span>
25172 !! end
25173
25174 !! test
25175 1. New links that end in spaces
25176 !! options
25177 parsoid={
25178 "modes": ["html2wt"],
25179 "scrubWikitext": false
25180 }
25181 !! html
25182 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
25183 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
25184 !! wikitext
25185 [[Berlin ]]<nowiki/>is the capital of Germany.
25186
25187 [[Foo ]]'''bar'''
25188 !! end
25189
25190 !! test
25191 2. New links that end in spaces
25192 !! options
25193 parsoid={
25194 "modes": ["html2wt"],
25195 "scrubWikitext": true
25196 }
25197 !! html
25198 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
25199 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
25200 !! wikitext
25201 [[Berlin]] is the capital of Germany.
25202
25203 [[Foo]] '''bar'''
25204 !! end
25205
25206 !! test
25207 3. Existing links that end in spaces
25208 !! options
25209 parsoid={
25210 "modes": ["html2wt"],
25211 "scrubWikitext": true
25212 }
25213 !! html
25214 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin" data-parsoid='{"stx":"simple","a":{"href":"./Berlin"},"sa":{"href":"Berlin "}}'>Berlin </a>is the capital of Germany.</p>
25215
25216 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"Foo "}}'>Foo </a><b>bar</b></p>
25217 !! wikitext
25218 [[Berlin ]]<nowiki/>is the capital of Germany.
25219
25220 [[Foo ]]'''bar'''
25221 !! end
25222
25223 # ---------------------------------------------------
25224 # End of tests spec'ing wikitext serialization norms |
25225 # ---------------------------------------------------
25226
25227 # -----------------------------------------------------------------
25228 # End of section for Parsoid-only html2wt tests for serialization
25229 # of new content
25230 # -----------------------------------------------------------------
25231
25232 # -----------------------------------------------------------------
25233 # The following section of tests are primarily to spec behavior of
25234 # the selective serializer. All these tests have manual selser
25235 # changes. The automated selser changes for all tests handle the
25236 # wide variation of changes, but these tests here capture specs
25237 # deterministically.
25238 # ----------------------------------------------------------------
25239
25240 ## T90517
25241 !! test
25242 Selser: New comments should not be lost
25243 !! options
25244 parsoid={
25245 "modes": ["selser"],
25246 "changes": [
25247 [ "#a", "after", "<!--c1-->" ],
25248 [ "#b", "before", "<!--c2-->" ]
25249 ]
25250 }
25251 !! wikitext
25252 <span id="a">a</span>
25253
25254 <span id="b">b</span>
25255 !! wikitext/edited
25256 <span id="a">a</span><!--c1-->
25257
25258 <!--c2--><span id="b">b</span>
25259 !! end
25260
25261 ## T89383
25262 !! test
25263 Selser: Check for validity of DSR before using it
25264 !! options
25265 parsoid={
25266 "modes": ["selser"],
25267 "changes": [
25268 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
25269 ]
25270 }
25271 !! wikitext
25272 <span id="a">a</span>
25273 !! wikitext/edited
25274 {{DISPLAYTITLE:foo}}
25275 <span id="a">a</span>
25276 !! end
25277
25278 !! test
25279 1. DOMDiff: Changes to <ref> content should be looked up using id
25280 !! options
25281 parsoid={
25282 "modes": ["selser"],
25283 "changes": [
25284 ["#X", "after", "bar"],
25285 ["#Y", "after", "baz"]
25286 ]
25287 }
25288 !! wikitext
25289 X <ref><span id="X">foo</span></ref>
25290 Y <ref name="a" />
25291 <references>
25292 <ref name="a"><span id="Y">foo</span></ref>
25293 </references>
25294 !! wikitext/edited
25295 X <ref><span id="X">foo</span>bar</ref>
25296 Y <ref name="a" />
25297 <references>
25298 <ref name="a"><span id="Y">foo</span>baz</ref>
25299 </references>
25300 !! end
25301
25302 !! test
25303 2. DOMDiff: Changes to <ref> content should be looked up using id
25304 !! options
25305 parsoid={
25306 "modes": ["selser"],
25307 "changes": [
25308 ["#Z", "after", "bar"]
25309 ]
25310 }
25311 !! wikitext
25312 A <ref>foo bar for a</ref>
25313 B <ref group="X" name="b" />
25314
25315 <references />
25316
25317 <references group="X">
25318 <ref name="b"><span id="Z">foo</span></ref>
25319 </references>
25320 !! wikitext/edited
25321 A <ref>foo bar for a</ref>
25322 B <ref group="X" name="b" />
25323
25324 <references />
25325
25326 <references group="X">
25327 <ref name="b"><span id="Z">foo</span>bar</ref>
25328 </references>
25329 !! end