Add language Doteli (dty)
[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:table_attribs
123 !! text
124 <noinclude>
125 |</noinclude>style="color:red;"|Foo
126 !! endarticle
127
128 !! article
129 Template:table_attribs_2
130 !! text
131 <noinclude>
132 |</noinclude>style="color:red;"|Foo
133 |Bar||Baz
134 !! endarticle
135
136 !! article
137 Template:table_attribs_3
138 !! text
139 <noinclude>
140 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo
141 !! endarticle
142
143 !! article
144 Template:table_attribs_4
145 !! text
146 | style="background-color:#DC241f;" width="10px" |
147 !! endarticle
148
149 !! article
150 Template:table_attribs_5
151 !! text
152 <noinclude>
153 |</noinclude>style="color:red;"||Bar
154 !! endarticle
155
156 !! article
157 Template:table_header_cells
158 !! text
159 {{table_attribs}}!!style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
160 !! endarticle
161
162 !! article
163 Template:table_cells
164 !! text
165 {{table_attribs}}||style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
166 !! endarticle
167
168 !! article
169 Template:image_attribs
170 !! text
171 <noinclude>
172 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
173 !! endarticle
174
175 ## See T48811 for details
176 !! article
177 Template:mixed_attr_content_template
178 !! text
179 style="color:red;" title="T48811"
180 |-
181 |foo
182 !! endarticle
183
184 !! article
185 Template:definition_list
186 !! text
187 one
188 ::two
189 !! endarticle
190
191 !! article
192 A?b
193 !! text
194 Weirdo titles!
195 !! endarticle
196
197 !!article
198 Template:Bullet
199 !!text
200 * Bar
201 !!endarticle
202
203 !!article
204 Template:OpenTable
205 !!text
206 {|
207 !!endarticle
208
209 !!article
210 Template:EmptyLITest
211 !!text
212 *a
213 *
214 *
215 *b
216 !!endarticle
217
218 !!article
219 Template:EmptyTRTest
220 !!text
221 {|
222 |-
223 |-
224 |foo
225 |-
226 |-
227 |bar
228 |}
229 !!endarticle
230
231 !!article
232 Template:EmptyTRWithHTMLAttrTest
233 !!text
234 <table>
235 <tr align="center"></tr>
236 <tr><td>foo</td></tr>
237 <tr align="center"></tr>
238 <tr><td>bar</td></tr>
239 </table>
240 !!endarticle
241
242 ###
243 ### Basic tests
244 ###
245 !! test
246 Blank input
247 !! wikitext
248 !! html
249 !! end
250
251
252 !! test
253 Simple paragraph
254 !! wikitext
255 This is a simple paragraph.
256 !! html
257 <p>This is a simple paragraph.
258 </p>
259 !! end
260
261 !! test
262 Paragraphs with extra newline spacing
263 !! wikitext
264 foo
265
266 bar
267
268
269 baz
270
271
272
273 booz
274 !! html
275 <p>foo
276 </p><p>bar
277 </p><p><br />
278 baz
279 </p><p><br />
280 </p><p>booz
281 </p>
282 !! end
283
284 !! test
285 Paragraphs with newline spacing with comment lines in between
286 !! wikitext
287 ----
288 a
289 <!--foo-->
290 b
291 ----
292 a
293 <!--foo--><!--More than 1 comment, still stripped-->
294 b
295 ----
296 a
297 <!--foo--> <!----> <!-- bar -->
298 b
299 ----
300 a
301 <!--foo-->
302
303 b
304 ----
305 a
306
307 <!--foo-->
308 b
309 ----
310 a
311 <!--foo-->
312
313
314 b
315 ----
316 a
317
318
319 <!--foo-->
320 b
321 ----
322 !! html
323 <hr />
324 <p>a
325 b
326 </p>
327 <hr />
328 <p>a
329 b
330 </p>
331 <hr />
332 <p>a
333 b
334 </p>
335 <hr />
336 <p>a
337 </p><p>b
338 </p>
339 <hr />
340 <p>a
341 </p><p>b
342 </p>
343 <hr />
344 <p>a
345 </p><p><br />
346 b
347 </p>
348 <hr />
349 <p>a
350 </p><p><br />
351 b
352 </p>
353 <hr />
354
355 !! end
356
357 !! test
358 Paragraphs with newline spacing with non-empty white-space lines in between
359 !! wikitext
360 ----
361 a
362
363 b
364 ----
365 a
366
367
368 b
369 ----
370 !! html
371 <hr />
372 <p>a
373 </p><p>b
374 </p>
375 <hr />
376 <p>a
377 </p><p><br />
378 b
379 </p>
380 <hr />
381
382 !! end
383
384 !! test
385 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
386 !! wikitext
387 ----
388 a
389 <!--foo-->
390 b
391 ----
392 a
393 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
394 b
395 ----
396 a
397
398 <!--foo-->
399 <!--bar-->
400 b
401 ----
402 a
403
404 <!--foo-->
405 <!--bar-->
406
407 b
408 ----
409 !! html
410 <hr />
411 <p>a
412 b
413 </p>
414 <hr />
415 <p>a
416 b
417 </p>
418 <hr />
419 <p>a
420 </p><p>b
421 </p>
422 <hr />
423 <p>a
424 </p><p><br />
425 b
426 </p>
427 <hr />
428
429 !! end
430
431 !! test
432 Extra newlines: More paragraphs with indented comment
433 !! wikitext
434 a
435
436 <!--boo-->
437
438 b
439 !! html
440 <p>a
441 </p><p><br />
442 b
443 </p>
444 !!end
445
446 !! test
447 Extra newlines followed by heading
448 !! wikitext
449 a
450
451
452
453 =b=
454 [[a]]
455
456
457 =b=
458 !! html
459 <p>a
460 </p><p><br />
461 </p>
462 <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>
463 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
464 </p><p><br />
465 </p>
466 <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>
467
468 !! end
469
470 !! test
471 Extra newlines between heading and content are swallowed
472 !! wikitext
473 =b=
474
475
476
477 [[a]]
478 !! html
479 <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>
480 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
481 </p>
482 !! end
483
484 !! test
485 Parsing an URL
486 !! wikitext
487 http://fr.wikipedia.org/wiki/🍺
488 <!-- EasterEgg we love beer, better be able be able to link to it -->
489 !! html
490 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
491 </p>
492 !! end
493
494 # Note that the html+tidy output removes the spaces after the <li>,
495 # which is a bug (http://sourceforge.net/p/tidy/bugs/945/, etc).
496 # This is an issue for all tests with lists. We intentionally do
497 # *not* add html+tidy clauses for these, as we don't want to
498 # document/test the broken behavior. (Parsoid matches the non-tidy
499 # output in these cases.)
500
501 !! test
502 Simple list
503 !! wikitext
504 * Item 1
505 * Item 2
506 !! html
507 <ul><li> Item 1</li>
508 <li> Item 2</li></ul>
509
510 !! end
511
512 !! test
513 Italics and bold
514 !! wikitext
515 * plain
516 * plain''italic''plain
517 * plain''italic''plain''italic''plain
518 * plain'''bold'''plain
519 * plain'''bold'''plain'''bold'''plain
520 * plain''italic''plain'''bold'''plain
521 * plain'''bold'''plain''italic''plain
522 * plain''italic'''bold-italic'''italic''plain
523 * plain'''bold''bold-italic''bold'''plain
524 * plain'''''bold-italic'''italic''plain
525 * plain'''''bold-italic''bold'''plain
526 * plain''italic'''bold-italic'''''plain
527 * plain'''bold''bold-italic'''''plain
528 * plain l'''italic''plain
529 * plain l''''bold''' plain
530 !! html
531 <ul><li> plain</li>
532 <li> plain<i>italic</i>plain</li>
533 <li> plain<i>italic</i>plain<i>italic</i>plain</li>
534 <li> plain<b>bold</b>plain</li>
535 <li> plain<b>bold</b>plain<b>bold</b>plain</li>
536 <li> plain<i>italic</i>plain<b>bold</b>plain</li>
537 <li> plain<b>bold</b>plain<i>italic</i>plain</li>
538 <li> plain<i>italic<b>bold-italic</b>italic</i>plain</li>
539 <li> plain<b>bold<i>bold-italic</i>bold</b>plain</li>
540 <li> plain<i><b>bold-italic</b>italic</i>plain</li>
541 <li> plain<b><i>bold-italic</i>bold</b>plain</li>
542 <li> plain<i>italic<b>bold-italic</b></i>plain</li>
543 <li> plain<b>bold<i>bold-italic</i></b>plain</li>
544 <li> plain l'<i>italic</i>plain</li>
545 <li> plain l'<b>bold</b> plain</li></ul>
546
547 !! end
548
549 # this example taken from the [[simple:Moon]] article (bug 47326)
550 !! test
551 Italics and possessives (1)
552 !! wikitext
553 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
554 !! html
555 <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
556 </p>
557 !! end
558
559 # this example taken from [[en:Flaming Pie]] (bug 49926)
560 !! test
561 Italics and possessives (2)
562 !! wikitext
563 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
564 !! html
565 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
566 </p>
567 !! end
568
569 # this example taken from [[en:Dictionary]] (bug 49926)
570 !! test
571 Italics and possessives (3)
572 !! wikitext
573 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''.
574 !! html
575 <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>.
576 </p>
577 !! end
578
579
580 ###
581 ### 2-quote opening sequence tests
582 ###
583 !! test
584 Italics and bold: 2-quote opening sequence: (2,2)
585 !! wikitext
586 ''foo''
587 !! html
588 <p><i>foo</i>
589 </p>
590 !!end
591
592 !! test
593 Italics and bold: 2-quote opening sequence: (2,3)
594 !! wikitext
595 ''foo'''
596 !! html/*
597 <p><i>foo'</i>
598 </p>
599 !!end
600
601 !! test
602 Italics and bold: 2-quote opening sequence: (2,4)
603 !! options
604 parsoid=wt2html
605 !! wikitext
606 ''foo''''
607 !! html/*
608 <p><i>foo''</i>
609 </p>
610 !!end
611
612 # same html as previous, but wikitext adjusted to match parsoid html2wt
613 !! test
614 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
615 !! wikitext
616 ''foo<nowiki>''</nowiki>''
617 !! html
618 <p><i>foo''</i>
619 </p>
620 !! end
621
622 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
623 !! test
624 Italics and bold: 2-quote opening sequence: (2,5)
625 !! options
626 parsoid=wt2html
627 !! wikitext
628 ''foo'''''
629 !! html/php
630 <p><i>foo</i>
631 </p>
632 !! html/parsoid
633 <p><i>foo</i><b></b>
634 </p>
635 !!end
636
637 # same html as previous, but wikitext adjusted to match parsoid html2wt
638 !! test
639 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
640 !! wikitext
641 ''foo'''''<nowiki/>'''
642 !! html/php
643 <p><i>foo</i>
644 </p>
645 !! html/parsoid
646 <p><i>foo</i><b></b>
647 </p>
648 !! end
649
650
651 ###
652 ### 3-quote opening sequence tests
653 ###
654
655 !! test
656 Italics and bold: 3-quote opening sequence: (3,2)
657 !! wikitext
658 '''foo''
659 !! html/*
660 <p>'<i>foo</i>
661 </p>
662 !!end
663
664 !! test
665 Italics and bold: 3-quote opening sequence: (3,3)
666 !! wikitext
667 '''foo'''
668 !! html
669 <p><b>foo</b>
670 </p>
671 !!end
672
673 !! test
674 Italics and bold: 3-quote opening sequence: (3,4)
675 !! wikitext
676 '''foo''''
677 !! html/*
678 <p><b>foo'</b>
679 </p>
680 !!end
681
682 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
683 !! test
684 Italics and bold: 3-quote opening sequence: (3,5)
685 !! options
686 parsoid=wt2html
687 !! wikitext
688 '''foo'''''
689 !! html/php
690 <p><b>foo</b>
691 </p>
692 !! html/parsoid
693 <p><b>foo</b><i></i>
694 </p>
695 !!end
696
697 # same html as previous, but wikitext adjusted to match parsoid html2wt
698 !! test
699 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
700 !! wikitext
701 '''foo'''''<nowiki/>''
702 !! html/php
703 <p><b>foo</b>
704 </p>
705 !! html/parsoid
706 <p><b>foo</b><i></i>
707 </p>
708 !! end
709
710
711 ###
712 ### 4-quote opening sequence tests
713 ###
714
715 !! test
716 Italics and bold: 4-quote opening sequence: (4,2)
717 !! options
718 parsoid=wt2html
719 !! wikitext
720 ''''foo''
721 !! html/*
722 <p>''<i>foo</i>
723 </p>
724 !!end
725
726 # same html as previous, but wikitext adjusted to match parsoid html2wt
727 !! test
728 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
729 !! wikitext
730 <nowiki>''</nowiki>''foo''
731 !! html
732 <p>''<i>foo</i>
733 </p>
734 !! end
735
736 !! test
737 Italics and bold: 4-quote opening sequence: (4,3)
738 !! wikitext
739 ''''foo'''
740 !! html/*
741 <p>'<b>foo</b>
742 </p>
743 !!end
744
745 !! test
746 Italics and bold: 4-quote opening sequence: (4,4)
747 !! options
748 parsoid=wt2html
749 !! wikitext
750 ''''foo''''
751 !! html/*
752 <p>'<b>foo'</b>
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,4) w/ nowiki
759 !! wikitext
760 '<nowiki/>'''foo''''
761 !! html
762 <p>'<b>foo'</b>
763 </p>
764 !! end
765
766 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
767 !! test
768 Italics and bold: 4-quote opening sequence: (4,5)
769 !! options
770 parsoid=wt2html
771 !! wikitext
772 ''''foo'''''
773 !! html/php
774 <p>'<b>foo</b>
775 </p>
776 !! html/parsoid
777 <p>'<b>foo</b><i></i>
778 </p>
779 !!end
780
781 # same html as previous, but wikitext adjusted to match parsoid html2wt
782 !! test
783 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
784 !! wikitext
785 '<nowiki/>'''foo'''''<nowiki/>''
786 !! html/php
787 <p>'<b>foo</b>
788 </p>
789 !! html/parsoid
790 <p>'<b>foo</b><i></i>
791 </p>
792 !! end
793
794
795 ###
796 ### 5-quote opening sequence tests
797 ###
798
799 !! test
800 Italics and bold: 5-quote opening sequence: (5,2)
801 !! options
802 parsoid=wt2html
803 !! wikitext
804 '''''foo''
805 !! html/*
806 <p><b><i>foo</i></b>
807 </p>
808 !!end
809
810 # same html as previous, but wikitext adjusted to match parsoid html2wt
811 # skipping wt2html and html2html because it wants to put <i> before <b>
812 !! test
813 Italics and bold: 5-quote opening sequence: (5,2+3)
814 !! options
815 parsoid=wt2wt,html2wt
816 !! wikitext
817 '''''foo'''''
818 !! html
819 <p><b><i>foo</i></b>
820 </p>
821 !! end
822
823 !! test
824 Italics and bold: 5-quote opening sequence: (5,3)
825 !! options
826 parsoid=wt2html
827 !! wikitext
828 '''''foo'''
829 !! html/*
830 <p><i><b>foo</b></i>
831 </p>
832 !!end
833
834 # same html as previous, but wikitext adjusted to match parsoid html2wt
835 !! test
836 Italics and bold: 5-quote opening sequence: (5,3+2)
837 !! wikitext
838 '''''foo'''''
839 !! html
840 <p><i><b>foo</b></i>
841 </p>
842 !! end
843
844 !! test
845 Italics and bold: 5-quote opening sequence: (5,4)
846 !! options
847 parsoid=wt2html
848 !! wikitext
849 '''''foo''''
850 !! html/*
851 <p><i><b>foo'</b></i>
852 </p>
853 !!end
854
855 !! test
856 Italics and bold: 5-quote opening sequence: (5,5)
857 !! wikitext
858 '''''foo'''''
859 !! html
860 <p><i><b>foo</b></i>
861 </p>
862 !!end
863
864 !! test
865 Italics and bold: 5-quote opening sequence: (5,6)
866 !! wikitext
867 '''''foo''''''
868 !! html/*
869 <p><i><b>foo'</b></i>
870 </p>
871 !! end
872
873 ###
874 ### multiple quote sequences in a line
875 ###
876 !! test
877 Italics and bold: multiple quote sequences: (2,4,2)
878 !! options
879 parsoid=wt2html
880 !! wikitext
881 ''foo''''bar''
882 !! html/*
883 <p><i>foo'<b>bar</b></i>
884 </p>
885 !!end
886
887
888 # same html as previous, but wikitext adjusted to match parsoid html2wt
889 !! test
890 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
891 !! wikitext
892 ''foo'<nowiki/>'''bar'''''
893 !! html
894 <p><i>foo'<b>bar</b></i>
895 </p>
896 !! end
897
898
899 !! test
900 Italics and bold: multiple quote sequences: (2,4,3)
901 !! options
902 parsoid=wt2html
903 !! wikitext
904 ''foo''''bar'''
905 !! html/*
906 <p><i>foo'<b>bar</b></i>
907 </p>
908 !!end
909
910
911 # same html as previous, but wikitext adjusted to match parsoid html2wt
912 !! test
913 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
914 !! wikitext
915 ''foo'<nowiki/>'''bar'''''
916 !! html
917 <p><i>foo'<b>bar</b></i>
918 </p>
919 !! end
920
921
922 !! test
923 Italics and bold: multiple quote sequences: (2,4,4)
924 !! options
925 parsoid=wt2html
926 !! wikitext
927 ''foo''''bar''''
928 !! html/*
929 <p><i>foo'<b>bar'</b></i>
930 </p>
931 !!end
932
933
934 # same html as previous, but wikitext adjusted to match parsoid html2wt
935 !! test
936 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
937 !! wikitext
938 ''foo'<nowiki/>'''bar'<nowiki/>'''''
939 !! html
940 <p><i>foo'<b>bar'</b></i>
941 </p>
942 !! end
943
944
945 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
946 !! test
947 Italics and bold: multiple quote sequences: (3,4,2)
948 !! options
949 parsoid=wt2html
950 !! wikitext
951 '''foo''''bar''
952 !! html/php
953 <p><b>foo'</b>bar
954 </p>
955 !! html/parsoid
956 <p><b>foo'</b>bar<i></i>
957 </p>
958 !!end
959
960 # same html as previous, but wikitext adjusted to match parsoid html2wt
961 !! test
962 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
963 !! options
964 parsoid
965 !! wikitext
966 '''<nowiki>foo'</nowiki>'''bar''<nowiki/>''
967 !! html/php
968 <p><b>foo'</b>bar
969 </p>
970 !! html/parsoid
971 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<i></i>
972 </p>
973 !! end
974
975
976 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
977 !! test
978 Italics and bold: multiple quote sequences: (3,4,3)
979 !! options
980 parsoid=wt2html
981 !! wikitext
982 '''foo''''bar'''
983 !! html/php
984 <p><b>foo'</b>bar
985 </p>
986 !! html/parsoid
987 <p><b>foo'</b>bar<b></b>
988 </p>
989 !!end
990
991 # same html as previous, but wikitext adjusted to match parsoid html2wt
992 !! test
993 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
994 !! wikitext
995 '''<nowiki>foo'</nowiki>'''bar'''<nowiki/>'''
996 !! html/php
997 <p><b>foo'</b>bar
998 </p>
999 !! html/parsoid
1000 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<b></b>
1001 </p>
1002 !! end
1003
1004 ###
1005 ### other quote tests
1006 ###
1007 !! test
1008 Italics and bold: other quote tests: (2,3,5)
1009 !! wikitext
1010 ''this is about '''foo's family'''''
1011 !! html
1012 <p><i>this is about <b>foo's family</b></i>
1013 </p>
1014 !!end
1015
1016
1017 !! test
1018 Italics and bold: other quote tests: (2,(3,3),2)
1019 !! wikitext
1020 ''this is about '''foo's''' family''
1021 !! html
1022 <p><i>this is about <b>foo's</b> family</i>
1023 </p>
1024 !!end
1025
1026
1027 !! test
1028 Italics and bold: other quote tests: (3,2,3,2)
1029 !! options
1030 parsoid=wt2html
1031 !! wikitext
1032 '''this is about ''foo'''s family''
1033 !! html/*
1034 <p><b>this is about <i>foo</i></b><i>s family</i>
1035 </p>
1036 !!end
1037
1038
1039 # same html as previous, but wikitext adjusted to match parsoid html2wt
1040 !! test
1041 Italics and bold: other quote tests: (3,2,3+2+2,2)
1042 !! wikitext
1043 '''this is about ''foo'''''<nowiki/>''s family''
1044 !! html
1045 <p><b>this is about <i>foo</i></b><i>s family</i>
1046 </p>
1047 !! end
1048
1049
1050 !! test
1051 Italics and bold: other quote tests: (3,2,3,3)
1052 !! wikitext
1053 '''this is about ''foo'''s family'''
1054 !! html/*
1055 <p>'<i>this is about </i>foo<b>s family</b>
1056 </p>
1057 !!end
1058
1059
1060 !! test
1061 Italics and bold: other quote tests: (3,(2,2),3)
1062 !! wikitext
1063 '''this is about ''foo's'' family'''
1064 !! html
1065 <p><b>this is about <i>foo's</i> family</b>
1066 </p>
1067 !!end
1068
1069
1070 !! test
1071 Italicized possessive
1072 !! wikitext
1073 The ''[[Main Page]]'''s talk page.
1074 !! html/php
1075 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1076 </p>
1077 !! html/parsoid
1078 <p>The <i><a rel="mw:WikiLink" href="Main_Page" title="Main Page">Main Page</a>'</i>s talk page.</p>
1079 !! end
1080
1081 !! test
1082 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
1083 (Requires tidy for PHP parser output to be fixed up)
1084 !! options
1085 parsoid=wt2html,wt2wt
1086 !! wikitext
1087 {|
1088 !''a!!''b
1089 |''a||''b
1090 |}
1091 !! html/php+tidy
1092 <table>
1093 <tr>
1094 <th><i>a</i></th>
1095 <th><i>b</i></th>
1096 <td><i>a</i></td>
1097 <td><i>b</i></td>
1098 </tr>
1099 </table>
1100 !! html/parsoid
1101 <table>
1102 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
1103 <td><i>a</i></td><td><i>b</i></td></tr>
1104 </tbody></table>
1105 !! end
1106
1107 ###
1108 ### Non-html5 tags
1109 ###
1110
1111 !! test
1112 Non-html5 tags should be accepted
1113 !! wikitext
1114 <center>''foo''</center>
1115 <big>''foo''</big>
1116 <font>''foo''</font>
1117 <strike>''foo''</strike>
1118 <tt>''foo''</tt>
1119 !! html
1120 <center><i>foo</i></center>
1121 <p><big><i>foo</i></big>
1122 <font><i>foo</i></font>
1123 <strike><i>foo</i></strike>
1124 <tt><i>foo</i></tt>
1125 </p>
1126 !! end
1127
1128 !! test
1129 <wbr> is valid wikitext (bug 52468)
1130 !! wikitext
1131 <wbr>
1132 !! html
1133 <p><wbr />
1134 </p>
1135 !! end
1136
1137 # <strike> is HTML4, <s> is HTML4/5.
1138 !! test
1139 <s> or <strike> for strikethrough
1140 !! wikitext
1141 <strike>strike</strike>
1142
1143 <s>s</s>
1144 !! html
1145 <p><strike>strike</strike>
1146 </p><p><s>s</s>
1147 </p>
1148 !! end
1149
1150 ## a not permitted
1151 ## i,b,br omitted
1152 !! test
1153 Text-level semantic html elements in wikitext
1154 !! wikitext
1155 <em>text</em>
1156 <strong>text</strong>
1157 <small>text</small>
1158 <s>text</s>
1159 <cite>text</cite>
1160 <q>text</q>
1161 <dfn>text</dfn>
1162 <abbr>text</abbr>
1163 <data>text</data>
1164 <time>text</time>
1165 <code>text</code>
1166 <var>text</var>
1167 <samp>text</samp>
1168 <kbd>text</kbd>
1169 <sub>text</sub>
1170 <u>text</u>
1171 <mark>text</mark>
1172 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1173 <bdi>text</bdi>
1174 <bdo>text</bdo>
1175 <span>text</span>
1176 <wbr />
1177 !! html
1178 <p><em>text</em>
1179 <strong>text</strong>
1180 <small>text</small>
1181 <s>text</s>
1182 <cite>text</cite>
1183 <q>text</q>
1184 <dfn>text</dfn>
1185 <abbr>text</abbr>
1186 <data>text</data>
1187 <time>text</time>
1188 <code>text</code>
1189 <var>text</var>
1190 <samp>text</samp>
1191 <kbd>text</kbd>
1192 <sub>text</sub>
1193 <u>text</u>
1194 <mark>text</mark>
1195 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1196 <bdi>text</bdi>
1197 <bdo>text</bdo>
1198 <span>text</span>
1199 <wbr />
1200 </p>
1201 !! end
1202
1203 # test cases taken from
1204 # http://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
1205 !! test
1206 Ruby markup (W3C-style)
1207 !! wikitext
1208 ; Mono-ruby for individual base characters
1209 : <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
1210 ; Group ruby
1211 : <ruby>今日<rt>きょう</rt></ruby>
1212 ; Jukugo ruby
1213 : <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
1214 ; Inline ruby
1215 : <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
1216 ; Double-sided ruby
1217 : <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
1218 <ruby>
1219 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1220 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1221 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1222 </ruby>
1223 !! html
1224 <dl><dt> Mono-ruby for individual base characters</dt>
1225 <dd> <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1226 <dt> Group ruby</dt>
1227 <dd> <ruby>今日<rt>きょう</rt></ruby></dd>
1228 <dt> Jukugo ruby</dt>
1229 <dd> <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1230 <dt> Inline ruby</dt>
1231 <dd> <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1232 <dt> Double-sided ruby</dt>
1233 <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>
1234 <p><ruby>
1235 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1236 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1237 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1238 </ruby>
1239 </p>
1240 !! end
1241
1242 # The next two test different paths in the sanitizer.
1243 !! test
1244 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
1245 !! wikitext
1246 <blockquote|>a</blockquote>
1247
1248 <b→> doesn't terminate </b→>
1249
1250 <bä> doesn't terminate </bä>
1251
1252 <boo> doesn't terminate </boo>
1253
1254 <s.foo> doesn't terminate </s.foo>
1255
1256 <sub-ID#1>
1257 !! html
1258 <p>&lt;blockquote|&gt;a&lt;/blockquote&gt;
1259 </p><p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1260 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1261 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1262 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1263 </p><p>&lt;sub-ID#1&gt;
1264 </p>
1265 !! end
1266
1267 # There is a tidy bug here: http://sourceforge.net/p/tidy/bugs/946/
1268 # If the non-word-character tag made it through the sanitizer, tidy
1269 # would munge it up.
1270 !! test
1271 Non-word characters don't terminate tag names + tidy
1272 !! wikitext
1273 <blockquote|>a</blockquote>
1274
1275 <b→> doesn't terminate </b→>
1276
1277 <bä> doesn't terminate </bä>
1278
1279 <boo> doesn't terminate </boo>
1280
1281 <s.foo> doesn't terminate </s.foo>
1282
1283 <sub-ID#1>
1284 !! html+tidy
1285 <p>&lt;blockquote|&gt;a</p>
1286 <p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;</p>
1287 <p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;</p>
1288 <p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;</p>
1289 <p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;</p>
1290 <p>&lt;sub-ID#1&gt;</p>
1291 !! end
1292
1293 ###
1294 ### See tests/parser/parserTestsParserHook.php for the <tåg> extension)
1295 ### This checks that HTML5 tags (with non-word characters in the tag
1296 ### name) make it safely through the parser -- the Sanitizer will
1297 ### munge them later, as it should.
1298 ###
1299 !! test
1300 Non-word characters are valid in extension tags (T19663)
1301 !! wikitext
1302 <tåg>tåg</tåg>
1303 !! html
1304 <pre>
1305 'tåg'
1306 array (
1307 )
1308 </pre>
1309
1310 !! end
1311
1312 !! test
1313 Isolated close tags should be treated as literal text (bug 52760)
1314 !! wikitext
1315 </b>
1316
1317 <s.foo>s</s>
1318 !! html+tidy
1319 <p>&lt;s.foo&gt;s</p>
1320 !! end
1321
1322 ###
1323 ### Special characters
1324 ###
1325
1326 !! test
1327 Bare pipe character (bug 52363)
1328 !! wikitext
1329 |
1330 !! html
1331 <p>|
1332 </p>
1333 !! end
1334
1335 !! test
1336 Bare pipe character from a template (bug 52363)
1337 !! wikitext
1338 {{pipe}}
1339 !! html
1340 <p>|
1341 </p>
1342 !! end
1343
1344 ###
1345 ### <nowiki> test cases
1346 ###
1347
1348 !! test
1349 <nowiki> unordered list
1350 !! wikitext
1351 <nowiki>* This is not an unordered list item.</nowiki>
1352 !! html
1353 <p>* This is not an unordered list item.
1354 </p>
1355 !! end
1356
1357 !! test
1358 <nowiki> spacing
1359 !! wikitext
1360 <nowiki>Lorem ipsum dolor
1361
1362 sed abit.
1363 sed nullum.
1364
1365 :and a colon
1366 </nowiki>
1367 !! html
1368 <p>Lorem ipsum dolor
1369
1370 sed abit.
1371 sed nullum.
1372
1373 :and a colon
1374
1375 </p>
1376 !! end
1377
1378 !! test
1379 nowiki 3
1380 !! wikitext
1381 :There is not nowiki.
1382 :There is <nowiki>nowiki</nowiki>.
1383
1384 #There is not nowiki.
1385 #There is <nowiki>nowiki</nowiki>.
1386
1387 *There is not nowiki.
1388 *There is <nowiki>nowiki</nowiki>.
1389 !! html
1390 <dl><dd>There is not nowiki.</dd>
1391 <dd>There is nowiki.</dd></dl>
1392 <ol><li>There is not nowiki.</li>
1393 <li>There is nowiki.</li></ol>
1394 <ul><li>There is not nowiki.</li>
1395 <li>There is nowiki.</li></ul>
1396
1397 !! end
1398
1399 !! test
1400 Entities inside <nowiki>
1401 !! wikitext
1402 <nowiki>&lt;</nowiki>
1403 !! html
1404 <p>&lt;
1405 </p>
1406 !! end
1407
1408 !! test
1409 Entities inside template parameters
1410 !! options
1411 parsoid
1412 !! wikitext
1413 {{echo|&ndash;}}
1414 !! html
1415 <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>
1416 !! end
1417
1418 !! test
1419 Properly escape nowiki when combined with other wiki markup
1420 !! options
1421 parsoid=html2wt
1422 !! html
1423 <p>* &lt;/nowiki&gt; tag</p>
1424 !! wikitext
1425 <nowiki>* &lt;/nowiki&gt;</nowiki> tag
1426 !! end
1427
1428 !! test
1429 T71950: 1. Put nowiki as close to cause as possible, even with non-quote escapable chars
1430 !! options
1431 parsoid=html2wt
1432 !! html
1433 <p>This text: L'<a rel="mw:WikiLink" href="./Foo">Foo</a>
1434 This text: L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1435 This text: L'''<a rel="mw:WikiLink" href="./Foo">Foo</a>''</p>
1436 !! wikitext
1437 This text: L'[[Foo]]
1438 This text: L<nowiki>''</nowiki>[[Foo]]
1439 This text: L<nowiki>'''</nowiki>[[Foo]]<nowiki>''</nowiki>
1440 !! end
1441
1442 # This test fails because wikitext whitespace is not normalized before comparing.
1443 !! test
1444 T71950: 2. Put nowiki as close to cause as possible, after ' :'
1445 !! options
1446 parsoid=html2wt
1447 !! html
1448 <p>This text : L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1449 </p>
1450 !! wikitext
1451 This text : L<nowiki>''</nowiki>[[Foo]]
1452 !! end
1453
1454 # This test and the next one are html2wt only as they test that incorrect wikitext
1455 # passed in template arguments gets escaped or wrapped in nowikis where required.
1456 !! test
1457 T71482: Use {{!}} instead of nowiki for single pipe in template argument
1458 !! options
1459 parsoid=html2wt
1460 !! html/parsoid
1461 <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>
1462 <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>
1463 !! wikitext
1464 {{echo|foo{{!}}bar}}
1465 {{echo|<nowiki>foo|bar |[[</nowiki>}}
1466 !! end
1467
1468 !! test
1469 T53961: Output correct nowikis in template arguments
1470 !! options
1471 parsoid=html2wt
1472 !! html/parsoid
1473 <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>
1474 <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>
1475 <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>
1476 <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>
1477 <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>
1478 !! wikitext
1479 {{echo|a [ b}}
1480 {{echo|a <nowiki>}}</nowiki> b}}
1481 {{echo|<nowiki>a [[ b</nowiki>}}
1482 {{echo|a {{!}} <nowiki>{{ ]]</nowiki>}}
1483 {{echo|a <nowiki>}</nowiki>}}
1484 !! end
1485
1486 ###
1487 ### Comments
1488 ###
1489 !! test
1490 Comments and Indent-Pre
1491 !! wikitext
1492 <!-- comment 1 --> asdf
1493
1494 <!-- comment 1 --> asdf
1495 <!-- comment 2 -->
1496
1497 <!-- comment 1 --> asdf
1498 <!-- comment 2 -->xyz
1499
1500 <!-- comment 1 --> asdf
1501 <!-- comment 2 --> xyz
1502 !! html
1503 <pre>asdf
1504 </pre>
1505 <pre>asdf
1506 </pre>
1507 <pre>asdf
1508 </pre>
1509 <p>xyz
1510 </p>
1511 <pre>asdf
1512 xyz
1513 </pre>
1514 !! end
1515
1516 !! test
1517 Comment test 2a
1518 !! wikitext
1519 asdf
1520 <!-- comment 1 -->
1521 jkl
1522 !! html
1523 <p>asdf
1524 jkl
1525 </p>
1526 !! end
1527
1528 !! test
1529 Comment test 2b
1530 !! wikitext
1531 asdf
1532 <!-- comment 1 -->
1533
1534 jkl
1535 !! html
1536 <p>asdf
1537 </p><p>jkl
1538 </p>
1539 !! end
1540
1541 !! test
1542 Comment test 3
1543 !! wikitext
1544 asdf
1545 <!-- comment 1 -->
1546 <!-- comment 2 -->
1547 jkl
1548 !! html
1549 <p>asdf
1550 jkl
1551 </p>
1552 !! end
1553
1554 !! test
1555 Comment test 4
1556 !! wikitext
1557 asdf<!-- comment 1 -->jkl
1558 !! html
1559 <p>asdfjkl
1560 </p>
1561 !! end
1562
1563 !! test
1564 Comment spacing
1565 !! wikitext
1566 a
1567 <!-- foo --> b <!-- bar -->
1568 c
1569 !! html
1570 <p>a
1571 </p>
1572 <pre> b
1573 </pre>
1574 <p>c
1575 </p>
1576 !! end
1577
1578 !! test
1579 Comment whitespace
1580 !! wikitext
1581 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1582 !! html
1583
1584 !! end
1585
1586 !! test
1587 Comment semantics and delimiters
1588 !! wikitext
1589 <!-- --><!----><!-----><!------>
1590 !! html
1591
1592 !! end
1593
1594 !! test
1595 Comment semantics and delimiters, redux
1596 !! wikitext
1597 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1598 -- foo -- funky huh? ... -->
1599 !! html
1600
1601 !! end
1602
1603 !! test
1604 Comment semantics and delimiters: directors cut
1605 !! wikitext
1606 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1607 everything starting with < followed by !-- until the first -- and > we see,
1608 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1609 -->-->
1610 !! html
1611 <p>--&gt;
1612 </p>
1613 !! end
1614
1615 !! test
1616 Comment semantics: nesting
1617 !! wikitext
1618 <!--<!-- no, we're not going to do anything fancy here -->-->
1619 !! html
1620 <p>--&gt;
1621 </p>
1622 !! end
1623
1624 !! test
1625 Comment semantics: unclosed comment at end
1626 !! wikitext
1627 <!--This comment will run out to the end of the document
1628 !! html
1629
1630 !! end
1631
1632 # Bug 58184: document parsoid's behaviour
1633 !! test
1634 Suppress comment closing tag in lenient browsers
1635 !! options
1636 parsoid=wt2html,html2html
1637 !! wikitext
1638 <!-- Browsers--!> think this is closed -->
1639 !! html/php
1640
1641 !! html/parsoid
1642 <!-- Browsers--¡> think this is closed -->
1643 !! end
1644
1645 !! test
1646 Comment in template title
1647 !! wikitext
1648 {{f<!---->oo}}
1649 !! html
1650 <p>FOO
1651 </p>
1652 !! end
1653
1654 !! test
1655 Comment on its own line post-expand
1656 !! wikitext
1657 a
1658 {{blank}}<!---->
1659 b
1660 !! html
1661 <p>a
1662 </p><p>b
1663 </p>
1664 !! end
1665
1666 !! test
1667 Comment on its own line post-expand with non-significant whitespace
1668 !! wikitext
1669 a
1670 {{blank}} <!---->
1671 b
1672 !! html
1673 <p>a
1674 </p><p>b
1675 </p>
1676 !! end
1677
1678 !! test
1679 Multiple comments should still parse as SOL-transparent
1680 !! options
1681 parsoid=wt2html,wt2wt
1682 !! wikitext
1683 <!--c1-->*a
1684 <!--c2--><!--c3--><!--c4-->*b
1685 !! html
1686 <ul>
1687 <li>a
1688 </li>
1689 <li>b
1690 </li>
1691 </ul>
1692 !! end
1693
1694 ###
1695 ### paragraph wrapping tests
1696 ###
1697 !! test
1698 No block tags
1699 !! wikitext
1700 a
1701
1702 b
1703 !! html
1704 <p>a
1705 </p><p>b
1706 </p>
1707 !! end
1708
1709 !! test
1710 Block tag on one line (<div>)
1711 !! wikitext
1712 a <div>foo</div>
1713
1714 b
1715 !! html
1716 a <div>foo</div>
1717 <p>b
1718 </p>
1719 !! html+tidy
1720 <p>a</p>
1721 <div>foo</div>
1722 <p>b</p>
1723 !! end
1724
1725 !! test
1726 Block tag on one line (<blockquote>)
1727 !! wikitext
1728 a <blockquote>foo</blockquote>
1729
1730 b
1731 !! html
1732 a <blockquote>foo</blockquote>
1733 <p>b
1734 </p>
1735 !! html+tidy
1736 <p>a</p>
1737 <blockquote>
1738 <p>foo</p>
1739 </blockquote>
1740 <p>b</p>
1741 !! end
1742
1743 !! test
1744 Block tag on both lines (<div>)
1745 !! wikitext
1746 a <div>foo</div>
1747
1748 b <div>foo</div>
1749 !! html
1750 a <div>foo</div>
1751 b <div>foo</div>
1752
1753 !! html+tidy
1754 <p>a</p>
1755 <div>foo</div>
1756 <p>b</p>
1757 <div>foo</div>
1758 !! end
1759
1760 !! test
1761 Block tag on both lines (<blockquote>)
1762 !! wikitext
1763 a <blockquote>foo</blockquote>
1764
1765 b <blockquote>foo</blockquote>
1766 !! html
1767 a <blockquote>foo</blockquote>
1768 b <blockquote>foo</blockquote>
1769
1770 !! html+tidy
1771 <p>a</p>
1772 <blockquote>
1773 <p>foo</p>
1774 </blockquote>
1775 <p>b</p>
1776 <blockquote>
1777 <p>foo</p>
1778 </blockquote>
1779 !! end
1780
1781 !! test
1782 Multiple lines without block tags
1783 !! wikitext
1784 <div>foo</div> a
1785 b
1786 c
1787 d<!--foo--> e
1788 x <div>foo</div> z
1789 !! html
1790 <div>foo</div> a
1791 <p>b
1792 c
1793 d e
1794 </p>
1795 x <div>foo</div> z
1796
1797 !! html+tidy
1798 <div>foo</div>
1799 <p>a</p>
1800 <p>b c d e</p>
1801 <p>x</p>
1802 <div>foo</div>
1803 <p>z</p>
1804 !! end
1805
1806 # Tidy strips out the empty <div> tags. Parsoid doesn't.
1807 # So, we have a separate section for Parsoid. We don't want
1808 # to mimic this stripping behavior in Parsoid. It affects
1809 # editing experience and also requires us to maintain additional
1810 # info for RT-ing.
1811 !! test
1812 Empty lines between lines with block tags
1813 !! wikitext
1814 <div></div>
1815
1816
1817 <div></div>a
1818
1819 b
1820 <div>a</div>b
1821
1822 <div>b</div>d
1823
1824
1825 <div>e</div>
1826 !! html
1827 <div></div>
1828 <p><br />
1829 </p>
1830 <div></div>a
1831 <p>b
1832 </p>
1833 <div>a</div>b
1834 <div>b</div>d
1835 <p><br />
1836 </p>
1837 <div>e</div>
1838
1839 !! html+tidy
1840 <p><br /></p>
1841 <p>a</p>
1842 <p>b</p>
1843 <div>a</div>
1844 <p>b</p>
1845 <div>b</div>
1846 <p>d</p>
1847 <p><br /></p>
1848 <div>e</div>
1849 !! html/parsoid
1850 <div data-parsoid='{"stx":"html"}'></div>
1851
1852 <p><br /></p>
1853 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
1854
1855 <p>b</p>
1856 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
1857
1858 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
1859
1860 <p><br /></p>
1861 <div data-parsoid='{"stx":"html"}'>e</div>
1862 !! end
1863
1864 ## PHP parser emits output which is broken
1865 !! test
1866 Unclosed HTML p-tags should be handled properly
1867 !! wikitext
1868 <div><p>foo</div>
1869 a
1870
1871 b
1872 !! html/php+tidy
1873 <div>
1874 <p>foo</p>
1875 </div>
1876 <p>a</p>
1877 <p>b</p>
1878 !! html/parsoid
1879 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
1880 <p>a</p>
1881 <p>b</p>
1882 !! end
1883
1884 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
1885 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
1886 ## them for now.
1887 !! test
1888 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
1889 !! options
1890 parsoid=wt2html
1891 !! wikitext
1892 a [[Category:A1]] [[Category:A2]]
1893 [[Category:A3]]
1894 [[Category:A4]]
1895 !! html/parsoid
1896 <p>a</p>
1897 <link href="Category:A1"/> <link href="Category:A2"/> <link href="Category:A3"/> <link href="Category:A4"/>
1898 !! end
1899
1900 !! test
1901 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
1902 !! options
1903 parsoid=wt2html
1904 !! wikitext
1905 [[Category:A1]]a
1906 !! html/parsoid
1907 <link href="Category:A1"/><p>a</p>
1908 !! end
1909
1910 ###
1911 ### Preformatted text
1912 ###
1913 !! test
1914 Preformatted text
1915 !! wikitext
1916 This is some
1917 Preformatted text
1918 With ''italic''
1919 And '''bold'''
1920 And a [[Main Page|link]]
1921 !! html
1922 <pre>This is some
1923 Preformatted text
1924 With <i>italic</i>
1925 And <b>bold</b>
1926 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
1927 </pre>
1928 !! end
1929
1930 !! test
1931 Tabs don't trigger preformatted text
1932 !! wikitext
1933 This is not
1934 preformatted text.
1935 This is preformatted text.
1936 So is this.
1937 !! html
1938 <p> This is not
1939 preformatted text.
1940 </p>
1941 <pre>This is preformatted text.
1942 So is this.
1943 </pre>
1944 !! end
1945
1946 !! test
1947 Ident preformatting with inline content
1948 !! wikitext
1949 a
1950 ''b''
1951 !! html
1952 <pre>a
1953 <i>b</i>
1954 </pre>
1955 !! end
1956
1957 !! test
1958 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
1959 !! wikitext
1960 <pre><nowiki>
1961 <b>
1962 <cite>
1963 <em>
1964 </nowiki></pre>
1965 !! html
1966 <pre>
1967 &lt;b&gt;
1968 &lt;cite&gt;
1969 &lt;em&gt;
1970 </pre>
1971
1972 !! end
1973
1974 !! test
1975 Regression with preformatted in <center>
1976 !! wikitext
1977 <center>
1978 Blah
1979 </center>
1980 !! html
1981 <center>
1982 <pre>Blah
1983 </pre>
1984 </center>
1985
1986 !! end
1987
1988 !! test
1989 Bug 52763: Preformatted in <blockquote>
1990 !! wikitext
1991 <blockquote>
1992 Blah
1993 {|
1994 |
1995 indented cell (no pre-wrapping!)
1996 |}
1997 </blockquote>
1998 !! html
1999 <blockquote>
2000 <p> Blah
2001 </p>
2002 <table>
2003 <tr>
2004 <td>
2005 <p> indented cell (no pre-wrapping!)
2006 </p>
2007 </td></tr></table>
2008 </blockquote>
2009
2010 !! end
2011
2012 !! test
2013 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
2014 !! wikitext
2015 <blockquote>
2016 Foo
2017
2018 Bar
2019 </blockquote>
2020 !! html
2021 <blockquote>
2022 <p>Foo
2023 </p><p>Bar
2024 </p>
2025 </blockquote>
2026
2027 !! end
2028
2029 !! test
2030 Bug 15491: <ins>/<del> in blockquote
2031 !! wikitext
2032 <blockquote>
2033 Foo <del>bar</del> <ins>baz</ins> quux
2034 </blockquote>
2035 !! html
2036 <blockquote>
2037 <p>Foo <del>bar</del> <ins>baz</ins> quux
2038 </p>
2039 </blockquote>
2040
2041 !! end
2042
2043 # Note that the p-wrapping is newline sensitive, which could be
2044 # considered a bug: tidy will wrap only the 'Foo' in the example
2045 # below in a <p> tag. (see comment 23-25 of bug #6200)
2046 !! test
2047 Bug 15491: <ins>/<del> in blockquote (2)
2048 !! wikitext
2049 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2050 </blockquote>
2051 !! html
2052 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2053 </blockquote>
2054
2055 !! html+tidy
2056 <blockquote>
2057 <p>Foo</p>
2058 <del>bar</del> <ins>baz</ins> quux</blockquote>
2059 !! end
2060
2061 !! test
2062 <pre> with attributes (bug 3202)
2063 !! wikitext
2064 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2065 !! html
2066 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2067
2068 !! end
2069
2070 !! test
2071 <pre> with width attribute (bug 3202)
2072 !! wikitext
2073 <pre width="8">Narrow screen goodies</pre>
2074 !! html
2075 <pre width="8">Narrow screen goodies</pre>
2076
2077 !! end
2078
2079 !! test
2080 <pre> with forbidden attribute (bug 3202)
2081 !! wikitext
2082 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
2083 !! html
2084 <pre width="8">Narrow screen goodies</pre>
2085
2086 !! end
2087
2088 !! test
2089 Entities inside <pre>
2090 !! wikitext
2091 <pre>&lt;</pre>
2092 !! html
2093 <pre>&lt;</pre>
2094
2095 !! end
2096
2097 !! test
2098 <pre> with forbidden attribute values (bug 3202)
2099 !! wikitext
2100 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
2101 !! html
2102 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
2103
2104 !! end
2105
2106 !! test
2107 <nowiki> inside <pre> (bug 13238)
2108 !! wikitext
2109 <pre>
2110 <nowiki>
2111 </pre>
2112 <pre>
2113 <nowiki></nowiki>
2114 </pre>
2115 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
2116 !! html
2117 <pre>
2118 &lt;nowiki&gt;
2119 </pre>
2120 <pre>
2121
2122 </pre>
2123 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2124
2125 !! end
2126
2127 !! test
2128 <nowiki> and <pre> preference (first one wins)
2129 !! wikitext
2130 <pre>
2131 <nowiki>
2132 </pre>
2133 </nowiki>
2134 </pre>
2135
2136 <nowiki>
2137 <pre>
2138 <nowiki>
2139 </pre>
2140 </nowiki>
2141 </pre>
2142
2143 !! html
2144 <pre>
2145 &lt;nowiki&gt;
2146 </pre>
2147 <p>&lt;/nowiki&gt;
2148 &lt;/pre&gt;
2149 </p><p>
2150 &lt;pre&gt;
2151 &lt;nowiki&gt;
2152 &lt;/pre&gt;
2153
2154 &lt;/pre&gt;
2155 </p>
2156 !! end
2157
2158 !! test
2159 </pre> inside nowiki
2160 !! wikitext
2161 <nowiki></pre></nowiki>
2162 !! html
2163 <p>&lt;/pre&gt;
2164 </p>
2165 !! end
2166
2167 # Parsoid doesn't strip empty tags, like Tidy does.
2168 !! test
2169 Empty pre; pre inside other HTML tags (bug 54946)
2170 !! options
2171 parsoid=wt2html,wt2wt
2172 !! wikitext
2173 a
2174
2175 <div><pre>
2176 foo
2177 </pre></div>
2178 <pre></pre>
2179 !! html/php
2180 <p>a
2181 </p>
2182 <div><pre>
2183 foo
2184 </pre></div>
2185 <pre></pre>
2186
2187 !! html/php+tidy
2188 <p>a</p>
2189 <div>
2190 <pre>
2191 foo
2192 </pre></div>
2193 !! html/parsoid
2194 <p>a</p>
2195
2196 <div><pre>foo
2197 </pre></div>
2198 <pre></pre>
2199 !! end
2200
2201 !! test
2202 HTML pre followed by indent-pre
2203 !! wikitext
2204 <pre>foo</pre>
2205 bar
2206 !! html
2207 <pre>foo</pre>
2208 <pre>bar
2209 </pre>
2210 !! end
2211
2212 !!test
2213 Block tag pre
2214 !!options
2215 parsoid
2216 !! wikitext
2217 <p><pre>foo</pre></p>
2218 !! html
2219 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2220 !!end
2221
2222 !!test
2223 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2224 !! wikitext
2225 {{echo|}}
2226 !! html
2227
2228 !!end
2229
2230 !!test
2231 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2232 !! wikitext
2233 {{echo|
2234 foo}}
2235 !! html
2236 <p>foo
2237 </p>
2238 !!end
2239
2240 !! test
2241 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2242 !! wikitext
2243 {{echo|a
2244 b}}
2245 !! html
2246 <pre>a
2247 </pre>
2248 <p>b
2249 </p>
2250 !!end
2251
2252 !! test
2253 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2254 !! wikitext
2255 {{echo|a
2256 b
2257 c
2258 d
2259 e
2260 }}
2261 !! html
2262 <pre>a
2263 </pre>
2264 <p>b
2265 c
2266 </p>
2267 <pre>d
2268 </pre>
2269 <p>e
2270 </p>
2271 !!end
2272
2273 !!test
2274 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2275 !! wikitext
2276 {{echo| foo}}
2277
2278 {{echo| foo}}{{echo| bar}}
2279
2280 {{echo| foo}}
2281 {{echo| bar}}
2282
2283 {{echo|<!--cmt--> foo}}
2284
2285 <!--cmt-->{{echo| foo}}
2286
2287 {{echo|{{echo| }}bar}}
2288 !! html
2289 <pre>foo
2290 </pre>
2291 <pre>foo bar
2292 </pre>
2293 <pre>foo
2294 bar
2295 </pre>
2296 <pre>foo
2297 </pre>
2298 <pre>foo
2299 </pre>
2300 <pre>bar
2301 </pre>
2302 !!end
2303
2304 !! test
2305 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2306 !! wikitext
2307 {{echo| }}a
2308
2309 {{echo|
2310 }}a
2311
2312 {{echo|
2313 b}}
2314
2315 {{echo|a
2316 }}b
2317
2318 {{echo|a
2319 }} b
2320 !! html
2321 <pre>a
2322 </pre>
2323 <p><br />
2324 </p>
2325 <pre>a
2326 </pre>
2327 <p><br />
2328 </p>
2329 <pre>b
2330 </pre>
2331 <p>a
2332 </p>
2333 <pre>b
2334 </pre>
2335 <p>a
2336 </p>
2337 <pre>b
2338 </pre>
2339 !!end
2340
2341 !! test
2342 Things that look like <pre> tags aren't treated as such
2343 !! wikitext
2344 Barack Obama <President> of the United States
2345 <President></President>
2346 !! html
2347 <p>Barack Obama &lt;President&gt; of the United States
2348 &lt;President&gt;&lt;/President&gt;
2349 </p>
2350 !! end
2351
2352 ## PHP parser discards the "<pre " string
2353 !! test
2354 Handle broken pre-like tags (bug 64025)
2355 !! options
2356 parsoid=wt2html
2357 !! wikitext
2358 {{echo|<pre <pre>x</pre>}}
2359
2360 <table><pre </table>
2361 !! html/php
2362 <pre>x</pre>
2363 <table><pre></pre></table>
2364
2365 !! html/parsoid
2366 <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>
2367
2368
2369 <p>&lt;pre </p>
2370
2371 <table></table>
2372 !! end
2373
2374 !! test
2375 Parsoid: handle pre with space after attribute
2376 !! options
2377 parsoid=wt2html
2378 !! wikitext
2379 <pre style="width:50%;" >{{echo|foo}}</pre>
2380 !! html
2381 <pre style="width:50%;">{{echo|foo}}</pre>
2382 !! end
2383
2384 # TODO / maybe: fix wt2wt for this
2385 !! test
2386 Parsoid: Don't paragraph-wrap fosterable content
2387 !! options
2388 parsoid=wt2html
2389 !! wikitext
2390 {|
2391 <td></td>
2392 <td></td>
2393
2394
2395
2396 |}
2397 !! html
2398 <table>
2399
2400 <tbody>
2401 <tr>
2402 <td></td>
2403
2404 <td></td></tr>
2405
2406
2407
2408 </tbody></table>
2409 !! end
2410
2411 !! test
2412 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2413 !! options
2414 parsoid=wt2html
2415 !! wikitext
2416 {|
2417 <td>
2418 <td>
2419 </td>
2420
2421
2422
2423 |}
2424 !! html
2425 <table>
2426
2427 <tbody>
2428 <tr>
2429 <td></td>
2430
2431 <td>
2432 </td></tr>
2433
2434
2435
2436 </tbody></table>
2437 !! end
2438
2439
2440 #--------------------------------------------------------------------
2441 # Transclusion parameter whitespace stripping tests
2442 # Behavior is different for positional and named parameters
2443 #--------------------------------------------------------------------
2444 !! test
2445 Templates: Strip leading and trailing whitespace from named-param values
2446 !! wikitext
2447 {{echo|1= a }}
2448
2449 {{echo|1= {{echo|b}} }}
2450
2451 {{echo| 1 =
2452 c }}
2453
2454 {{echo| 1 =
2455 * d
2456 }}
2457 !! html
2458 <p>a
2459 </p><p>b
2460 </p><p>c
2461 </p>
2462 <ul><li> d</li></ul>
2463
2464 !! end
2465
2466 !! test
2467 Templates: Don't strip whitespace from positional-param values
2468 !! wikitext
2469 {{echo|a }}
2470
2471 {{echo|{{echo|b}} }}
2472
2473 {{echo| c
2474 }}
2475
2476 {{echo| {{echo|d}}
2477 }}
2478
2479 {{echo|
2480 e}}
2481
2482 {{echo|
2483 * f}}
2484
2485 {{echo|
2486 }}g
2487 !! html
2488 <p>a
2489 </p><p>b
2490 </p>
2491 <pre>c
2492 </pre>
2493 <p><br />
2494 </p>
2495 <pre>d
2496 </pre>
2497 <p><br />
2498 </p>
2499 <pre>e
2500 </pre>
2501 <p><br />
2502 </p>
2503 <ul><li> f</li></ul>
2504 <p><br />
2505 </p>
2506 <pre>g
2507 </pre>
2508 !! end
2509
2510 !! test
2511 Templates: Handle empty comment-and-ws-only lines correctly
2512 !! wikitext
2513 {{echo|foo
2514 <!--should be ignored-->
2515 <!--should be ignored as well-->
2516 bar}}
2517 !! html
2518 <p>foo
2519 bar
2520 </p>
2521 !! end
2522
2523 !! test
2524 Templates: Handle comments in the target
2525 !! wikitext
2526 {{echo
2527 <!-- should be ignored -->
2528 |foo}}
2529
2530 {{echo<!-- should be ignored -->
2531 |foo}}
2532
2533 {{echo<!-- should be ignored -->|foo}}
2534
2535 {{<!-- should be ignored -->echo|foo}}
2536 !!html/parsoid
2537 <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>
2538
2539 <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>
2540
2541 <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>
2542
2543 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2544 !!end
2545
2546 !! test
2547 Templates: Handle comments in parameter names (bug 67657)
2548 !! wikitext
2549 {{echo|1
2550 <!-- should be ignored -->
2551 =foo}}
2552
2553 {{echo|
2554 <!-- should be ignored -->
2555 1 = foo}}
2556
2557 {{echo|1<!-- should be ignored --> = foo}}
2558
2559 {{echo|<!-- should be ignored -->1 = foo}}
2560 !!html/parsoid
2561 <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>
2562
2563 <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>
2564
2565 <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>
2566
2567 <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>
2568 !!end
2569
2570 !! test
2571 Templates: Other wikitext in parameter names (bug 67657)
2572 !! wikitext
2573 {{echo|''1''=foo}}
2574 !!html/parsoid
2575 <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>
2576 !!html/php
2577 <p>{{{1}}}
2578 </p>
2579 !!end
2580
2581 #--------------------------------------------------------------------
2582 # Transclusion parameter escaping tests
2583 #--------------------------------------------------------------------
2584 !! test
2585 Templates: Parsoid parameter escaping test 1
2586 !! options
2587 parsoid
2588 !! wikitext
2589 {{echo|[foo]|{{echo|[bar]}}}}
2590 !! html
2591 <p about="#mwt1" typeof="mw:Transclusion"
2592 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2593 !! end
2594
2595 !! test
2596 Parsoid: Pipes in external links in template parameter
2597 !! options
2598 parsoid
2599 !! wikitext
2600 {{echo|[{{echo|http://example.com}} link]}}
2601 !! html
2602 <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>
2603 !! end
2604
2605 !! test
2606 Parsoid: pipe in transclusion parameter
2607 !! options
2608 parsoid
2609 !! wikitext
2610 {{echo|http://foo.com/a&#124;b}}
2611 !! html
2612 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2613 typeof="mw:Transclusion"
2614 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>
2615 !! end
2616
2617 !! test
2618 Parsoid: Pipe in external link target and content in template parameter
2619 !! options
2620 parsoid=html2wt,wt2wt
2621 !! wikitext
2622 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2623 !! html
2624 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2625 typeof="mw:Transclusion"
2626 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2627 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2628 !! end
2629
2630 !! test
2631 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2632 !! options
2633 parsoid
2634 !! wikitext
2635 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2636 !! html
2637 <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>
2638 !! end
2639
2640 !! test
2641 Templates: Don't escape already nowiki-escaped text in template parameters
2642 !! options
2643 parsoid=html2wt,wt2wt
2644 !! wikitext
2645 {{echo|foo<nowiki>|</nowiki>bar}}
2646 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2647 {{echo|<nowiki></nowiki>}}
2648 !! html
2649 <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>
2650 <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>
2651 <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>
2652 </p>
2653 !! end
2654
2655 ## Bug 52824
2656 !! test
2657 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2658 !! options
2659 parsoid=html2wt,wt2wt
2660 !! wikitext
2661 {{echo|{{echo|1=bar}}}}
2662 !! html
2663 <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>
2664 !! end
2665
2666 ## Bug 56733
2667 !! test
2668 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2669 !! options
2670 parsoid
2671 !! wikitext
2672 {{echo|a : b}}
2673 !! html
2674 <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:Placeholder" data-parsoid='{"isDisplayHack":true}'> </span>: b</p>
2675 !! end
2676
2677 ## Bug T73412
2678 !! test
2679 Templates: Preserve blank parameter names
2680 !! wikitext
2681 {{echo|=foo}}
2682 !! html/php
2683 <p>{{{1}}}
2684 </p>
2685 !! html/parsoid
2686 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2687 !! end
2688
2689 ###
2690 ### Parsoid-centric tests for testing RT edge cases for pre
2691 ###
2692
2693 !!test
2694 1a. Indent-Pre and Comments
2695 !! wikitext
2696 a
2697 <!--a-->
2698 c
2699 !! html
2700 <pre>a
2701 </pre>
2702 <p>c
2703 </p>
2704 !!end
2705
2706 !!test
2707 1b. Indent-Pre and Comments
2708 !! wikitext
2709 a
2710 <!--a-->
2711 c
2712 !! html
2713 <pre>a
2714 </pre>
2715 <p>c
2716 </p>
2717 !!end
2718
2719 !!test
2720 1c. Indent-Pre and Comments
2721 !! wikitext
2722 <!--a--> a
2723
2724 <!--a--> a
2725 !! html
2726 <pre> a
2727 </pre>
2728 <pre> a
2729 </pre>
2730 !!end
2731
2732 !!test
2733 1d. Indent-Pre and Comments
2734 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2735 !! wikitext
2736 <!--a--> a
2737
2738 <!--b-->b
2739 !! html
2740 <pre>a
2741 </pre>
2742 <pre>b
2743 </pre>
2744 !!end
2745
2746 !!test
2747 2a. Indent-Pre and tables
2748 !! wikitext
2749 {|
2750 |-
2751 !h1!!h2
2752 |foo||bar
2753 |}
2754 !! html
2755 <table>
2756
2757 <tr>
2758 <th>h1</th>
2759 <th>h2
2760 </th>
2761 <td>foo</td>
2762 <td>bar
2763 </td></tr></table>
2764
2765 !!end
2766
2767 !!test
2768 2b. Indent-Pre and tables
2769 !! wikitext
2770 {|
2771 |-
2772 |foo
2773 |}
2774 !! html
2775 <table>
2776
2777 <tr>
2778 <td>foo
2779 </td></tr></table>
2780
2781 !!end
2782
2783 !!test
2784 2c. Indent-Pre and tables (bug 42252)
2785 !! wikitext
2786 {|
2787 |+ foo
2788 ! | bar
2789 |}
2790 !! html
2791 <table>
2792 <caption> foo
2793 </caption>
2794 <tr>
2795 <th> bar
2796 </th></tr></table>
2797
2798 !!end
2799
2800 !!test
2801 2d. Indent-Pre and tables
2802 !! wikitext
2803 a
2804 {|
2805 | b
2806 |}
2807 !! html/php
2808 <pre>a
2809 </pre>
2810 <table>
2811 <tr>
2812 <td> b
2813 </td></tr></table>
2814
2815 !! html/parsoid
2816 <pre>a</pre>
2817 <table>
2818 <tbody><tr><td> b</td></tr>
2819 </tbody></table>
2820 !!end
2821
2822 !!test
2823 2e. Indent-Pre and table-line syntax
2824 !! wikitext
2825 a
2826 | b
2827 | c
2828 !! html/php
2829 <pre>a
2830 | b
2831 | c
2832 </pre>
2833 !!end
2834
2835 !!test
2836 2f. Indent-pre started by table-line syntax
2837 !! wikitext
2838 a
2839 | b
2840 | c
2841 !! html/php
2842 <p>a
2843 </p>
2844 <pre>| b
2845 | c
2846 </pre>
2847 !! html/parsoid
2848 <p>a</p>
2849 <pre>
2850 | b
2851 | c</pre>
2852 !!end
2853
2854 !!test
2855 3a. Indent-Pre and block tags (single-line html)
2856 !! wikitext
2857 a <p> foo </p>
2858 b <div> foo </div>
2859 c <blockquote> foo </blockquote>
2860 <span> foo </span>
2861 !! html
2862 a <p> foo </p>
2863 b <div> foo </div>
2864 c <blockquote> foo </blockquote>
2865 <pre><span> foo </span>
2866 </pre>
2867 !! html/parsoid
2868 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
2869 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
2870 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
2871 <pre><span> foo </span>
2872 </pre>
2873 !! html+tidy
2874 <p>a</p>
2875 <p>foo</p>
2876 <p>b</p>
2877 <div>foo</div>
2878 <p>c</p>
2879 <blockquote>
2880 <p>foo</p>
2881 </blockquote>
2882 <pre>
2883 <span> foo </span>
2884 </pre>
2885 !! end
2886
2887 !!test
2888 3b. Indent-Pre and block tags (multi-line html)
2889 !! wikitext
2890 a <span>foo</span>
2891 b <div> foo </div>
2892 !! html
2893 <pre>a <span>foo</span>
2894 </pre>
2895 b <div> foo </div>
2896
2897 !! html/parsoid
2898 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
2899 b <div data-parsoid='{"stx":"html"}'> foo </div>
2900 !! html+tidy
2901 <pre>
2902 a <span>foo</span>
2903 </pre>
2904 <p>b</p>
2905 <div>foo</div>
2906 !!end
2907
2908 !!test
2909 3c. Indent-Pre and block tags (pre-content on separate line)
2910 !! wikitext
2911 <p>
2912 foo
2913 </p>
2914
2915 <div>
2916 foo
2917 </div>
2918
2919 <center>
2920 foo
2921 </center>
2922
2923 <blockquote>
2924 foo
2925 </blockquote>
2926
2927 <blockquote>
2928 <pre>
2929 foo
2930 </pre>
2931 </blockquote>
2932
2933 <table><tr><td>
2934 foo
2935 </td></tr></table>
2936
2937 <ul><li>
2938 foo
2939 </li></ul>
2940
2941 !! html
2942 <p>
2943 foo
2944 </p>
2945 <div>
2946 <pre>foo
2947 </pre>
2948 </div>
2949 <center>
2950 <pre>foo
2951 </pre>
2952 </center>
2953 <blockquote>
2954 <p> foo
2955 </p>
2956 </blockquote>
2957 <blockquote>
2958 <pre>
2959 foo
2960 </pre>
2961 </blockquote>
2962 <table><tr><td>
2963 <pre>foo
2964 </pre>
2965 </td></tr></table>
2966 <ul><li>
2967 foo
2968 </li></ul>
2969
2970 !!end
2971
2972 !!test
2973 4. Indent-Pre and extension tags
2974 !! wikitext
2975 a <gallery>
2976 File:foobar.jpg
2977 </gallery>
2978 !! html
2979 a <ul class="gallery mw-gallery-traditional">
2980 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
2981 <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>
2982 <div class="gallerytext">
2983 </div>
2984 </div></li>
2985 </ul>
2986
2987 !! html+tidy
2988 <p>a</p>
2989 <ul class="gallery mw-gallery-traditional">
2990 <li class="gallerybox" style="width: 155px">
2991 <div style="width: 155px">
2992 <div class="thumb" style="width: 150px;">
2993 <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>
2994 </div>
2995 <div class="gallerytext"></div>
2996 </div>
2997 </li>
2998 </ul>
2999 !!end
3000
3001 !! test
3002 Table wikitext syntax outside wiki-tables
3003 !! wikitext
3004 a
3005 ! not a table heading
3006 |- not a table row
3007 | not a table cell
3008 | class="foo bar" | baz
3009 b
3010 |}
3011 |-
3012 c
3013 !! html
3014 <p>a
3015 ! not a table heading
3016 |- not a table row
3017 | not a table cell
3018 | class="foo bar" | baz
3019 b
3020 |}
3021 |-
3022 c
3023 </p>
3024 !! end
3025
3026 !!test
3027 Render paragraphs when indent-pre is suppressed in blocklevels
3028 !! wikitext
3029 <blockquote>
3030 foo
3031
3032 bar
3033 </blockquote>
3034 !! html
3035 <blockquote>
3036 <p> foo
3037 </p><p> bar
3038 </p>
3039 </blockquote>
3040
3041 !!end
3042
3043 !!test
3044 4. Multiple spaces at start-of-line
3045 !! wikitext
3046 <p> foo </p>
3047 foo
3048 {|
3049 |foo
3050 |}
3051 !! html
3052 <p> foo </p>
3053 <pre> foo
3054 </pre>
3055 <table>
3056 <tr>
3057 <td>foo
3058 </td></tr></table>
3059
3060 !!end
3061
3062 ## NOTE: the leading white-space chars on empty line are significant
3063 !! test
3064 5a. White-space in indent-pre
3065 !! wikitext
3066 a<br />
3067
3068 b
3069 !! html
3070 <pre>a<br />
3071
3072 b
3073 </pre>
3074 !! end
3075
3076 ## NOTE: the leading white-space chars on empty line are significant
3077 !! test
3078 5b. White-space in indent-pre
3079 !! wikitext
3080 a
3081
3082 b
3083
3084
3085 c
3086 !! html
3087 <pre>a
3088
3089 b
3090
3091
3092 c
3093 </pre>
3094 !! end
3095
3096 !! test
3097 5c. White-space in indent-pre
3098 !! wikitext
3099 ''a''
3100 ''b''
3101 ''c''
3102 !! html
3103 <pre><i>a</i>
3104 <i>b</i>
3105 <i>c</i>
3106 </pre>
3107 !! end
3108
3109 !! test
3110 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3111 !! wikitext
3112 a
3113
3114 <!-- continue -->
3115 b
3116
3117 c
3118
3119 d
3120 !! html
3121 <pre>a
3122
3123 b
3124 </pre>
3125 <pre>c
3126
3127 </pre>
3128 <p>d
3129 </p>
3130 !! end
3131
3132 !! test
3133 7a. Indent-pre and category links
3134 !! options
3135 parsoid=wt2html,wt2wt
3136 !! wikitext
3137 [[Category:foo]] <!-- No pre-wrapping -->
3138 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3139 !! html
3140 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre-wrapping -->
3141 <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-wrapping -->
3142 !! end
3143
3144 !! test
3145 7b. Indent-pre and category links
3146 !! options
3147 parsoid=wt2html,wt2wt
3148 !! wikitext
3149 [[Category:foo]] a
3150 [[Category:foo]] {{echo|b}}
3151 !! html
3152 <pre>
3153 <link rel="mw:PageProp/Category" href="./Category:Foo"> a
3154 <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>
3155 !! end
3156
3157 ###
3158 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3159 ###
3160
3161 !!test
3162 HTML-pre: 1. embedded newlines
3163 !! wikitext
3164 <pre>foo</pre>
3165
3166 <pre>
3167 foo
3168 </pre>
3169
3170 <pre>
3171
3172 foo
3173 </pre>
3174
3175 <pre>
3176
3177
3178 foo
3179 </pre>
3180 !! html
3181 <pre>foo</pre>
3182 <pre>
3183 foo
3184 </pre>
3185 <pre>
3186
3187 foo
3188 </pre>
3189 <pre>
3190
3191
3192 foo
3193 </pre>
3194
3195 !! html/parsoid
3196 <pre data-parsoid='{"stx":"html"}'>foo</pre>
3197
3198 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
3199 foo
3200 </pre>
3201
3202 <pre data-parsoid='{"stx":"html"}'>
3203
3204 foo
3205 </pre>
3206
3207 <pre data-parsoid='{"stx":"html"}'>
3208
3209
3210 foo
3211 </pre>
3212 !!end
3213
3214 !! test
3215 HTML-pre: big spaces
3216 !! wikitext
3217 <pre>
3218
3219
3220
3221
3222 haha
3223
3224
3225
3226
3227 haha
3228
3229
3230
3231
3232 </pre>
3233 !! html
3234 <pre>
3235
3236
3237
3238
3239 haha
3240
3241
3242
3243
3244 haha
3245
3246
3247
3248
3249 </pre>
3250
3251 !! html/parsoid
3252 <pre data-parsoid='{"stx":"html"}'>
3253
3254
3255
3256
3257 haha
3258
3259
3260
3261
3262 haha
3263
3264
3265
3266
3267 </pre>
3268 !! end
3269
3270 !!test
3271 HTML-pre: 2: indented text
3272 !! wikitext
3273 <pre>
3274 foo
3275 </pre>
3276 !! html
3277 <pre>
3278 foo
3279 </pre>
3280
3281 !!end
3282
3283 !!test
3284 HTML-pre: 3: other wikitext
3285 !! wikitext
3286 <pre>
3287 * foo
3288 # bar
3289 = no-h =
3290 '' no-italic ''
3291 [[ NoLink ]]
3292 </pre>
3293 !! html
3294 <pre>
3295 * foo
3296 # bar
3297 = no-h =
3298 '' no-italic ''
3299 [[ NoLink ]]
3300 </pre>
3301
3302 !!end
3303
3304 ###
3305 ### Definition lists
3306 ###
3307 !! test
3308 Simple definition
3309 !! wikitext
3310 ; name : Definition
3311 !! html
3312 <dl><dt> name&#160;</dt>
3313 <dd> Definition</dd></dl>
3314
3315 !! end
3316
3317 !! test
3318 Definition list for indentation only
3319 !! wikitext
3320 : Indented text
3321 !! html
3322 <dl><dd> Indented text</dd></dl>
3323
3324 !! end
3325
3326 !! test
3327 Definition list with no space
3328 !! wikitext
3329 ;name:Definition
3330 !! html
3331 <dl><dt>name</dt>
3332 <dd>Definition</dd></dl>
3333
3334 !!end
3335
3336 !! test
3337 Definition list with URL link
3338 !! wikitext
3339 ; http://example.com/ : definition
3340 !! html
3341 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3342 <dd> definition</dd></dl>
3343
3344 !! end
3345
3346 !! test
3347 Definition list with bracketed URL link
3348 !! wikitext
3349 ;[http://www.example.com/ Example]:Something about it
3350 !! html
3351 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3352 <dd>Something about it</dd></dl>
3353
3354 !! end
3355
3356 !! test
3357 Definition list with wikilink containing colon
3358 !! wikitext
3359 ; [[Help:FAQ]]: The least-read page on Wikipedia
3360 !! html
3361 <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>
3362 <dd> The least-read page on Wikipedia</dd></dl>
3363
3364 !! end
3365
3366 # At Brion's and JeLuF's insistence... :)
3367 !! test
3368 Definition list with news link containing colon
3369 !! wikitext
3370 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
3371 !! html/php
3372 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3373 <dd> This isn't even a real newsgroup!</dd></dl>
3374
3375 !! html/parsoid
3376 <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>
3377 !! end
3378
3379 !! test
3380 Malformed definition list with colon
3381 !! wikitext
3382 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3383 !! html
3384 <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>
3385
3386 !! end
3387
3388 !! test
3389 Definition lists: colon in external link text
3390 !! wikitext
3391 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3392 !! html
3393 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3394 <dd> OK, I made that up</dd></dl>
3395
3396 !! end
3397
3398 !! test
3399 Definition lists: colon in HTML attribute
3400 !! wikitext
3401 ;<b style="display: inline">bold</b>
3402 !! html
3403 <dl><dt><b style="display: inline">bold</b></dt></dl>
3404
3405 !! end
3406
3407 !! test
3408 Definition lists: self-closed tag
3409 !! wikitext
3410 ;one<br/>two : two-line fun
3411 !! html
3412 <dl><dt>one<br />two&#160;</dt>
3413 <dd> two-line fun</dd></dl>
3414
3415 !! end
3416
3417 !! test
3418 Bug 11748: Literal closing tags
3419 !! wikitext
3420 <dl>
3421 <dt>test 1</dt>
3422 <dd>test test test test test</dd>
3423 <dt>test 2</dt>
3424 <dd>test test test test test</dd>
3425 </dl>
3426 !! html
3427 <dl>
3428 <dt>test 1</dt>
3429 <dd>test test test test test</dd>
3430 <dt>test 2</dt>
3431 <dd>test test test test test</dd>
3432 </dl>
3433
3434 !! end
3435
3436 !! test
3437 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3438 !! wikitext
3439 <ul><li>
3440 ; term : description
3441 * unordered
3442 </li></ul>
3443 !! html
3444 <ul><li>
3445 <dl><dt> term&#160;</dt>
3446 <dd> description</dd></dl>
3447 <ul><li> unordered</li></ul>
3448 </li></ul>
3449
3450 !! end
3451
3452 !! test
3453
3454 Definition list with empty definition and following paragraph
3455 !! wikitext
3456 ; term:
3457 Paragraph text
3458 !! html
3459 <dl><dt> term</dt>
3460 <dd></dd></dl>
3461 <p>Paragraph text
3462 </p>
3463 !! end
3464
3465 !! test
3466 Nested definition lists using html syntax
3467 !! wikitext
3468 <dl><dt>x</dt>
3469 <dd>a</dd>
3470 <dd>b</dd></dl>
3471
3472 !! end
3473
3474 !! test
3475 Definition Lists: No nesting: Multiple dd's
3476 !! wikitext
3477 ;x
3478 :a
3479 :b
3480 !! html
3481 <dl><dt>x</dt>
3482 <dd>a</dd>
3483 <dd>b</dd></dl>
3484
3485 !! end
3486
3487 !! test
3488 Definition Lists: Indentation: Regular
3489 !! wikitext
3490 :i1
3491 ::i2
3492 :::i3
3493 !! html
3494 <dl><dd>i1
3495 <dl><dd>i2
3496 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3497
3498 !! end
3499
3500 !! test
3501 Definition Lists: Indentation: Missing 1st level
3502 !! wikitext
3503 ::i2
3504 :::i3
3505 !! html
3506 <dl><dd><dl><dd>i2
3507 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3508
3509 !! end
3510
3511 !! test
3512 Definition Lists: Indentation: Multi-level indent
3513 !! wikitext
3514 :::i3
3515 !! html
3516 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3517
3518 !! end
3519
3520 !! test
3521 Definition Lists: Hacky use to indent tables
3522 !! wikitext
3523 ::{|
3524 |foo
3525 |bar
3526 |}
3527 this text
3528 should be left alone
3529 !! html
3530 <dl><dd><dl><dd><table>
3531 <tr>
3532 <td>foo
3533 </td>
3534 <td>bar
3535 </td></tr></table></dd></dl></dd></dl>
3536 <p>this text
3537 should be left alone
3538 </p>
3539 !! end
3540
3541 !! test
3542 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3543 !! wikitext
3544 <!-- foo -->
3545 ::{|
3546 |foo
3547 |bar
3548 |}<!-- bar -->
3549 this text
3550 should be left alone
3551 !! html/parsoid
3552 <!-- foo -->
3553 <dl><dd><dl><dd><table><tr>
3554 <td>foo</td>
3555 <td>bar</td>
3556 </tr></table><!-- bar --></dd></dl></dd></dl>
3557 <p>this text
3558 should be left alone</p>
3559 !! end
3560
3561 !! test
3562 Definition Lists: Hacky use to indent tables, with comment before table
3563 !! wikitext
3564 ::<!-- foo -->{|
3565 |foo
3566 |}
3567 !! html/parsoid
3568 <dl><dd><dl><dd><!-- foo --><table><tr>
3569 <td>foo</td>
3570 </tr></table></dd></dl></dd></dl>
3571 !! end
3572
3573 # Bug 52473
3574 !! test
3575 Definition Lists: Hacky use to indent tables (WS-insensitive)
3576 !! options
3577 parsoid
3578 !! wikitext
3579 : {|
3580 |a
3581 |}
3582 !! html
3583 <dl>
3584 <dd> <table><tr><td>a</td></tr></table> </dd>
3585 </dl>
3586 !! end
3587 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3588 ## as an empty dt item. It also ignores all but the last ";" when followed
3589 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3590 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3591 ## ";"s.
3592 ##
3593 ## Ex: ";;t2 ::d2" is transformed into:
3594 ##
3595 ## <dl>
3596 ## <dt>t2 </dt>
3597 ## <dd>
3598 ## <dl>
3599 ## <dt></dt>
3600 ## <dd>d2</dd>
3601 ## </dl>
3602 ## </dd>
3603 ## </dl>
3604 ##
3605 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3606 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3607 ##
3608 ## <dl>
3609 ## <dt>
3610 ## <dl>
3611 ## <dt>t2 </dt>
3612 ## <dd>:d2</dd>
3613 ## </dl>
3614 ## </dt>
3615 ## </dl>
3616 ##
3617 ## All Parsoid only definition list tests have this difference.
3618 ##
3619 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
3620 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3621
3622 !! test
3623 Table / list interaction: indented table with lists in table contents
3624 !! wikitext
3625 :{|
3626 |-
3627 | a
3628 * b
3629 |-
3630 | c
3631 * d
3632 |}
3633 !! html
3634 <dl><dd><table>
3635
3636 <tr>
3637 <td> a
3638 <ul><li> b</li></ul>
3639 </td></tr>
3640 <tr>
3641 <td> c
3642 <ul><li> d</li></ul>
3643 </td></tr></table></dd></dl>
3644
3645 !! end
3646
3647 !!test
3648 Table / list interaction: lists nested in tables nested in indented lists
3649 !! wikitext
3650 :{|
3651 |
3652 :a
3653 :b
3654 |
3655 *c
3656 *d
3657 |}
3658
3659 *e
3660 *f
3661 !! html
3662 <dl><dd><table>
3663 <tr>
3664 <td>
3665 <dl><dd>a</dd>
3666 <dd>b</dd></dl>
3667 </td>
3668 <td>
3669 <ul><li>c</li>
3670 <li>d</li></ul>
3671 </td></tr></table></dd></dl>
3672 <ul><li>e</li>
3673 <li>f</li></ul>
3674
3675 !!end
3676
3677 !! test
3678 Definition Lists: Nesting: Multi-level (Parsoid only)
3679 !! options
3680 parsoid
3681 !! wikitext
3682 ;t1 :d1
3683 ;;t2 ::d2
3684 ;;;t3 :::d3
3685 !! html
3686 <dl>
3687 <dt>t1 </dt>
3688 <dd>d1</dd>
3689 <dt>
3690 <dl>
3691 <dt>t2 </dt>
3692 <dd>:d2</dd>
3693 <dt>
3694 <dl>
3695 <dt>t3 </dt>
3696 <dd>::d3</dd>
3697 </dl>
3698 </dt>
3699 </dl>
3700 </dt>
3701 </dl>
3702
3703
3704 !! end
3705
3706
3707 !! test
3708 Definition Lists: Nesting: Test 2 (Parsoid only)
3709 !! options
3710 parsoid
3711 !! wikitext
3712 ;t1
3713 ::d2
3714 !! html
3715 <dl>
3716 <dt>t1</dt>
3717 <dd>
3718 <dl>
3719 <dd>d2</dd>
3720 </dl>
3721 </dd>
3722 </dl>
3723
3724 !! end
3725
3726
3727 !! test
3728 Definition Lists: Nesting: Test 3 (Parsoid only)
3729 !! options
3730 parsoid
3731 !! wikitext
3732 :;t1
3733 ::::d2
3734 !! html
3735 <dl>
3736 <dd>
3737 <dl>
3738 <dt>t1</dt>
3739 <dd>
3740 <dl>
3741 <dd>
3742 <dl>
3743 <dd>d2</dd>
3744 </dl>
3745 </dd>
3746 </dl>
3747 </dd>
3748 </dl>
3749 </dd>
3750 </dl>
3751
3752 !! end
3753
3754
3755 !! test
3756 Definition Lists: Nesting: Test 4
3757 !! wikitext
3758 ::;t3
3759 :::d3
3760 !! html
3761 <dl><dd><dl><dd><dl><dt>t3</dt>
3762 <dd>d3</dd></dl></dd></dl></dd></dl>
3763
3764 !! end
3765
3766
3767 ## The Parsoid team believes the following three test exposes a
3768 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
3769 ## wrong to close the <dl> after the <dt> containing the <ul>.)
3770 ## It also exposes a "misfeature" in tidy, which doesn't like
3771 ## <dl> tags with a single <dt> child; it converts the <dt> into
3772 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
3773 !! test
3774 Definition Lists: Mixed Lists: Test 1
3775 !! wikitext
3776 :;* foo
3777 ::* bar
3778 :; baz
3779 !! html/php
3780 <dl><dd><dl><dt><ul><li> foo</li>
3781 <li> bar</li></ul></dt></dl>
3782 <dl><dt> baz</dt></dl></dd></dl>
3783
3784 !! html/php+tidy
3785 <dl>
3786 <dd>
3787 <dl>
3788 <dd>
3789 <ul>
3790 <li>foo</li>
3791 <li>bar</li>
3792 </ul>
3793 </dd>
3794 </dl>
3795 <dl>
3796 <dt>baz</dt>
3797 </dl>
3798 </dd>
3799 </dl>
3800 !! html/parsoid
3801 <dl>
3802 <dd><dl>
3803 <dt><ul>
3804 <li> foo
3805 </li>
3806 </ul></dt>
3807 <dd><ul>
3808 <li> bar
3809 </li>
3810 </ul></dd>
3811 <dt> baz</dt>
3812 </dl></dd>
3813 </dl>
3814 !! end
3815
3816 !! test
3817 Definition Lists: Mixed Lists: Test 2
3818 !! wikitext
3819 *: d1
3820 *: d2
3821 !! html
3822 <ul><li><dl><dd> d1</dd>
3823 <dd> d2</dd></dl></li></ul>
3824
3825 !! end
3826
3827
3828 !! test
3829 Definition Lists: Mixed Lists: Test 3
3830 !! wikitext
3831 *::: d1
3832 *::: d2
3833 !! html
3834 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
3835 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
3836
3837 !! end
3838
3839
3840 !! test
3841 Definition Lists: Mixed Lists: Test 4
3842 !! wikitext
3843 *;d1 :d2
3844 *;d3 :d4
3845 !! html
3846 <ul><li><dl><dt>d1&#160;</dt>
3847 <dd>d2</dd>
3848 <dt>d3&#160;</dt>
3849 <dd>d4</dd></dl></li></ul>
3850
3851 !! end
3852
3853
3854 !! test
3855 Definition Lists: Mixed Lists: Test 5
3856 !! wikitext
3857 *:d1
3858 *:: d2
3859 !! html
3860 <ul><li><dl><dd>d1
3861 <dl><dd> d2</dd></dl></dd></dl></li></ul>
3862
3863 !! end
3864
3865
3866 !! test
3867 Definition Lists: Mixed Lists: Test 6
3868 !! wikitext
3869 #*:d1
3870 #*::: d3
3871 !! html
3872 <ol><li><ul><li><dl><dd>d1
3873 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
3874
3875 !! end
3876
3877
3878 !! test
3879 Definition Lists: Mixed Lists: Test 7
3880 !! wikitext
3881 :* d1
3882 :* d2
3883 !! html
3884 <dl><dd><ul><li> d1</li>
3885 <li> d2</li></ul></dd></dl>
3886
3887 !! end
3888
3889
3890 !! test
3891 Definition Lists: Mixed Lists: Test 8
3892 !! wikitext
3893 :* d1
3894 ::* d2
3895 !! html
3896 <dl><dd><ul><li> d1</li></ul>
3897 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
3898
3899 !! end
3900
3901
3902 !! test
3903 Definition Lists: Mixed Lists: Test 9
3904 !! wikitext
3905 *;foo :bar
3906 !! html
3907 <ul><li><dl><dt>foo&#160;</dt>
3908 <dd>bar</dd></dl></li></ul>
3909
3910 !! end
3911
3912
3913 !! test
3914 Definition Lists: Mixed Lists: Test 10
3915 !! wikitext
3916 *#;foo :bar
3917 !! html
3918 <ul><li><ol><li><dl><dt>foo&#160;</dt>
3919 <dd>bar</dd></dl></li></ol></li></ul>
3920
3921 !! end
3922
3923 # The Parsoid team disagrees with the PHP parser's seemingly-random
3924 # rules regarding dd/dt on the next two tests. Parsoid is more
3925 # consistent, and recognizes the shared nesting and keeps the
3926 # still-open tags around until the nesting is complete.
3927 # (And tidy again converts <dt> to <dd> before 'bar'.)
3928
3929 !! test
3930 Definition Lists: Mixed Lists: Test 11
3931 !! wikitext
3932 *#*#;*;;foo :bar
3933 *#*#;boo :baz
3934 !! html/php
3935 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
3936 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
3937 <dl><dt>boo&#160;</dt>
3938 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
3939
3940 !! html/php+tidy
3941 <ul>
3942 <li>
3943 <ol>
3944 <li>
3945 <ul>
3946 <li>
3947 <ol>
3948 <li>
3949 <dl>
3950 <dt>foo&#160;</dt>
3951 <dd>
3952 <ul>
3953 <li>
3954 <dl>
3955 <dd>
3956 <dl>
3957 <dt>bar</dt>
3958 </dl>
3959 </dd>
3960 </dl>
3961 </li>
3962 </ul>
3963 </dd>
3964 </dl>
3965 <dl>
3966 <dt>boo&#160;</dt>
3967 <dd>baz</dd>
3968 </dl>
3969 </li>
3970 </ol>
3971 </li>
3972 </ul>
3973 </li>
3974 </ol>
3975 </li>
3976 </ul>
3977 !! html/parsoid
3978 <ul>
3979 <li>
3980 <ol>
3981 <li>
3982 <ul>
3983 <li>
3984 <ol>
3985 <li>
3986 <dl>
3987 <dt>
3988 <ul>
3989 <li>
3990 <dl>
3991 <dt>
3992 <dl>
3993 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3994 <dd data-parsoid='{"stx":"row"}'>bar</dd>
3995 </dl></dt>
3996 </dl></li>
3997 </ul></dt>
3998 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3999 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4000 </dl></li>
4001 </ol></li>
4002 </ul></li>
4003 </ol></li>
4004 </ul>
4005 !! end
4006
4007
4008 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
4009 !! test
4010 Definition Lists: Weird Ones: Test 1
4011 !! wikitext
4012 *#;*::;; foo : bar (who uses this?)
4013 !! html/php
4014 <ul><li><ol><li><dl><dt> foo&#160;</dt>
4015 <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>
4016
4017 !! html/php+tidy
4018 <ul>
4019 <li>
4020 <ol>
4021 <li>
4022 <dl>
4023 <dt>foo&#160;</dt>
4024 <dd>
4025 <ul>
4026 <li>
4027 <dl>
4028 <dd>
4029 <dl>
4030 <dd>
4031 <dl>
4032 <dd>
4033 <dl>
4034 <dt>bar (who uses this?)</dt>
4035 </dl>
4036 </dd>
4037 </dl>
4038 </dd>
4039 </dl>
4040 </dd>
4041 </dl>
4042 </li>
4043 </ul>
4044 </dd>
4045 </dl>
4046 </li>
4047 </ol>
4048 </li>
4049 </ul>
4050 !! html/parsoid
4051 <ul>
4052 <li>
4053 <ol>
4054 <li>
4055 <dl>
4056 <dt>
4057 <ul>
4058 <li>
4059 <dl>
4060 <dd>
4061 <dl>
4062 <dd>
4063 <dl>
4064 <dt>
4065 <dl>
4066 <dt> foo<span typeof="mw:Placeholder">&nbsp;</span></dt>
4067 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
4068 </dl></dt>
4069 </dl></dd>
4070 </dl></dd>
4071 </dl></li>
4072 </ul></dt>
4073 </dl></li>
4074 </ol></li>
4075 </ul>
4076 !! end
4077
4078 !! test
4079 Definition Lists: colons occurring in tags
4080 !! wikitext
4081 ;a:b
4082 ;'''a:b'''
4083 ;<i>a:b</i>
4084 ;<span>a:b</span>
4085 ;<div>a:b</div>
4086 ;<div>a
4087 :b</div>
4088 ;{{echo|a:b}}
4089 ;{{echo|''a:b''}}
4090 ;;;''a:b''
4091 !! html+tidy
4092 <dl>
4093 <dt>a</dt>
4094 <dd>b</dd>
4095 <dt><b>a:b</b></dt>
4096 <dt><i>a:b</i></dt>
4097 <dt><span>a:b</span></dt>
4098 <dd>
4099 <div>a:b</div>
4100 </dd>
4101 <dd>
4102 <div>a
4103 <dl>
4104 <dd>b</dd>
4105 </dl>
4106 </div>
4107 </dd>
4108 <dt>a</dt>
4109 <dd>b</dd>
4110 <dt><i>a:b</i></dt>
4111 </dl>
4112 <dl>
4113 <dd>
4114 <dl>
4115 <dd>
4116 <dl>
4117 <dt><i>a:b</i></dt>
4118 </dl>
4119 </dd>
4120 </dl>
4121 </dd>
4122 </dl>
4123 !! end
4124
4125 !! test
4126 Definition Lists: colons and tables 1
4127 !! wikitext
4128 :{|
4129 | x
4130 |}
4131 :{|
4132 | y
4133 |}
4134 !! html
4135 <dl><dd><table>
4136 <tr>
4137 <td> x
4138 </td></tr></table></dd></dl>
4139 <dl><dd><table>
4140 <tr>
4141 <td> y
4142 </td></tr></table></dd></dl>
4143
4144 !! end
4145
4146 # Parsoid's output (as documented below) differs from php's in this case.
4147 # This is probably a bug. If we fixup parsoid to match php's output, the
4148 # above test should pass and the below test case can be removed. It is
4149 # unclear which output is more desirable.
4150
4151 !! test
4152 Definition Lists: colons and tables 2
4153 !! wikitext
4154 :{|
4155 | x
4156 |}
4157 :{|
4158 | y
4159 |}
4160 !! html/parsoid
4161 <dl><dd><table>
4162 <tr>
4163 <td> x
4164 </td></tr></table></dd>
4165 <dd><table>
4166 <tr>
4167 <td> y
4168 </td></tr></table></dd></dl>
4169 !! end
4170
4171 !! test
4172 Definition Lists: template interaction
4173 !! wikitext
4174 ::{{definition_list}}
4175
4176 :one
4177 ::{{definition_list}}
4178 :::two
4179 :::three
4180 ::four
4181 !! html/parsoid
4182 <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">
4183 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4184
4185 <dl><dd data-parsoid='{}'>one
4186 <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">
4187 </span><dd about="#mwt2">two
4188 <dl><dd>two</dd>
4189 <dd>three</dd></dl></dd>
4190 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4191 !! end
4192
4193
4194 ###
4195 ### External links
4196 ###
4197 !! test
4198 External links: non-bracketed
4199 !! wikitext
4200 Non-bracketed: http://example.com
4201 !! html
4202 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4203 </p>
4204 !! end
4205
4206 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4207 !! test
4208 External links: numbered
4209 !! wikitext
4210 Numbered: [http://example.com]
4211 Numbered: [http://example.net]
4212 Numbered: [http://example.com]
4213 !! html/php
4214 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4215 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4216 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4217 </p>
4218 !! html/parsoid
4219 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
4220 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
4221 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
4222 !!end
4223
4224 !! test
4225 External links: specified text
4226 !! wikitext
4227 Specified text: [http://example.com link]
4228 !! html
4229 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4230 </p>
4231 !!end
4232
4233 !! test
4234 External links: trail
4235 !! wikitext
4236 Linktrails should not work for external links: [http://example.com link]s
4237 !! html
4238 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4239 </p>
4240 !! end
4241
4242 !! test
4243 External links: dollar sign in URL
4244 !! wikitext
4245 http://example.com/1$2345
4246 !! html
4247 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4248 </p>
4249 !! end
4250
4251 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4252 !! test
4253 External links: dollar sign in URL (autonumber)
4254 !! wikitext
4255 [http://example.com/1$2345]
4256 !! html/php
4257 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4258 </p>
4259 !! html/parsoid
4260 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4261 !!end
4262
4263 !! test
4264 External links: open square bracket forbidden in URL (bug 4377)
4265 !! options
4266 parsoid=wt2html,wt2wt,html2html
4267 !! wikitext
4268 http://example.com/1[2345
4269 !! html/php
4270 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4271 </p>
4272 !! html/parsoid
4273 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4274 !! end
4275
4276 !! test
4277 External links: open square bracket forbidden in URL (named) (bug 4377)
4278 !! options
4279 parsoid=wt2html,html2html
4280 !! wikitext
4281 [http://example.com/1[2345]
4282 !! html/php
4283 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4284 </p>
4285 !! html/parsoid
4286 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4287 !!end
4288
4289 # parsoid adds a space before the link name
4290 !! test
4291 External links: open square bracket forbidden in URL (named) (bug 4377)
4292 Parsoid variant.
4293 !! wikitext
4294 [http://example.com/1 [2345]
4295 !! html
4296 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4297 </p>
4298 !!end
4299
4300 !! test
4301 External links: nowiki in URL link text (bug 6230)
4302 !! wikitext
4303 [http://example.com/ <nowiki>''example site''</nowiki>]
4304 !! html
4305 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4306 </p>
4307 !! end
4308
4309 !! test
4310 External links: newline forbidden in text (bug 6230 regression check)
4311 !! wikitext
4312 [http://example.com/ first
4313 second]
4314 !! html
4315 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4316 second]
4317 </p>
4318 !!end
4319
4320 !! test
4321 External links: Pipe char between url and text
4322 !! wikitext
4323 [http://example.com | link]
4324 !! html
4325 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4326 </p>
4327 !!end
4328
4329 !! test
4330 External links: protocol-relative URL in brackets
4331 !! wikitext
4332 [//example.com/ Test]
4333 !! html
4334 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4335 </p>
4336 !! end
4337
4338 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4339 !! test
4340 External links: protocol-relative URL in brackets without text
4341 !! wikitext
4342 [//example.com]
4343 !! html/php
4344 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4345 </p>
4346 !! html/parsoid
4347 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4348 !! end
4349
4350 !! test
4351 External links: protocol-relative URL in free text is left alone
4352 !! wikitext
4353 //example.com/Foo
4354 !! html
4355 <p>//example.com/Foo
4356 </p>
4357 !!end
4358
4359 !! test
4360 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
4361 !! wikitext
4362 foo//example.com/Foo
4363 !! html
4364 <p>foo//example.com/Foo
4365 </p>
4366 !! end
4367
4368 !! test
4369 External links: with no contents
4370 !! wikitext
4371 [http://en.wikipedia.org/wiki/Foo]
4372
4373 [[wikipedia:Foo|Bar]]
4374
4375 [[wikipedia:Foo|<span>Bar</span>]]
4376 !! html/php
4377 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4378 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4379 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4380 </p>
4381 !! html/parsoid
4382 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4383 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4384 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4385 !! end
4386
4387 !! test
4388 External links: Free with trailing punctuation
4389 !! wikitext
4390 http://example.com,
4391 http://example.com;
4392 http://example.com\
4393 http://example.com.
4394 http://example.com:
4395 http://example.com!
4396 http://example.com?
4397 http://example.com)
4398 http://example.com/url_with_(brackets)
4399 (http://example.com/url_without_brackets)
4400 http://example.com/url_with_entity&nbsp;
4401 http://example.com/url_with_entity&#xA0;
4402 http://example.com/url_with_entity&#160;
4403 http://example.com/url_with_entity&lt;
4404 http://example.com/url_with_entity&#x3C;
4405 http://example.com/url_with_entity&#60;
4406 !! html/php
4407 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4408 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4409 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4410 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4411 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4412 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4413 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4414 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4415 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4416 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4417 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4418 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4419 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4420 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4421 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity%3C">http://example.com/url_with_entity%3C</a>
4422 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity%3C">http://example.com/url_with_entity%3C</a>
4423 </p>
4424 !! html/parsoid
4425 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>,
4426 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>;
4427 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>\
4428 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>.
4429 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:
4430 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>!
4431 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>?
4432 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)
4433 <a rel="mw:ExtLink" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4434 (<a rel="mw:ExtLink" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4435 <a rel="mw:ExtLink" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4436 <a rel="mw:ExtLink" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4437 <a rel="mw:ExtLink" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4438 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity">&lt;</span>
4439 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&lt;">http://example.com/url_with_entity&lt;</a>
4440 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&lt;">http://example.com/url_with_entity&lt;</a></p>
4441 !! end
4442
4443 !! test
4444 External links: No preceding word characters allowed (bug 65278)
4445 !! wikitext
4446 NOPEhttp://example.com
4447 N0http://example.com
4448 ok:http://example.com
4449 ok-http://example.com
4450 !! html
4451 <p>NOPEhttp://example.com
4452 N0http://example.com
4453 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4454 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4455 </p>
4456 !! end
4457
4458 !! test
4459 External image
4460 !! wikitext
4461 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4462 !! html
4463 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4464 </p>
4465 !! end
4466
4467 !! test
4468 External image from https
4469 !! wikitext
4470 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4471 !! html
4472 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4473 </p>
4474 !! end
4475
4476 !! test
4477 External image (when not allowed)
4478 !! options
4479 wgAllowExternalImages=0
4480 !! wikitext
4481 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4482 !! html
4483 <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>
4484 </p>
4485 !! end
4486
4487 !! test
4488 Link to non-http image, no img tag
4489 !! wikitext
4490 Link to non-http image, no img tag: ftp://example.com/test.jpg
4491 !! html
4492 <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>
4493 </p>
4494 !! end
4495
4496 !! test
4497 External links: terminating separator
4498 !! wikitext
4499 Terminating separator: http://example.com/thing,
4500 !! html
4501 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4502 </p>
4503 !! end
4504
4505 !! test
4506 External links: intervening separator
4507 !! wikitext
4508 Intervening separator: http://example.com/1,2,3
4509 !! html
4510 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4511 </p>
4512 !! end
4513
4514 !! test
4515 External links: old bug with URL in query
4516 !! wikitext
4517 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4518 !! html
4519 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4520 </p>
4521 !! end
4522
4523 !! test
4524 External links: old URL-in-URL bug, mixed protocols
4525 !! wikitext
4526 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4527 !! html
4528 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4529 </p>
4530 !!end
4531
4532 !! test
4533 External links: URL in text
4534 !! wikitext
4535 URL in text: [http://example.com http://example.com]
4536 !! html
4537 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4538 </p>
4539 !! end
4540
4541 !! test
4542 External links: Clickable images
4543 !! wikitext
4544 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4545 !! html/php
4546 <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>
4547 </p>
4548 !! html/parsoid
4549 <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>
4550 !! end
4551
4552 !! test
4553 External links: raw ampersand
4554 !! wikitext
4555 Old &amp; use: http://x&y
4556 !! html
4557 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4558 </p>
4559 !! end
4560
4561 !! test
4562 External links: encoded ampersand
4563 !! wikitext
4564 Old &amp; use: http://x&amp;y
4565 !! html/php
4566 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4567 </p>
4568 !! html/parsoid
4569 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4570 !! end
4571
4572 !! test
4573 External links: encoded equals (bug 6102)
4574 !! wikitext
4575 http://example.com/?foo&#61;bar
4576 !! html/php
4577 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4578 </p>
4579 !! html/parsoid
4580 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4581 !! end
4582
4583 ##
4584 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4585 ## does it number them. As discussed in bug 53505, we can identify
4586 ## autonumbered links via CSS.
4587 ##
4588
4589 !! test
4590 External links: [raw ampersand]
4591 !! wikitext
4592 Old &amp; use: [http://x&y]
4593 !! html/php
4594 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4595 </p>
4596 !! html/parsoid
4597 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4598 !! end
4599
4600 # note that parsoid html is identical to [raw ampersand] case; so html2wt
4601 # mode will return the [raw ampersand] wikitext
4602 !! test
4603 External links: [encoded ampersand]
4604 !! options
4605 parsoid=wt2html,wt2wt,html2html
4606 !! wikitext
4607 Old &amp; use: [http://x&amp;y]
4608 !! html/php
4609 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4610 </p>
4611 !! html/parsoid
4612 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4613 !! end
4614
4615 !! test
4616 External links: [raw equals]
4617 !! wikitext
4618 [http://example.com/?foo=bar]
4619 !! html/php
4620 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4621 </p>
4622 !! html/parsoid
4623 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4624 !! end
4625
4626 # note that parsoid html is identical to [raw equals] case; so html2wt
4627 # mode will return the [raw equals] wikitext
4628 !! test
4629 External links: [encoded equals] (bug 6102)
4630 !! options
4631 parsoid=wt2html,wt2wt,html2html
4632 !! wikitext
4633 [http://example.com/?foo&#61;bar]
4634 !! html/php
4635 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4636 </p>
4637 !! html/parsoid
4638 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4639 !! end
4640
4641 # xxx parsoid strips the IDN character, so the round-trip tests will
4642 # obviously fail and are disabled. --cscott
4643 !! test
4644 External links: [IDN ignored character reference in hostname; strip it right off]
4645 !! options
4646 parsoid=wt2html,wt2wt,html2html
4647 !! wikitext
4648 [http://e&zwnj;xample.com/]
4649 !! html/php
4650 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
4651 </p>
4652 !! html/parsoid
4653 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
4654 !! end
4655
4656 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
4657 # Where an external link could easily circumvent the sanitization of the text of
4658 # a link like this (where an IDN-ignore character is in the URL somewhere), this
4659 # test demands a higher standard. That's a bit strange.
4660 #
4661 # Example:
4662 #
4663 # http://e‌xample.com -> [http://example.com|http://example.com]
4664 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
4665 #
4666 # The first example is sanitized, but the second is not. Any security benefits
4667 # from this production are trivial to circumvent. Either remove this test and
4668 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
4669 # the test accordingly.
4670 #
4671 # All our love,
4672 # The Parsoid team.
4673 # xxx parsoid strips the IDN character, so the round-trip tests will
4674 # obviously fail and are disabled. --cscott
4675 !! test
4676 External links: IDN ignored character reference in hostname; strip it right off
4677 !! options
4678 parsoid=wt2html,html2html
4679 !! wikitext
4680 http://e&zwnj;xample.com/
4681 !! html/php
4682 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
4683 </p>
4684 !! html/parsoid
4685 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
4686 !! end
4687
4688 !! test
4689 External links: www.jpeg.org (bug 554)
4690 !! wikitext
4691 http://www.jpeg.org
4692 !! html
4693 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
4694 </p>
4695 !! end
4696
4697 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4698 !! test
4699 External links: URL within URL (original bug 2)
4700 !! wikitext
4701 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
4702 !! html/php
4703 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
4704 </p>
4705 !! html/parsoid
4706 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
4707 !! end
4708
4709 !! test
4710 BUG 361: URL inside bracketed URL
4711 !! wikitext
4712 [http://www.example.com/foo http://www.example.com/bar]
4713 !! html
4714 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
4715 </p>
4716 !! end
4717
4718 !! test
4719 BUG 361: URL within URL, not bracketed
4720 !! wikitext
4721 http://www.example.com/foo?=http://www.example.com/bar
4722 !! html
4723 <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>
4724 </p>
4725 !! end
4726
4727 !! test
4728 BUG 289: ">"-token in URL-tail
4729 !! wikitext
4730 http://www.example.com/<hello>
4731 !! html
4732 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
4733 </p>
4734 !!end
4735
4736 !! test
4737 BUG 289: literal ">"-token in URL-tail
4738 !! wikitext
4739 http://www.example.com/<b>html</b>
4740 !! html/php
4741 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
4742 </p>
4743 !! html/parsoid
4744 <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>
4745 !! end
4746
4747 !! test
4748 BUG 289: ">"-token in bracketed URL
4749 !! wikitext
4750 [http://www.example.com/<hello> stuff]
4751 !! html
4752 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
4753 </p>
4754 !!end
4755
4756 !! test
4757 BUG 289: literal ">"-token in bracketed URL
4758 !! wikitext
4759 [http://www.example.com/<b>html</b> stuff]
4760 !! html
4761 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
4762 </p>
4763 !!end
4764
4765 !! test
4766 BUG 289: literal double quote at end of URL
4767 !! wikitext
4768 http://www.example.com/"hello"
4769 !! html
4770 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
4771 </p>
4772 !!end
4773
4774 !! test
4775 BUG 289: literal double quote in bracketed URL
4776 !! wikitext
4777 [http://www.example.com/"hello" stuff]
4778 !! html
4779 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
4780 </p>
4781 !!end
4782
4783 !! test
4784 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
4785 !! wikitext
4786 [http://www.example.com test]
4787 !! html
4788 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
4789 </p>
4790 !! end
4791
4792 !! test
4793 External links: link text with spaces
4794 !! wikitext
4795 [http://www.example.com a b c]
4796 [http://www.example.com ''a'' ''b'']
4797 !! html
4798 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
4799 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
4800 </p>
4801 !! end
4802
4803 !! test
4804 External links: wiki links within external link (Bug 3695)
4805 !! wikitext
4806 [http://example.com [[wikilink]] embedded in ext link]
4807 !! html/php
4808 <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>
4809 </p>
4810 !! html/parsoid
4811 <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>
4812 !! end
4813
4814 !! test
4815 BUG 787: Links with one slash after the url protocol are invalid
4816 !! wikitext
4817 http:/example.com
4818
4819 [http:/example.com title]
4820 !! html
4821 <p>http:/example.com
4822 </p><p>[http:/example.com title]
4823 </p>
4824 !! end
4825
4826 !! test
4827 Bracketed external links with template-generated invalid target
4828 !! wikitext
4829 [{{echo|http:/example.com}} title]
4830 !! html
4831 <p>[http:/example.com title]
4832 </p>
4833 !! end
4834
4835 !! test
4836 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
4837 !! wikitext
4838 ''[http://example.com text'']
4839 [http://example.com '''text]'''
4840 ''Something [http://example.com in italic'']
4841 ''Something [http://example.com mixed''''', even bold]'''
4842 '''''Now [http://example.com both''''']
4843 !! html
4844 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
4845 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
4846 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
4847 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
4848 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
4849 </p>
4850 !! end
4851
4852
4853 !! test
4854 Bug 4781: %26 in URL
4855 !! wikitext
4856 http://www.example.com/?title=AT%26T
4857 !! html/php
4858 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
4859 </p>
4860 !! html/parsoid
4861 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
4862 !! end
4863
4864 # According to http://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
4865 # % is actually legal in HTML5. Any change in output would need testing though.
4866 !! test
4867 Bug 4781, 5267: %25 in URL
4868 !! wikitext
4869 http://www.example.com/?title=100%25_Bran
4870 !! html/php
4871 <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>
4872 </p>
4873 !! html/parsoid
4874 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
4875 !! end
4876
4877 !! test
4878 Bug 4781, 5267: %28, %29 in URL
4879 !! wikitext
4880 http://www.example.com/?title=Ben-Hur_%281959_film%29
4881 !! html/php
4882 <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>
4883 </p>
4884 !! html/parsoid
4885 <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>
4886 !! end
4887
4888
4889 !! test
4890 Bug 4781: %26 in autonumber URL
4891 !! wikitext
4892 [http://www.example.com/?title=AT%26T]
4893 !! html/php
4894 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
4895 </p>
4896 !! html/parsoid
4897 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
4898 !! end
4899
4900 !! test
4901 Bug 4781, 5267: %26 in autonumber URL
4902 !! wikitext
4903 [http://www.example.com/?title=100%25_Bran]
4904 !! html/php
4905 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
4906 </p>
4907 !! html/parsoid
4908 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
4909 !! end
4910
4911 !! test
4912 Bug 4781, 5267: %28, %29 in autonumber URL
4913 !! wikitext
4914 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
4915 !! html/php
4916 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
4917 </p>
4918 !! html/parsoid
4919 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
4920 !! end
4921
4922
4923 !! test
4924 Bug 4781: %26 in bracketed URL
4925 !! wikitext
4926 [http://www.example.com/?title=AT%26T link]
4927 !! html/php
4928 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
4929 </p>
4930 !! html/parsoid
4931 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
4932 !! end
4933
4934 !! test
4935 Bug 4781, 5267: %25 in bracketed URL
4936 !! wikitext
4937 [http://www.example.com/?title=100%25_Bran link]
4938 !! html
4939 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
4940 </p>
4941 !! end
4942
4943 !! test
4944 Bug 4781, 5267: %28, %29 in bracketed URL
4945 !! wikitext
4946 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
4947 !! html/php
4948 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
4949 </p>
4950 !! html/parsoid
4951 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
4952 !! end
4953
4954 !! test
4955 External link containing a period in the anchor. (bug 63947)
4956 !! wikitext
4957 [//foo.org/bar#baz. bang]
4958
4959 [//foo.org/bar. bang]
4960 !! html/php
4961 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
4962 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
4963 </p>
4964 !! html/parsoid
4965 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
4966 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
4967 !! end
4968
4969 !! test
4970 External link containing a single quote. (bug 63947)
4971 !! wikitext
4972 [//foo.org/bar'baz]
4973
4974 [//foo.org/bar'baz bang]
4975 !! html/php
4976 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
4977 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
4978 </p>
4979 !! html/parsoid
4980 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
4981 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
4982 !! end
4983
4984
4985 !! test
4986 External link containing a period in the anchor. (bug 63947)
4987 !! wikitext
4988 [//foo.org/bar#baz. bang]
4989
4990 [//foo.org/bar. bang]
4991 !! html/php
4992 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
4993 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
4994 </p>
4995 !! html/parsoid
4996 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
4997 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
4998 !! end
4999
5000 !! test
5001 External link containing a single quote. (bug 63947)
5002 !! wikitext
5003 [//foo.org/bar'baz]
5004
5005 [//foo.org/bar'baz bang]
5006 !! html/php
5007 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
5008 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
5009 </p>
5010 !! html/parsoid
5011 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
5012 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
5013 !! end
5014
5015
5016 !! test
5017 External link containing double-single-quotes in text '' (bug 4598 sanity check)
5018 !! wikitext
5019 Some [http://example.com/ pretty ''italics'' and stuff]!
5020 !! html
5021 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5022 </p>
5023 !! end
5024
5025 !! test
5026 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
5027 !! wikitext
5028 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5029 !! html
5030 <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>
5031 </p>
5032 !! end
5033
5034 !! test
5035 External link containing double-single-quotes with no space separating the url from text in italics
5036 !! wikitext
5037 [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]].]
5038 !! html/php
5039 <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>
5040 </p>
5041 !! html/php+tidy
5042 <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>
5043 !! html/parsoid
5044 <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>
5045 !! end
5046
5047 !! test
5048 External link with comments in link text
5049 !! wikitext
5050 [http://www.google.com Google <!-- comment -->]
5051 !! html
5052 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5053 </p>
5054 !! end
5055
5056 !! test
5057 URL-encoding in URL functions (single parameter)
5058 !! wikitext
5059 {{localurl:Some page|amp=&}}
5060 !! html
5061 <p>/index.php?title=Some_page&amp;amp=&amp;
5062 </p>
5063 !! end
5064
5065 !! test
5066 URL-encoding in URL functions (multiple parameters)
5067 !! wikitext
5068 {{localurl:Some page|q=?&amp=&}}
5069 !! html
5070 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5071 </p>
5072 !! end
5073
5074 !! test
5075 Brackets in urls
5076 !! wikitext
5077 http://example.com/index.php?foozoid%5B%5D=bar
5078
5079 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5080 !! html/php
5081 <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>
5082 </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>
5083 </p>
5084 !! html/parsoid
5085 <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>
5086
5087 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
5088 !! end
5089
5090 !! test
5091 IPv6 urls (bug 21261)
5092 !! options
5093 disabled
5094 !! wikitext
5095 http://[2404:130:0:1000::187:2]/index.php
5096 !! html
5097 <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>
5098 </p>
5099 !! end
5100
5101 !! test
5102 Non-extlinks in brackets
5103 !! wikitext
5104 [foo]
5105 [foo bar]
5106 [foo ''bar'']
5107 [fool's] errand
5108 [fool's errand]
5109 [{{echo|foo}}]
5110 [{{echo|foo}} bar]
5111 [{{echo|foo}} ''bar'']
5112 [{{echo|foo}}l's] errand
5113 [{{echo|foo}}l's errand]
5114 [url={{echo|foo}}]
5115 [url=http://example.com]
5116 !! html
5117 <p>[foo]
5118 [foo bar]
5119 [foo <i>bar</i>]
5120 [fool's] errand
5121 [fool's errand]
5122 [foo]
5123 [foo bar]
5124 [foo <i>bar</i>]
5125 [fool's] errand
5126 [fool's errand]
5127 [url=foo]
5128 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5129 </p>
5130 !! end
5131
5132 !! test
5133 Percent encoding in external links
5134 !! wikitext
5135 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
5136 !! html/php
5137 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
5138 </p>
5139 !! html/parsoid
5140 <p><a rel="mw:ExtLink"
5141 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
5142 !! end
5143
5144 !! test
5145 Use url link syntax for links where the content is equal the link target
5146 !! wikitext
5147 http://example.com
5148 !! html/php
5149 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5150 </p>
5151 !! html/parsoid
5152 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5153 !! end
5154
5155 !! test
5156 Parenthesis in external links, especially URL links
5157 !! wikitext
5158 http://example.com)
5159
5160 http://example.com/test)
5161
5162 http://example.com/(test)
5163
5164 http://example.com/((test)
5165
5166 (http://example.com/(test))
5167
5168 (http://example.com/(test)))))
5169
5170 http://example.com/a)b
5171
5172 [http://example.com) foo]
5173 !! html/php
5174 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5175 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
5176 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
5177 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
5178 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
5179 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
5180 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
5181 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5182 </p>
5183 !! html/parsoid
5184 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
5185 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
5186 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
5187 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
5188 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
5189 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
5190 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
5191 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
5192 !! end
5193
5194 !! test
5195 Parenthesis in external links, w/ transclusion or comment
5196 !! wikitext
5197 (http://example.com/{{echo|hi}})
5198
5199 (http://example.com<!-- hi -->)
5200 !! html/php
5201 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5202 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5203 </p>
5204 !! html/parsoid
5205 <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>
5206
5207 <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>
5208 !! end
5209
5210 !! test
5211 Replace invalid link targets when serializing
5212 !! options
5213 parsoid=html2wt
5214 !! html
5215 <a rel="mw:WikiLink" href="./]] foo [[bar">Manual</a>
5216 !! wikitext
5217 [[MediaWiki:Badtitletext|Manual]]
5218 !! end
5219
5220 ###
5221 ### Quotes
5222 ###
5223
5224 !! test
5225 Quotes
5226 !! wikitext
5227 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5228
5229 Normal text. '''''Bold italic text.''''' Normal text.
5230 !! html
5231 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5232 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5233 </p>
5234 !! end
5235
5236
5237 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5238 # parser strips. The wikitext contains just the first half of the bold
5239 # quote pair.
5240 !! test
5241 Unclosed and unmatched quotes
5242 !! wikitext
5243 '''''Bold italic text '''with bold deactivated''' in between.'''''
5244
5245 '''''Bold italic text ''with italic deactivated'' in between.'''''
5246
5247 '''Bold text..
5248
5249 ..spanning two paragraphs (should not work).'''
5250
5251 '''Bold tag left open
5252
5253 ''Italic tag left open
5254
5255 Normal text.
5256
5257 <!-- Unmatching number of opening, closing tags: -->
5258 '''This year''''s election ''should'' beat '''last year''''s.
5259
5260 ''Tom'''s car is bigger than ''Susan'''s.
5261
5262 Plain ''italic'''s plain
5263 !! html/php
5264 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5265 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5266 </p><p><b>Bold text..</b>
5267 </p><p>..spanning two paragraphs (should not work).
5268 </p><p><b>Bold tag left open</b>
5269 </p><p><i>Italic tag left open</i>
5270 </p><p>Normal text.
5271 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5272 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5273 </p><p>Plain <i>italic'</i>s plain
5274 </p>
5275 !! html/parsoid
5276 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5277 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5278 </p><p><b>Bold text..</b>
5279 </p><p>..spanning two paragraphs (should not work).<b></b>
5280 </p><p><b>Bold tag left open</b>
5281 </p><p><i>Italic tag left open</i>
5282 </p><p>Normal text.
5283 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5284 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5285 </p><p>Plain <i>italic'</i>s plain
5286 </p>
5287 !! end
5288
5289 ###
5290 ### Tables
5291 ###
5292 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5293 ###
5294
5295 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5296 # is the bare minimum required by the spec, see:
5297 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5298 # Parsoid team replies: empty table tags are legal in HTML5
5299 !! test
5300 A table with no data.
5301 !! options
5302 parsoid=wt2html
5303 !! wikitext
5304 {||}
5305 !! html/php
5306
5307 !! html/parsoid
5308 <table></table>
5309
5310 !! end
5311
5312 !! test
5313 A table with stray table end tags on start tag line (wt2html)
5314 !! options
5315 parsoid=wt2html
5316 !! wikitext
5317 {|style="color: red;"|}
5318
5319 {|style="color: red;" |}
5320 |foo
5321 |}
5322
5323 {|style="color: red;"|} id="foo"
5324 |foo
5325 |}
5326
5327 {|style="color: red;" |} id="foo"
5328 |foo
5329 |}
5330 !! html
5331 <table style="color: red;"></table>
5332
5333 <table style="color: red;">
5334 <tbody><tr>
5335 <td>foo</td>
5336 </tr></tbody>
5337 </table>
5338
5339 <table style="color: red;" id="foo">
5340 <tbody><tr>
5341 <td>foo</td>
5342 </tr></tbody>
5343 </table>
5344
5345 <table style="color: red;" id="foo">
5346 <tbody><tr>
5347 <td>foo</td>
5348 </tr></tbody>
5349 </table>
5350
5351 !! end
5352
5353 !! test
5354 A table with no data (take 2)
5355 !! wikitext
5356 {|
5357 |}
5358 !! html/parsoid
5359 <table></table>
5360 !! end
5361
5362 # A table with nothing but a caption is invalid XHTML, we might want to render
5363 # this as <p>caption</p>
5364 # Parsoid team replies: table with only a caption is legal in HTML5
5365 !! test
5366 A table with nothing but a caption
5367 !! wikitext
5368 {|
5369 |+ caption
5370 |}
5371 !! html/php
5372 <table>
5373 <caption> caption
5374 </caption><tr><td></td></tr></table>
5375
5376 !! html/parsoid
5377 <table><caption> caption</caption></table>
5378 !! end
5379
5380 !! test
5381 A table with caption with default-spaced attributes and a table row
5382 !! wikitext
5383 {|
5384 |+ style="color: red;" | caption1
5385 |-
5386 | foo
5387 |}
5388 !! html
5389 <table>
5390 <caption style="color: red;"> caption1
5391 </caption>
5392 <tr>
5393 <td> foo
5394 </td></tr></table>
5395
5396 !! end
5397
5398 !! test
5399 A table with captions with non-default spaced attributes and a table row
5400 !! wikitext
5401 {|
5402 |+style="color: red;"|caption2
5403 |+ style="color: red;"| caption3
5404 |-
5405 | foo
5406 |}
5407 !! html
5408 <table>
5409 <caption style="color: red;">caption2
5410 </caption>
5411 <caption style="color: red;"> caption3
5412 </caption>
5413 <tr>
5414 <td> foo
5415 </td></tr></table>
5416
5417 !! end
5418
5419 !! test
5420 Table td-cell syntax variations
5421 !! wikitext
5422 {|
5423 | foo bar foo | baz
5424 | foo bar foo || baz
5425 | style='color:red;' | baz
5426 | style='color:red;' || baz
5427 |}
5428 !! html
5429 <table>
5430 <tr>
5431 <td> baz
5432 </td>
5433 <td> foo bar foo </td>
5434 <td> baz
5435 </td>
5436 <td style="color:red;"> baz
5437 </td>
5438 <td> style='color:red;' </td>
5439 <td> baz
5440 </td></tr></table>
5441
5442 !! end
5443
5444 !! test
5445 Simple table
5446 !! wikitext
5447 {|
5448 | 1 || 2
5449 |-
5450 | 3 || 4
5451 |}
5452 !! html
5453 <table>
5454 <tr>
5455 <td> 1 </td>
5456 <td> 2
5457 </td></tr>
5458 <tr>
5459 <td> 3 </td>
5460 <td> 4
5461 </td></tr></table>
5462
5463 !! end
5464
5465 !! test
5466 Simple table but with multiple dashes for row wikitext
5467 !! wikitext
5468 {|
5469 | foo
5470 |-----
5471 | bar
5472 |}
5473 !! html
5474 <table>
5475 <tr>
5476 <td> foo
5477 </td></tr>
5478 <tr>
5479 <td> bar
5480 </td></tr></table>
5481
5482 !! end
5483 !! test
5484 Multiplication table
5485 !! wikitext
5486 {| border="1" cellpadding="2"
5487 |+Multiplication table
5488 |-
5489 ! &times; !! 1 !! 2 !! 3
5490 |-
5491 ! 1
5492 | 1 || 2 || 3
5493 |-
5494 ! 2
5495 | 2 || 4 || 6
5496 |-
5497 ! 3
5498 | 3 || 6 || 9
5499 |-
5500 ! 4
5501 | 4 || 8 || 12
5502 |-
5503 ! 5
5504 | 5 || 10 || 15
5505 |}
5506 !! html
5507 <table border="1" cellpadding="2">
5508 <caption>Multiplication table
5509 </caption>
5510 <tr>
5511 <th> &#215; </th>
5512 <th> 1 </th>
5513 <th> 2 </th>
5514 <th> 3
5515 </th></tr>
5516 <tr>
5517 <th> 1
5518 </th>
5519 <td> 1 </td>
5520 <td> 2 </td>
5521 <td> 3
5522 </td></tr>
5523 <tr>
5524 <th> 2
5525 </th>
5526 <td> 2 </td>
5527 <td> 4 </td>
5528 <td> 6
5529 </td></tr>
5530 <tr>
5531 <th> 3
5532 </th>
5533 <td> 3 </td>
5534 <td> 6 </td>
5535 <td> 9
5536 </td></tr>
5537 <tr>
5538 <th> 4
5539 </th>
5540 <td> 4 </td>
5541 <td> 8 </td>
5542 <td> 12
5543 </td></tr>
5544 <tr>
5545 <th> 5
5546 </th>
5547 <td> 5 </td>
5548 <td> 10 </td>
5549 <td> 15
5550 </td></tr></table>
5551
5552 !! end
5553
5554 !! test
5555 Accept "||" in table headings
5556 !! wikitext
5557 {|
5558 !h1 || h2
5559 |}
5560 !! html
5561 <table>
5562 <tr>
5563 <th>h1 </th>
5564 <th> h2
5565 </th></tr></table>
5566
5567 !! end
5568
5569 !! test
5570 Accept "!!" in table data
5571 !! wikitext
5572 {|
5573 | Foo!! ||
5574 |}
5575 !! html
5576 <table>
5577 <tr>
5578 <td> Foo!! </td>
5579 <td>
5580 </td></tr></table>
5581
5582 !! html/parsoid
5583 <table>
5584 <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>
5585 </tbody></table>
5586 !! end
5587
5588 !! test
5589 Accept "||" in indented table headings
5590 !! wikitext
5591 :{|
5592 !h1 || h2
5593 |}
5594 !! html
5595 <dl><dd><table>
5596 <tr>
5597 <th>h1 </th>
5598 <th> h2
5599 </th></tr></table></dd></dl>
5600
5601 !! end
5602
5603 !! test
5604 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
5605 !! wikitext
5606 {|
5607 !| h1
5608 || a
5609 |}
5610 !! html
5611 <table>
5612 <tr>
5613 <th> h1
5614 </th>
5615 <td> a
5616 </td></tr></table>
5617
5618 !! end
5619
5620 !!test
5621 Accept "| !" at start of line in tables (ignore !-attribute)
5622 !! wikitext
5623 {|
5624 |-
5625 | !style="color:red" | bar
5626 |}
5627 !! html
5628 <table>
5629
5630 <tr>
5631 <td> bar
5632 </td></tr></table>
5633
5634 !!end
5635
5636 !!test
5637 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 +/-
5638 !! wikitext
5639 {|
5640 |-
5641 |style='color:red;'|+1
5642 |style='color:blue;'|-1
5643 |-
5644 | 1 || 2 || 3
5645 | 1 ||+2 ||-3
5646 |-
5647 | +1
5648 | -1
5649 |}
5650 !! html
5651 <table>
5652
5653 <tr>
5654 <td style="color:red;">+1
5655 </td>
5656 <td style="color:blue;">-1
5657 </td></tr>
5658 <tr>
5659 <td> 1 </td>
5660 <td> 2 </td>
5661 <td> 3
5662 </td>
5663 <td> 1 </td>
5664 <td>+2 </td>
5665 <td>-3
5666 </td></tr>
5667 <tr>
5668 <td> +1
5669 </td>
5670 <td> -1
5671 </td></tr></table>
5672
5673 !!end
5674
5675 !! test
5676 Table rowspan
5677 !! wikitext
5678 {| border=1
5679 | Cell 1, row 1
5680 |rowspan=2| Cell 2, row 1 (and 2)
5681 | Cell 3, row 1
5682 |-
5683 | Cell 1, row 2
5684 | Cell 3, row 2
5685 |}
5686 !! html
5687 <table border="1">
5688 <tr>
5689 <td> Cell 1, row 1
5690 </td>
5691 <td rowspan="2"> Cell 2, row 1 (and 2)
5692 </td>
5693 <td> Cell 3, row 1
5694 </td></tr>
5695 <tr>
5696 <td> Cell 1, row 2
5697 </td>
5698 <td> Cell 3, row 2
5699 </td></tr></table>
5700
5701 !! end
5702
5703 !! test
5704 Nested table
5705 !! wikitext
5706 {| border=1
5707 | &alpha;
5708 |
5709 {| bgcolor=#ABCDEF border=2
5710 |nested
5711 |-
5712 |table
5713 |}
5714 |the original table again
5715 |}
5716 !! html
5717 <table border="1">
5718 <tr>
5719 <td> &#945;
5720 </td>
5721 <td>
5722 <table bgcolor="#ABCDEF" border="2">
5723 <tr>
5724 <td>nested
5725 </td></tr>
5726 <tr>
5727 <td>table
5728 </td></tr></table>
5729 </td>
5730 <td>the original table again
5731 </td></tr></table>
5732
5733 !! end
5734
5735 !! test
5736 Invalid attributes in table cell (bug 1830)
5737 !! wikitext
5738 {|
5739 |Cell:|broken
5740 |}
5741 !! html
5742 <table>
5743 <tr>
5744 <td>broken
5745 </td></tr></table>
5746
5747 !! end
5748
5749 # The "|}" to close the table is missing from the input, so parsoid's
5750 # *2wt modes will fail.
5751 !! test
5752 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
5753 !! options
5754 parsoid=wt2html,html2html
5755 !! wikitext
5756 {|
5757 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
5758 !! html/php
5759 <table>
5760 <tr>
5761 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
5762 <td>]" onmouseover="alert(document.cookie)"&gt;test
5763 </td>
5764 </tr>
5765 </table>
5766
5767 !! html/parsoid
5768 <table><tbody>
5769 <tr>
5770 <td><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
5771 !! end
5772
5773 # FIXME: The php output is broken.
5774 !! test
5775 ! and || in td attributes should not be parsed as <th>/<td>
5776 !! wikitext
5777 {|
5778 | style="color: red !important;" data-contrived="put this here ||" | foo
5779 |}
5780 !! html/php
5781 <table>
5782 <tr>
5783 <td> style="color: red !important;" data-contrived="put this here </td>
5784 <td> foo
5785 </td></tr></table>
5786
5787 !! html/parsoid
5788 <table>
5789 <tbody><tr><td style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"autoInsertedEnd":true}'> foo</td></tr>
5790 </tbody></table>
5791 !! end
5792
5793 !! test
5794 Indented table markup mixed with indented pre content (proposed in bug 6200)
5795 !! wikitext
5796 <table>
5797 <tr>
5798 <td>
5799 Text that should be rendered preformatted
5800 </td>
5801 </tr>
5802 </table>
5803 !! html
5804 <table>
5805 <tr>
5806 <td>
5807 <pre>Text that should be rendered preformatted
5808 </pre>
5809 </td>
5810 </tr>
5811 </table>
5812
5813 !! end
5814
5815 !! test
5816 1. Template-generated table cell attributes and cell content
5817 !! wikitext
5818 {|
5819 |{{table_attribs}}
5820 | {{table_attribs}}
5821 || {{table_attribs_5}}
5822 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
5823 |align=center {{table_attribs}}
5824 | <!--foo--> align=center <!--bar--> {{table_attribs}}
5825 |}
5826 !! html
5827 <table>
5828 <tr>
5829 <td style="color:red;">Foo
5830 </td>
5831 <td style="color:red;">Foo
5832 </td>
5833 <td> style="color:red;"</td>
5834 <td>Bar
5835 </td>
5836 <td style="color:red;">Foo
5837 </td>
5838 <td align="center" style="color:red;">Foo
5839 </td>
5840 <td align="center" style="color:red;">Foo
5841 </td></tr></table>
5842
5843 !! end
5844
5845 !! test
5846 2. Template-generated table cell attributes and cell content
5847 !! wikitext
5848 {|
5849 |{{table_attribs_2}}
5850 |}
5851 !! html/php
5852 <table>
5853 <tr>
5854 <td style="color:red;">Foo
5855 </td>
5856 <td>Bar</td>
5857 <td>Baz
5858 </td></tr></table>
5859
5860 !! html/parsoid
5861 <table>
5862 <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>
5863 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
5864 </tbody></table>
5865 !! end
5866
5867 !! test
5868 3. Template-generated table cell attributes and cell content
5869 !! wikitext
5870 {|
5871 !align=center {{table_header_cells}}
5872 |-
5873 |align=center {{table_cells}}
5874 |}
5875 !! html/php
5876 <table>
5877 <tr>
5878 <th align="center" style="color:red;">Foo</th>
5879 <th style="color:red;"><i>Bar</i></th>
5880 <th style="color:brown;"><i>Foo</i> and Baz
5881 </th></tr>
5882 <tr>
5883 <td align="center" style="color:red;">Foo</td>
5884 <td style="color:red;"><i>Bar</i></td>
5885 <td style="color:brown;"><i>Foo</i> and Baz
5886 </td></tr></table>
5887
5888 !! html/parsoid
5889 <table>
5890 <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>
5891 <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>
5892 </tbody></table>
5893 !! end
5894
5895 !! test
5896 Table with row followed by newlines and table heading
5897 !! wikitext
5898 {|
5899 |-
5900
5901 ! foo
5902 |}
5903 !! html
5904 <table>
5905
5906
5907 <tr>
5908 <th> foo
5909 </th></tr></table>
5910
5911 !! end
5912
5913 !! test
5914 Table with empty line following the start tag
5915 !! wikitext
5916 {|
5917
5918 |-
5919 | foo
5920 |}
5921 !! html
5922 <table>
5923
5924
5925 <tr>
5926 <td> foo
5927 </td></tr></table>
5928
5929 !! end
5930
5931 # FIXME: Preserve the attribute properly (with an empty string as value) in
5932 # the PHP parser. Parsoid implements the behavior below.
5933 !! test
5934 Table attributes with empty value
5935 !! wikitext
5936 {|
5937 | style=| hello
5938 |}
5939 !! html/parsoid
5940 <table>
5941 <tbody>
5942 <tr>
5943 <td style=""> hello
5944 </td></tr></tbody></table>
5945
5946 !! end
5947
5948 !! test
5949 Wikitext table with a lot of comments
5950 !! wikitext
5951 {|
5952 <!-- c0 -->
5953 | foo
5954 <!-- c1 -->
5955 |-<!-- c2 -->
5956 <!-- c3 -->
5957 |<!-- c4 -->
5958 <!-- c5 -->
5959 |}
5960 !! html
5961 <table>
5962 <tr>
5963 <td> foo
5964 </td></tr>
5965 <tr>
5966 <td>
5967 </td></tr></table>
5968
5969 !! end
5970
5971 !! test
5972 Wikitext table comments represented in parsoid dom
5973 !! wikitext
5974 {|<!--c1--><!--c2-->
5975 |-<!--c3-->
5976 | x
5977 |}
5978 !! html/php+tidy
5979 <table>
5980 <tr>
5981 <td>x</td>
5982 </tr>
5983 </table>
5984 !! html/parsoid
5985 <table><!--c1--><!--c2-->
5986 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
5987 <td data-parsoid='{"autoInsertedEnd":true}'> x</td></tr>
5988 </tbody></table>
5989 !! end
5990
5991 !! test
5992 Wikitext table with double-line table cell
5993 !! wikitext
5994 {|
5995 |a
5996 b
5997 |}
5998 !! html
5999 <table>
6000 <tr>
6001 <td>a
6002 <p>b
6003 </p>
6004 </td></tr></table>
6005
6006 !! end
6007
6008 !! test
6009 Table cell with a single comment
6010 !! wikitext
6011 {|
6012 | <!-- c1 -->
6013 | a
6014 |}
6015 !! html
6016 <table>
6017 <tr>
6018 <td>
6019 </td>
6020 <td> a
6021 </td></tr></table>
6022
6023 !! end
6024
6025 !! test
6026 Table-cell after a comment-only-empty-line
6027 !! wikitext
6028 {|
6029 |a
6030 <!--c1-->
6031 <!--c2-->| b
6032 |}
6033 !! html
6034 <table>
6035 <tr>
6036 <td>a
6037 </td>
6038 <td> b
6039 </td></tr></table>
6040
6041 !! html/parsoid
6042 <table>
6043 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
6044 <!--c1-->
6045 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
6046 </tbody></table>
6047
6048 !! end
6049
6050 !! test
6051 Build table with {{!}}
6052 !! wikitext
6053 {{{!}} class="wikitable"
6054 ! header
6055 ! second header
6056 {{!}}- style="color:red;"
6057 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
6058 {{!}}}
6059 !! html
6060 <table class="wikitable">
6061 <tr>
6062 <th> header
6063 </th>
6064 <th> second header
6065 </th></tr>
6066 <tr style="color:red;">
6067 <td> data </td>
6068 <td style="color:red;"> second data
6069 </td></tr></table>
6070
6071 !! end
6072
6073 !! test
6074 Build table with pipe as data
6075 !! wikitext
6076 {| class="wikitable"
6077 ! header
6078 ! second header
6079 |- style="color:red;"
6080 | data || style="color:red;" | second data
6081 |-
6082 | style="color:red;" | data with | || style="color:red;" | second data with |
6083 |-
6084 || data with | ||| second data with |
6085 |}
6086 !! html
6087 <table class="wikitable">
6088 <tr>
6089 <th> header
6090 </th>
6091 <th> second header
6092 </th></tr>
6093 <tr style="color:red;">
6094 <td> data </td>
6095 <td style="color:red;"> second data
6096 </td></tr>
6097 <tr>
6098 <td style="color:red;"> data with | </td>
6099 <td style="color:red;"> second data with |
6100 </td></tr>
6101 <tr>
6102 <td> data with | </td>
6103 <td> second data with |
6104 </td></tr></table>
6105
6106 !! end
6107
6108 !! test
6109 Build table with wikilink
6110 !! wikitext
6111 {| class="wikitable"
6112 ! header || second header
6113 |- style="color:red;"
6114 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
6115 |-
6116 | data || second data [[Main Page|link|text with pipe]]
6117 |}
6118 !! html
6119 <table class="wikitable">
6120 <tr>
6121 <th> header </th>
6122 <th> second header
6123 </th></tr>
6124 <tr style="color:red;">
6125 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
6126 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
6127 </td></tr>
6128 <tr>
6129 <td> data </td>
6130 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
6131 </td></tr></table>
6132
6133 !! end
6134
6135 # The expected HTML structure in this test is debatable. The PHP parser does
6136 # not parse this kind of table at all. The main focus for Parsoid is on
6137 # round-tripping, so this output is ok for now. TODO: revisit!
6138 !! test
6139 Wikitext table with html-syntax row
6140 !! wikitext
6141 {|
6142 |-
6143 <td>foo</td>
6144 |}
6145 !! html/parsoid
6146 <table>
6147 <tbody>
6148 <tr>
6149 <td>foo</td></tr></tbody></table>
6150 !! end
6151
6152 ## Note that Parsoid output differs from PHP and PHP+tidy here.
6153 ## The lack of <tr> tags in the PHP output is arguably a bug in the
6154 ## PHP parser, which tidy then compounds by fostering the content
6155 ## entirely out of the table. Parsoid recognizes the table context
6156 ## and generates <tr> and <td> wrappers as needed. Hopefully nobody
6157 ## depends on PHP's treatment of broken table markup!
6158 !! test
6159 Implicit <td> after a |-
6160 !! options
6161 parsoid=wt2html,html2html
6162 !! wikitext
6163 {|
6164 |-
6165 a
6166 |}
6167 !! html/php
6168 <table>
6169
6170 a
6171 </table>
6172
6173 !! html/php+tidy
6174 <p>a</p>
6175 !! html/parsoid
6176 <table>
6177 <tr><td>a</td></tr>
6178 </table>
6179 !! end
6180
6181 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
6182 !! test
6183 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
6184 !! options
6185 parsoid=wt2html,html2html
6186 !! wikitext
6187 {|
6188 |-
6189 |
6190 a
6191 |-
6192 b
6193 |}
6194 !! html/php
6195 <table>
6196
6197 <tr>
6198 <td>
6199 <pre>a
6200 </pre>
6201 </td></tr>
6202 b
6203 </table>
6204
6205 !! html/php+tidy
6206 <p>b</p>
6207 <table>
6208 <tr>
6209 <td>
6210 <pre>
6211 a
6212 </pre></td>
6213 </tr>
6214 </table>
6215 !! html/parsoid
6216 <table>
6217 <tbody>
6218 <tr><td><pre>a</pre></td></tr>
6219 <tr><td> b</td></tr>
6220 </tbody>
6221 </table>
6222 !! end
6223
6224 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
6225 # Parsoid generates the missing <td>, so wt2wt won't succeed.
6226 !! test
6227 Lists should be recognized in an implicit <td> context
6228 !! options
6229 parsoid=wt2html,html2html
6230 !! wikitext
6231 {|
6232 |-
6233 *a
6234 |}
6235 !! html/php
6236 <table>
6237
6238 <ul><li>a</li></ul>
6239 </table>
6240
6241 !! html/php+tidy
6242 <ul>
6243 <li>a</li>
6244 </ul>
6245 !! html/parsoid
6246 <table>
6247 <tr>
6248 <td><ul>
6249 <li>a</li>
6250 </ul></td>
6251 </tr>
6252 </table>
6253 !! end
6254
6255 !! test
6256 Table cells not properly parsed in an implicit-td context
6257 !! wikitext
6258 {|
6259 |-
6260 {{table_attribs_4}} || a || b
6261 |}
6262 !! html/php+tidy
6263 <table>
6264 <tr>
6265 <td style="background-color:#DC241f;" width="10px"></td>
6266 <td>a</td>
6267 <td>b</td>
6268 </tr>
6269 </table>
6270 !! html/parsoid
6271 <table>
6272 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
6273 <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>
6274 </tbody></table>
6275 !! end
6276
6277 !! test
6278 Parsoid: Round-trip tables directly followed by content (bug 51219)
6279 !! options
6280 parsoid=wt2html,wt2wt
6281 !! wikitext
6282 {|
6283 |foo
6284 |} bar
6285
6286 {|
6287 |baz
6288 |}<b>quux</b>
6289 !! html+tidy
6290 <table>
6291 <tr>
6292 <td>foo</td>
6293 </tr>
6294 </table>
6295 <p>bar</p>
6296 <table>
6297 <tr>
6298 <td>baz</td>
6299 </tr>
6300 </table>
6301 <p><b>quux</b></p>
6302 !! end
6303
6304 !! test
6305 Parsoid: Default to a newline after tables in new content (bug 51219)
6306 !! options
6307 parsoid=html2wt
6308 !! html
6309 <table><tbody>
6310 <tr><td>foo</td></tr></tbody></table> bar
6311 <table><tbody>
6312 <tr><td>baz</td></tr></tbody></table><b>quux</b>
6313 !! wikitext
6314 {|
6315 |foo
6316 |}
6317 <nowiki> </nowiki>bar
6318 {|
6319 |baz
6320 |}
6321 '''quux'''
6322 !! end
6323
6324 !! test
6325 Parsoid: newline inducing block nodes don't suppress <nowiki>
6326 !! options
6327 parsoid=html2wt
6328 !! html
6329 a<h1>foo</h1>
6330 !! wikitext
6331 <nowiki> </nowiki>a
6332
6333 = foo =
6334 !! end
6335
6336 !! test
6337 Parsoid: Row-syntax table headings followed by comment & table cells
6338 !! options
6339 parsoid=wt2html,wt2wt
6340 !! wikitext
6341 {|
6342 ! foo || bar
6343 <!-- foo --> || baz || quux
6344 |}
6345 !! html/php
6346 <table>
6347 <tr>
6348 <th> foo </th>
6349 <th> bar
6350 </th>
6351 <td> baz </td>
6352 <td> quux
6353 </td></tr></table>
6354
6355 !! html/parsoid
6356 <table>
6357 <tbody><tr><th> foo </th><th> bar
6358 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
6359 </tbody></table>
6360 !! end
6361
6362
6363 # PHP throws away the (semi-broken) "foo" class here; Parsoid
6364 # preserves it.
6365 !!test
6366 Parsoid: Recover better from broken table attributes
6367 !!options
6368 parsoid=wt2html
6369 !!wikitext
6370 {| class="foo
6371 | class="bar" |
6372 foo
6373 |}
6374 !!html/php+tidy
6375 <table>
6376 <tr>
6377 <td class="bar">
6378 <p>foo</p>
6379 </td>
6380 </tr>
6381 </table>
6382 !!html/parsoid
6383 <table class="foo">
6384 <tr>
6385 <td class="bar">
6386 <p>foo</p></td></tr>
6387 </tbody></table>
6388 !!end
6389
6390 !! test
6391 Strip unsupported table tags
6392 !! options
6393 parsoid=html2wt
6394 !! html
6395 <table>
6396 <thead>
6397 <tr>
6398 <th>Month</th>
6399 <th>Savings</th>
6400 </tr>
6401 </thead>
6402 <tbody>
6403 <tr>
6404 <td>January</td>
6405 <td>$100</td>
6406 </tr>
6407 <tr>
6408 <td>February</td>
6409 <td>$80</td>
6410 </tr>
6411 </tbody>
6412 <tfoot>
6413 <tr>
6414 <td>Sum</td>
6415 <td>$180</td>
6416 </tr>
6417 </tfoot>
6418 </table>
6419 !! wikitext
6420 {|
6421
6422 !Month
6423 !Savings
6424
6425 |January
6426 |$100
6427
6428 |-
6429 |February
6430 |$80
6431
6432 |Sum
6433 |$180
6434
6435 |}
6436 !! end
6437
6438 !!test
6439 Testing serialization after deletion of table cells
6440 !!options
6441 parsoid={
6442 "modes": ["wt2wt", "selser"],
6443 "changes": [
6444 ["#x", "remove"]
6445 ]
6446 }
6447 !!wikitext
6448 {|
6449 !h1 !!h2 !!h3
6450 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
6451 |}
6452 !! wikitext/edited
6453 {|
6454 !h1 !!h2 !!h3
6455 |c2 |||c3
6456 |}
6457 !!end
6458
6459 ###
6460 ### Internal links
6461 ###
6462 !! test
6463 Plain link, capitalized
6464 !! wikitext
6465 [[Main Page]]
6466 !! html
6467 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6468 </p>
6469 !! end
6470
6471 !! test
6472 Plain link, uncapitalized
6473 !! wikitext
6474 [[main Page]]
6475 !! html
6476 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
6477 </p>
6478 !! end
6479
6480 !! test
6481 Piped link
6482 !! wikitext
6483 [[Main Page|The Main Page]]
6484 !! html
6485 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
6486 </p>
6487 !! end
6488
6489 !! test
6490 Piped link with comment in link text
6491 !! wikitext
6492 [[Main Page|The Main<!--front--> Page]]
6493 !! html
6494 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
6495 </p>
6496 !! end
6497
6498 !! test
6499 Piped link with multiple pipe characters in link text
6500 !! wikitext
6501 [[Main Page||The|Main|Page|]]
6502 !! html/php
6503 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
6504 </p>
6505 !! html/parsoid
6506 <p><a rel="mw:WikiLink" href="Main_Page" title="Main Page">|The|Main|Page|</a></p>
6507 !! end
6508
6509 !! test
6510 Broken link
6511 !! wikitext
6512 [[Zigzagzogzagzig]]
6513 !! html
6514 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
6515 </p>
6516 !! end
6517
6518 !! test
6519 Broken link with fragment
6520 !! wikitext
6521 [[Zigzagzogzagzig#zug]]
6522 !! html
6523 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
6524 </p>
6525 !! end
6526
6527 !! test
6528 Special page link with fragment
6529 !! wikitext
6530 [[Special:Version#anchor]]
6531 !! html
6532 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
6533 </p>
6534 !! end
6535
6536 !! test
6537 Nonexistent special page link with fragment
6538 !! wikitext
6539 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
6540 !! html
6541 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
6542 </p>
6543 !! end
6544
6545 !! test
6546 Link with prefix
6547 !! wikitext
6548 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
6549 !! html
6550 <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>
6551 </p>
6552 !! end
6553
6554 !! test
6555 Link with suffix
6556 !! wikitext
6557 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
6558 !! html
6559 <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>!!!
6560 </p>
6561 !! end
6562
6563 !! article
6564 prefixed article
6565 !! text
6566 Some text
6567 !! endarticle
6568
6569 !! test
6570 Bug 43661: Piped links with identical prefixes
6571 !! wikitext
6572 [[prefixed article|prefixed articles with spaces]]
6573
6574 [[prefixed article|prefixed articlesaoeu]]
6575
6576 [[Main Page|Main Page test]]
6577 !! html
6578 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
6579 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
6580 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
6581 </p>
6582 !! end
6583
6584
6585 !! test
6586 Link with HTML entity in suffix / tail
6587 !! wikitext
6588 [[Main Page]]&quot;, [[Main Page]]&#97;
6589 !! html/php
6590 <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;
6591 </p>
6592 !! html/parsoid
6593 <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>
6594 !! end
6595
6596 !! test
6597 Link with 3 brackets
6598 !! wikitext
6599 [[[Main Page]]]
6600 !! html
6601 <p>[[[Main Page]]]
6602 </p>
6603 !! end
6604
6605 !! test
6606 Link with 4 brackets
6607 !! wikitext
6608 [[[[Main Page]]]]
6609 !! html
6610 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
6611 </p>
6612 !! end
6613
6614 !! test
6615 Piped link with 3 brackets
6616 !! wikitext
6617 [[[main page|the main page]]]
6618 !! html
6619 <p>[[[main page|the main page]]]
6620 </p>
6621 !! end
6622
6623 !! test
6624 Piped link with extlink-like text
6625 !! wikitext
6626 [[Main Page|[bar]]]
6627 [[Main Page|This is a [bar]]]
6628 !! html/php
6629 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
6630 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
6631 </p>
6632 !! html/parsoid
6633 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
6634 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a></p>
6635 !! end
6636
6637 !! test
6638 Link with multiple pipes
6639 !! wikitext
6640 [[Main Page|The|Main|Page]]
6641 !! html
6642 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
6643 </p>
6644 !! end
6645
6646 # Note that parsoid does not munge anchor text; all non-space
6647 # characters are valid in HTML5 ids.
6648 !! test
6649 Anchor containing a #. (bug 63430)
6650 !! wikitext
6651 [[Main Page#And#Link]]
6652 !! html/php
6653 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
6654 </p>
6655 !! html/parsoid
6656 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link" title="Main Page">Main Page#And#Link</a></p>
6657 !! end
6658
6659 !! test
6660 Link to namespaces
6661 !! wikitext
6662 [[Talk:Parser testing]], [[Meta:Disclaimers]]
6663 !! html
6664 <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>
6665 </p>
6666 !! end
6667
6668 !! test
6669 Link with space in namespace
6670 !! wikitext
6671 [[User talk:Foo bar]]
6672 !! html
6673 <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>
6674 </p>
6675 !! end
6676
6677 !! article
6678 MemoryAlpha:AlphaTest
6679 !! text
6680 This is an article in the MemoryAlpha namespace
6681 (which shadows the memoryalpha interwiki link).
6682 !! endarticle
6683
6684 !! test
6685 Namespace takes precedence over interwiki link (bug 51680)
6686 !! wikitext
6687 [[MemoryAlpha:AlphaTest]]
6688 !! html
6689 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
6690 </p>
6691 !! end
6692
6693 # The previous test doesn't work correctly in html2*, due to not recognizing the
6694 # link as an internal one. This one checks for the correct behavior.
6695 !! test
6696 Link to namespace preferred over interwiki with correct rel attribute
6697 !! options
6698 parsoid=html2wt,html2html
6699 !! html
6700 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
6701 !! wikitext
6702 [[MemoryAlpha:AlphaTest]]
6703 !! end
6704
6705 !! test
6706 Piped link to namespace
6707 !! wikitext
6708 [[Meta:Disclaimers|The disclaimers]]
6709 !! html
6710 <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>
6711 </p>
6712 !! end
6713
6714 !! test
6715 Link containing }
6716 !! wikitext
6717 [[Usually caused by a typo (oops}]]
6718 !! html
6719 <p>[[Usually caused by a typo (oops}]]
6720 </p>
6721 !! end
6722
6723 !! article
6724 7% Solution
6725 !! text
6726 Just a test of an article title containing a percent.
6727 !! endarticle
6728
6729 !! test
6730 Link containing % (not as a hex sequence)
6731 !! wikitext
6732 [[7% Solution]]
6733 !! html/php
6734 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
6735 </p>
6736 !! html/parsoid
6737 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
6738 !! end
6739
6740 # note that the parsoid HTML is identical to the previous test output,
6741 # so the previous test ensures that the html2wt mode will generate the
6742 # "not as a hex sequence" wikitext.
6743 !! test
6744 Link containing % as a single hex sequence interpreted to char
6745 !! options
6746 parsoid=wt2wt,wt2html,html2html
6747 !! wikitext
6748 [[7%25 Solution]]
6749 !! html/php
6750 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
6751 </p>
6752 !! html/parsoid
6753 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
6754 !!end
6755
6756 !! test
6757 Link containing % as a double hex sequence interpreted to hex sequence
6758 !! wikitext
6759 [[7%2525 Solution]]
6760 !! html
6761 <p>[[7%2525 Solution]]
6762 </p>
6763 !!end
6764
6765 # note that parsoid does not munge anchor text; all non-space
6766 # characters are valid in HTML5 anchors.
6767 !! test
6768 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
6769 Example for such a section: == < ==
6770 !! wikitext
6771 [[%23%3c]][[%23%3e]]
6772 !! html/php
6773 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
6774 </p>
6775 !! html/parsoid
6776 <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>
6777 !! end
6778
6779 !! test
6780 Link containing "<#" and ">#" as a hex sequences
6781 !! wikitext
6782 [[%3c%23]][[%3e%23]]
6783 !! html
6784 <p>[[%3c%23]][[%3e%23]]
6785 </p>
6786 !! end
6787
6788 !! test
6789 Link containing an equals sign
6790 !! wikitext
6791 [[Special:BookSources/isbn=4-00-026157-6]]
6792 !! html/php
6793 <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>
6794 </p>
6795 !! html/parsoid
6796 <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>
6797 !! end
6798
6799 !! article
6800 Foo~bar
6801 !! text
6802 Just a test of an article title containing a tilde.
6803 !! endarticle
6804
6805 # note that links containing signatures, like [[Foo~~~~]], are
6806 # massaged by the pre-save transform (PST) and so the tildes are never
6807 # seen by the parser.
6808 !! test
6809 Link containing a tilde
6810 !! wikitext
6811 [[Foo~bar]]
6812 !! html/php
6813 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
6814 </p>
6815 !! html/parsoid
6816 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
6817 !! end
6818
6819 !! test
6820 Link containing double-single-quotes '' (bug 4598)
6821 !! wikitext
6822 [[Lista d''e paise d''o munno]]
6823 !! html/php
6824 <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>
6825 </p>
6826 !! html/parsoid
6827 <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>
6828 !! end
6829
6830 !! test
6831 Link containing double-single-quotes '' in text (bug 4598 sanity check)
6832 !! wikitext
6833 Some [[Link|pretty ''italics'' and stuff]]!
6834 !! html/php
6835 <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>!
6836 </p>
6837 !! html/parsoid
6838 <p>Some <a rel="mw:WikiLink" href="Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
6839 !! end
6840
6841 !! test
6842 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
6843 !! wikitext
6844 ''Some [[Link|pretty ''italics'' and stuff]]!''
6845 !! html
6846 <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>
6847 </p>
6848 !! end
6849
6850 !! test
6851 Link with double quotes in title part (literal) and alternate part (interpreted)
6852 !! wikitext
6853 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
6854
6855 [[''Pentecoste'']]
6856
6857 [[''Pentecoste''|Pentecoste]]
6858
6859 [[''Pentecoste''|''Pentecoste'']]
6860 !! html/php
6861 <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>
6862 </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>
6863 </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>
6864 </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>
6865 </p>
6866 !! html/parsoid
6867 <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>
6868 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
6869 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
6870 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
6871 !! end
6872
6873 !! test
6874 Broken image links with HTML captions (bug 39700)
6875 !! wikitext
6876 [[File:Nonexistent|<script></script>]]
6877 [[File:Nonexistent|100x100px|<script></script>]]
6878 [[File:Nonexistent|&lt;]]
6879 [[File:Nonexistent|a<i>b</i>c]]
6880 !! html/php
6881 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
6882 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
6883 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
6884 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
6885 </p>
6886 !! html/parsoid
6887 <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>
6888 <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>
6889 <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>
6890 <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>
6891 !! end
6892
6893 !! test
6894 Plain link to URL
6895 !! wikitext
6896 [[http://www.example.com]]
6897 !! html/php
6898 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
6899 </p>
6900 !! html/parsoid
6901 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
6902 !! end
6903
6904 !! test
6905 Plain link to URL with link text
6906 !! wikitext
6907 [[http://www.example.com Link text]]
6908 !! html
6909 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
6910 </p>
6911 !! end
6912
6913 !! test
6914 Plain link to protocol-relative URL
6915 !! wikitext
6916 [[//www.example.com]]
6917 !! html/php
6918 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
6919 </p>
6920 !! html/parsoid
6921 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
6922 !! end
6923
6924 !! test
6925 Plain link to protocol-relative URL with link text
6926 !! wikitext
6927 [[//www.example.com Link text]]
6928 !! html
6929 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
6930 </p>
6931 !! end
6932
6933 !! test
6934 Plain link to page with question mark in title
6935 !! wikitext
6936 [[A?b]]
6937
6938 [[A?b|Baz]]
6939 !! html
6940 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
6941 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
6942 </p>
6943 !! end
6944
6945
6946 # I'm fairly sure the expected result here is wrong.
6947 # We want these to be URL links, not pseudo-pages with URLs for titles....
6948 # However the current output is also pretty screwy.
6949 #
6950 # ----
6951 # I'm changing it to match the current output--it arguably makes more
6952 # sense in the light of the test above. Old expected result was:
6953 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
6954 #</p>
6955 # But I think this test is bordering on "garbage in, garbage out" anyway.
6956 # -- wtm
6957 !! test
6958 Piped link to URL
6959 !! wikitext
6960 Piped link to URL: [[http://www.example.com|an example URL]]
6961 !! html/php
6962 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
6963 </p>
6964 !! html/parsoid
6965 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
6966 !! end
6967
6968 !! test
6969 BUG 2: [[page|http://url/]] should link to page, not http://url/
6970 !! wikitext
6971 [[Main Page|http://url/]]
6972 !! html/php
6973 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
6974 </p>
6975 !! html/parsoid
6976 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
6977 !! end
6978
6979 # Parsoid does not mark self-links, by design.
6980 !! test
6981 BUG 337: Escaped self-links should be bold
6982 !! options
6983 title=[[Bug462]]
6984 !! wikitext
6985 [[Bu&#103;462]] [[Bug462]]
6986 !! html/php
6987 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
6988 </p>
6989 !! html/php+tidy
6990 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
6991 !! html/parsoid
6992 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
6993 !! end
6994
6995 !! test
6996 Self-link to section should not be bold
6997 !! options
6998 title=[[Main Page]]
6999 !! wikitext
7000 [[Main Page#section]]
7001 !! html
7002 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
7003 </p>
7004 !! end
7005
7006 !! article
7007 00
7008 !! text
7009 This is 00.
7010 !! endarticle
7011
7012 !!test
7013 Self-link to numeric title
7014 !!options
7015 title=[[0]]
7016 !! wikitext
7017 [[0]]
7018 !! html
7019 <p><strong class="selflink">0</strong>
7020 </p>
7021 !!end
7022
7023 !!test
7024 Link to numeric-equivalent title
7025 !!options
7026 title=[[0]]
7027 !! wikitext
7028 [[00]]
7029 !! html
7030 <p><a href="/wiki/00" title="00">00</a>
7031 </p>
7032 !!end
7033
7034 !! test
7035 <nowiki> inside a link
7036 !! wikitext
7037 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
7038 !! html
7039 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
7040 </p>
7041 !! end
7042
7043 !! test
7044 Non-breaking spaces in title
7045 !! wikitext
7046 [[&nbsp; Main &nbsp; Page &nbsp;]]
7047 !! html
7048 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
7049 </p>
7050 !!end
7051
7052 !! test
7053 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
7054 !! options
7055 language=ca
7056 !! wikitext
7057 '''[[Main Page]]'''
7058 !! html
7059 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
7060 </p>
7061 !! end
7062
7063 !! test
7064 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
7065 !! options
7066 language=ca
7067 !! wikitext
7068 ''[[Main Page]]''
7069 !! html
7070 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
7071 </p>
7072 !! end
7073
7074 !! test
7075 Internal link with en linktrail: no apostrophes (bug 27473)
7076 !! options
7077 language=en
7078 !! wikitext
7079 [[Something]]'nice
7080 !! html
7081 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
7082 </p>
7083 !! end
7084
7085 !! test
7086 Internal link with ca linktrail with apostrophes (bug 27473)
7087 !! options
7088 language=ca
7089 !! wikitext
7090 [[Something]]'nice
7091 !! html
7092 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
7093 </p>
7094 !! end
7095
7096 !! test
7097 Internal link with kaa linktrail with apostrophes (bug 27473)
7098 !! options
7099 language=kaa
7100 !! wikitext
7101 [[Something]]'nice
7102 !! html
7103 <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>
7104 </p>
7105 !! end
7106
7107 !! test
7108 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
7109 !! wikitext
7110 [[User:Foo/Test/63636:Bar|Test]]
7111 !! html/php
7112 <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>
7113 </p>
7114 !! html/parsoid
7115 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
7116 !! end
7117
7118 !! test
7119 Purely hash wikilink
7120 !! options
7121 title=[[User:test/123]]
7122 !! wikitext
7123 [[#a|b]]
7124 !! html/php
7125 <p><a href="#a">b</a>
7126 </p>
7127 !! html/parsoid
7128 <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>
7129 !! end
7130
7131 !! test
7132 1. Interaction of linktrail and template encapsulation
7133 !! options
7134 parsoid
7135 !! wikitext
7136 {{echo|[[Foo]]}}l
7137 !! html
7138 <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>
7139 !! end
7140
7141 !! test
7142 2. Interaction of linktrail and template encapsulation
7143 !! options
7144 parsoid
7145 !! wikitext
7146 {{echo|Some [[Fool]]}}s
7147 !! html
7148 <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>
7149 !! end
7150
7151 !! test
7152 3. Interaction of linktrail and template encapsulation
7153 !! options
7154 parsoid
7155 !! wikitext
7156 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
7157 !! html
7158 <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>
7159 !! end
7160
7161 !! article
7162 Söfnuður
7163 !! text
7164 Test.
7165 !! endarticle
7166
7167 !! test
7168 Internal link with is link prefix
7169 !! options
7170 language=is
7171 !! wikitext
7172 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
7173 !! html
7174 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
7175 </p>
7176 !! end
7177
7178 !! article
7179 Mótmælendatrú
7180 !! text
7181 Test.
7182 !! endarticle
7183
7184 !! test
7185 Internal link with is link trail and link prefix
7186 !! options
7187 language=is
7188 !! wikitext
7189 [[mótmælendatrú|xxx]]ar
7190 [[mótmælendatrú]]ar
7191 mótmælenda[[söfnuður]]
7192 mótmælenda[[söfnuður|söfnuðir]]
7193 mótmælenda[[söfnuður|söfnuðir]]xxx
7194 !! html
7195 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
7196 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
7197 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
7198 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
7199 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
7200 </p>
7201 !! end
7202
7203 !! test
7204 Parsoid link trail escaping
7205 !! options
7206 parsoid=html2wt,html2html
7207 !! html
7208 <p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p>
7209 !! wikitext
7210 [[apple]]<nowiki/>s
7211 !! end
7212
7213 !! test
7214 Parsoid link prefix escaping
7215 !! options
7216 language=is
7217 parsoid=html2wt,html2html
7218 !! html
7219 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p>
7220 !! wikitext
7221 Aðrir mótmælenda<nowiki/>[[söfnuður]]
7222 !! end
7223
7224 !! test
7225 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
7226 !! wikitext
7227 [[Foo| bar]]
7228
7229 [[Foo| ''bar'']]
7230
7231 [http://wp.org foo]
7232
7233 [http://wp.org ''foo'']
7234 !! html
7235 <p><a href="/wiki/Foo" title="Foo"> bar</a>
7236 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
7237 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
7238 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
7239 </p>
7240 !! end
7241
7242 !! test
7243 Parsoid: Scoped parsing should handle mixed transclusions and plain text
7244 !! options
7245 parsoid
7246 !! wikitext
7247 [[Foo|{{echo|a}} b {{echo|c}}]]
7248 !! html
7249 <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>
7250 !! end
7251
7252 !! test
7253 Link with angle bracket after anchor
7254 !! wikitext
7255 [[Foo#<bar>]]
7256 !! html/php
7257 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
7258 </p>
7259 !! html/parsoid
7260 <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>
7261 !! end
7262
7263 ###
7264 ### Interwiki links (see maintenance/interwiki.sql)
7265 ###
7266
7267 !! test
7268 Inline interwiki link
7269 !! options
7270 parsoid=wt2html,wt2wt,html2html
7271 !! wikitext
7272 [[MeatBall:SoftSecurity]]
7273 !! html/php
7274 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
7275 </p>
7276 !! html/parsoid
7277 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
7278 !! end
7279
7280 !! test
7281 Inline interwiki link with empty title (bug 2372)
7282 !! options
7283 parsoid=wt2html,wt2wt,html2html
7284 !! wikitext
7285 [[MeatBall:]]
7286 !! html/php
7287 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
7288 </p>
7289 !! html/parsoid
7290 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
7291 !! end
7292
7293 !! test
7294 Interwiki link encoding conversion (bug 1636)
7295 !! wikitext
7296 *[[Wikipedia:ro:Olteni&#0355;a]]
7297 *[[Wikipedia:ro:Olteni&#355;a]]
7298 !! html
7299 <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>
7300 <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>
7301
7302 !! html+tidy
7303 <ul>
7304 <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>
7305 <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>
7306 </ul>
7307 !! end
7308
7309 !! test
7310 Interwiki link with fragment (bug 2130)
7311 !! wikitext
7312 [[MeatBall:SoftSecurity#foo]]
7313 !! html
7314 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
7315 </p>
7316 !! end
7317
7318 # Ideally the wikipedia: prefix here should be proto-relative too
7319 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
7320 # define the 'en' prefix, and originally the test used 'wikipedia',
7321 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
7322 # article.
7323 !! test
7324 Different interwiki prefixes mapping to the same URL
7325 !! wikitext
7326 [[:en:Foo]]
7327
7328 [[:en:Foo|Foo]]
7329
7330 [[wikipedia:Foo]]
7331
7332 [[:wikipedia:Foo|Foo]]
7333
7334 [[wikipedia:en:Foo]]
7335
7336 [[:wikipedia:en:Foo]]
7337
7338 [[ wikiPEdia :Foo]]
7339 !! html/parsoid
7340 <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>
7341
7342 <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>
7343
7344 <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>
7345
7346 <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>
7347
7348 <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>
7349
7350 <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>
7351
7352 <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>
7353 !! end
7354
7355 !! test
7356 Interwiki links that cannot be represented in wiki syntax
7357 !! wikitext
7358 [[meatball:ok]]
7359 [[meatball:ok#foo|ok with fragment]]
7360 [[meatball:ok_as_well?|ok ending with ? mark]]
7361 [http://de.wikipedia.org/wiki/Foo?action=history has query]
7362 [http://de.wikipedia.org/wiki/#foo is just fragment]
7363
7364 !! html/php
7365 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
7366 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
7367 <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>
7368 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
7369 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
7370 </p>
7371 !! html/parsoid
7372 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
7373 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
7374 <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>
7375 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
7376 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
7377 !! end
7378
7379 !! test
7380 Interwiki links: trail
7381 !! wikitext
7382 [[wikipedia:Foo|Ba]]r
7383 !! html/php
7384 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
7385 </p>
7386 !! html/parsoid
7387 <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>
7388 !! end
7389
7390 !! test
7391 Local interwiki link
7392 !! options
7393 parsoid=wt2html,wt2wt,html2html
7394 !! wikitext
7395 [[local:Template:Foo]]
7396 !! html/php
7397 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
7398 </p>
7399 !! html/parsoid
7400 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
7401 !! end
7402
7403 # Parsoid does not mark self-links, by design.
7404 !! test
7405 Local interwiki link: self-link to current page
7406 !! options
7407 title=[[Main Page]]
7408 parsoid=wt2html,wt2wt,html2html
7409 !! wikitext
7410 [[local:Main Page]]
7411 !! html/php
7412 <p><strong class="selflink">local:Main Page</strong>
7413 </p>
7414 !! html/parsoid
7415 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
7416 !! end
7417
7418 !! test
7419 Local interwiki link: prefix only (bug 64167)
7420 !! options
7421 parsoid=wt2html,wt2wt,html2html
7422 !! wikitext
7423 [[local:]]
7424 !! html/php
7425 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
7426 </p>
7427 !! html/parsoid
7428 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
7429 !! end
7430
7431 !! test
7432 Local interwiki link: with additional interwiki prefix (bug 61357)
7433 !! options
7434 parsoid=wt2html,wt2wt,html2html
7435 !! wikitext
7436 [[local:meatball:Hello]]
7437 !! html/php
7438 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
7439 </p>
7440 !! html/parsoid
7441 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
7442 !! end
7443
7444 !! test
7445 Multiple local interwiki link prefixes
7446 !! wikitext
7447 [[local:local:local:local:mi:local:Foo]]
7448 !! options
7449 parsoid=wt2html,wt2wt,html2html
7450 !! html/php
7451 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
7452 </p>
7453 !! html/parsoid
7454 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
7455 !! end
7456
7457 ###
7458 ### Interlanguage links
7459 ### Language links (so that searching for '### language' matches..)
7460 ###
7461
7462 !! test
7463 Interlanguage link
7464 !! options
7465 parsoid=wt2html,wt2wt,html2html
7466 !! wikitext
7467 Blah blah blah
7468 [[zh:Chinese]]
7469 !! html/php
7470 <p>Blah blah blah
7471 </p>
7472 !! html/parsoid
7473 <p>Blah blah blah</p>
7474 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7475 !! end
7476
7477 !! test
7478 Interlanguage link with spacing
7479 !! options
7480 parsoid=wt2html,wt2wt,html2html
7481 !! wikitext
7482 Blah blah blah
7483 [[ zh : Chinese ]]
7484 !! html/php
7485 <p>Blah blah blah
7486 </p>
7487 !! html/parsoid
7488 <p>Blah blah blah</p>
7489 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7490 !! end
7491
7492 !! test
7493 Double interlanguage link
7494 !! options
7495 parsoid=wt2html,wt2wt,html2html
7496 !! wikitext
7497 Blah blah blah
7498 [[es:Spanish]]
7499 [[zh:Chinese]]
7500 !! html/php
7501 <p>Blah blah blah
7502 </p>
7503 !! html/parsoid
7504 <p>Blah blah blah</p>
7505 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
7506 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7507 !! end
7508
7509 !! test
7510 Interlanguage link variations
7511 !! options
7512 parsoid=wt2html,wt2wt,html2html
7513 !! wikitext
7514 Blah blah blah
7515 [[ es :Spanish]]
7516 [[ ZH :Chinese]]
7517 [[es:Foo_bar]]
7518 [[es:Foo bar]]
7519 !! html/php
7520 <p>Blah blah blah
7521 </p>
7522 !! html/parsoid
7523 <p>Blah blah blah</p>
7524 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
7525 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
7526 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
7527 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
7528 !! end
7529
7530 !! test
7531 Interlanguage link, with prefix links
7532 !! options
7533 language=ln
7534 !! wikitext
7535 Blah blah blah
7536 [[zh:Chinese]]
7537 !! html/php
7538 <p>Blah blah blah
7539 </p>
7540 !! html/parsoid
7541 <p>Blah blah blah</p>
7542 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7543 !! end
7544
7545 !! test
7546 Double interlanguage link, with prefix links (bug 8897)
7547 !! options
7548 language=ln
7549 !! wikitext
7550 Blah blah blah
7551 [[es:Spanish]]
7552 [[zh:Chinese]]
7553 !! html/php
7554 <p>Blah blah blah
7555 </p>
7556 !! html/parsoid
7557 <p>Blah blah blah</p>
7558 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
7559 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7560 !! end
7561
7562 !! test
7563 "Extra" interlanguage links (bug 32189 / gerrit 111390)
7564 !! wikitext
7565 Blah blah blah
7566 [[mul:Article]]
7567 !! html/php
7568 <p>Blah blah blah
7569 </p>
7570 !! html/parsoid
7571 <p>Blah blah blah</p>
7572 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
7573 !! end
7574
7575 !! test
7576 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
7577 !! options
7578 language=ln
7579 !! wikitext
7580 [[WW&nbsp;II]]
7581 !! html
7582 <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>
7583 </p>
7584 !! end
7585
7586 !! test
7587 Parsoid bug 53221: Wikilinks should be properly entity-escaped
7588 !! options
7589 parsoid=html2wt
7590 !! html
7591 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
7592 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
7593 !! wikitext
7594 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
7595
7596 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
7597 !! end
7598
7599 !! test
7600 Parsoid: handle constructor well
7601 !! wikitext
7602 [[constructor]]
7603
7604 [[constructor:foo]]
7605 !! html/php
7606 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
7607 </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>
7608 </p>
7609 !! html/parsoid
7610 <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>
7611
7612 <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>
7613 !! end
7614
7615 !! article
7616 ko:
7617 !! text
7618 Test.
7619 !! endarticle
7620
7621 # Note that `ko` isn't a known interlanguage prefix
7622 !! test
7623 Parsoid: recognize interlanguage links without a target page
7624 !! options
7625 ill
7626 !! wikitext
7627 [[es:]]
7628
7629 [[ko:]]
7630 !! html/php
7631 es:
7632 !! html/parsoid
7633 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
7634
7635 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
7636 !! end
7637
7638 # Note that `ko` isn't a known interwiki prefix
7639 !! test
7640 Parsoid: recognize interwiki links without a target page
7641 !! options
7642 parsoid=wt2html,wt2wt,html2html
7643 !! wikitext
7644 [[:es:]]
7645
7646 [[:ko:]]
7647 !! html/php
7648 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
7649 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
7650 </p>
7651 !! html/parsoid
7652 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
7653 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
7654 !! end
7655
7656 !! test
7657 Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
7658 !! wikitext
7659 [[mi:Foo]]
7660 !! html/php
7661 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
7662 </p>
7663 !! html/parsoid
7664 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
7665 !! end
7666
7667 !! test
7668 Interlanguage link with preceding local interwiki link (bug 68085)
7669 !! options
7670 parsoid=wt2html,wt2wt,html2html
7671 !! wikitext
7672 Blah blah blah
7673 [[local:es:Spanish]]
7674 !! html/php
7675 <p>Blah blah blah
7676 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
7677 </p>
7678 !! html/parsoid
7679 <p>Blah blah blah
7680 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
7681 !! end
7682
7683 !! test
7684 Looks like an interlanguage link, but is actually a local interwiki
7685 !! options
7686 parsoid=wt2html,wt2wt,html2html
7687 !! wikitext
7688 Blah blah blah
7689 [[mi:Template:Foo]]
7690 !! html/php
7691 <p>Blah blah blah
7692 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
7693 </p>
7694 !! html/parsoid
7695 <p>Blah blah blah
7696 <a rel="mw:WikiLink" href="Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
7697 !! end
7698
7699 ###
7700 ### Redirects, Parsoid-only
7701 ###
7702
7703 !! test
7704 1. Simple redirect to page
7705 !! options
7706 parsoid
7707 !! wikitext
7708 #REDIRECT [[Main Page]]
7709 !! html
7710 <link rel="mw:PageProp/redirect" href="./Main_Page">
7711 !! end
7712
7713 !! test
7714 2. Other redirect variants
7715 !! wikitext
7716 #REDIRECT [[Main_Page]]
7717 !! html/parsoid
7718 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
7719 !! end
7720
7721 !! test
7722 3. Other redirect variants
7723 !! wikitext
7724 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
7725 !! html/parsoid
7726 <link rel="mw:PageProp/redirect" href="./%5B%5BBar%5D%5D" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./%5B%5BBar%5D%5D"},"sa":{"href":"&lt;nowiki>[[Bar]]&lt;/nowiki>"}}'/>
7727 !! end
7728
7729 !! test
7730 Empty redirect
7731 !! options
7732 parsoid=wt2html,wt2wt
7733 !! wikitext
7734 #REDIRECT [[]]
7735 !! html
7736 <ol>
7737 <li>REDIRECT [[]]</li></ol>
7738 !! end
7739
7740 !! test
7741 Optional colon in #REDIRECT
7742 !! options
7743 # the colon is archaic syntax. we support it for wt2html, but we
7744 # don't care that it roundtrips back to the modern syntax.
7745 parsoid=wt2html,html2html
7746 !! wikitext
7747 #REDIRECT:[[Main Page]]
7748 !! html
7749 <link rel="mw:PageProp/redirect" href="./Main_Page">
7750 !! end
7751
7752 !! test
7753 Whitespace in #REDIRECT with optional colon
7754 !! options
7755 # the colon and gratuitous whitespace is archaic syntax. we support
7756 # it for wt2html, but we don't care that it roundtrips back to the
7757 # modern syntax (without extra whitespace)
7758 parsoid=wt2html,html2html
7759 !! wikitext
7760
7761 #REDIRECT
7762 :
7763 [[Main Page]]
7764 !! html
7765 <link rel="mw:PageProp/redirect" href="./Main_Page">
7766 !! end
7767
7768 !! test
7769 Piped link in #REDIRECT
7770 !! options
7771 # content after piped link is ignored. we support this syntax,
7772 # but don't care that the piped link is lost when we roundtrip this.
7773 parsoid=wt2html
7774 !! wikitext
7775 #REDIRECT [[Main Page|bar]]
7776 !! html
7777 <link rel="mw:PageProp/redirect" href="./Main_Page">
7778 !! end
7779
7780 !! test
7781 Redirect to category
7782 !! options
7783 parsoid=wt2wt,wt2html
7784 !! wikitext
7785 #REDIRECT [[Category:Foo]]
7786 !! html
7787 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
7788 !! end
7789
7790 !! test
7791 Redirect to category with URL encoding
7792 !! options
7793 parsoid=wt2html
7794 !! wikitext
7795 #REDIRECT [[Category%3AFoo]]
7796 !! html
7797 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
7798 !! end
7799
7800 !! test
7801 Redirect to category page
7802 !! options
7803 parsoid
7804 !! wikitext
7805 #REDIRECT [[:Category:Foo]]
7806 !! html
7807 <link rel="mw:PageProp/redirect" href="Category:Foo" title="Category:Foo"/>
7808 !! end
7809
7810 !! test
7811 Redirect to image page (1)
7812 !! options
7813 parsoid
7814 !! wikitext
7815 #REDIRECT [[File:Wiki.png]]
7816 !! html
7817 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
7818 !! end
7819
7820 !! test
7821 Redirect to image page (2)
7822 !! options
7823 parsoid
7824 !! wikitext
7825 #REDIRECT [[Image:Wiki.png]]
7826 !! html
7827 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
7828 !! end
7829
7830 !! test
7831 Redirect to language
7832 !! options
7833 parsoid
7834 !! wikitext
7835 #REDIRECT [[en:File:Wiki.png]]
7836 !! html
7837 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
7838 !! end
7839
7840 !! test
7841 Redirect to interwiki
7842 !! options
7843 parsoid
7844 !! wikitext
7845 #REDIRECT [[meatball:File:Wiki.png]]
7846 !! html
7847 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
7848 !! end
7849
7850 !! test
7851 Non-English #REDIRECT
7852 !! options
7853 parsoid
7854 language=is
7855 !! wikitext
7856 #TILVÍSUN [[Main Page]]
7857 !! html
7858 <link rel="mw:PageProp/redirect" href="./Main_Page">
7859 !! end
7860
7861 !! test
7862 Redirect syntax under text isn't considered a redirect
7863 !! wikitext
7864 some text
7865 #redirect [[Main Page]]
7866 !! html/parsoid
7867 <p>some text</p>
7868 <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>
7869 !! end
7870
7871 # FIXME: Should hoist the redirect to the top of the page and ensure there
7872 # is only one.
7873 !! test
7874 New redirect
7875 !! options
7876 parsoid=html2wt
7877 !! html
7878 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"></p>
7879 !! wikitext
7880 Foo
7881 #REDIRECT [[Foo]]
7882 !! end
7883
7884 ##
7885 ## XHTML tidiness
7886 ###
7887
7888 !! test
7889 <br> to <br />
7890 !! wikitext
7891 1<br>2<br />3
7892 !! html
7893 <p>1<br />2<br />3
7894 </p>
7895 !! end
7896
7897 !! test
7898 Broken br tag sanitization
7899 !! wikitext
7900 </br>
7901 !! html/php
7902 <p>&lt;/br&gt;
7903 </p>
7904 !! end
7905
7906 # TODO: Fix html2html mode (bug 51055)!
7907 !! test
7908 Parsoid: Broken br tag recognition
7909 !! options
7910 parsoid=wt2html
7911 !! wikitext
7912 </br>
7913
7914 <br/ >
7915 !! html+tidy
7916 <p><br /></p>
7917 <p><br /></p>
7918 !! end
7919
7920 !! test
7921 Incorrecly removing closing slashes from correctly formed XHTML
7922 !! wikitext
7923 <br style="clear:both;" />
7924 !! html
7925 <p><br style="clear:both;" />
7926 </p>
7927 !! end
7928
7929 !! test
7930 Failing to transform badly formed HTML into correct XHTML
7931 !! wikitext
7932 <br style="clear: left;">
7933 <br style="clear: right;">
7934 <br style="clear: both;">
7935 !! html
7936 <p><br style="clear: left;" />
7937 <br style="clear: right;" />
7938 <br style="clear: both;" />
7939 </p>
7940 !!end
7941
7942 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
7943 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
7944 !! test
7945 Handling html with a div self-closing tag
7946 !! wikitext
7947 <div title />
7948 <div title/>
7949 <div title/ >
7950 <div title=bar />
7951 <div title=bar/>
7952 <div title=bar/ >
7953 !! html/php
7954 <p>&lt;div title /&gt;
7955 &lt;div title/&gt;
7956 </p>
7957 <div>
7958 <p>&lt;div title=bar /&gt;
7959 &lt;div title=bar/&gt;
7960 </p>
7961 <div title="bar/"></div>
7962 </div>
7963
7964 !! html/parsoid
7965 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
7966 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
7967 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
7968 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
7969 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
7970 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
7971 !! end
7972
7973 !! test
7974 Handling html with a br self-closing tag
7975 !! wikitext
7976 <br title />
7977 <br title/>
7978 <br title/ >
7979 <br title=bar />
7980 <br title=bar/>
7981 <br title=bar/ >
7982 !! html/php
7983 <p><br title="title" />
7984 <br title="title" />
7985 <br />
7986 <br title="bar" />
7987 <br title="bar" />
7988 <br title="bar/" />
7989 </p>
7990 !! html/parsoid
7991 <p><br title="" />
7992 <br title="" />
7993 <br title="" />
7994 <br title="bar" />
7995 <br title="bar" />
7996 <br title="bar/" />
7997 </p>
7998 !! end
7999
8000 !! test
8001 Horizontal ruler (should it add that extra space?)
8002 !! wikitext
8003 <hr>
8004 <hr >
8005 foo <hr
8006 > bar
8007 !! html+tidy
8008 <hr />
8009 <hr />
8010 <p>foo</p>
8011 <hr />
8012 <p>bar</p>
8013 !! end
8014
8015 !! test
8016 Horizontal ruler -- 4+ dashes render hr
8017 !! wikitext
8018 ----
8019 !! html
8020 <hr />
8021
8022 !! end
8023
8024 !! test
8025 Horizontal ruler -- eats additional dashes on the same line
8026 !! wikitext
8027 ---------
8028 !! html
8029 <hr />
8030
8031 !! end
8032
8033 !! test
8034 Horizontal ruler -- does not collapse dashes on consecutive lines
8035 !! wikitext
8036 ----
8037 ----
8038 !! html
8039 <hr />
8040 <hr />
8041
8042 !! end
8043
8044 !! test
8045 Horizontal ruler -- <4 dashes render as plain text
8046 !! wikitext
8047 ---
8048 !! html
8049 <p>---
8050 </p>
8051 !! end
8052
8053 !! test
8054 Horizontal ruler -- Supports content following dashes on same line
8055 !! wikitext
8056 ---- Foo
8057 !! html
8058 <hr /> Foo
8059
8060 !! html+tidy
8061 <hr />
8062 <p>Foo</p>
8063 !! end
8064
8065 ###
8066 ### Block-level elements
8067 ###
8068 !! test
8069 Common list
8070 !! wikitext
8071 *Common list
8072 * item 2
8073 *item 3
8074 !! html
8075 <ul><li>Common list</li>
8076 <li> item 2</li>
8077 <li>item 3</li></ul>
8078
8079 !! end
8080
8081 !! test
8082 Numbered list
8083 !! wikitext
8084 #Numbered list
8085 #item 2
8086 # item 3
8087 !! html
8088 <ol><li>Numbered list</li>
8089 <li>item 2</li>
8090 <li> item 3</li></ol>
8091
8092 !! end
8093
8094 !! test
8095 Mixed list
8096 !! wikitext
8097 *Mixed list
8098 *# with numbers
8099 ** and bullets
8100 *# and numbers
8101 *bullets again
8102 **bullet level 2
8103 ***bullet level 3
8104 ***#Number on level 4
8105 **bullet level 2
8106 **#Number on level 3
8107 **#Number on level 3
8108 *#number level 2
8109 *Level 1
8110 *** Level 3
8111 #** Level 3, but ordered
8112 !! html
8113 <ul><li>Mixed list
8114 <ol><li> with numbers</li></ol>
8115 <ul><li> and bullets</li></ul>
8116 <ol><li> and numbers</li></ol></li>
8117 <li>bullets again
8118 <ul><li>bullet level 2
8119 <ul><li>bullet level 3
8120 <ol><li>Number on level 4</li></ol></li></ul></li>
8121 <li>bullet level 2
8122 <ol><li>Number on level 3</li>
8123 <li>Number on level 3</li></ol></li></ul>
8124 <ol><li>number level 2</li></ol></li>
8125 <li>Level 1
8126 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
8127 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
8128
8129 !! end
8130
8131 !! test
8132 Nested lists 1
8133 !! wikitext
8134 *foo
8135 **bar
8136 !! html
8137 <ul><li>foo
8138 <ul><li>bar</li></ul></li></ul>
8139
8140 !! end
8141
8142 !! test
8143 Nested lists 2
8144 !! wikitext
8145 **foo
8146 *bar
8147 !! html
8148 <ul><li><ul><li>foo</li></ul></li>
8149 <li>bar</li></ul>
8150
8151 !! end
8152
8153 !! test
8154 Nested lists 3 (first element empty)
8155 !! wikitext
8156 *
8157 **bar
8158 !! html
8159 <ul><li>
8160 <ul><li>bar</li></ul></li></ul>
8161
8162 !! end
8163
8164 !! test
8165 Nested lists 4 (first element empty)
8166 !! wikitext
8167 **
8168 *bar
8169 !! html
8170 <ul><li><ul><li></li></ul></li>
8171 <li>bar</li></ul>
8172
8173 !! end
8174
8175 !! test
8176 Nested lists 5 (both elements empty)
8177 !! wikitext
8178 **
8179 *
8180 !! html
8181 <ul><li><ul><li></li></ul></li>
8182 <li></li></ul>
8183
8184 !! end
8185
8186 !! test
8187 Nested lists 6 (both elements empty)
8188 !! wikitext
8189 *
8190 **
8191 !! html
8192 <ul><li>
8193 <ul><li></li></ul></li></ul>
8194
8195 !! end
8196
8197 !! test
8198 Nested lists 7 (skip initial nesting levels)
8199 !! wikitext
8200 *** foo
8201 !! html
8202 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
8203
8204 !! end
8205
8206 !! test
8207 Nested lists 8 (multiple nesting transitions)
8208 !! wikitext
8209 * foo
8210 *** bar
8211 ** baz
8212 * boo
8213 !! html
8214 <ul><li> foo
8215 <ul><li><ul><li> bar</li></ul></li>
8216 <li> baz</li></ul></li>
8217 <li> boo</li></ul>
8218
8219 !! end
8220
8221 !! test
8222 Nested lists 9 (extension interaction)
8223 !! options
8224 parsoid
8225 !! wikitext
8226 *<references />
8227 !! html/parsoid
8228 <ul><li data-parsoid='{}'><ol class="references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
8229 !! end
8230
8231 !! test
8232 1. Lists with start-of-line-transparent tokens before bullets: Comments
8233 !! wikitext
8234 *foo
8235 *<!--cmt-->bar
8236 <!--cmt-->*baz
8237 !! html
8238 <ul><li>foo</li>
8239 <li>bar</li>
8240 <li>baz</li></ul>
8241
8242 !! end
8243
8244 !! test
8245 2. Lists with start-of-line-transparent tokens before bullets: Template close
8246 !! wikitext
8247 *foo {{echo|bar
8248 }}*baz
8249 !! html
8250 <ul><li>foo bar</li>
8251 <li>baz</li></ul>
8252
8253 !! end
8254
8255 !! test
8256 List items are not parsed correctly following a <pre> block (bug 785)
8257 !! wikitext
8258 * <pre>foo</pre>
8259 * <pre>bar</pre>
8260 * zar
8261 !! html
8262 <ul><li> <pre>foo</pre></li>
8263 <li> <pre>bar</pre></li>
8264 <li> zar</li></ul>
8265
8266 !! end
8267
8268 !! test
8269 List items from template
8270 !! wikitext
8271
8272 {{inner list}}
8273 * item 2
8274
8275 * item 0
8276 {{inner list}}
8277 * item 2
8278
8279 * item 0
8280 * notSOL{{inner list}}
8281 * item 2
8282 !! html
8283 <ul><li> item 1</li>
8284 <li> item 2</li></ul>
8285 <ul><li> item 0</li>
8286 <li> item 1</li>
8287 <li> item 2</li></ul>
8288 <ul><li> item 0</li>
8289 <li> notSOL</li>
8290 <li> item 1</li>
8291 <li> item 2</li></ul>
8292
8293 !! end
8294
8295 !! test
8296 List interrupted by empty line or heading
8297 !! wikitext
8298 * foo
8299
8300 ** bar
8301 == A heading ==
8302 * Another list item
8303 !! html
8304 <ul><li> foo</li></ul>
8305 <ul><li><ul><li> bar</li></ul></li></ul>
8306 <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>
8307 <ul><li> Another list item</li></ul>
8308
8309 !!end
8310
8311 !!test
8312 Multiple list tags generated by templates
8313 !! wikitext
8314 {{echo|<li>}}a
8315 {{echo|<li>}}b
8316 {{echo|<li>}}c
8317 !! html
8318 <li>a
8319 <li>b
8320 <li>c</li>
8321 </li>
8322 </li>
8323
8324 !! html+tidy
8325 <ul>
8326 <li>a</li>
8327 <li>b</li>
8328 <li>c</li>
8329 </ul>
8330 !!end
8331
8332 !!test
8333 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
8334 !! wikitext
8335 *a
8336 <!--This line will NOT split the list-->
8337 *b
8338 <!--This line will NOT split the list either-->
8339 *c
8340 <!--foo--> <!----> <!--This line NOT split the list either-->
8341 *d
8342 !! html
8343 <ul><li>a</li>
8344 <li>b</li>
8345 <li>c</li>
8346 <li>d</li></ul>
8347
8348 !!end
8349
8350 !!test
8351 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
8352 !! wikitext
8353 *a
8354 <!--This line will NOT split the list-->
8355 *b
8356 <!--This line will NOT split the list either-->
8357 *c
8358 <!--foo--> <!----> <!--This line NOT split the list
8359 either-->
8360 *d
8361 !! html
8362 <ul><li>a</li>
8363 <li>b</li>
8364 <li>c</li>
8365 <li>d</li></ul>
8366
8367 !!end
8368
8369 !!test
8370 Test the li-hack
8371 (The PHP parser relies on Tidy for the hack)
8372 !!options
8373 parsoid=wt2html,wt2wt
8374 !! wikitext
8375 * foo
8376 * <li>li-hack
8377 * {{echo|<li>templated li-hack}}
8378 * <!--foo--> <li> unsupported li-hack with preceding comments
8379
8380 <ul>
8381 <li><li>not a li-hack
8382 </li>
8383 </ul>
8384 !! html+tidy
8385 <ul>
8386 <li>foo</li>
8387 <li>li-hack</li>
8388 <li>templated li-hack</li>
8389 <li>unsupported li-hack with preceding comments</li>
8390 </ul>
8391 <ul>
8392 <li>not a li-hack</li>
8393 </ul>
8394 !!end
8395
8396 !! test
8397 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
8398 !! options
8399 parsoid
8400 !! wikitext
8401 # foo
8402 ## bar
8403 * foo
8404 ** bar
8405 : foo
8406 :: bar
8407 !! html
8408 <ol>
8409 <li> foo<ol>
8410 <li> bar</li>
8411 </ol></li>
8412 </ol><ul>
8413 <li> foo<ul>
8414 <li> bar</li>
8415 </ul></li>
8416 </ul><dl>
8417 <dd> foo<dl>
8418 <dd> bar</dd>
8419 </dl></dd>
8420 </dl>
8421 !! end
8422
8423 !! test
8424 Parsoid: Test of whitespace serialization with Templated bullets
8425 !! options
8426 parsoid
8427 !! wikitext
8428 * {{bullet}}
8429 !! html
8430 <ul>
8431 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
8432 </ul>
8433 !! end
8434
8435 # ------------------------------------------------------------------------
8436 # The next set of tests are about Parsoid's ability to handle badly nested
8437 # tags (parse, minimize scope of fixup, and roundtrip back)
8438 # ------------------------------------------------------------------------
8439
8440 !! test
8441 Unbalanced closing block tags break a list
8442 (php parser relies on Tidy to fix up)
8443 !! wikitext
8444 <div>
8445 *a</div><div>
8446 *b</div>
8447 !! html+tidy
8448 <div>
8449 <ul>
8450 <li>a</li>
8451 </ul>
8452 </div>
8453 <div>
8454 <ul>
8455 <li>b</li>
8456 </ul>
8457 </div>
8458 !! end
8459
8460 # Parsoid fails this test, but it might be tricky to support properly.
8461 # See bug 68395.
8462 !! test
8463 Unbalanced closing non-block tags don't break a list
8464 (php parser relies on Tidy to fix up)
8465 !! wikitext
8466 <span>
8467 *a</span><span>
8468 *b</span>
8469 !! html/php+tidy
8470 <ul>
8471 <li><span>a</span></li>
8472 <li><span>b</span></li>
8473 </ul>
8474 !! html/parsoid
8475 <span>
8476 <ul>
8477 <li>a<span></span>
8478 </li>
8479 <li>b
8480 </li>
8481 </ul>
8482 </span>
8483 !! end
8484
8485 !! test
8486 Unclosed formatting tags that straddle lists are closed and reopened
8487 (php parser relies on Tidy to fix up)
8488 !! options
8489 parsoid=wt2html,wt2wt,html2html
8490 !! wikitext
8491 # <s> a
8492 # b </s>
8493 !! html/php+tidy
8494 <ol>
8495 <li><s>a</s></li>
8496 <li><s>b</s></li>
8497 </ol>
8498 !! html/parsoid
8499 <ol><li> <s> a</s></li>
8500 <li><s> b </s></li></ol>
8501 !! end
8502
8503 # See bug 68395.
8504 !!test
8505 1. List embedded in a formatting tag
8506 !! wikitext
8507 <small>
8508 * foo
8509 </small>
8510 !! html/php+tidy
8511 <ul>
8512 <li><small>foo</small></li>
8513 </ul>
8514 !! html/parsoid
8515 <small>
8516 <ul>
8517 <li> foo</li>
8518 </ul>
8519 </small>
8520 !!end
8521
8522 ## Ugly Parsoid output here
8523 ## Not sure what the right output is.
8524 !!test
8525 2. List embedded in a formatting tag
8526 !! wikitext
8527 <small>
8528 *a
8529 *b</small>
8530 !! html/php+tidy
8531 <ul>
8532 <li><small>a</small></li>
8533 <li><small>b</small></li>
8534 </ul>
8535 !! html/parsoid
8536 <small></small>
8537 <ul><small>
8538 <li>a</li>
8539 </small>
8540 <li><small>b</small></li>
8541 </ul>
8542 !!end
8543
8544 # Ugly Parsoid and PHP parser output here
8545 # Not sure if we want to make this a test!
8546 #
8547 ## !!test
8548 ## 3. Unclosed formatting tags in list elements
8549 ## !! wikitext
8550 ## *<small>a
8551 ## *<small>b
8552 ## !! html/php+tidy
8553 ## <ul>
8554 ## <li><small>a</small></li>
8555 ## <li><small><small>b</small></small></li>
8556 ## </ul>
8557 ## !! html/parsoid
8558 ## <ul>
8559 ## <li><small>a</small></li>
8560 ## <small>
8561 ## <li><small>b</small></li>
8562 ## </small></ul>
8563 ## !!end
8564
8565 # This is a bug in the PHP parser + tidy combination.
8566 # (The </tr> tag gets parsed as text and html-escaped by PHP,
8567 # and then fostered out of the table by tidy.)
8568 # We believe the Parsoid output to be correct.
8569 !! test
8570 Table with missing opening <tr> tag
8571 !! options
8572 parsoid=wt2html,wt2wt
8573 !! wikitext
8574 <table>
8575 <td>foo</td>
8576 </tr>
8577 </table>
8578 !! html+tidy
8579 <table>
8580 <tr>
8581 <td>foo</td>
8582 </tr>
8583 </table>
8584 !! end
8585
8586 ###
8587 ### Magic Words
8588 ###
8589
8590 # Note that the current date is hard-coded as
8591 # 1970-01-01T00:02:03Z (a Thursday)
8592 # when running parser tests. The timezone is also fixed to GMT, so
8593 # local date will be identical to current date.
8594
8595 !! test
8596 Magic Word: {{CURRENTDAY}}
8597 !! wikitext
8598 {{CURRENTDAY}}
8599 !! html
8600 <p>1
8601 </p>
8602 !! end
8603
8604 !! test
8605 Magic Word: {{CURRENTDAY2}}
8606 !! wikitext
8607 {{CURRENTDAY2}}
8608 !! html
8609 <p>01
8610 </p>
8611 !! end
8612
8613 !! test
8614 Magic Word: {{CURRENTDAYNAME}}
8615 !! wikitext
8616 {{CURRENTDAYNAME}}
8617 !! html
8618 <p>Thursday
8619 </p>
8620 !! end
8621
8622 !! test
8623 Magic Word: {{CURRENTDOW}}
8624 !! wikitext
8625 {{CURRENTDOW}}
8626 !! html
8627 <p>4
8628 </p>
8629 !! end
8630
8631 !! test
8632 Magic Word: {{CURRENTMONTH}}
8633 !! wikitext
8634 {{CURRENTMONTH}}
8635 !! html
8636 <p>01
8637 </p>
8638 !! end
8639
8640 !! test
8641 Magic Word: {{CURRENTMONTH1}}
8642 !! wikitext
8643 {{CURRENTMONTH1}}
8644 !! html
8645 <p>1
8646 </p>
8647 !! end
8648
8649 !! test
8650 Magic Word: {{CURRENTMONTHABBREV}}
8651 !! wikitext
8652 {{CURRENTMONTHABBREV}}
8653 !! html
8654 <p>Jan
8655 </p>
8656 !! end
8657
8658 !! test
8659 Magic Word: {{CURRENTMONTHNAME}}
8660 !! wikitext
8661 {{CURRENTMONTHNAME}}
8662 !! html
8663 <p>January
8664 </p>
8665 !! end
8666
8667 !! test
8668 Magic Word: {{CURRENTMONTHNAMEGEN}}
8669 !! wikitext
8670 {{CURRENTMONTHNAMEGEN}}
8671 !! html
8672 <p>January
8673 </p>
8674 !! end
8675
8676 !! test
8677 Magic Word: {{CURRENTTIME}}
8678 !! wikitext
8679 {{CURRENTTIME}}
8680 !! html
8681 <p>00:02
8682 </p>
8683 !! end
8684
8685 !! test
8686 Magic Word: {{CURRENTHOUR}}
8687 !! wikitext
8688 {{CURRENTHOUR}}
8689 !! html
8690 <p>00
8691 </p>
8692 !! end
8693
8694 !! test
8695 Magic Word: {{CURRENTWEEK}} (@bug 4594)
8696 !! wikitext
8697 {{CURRENTWEEK}}
8698 !! html
8699 <p>1
8700 </p>
8701 !! end
8702
8703 !! test
8704 Magic Word: {{CURRENTYEAR}}
8705 !! wikitext
8706 {{CURRENTYEAR}}
8707 !! html
8708 <p>1970
8709 </p>
8710 !! end
8711
8712 !! test
8713 Magic Word: {{CURRENTTIMESTAMP}}
8714 !! wikitext
8715 {{CURRENTTIMESTAMP}}
8716 !! html
8717 <p>19700101000203
8718 </p>
8719 !! end
8720
8721 !! test
8722 Magic Words LOCAL (UTC)
8723 !! wikitext
8724 * {{LOCALMONTH}}
8725 * {{LOCALMONTH1}}
8726 * {{LOCALMONTHNAME}}
8727 * {{LOCALMONTHNAMEGEN}}
8728 * {{LOCALMONTHABBREV}}
8729 * {{LOCALDAY}}
8730 * {{LOCALDAY2}}
8731 * {{LOCALDAYNAME}}
8732 * {{LOCALYEAR}}
8733 * {{LOCALTIME}}
8734 * {{LOCALHOUR}}
8735 * {{LOCALWEEK}}
8736 * {{LOCALDOW}}
8737 * {{LOCALTIMESTAMP}}
8738 !! html
8739 <ul><li> 01</li>
8740 <li> 1</li>
8741 <li> January</li>
8742 <li> January</li>
8743 <li> Jan</li>
8744 <li> 1</li>
8745 <li> 01</li>
8746 <li> Thursday</li>
8747 <li> 1970</li>
8748 <li> 00:02</li>
8749 <li> 00</li>
8750 <li> 1</li>
8751 <li> 4</li>
8752 <li> 19700101000203</li></ul>
8753
8754 !! end
8755
8756 !! test
8757 Magic Word: {{FULLPAGENAME}}
8758 !! options
8759 title=[[User:Ævar Arnfjörð Bjarmason]]
8760 !! wikitext
8761 {{FULLPAGENAME}}
8762 !! html
8763 <p>User:Ævar Arnfjörð Bjarmason
8764 </p>
8765 !! end
8766
8767 !! test
8768 Magic Word: {{FULLPAGENAMEE}}
8769 !! options
8770 title=[[User:Ævar Arnfjörð Bjarmason]]
8771 !! wikitext
8772 {{FULLPAGENAMEE}}
8773 !! html
8774 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8775 </p>
8776 !! end
8777
8778 !! test
8779 Magic Word: {{TALKSPACE}}
8780 !! options
8781 title=[[User:Ævar Arnfjörð Bjarmason]]
8782 !! wikitext
8783 {{TALKSPACE}}
8784 !! html
8785 <p>User talk
8786 </p>
8787 !! end
8788
8789 !! test
8790 Magic Word: {{TALKSPACE}}, same namespace
8791 !! options
8792 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8793 !! wikitext
8794 {{TALKSPACE}}
8795 !! html
8796 <p>User talk
8797 </p>
8798 !! end
8799
8800 !! test
8801 Magic Word: {{TALKSPACE}}, main namespace
8802 !! options
8803 title=[[Parser Test]]
8804 !! wikitext
8805 {{TALKSPACE}}
8806 !! html
8807 <p>Talk
8808 </p>
8809 !! end
8810
8811 !! test
8812 Magic Word: {{TALKSPACEE}}
8813 !! options
8814 title=[[User:Ævar Arnfjörð Bjarmason]]
8815 !! wikitext
8816 {{TALKSPACEE}}
8817 !! html
8818 <p>User_talk
8819 </p>
8820 !! end
8821
8822 !! test
8823 Magic Word: {{SUBJECTSPACE}}
8824 !! options
8825 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8826 !! wikitext
8827 {{SUBJECTSPACE}}
8828 !! html
8829 <p>User
8830 </p>
8831 !! end
8832
8833 !! test
8834 Magic Word: {{SUBJECTSPACE}}, same namespace
8835 !! options
8836 title=[[User:Ævar Arnfjörð Bjarmason]]
8837 !! wikitext
8838 {{SUBJECTSPACE}}
8839 !! html
8840 <p>User
8841 </p>
8842 !! end
8843
8844 !! test
8845 Magic Word: {{SUBJECTSPACE}}, main namespace
8846 !! options
8847 title=[[Parser Test]]
8848 !! wikitext
8849 {{SUBJECTSPACE}}
8850 !! html
8851
8852 !! end
8853
8854 !! test
8855 Magic Word: {{SUBJECTSPACEE}}
8856 !! options
8857 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8858 !! wikitext
8859 {{SUBJECTSPACEE}}
8860 !! html
8861 <p>User
8862 </p>
8863 !! end
8864
8865 !! test
8866 Magic Word: {{NAMESPACE}}
8867 !! options
8868 title=[[User:Ævar Arnfjörð Bjarmason]]
8869 !! wikitext
8870 {{NAMESPACE}}
8871 !! html
8872 <p>User
8873 </p>
8874 !! end
8875
8876 !! test
8877 Magic Word: {{NAMESPACEE}}
8878 !! options
8879 title=[[User:Ævar Arnfjörð Bjarmason]]
8880 !! wikitext
8881 {{NAMESPACEE}}
8882 !! html
8883 <p>User
8884 </p>
8885 !! end
8886
8887 !! test
8888 Magic Word: {{NAMESPACENUMBER}}
8889 !! options
8890 title=[[User:Ævar Arnfjörð Bjarmason]]
8891 !! wikitext
8892 {{NAMESPACENUMBER}}
8893 !! html
8894 <p>2
8895 </p>
8896 !! end
8897
8898 !! test
8899 Magic Word: {{SUBPAGENAME}}
8900 !! options
8901 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
8902 !! wikitext
8903 {{SUBPAGENAME}}
8904 !! html
8905 <p>sub ö
8906 </p>
8907 !! end
8908
8909 !! test
8910 Magic Word: {{SUBPAGENAMEE}}
8911 !! options
8912 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
8913 !! wikitext
8914 {{SUBPAGENAMEE}}
8915 !! html
8916 <p>sub_%C3%B6
8917 </p>
8918 !! end
8919
8920 !! test
8921 Magic Word: {{ROOTPAGENAME}}
8922 !! options
8923 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
8924 !! wikitext
8925 {{ROOTPAGENAME}}
8926 !! html
8927 <p>Ævar Arnfjörð Bjarmason
8928 </p>
8929 !! end
8930
8931 !! test
8932 Magic Word: {{ROOTPAGENAMEE}}
8933 !! options
8934 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
8935 !! wikitext
8936 {{ROOTPAGENAMEE}}
8937 !! html
8938 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8939 </p>
8940 !! end
8941
8942 !! test
8943 Magic Word: {{BASEPAGENAME}}
8944 !! options
8945 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
8946 !! wikitext
8947 {{BASEPAGENAME}}
8948 !! html
8949 <p>Ævar Arnfjörð Bjarmason
8950 </p>
8951 !! end
8952
8953 !! test
8954 Magic Word: {{BASEPAGENAMEE}}
8955 !! options
8956 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
8957 !! wikitext
8958 {{BASEPAGENAMEE}}
8959 !! html
8960 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8961 </p>
8962 !! end
8963
8964 !! test
8965 Magic Word: {{TALKPAGENAME}}
8966 !! options
8967 title=[[User:Ævar Arnfjörð Bjarmason]]
8968 !! wikitext
8969 {{TALKPAGENAME}}
8970 !! html
8971 <p>User talk:Ævar Arnfjörð Bjarmason
8972 </p>
8973 !! end
8974
8975 !! test
8976 Magic Word: {{TALKPAGENAMEE}}
8977 !! options
8978 title=[[User:Ævar Arnfjörð Bjarmason]]
8979 !! wikitext
8980 {{TALKPAGENAMEE}}
8981 !! html
8982 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8983 </p>
8984 !! end
8985
8986 !! test
8987 Magic Word: {{SUBJECTPAGENAME}}
8988 !! options
8989 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8990 !! wikitext
8991 {{SUBJECTPAGENAME}}
8992 !! html
8993 <p>User:Ævar Arnfjörð Bjarmason
8994 </p>
8995 !! end
8996
8997 !! test
8998 Magic Word: {{SUBJECTPAGENAMEE}}
8999 !! options
9000 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9001 !! wikitext
9002 {{SUBJECTPAGENAMEE}}
9003 !! html
9004 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9005 </p>
9006 !! end
9007
9008 !! test
9009 Magic Word: {{NUMBEROFFILES}}
9010 !! wikitext
9011 {{NUMBEROFFILES}}
9012 !! html
9013 <p>5
9014 </p>
9015 !! end
9016
9017 !! test
9018 Magic Word: {{PAGENAME}}
9019 !! options
9020 title=[[User:Ævar Arnfjörð Bjarmason]]
9021 !! wikitext
9022 {{PAGENAME}}
9023 !! html
9024 <p>Ævar Arnfjörð Bjarmason
9025 </p>
9026 !! end
9027
9028 !! test
9029 Magic Word: {{PAGENAME}} with metacharacters
9030 !! options
9031 title=[['foo & bar = baz']]
9032 !! wikitext
9033 ''{{PAGENAME}}''
9034 !! html/php
9035 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
9036 </p>
9037 !! html+tidy
9038 <p><i>'foo &amp; bar = baz'</i></p>
9039 !! end
9040
9041 !! test
9042 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
9043 !! options
9044 title=[[*RFC 1234 http://example.com/]]
9045 !! wikitext
9046 {{PAGENAME}}
9047 !! html/php
9048 <p>&#42;RFC&#32;1234 http&#58;//example.com/
9049 </p>
9050 !! html+tidy
9051 <p>*RFC 1234 http://example.com/</p>
9052 !! end
9053
9054 !! test
9055 Magic Word: {{PAGENAMEE}}
9056 !! options
9057 title=[[User:Ævar Arnfjörð Bjarmason]]
9058 !! wikitext
9059 {{PAGENAMEE}}
9060 !! html
9061 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9062 </p>
9063 !! end
9064
9065 !! test
9066 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
9067 !! options
9068 title=[[*RFC 1234 http://example.com/]]
9069 !! wikitext
9070 {{PAGENAMEE}}
9071 !! html/php
9072 <p>&#42;RFC_1234_http&#58;//example.com/
9073 </p>
9074 !! html+tidy
9075 <p>*RFC_1234_http://example.com/</p>
9076 !! end
9077
9078 !! test
9079 Magic Word: {{REVISIONID}}
9080 !! wikitext
9081 {{REVISIONID}}
9082 !! html
9083 <p>1337
9084 </p>
9085 !! end
9086
9087 !! test
9088 Magic Word: {{SCRIPTPATH}}
9089 !! wikitext
9090 {{SCRIPTPATH}}
9091 !! html
9092 <p>/
9093 </p>
9094 !! end
9095
9096 !! test
9097 Magic Word: {{STYLEPATH}}
9098 !! wikitext
9099 {{STYLEPATH}}
9100 !! html
9101 <p>/skins
9102 </p>
9103 !! end
9104
9105 !! test
9106 Magic Word: {{SERVER}}
9107 !! wikitext
9108 {{SERVER}}
9109 !! html
9110 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9111 </p>
9112 !! end
9113
9114 !! test
9115 Magic Word: {{SERVERNAME}}
9116 !! wikitext
9117 {{SERVERNAME}}
9118 !! html
9119 <p>example.org
9120 </p>
9121 !! end
9122
9123 !! test
9124 Magic Word: {{SITENAME}}
9125 !! wikitext
9126 {{SITENAME}}
9127 !! html
9128 <p>MediaWiki
9129 </p>
9130 !! end
9131
9132 !! test
9133 Case-sensitive magic words, when cased differently, should just be template transclusions
9134 !! wikitext
9135 {{CurrentMonth}}
9136 {{currentday}}
9137 {{cURreNTweEK}}
9138 {{currentHour}}
9139 !! html
9140 <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>
9141 <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>
9142 <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>
9143 <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>
9144 </p>
9145 !! end
9146
9147 !! test
9148 Case-insensitive magic words should still work with weird casing.
9149 !! wikitext
9150 {{sErVeRNaMe}}
9151 {{LCFirst:AOEU}}
9152 {{ucFIRST:aoeu}}
9153 {{SERver}}
9154 !! html
9155 <p>example.org
9156 aOEU
9157 Aoeu
9158 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9159 </p>
9160 !! end
9161
9162 # From plwiki:PLOS_ONE
9163 !! test
9164 Parsoid: Page property magic word with magic word contents
9165 !! wikitext
9166 {{DISPLAYTITLE:''{{PAGENAME}}''}}
9167 !! html/parsoid
9168 <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>"}]]}'/>
9169 !! end
9170
9171 !! test
9172 Parsoid: Template-generated DISPLAYTITLE
9173 !! wikitext
9174 {{{{echo|DISPLAYTITLE}}:Foo}}
9175 !! html/parsoid
9176 <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}}]}'/>
9177 !! end
9178
9179 !! test
9180 Namespace 1 {{ns:1}}
9181 !! wikitext
9182 {{ns:1}}
9183 !! html
9184 <p>Talk
9185 </p>
9186 !! end
9187
9188 !! test
9189 Namespace 1 {{ns:01}}
9190 !! wikitext
9191 {{ns:01}}
9192 !! html
9193 <p>Talk
9194 </p>
9195 !! end
9196
9197 !! test
9198 Namespace 0 {{ns:0}} (bug 4783)
9199 !! wikitext
9200 {{ns:0}}
9201 !! html
9202
9203 !! end
9204
9205 !! test
9206 Namespace 0 {{ns:00}} (bug 4783)
9207 !! wikitext
9208 {{ns:00}}
9209 !! html
9210
9211 !! end
9212
9213 !! test
9214 Namespace -1 {{ns:-1}}
9215 !! wikitext
9216 {{ns:-1}}
9217 !! html
9218 <p>Special
9219 </p>
9220 !! end
9221
9222 !! test
9223 Namespace User {{ns:User}}
9224 !! wikitext
9225 {{ns:User}}
9226 !! html
9227 <p>User
9228 </p>
9229 !! end
9230
9231 !! test
9232 Namespace User talk {{ns:User_talk}}
9233 !! wikitext
9234 {{ns:User_talk}}
9235 !! html
9236 <p>User talk
9237 </p>
9238 !! end
9239
9240 !! test
9241 Namespace User talk {{ns:uSeR tAlK}}
9242 !! wikitext
9243 {{ns:uSeR tAlK}}
9244 !! html
9245 <p>User talk
9246 </p>
9247 !! end
9248
9249 !! test
9250 Namespace File {{ns:File}}
9251 !! wikitext
9252 {{ns:File}}
9253 !! html
9254 <p>File
9255 </p>
9256 !! end
9257
9258 !! test
9259 Namespace File {{ns:Image}}
9260 !! wikitext
9261 {{ns:Image}}
9262 !! html
9263 <p>File
9264 </p>
9265 !! end
9266
9267 !! test
9268 Namespace (lang=de) Benutzer {{ns:User}}
9269 !! options
9270 language=de
9271 !! wikitext
9272 {{ns:User}}
9273 !! html
9274 <p>Benutzer
9275 </p>
9276 !! end
9277
9278 !! test
9279 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
9280 !! options
9281 language=de
9282 !! wikitext
9283 {{ns:3}}
9284 !! html
9285 <p>Benutzer Diskussion
9286 </p>
9287 !! end
9288
9289
9290 !! test
9291 Urlencode
9292 !! wikitext
9293 {{urlencode:hi world?!}}
9294 {{urlencode:hi world?!|WIKI}}
9295 {{urlencode:hi world?!|PATH}}
9296 {{urlencode:hi world?!|QUERY}}
9297 !! html
9298 <p>hi+world%3F%21
9299 hi_world%3F!
9300 hi%20world%3F%21
9301 hi+world%3F%21
9302 </p>
9303 !! end
9304
9305 !! test
9306 Magic Word: prioritize type info over data-parsoid
9307 !! options
9308 parsoid=html2wt
9309 !! html
9310 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
9311 !! wikitext
9312 __FORCETOC__
9313 !! end
9314
9315 !! test
9316 Magic Word: serialize on separate line (parsoid)
9317 !! options
9318 parsoid=wt2wt,html2wt
9319 !! wikitext
9320 foo
9321 __NOTOC__
9322 bar
9323 !! html
9324 foo<meta property="mw:PageProp/notoc"/>bar
9325 !! end
9326
9327 !! test
9328 Magic Word: rt non-english wikis
9329 !! options
9330 parsoid=wt2wt
9331 language=de
9332 !! wikitext
9333 __NOEDITSECTION__
9334 !! html
9335 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
9336 !! end
9337
9338 ###
9339 ### Magic links
9340 ###
9341 !! test
9342 Magic links: internal link to RFC (bug 479)
9343 !! wikitext
9344 [[RFC 123]]
9345 !! html
9346 <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>
9347 </p>
9348 !! end
9349
9350 !! test
9351 Magic links: RFC (bug 479)
9352 !! wikitext
9353 RFC 822
9354 !! html
9355 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
9356 </p>
9357 !! end
9358
9359 !! test
9360 Magic links: RFC (bug 65278)
9361 !! wikitext
9362 This is RFC 822 but thisRFC 822 is not RFC 822linked.
9363 !! html
9364 <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.
9365 </p>
9366 !! end
9367
9368 !! test
9369 Magic links: RFC (w/ non-newline whitespace, bug 28950/29025)
9370 !! wikitext
9371 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
9372 RFC
9373 822
9374 !! html
9375 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
9376 RFC
9377 822
9378 </p>
9379 !! end
9380
9381 !! test
9382 Magic links: ISBN (bug 1937)
9383 !! wikitext
9384 ISBN 0-306-40615-2
9385 !! html
9386 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
9387 </p>
9388 !! end
9389
9390 !! test
9391 Magic links: ISBN (bug 65278)
9392 !! wikitext
9393 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
9394 !! html/php
9395 <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.
9396 </p>
9397 !! html/parsoid
9398 <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>
9399 !! end
9400
9401 !! test
9402 Magic links: ISBN (w/ non-newline whitespace, bug 28950/29025)
9403 !! wikitext
9404 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
9405 ISBN
9406 9780316098113
9407 ISBN 978
9408 0316098113
9409 !! html
9410 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
9411 ISBN
9412 9780316098113
9413 ISBN 978
9414 0316098113
9415 </p>
9416 !! end
9417
9418 !! test
9419 Magic links: PMID incorrectly converts space to underscore
9420 !! wikitext
9421 PMID 1234
9422 !! html
9423 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
9424 </p>
9425 !! end
9426
9427 !! test
9428 Magic links: PMID (bug 65278)
9429 !! wikitext
9430 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
9431 !! html
9432 <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.
9433 </p>
9434 !! end
9435
9436 !! test
9437 Magic links: PMID (w/ non-newline whitespace, bug 28950/29025)
9438 !! wikitext
9439 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
9440 PMID
9441 1234
9442 !! html
9443 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
9444 PMID
9445 1234
9446 </p>
9447 !! end
9448
9449 ###
9450 ### Templates
9451 ####
9452
9453 !! test
9454 Nonexistent template
9455 !! wikitext
9456 {{thistemplatedoesnotexist}}
9457 !! html
9458 <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>
9459 </p>
9460 !! end
9461
9462 !! test
9463 Template with invalid target containing tags
9464 !! wikitext
9465 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
9466 !! html
9467 <p>{{a<b>b</b>|foo|a=b|a = b}}
9468 </p>
9469 !! end
9470
9471 !! test
9472 Template with invalid target containing unclosed tag
9473 !! wikitext
9474 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
9475 !! html
9476 <p>{{a<b>|foo|a=b|a = b}}</b>
9477 </p>
9478 !! end
9479
9480 !! test
9481 Template with invalid target containing wikilink
9482 !! wikitext
9483 {{[[Main Page]]}}
9484 !! html/php
9485 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
9486 </p>
9487 !! html/parsoid
9488 <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>
9489 !! end
9490
9491 !! test
9492 Template with just whitespace in it, bug #68421
9493 !! wikitext
9494 {{echo|{{ }}}}
9495 !! html/parsoid
9496 <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>
9497 !! end
9498
9499 !! article
9500 Template:test
9501 !! text
9502 This is a test template
9503 !! endarticle
9504
9505 !! test
9506 Simple template
9507 !! wikitext
9508 {{test}}
9509 !! html
9510 <p>This is a test template
9511 </p>
9512 !! end
9513
9514 !! test
9515 Template with explicit namespace
9516 !! wikitext
9517 {{Template:test}}
9518 !! html
9519 <p>This is a test template
9520 </p>
9521 !! end
9522
9523
9524 !! article
9525 Template:paramtest
9526 !! text
9527 This is a test template with parameter {{{param}}}
9528 !! endarticle
9529
9530 !! test
9531 Template parameter
9532 !! wikitext
9533 {{paramtest|param=foo}}
9534 !! html
9535 <p>This is a test template with parameter foo
9536 </p>
9537 !! end
9538
9539 !! article
9540 Template:paramtestnum
9541 !! text
9542 [[{{{1}}}|{{{2}}}]]
9543 !! endarticle
9544
9545 !! test
9546 Template unnamed parameter
9547 !! wikitext
9548 {{paramtestnum|Main Page|the main page}}
9549 !! html
9550 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
9551 </p>
9552 !! end
9553
9554 !! article
9555 Template:templatesimple
9556 !! text
9557 (test)
9558 !! endarticle
9559
9560 !! article
9561 Template:templateredirect
9562 !! text
9563 #redirect [[Template:templatesimple]]
9564 !! endarticle
9565
9566 !! article
9567 Template:templateasargtestnum
9568 !! text
9569 {{{{{1}}}}}
9570 !! endarticle
9571
9572 !! article
9573 Template:templateasargtest
9574 !! text
9575 {{template{{{templ}}}}}
9576 !! endarticle
9577
9578 !! article
9579 Template:templateasargtest2
9580 !! text
9581 {{{{{templ}}}}}
9582 !! endarticle
9583
9584 !! test
9585 Template with template name as unnamed argument
9586 !! wikitext
9587 {{templateasargtestnum|templatesimple}}
9588 !! html
9589 <p>(test)
9590 </p>
9591 !! end
9592
9593 !! test
9594 Template with template name as argument
9595 !! wikitext
9596 {{templateasargtest|templ=simple}}
9597 !! html
9598 <p>(test)
9599 </p>
9600 !! end
9601
9602 !! test
9603 Template with template name as argument (2)
9604 !! wikitext
9605 {{templateasargtest2|templ=templatesimple}}
9606 !! html
9607 <p>(test)
9608 </p>
9609 !! end
9610
9611 !! article
9612 Template:templateasargtestdefault
9613 !! text
9614 {{{{{templ|templatesimple}}}}}
9615 !! endarticle
9616
9617 !! article
9618 Template:templa
9619 !! text
9620 '''templ'''
9621 !! endarticle
9622
9623 !! test
9624 Template with default value
9625 !! wikitext
9626 {{templateasargtestdefault}}
9627 !! html
9628 <p>(test)
9629 </p>
9630 !! end
9631
9632 !! test
9633 Template with default value (value set)
9634 !! wikitext
9635 {{templateasargtestdefault|templ=templa}}
9636 !! html
9637 <p><b>templ</b>
9638 </p>
9639 !! end
9640
9641 !! test
9642 Template redirect
9643 !! wikitext
9644 {{templateredirect}}
9645 !! html
9646 <p>(test)
9647 </p>
9648 !! end
9649
9650 !! test
9651 Template with argument in separate line
9652 !! wikitext
9653 {{ templateasargtest |
9654 templ = simple }}
9655 !! html
9656 <p>(test)
9657 </p>
9658 !! end
9659
9660 !! test
9661 Template with complex template as argument
9662 !! wikitext
9663 {{paramtest|
9664 param ={{ templateasargtest |
9665 templ = simple }}}}
9666 !! html
9667 <p>This is a test template with parameter (test)
9668 </p>
9669 !! end
9670
9671 !! test
9672 Template with thumb image (with link in description)
9673 !! wikitext
9674 {{paramtest|param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
9675 !! html/php
9676 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>
9677
9678 !! html+tidy
9679 <p>This is a test template with parameter</p>
9680 <div class="thumb tright">
9681 <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>
9682 <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>
9683 </div>
9684 </div>
9685 !! html/parsoid
9686 <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>
9687 !! end
9688
9689 !! article
9690 Template:complextemplate
9691 !! text
9692 {{{1}}} {{paramtest|
9693 param ={{{param}}}}}
9694 !! endarticle
9695
9696 !! test
9697 Template with complex arguments
9698 !! wikitext
9699 {{complextemplate|
9700 param ={{ templateasargtest |
9701 templ = simple }}|[[Template:complextemplate|link]]}}
9702 !! html
9703 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
9704 </p>
9705 !! end
9706
9707 !! test
9708 BUG 553: link with two variables in a piped link
9709 !! wikitext
9710 {|
9711 |[[{{{1}}}|{{{2}}}]]
9712 |}
9713 !! html
9714 <table>
9715 <tr>
9716 <td>[[{{{1}}}|{{{2}}}]]
9717 </td></tr></table>
9718
9719 !! end
9720
9721 !! test
9722 Magic variable as template parameter
9723 !! wikitext
9724 {{paramtest|param={{SITENAME}}}}
9725 !! html
9726 <p>This is a test template with parameter MediaWiki
9727 </p>
9728 !! end
9729
9730 !! article
9731 Template:linktest
9732 !! text
9733 [[{{{param}}}|link]]
9734 !! endarticle
9735
9736 !! test
9737 Template parameter as link source
9738 !! wikitext
9739 {{linktest|param=Main Page}}
9740 !! html
9741 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
9742 </p>
9743 !! end
9744
9745 !!article
9746 Template:paramtest2
9747 !! text
9748 including another template, {{paramtest|param={{{arg}}}}}
9749 !! endarticle
9750
9751 !! test
9752 Template passing argument to another template
9753 !! wikitext
9754 {{paramtest2|arg='hmm'}}
9755 !! html
9756 <p>including another template, This is a test template with parameter 'hmm'
9757 </p>
9758 !! end
9759
9760 !! article
9761 Template:Linktest2
9762 !! text
9763 Main Page
9764 !! endarticle
9765
9766 !! test
9767 Template as link source
9768 !! wikitext
9769 [[{{linktest2}}]]
9770
9771 [[{{linktest2}}|Main Page]]
9772
9773 [[{{linktest2}}]]Page
9774 !! html
9775 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
9776 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
9777 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
9778 </p>
9779 !! end
9780
9781
9782 !! article
9783 Template:loop1
9784 !! text
9785 {{loop2}}
9786 !! endarticle
9787
9788 !! article
9789 Template:loop2
9790 !! text
9791 {{loop1}}
9792 !! endarticle
9793
9794 !! test
9795 Template infinite loop
9796 !! wikitext
9797 {{loop1}}
9798 !! html
9799 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
9800 </p>
9801 !! end
9802
9803 !! test
9804 Template from main namespace
9805 !! wikitext
9806 {{:Main Page}}
9807 !! html
9808 <p>blah blah
9809 </p>
9810 !! end
9811
9812 !! article
9813 Template:table
9814 !! text
9815 {|
9816 | 1 || 2
9817 |-
9818 | 3 || 4
9819 |}
9820 !! endarticle
9821
9822 !! test
9823 BUG 529: Template with table, not included at beginning of line
9824 !! wikitext
9825 foo {{table}}
9826 !! html
9827 <p>foo
9828 </p>
9829 <table>
9830 <tr>
9831 <td> 1 </td>
9832 <td> 2
9833 </td></tr>
9834 <tr>
9835 <td> 3 </td>
9836 <td> 4
9837 </td></tr></table>
9838
9839 !! end
9840
9841 !! test
9842 BUG 523: Template shouldn't eat newline (or add an extra one before table)
9843 !! wikitext
9844 foo
9845 {{table}}
9846 !! html
9847 <p>foo
9848 </p>
9849 <table>
9850 <tr>
9851 <td> 1 </td>
9852 <td> 2
9853 </td></tr>
9854 <tr>
9855 <td> 3 </td>
9856 <td> 4
9857 </td></tr></table>
9858
9859 !! end
9860
9861 !! test
9862 BUG 41: Template parameters shown as broken links
9863 !! wikitext
9864 {{{parameter}}}
9865 !! html
9866 <p>{{{parameter}}}
9867 </p>
9868 !! end
9869
9870 !! test
9871 Template with targets containing wikilinks
9872 !! wikitext
9873 {{[[foo]]}}
9874
9875 {{[[{{echo|foo}}]]}}
9876
9877 {{{{echo|[[foo}}]]}}
9878 !! html
9879 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
9880 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
9881 </p><p>{{[[foo}}]]
9882 </p>
9883 !! end
9884
9885 !! article
9886 Template:MSGNW test
9887 !! text
9888 ''None'' of '''this''' should be
9889 * interpreted
9890 but rather passed unmodified
9891 {{test}}
9892 <gallery>
9893 File:Foobar.jpg
9894 </gallery>
9895 !! endarticle
9896
9897 # hmm, fix this or just deprecate msgnw and document its behavior?
9898 !! test
9899 msgnw keyword
9900 !! wikitext
9901 {{msgnw:MSGNW test}}
9902 !! html
9903 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
9904 &#42; interpreted
9905 &#32;but rather passed unmodified
9906 &#123;&#123;test&#125;&#125;
9907 &#60;gallery&#62;
9908 File:Foobar.jpg
9909 &#60;/gallery&#62;
9910 </p>
9911 !! end
9912
9913 !! test
9914 int keyword
9915 !! wikitext
9916 {{int:youhavenewmessages|lots of money|not!}}
9917 !! html
9918 <p>You have lots of money (not!).
9919 </p>
9920 !! end
9921
9922 !! article
9923 Template:Includes
9924 !! text
9925 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
9926 !! endarticle
9927
9928 !! test
9929 <includeonly> and <noinclude> being included
9930 !! wikitext
9931 {{Includes}}
9932 !! html
9933 <p>Foobar
9934 </p>
9935 !! end
9936
9937 !! article
9938 Template:Includes2
9939 !! text
9940 <onlyinclude>Foo</onlyinclude>bar
9941 !! endarticle
9942
9943 !! test
9944 <onlyinclude> being included
9945 !! wikitext
9946 {{Includes2}}
9947 !! html
9948 <p>Foo
9949 </p>
9950 !! end
9951
9952
9953 !! article
9954 Template:Includes3
9955 !! text
9956 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
9957 !! endarticle
9958
9959 !! test
9960 <onlyinclude> and <includeonly> being included
9961 !! wikitext
9962 {{Includes3}}
9963 !! html
9964 <p>Foo
9965 </p>
9966 !! end
9967
9968 !! test
9969 <includeonly> and <noinclude> on a page
9970 !! wikitext
9971 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
9972 !! html
9973 <p>Foozar
9974 </p>
9975 !! end
9976
9977 !! test
9978 Un-closed <noinclude>
9979 !! wikitext
9980 <noinclude>
9981 !! html
9982 !! end
9983
9984 !! test
9985 <onlyinclude> on a page
9986 !! wikitext
9987 <onlyinclude>Foo</onlyinclude>bar
9988 !! html
9989 <p>Foobar
9990 </p>
9991 !! end
9992
9993 !! test
9994 Un-closed <onlyinclude>
9995 !! wikitext
9996 <onlyinclude>
9997 !! html
9998 !! end
9999
10000 !!test
10001 Self-closed noinclude, includeonly, onlyinclude tags
10002 !! wikitext
10003 <noinclude />
10004 <includeonly />
10005 <onlyinclude />
10006 !! html
10007 <p><br />
10008 </p>
10009 !!end
10010
10011 !!test
10012 Unbalanced includeonly and noinclude tags
10013 !! wikitext
10014 {|
10015 |a</noinclude>
10016 |b</noinclude></noinclude>
10017 |c</noinclude></includeonly>
10018 |d</includeonly></includeonly>
10019 |}
10020 !! html
10021 <table>
10022 <tr>
10023 <td>a
10024 </td>
10025 <td>b
10026 </td>
10027 <td>c&lt;/includeonly&gt;
10028 </td>
10029 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
10030 </td></tr></table>
10031
10032 !!end
10033
10034 !! article
10035 Template:Includeonly section
10036 !! text
10037 <includeonly>
10038 ==Includeonly section==
10039 </includeonly>
10040 ==Section T-1==
10041 !!endarticle
10042
10043 !! test
10044 Bug 6563: Edit link generation for section shown by <includeonly>
10045 !! wikitext
10046 {{includeonly section}}
10047 !! html
10048 <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>
10049 <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>
10050
10051 !! end
10052
10053 # Uses same input as the contents of [[Template:Includeonly section]]
10054 !! test
10055 Bug 6563: Section extraction for section shown by <includeonly>
10056 !! options
10057 section=T-2
10058 !! wikitext
10059 <includeonly>
10060 ==Includeonly section==
10061 </includeonly>
10062 ==Section T-2==
10063 !! html
10064 ==Section T-2==
10065 !! end
10066
10067 !! test
10068 Bug 6563: Edit link generation for section suppressed by <includeonly>
10069 !! wikitext
10070 <includeonly>
10071 ==Includeonly section==
10072 </includeonly>
10073 ==Section 1==
10074 !! html
10075 <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>
10076
10077 !! end
10078
10079 !! test
10080 Bug 6563: Section extraction for section suppressed by <includeonly>
10081 !! options
10082 section=1
10083 !! wikitext
10084 <includeonly>
10085 ==Includeonly section==
10086 </includeonly>
10087 ==Section 1==
10088 !! html
10089 ==Section 1==
10090 !! end
10091
10092 !! test
10093 Un-closed <includeonly>
10094 !! wikitext
10095 <includeonly>
10096 !! html
10097 !! end
10098
10099 !! test
10100 Includes and comments at SOL
10101 !! wikitext
10102 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
10103
10104 <noinclude>
10105 some
10106 </noinclude>* stuff
10107 * here
10108
10109 <includeonly>can have stuff</includeonly>=== here ===
10110
10111 !! html/php
10112 <h2><span class="mw-headline" id="hu">hu</span></h2>
10113 <p>some
10114 </p>
10115 <ul><li> stuff</li>
10116 <li> here</li></ul>
10117 <h3><span class="mw-headline" id="here">here</span></h3>
10118
10119 !! html/parsoid
10120 <!-- 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>
10121
10122 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
10123 <p>some</p>
10124 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
10125 <li> here</li></ul>
10126
10127 <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>
10128
10129 !! end
10130
10131 # TODO: test with DOM fragment reuse!
10132 !! test
10133 Parsoid: DOM fragment reuse
10134 !! options
10135 parsoid=wt2wt,wt2html
10136 !! wikitext
10137 a{{echo|b<table></table>c}}d
10138
10139 a{{echo|b
10140 <table></table>
10141 c}}d
10142
10143 {{echo|a
10144
10145 <table></table>
10146
10147 b}}
10148 !! html
10149 <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>
10150
10151 <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">
10152 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
10153 </span><p about="#mwt2">cd</p>
10154
10155 <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">
10156
10157 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
10158
10159 </span><p about="#mwt3">b</p>
10160 !! end
10161
10162 !! test
10163 Parsoid: Merge double tds (bug 50603)
10164 !! options
10165 parsoid
10166 !! wikitext
10167 {|
10168 |{{echo|{{!}} foo}}
10169 |}
10170 !! html
10171 <table><tbody>
10172 <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>
10173 </tbody></table>
10174 !! end
10175
10176 !! test
10177 Parsoid: Merge double tds in nested transclusion content (bug 50603)
10178 !! options
10179 parsoid
10180 !! wikitext
10181 {{echo|<div>}}
10182 {|
10183 |{{echo|{{!}} foo}}
10184 |}
10185 {{echo|</div>}}
10186 !! html
10187 <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}}]}'>
10188 <table><tbody>
10189 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
10190 </tbody></table>
10191 </div>
10192 !! end
10193
10194 ###
10195 ### <includeonly> and <noinclude> in attributes
10196 ###
10197 !!test
10198 0. includeonly around the entire attribute
10199 !! wikitext
10200 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
10201 !! html
10202 <p><span id="v2">bar</span>
10203 </p>
10204 !!end
10205
10206 !!test
10207 1. includeonly in html attr key
10208 !! wikitext
10209 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
10210 !! html
10211 <p><span id="foo">bar</span>
10212 </p>
10213 !!end
10214
10215 !!test
10216 2. includeonly in html attr value
10217 !! wikitext
10218 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
10219 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
10220 !! html
10221 <p><span id="v1">bar</span>
10222 <span id="v1">bar</span>
10223 </p>
10224 !!end
10225
10226 !!test
10227 3. includeonly in part of an attr value
10228 !! wikitext
10229 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
10230 !! html
10231 <p><span style="color:red;">bar</span>
10232 </p>
10233 !!end
10234
10235 !!test
10236 4. includeonly in table attributes
10237 !! wikitext
10238 {|
10239 |- <noinclude>
10240 |-
10241 |a
10242 </noinclude>
10243 |- <includeonly>
10244 |-
10245 |b
10246 </includeonly>
10247 |}
10248 !! html
10249 <table>
10250
10251
10252 <tr>
10253 <td>a
10254 </td></tr>
10255 </table>
10256
10257 !!end
10258
10259 ###
10260 ### Token Stream Patcher tests
10261 ###
10262 ### These tests won't always pass wt2wt and other modes because
10263 ### on serialization, the table will be output on a new line.
10264 ### For now, we are blacklisting them, and using this to test selser.
10265 ###
10266
10267 !!test
10268 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
10269 !!options
10270 parsoid=wt2html,wt2wt
10271 !!wikitext
10272 {{echo|}}{| width = '100%'
10273 |foo
10274 |}
10275 !!html/parsoid
10276 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
10277 <tbody><tr><td>foo</td></tr>
10278 </tbody></table>
10279 !!end
10280
10281 !!test
10282 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
10283 !!options
10284 parsoid=wt2html,wt2wt
10285 !!wikitext
10286 <includeonly>a</includeonly>{| {{{b}}}
10287 |c
10288 |}
10289 !!html/parsoid
10290 <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}}}":""}}'>
10291 <tbody><tr><td>c</td></tr>
10292 </tbody></table>
10293
10294 !!end
10295
10296 ###
10297 ### Testing parsing of templates where a template arg
10298 ### has the same name as the template itself.
10299 ###
10300
10301 !! article
10302 Template:quote
10303 !! text
10304 {{{quote|{{{1}}}}}}
10305 !! endarticle
10306
10307 !!test
10308 Templates: Template Name/Arg clash: 1. Use of positional param
10309 !! wikitext
10310 {{quote|foo}}
10311 !! html
10312 <p>foo
10313 </p>
10314 !!end
10315
10316 !!test
10317 Templates: Template Name/Arg clash: 2. Use of named param
10318 !! wikitext
10319 {{quote|quote=foo}}
10320 !! html
10321 <p>foo
10322 </p>
10323 !!end
10324
10325 !!test
10326 Templates: Template Name/Arg clash: 3. Use of named param with empty input
10327 !! wikitext
10328 {{quote|quote}}
10329 !! html
10330 <p>quote
10331 </p>
10332 !!end
10333
10334 ###
10335 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
10336 ###
10337
10338 !!test
10339 Templates: 1. Simple use
10340 !! wikitext
10341 {{echo|Foo}}
10342 !! html
10343 <p>Foo
10344 </p>
10345 !!end
10346
10347 !!test
10348 Templates: 2. Inside a block tag
10349 !! wikitext
10350 <div>{{echo|Foo}}</div>
10351 <blockquote>{{echo|Foo}}</blockquote>
10352 !! html
10353 <div>Foo</div>
10354 <blockquote>Foo</blockquote>
10355
10356 !! html+tidy
10357 <div>Foo</div>
10358 <blockquote>
10359 <p>Foo</p>
10360 </blockquote>
10361 !!end
10362
10363 !!test
10364 Templates: P-wrapping: 1a. Templates on consecutive lines
10365 !! wikitext
10366 {{echo|Foo}}
10367 {{echo|bar}}
10368 !! html
10369 <p>Foo
10370 bar
10371 </p>
10372 !!end
10373
10374 !!test
10375 Templates: P-wrapping: 1b. Templates on consecutive lines
10376 !! wikitext
10377 Foo
10378
10379 {{echo|bar}}
10380 {{echo|baz}}
10381 !! html
10382 <p>Foo
10383 </p><p>bar
10384 baz
10385 </p>
10386 !!end
10387
10388 !!test
10389 Templates: P-wrapping: 1c. Templates on consecutive lines
10390 !! wikitext
10391 {{echo|Foo}}
10392 {{echo|bar}} <div>baz</div>
10393 !! html
10394 <p>Foo
10395 </p>
10396 bar <div>baz</div>
10397
10398 !! html+tidy
10399 <p>Foo</p>
10400 <p>bar</p>
10401 <div>baz</div>
10402 !! end
10403
10404 !!test
10405 Templates: P-wrapping: 1d. Template preceded by comment-only line
10406 !!options
10407 parsoid
10408 !! wikitext
10409 <!-- foo -->
10410 {{echo|Bar}}
10411 !! html
10412 <!-- foo -->
10413
10414 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
10415 !!end
10416
10417 !!test
10418 Templates: Inline Text: 1. Multiple template uses
10419 !! wikitext
10420 {{echo|Foo}}bar{{echo|baz}}
10421 !! html
10422 <p>Foobarbaz
10423 </p>
10424 !!end
10425
10426 !!test
10427 Templates: Inline Text: 2. Back-to-back template uses
10428 !! wikitext
10429 {{echo|Foo}}{{echo|bar}}
10430 !! html
10431 <p>Foobar
10432 </p>
10433 !!end
10434
10435 !!test
10436 Templates: Block Tags: 1. Multiple template uses
10437 !! wikitext
10438 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
10439 !! html
10440 <div>Foo</div><div>bar</div><div>baz</div>
10441
10442 !!end
10443
10444 !!test
10445 Templates: Block Tags: 2. Back-to-back template uses
10446 !! wikitext
10447 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
10448 !! html
10449 <div>Foo</div><div>bar</div>
10450
10451 !!end
10452
10453 # This is an edge case relating to paragraph wrapping.
10454 !!test
10455 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
10456 !! wikitext
10457 {{echo|a
10458 b</p>}}
10459 !! html/parsoid
10460 <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
10461 b</p>
10462 !!end
10463
10464 !!test
10465 Templates: Links: 1. Simple example
10466 !! wikitext
10467 {{echo|[[Foo|bar]]}}
10468 !! html
10469 <p><a href="/wiki/Foo" title="Foo">bar</a>
10470 </p>
10471 !!end
10472
10473 !!test
10474 Templates: Links: 2. Generation of link href
10475 !! wikitext
10476 [[{{echo|Foo}}|bar]]
10477 !! html
10478 <p><a href="/wiki/Foo" title="Foo">bar</a>
10479 </p>
10480 !!end
10481
10482 !!test
10483 Templates: Links: 3. Generation of part of a link href
10484 !! wikitext
10485 [[Fo{{echo|o}}|bar]]
10486
10487 [[Foo{{echo|bar}}]]
10488
10489 [[Foo{{echo|bar}}baz]]
10490
10491 [[Foo{{echo|bar}}|bar]]
10492
10493 [[:Foo{{echo|bar}}]]
10494
10495 [[:Foo{{echo|bar}}|bar]]
10496 !! html
10497 <p><a href="/wiki/Foo" title="Foo">bar</a>
10498 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
10499 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
10500 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
10501 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
10502 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
10503 </p>
10504 !!end
10505
10506 !!test
10507 Templates: Links: 4. Multiple templates generating link href
10508 !! wikitext
10509 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
10510 !! html
10511 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
10512 </p>
10513 !!end
10514
10515 !!test
10516 Templates: Links: 5. Generation of link text
10517 !! wikitext
10518 [[Foo|{{echo|bar}}]]
10519 !! html
10520 <p><a href="/wiki/Foo" title="Foo">bar</a>
10521 </p>
10522 !!end
10523
10524 !!test
10525 Templates: Links: 5. Nested templates (only outermost template should be marked)
10526 !! wikitext
10527 {{echo|[[{{echo|Foo}}|bar]]}}
10528 !! html
10529 <p><a href="/wiki/Foo" title="Foo">bar</a>
10530 </p>
10531 !!end
10532
10533 !!test
10534 Templates: HTML Tag: 1. Generation of HTML attr. key
10535 !! wikitext
10536 <div {{echo|style}}="color:red;">foo</div>
10537 !! html
10538 <div style="color:red;">foo</div>
10539
10540 !!end
10541
10542 !!test
10543 Templates: HTML Tag: 2. Generation of HTML attr. value
10544 !! wikitext
10545 <div style={{echo|'color:red;'}}>foo</div>
10546 !! html
10547 <div style="color:red;">foo</div>
10548
10549 !!end
10550
10551 !!test
10552 Templates: HTML Tag: 3. Generation of HTML attr key and value
10553 !! wikitext
10554 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
10555 !! html
10556 <div style="color:red;">foo</div>
10557
10558 !!end
10559
10560 !!test
10561 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
10562 !! wikitext
10563 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
10564 !! html
10565 <div title="This is a long title with just one piece templated">foo</div>
10566
10567 !!end
10568
10569 !!test
10570 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
10571 !! wikitext
10572 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
10573 !! html
10574 <div title="This is a long title with just one piece templated">foo</div>
10575
10576 !!end
10577
10578 !!test
10579 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
10580 !! wikitext
10581 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
10582 !! html
10583 <div title="This is a long title with just one piece templated">foo</div>
10584
10585 !!end
10586
10587 # SSS FIXME: While it is great we added support for all this,
10588 # do we want to make this part of the spec? Maybe we want to
10589 # deprecate this kind of usage in the future?
10590 !!test
10591 Templates: HTML Tag: 7. Generation of partial attribute key string
10592 !! wikitext
10593 <div st{{echo|yle}}="color:red;">foo</div>
10594 !! html
10595 <div style="color:red;">foo</div>
10596
10597 !!end
10598
10599 !! test
10600 Templates: HTML Tag: 8. Template-generated attribute (k=v)
10601 !! wikitext
10602 <div {{echo|1=id="v1"}}>bar</div>
10603 !! html
10604 <div id="v1">bar</div>
10605
10606 !!end
10607
10608 !! test
10609 Templates: HTML Tag: 9. Multiple template-generated attributes
10610 !! wikitext
10611 <div {{echo|1=id="v1" title="foo"}}>bar</div>
10612 !! html
10613 <div id="v1" title="foo">bar</div>
10614
10615 !!end
10616
10617 !! test
10618 Templates: Support for templates generating attributes and content
10619 !! wikitext
10620 {| {{mixed_attr_content_template}}
10621 |-
10622 |bar
10623 |}
10624 !! html/php
10625 <table style="color:red;" title="T48811">
10626
10627 <tr>
10628 <td>foo
10629 </td></tr>
10630 <tr>
10631 <td>bar
10632 </td></tr></table>
10633
10634 !! html/parsoid
10635 <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|}"]}'>
10636 <tbody><tr>
10637 <td>foo</td></tr>
10638 <tr>
10639 <td>bar</td></tr>
10640 </tbody></table>
10641 !!end
10642
10643 !! test
10644 1. Entities and nowikis inside templated attributes should be handled correctly
10645 !! wikitext
10646 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
10647 !! html/php
10648 <div style="background:#f9f9f9;">foo</div>
10649
10650 !! html/parsoid
10651 <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>
10652 !! end
10653
10654 !! test
10655 2. Entities and nowikis inside templated attributes should be handled correctly
10656 !! wikitext
10657 {|
10658 |{{table_attribs_3}}
10659 |}
10660 !! html/php
10661 <table>
10662 <tr>
10663 <td style="background:#f9f9f9;">Foo
10664 </td></tr></table>
10665
10666 !! html/parsoid
10667 <table>
10668 <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>
10669 </tbody></table>
10670 !! end
10671
10672 !!test
10673 Templates: HTML Tables: 1. Generating start of a HTML table
10674 !! wikitext
10675 {{echo|<table><tr><td>foo</td>}}</tr></table>
10676 !! html
10677 <table><tr><td>foo</td></tr></table>
10678
10679 !!end
10680
10681 !!test
10682 Templates: HTML Tables: 2a. Generating middle of a HTML table
10683 !! wikitext
10684 <table><tr>{{echo|<td>foo</td>}}</tr></table>
10685 !! html
10686 <table><tr><td>foo</td></tr></table>
10687
10688 !!end
10689
10690 !!test
10691 Templates: HTML Tables: 2b. Generating middle of a HTML table
10692 !! wikitext
10693 <table>{{echo|<tr><td>foo</td></tr>}}</table>
10694 !! html
10695 <table><tr><td>foo</td></tr></table>
10696
10697 !!end
10698
10699 !!test
10700 Templates: HTML Tables: 3. Generating end of a HTML table
10701 !! wikitext
10702 <table><tr>{{echo|<td>foo</td></tr></table>}}
10703 !! html
10704 <table><tr><td>foo</td></tr></table>
10705
10706 !!end
10707
10708 !!test
10709 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
10710 !! wikitext
10711 {{echo|<table>}}<tr><td>foo</td></tr></table>
10712 !! html
10713 <table><tr><td>foo</td></tr></table>
10714
10715 !!end
10716
10717 !!test
10718 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
10719 !! wikitext
10720 <table>{{echo|<tr>}}<td>foo</td></tr></table>
10721 !! html
10722 <table><tr><td>foo</td></tr></table>
10723
10724 !!end
10725
10726 !!test
10727 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
10728 !! wikitext
10729 <table><tr>{{echo|<td>}}foo</td></tr></table>
10730 !! html
10731 <table><tr><td>foo</td></tr></table>
10732
10733 !!end
10734
10735 !!test
10736 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
10737 !! wikitext
10738 <table><tr><td>foo{{echo|</td>}}</tr></table>
10739 !! html
10740 <table><tr><td>foo</td></tr></table>
10741
10742 !!end
10743
10744 !!test
10745 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
10746 !! wikitext
10747 <table><tr><td>foo</td>{{echo|</tr>}}</table>
10748 !! html
10749 <table><tr><td>foo</td></tr></table>
10750
10751 !!end
10752
10753 !!test
10754 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
10755 !! wikitext
10756 <table><tr><td>foo</td></tr>{{echo|</table>}}
10757 !! html
10758 <table><tr><td>foo</td></tr></table>
10759
10760 !!end
10761
10762 !!test
10763 Templates: HTML Tables: 5. Proper fostering of categories from inside
10764 !!options
10765 parsoid=wt2html,wt2wt
10766 !! wikitext
10767 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
10768 <!--Two categories (Bug 50330)-->
10769 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
10770 !! html
10771 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
10772 <!--Two categories (Bug 50330)-->
10773 <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>
10774 !!end
10775
10776 !!test
10777 Templates: Wiki Tables: 1a. Fostering of entire template content
10778 !! wikitext
10779 {|
10780 {{echo|a}}
10781 |}
10782 !! html
10783 <table>
10784 a
10785 <tr><td></td></tr></table>
10786
10787 !! html+tidy
10788 <p>a</p>
10789 <table>
10790 <tr>
10791 <td></td>
10792 </tr>
10793 </table>
10794 !! end
10795
10796 !!test
10797 Templates: Wiki Tables: 1b. Fostering of entire template content
10798 !! wikitext
10799 {|
10800 {{echo|<div>}}
10801 foo
10802 {{echo|</div>}}
10803 |}
10804 !! html
10805 <table>
10806 <div>
10807 <p>foo
10808 </p>
10809 </div>
10810 <tr><td></td></tr></table>
10811
10812 !! html+tidy
10813 <div>
10814 <p>foo</p>
10815 </div>
10816 <table>
10817 <tr>
10818 <td></td>
10819 </tr>
10820 </table>
10821 !! end
10822
10823 !!test
10824 Templates: Wiki Tables: 2. Fostering of partial template content
10825 !! wikitext
10826 {|
10827 {{echo|a
10828 <div>b</div>}}
10829 |}
10830 !! html
10831 <table>
10832 a
10833 <div>b</div>
10834 <tr><td></td></tr></table>
10835
10836 !! html+tidy
10837 <p>a</p>
10838 <div>b</div>
10839 <table>
10840 <tr>
10841 <td></td>
10842 </tr>
10843 </table>
10844 !! end
10845
10846 !!test
10847 Templates: Wiki Tables: 3. td-content via multiple templates
10848 !! wikitext
10849 {|
10850 {{echo|{{pipe}}a}}{{echo|b}}
10851 |}
10852 !! html
10853 <table>
10854 <tr>
10855 <td>ab
10856 </td></tr></table>
10857
10858 !!end
10859
10860 !!test
10861 Templates: Wiki Tables: 4. Templated tags, no content
10862 !! wikitext
10863 {{tbl-start}}
10864 {{tbl-end}}
10865 !! html
10866 <table>
10867 <tr><td></td></tr></table>
10868
10869 !!end
10870
10871 !!test
10872 Templates: Wiki Tables: 5. Templated tags, regular td-tags
10873 !! wikitext
10874 {{tbl-start}}
10875 |foo
10876 {{tbl-end}}
10877 !! html
10878 <table>
10879 <tr>
10880 <td>foo
10881 </td></tr></table>
10882
10883 !!end
10884
10885 !!test
10886 Templates: Wiki Tables: 6. Templated tags, templated td-tags
10887 !! wikitext
10888 {{tbl-start}}
10889 {{!}}foo
10890 {{tbl-end}}
10891 !! html
10892 <table>
10893 <tr>
10894 <td>foo
10895 </td></tr></table>
10896
10897 !!end
10898
10899 !!test
10900 Templates: Lists: Multi-line list-items via templates
10901 !! wikitext
10902 *{{echo|a {{nonexistent|
10903 unused}}}}
10904 *{{echo|b {{nonexistent|
10905 unused}}}}
10906 !! html
10907 <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>
10908 <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>
10909
10910 !!end
10911
10912 !!test
10913 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
10914 !! wikitext
10915 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
10916 !! html
10917 <p><i>ab</i>c<i>d</i>e
10918 </p>
10919 !!end
10920
10921 !!test
10922 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
10923 (PHP parser generates misnested html)
10924 !! wikitext
10925 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
10926 !! html/parsoid
10927 <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>
10928 !!end
10929
10930 !!test
10931 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
10932 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
10933 !! options
10934 parsoid=wt2html,wt2wt
10935 !! wikitext
10936 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
10937 !! html
10938 <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>
10939 <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>
10940 <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>
10941 !!end
10942
10943 !!test
10944 Templates: Ugly nesting: 4. Divs opened/closed across templates
10945 !! wikitext
10946 a<div>b{{echo|c</div>d}}e
10947 !! html
10948 a<div>bc</div>de
10949
10950 !! html+tidy
10951 <p>a</p>
10952 <div>bc</div>
10953 <p>de</p>
10954 !! end
10955
10956 !!test
10957 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
10958 (Parsoid-centric)
10959 !! options
10960 parsoid
10961 !! wikitext
10962 {|
10963 |{{echo|foo</table>}}
10964 |bar
10965 |}
10966 !! html
10967 <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|}"]}'>
10968
10969 <tbody>
10970 <tr>
10971 <td>foo</td></tr></tbody></table><span about="#mwt1">
10972 </span><span about="#mwt1">|bar</span><span about="#mwt1">
10973 |}</span>
10974 !!end
10975
10976 !!test
10977 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
10978 (Parsoid-centric)
10979 !! options
10980 parsoid
10981 !! wikitext
10982 <table>
10983 <tr>
10984 <td>
10985 <table>
10986 <tr>
10987 <td>1. {{echo|foo </table>}}</td>
10988 <td> bar </td>
10989 <td>2. {{echo|baz </table>}}</td>
10990 </tr>
10991 <tr>
10992 <td>abc</td>
10993 </tr>
10994 </table>
10995 </td>
10996 </tr>
10997 <tr>
10998 <td>xyz</td>
10999 </tr>
11000 </table>
11001 !! html
11002 <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>"]}'>
11003 <tbody><tr>
11004 <td>
11005 <table>
11006 <tbody><tr>
11007 <td>1. foo </td></tr></tbody></table></td>
11008 <td> bar </td>
11009 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
11010 </span><span about="#mwt2">
11011 </span><span about="#mwt2">
11012 </span><span about="#mwt2">abc</span><span about="#mwt2">
11013 </span><span about="#mwt2">
11014 </span><span about="#mwt2">
11015 </span><span about="#mwt2">
11016 </span><span about="#mwt2">
11017 </span><span about="#mwt2">
11018 </span><span about="#mwt2">xyz</span><span about="#mwt2">
11019 </span><span about="#mwt2">
11020 </span>
11021 !!end
11022
11023 !! test
11024 Templates: Ugly templates: 3. newline-only template parameter
11025 !! wikitext
11026 foo {{echo|
11027 }}
11028 !! html
11029 <p>foo
11030 </p>
11031 !! end
11032
11033 # This looks like a bug: a single newline triggers p/br for some reason.
11034 !! test
11035 Templates: Ugly templates: 4. newline-only template parameter inconsistency
11036 !! wikitext
11037 {{echo|
11038 }}
11039 !! html
11040 <p><br />
11041 </p>
11042 !! end
11043
11044 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
11045 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
11046 !! test
11047 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
11048 !! wikitext
11049 {{echo|<table>}}
11050 {{echo|<div>foo}}
11051 {{echo|</table>}}
11052 !! html/parsoid
11053 <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
11054 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
11055 </table>
11056 !! end
11057
11058 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
11059 # that are "identical" and generate nesting cycles in the algorithm
11060 !! test
11061 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
11062 !! wikitext
11063 {{echo|<table><tr><td><table>}}
11064 {{echo|<div>}}
11065 {{echo|</div>}}
11066 !! html/parsoid
11067 <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"}'>
11068 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
11069 </table></td></tr></tbody></table>
11070 !! end
11071
11072 !!test
11073 Parser Functions: 1. Simple example
11074 !! wikitext
11075 {{uc:foo}}
11076 !! html
11077 <p>FOO
11078 </p>
11079 !!end
11080
11081 !!test
11082 Parser Functions: 2. Nested use (only outermost should be marked up)
11083 !! wikitext
11084 {{uc:{{lc:FOO}}}}
11085 !! html
11086 <p>FOO
11087 </p>
11088 !!end
11089
11090 ###
11091 ### Pre-save transform tests
11092 ###
11093 !! test
11094 pre-save transform: subst:
11095 !! options
11096 PST
11097 !! wikitext
11098 {{subst:test}}
11099 !! html
11100 This is a test template
11101 !! end
11102
11103 !! test
11104 pre-save transform: normal template
11105 !! options
11106 PST
11107 !! wikitext
11108 {{test}}
11109 !! html
11110 {{test}}
11111 !! end
11112
11113 !! test
11114 pre-save transform: nonexistent template
11115 !! options
11116 PST
11117 !! wikitext
11118 {{thistemplatedoesnotexist}}
11119 !! html
11120 {{thistemplatedoesnotexist}}
11121 !! end
11122
11123
11124 !! test
11125 pre-save transform: subst magic variables
11126 !! options
11127 PST
11128 !! wikitext
11129 {{subst:SITENAME}}
11130 !! html
11131 MediaWiki
11132 !! end
11133
11134 # This is bug 89, which I fixed. -- wtm
11135 !! test
11136 pre-save transform: subst: templates with parameters
11137 !! options
11138 pst
11139 !! wikitext
11140 {{subst:paramtest|param="something else"}}
11141 !! html
11142 This is a test template with parameter "something else"
11143 !! end
11144
11145 !! article
11146 Template:nowikitest
11147 !! text
11148 <nowiki>'''not wiki'''</nowiki>
11149 !! endarticle
11150
11151 !! test
11152 pre-save transform: nowiki in subst (bug 1188)
11153 !! options
11154 pst
11155 !! wikitext
11156 {{subst:nowikitest}}
11157 !! html
11158 <nowiki>'''not wiki'''</nowiki>
11159 !! end
11160
11161
11162 !! article
11163 Template:commenttest
11164 !! text
11165 This template has <!-- a comment --> in it.
11166 !! endarticle
11167
11168 !! test
11169 pre-save transform: comment in subst (bug 1936)
11170 !! options
11171 pst
11172 !! wikitext
11173 {{subst:commenttest}}
11174 !! html
11175 This template has <!-- a comment --> in it.
11176 !! end
11177
11178 !! test
11179 pre-save transform: unclosed tag
11180 !! options
11181 pst noxml
11182 !! wikitext
11183 <nowiki>'''not wiki'''
11184 !! html
11185 <nowiki>'''not wiki'''
11186 !! end
11187
11188 !! test
11189 pre-save transform: mixed tag case
11190 !! options
11191 pst noxml
11192 !! wikitext
11193 <NOwiki>'''not wiki'''</noWIKI>
11194 !! html
11195 <NOwiki>'''not wiki'''</noWIKI>
11196 !! end
11197
11198 !! test
11199 pre-save transform: unclosed comment in <nowiki>
11200 !! options
11201 pst noxml
11202 !! wikitext
11203 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
11204 !! html
11205 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
11206 !!end
11207
11208 # Leading @ in this template definition works around a limitation
11209 # in parsoid's parserTests which otherwise strips the <span> from the
11210 # result (confusing it for a template wrapper)
11211 !! article
11212 Template:dangerous
11213 !!text
11214 @<span onmouseover="alert('crap')">Oh no</span>
11215 !!endarticle
11216
11217 !!test
11218 (confirming safety of fix for subst bug 1936)
11219 !! wikitext
11220 {{Template:dangerous}}
11221 !! html
11222 <p>@<span>Oh no</span>
11223 </p>
11224 !! end
11225
11226 !! test
11227 pre-save transform: comment containing gallery (bug 5024)
11228 !! options
11229 pst
11230 !! wikitext
11231 <!-- <gallery>data</gallery> -->
11232 !! html
11233 <!-- <gallery>data</gallery> -->
11234 !!end
11235
11236 !! test
11237 pre-save transform: comment containing extension
11238 !! options
11239 pst
11240 !! wikitext
11241 <!-- <tag>data</tag> -->
11242 !! html
11243 <!-- <tag>data</tag> -->
11244 !!end
11245
11246 !! test
11247 pre-save transform: comment containing nowiki
11248 !! options
11249 pst
11250 !! wikitext
11251 <!-- <nowiki>data</nowiki> -->
11252 !! html
11253 <!-- <nowiki>data</nowiki> -->
11254 !!end
11255
11256 !! test
11257 pre-save transform: <noinclude> in subst (bug 3298)
11258 !! options
11259 pst
11260 !! wikitext
11261 {{subst:Includes}}
11262 !! html
11263 Foobar
11264 !! end
11265
11266 !! test
11267 pre-save transform: <onlyinclude> in subst (bug 3298)
11268 !! options
11269 pst
11270 !! wikitext
11271 {{subst:Includes2}}
11272 !! html
11273 Foo
11274 !! end
11275
11276 !! article
11277 Template:SubstTest
11278 !!text
11279 {{<includeonly>subst:</includeonly>Includes}}
11280 !! endarticle
11281
11282 !! article
11283 Template:SafeSubstTest
11284 !! text
11285 {{<includeonly>safesubst:</includeonly>Includes}}
11286 !! endarticle
11287
11288 !! test
11289 bug 22297: safesubst: works during PST
11290 !! options
11291 pst
11292 !! wikitext
11293 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
11294 !! html
11295 FoobarFoobar
11296 !! end
11297
11298 !! test
11299 bug 22297: safesubst: works during normal parse
11300 !! wikitext
11301 {{SafeSubstTest}}
11302 !! html
11303 <p>Foobar
11304 </p>
11305 !! end
11306
11307 !! test
11308 subst: does not work during normal parse
11309 !! wikitext
11310 {{SubstTest}}
11311 !! html
11312 <p>{{subst:Includes}}
11313 </p>
11314 !! end
11315
11316 !! test
11317 pre-save transform: context links ("pipe trick")
11318 !! options
11319 pst
11320 !! wikitext
11321 [[Article (context)|]]
11322 [[Bar:Article|]]
11323 [[:Bar:Article|]]
11324 [[Bar:Article (context)|]]
11325 [[:Bar:Article (context)|]]
11326 [[|Article]]
11327 [[|Article (context)]]
11328 [[Bar:X (Y) Z|]]
11329 [[:Bar:X (Y) Z|]]
11330 !! html
11331 [[Article (context)|Article]]
11332 [[Bar:Article|Article]]
11333 [[:Bar:Article|Article]]
11334 [[Bar:Article (context)|Article]]
11335 [[:Bar:Article (context)|Article]]
11336 [[Article]]
11337 [[Article (context)]]
11338 [[Bar:X (Y) Z|X (Y) Z]]
11339 [[:Bar:X (Y) Z|X (Y) Z]]
11340 !! end
11341
11342 !! test
11343 pre-save transform: context links ("pipe trick") with interwiki prefix
11344 !! options
11345 pst
11346 !! wikitext
11347 [[interwiki:Article|]]
11348 [[:interwiki:Article|]]
11349 [[interwiki:Bar:Article|]]
11350 [[:interwiki:Bar:Article|]]
11351 !! html
11352 [[interwiki:Article|Article]]
11353 [[:interwiki:Article|Article]]
11354 [[interwiki:Bar:Article|Bar:Article]]
11355 [[:interwiki:Bar:Article|Bar:Article]]
11356 !! end
11357
11358 !! test
11359 pre-save transform: context links ("pipe trick") with parens in title
11360 !! options
11361 pst title=[[Somearticle (context)]]
11362 !! wikitext
11363 [[|Article]]
11364 !! html
11365 [[Article (context)|Article]]
11366 !! end
11367
11368 !! test
11369 pre-save transform: context links ("pipe trick") with comma in title
11370 !! options
11371 pst title=[[Someplace, Somewhere]]
11372 !! wikitext
11373 [[|Otherplace]]
11374 [[Otherplace, Elsewhere|]]
11375 [[Otherplace, Elsewhere, Anywhere|]]
11376 !! html
11377 [[Otherplace, Somewhere|Otherplace]]
11378 [[Otherplace, Elsewhere|Otherplace]]
11379 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
11380 !! end
11381
11382 !! test
11383 pre-save transform: context links ("pipe trick") with parens and comma
11384 !! options
11385 pst title=[[Someplace (IGNORED), Somewhere]]
11386 !! wikitext
11387 [[|Otherplace]]
11388 [[Otherplace (place), Elsewhere|]]
11389 !! html
11390 [[Otherplace, Somewhere|Otherplace]]
11391 [[Otherplace (place), Elsewhere|Otherplace]]
11392 !! end
11393
11394 !! test
11395 pre-save transform: context links ("pipe trick") with comma and parens
11396 !! options
11397 pst title=[[Who, me? (context)]]
11398 !! wikitext
11399 [[|Yes, you.]]
11400 [[Me, Myself, and I (1937 song)|]]
11401 !! html
11402 [[Yes, you. (context)|Yes, you.]]
11403 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
11404 !! end
11405
11406 !! test
11407 pre-save transform: context links ("pipe trick") with namespace
11408 !! options
11409 pst title=[[Ns:Somearticle]]
11410 !! wikitext
11411 [[|Article]]
11412 !! html
11413 [[Ns:Article|Article]]
11414 !! end
11415
11416 !! test
11417 pre-save transform: context links ("pipe trick") with namespace and parens
11418 !! options
11419 pst title=[[Ns:Somearticle (context)]]
11420 !! wikitext
11421 [[|Article]]
11422 !! html
11423 [[Ns:Article (context)|Article]]
11424 !! end
11425
11426 !! test
11427 pre-save transform: context links ("pipe trick") with namespace and comma
11428 !! options
11429 pst title=[[Ns:Somearticle, Context, Whatever]]
11430 !! wikitext
11431 [[|Article]]
11432 !! html
11433 [[Ns:Article, Context, Whatever|Article]]
11434 !! end
11435
11436 !! test
11437 pre-save transform: context links ("pipe trick") with namespace, comma and parens
11438 !! options
11439 pst title=[[Ns:Somearticle, Context (context)]]
11440 !! wikitext
11441 [[|Article]]
11442 !! html
11443 [[Ns:Article (context)|Article]]
11444 !! end
11445
11446 !! test
11447 pre-save transform: context links ("pipe trick") with namespace, parens and comma
11448 !! options
11449 pst title=[[Ns:Somearticle (IGNORED), Context]]
11450 !! wikitext
11451 [[|Article]]
11452 !! html
11453 [[Ns:Article, Context|Article]]
11454 !! end
11455
11456 !! test
11457 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
11458 !! options
11459 pst
11460 !! wikitext
11461 [[Article(context)|]]
11462 [[Bar:Article(context)|]]
11463 [[:Bar:Article(context)|]]
11464 [[|Article(context)]]
11465 [[Bar:X(Y)Z|]]
11466 [[:Bar:X(Y)Z|]]
11467 !! html
11468 [[Article(context)|Article]]
11469 [[Bar:Article(context)|Article]]
11470 [[:Bar:Article(context)|Article]]
11471 [[Article(context)]]
11472 [[Bar:X(Y)Z|X(Y)Z]]
11473 [[:Bar:X(Y)Z|X(Y)Z]]
11474 !! end
11475
11476 !! test
11477 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
11478 !! options
11479 pst
11480 !! wikitext
11481 [[Article (context)|]]
11482 [[Bar:Article (context)|]]
11483 [[:Bar:Article (context)|]]
11484 [[|Article (context)]]
11485 [[Bar:X (Y) Z|]]
11486 [[:Bar:X (Y) Z|]]
11487 !! html
11488 [[Article (context)|Article]]
11489 [[Bar:Article (context)|Article]]
11490 [[:Bar:Article (context)|Article]]
11491 [[Article (context)]]
11492 [[Bar:X (Y) Z|X (Y) Z]]
11493 [[:Bar:X (Y) Z|X (Y) Z]]
11494 !! end
11495
11496 !! test
11497 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
11498 !! options
11499 pst
11500 !! wikitext
11501 [[Article(context)|]]
11502 [[Bar:Article(context)|]]
11503 [[:Bar:Article(context)|]]
11504 [[|Article(context)]]
11505 [[Bar:X(Y)Z|]]
11506 [[:Bar:X(Y)Z|]]
11507 !! html
11508 [[Article(context)|Article]]
11509 [[Bar:Article(context)|Article]]
11510 [[:Bar:Article(context)|Article]]
11511 [[Article(context)]]
11512 [[Bar:X(Y)Z|X(Y)Z]]
11513 [[:Bar:X(Y)Z|X(Y)Z]]
11514 !! end
11515
11516 !! test
11517 pre-save transform: context links ("pipe trick") with commas (bug 21660)
11518 !! options
11519 pst
11520 !! wikitext
11521 [[Article (context), context|]]
11522 [[Article (context),context|]]
11523 [[Bar:Article (context), context|]]
11524 [[Bar:Article (context),context|]]
11525 [[:Bar:Article (context), context|]]
11526 [[:Bar:Article (context),context|]]
11527 !! html
11528 [[Article (context), context|Article]]
11529 [[Article (context),context|Article]]
11530 [[Bar:Article (context), context|Article]]
11531 [[Bar:Article (context),context|Article]]
11532 [[:Bar:Article (context), context|Article]]
11533 [[:Bar:Article (context),context|Article]]
11534 !! end
11535
11536 !! test
11537 pre-save transform: trim trailing empty lines
11538 !! options
11539 pst
11540 !! wikitext
11541 Empty lines are trimmed
11542
11543
11544
11545
11546 !! html
11547 Empty lines are trimmed
11548 !! end
11549
11550 !! test
11551 pre-save transform: Signature expansion
11552 !! options
11553 pst
11554 !! wikitext
11555 * ~~~
11556 * <noinclude>~~~</noinclude>
11557 * <includeonly>~~~</includeonly>
11558 * <onlyinclude>~~~</onlyinclude>
11559 !! html
11560 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
11561 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
11562 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
11563 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
11564 !! end
11565
11566
11567 !! test
11568 pre-save transform: Signature expansion in nowiki tags (bug 93)
11569 !! options
11570 pst disabled
11571 !! wikitext
11572 Shall not expand:
11573
11574 <nowiki>~~~~</nowiki>
11575
11576 <includeonly><nowiki>~~~~</nowiki></includeonly>
11577
11578 <noinclude><nowiki>~~~~</nowiki></noinclude>
11579
11580 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
11581
11582 {{subst:Foo}} shall be converted to FOO
11583
11584 As well as inside noinclude/onlyinclude
11585 <noinclude>{{subst:Foo}}</noinclude>
11586 <onlyinclude>{{subst:Foo}}</onlyinclude>
11587
11588 But not inside includeonly
11589 <includeonly>{{subst:Foo}}</includeonly>
11590 !! html
11591 Shall not expand:
11592
11593 <nowiki>~~~~</nowiki>
11594
11595 <includeonly><nowiki>~~~~</nowiki></includeonly>
11596
11597 <noinclude><nowiki>~~~~</nowiki></noinclude>
11598
11599 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
11600
11601 FOO shall be converted to FOO
11602
11603 As well as inside noinclude/onlyinclude
11604 <noinclude>FOO</noinclude>
11605 <onlyinclude>FOO</onlyinclude>
11606
11607 But not inside includeonly
11608 <includeonly>{{subst:Foo}}</includeonly>
11609 !! end
11610
11611 !! test
11612 Parsoid: Recognize nowiki with trailing space in tags
11613 !! options
11614 parsoid=wt2html
11615 !! wikitext
11616 <nowiki ><div>[[foo]]</nowiki >
11617
11618 a<nowiki / >b
11619
11620 c<nowiki />d
11621
11622 e<nowiki/ >f
11623 !! html
11624 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
11625 <p>ab</p>
11626 <p>cd</p>
11627 <p>ef</p>
11628 !! end
11629
11630 !! test
11631 Parsoid: Recognize nowiki with odd capitalization
11632 !! options
11633 parsoid=wt2html
11634 !! wikitext
11635 <noWikI ><div>[[foo]]</Nowiki >
11636 !! html
11637 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
11638 !! end
11639
11640
11641 !! test
11642 Parsoid: Escape nowiki with trailing space in tags
11643 !! options
11644 parsoid=html2wt
11645 !! html
11646 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
11647 <p>a&lt;nowiki /&gt;b</p>
11648 <p>c&lt;nowiki/ &gt;d</p>
11649 !! wikitext
11650 &lt;nowiki &gt; foo &lt;/nowiki &gt;
11651
11652 a&lt;nowiki /&gt;b
11653
11654 c&lt;nowiki/ &gt;d
11655 !! end
11656
11657 !! test
11658 Parsoid: Escape weird noWikI capitalizations
11659 !! options
11660 parsoid=html2wt
11661 !! html
11662 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
11663 !! wikitext
11664 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
11665 !! end
11666
11667 ###
11668 ### Message transform tests
11669 ###
11670 !! test
11671 message transform: magic variables
11672 !! options
11673 msg
11674 !! wikitext
11675 {{SITENAME}}
11676 !! html
11677 MediaWiki
11678 !! end
11679
11680 !! test
11681 message transform: should not transform wiki markup
11682 !! options
11683 msg
11684 !! wikitext
11685 ''test''
11686 !! html
11687 ''test''
11688 !! end
11689
11690 !! test
11691 message transform: <noinclude> in transcluded template (bug 4926)
11692 !! options
11693 msg
11694 !! wikitext
11695 {{Includes}}
11696 !! html
11697 Foobar
11698 !! end
11699
11700 !! test
11701 message transform: <onlyinclude> in transcluded template (bug 4926)
11702 !! options
11703 msg
11704 !! wikitext
11705 {{Includes2}}
11706 !! html
11707 Foo
11708 !! end
11709
11710 !! test
11711 {{#special:}} page name, known
11712 !! options
11713 msg
11714 !! wikitext
11715 {{#special:Recentchanges}}
11716 !! html
11717 Special:RecentChanges
11718 !! end
11719
11720 !! test
11721 {{#special:}} page name with subpage, known
11722 !! options
11723 msg
11724 !! wikitext
11725 {{#special:Recentchanges/param}}
11726 !! html
11727 Special:RecentChanges/param
11728 !! end
11729
11730 !! test
11731 {{#special:}} page name, unknown
11732 !! options
11733 msg
11734 !! wikitext
11735 {{#special:foobar nonexistent}}
11736 !! html
11737 Special:Foobar nonexistent
11738 !! end
11739
11740 !! test
11741 {{#speciale:}} page name, known
11742 !! options
11743 msg
11744 !! wikitext
11745 {{#speciale:Recentchanges}}
11746 !! html
11747 Special:RecentChanges
11748 !! end
11749
11750 !! test
11751 {{#speciale:}} page name with subpage, known
11752 !! options
11753 msg
11754 !! wikitext
11755 {{#speciale:Recentchanges/param}}
11756 !! html
11757 Special:RecentChanges/param
11758 !! end
11759
11760 !! test
11761 {{#speciale:}} page name, unknown
11762 !! options
11763 msg
11764 !! wikitext
11765 {{#speciale:foobar nonexistent}}
11766 !! html
11767 Special:Foobar_nonexistent
11768 !! end
11769
11770 ###
11771 ### Images
11772 ###
11773 ### For Parsoid-specific tests, see
11774 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
11775
11776 !! test
11777 Simple image
11778 !! options
11779 parsoid=wt2html,wt2wt,html2html
11780 !! wikitext
11781 [[Image:foobar.jpg]]
11782 !! html/php
11783 <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>
11784 </p>
11785 !! html/parsoid
11786 <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>
11787 !! end
11788
11789 !! test
11790 Simple image (using File: namespace, now canonical)
11791 !! wikitext
11792 [[File:Foobar.jpg]]
11793 !! html/php
11794 <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>
11795 </p>
11796 !! html/parsoid
11797 <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>
11798 !! end
11799
11800 !! test
11801 Right-aligned image
11802 !! wikitext
11803 [[File:Foobar.jpg|right]]
11804 !! html/php
11805 <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>
11806
11807 !! html/parsoid
11808 <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>
11809 !! end
11810
11811 !! test
11812 Image with caption
11813 !! wikitext
11814 [[File:Foobar.jpg|right|Caption text]]
11815 !! html/php
11816 <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>
11817
11818 !! html/parsoid
11819 <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>
11820 !! end
11821
11822 !! test
11823 Image with caption, bug 53312 #1
11824 !! wikitext
11825 [[File:Foobar.jpg|right|Caption page stuff]]
11826 !! html/php
11827 <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>
11828
11829 !! html/parsoid
11830 <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>
11831 !! end
11832
11833 !! test
11834 Image with caption, bug 53312 #2
11835 !! wikitext
11836 [[File:Foobar.jpg|right|Caption page=]]
11837 !! html/php
11838 <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>
11839
11840 !! html/parsoid
11841 <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>
11842 !! end
11843
11844 !! test
11845 Image with caption, bug 53312 #3
11846 !! wikitext
11847 [[File:Foobar.jpg|right|Caption page=stuff]]
11848 !! html/php
11849 <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>
11850
11851 !! html/parsoid
11852 <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>
11853 !! end
11854
11855 !! test
11856 Allow empty links in image captions (Bug 60753)
11857 !! options
11858 thumbsize=220
11859 !! wikitext
11860 [[File:Foobar.jpg|thumb|Caption [[Link1]]
11861 [[]]
11862 [[Link2]]
11863 ]]
11864 !! html/php
11865 <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>
11866
11867 !! html/parsoid
11868 <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>
11869 [[]]
11870 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
11871 </figcaption></figure>
11872 !! end
11873
11874 !! test
11875 Titles in unlinked images (T23454)
11876 !! wikitext
11877 [[File:Foobar.jpg|link=|stuff]]
11878 !! html/php
11879 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
11880 </p>
11881 !! end
11882
11883 !! test
11884 Link with empty target
11885 !! wikitext
11886 [[]]
11887 !! html
11888 <p>[[]]
11889 </p>
11890 !! end
11891
11892 !! test
11893 Image with link trail
11894 !! wikitext
11895 Linktrails should not work for images: [[File:Foobar.jpg]]s
11896 !! html/php
11897 <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
11898 </p>
11899 !! html/parsoid
11900 <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>
11901 !! end
11902
11903 !! test
11904 Image with empty attribute
11905 !! options
11906 parsoid=wt2html,wt2wt,html2html
11907 !! wikitext
11908 [[File:Foobar.jpg|right||Caption text]]
11909 !! html/php
11910 <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>
11911
11912 !! html/parsoid
11913 <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>
11914 !! end
11915
11916 !! test
11917 1. Block image with individual attributes from templates
11918 !! wikitext
11919 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
11920 !! html/php
11921 <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>
11922
11923 !! html/parsoid
11924 <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/3/3a/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>
11925 !! end
11926
11927 !! test
11928 2. Block Image with individual attributes from templates
11929 !! wikitext
11930 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
11931 !! html/php
11932 <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>
11933
11934 !! html/parsoid
11935 <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/3/3a/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>
11936 !! end
11937
11938 !! test
11939 3. Inline image with individual attributes from templates
11940 !! wikitext
11941 [[File:Foobar.jpg|{{echo|50px}}]]
11942 !! html/php
11943 <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>
11944 </p>
11945 !! html/parsoid
11946 <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>
11947 !! end
11948
11949 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
11950 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
11951 !! test
11952 Image with multiple attributes from the same template
11953 !! wikitext
11954 [[File:Foobar.jpg|{{image_attribs}}]]
11955 !! html/php
11956 <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>
11957
11958 !! html/parsoid
11959 <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>
11960 !! end
11961
11962 !! test
11963 Image with link tails
11964 !! options
11965 thumbsize=220
11966 !! wikitext
11967 123[[File:Foobar.jpg]]456
11968 123[[File:Foobar.jpg|right]]456
11969 123[[File:Foobar.jpg|thumb]]456
11970 !! html/php
11971 <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
11972 </p>
11973 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
11974 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
11975
11976 !! html/php+tidy
11977 <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>
11978 <p>123</p>
11979 <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>
11980 <p>456 123</p>
11981 <div class="thumb tright">
11982 <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>
11983 <div class="thumbcaption">
11984 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
11985 </div>
11986 </div>
11987 </div>
11988 <p>456</p>
11989 !! html/parsoid
11990 <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>
11991 <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>
11992 <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/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></figure><p>456</p>
11993 !! end
11994
11995 !! test
11996 Image with multiple captions -- only last one is accepted
11997 !! wikitext
11998 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
11999 !! html/php
12000 <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>
12001
12002 !! html/parsoid
12003 <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>
12004 !! end
12005
12006 !! test
12007 Image with multiple widths -- use last
12008 !! wikitext
12009 [[File:Foobar.jpg|200px|300px|caption]]
12010 !! html/php
12011 <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>
12012 </p>
12013 !! html/parsoid
12014 <p><span 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="34" width="300"/></a></span></p>
12015 !! end
12016
12017 !! test
12018 Image with multiple alignments -- use first (bug 48664)
12019 !! options
12020 thumbsize=220
12021 !! wikitext
12022 [[File:Foobar.jpg|thumb|left|right|center|caption]]
12023
12024 [[File:Foobar.jpg|middle|text-top|caption]]
12025 !! html/php
12026 <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>
12027 <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>
12028 </p>
12029 !! html/parsoid
12030 <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/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
12031 <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>
12032 !! end
12033
12034 !! test
12035 Image with width attribute at different positions
12036 !! wikitext
12037 [[File:Foobar.jpg|200px|right|Caption]]
12038 [[File:Foobar.jpg|right|200px|Caption]]
12039 [[File:Foobar.jpg|right|Caption|200px]]
12040 !! html/php
12041 <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>
12042 <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>
12043 <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>
12044
12045 !! html/parsoid
12046 <figure class="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="23" width="200"/></a><figcaption>Caption</figcaption></figure>
12047 <figure class="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="23" width="200"/></a><figcaption>Caption</figcaption></figure>
12048 <figure class="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="23" width="200"/></a><figcaption>Caption</figcaption></figure>
12049 !! end
12050
12051 # a sad bit of backward-compatibility
12052 !! test
12053 Image with size specified with pxpx (bug 13500, 51628)
12054 !! options
12055 parsoid=wt2html,wt2wt,html2html
12056 !! wikitext
12057 [[File:Foobar.jpg|20pxpx]]
12058 [[File:Foobar.jpg|200x20pxpx]]
12059 !! html/php
12060 <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>
12061 <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>
12062 </p>
12063 !! html/parsoid
12064 <p><span 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="2" width="20"/></a></span> <span 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="20" width="177"/></a></span></p>
12065 !! end
12066
12067 !! test
12068 Image with link parameter, wiki target
12069 !! wikitext
12070 [[File:Foobar.jpg|link=Main Page]]
12071 !! html/php
12072 <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>
12073 </p>
12074 !! html/parsoid
12075 <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>
12076 !! end
12077
12078 # parsoid bug 49293 (part 1)
12079 !! test
12080 Image with link parameter, URL target
12081 !! wikitext
12082 [[File:Foobar.jpg|link=http://example.com/]]
12083 !! html/php
12084 <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>
12085 </p>
12086 !! html/parsoid
12087 <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>
12088 !! end
12089
12090 # parsoid bug 49293 (part 2)
12091 !! test
12092 Image with link parameter, protocol-less URL target
12093 !! wikitext
12094 [[File:Foobar.jpg|link=//example.com/]]
12095 !! html/php
12096 <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>
12097 </p>
12098 !! html/parsoid
12099 <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>
12100 !! end
12101
12102 !! test
12103 Image with link parameter, wgExternalLinkTarget
12104 !! wikitext
12105 [[Image:foobar.jpg|link=http://example.com/]]
12106 !! config
12107 wgExternalLinkTarget='foobar'
12108 !! html
12109 <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>
12110 </p>
12111 !! end
12112
12113 !! test
12114 Image with link parameter, wgNoFollowLinks set to false
12115 !! wikitext
12116 [[Image:foobar.jpg|link=http://example.com/]]
12117 !! config
12118 wgNoFollowLinks=false
12119 !! html
12120 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
12121 </p>
12122 !! end
12123
12124 !! test
12125 Image with link parameter, wgNoFollowDomainExceptions
12126 !! wikitext
12127 [[Image:foobar.jpg|link=http://example.com/]]
12128 !! config
12129 wgNoFollowDomainExceptions='example.com'
12130 !! html
12131 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
12132 </p>
12133 !! end
12134
12135 !! test
12136 Image with link parameter, wgExternalLinkTarget, unnamed parameter
12137 !! wikitext
12138 [[Image:foobar.jpg|link=http://example.com/|Title]]
12139 !! config
12140 wgExternalLinkTarget='foobar'
12141 !! html
12142 <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>
12143 </p>
12144 !! end
12145
12146 !! test
12147 Image with empty link parameter
12148 !! wikitext
12149 [[File:Foobar.jpg|link=]]
12150 !! html/php
12151 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
12152 </p>
12153 !! html/parsoid
12154 <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>
12155 !! end
12156
12157 !! test
12158 Image with link parameter (wiki target) and unnamed parameter
12159 !! wikitext
12160 [[File:Foobar.jpg|link=Main_Page|Title]]
12161 !! html/php
12162 <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>
12163 </p>
12164 !! html/parsoid
12165 <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>
12166 !! end
12167
12168 !! test
12169 Image with link parameter (URL target) and unnamed parameter
12170 !! wikitext
12171 [[File:Foobar.jpg|link=http://example.com/|Title]]
12172 !! html/php
12173 <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>
12174 </p>
12175 !! html/parsoid
12176 <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>
12177 !! end
12178
12179 !! test
12180 Thumbnail image with link parameter
12181 !! options
12182 thumbsize=220
12183 parsoid=wt2html,wt2wt,html2html
12184 !! wikitext
12185 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
12186 !! html/php
12187 <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>
12188
12189 !! html/parsoid
12190 <figure class="mw-default-size" typeof="mw:Image/Thumb"><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="25" width="220"/></a><figcaption>Title</figcaption></figure>
12191 !! end
12192
12193 !! test
12194 Manually-specified thumbnail image
12195 !! options
12196 thumbsize=220
12197 !! wikitext
12198 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
12199 !! html/php
12200 <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>
12201
12202 !! html/parsoid
12203 <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>
12204 !! end
12205
12206 !! test
12207 Manually-specified thumbnail image with explicit link to wiki page
12208 !! options
12209 thumbsize=220
12210 parsoid=wt2html,wt2wt,html2html
12211 !! wikitext
12212 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
12213 !! html/php
12214 <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>
12215
12216 !! html/parsoid
12217 <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>
12218 !! end
12219
12220 !! test
12221 Manually-specified thumbnail image with explicit link to url
12222 !! options
12223 thumbsize=220
12224 parsoid=wt2html,wt2wt,html2html
12225 !! wikitext
12226 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
12227 !! html/php
12228 <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>
12229
12230 !! html/parsoid
12231 <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>
12232 !! end
12233
12234 !! test
12235 Manually-specified thumbnail image with explicit no link
12236 !! options
12237 thumbsize=220
12238 parsoid=wt2html,wt2wt,html2html
12239 !! wikitext
12240 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
12241 !! html/php
12242 <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>
12243
12244 !! html/parsoid
12245 <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>
12246 !! end
12247
12248 !! test
12249 Manually-specified thumbnail image with explicit link and alt text
12250 !! options
12251 thumbsize=220
12252 parsoid=wt2html,wt2wt,html2html
12253 !! wikitext
12254 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
12255 !! html/php
12256 <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>
12257
12258 !! html/parsoid
12259 <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>
12260 !! end
12261
12262 !! test
12263 Image with frame and link
12264 !! options
12265 parsoid=wt2html,wt2wt,html2html
12266 !! wikitext
12267 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
12268 !! html/php
12269 <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>
12270
12271 !! html/parsoid
12272 <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>
12273 !! end
12274
12275 !! test
12276 Image with frame and link and explicit alt
12277 !! options
12278 parsoid=wt2html,wt2wt,html2html
12279 !! wikitext
12280 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
12281 !! html/php
12282 <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>
12283
12284 !! html/parsoid
12285 <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>
12286 !! end
12287
12288 !! test
12289 Image with wiki markup in implicit alt
12290 !! options
12291 parsoid=wt2html,wt2wt,html2html
12292 !! wikitext
12293 [[Image:Foobar.jpg|testing '''bold''' in alt]]
12294
12295 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
12296 !! html/php
12297 <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>
12298 </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>
12299 </p>
12300 !! html/parsoid
12301 <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>
12302 <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>
12303 !! end
12304
12305 !! test
12306 Alt image option should handle most kinds of wikitext without barfing
12307 !! wikitext
12308 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
12309 !! html/php
12310 <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>
12311
12312 !! html/parsoid
12313 <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>
12314 !! end
12315
12316 ###################
12317 # Conflicting image format options.
12318 # First option specified should 'win'.
12319 # All three cases in each test should be identical.
12320
12321 !! test
12322 Image with 'frameless' first.
12323 !! options
12324 parsoid=wt2html,wt2wt,html2html
12325 !! wikitext
12326 [[File:Foobar.jpg|frameless|caption]]
12327
12328 [[File:Foobar.jpg|frameless|frame|caption]]
12329
12330 [[File:Foobar.jpg|frameless|thumb|caption]]
12331 !! html/php
12332 <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>
12333 </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>
12334 </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>
12335 </p>
12336 !! html/parsoid
12337 <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/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></span></p>
12338 <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/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></span></p>
12339 <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/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></span></p>
12340 !! end
12341
12342 !! test
12343 Image with 'frame' first.
12344 !! options
12345 parsoid=wt2html,wt2wt,html2html
12346 !! wikitext
12347 [[File:Foobar.jpg|frame|caption]]
12348 [[File:Foobar.jpg|frame|frameless|caption]]
12349 [[File:Foobar.jpg|frame|thumb|caption]]
12350 !! html/php
12351 <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>
12352 <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>
12353 <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>
12354
12355 !! html/parsoid
12356 <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>
12357 <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>
12358 <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>
12359 !! end
12360
12361 !! test
12362 Image with 'thumb' first.
12363 !! options
12364 parsoid=wt2html,wt2wt,html2html
12365 !! wikitext
12366 [[File:Foobar.jpg|thumb|caption]]
12367 [[File:Foobar.jpg|thumb|frameless|caption]]
12368 [[File:Foobar.jpg|thumb|frame|caption]]
12369 !! html/php
12370 <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>
12371 <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>
12372 <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>
12373
12374 !! html/parsoid
12375 <figure class="mw-default-size" typeof="mw:Image/Thumb"><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="25" width="220"/></a><figcaption>caption</figcaption></figure>
12376 <figure class="mw-default-size" typeof="mw:Image/Thumb"><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="25" width="220"/></a><figcaption>caption</figcaption></figure>
12377 <figure class="mw-default-size" typeof="mw:Image/Thumb"><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="25" width="220"/></a><figcaption>caption</figcaption></figure>
12378 !! end
12379
12380 ###################
12381 # Image sizing.
12382 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
12383 # and https://bugzilla.wikimedia.org/show_bug.cgi?id=62258
12384 # Foobar has actual size of 1941x220
12385 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
12386 # a scalable format.
12387 # 2. Framed images always ignore size options; always render at default size.
12388 # 3. "Unspecified format" and border are the only types which can be
12389 # enlarged.
12390
12391 !! test
12392 Image: "unspecified format" and border enlarge
12393 !! options
12394 parsoid=wt2html,wt2wt,html2html
12395 !! wikitext
12396 [[File:Foobar.jpg|2000px]]
12397
12398 [[File:Foobar.jpg|border|2000px]]
12399 !! html/php
12400 <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>
12401 </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>
12402 </p>
12403 !! html/parsoid
12404 <p><span 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="227" width="2000"/></a></span></p>
12405 <p><span class="mw-image-border" 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="227" width="2000"/></a></span></p>
12406 !! end
12407
12408 !! test
12409 Image: "unspecified format" and border reduce
12410 !! options
12411 parsoid=wt2html,wt2wt,html2html
12412 !! wikitext
12413 [[File:Foobar.jpg|1000px]]
12414
12415 [[File:Foobar.jpg|border|1000px]]
12416 !! html/php
12417 <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>
12418 </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>
12419 </p>
12420 !! html/parsoid
12421 <p><span 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="113" width="1000"/></a></span></p>
12422 <p><span class="mw-image-border" 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="113" width="1000"/></a></span></p>
12423 !! end
12424
12425 !! test
12426 Image: thumbs reduce
12427 !! options
12428 parsoid=wt2html,wt2wt,html2html
12429 !! wikitext
12430 [[File:Foobar.jpg|thumb|50px]]
12431 !! html/php
12432 <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>
12433
12434 !! html/parsoid
12435 <figure typeof="mw:Image/Thumb"><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="6" width="50"/></a></figure>
12436 !! end
12437
12438 !! test
12439 Image: bitmap thumbs can't be enlarged past original size, but vector can.
12440 !! options
12441 parsoid=wt2html,wt2wt,html2html
12442 !! wikitext
12443 [[File:Foobar.jpg|thumb|2000px]]
12444
12445 [[File:Foobar.svg|thumb|2000px]]
12446 !! html/php
12447 <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>
12448 <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>
12449
12450 !! html/parsoid
12451 <figure typeof="mw:Image/Thumb"><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>
12452 <figure 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="1500" width="2000"/></a></figure>
12453 !! end
12454
12455 !! test
12456 Image: frameless can reduce in size
12457 !! options
12458 parsoid=wt2html,wt2wt,html2html
12459 !! wikitext
12460 [[File:Foobar.jpg|frameless|50px]]
12461 !! html/php
12462 <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>
12463 </p>
12464 !! html/parsoid
12465 <p><span typeof="mw:Image/Frameless"><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="6" width="50"/></a></span></p>
12466 !! end
12467
12468 !! test
12469 Image: bitmap frameless can't be enlarged past original size, but vector can
12470 !! options
12471 parsoid=wt2html,wt2wt,html2html
12472 !! wikitext
12473 [[File:Foobar.jpg|frameless|2000px]]
12474
12475 [[File:Foobar.svg|frameless|2000px]]
12476 !! html/php
12477 <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>
12478 </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>
12479 </p>
12480 !! html/parsoid
12481 <p><span typeof="mw:Image/Frameless"><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>
12482 <p><span typeof="mw:Image/Frameless"><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="1500" width="2000"/></a></span></p>
12483 !! end
12484
12485 !! test
12486 Image: framed images are always unscaled.
12487 !! options
12488 parsoid=wt2html,wt2wt,html2html
12489 !! wikitext
12490 [[File:Foobar.jpg|frame]]
12491
12492 [[File:Foobar.jpg|frame|50px]]
12493
12494 [[File:Foobar.jpg|frame|50x50px]]
12495
12496 [[File:Foobar.jpg|frame|2000px]]
12497 !! html/php
12498 <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>
12499 <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>
12500 <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>
12501 <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>
12502
12503 !! html/parsoid
12504 <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>
12505 <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>
12506 <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>
12507 <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>
12508 !! end
12509
12510 ###################
12511
12512 !! test
12513 Link to image page- image page normally doesn't exists, hence edit link
12514 Add test with existing image page
12515 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
12516 !! wikitext
12517 [[:Image:test]]
12518 !! html
12519 <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>
12520 </p>
12521 !! end
12522
12523 !! test
12524 bug 18784 Link to non-existent image page with caption should use caption as link text
12525 !! wikitext
12526 [[:Image:test|caption]]
12527 !! html
12528 <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>
12529 </p>
12530 !! end
12531
12532 !! test
12533 Frameless image caption with a free URL
12534 !! wikitext
12535 [[File:Foobar.jpg|http://example.com]]
12536 !! html/php
12537 <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>
12538 </p>
12539 !! html/parsoid
12540 <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>
12541 !! end
12542
12543 !! test
12544 Thumbnail image caption with a free URL
12545 !! options
12546 thumbsize=220
12547 !! wikitext
12548 [[File:Foobar.jpg|thumb|http://example.com]]
12549 !! html/php
12550 <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>
12551
12552 !! html/parsoid
12553 <figure class="mw-default-size" typeof="mw:Image/Thumb"><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="25" width="220"/></a><figcaption><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></figcaption></figure>
12554 !! end
12555
12556 !! test
12557 Thumbnail image caption with a free URL and explicit alt
12558 !! options
12559 thumbsize=220
12560 parsoid=wt2html,wt2wt,html2html
12561 !! wikitext
12562 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
12563 !! html/php
12564 <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>
12565
12566 !! html/parsoid
12567 <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/3/3a/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>
12568 !! end
12569
12570 !! test
12571 SVG thumbnails with no language set
12572 !! options
12573 !! wikitext
12574 [[File:Foobar.svg|thumb|caption]]
12575 !! html/php
12576 <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>
12577
12578 !! html/parsoid
12579 <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>caption</figcaption></figure>
12580 !! end
12581
12582 !! test
12583 SVG thumbnails with language de
12584 !! options
12585 parsoid=wt2html,wt2wt,html2html
12586 !! wikitext
12587 [[File:Foobar.svg|thumb|caption|lang=de]]
12588 !! html/php
12589 <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>
12590
12591 !! html/parsoid
12592 <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" lang="de" data-file-width="240" data-file-height="180" data-file-type="drawing" height="165" width="220"/></a><figcaption>caption</figcaption></figure>
12593 !! end
12594
12595 !! test
12596 SVG thumbnails with invalid language code
12597 !! options
12598 parsoid=wt2html,wt2wt,html2html
12599 !! wikitext
12600 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
12601 !! html/php
12602 <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>
12603
12604 !! html/parsoid
12605 <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>
12606 !! end
12607
12608 !! test
12609 BUG 1887: A ISBN with a thumbnail
12610 !! wikitext
12611 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
12612 !! html/php
12613 <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>
12614
12615 !! html/parsoid
12616 <figure class="mw-default-size" typeof="mw:Image/Thumb"><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="25" width="220"/></a><figcaption><a href="Special:BookSources/1235467890" rel="mw:ExtLink">ISBN 1235467890</a></figcaption></figure>
12617 !! end
12618
12619 !! test
12620 BUG 1887: A RFC with a thumbnail
12621 !! wikitext
12622 [[File:Foobar.jpg|thumb|This is RFC 12354]]
12623 !! html/php
12624 <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>
12625
12626 !! html/parsoid
12627 <figure class="mw-default-size" typeof="mw:Image/Thumb"><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="25" width="220"/></a><figcaption>This is <a href="//tools.ietf.org/html/rfc12354" rel="mw:ExtLink">RFC 12354</a></figcaption></figure>
12628 !! end
12629
12630 !! test
12631 BUG 1887: A mailto link with a thumbnail
12632 !! wikitext
12633 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
12634 !! html/php
12635 <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>
12636
12637 !! html/parsoid
12638 <figure class="mw-default-size" typeof="mw:Image/Thumb"><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="25" width="220"/></a><figcaption>Please <a rel="mw:ExtLink" href="mailto:nobody@example.com">mailto:nobody@example.com</a></figcaption></figure>
12639 !! end
12640
12641 # Pending resolution to bug 368
12642 !! test
12643 BUG 648: Frameless image caption with a link
12644 !! wikitext
12645 [[File:Foobar.jpg|text with a [[link]] in it]]
12646 !! html/php
12647 <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>
12648 </p>
12649 !! html/parsoid
12650 <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>
12651 !! end
12652
12653 !! test
12654 BUG 648: Frameless image caption with a link (suffix)
12655 !! wikitext
12656 [[File:Foobar.jpg|text with a [[link]]foo in it]]
12657 !! html/php
12658 <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>
12659 </p>
12660 !! html/parsoid
12661 <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>
12662 !! end
12663
12664 !! test
12665 BUG 648: Frameless image caption with an interwiki link
12666 !! wikitext
12667 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
12668 !! html/php
12669 <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>
12670 </p>
12671 !! html/parsoid
12672 <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>
12673 !! end
12674
12675 !! test
12676 BUG 648: Frameless image caption with a piped interwiki link
12677 !! wikitext
12678 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
12679 !! html/php
12680 <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>
12681 </p>
12682 !! html/parsoid
12683 <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>
12684 !! end
12685
12686 !! test
12687 Escape HTML special chars in image alt text
12688 !! wikitext
12689 [[File:Foobar.jpg|& < > "]]
12690 !! html/php
12691 <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>
12692 </p>
12693 !! html/parsoid
12694 <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>
12695 !! end
12696
12697 !! test
12698 BUG 499: Alt text should have &#1234;, not &amp;1234;
12699 !! wikitext
12700 [[File:Foobar.jpg|&#9792;]]
12701 !! html/php
12702 <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>
12703 </p>
12704 !! html/parsoid
12705 <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>
12706 !! end
12707
12708 !! test
12709 Broken image caption with link
12710 !! options
12711 parsoid=wt2html,wt2wt,html2html
12712 !! wikitext
12713 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
12714 !! html/php
12715 <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.
12716 </p>
12717 !! html/parsoid
12718 <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>
12719 !! end
12720
12721 !! test
12722 Image caption containing another image
12723 !! wikitext
12724 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
12725 !! html/php
12726 <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>
12727
12728 !! html/parsoid
12729 <figure class="mw-default-size" typeof="mw:Image/Thumb"><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="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>
12730 !! end
12731
12732 !! test
12733 Image: caption containing a newline
12734 !! wikitext
12735 [[File:Foobar.jpg|This
12736 *is some text]]
12737 !! html/php
12738 <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>
12739 </p>
12740 !! html/parsoid
12741 <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>
12742 !!end
12743
12744 !!test
12745 Image: caption containing leading space
12746 (The leading space should not trigger nowiki escaping in wt2wt mode)
12747 !! wikitext
12748 [[File:Foobar.jpg|thumb| bar]]
12749 !! html/php
12750 <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>
12751
12752 !! html/parsoid
12753 <figure class="mw-default-size" typeof="mw:Image/Thumb"><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="25" width="220"/></a><figcaption> bar</figcaption></figure>
12754 !!end
12755
12756 !! test
12757 Image: caption containing a table
12758 !! options
12759 parsoid=wt2html,wt2wt,html2html
12760 !! wikitext
12761 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
12762 {|
12763 ! Foo !! Bar
12764 |-
12765 | Foo1 || Bar1
12766 |}
12767 and some more text.]]
12768 !! html/php
12769 <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>
12770
12771 !! html/parsoid
12772 <figure typeof="mw:Image/Thumb"><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="23" width="200"/></a><figcaption>This is an example image thumbnail caption with a table
12773 <table>
12774 <tbody>
12775 <tr><th>Foo </th><th>Bar</th></tr>
12776 <tr>
12777 <td>Foo1 </td>
12778 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
12779 !! end
12780
12781 !! test
12782 Bug 3090: External links other than http: in image captions
12783 !! wikitext
12784 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
12785 !! html/php
12786 <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>
12787
12788 !! html/parsoid
12789 <figure typeof="mw:Image/Thumb"><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="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>
12790 !! end
12791
12792 !! test
12793 Custom class
12794 !! options
12795 parsoid=wt2html,wt2wt,html2html
12796 !! wikitext
12797 [[Image:foobar.jpg|a|class=b]]
12798 !! html/php
12799 <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>
12800 </p>
12801 !! html/parsoid
12802 <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>
12803 !! end
12804
12805 !! test
12806 Localized image handling (1).
12807 !! options
12808 parsoid=wt2html,wt2wt,html2html
12809 language=es
12810 !! wikitext
12811 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
12812 !! html/php
12813 <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>
12814
12815 !! html/parsoid
12816 <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>
12817 !! end
12818
12819 !! test
12820 Localized image handling (2).
12821 !! options
12822 thumbsize=220
12823 parsoid=wt2html,wt2wt,html2html
12824 language=es
12825 !! wikitext
12826 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
12827 !! html/php
12828 <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>
12829
12830 !! html/parsoid
12831 <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Thumb"><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="25" width="220"/></a><figcaption>caption</figcaption></figure>
12832 !! end
12833
12834 !! test
12835 "border", "frameless" and "class" attributes on an image.
12836 !! options
12837 thumbsize=220
12838 parsoid=wt2html,wt2wt,html2html
12839 !! wikitext
12840 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
12841 !! html/php
12842 <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>
12843 </p>
12844 !! html/parsoid
12845 <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/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></span></p>
12846 !! end
12847
12848 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
12849 !! test
12850 Invalid image attributes (bug 62500)
12851 !! options
12852 thumbsize=220
12853 parsoid=wt2html,wt2wt,html2html
12854 !! wikitext
12855 [[File:Foobar.jpg|thumb|float|left|caption]]
12856
12857 [[File:Foobar.jpg|thumb|righ|caption]]
12858
12859 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
12860 !! html/php
12861 <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>
12862 <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>
12863 <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>
12864
12865 !! html/parsoid
12866 <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/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
12867 <figure class="mw-default-size" typeof="mw:Image/Thumb"><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="25" width="220"/></a><figcaption>caption</figcaption></figure>
12868 <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/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
12869 !! end
12870
12871 !! article
12872 File:Barfoo.jpg
12873 !! text
12874 #REDIRECT [[File:Barfoo.jpg]]
12875 !! endarticle
12876
12877 # FIXME: Parsoid should run this test -- but we'd need to teach the
12878 # mockAPI about the redirected Barfoo.jpg image.
12879 !! test
12880 Redirected image
12881 !! wikitext
12882 [[Image:Barfoo.jpg]]
12883 !! html/php
12884 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
12885 </p>
12886 !! end
12887
12888 !! test
12889 Missing image with uploads disabled
12890 !! options
12891 wgEnableUploads=0
12892 !! wikitext
12893 [[File:Foobaz.jpg]]
12894 !! html/php
12895 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
12896 </p>
12897 !! html/parsoid
12898 <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>
12899 !! end
12900
12901 # Parsoid-specific testing for images
12902 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
12903 # Currently imperfect due to a flaw in the Parsoid testrunner
12904 # Work in progress
12905 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
12906 # image tests.
12907
12908 !! test
12909 Parsoid-specific image handling - simple image with size and middle alignment
12910 !! wikitext
12911 [[File:Foobar.jpg|middle|50px]]
12912 !! html/parsoid
12913 <p><span class="mw-valign-middle" 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="6" width="50"/></a></span></p>
12914 !! end
12915
12916 !! test
12917 Parsoid-specific image handling - simple image with size, middle alignment,
12918 non-standard namespace alias
12919 !! options
12920 parsoid=wt2wt,wt2html,html2html
12921 !! wikitext
12922 [[Image:Foobar.jpg|middle|50px]]
12923 !! html/parsoid
12924 <p><span class="mw-valign-middle" 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="6" width="50"/></a></span></p>
12925 !! end
12926
12927 !! test
12928 Parsoid-specific image handling - simple image with size and middle alignment
12929 (existing content)
12930 !! wikitext
12931 [[File:Foobar.jpg|50px|middle]]
12932 !! html/parsoid
12933 <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/3/3a/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>
12934 !! end
12935
12936 !! test
12937 Parsoid-specific image handling - simple image with size and middle alignment
12938 and non-standard namespace name
12939 !! options
12940 parsoid=wt2html,wt2wt,html2html
12941 !! wikitext
12942 [[Image:Foobar.jpg|50px|middle]]
12943 !! html/parsoid
12944 <p><span class="mw-valign-middle" 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="6" width="50"/></a></span></p>
12945 !! end
12946
12947 !! test
12948 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
12949 !! wikitext
12950 [[File:Foobar.jpg|500x10px|baseline|caption]]
12951 !! html/parsoid
12952 <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>
12953 !! end
12954
12955 !! test
12956 Parsoid-specific image handling - simple image with border and size spec
12957 !! wikitext
12958 [[File:Foobar.jpg|50px|border|caption]]
12959 !! html/parsoid
12960 <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>
12961 !! end
12962
12963 !! test
12964 Parsoid-specific image handling - thumbnail with halign, valign, and caption
12965 !! wikitext
12966 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
12967 !! html/parsoid
12968 <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/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption content</figcaption></figure>
12969 !! end
12970
12971 !! test
12972 Parsoid-specific image handling - thumbnail with halign, valign, and caption
12973 (existing content)
12974 !! wikitext
12975 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
12976 !! html/parsoid
12977 <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/180px-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>
12978 !! end
12979
12980 !! test
12981 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
12982 !! wikitext
12983 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
12984 !! html/parsoid
12985 <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/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a><figcaption>caption</figcaption></figure>
12986 !! end
12987
12988 !! test
12989 Parsoid-specific image handling - thumbnail with specific size, halign,
12990 valign, and caption (existing content)
12991 !! wikitext
12992 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
12993 !! html/parsoid
12994 <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>
12995 !! end
12996
12997 !! test
12998 Parsoid-specific image handling - framed image with specific size and caption
12999 (size is ignored)
13000 !! options
13001 parsoid=wt2html,wt2wt,html2html
13002 !! wikitext
13003 [[File:Foobar.jpg|frame|500x50px|caption]]
13004 !! html/parsoid
13005 <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>
13006 !! end
13007
13008 !! test
13009 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
13010 (size is ignored)
13011 !! options
13012 parsoid=wt2html,wt2wt,html2html
13013 !! wikitext
13014 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
13015 !! html/parsoid
13016 <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>
13017 !! end
13018
13019 !! test
13020 Parsoid-specific image handling - frameless image with specific size, border, and caption
13021 !! wikitext
13022 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
13023 !! html/parsoid
13024 <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>
13025 !! end
13026
13027 !! test
13028 Parsoid-specific image handling - simple image with a formatted caption
13029 !! wikitext
13030 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
13031 !! html/parsoid
13032 <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>
13033 !! end
13034
13035 !! test
13036 Parsoid-specific image handling - caption with a template in it
13037 !! wikitext
13038 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
13039 !! html/parsoid
13040 <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>
13041 !! end
13042
13043 !! test
13044 Parsoid-specific image handling - caption with unbalanced tags in it
13045 !! options
13046 parsoid=wt2html,wt2wt,html2html
13047 !! wikitext
13048 foo
13049 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
13050 bar
13051 !! html/parsoid
13052 <p>foo</p>
13053 <figure typeof="mw:Image/Thumb"><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="23" width="200"/></a><figcaption>This caption has a <center>unbalanced tag in it.</center></figcaption></figure>
13054 <p>bar</p>
13055 !! end
13056
13057 !! test
13058 Parsoid-specific image handling - empty caption (1)
13059 !! options
13060 parsoid=wt2html,wt2wt
13061 !! wikitext
13062 [[File:Foobar.jpg|thumb|]]
13063 !! html/parsoid
13064 <figure class="mw-default-size" typeof="mw:Image/Thumb"><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="25" width="220"/></a><figcaption></figcaption></figure>
13065 !! end
13066
13067 # empty captions don't get serialized unless we're in the "round trip" case
13068 !! test
13069 Parsoid-specific image handling - empty caption (2)
13070 !! options
13071 parsoid=html2wt
13072 !! html/parsoid
13073 <figure class="mw-default-size" typeof="mw:Image/Thumb">
13074 <a href="./File:Foobar.jpg">
13075 <img resource="./File:Foobar.jpg"
13076 src="//example.com/images/3/3a/Foobar.jpg"
13077 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
13078 height="25" width="220"/>
13079 </a>
13080 <figcaption></figcaption>
13081 </figure>
13082 !! wikitext
13083 [[File:Foobar.jpg|thumb]]
13084 !! end
13085
13086 !! test
13087 Parsoid-specific image handling - whitespace caption
13088 !! wikitext
13089 [[File:Foobar.jpg|thumb| ]]
13090 !! html/parsoid
13091 <figure class="mw-default-size" typeof="mw:Image/Thumb"><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="25" width="220"/></a><figcaption> </figcaption></figure>
13092 !! end
13093
13094 !! test
13095 Parsoid-specific image handling - lang option
13096 !! wikitext
13097 foo
13098 [[File:Foobar.svg|lang=de|caption]]
13099 bar
13100 !! html/parsoid
13101 <p>foo
13102 <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>
13103 bar</p>
13104 !! end
13105
13106
13107 ###
13108 ### Subpages
13109 ###
13110 !! article
13111 Subpage test/subpage
13112 !! text
13113 foo
13114 !! endarticle
13115
13116 !! test
13117 Subpage link
13118 !! options
13119 subpage title=[[Subpage test]]
13120 !! wikitext
13121 [[/subpage]]
13122 !! html
13123 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
13124 </p>
13125 !! end
13126
13127 !! test
13128 Subpage noslash link
13129 !! options
13130 subpage title=[[Subpage test]]
13131 !! wikitext
13132 [[/subpage/]]
13133 !! html
13134 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
13135 </p>
13136 !! end
13137
13138 !! article
13139 Subpage test/1/2/subpage
13140 !! text
13141 blah
13142 !! endarticle
13143
13144 !! test
13145 Relative subpage noslash link
13146 !! options
13147 parsoid=wt2wt,wt2html,html2html
13148 subpage title=[[Subpage test/1/2/3/4]]
13149 !! wikitext
13150 [[../../subpage/]]
13151
13152 [[../../subpage]]
13153 !! html/php
13154 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
13155 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
13156 </p>
13157 !! html/parsoid
13158 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
13159 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
13160 !! end
13161
13162 !! test
13163 Parsoid: dot-slash prefixed wikilinks
13164 !! wikitext
13165 [[./foo]]
13166
13167 [[././bar]]
13168
13169 [[././baz/]]
13170 !! html/php
13171 <p>[[./foo]]
13172 </p><p>[[././bar]]
13173 </p><p>[[././baz/]]
13174 </p>
13175 !! html/parsoid
13176 <p>[[./foo]]
13177 </p><p>[[././bar]]
13178 </p><p>[[././baz/]]
13179 </p>
13180 !! end
13181
13182 !! test
13183 Render invalid page names as plain text (bug 51090)
13184 !! wikitext
13185 [[./../foo|bar]]
13186 [[foo�|bar]]
13187 [[foo/.|bar]]
13188 [[foo/..|bar]]
13189 [[foo~~~bar]]
13190 [[foo>bar]]
13191 [[foo[bar]]
13192 [[.]]
13193 [[..]]
13194 [[foo././bar]]
13195
13196 [[{{echo|./../foo}}|bar]]
13197 [[{{echo|foo/.}}|bar]]
13198 [[{{echo|foo/..}}|bar]]
13199 [[{{echo|foo~~~~bar}}]]
13200 [[{{echo|foo>bar}}]]
13201 [[{{echo|foo././bar}}]]
13202 [[{{echo|foo{bar}}]]
13203 [[{{echo|foo}bar}}]]
13204 [[{{echo|foo[bar}}]]
13205 [[{{echo|foo]bar}}]]
13206 [[{{echo|foo<bar}}]]
13207 !!html/php
13208 <p>[[./../foo|bar]]
13209 [[foo�|bar]]
13210 [[foo/.|bar]]
13211 [[foo/..|bar]]
13212 [[foo~~~bar]]
13213 [[foo&gt;bar]]
13214 [[foo[bar]]
13215 [[.]]
13216 [[..]]
13217 [[foo././bar]]
13218 </p><p>[[./../foo|bar]]
13219 [[foo/.|bar]]
13220 [[foo/..|bar]]
13221 [[foo~~~~bar]]
13222 [[foo&gt;bar]]
13223 [[foo././bar]]
13224 [[foo{bar]]
13225 [[foo}bar]]
13226 [[foo[bar]]
13227 [[foo]bar]]
13228 [[foo&lt;bar]]
13229 </p>
13230 !!html/parsoid
13231 <p>[[./../foo|bar]]
13232 [[foo�|bar]]
13233 [[foo/.|bar]]
13234 [[foo/..|bar]]
13235 [[foo~~~bar]]
13236 [[foo>bar]]
13237 [[foo[bar]]
13238 [[.]]
13239 [[..]]
13240 [[foo././bar]]</p>
13241
13242 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
13243 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
13244 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
13245 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
13246 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
13247 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
13248 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
13249 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
13250 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
13251 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
13252 [[<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>
13253 !!end
13254
13255 !! test
13256 Disabled subpages
13257 !! wikitext
13258 [[/subpage]]
13259 !! html
13260 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
13261 </p>
13262 !! end
13263
13264 !! test
13265 BUG 561: {{/Subpage}}
13266 !! options
13267 subpage title=[[Page]]
13268 !! wikitext
13269 {{/Subpage}}
13270 !! html
13271 <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>
13272 </p>
13273 !! end
13274
13275 ###
13276 ### Categories
13277 ###
13278 !! article
13279 Category:MediaWiki User's Guide
13280 !! text
13281 blah
13282 !! endarticle
13283
13284 !! test
13285 Link to category
13286 !! wikitext
13287 [[:Category:MediaWiki User's Guide]]
13288 !! html
13289 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
13290 </p>
13291 !! end
13292
13293 !! test
13294 Simple category
13295 !! options
13296 cat
13297 !! wikitext
13298 [[Category:MediaWiki User's Guide]]
13299 !! html
13300 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
13301 !! end
13302
13303 !! test
13304 PAGESINCATEGORY invalid title fatal (r33546 fix)
13305 !! wikitext
13306 {{PAGESINCATEGORY:<bogus>}}
13307 !! html
13308 <p>0
13309 </p>
13310 !! end
13311
13312 !! test
13313 Category with different sort key
13314 !! options
13315 cat
13316 !! wikitext
13317 [[Category:MediaWiki User's Guide|Foo]]
13318 !! html
13319 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
13320 !! end
13321
13322 !! test
13323 Category with identical sort key
13324 !! options
13325 cat
13326 !! wikitext
13327 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
13328 !! html
13329 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
13330 !! end
13331
13332 !! test
13333 Category with empty sort key
13334 !! options
13335 cat
13336 pst
13337 !! wikitext
13338 [[Category:MediaWiki User's Guide|]]
13339 !! html
13340 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
13341 !! end
13342
13343 !! test
13344 Category with empty sort key and parentheses
13345 !! options
13346 cat
13347 pst
13348 !! wikitext
13349 [[Category:Foo (bar)|]]
13350 !! html
13351 [[Category:Foo (bar)|Foo]]
13352 !! end
13353
13354 !! test
13355 Category with link tail
13356 !! options
13357 cat
13358 pst
13359 !! wikitext
13360 123[[Category:Foo]]456
13361 !! html
13362 123[[Category:Foo]]456
13363 !! end
13364
13365 !! test
13366 Category with template
13367 !! options
13368 cat
13369 pst
13370 !! wikitext
13371 [[Category:{{echo|Foo}}]]
13372 !! html
13373 [[Category:{{echo|Foo}}]]
13374 !! end
13375
13376 !! test
13377 Category with template in sort key
13378 !! options
13379 cat
13380 pst
13381 !! wikitext
13382 [[Category:Foo|{{echo|Bar}}]]
13383 !! html
13384 [[Category:Foo|{{echo|Bar}}]]
13385 !! end
13386
13387 !! test
13388 Category with template in sort key and title
13389 !! options
13390 cat
13391 pst
13392 !! wikitext
13393 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
13394 !! html
13395 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
13396 !! end
13397
13398 !! test
13399 Category / paragraph interactions
13400 !! wikitext
13401 Foo [[Category:Baz]] Bar
13402
13403 Foo [[Category:Baz]]
13404 Bar
13405
13406 Foo
13407 [[Category:Baz]]
13408 Bar
13409
13410 Foo
13411 [[Category:Baz]] Bar
13412
13413 Foo
13414 [[Category:Baz]]
13415 [[Category:Baz]]
13416 [[Category:Baz]]
13417 Bar
13418
13419 [[Category:Baz]]
13420 [[Category:Baz]]
13421 [[Category:Baz]]
13422
13423 [[Category:Baz]]
13424 {{echo|[[Category:Baz]]}}
13425 [[Category:Baz]]
13426 !! html
13427 <p>Foo Bar
13428 </p><p>Foo
13429 Bar
13430 </p><p>Foo
13431 Bar
13432 </p><p>Foo Bar
13433 </p><p>Foo
13434 Bar
13435 </p>
13436 !! end
13437
13438 !! test
13439 Parsoid: Serialize link to category page with colon escape
13440 !! options
13441 parsoid
13442 !! wikitext
13443
13444 [[:Category:Foo]]
13445 [[:Category:Foo|Bar]]
13446 !! html
13447 <p>
13448 <a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Category:Foo</a>
13449 <a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Bar</a>
13450 </p>
13451 !! end
13452
13453 !! test
13454 Parsoid: Link prefix/suffixes aren't applied to category links
13455 !! options
13456 parsoid=wt2html,wt2wt,html2html
13457 language=is
13458 !! wikitext
13459 x[[Category:Foo]]y
13460 !! html
13461 <p>x<link rel="mw:PageProp/Category" href="Category:Foo">y</p>
13462 !! end
13463
13464 !! test
13465 Parsoid: Serialize link to file page with colon escape
13466 !! options
13467 parsoid
13468 !! wikitext
13469
13470 [[:File:Foo.png]]
13471 [[:File:Foo.png|Bar]]
13472 !! html
13473 <p>
13474 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
13475 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
13476 </p>
13477 !! end
13478
13479 !! test
13480 Parsoid: Serialize a genuine category link without colon escape
13481 !! options
13482 parsoid
13483 !! wikitext
13484 [[Category:Foo]]
13485 [[Category:Foo|Bar]]
13486 !! html
13487 <link rel="mw:PageProp/Category" href="Category:Foo">
13488 <link rel="mw:PageProp/Category" href="Category:Foo#Bar">
13489 !! end
13490
13491 !! test
13492 Normalize hrefs properly before testing for invalid link targets (bug 70894)
13493 !! options
13494 parsoid=html2wt
13495 !! html
13496 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
13497 !! wikitext
13498 [[Category:Toxine bactérienne]]
13499 !! end
13500
13501 !! test
13502 Parsoid: Defaultsort
13503 !! wikitext
13504 {{DEFAULTSORT:Foo}}
13505 !! html/parsoid
13506 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
13507 !! end
13508
13509 !! test
13510 Parsoid: Defaultsort (template-generated)
13511 !! wikitext
13512 {{{{echo|DEFAULTSORT}}:Foo}}
13513 !! html/parsoid
13514 <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}}]}'/>
13515 !! end
13516
13517 ###
13518 ### Inter-language links
13519 ###
13520 !! test
13521 Interlanguage links
13522 !! options
13523 ill
13524 !! wikitext
13525 [[es:Alimento]]
13526 [[fr:Nourriture]]
13527 [[zh:食品]]
13528 !! html/php
13529 es:Alimento fr:Nourriture zh:食品
13530 !! html/parsoid
13531 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
13532 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
13533 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
13534 !! end
13535
13536 !! test
13537 Duplicate interlanguage links (bug 24502)
13538 !! options
13539 ill
13540 !! wikitext
13541 [[es:1]]
13542 [[es:2]]
13543 [[fr:1]]
13544 [[fr:2]]
13545 !! html/php
13546 es:1 fr:1
13547 !! html/parsoid
13548 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
13549 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
13550 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
13551 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
13552 !! end
13553
13554 ###
13555 ### Sections
13556 ###
13557 !! test
13558 Basic section headings
13559 !! wikitext
13560 == Headline 1 ==
13561 Some text
13562
13563 ==Headline 2==
13564 More
13565 ===Smaller headline===
13566 Blah blah
13567 !! html
13568 <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>
13569 <p>Some text
13570 </p>
13571 <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>
13572 <p>More
13573 </p>
13574 <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>
13575 <p>Blah blah
13576 </p>
13577 !! end
13578
13579 !! test
13580 Section headings with TOC
13581 !! wikitext
13582 == Headline 1 ==
13583 === Subheadline 1 ===
13584 ===== Skipping a level =====
13585 ====== Skipping a level ======
13586
13587 == Headline 2 ==
13588 Some text
13589 ===Another headline===
13590 !! html
13591 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13592 <ul>
13593 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
13594 <ul>
13595 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
13596 <ul>
13597 <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>
13598 <ul>
13599 <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>
13600 </ul>
13601 </li>
13602 </ul>
13603 </li>
13604 </ul>
13605 </li>
13606 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
13607 <ul>
13608 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
13609 </ul>
13610 </li>
13611 </ul>
13612 </div>
13613
13614 <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>
13615 <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>
13616 <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>
13617 <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>
13618 <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>
13619 <p>Some text
13620 </p>
13621 <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>
13622
13623 !! end
13624
13625 !! test
13626 TOC anchors don't collide
13627 !! wikitext
13628 __FORCETOC__
13629 == Headline 2 ==
13630 == Headline ==
13631 == Headline 2 ==
13632 == Headline ==
13633 !! html
13634 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13635 <ul>
13636 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
13637 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
13638 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
13639 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
13640 </ul>
13641 </div>
13642
13643 <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>
13644 <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>
13645 <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>
13646 <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>
13647
13648 !! end
13649
13650 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
13651 !! test
13652 Handling of sections up to level 6 and beyond
13653 !! wikitext
13654 = Level 1 Heading=
13655 == Level 2 Heading==
13656 === Level 3 Heading===
13657 ==== Level 4 Heading====
13658 ===== Level 5 Heading=====
13659 ====== Level 6 Heading======
13660 ======= Level 7 Heading=======
13661 ======== Level 8 Heading========
13662 ========= Level 9 Heading=========
13663 ========== Level 10 Heading==========
13664 !! html
13665 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13666 <ul>
13667 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
13668 <ul>
13669 <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>
13670 <ul>
13671 <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>
13672 <ul>
13673 <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>
13674 <ul>
13675 <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>
13676 <ul>
13677 <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>
13678 <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>
13679 <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>
13680 <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>
13681 <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>
13682 </ul>
13683 </li>
13684 </ul>
13685 </li>
13686 </ul>
13687 </li>
13688 </ul>
13689 </li>
13690 </ul>
13691 </li>
13692 </ul>
13693 </div>
13694
13695 <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>
13696 <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>
13697 <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>
13698 <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>
13699 <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>
13700 <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>
13701 <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>
13702 <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>
13703 <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>
13704 <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>
13705
13706 !! end
13707
13708 !! test
13709 TOC regression (T11764)
13710 !! wikitext
13711 == title 1 ==
13712 === title 1.1 ===
13713 ==== title 1.1.1 ====
13714 === title 1.2 ===
13715 == title 2 ==
13716 === title 2.1 ===
13717 !! html
13718 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13719 <ul>
13720 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
13721 <ul>
13722 <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>
13723 <ul>
13724 <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>
13725 </ul>
13726 </li>
13727 <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>
13728 </ul>
13729 </li>
13730 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
13731 <ul>
13732 <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>
13733 </ul>
13734 </li>
13735 </ul>
13736 </div>
13737
13738 <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>
13739 <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>
13740 <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>
13741 <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>
13742 <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>
13743 <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>
13744
13745 !! end
13746
13747 !! test
13748 TOC with wgMaxTocLevel=3 (bug 6204)
13749 !! options
13750 wgMaxTocLevel=3
13751 !! wikitext
13752 == title 1 ==
13753 === title 1.1 ===
13754 ==== title 1.1.1 ====
13755 === title 1.2 ===
13756 == title 2 ==
13757 === title 2.1 ===
13758 !! html
13759 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13760 <ul>
13761 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
13762 <ul>
13763 <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>
13764 <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>
13765 </ul>
13766 </li>
13767 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
13768 <ul>
13769 <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>
13770 </ul>
13771 </li>
13772 </ul>
13773 </div>
13774
13775 <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>
13776 <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>
13777 <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>
13778 <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>
13779 <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>
13780 <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>
13781
13782 !! end
13783
13784 !! test
13785 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
13786 !! options
13787 wgMaxTocLevel=3
13788 !! wikitext
13789 ==Section 1==
13790 ===Section 1.1===
13791 ====Section 1.1.1====
13792 ====Section 1.1.1.1====
13793 ==Section 2==
13794 !! html
13795 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13796 <ul>
13797 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
13798 <ul>
13799 <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>
13800 </ul>
13801 </li>
13802 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
13803 </ul>
13804 </div>
13805
13806 <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>
13807 <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>
13808 <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>
13809 <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>
13810 <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>
13811
13812 !! end
13813
13814
13815 !! test
13816 Resolving duplicate section names
13817 !! wikitext
13818 == Foo bar ==
13819 == Foo bar ==
13820 !! html
13821 <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>
13822 <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>
13823
13824 !! end
13825
13826 !! test
13827 Resolving duplicate section names with differing case (bug 10721)
13828 !! wikitext
13829 == Foo bar ==
13830 == Foo Bar ==
13831 !! html
13832 <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>
13833 <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>
13834
13835 !! end
13836
13837 !! article
13838 Template:sections
13839 !! text
13840 ===Section 1===
13841 ==Section 2==
13842 !! endarticle
13843
13844 !! test
13845 Template with sections, __NOTOC__
13846 !! wikitext
13847 __NOTOC__
13848 ==Section 0==
13849 {{sections}}
13850 ==Section 4==
13851 !! html
13852 <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>
13853 <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>
13854 <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>
13855 <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>
13856
13857 !! end
13858
13859 !! test
13860 __NOEDITSECTION__ keyword
13861 !! wikitext
13862 __NOEDITSECTION__
13863 ==Section 1==
13864 ==Section 2==
13865 !! html
13866 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
13867 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
13868
13869 !! end
13870
13871 !! test
13872 Link inside a section heading
13873 !! wikitext
13874 ==Section with a [[Main Page|link]] in it==
13875 !! html
13876 <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>
13877
13878 !! end
13879
13880 !! test
13881 TOC regression (T14077)
13882 !! wikitext
13883 __TOC__
13884 == title 1 ==
13885 === title 1.1 ===
13886 == title 2 ==
13887 !! html
13888 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13889 <ul>
13890 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
13891 <ul>
13892 <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>
13893 </ul>
13894 </li>
13895 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
13896 </ul>
13897 </div>
13898
13899 <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>
13900 <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>
13901 <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>
13902
13903 !! end
13904
13905 !! test
13906 BUG 1219 URL next to image (good)
13907 !! wikitext
13908 http://example.com [[File:Foobar.jpg]]
13909 !! html/php
13910 <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>
13911 </p>
13912 !! html/parsoid
13913 <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>
13914 !!end
13915
13916 !! test
13917 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
13918 !! wikitext
13919 ===
13920 The line above must have a trailing space!
13921 === <!--
13922 --> <!-- -->
13923 But just in case it doesn't...
13924 !! html
13925 <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>
13926 <p>The line above must have a trailing space!
13927 </p>
13928 <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>
13929 <p>But just in case it doesn't...
13930 </p>
13931 !! end
13932
13933 !! test
13934 Header with special characters (bug 25462)
13935 !! wikitext
13936 The tooltips shall not show entities to the user (ie. be double escaped)
13937
13938 == text > text ==
13939 section 1
13940
13941 == text < text ==
13942 section 2
13943
13944 == text & text ==
13945 section 3
13946
13947 == text ' text ==
13948 section 4
13949
13950 == text " text ==
13951 section 5
13952 !! html
13953 <p>The tooltips shall not show entities to the user (ie. be double escaped)
13954 </p>
13955 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13956 <ul>
13957 <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>
13958 <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>
13959 <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>
13960 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
13961 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
13962 </ul>
13963 </div>
13964
13965 <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>
13966 <p>section 1
13967 </p>
13968 <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>
13969 <p>section 2
13970 </p>
13971 <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>
13972 <p>section 3
13973 </p>
13974 <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>
13975 <p>section 4
13976 </p>
13977 <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>
13978 <p>section 5
13979 </p>
13980 !! end
13981
13982 !! test
13983 Header with space, plus and underscore as entity
13984 !! wikitext
13985 Id should not contain + for spaces
13986
13987 == Space between Text ==
13988 section 1
13989
13990 == Space-Entity&#32;between&#32;Text ==
13991 section 2
13992
13993 == Plus+between+Text ==
13994 section 3
13995
13996 == Plus-Entity&#43;between&#43;Text ==
13997 section 4
13998
13999 == Underscore_between_Text ==
14000 section 5
14001
14002 == Underscore-Entity&#95;between&#95;Text ==
14003 section 6
14004
14005 [[#Space between Text]]
14006 [[#Space-Entity&#32;between&#32;Text]]
14007 [[#Plus+between+Text]]
14008 [[#Plus-Entity&#43;between&#43;Text]]
14009 [[#Underscore_between_Text]]
14010 [[#Underscore-Entity&#95;between&#95;Text]]
14011 !! html
14012 <p>Id should not contain + for spaces
14013 </p>
14014 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14015 <ul>
14016 <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>
14017 <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>
14018 <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>
14019 <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>
14020 <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>
14021 <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>
14022 </ul>
14023 </div>
14024
14025 <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>
14026 <p>section 1
14027 </p>
14028 <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>
14029 <p>section 2
14030 </p>
14031 <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>
14032 <p>section 3
14033 </p>
14034 <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>
14035 <p>section 4
14036 </p>
14037 <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>
14038 <p>section 5
14039 </p>
14040 <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>
14041 <p>section 6
14042 </p><p><a href="#Space_between_Text">#Space between Text</a>
14043 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
14044 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
14045 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
14046 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
14047 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
14048 </p>
14049 !! end
14050
14051 !! test
14052 Headers with excess '=' characters
14053 (Are similar tests necessary beyond the 1st level?)
14054 !! wikitext
14055 =foo==
14056 ==foo=
14057 =''italic'' heading==
14058 ==''italic'' heading=
14059 !! html
14060 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14061 <ul>
14062 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
14063 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
14064 <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>
14065 <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>
14066 </ul>
14067 </div>
14068
14069 <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>
14070 <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>
14071 <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>
14072 <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>
14073
14074 !! end
14075
14076 !! test
14077 HTML headers vs TOC (bug 23393)
14078 (__NOEDITSECTION__ for clearer output, doesn't matter here)
14079 !! wikitext
14080 <h1>Header 1</h1>
14081 == Header 1.1 ==
14082 == Header 1.2 ==
14083
14084 <h1>Header 2
14085 </h1>
14086 == Header 2.1 ==
14087 == Header 2.2 ==
14088 __NOEDITSECTION__
14089 !! html
14090 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14091 <ul>
14092 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
14093 <ul>
14094 <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>
14095 <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>
14096 </ul>
14097 </li>
14098 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
14099 <ul>
14100 <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>
14101 <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>
14102 </ul>
14103 </li>
14104 </ul>
14105 </div>
14106
14107 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
14108 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
14109 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
14110 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
14111 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
14112 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
14113
14114 !! end
14115
14116 !! test
14117 Single-line or multiline-comments can follow headings
14118 !! options
14119 parsoid=wt2html,wt2wt
14120 !! wikitext
14121 ==foo==<!---->
14122 ==bar==<!--c1-->
14123 ==baz==<!--
14124 c2
14125 c3-->
14126 !! html
14127 <h2><span class="mw-headline" id="foo">foo</span></h2>
14128 <h2><span class="mw-headline" id="bar">bar</span></h2>
14129 <h2><span class="mw-headline" id="baz">baz</span></h2>
14130
14131 !! end
14132
14133 !! test
14134 BUG 1219 URL next to image (broken)
14135 !! wikitext
14136 http://example.com[[File:Foobar.jpg]]
14137 !! html/php
14138 <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>
14139 </p>
14140 !! html/parsoid
14141 <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>
14142 !!end
14143
14144 !! test
14145 Bug 1186 news: in the middle of text
14146 !! wikitext
14147 http://en.wikinews.org/wiki/Wikinews:Workplace
14148 !! html
14149 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
14150 </p>
14151 !!end
14152
14153
14154 !! test
14155 Namespaced link must have a title
14156 !! wikitext
14157 [[Project:]]
14158 !! html
14159 <p>[[Project:]]
14160 </p>
14161 !!end
14162
14163 !! test
14164 Namespaced link must have a title (bad fragment version)
14165 !! wikitext
14166 [[Project:#fragment]]
14167 !! html
14168 <p>[[Project:#fragment]]
14169 </p>
14170 !!end
14171
14172
14173 ###
14174 ### HTML tags and HTML attributes
14175 ###
14176
14177 !! test
14178 div with no attributes
14179 !! wikitext
14180 <div>HTML rocks</div>
14181 !! html
14182 <div>HTML rocks</div>
14183
14184 !! end
14185
14186 !! test
14187 div with double-quoted attribute
14188 !! wikitext
14189 <div id="rock">HTML rocks</div>
14190 !! html
14191 <div id="rock">HTML rocks</div>
14192
14193 !! end
14194
14195 !! test
14196 div with single-quoted attribute
14197 !! wikitext
14198 <div id='rock'>HTML rocks</div>
14199 !! html
14200 <div id="rock">HTML rocks</div>
14201
14202 !! end
14203
14204 !! test
14205 div with unquoted attribute
14206 !! wikitext
14207 <div id=rock>HTML rocks</div>
14208 !! html
14209 <div id="rock">HTML rocks</div>
14210
14211 !! end
14212
14213 !! test
14214 div with illegal double attributes
14215 !! wikitext
14216 <div id="a" id="b">HTML rocks</div>
14217 !! html
14218 <div id="b">HTML rocks</div>
14219
14220 !!end
14221
14222 # FIXME: produce empty string instead of "class" in the PHP parser, following
14223 # the HTML5 spec.
14224 !! test
14225 div with empty attribute value, space before equals
14226 !! options
14227 parsoid
14228 !! wikitext
14229 <div class =>HTML rocks</div>
14230 !! html
14231 <div class="">HTML rocks</div>
14232
14233 !! end
14234
14235 !! test
14236 div with multiple empty attribute values
14237 !! options
14238 parsoid
14239 !! wikitext
14240 <div id= title=>HTML rocks</div>
14241 !! html
14242 <div id="" title="">HTML rocks</div>
14243
14244 !! end
14245
14246 !! test
14247 table with multiple empty attribute values
14248 !! options
14249 parsoid
14250 !! wikitext
14251 {| title= id=
14252 | hi
14253 |}
14254 !! html
14255 <table title="" id="">
14256 <tbody><tr><td> hi</td></tr>
14257 </tbody></table>
14258 !! end
14259
14260 !! test
14261 div with braces in attribute value
14262 !! wikitext
14263 <div title="{}">Foo</div>
14264 !! html/php
14265 <div title="&#123;}">Foo</div>
14266
14267 !! html/parsoid
14268 <div title="{}">Foo</div>
14269 !! end
14270
14271 # This it very inconsistent in the PHP parser: it returns
14272 # class="class" if there is a space between the name and the equal sign (see
14273 # 'div with empty attribute value, space before equals'), but strips the
14274 # attribute completely if the space is missing. We hope that not much content
14275 # depends on this, so are implementing the behavior below in Parsoid for
14276 # consistencies' sake.
14277 # FIXME: fix this behavior in the PHP parser?
14278 !! test
14279 div with empty attribute value, no space before equals
14280 !! options
14281 parsoid=wt2html,html2html
14282 !! wikitext
14283 <div class=>HTML rocks</div>
14284 !! html/php
14285 <div>HTML rocks</div>
14286
14287 !! html/parsoid
14288 <div class="">HTML rocks</div>
14289 !! end
14290
14291 !! test
14292 HTML multiple attributes correction
14293 !! wikitext
14294 <p class="error" class="awesome">Awesome!</p>
14295 !! html
14296 <p class="awesome">Awesome!</p>
14297
14298 !!end
14299
14300 !! test
14301 Table multiple attributes correction
14302 !! wikitext
14303 {|
14304 !+ class="error" class="awesome"| status
14305 |}
14306 !! html
14307 <table>
14308 <tr>
14309 <th class="awesome"> status
14310 </th></tr></table>
14311
14312 !!end
14313
14314 !! test
14315 DIV IN UPPERCASE
14316 !! wikitext
14317 <DIV ID="x">HTML ROCKS</DIV>
14318 !! html
14319 <div id="x">HTML ROCKS</div>
14320
14321 !!end
14322
14323 !! test
14324 Non-ASCII pseudo-tags are rendered as text
14325 !! wikitext
14326 <khyô>
14327 !! html
14328 <p>&lt;khyô&gt;
14329 </p>
14330 !! end
14331
14332 !! test
14333 Pseudo-tag with URL 'name' renders as url link
14334 !! wikitext
14335 <http://example.com/>
14336 !! html
14337 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
14338 </p>
14339 !! end
14340
14341 !! test
14342 text with amp in the middle of nowhere
14343 !! wikitext
14344 Remember AT&T?
14345 !! html
14346 <p>Remember AT&amp;T?
14347 </p>
14348 !! end
14349
14350 !! test
14351 text with character entity: eacute
14352 !! wikitext
14353 I always thought &eacute; was a cute letter.
14354 !! html
14355 <p>I always thought &#233; was a cute letter.
14356 </p>
14357 !! html+tidy
14358 <p>I always thought é was a cute letter.</p>
14359 !! end
14360
14361 !! test
14362 text with entity-escaped character entity-like string: eacute
14363 !! wikitext
14364 I always thought &amp;eacute; was a cute letter.
14365 !! html
14366 <p>I always thought &amp;eacute; was a cute letter.
14367 </p>
14368 !! end
14369
14370 !! test
14371 text with undefined character entity: xacute
14372 !! wikitext
14373 I always thought &xacute; was a cute letter.
14374 !! html
14375 <p>I always thought &amp;xacute; was a cute letter.
14376 </p>
14377 !! end
14378
14379 # TODO: generalize to PHP parser?
14380 !! test
14381 HTML5 tags
14382 !! options
14383 parsoid
14384 !! wikitext
14385 <data value="5">five</data>
14386 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
14387 <mark>This highlighted text</mark>
14388 !! html
14389 <p><data value="5">five</data>
14390 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
14391 <mark>This highlighted text</mark></p>
14392 !! end
14393
14394 !! test
14395 HTML tag with leading space is parsed as text
14396 !! wikitext
14397 < div>foo< /div>
14398 !! html
14399 <p>&lt; div&gt;foo&lt; /div&gt;
14400 </p>
14401 !! end
14402
14403 ###
14404 ### Nesting tests (see bug 41545, 50604, 51081)
14405 ###
14406
14407 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
14408 # Note that html2wt is considerably more difficult if we use <b> in
14409 # the test case, instead of <big>
14410 !! test
14411 Ensure that HTML adoption agency algorithm is properly implemented.
14412 !! wikitext
14413 <big>X<big>Y</big>Z</big>
14414 !! html
14415 <p><big>X<big>Y</big>Z</big>
14416 </p>
14417 !! end
14418
14419 # This was bug 41545 in the PHP parser.
14420 # Note that tidy doesn't handle this correctly.
14421 !! test
14422 Nesting of <kbd>
14423 !! wikitext
14424 <kbd>X<kbd>Y</kbd>Z</kbd>
14425 !! html
14426 <p><kbd>X<kbd>Y</kbd>Z</kbd>
14427 </p>
14428 !! end
14429
14430 # The following cases were bug 51081 in the PHP parser.
14431 # Note that there are some other nestable tags (b, i, etc) which are
14432 # not covered; see bug 51081 for discussion.
14433
14434 # Note that tidy doesn't handle this correctly.
14435 !! test
14436 Nesting of <em>
14437 !! wikitext
14438 <em>X<em>Y</em>Z</em>
14439 !! html
14440 <p><em>X<em>Y</em>Z</em>
14441 </p>
14442 !! end
14443
14444 # Note that tidy doesn't handle this correctly.
14445 !! test
14446 Nesting of <strong>
14447 !! wikitext
14448 <strong>X<strong>Y</strong>Z</strong>
14449 !! html
14450 <p><strong>X<strong>Y</strong>Z</strong>
14451 </p>
14452 !! end
14453
14454 !! test
14455 Nesting of <q>
14456 !! wikitext
14457 <q>X<q>Y</q>Z</q>
14458 !! html+tidy
14459 <p><q>X<q>Y</q>Z</q></p>
14460 !! end
14461
14462 # Note that tidy doesn't handle this correctly.
14463 !! test
14464 Nesting of <ruby>
14465 !! wikitext
14466 <ruby>X<ruby>Y</ruby>Z</ruby>
14467 !! html
14468 <p><ruby>X<ruby>Y</ruby>Z</ruby>
14469 </p>
14470 !! end
14471
14472 # Note that tidy doesn't handle this correctly.
14473 !! test
14474 Nesting of <bdo>
14475 !! wikitext
14476 <bdo>X<bdo>Y</bdo>Z</bdo>
14477 !! html
14478 <p><bdo>X<bdo>Y</bdo>Z</bdo>
14479 </p>
14480 !! end
14481
14482
14483 ###
14484 ### Media links
14485 ###
14486
14487 !! test
14488 Media link
14489 !! wikitext
14490 [[Media:Foobar.jpg]]
14491 !! html
14492 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
14493 </p>
14494 !! end
14495
14496 !! test
14497 Media link with text
14498 !! wikitext
14499 [[Media:Foobar.jpg|A neat file to look at]]
14500 !! html
14501 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
14502 </p>
14503 !! end
14504
14505 # FIXME: this is still bad HTML tag nesting
14506 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
14507 !! test
14508 Media link with nasty text
14509 !! wikitext
14510 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
14511 !! html
14512 <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>
14513
14514 !! html+tidy
14515 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
14516 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
14517 !! end
14518
14519 !! test
14520 Media link to nonexistent file (bug 1702)
14521 !! wikitext
14522 [[Media:No such.jpg]]
14523 !! html
14524 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
14525 </p>
14526 !! end
14527
14528 !! test
14529 Image link to nonexistent file (bug 1850 - good)
14530 !! wikitext
14531 [[File:No_such.jpg]]
14532 !! html/php
14533 <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>
14534 </p>
14535 !! html/parsoid
14536 <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>
14537 !! end
14538
14539 !! test
14540 :Image link to nonexistent file (bug 1850 - bad)
14541 !! wikitext
14542 [[:Image:No such.jpg]]
14543 !! html/php
14544 <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>
14545 </p>
14546 !! html/parsoid
14547 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
14548 !! end
14549
14550
14551
14552 !! test
14553 Character reference normalization in link text (bug 1938)
14554 !! wikitext
14555 [[Main Page|this&that]]
14556 !! html
14557 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
14558 </p>
14559 !!end
14560
14561 !! article
14562 אַ
14563 !! text
14564 Test for unicode normalization
14565
14566 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
14567 !! endarticle
14568
14569 !! test
14570 (bug 19451) Links should refer to the normalized form.
14571 !! wikitext
14572 [[&#xFB2E;]]
14573 [[&#x5d0;&#x5b7;]]
14574 [[&#x5d0;ַ]]
14575 [[א&#x5b7;]]
14576 [[אַ]]
14577 !! html
14578 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
14579 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
14580 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
14581 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
14582 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
14583 </p>
14584 !! end
14585
14586 !! test
14587 Empty attribute crash test (bug 2067)
14588 !! wikitext
14589 <font color="">foo</font>
14590 !! html
14591 <p><font color="">foo</font>
14592 </p>
14593 !! end
14594
14595 !! test
14596 Empty attribute crash test single-quotes (bug 2067)
14597 !! wikitext
14598 <font color=''>foo</font>
14599 !! html
14600 <p><font color="">foo</font>
14601 </p>
14602 !! end
14603
14604 !! test
14605 Attribute test: equals, then nothing
14606 !! wikitext
14607 <font color=>foo</font>
14608 !! html
14609 <p><font>foo</font>
14610 </p>
14611 !! end
14612
14613 !! test
14614 Attribute test: unquoted value
14615 !! wikitext
14616 <font color=x>foo</font>
14617 !! html
14618 <p><font color="x">foo</font>
14619 </p>
14620 !! end
14621
14622 !! test
14623 Attribute test: unquoted but illegal value (hash)
14624 !! wikitext
14625 <font color=#x>foo</font>
14626 !! html
14627 <p><font color="#x">foo</font>
14628 </p>
14629 !! end
14630
14631 !! test
14632 Attribute test: no value
14633 !! wikitext
14634 <font color>foo</font>
14635 !! html
14636 <p><font color="color">foo</font>
14637 </p>
14638 !! end
14639
14640 !! test
14641 Bug 2095: link with three closing brackets
14642 !! wikitext
14643 [[Main Page]]]
14644 !! html/php
14645 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
14646 </p>
14647 !! html/parsoid
14648 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
14649 !! end
14650
14651 !! test
14652 Bug 2095: link with pipe and three closing brackets
14653 !! wikitext
14654 [[Main Page|link]]]
14655 !! html/php
14656 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
14657 </p>
14658 !! html/parsoid
14659 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
14660 !! end
14661
14662 !! test
14663 Bug 2095: link with pipe and three closing brackets, version 2
14664 !! wikitext
14665 [[Main Page|[http://example.com/]]]
14666 !! html/php
14667 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
14668 </p>
14669 !! html/parsoid
14670 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
14671 !! end
14672
14673
14674 ###
14675 ### Safety
14676 ###
14677
14678 !! article
14679 Template:Dangerous attribute
14680 !! text
14681 " onmouseover="alert(document.cookie)
14682 !! endarticle
14683
14684 !! article
14685 Template:Dangerous style attribute
14686 !! text
14687 border-size: expression(alert(document.cookie))
14688 !! endarticle
14689
14690 !! article
14691 Template:Div style
14692 !! text
14693 <div style="float: right; {{{1}}}">Magic div</div>
14694 !! endarticle
14695
14696 !! test
14697 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
14698 !! wikitext
14699 <div title="{{test}}"></div>
14700 !! html
14701 <div title="This is a test template"></div>
14702
14703 !! end
14704
14705 # Parsoid has enough context to handle this case
14706 !! test
14707 Bug 2304: HTML attribute safety (dangerous template; 2309)
14708 !! wikitext
14709 <div title="{{dangerous attribute}}"></div>
14710 !! html/php
14711 <div title=""></div>
14712
14713 !! html/parsoid
14714 <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>
14715 !! end
14716
14717 !! test
14718 Bug 2304: HTML attribute safety (dangerous style template; 2309)
14719 !! wikitext
14720 <div style="{{dangerous style attribute}}"></div>
14721 !! html
14722 <div style="/* insecure input */"></div>
14723
14724 !! end
14725
14726 !! test
14727 Bug 2304: HTML attribute safety (safe parameter; 2309)
14728 !! wikitext
14729 {{div style|width: 200px}}
14730 !! html
14731 <div style="float: right; width: 200px">Magic div</div>
14732
14733 !! end
14734
14735 !! test
14736 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
14737 !! wikitext
14738 {{div style|width: expression(alert(document.cookie))}}
14739 !! html
14740 <div style="/* insecure input */">Magic div</div>
14741
14742 !! end
14743
14744 !! test
14745 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
14746 !! wikitext
14747 {{div style|"><script>alert(document.cookie)</script>}}
14748 !! html
14749 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
14750
14751 !! end
14752
14753 !! test
14754 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
14755 !! wikitext
14756 {{div style|" ><script>alert(document.cookie)</script>}}
14757 !! html
14758 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
14759
14760 !! end
14761
14762 !! test
14763 Bug 2304: HTML attribute safety (link)
14764 !! wikitext
14765 <div title="[[Main Page]]"></div>
14766 !! html
14767 <div title="&#91;&#91;Main Page]]"></div>
14768
14769 !! end
14770
14771 !! test
14772 Bug 2304: HTML attribute safety (italics)
14773 !! wikitext
14774 <div title="''foobar''"></div>
14775 !! html
14776 <div title="&#39;&#39;foobar&#39;&#39;"></div>
14777
14778 !! end
14779
14780 !! test
14781 Bug 2304: HTML attribute safety (bold)
14782 !! wikitext
14783 <div title="'''foobar'''"></div>
14784 !! html
14785 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
14786
14787 !! end
14788
14789
14790 !! test
14791 Bug 2304: HTML attribute safety (ISBN)
14792 !! wikitext
14793 <div title="ISBN 1234567890"></div>
14794 !! html
14795 <div title="&#73;SBN 1234567890"></div>
14796
14797 !! end
14798
14799 !! test
14800 Bug 2304: HTML attribute safety (RFC)
14801 !! wikitext
14802 <div title="RFC 1234"></div>
14803 !! html
14804 <div title="&#82;FC 1234"></div>
14805
14806 !! end
14807
14808 !! test
14809 Bug 2304: HTML attribute safety (PMID)
14810 !! wikitext
14811 <div title="PMID 1234567890"></div>
14812 !! html
14813 <div title="&#80;MID 1234567890"></div>
14814
14815 !! end
14816
14817 !! test
14818 Bug 2304: HTML attribute safety (web link)
14819 !! wikitext
14820 <div title="http://example.com/"></div>
14821 !! html
14822 <div title="http&#58;//example.com/"></div>
14823
14824 !! end
14825
14826 !! test
14827 Bug 2304: HTML attribute safety (named web link)
14828 !! wikitext
14829 <div title="[http://example.com/ link]"></div>
14830 !! html
14831 <div title="&#91;http&#58;//example.com/ link]"></div>
14832
14833 !! end
14834
14835 !! test
14836 Bug 3244: HTML attribute safety (extension; safe)
14837 !! wikitext
14838 <div style="<nowiki>background:blue</nowiki>"></div>
14839 !! html
14840 <div style="background:blue"></div>
14841
14842 !! end
14843
14844 !! test
14845 Bug 3244: HTML attribute safety (extension; unsafe)
14846 !! wikitext
14847 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
14848 !! html
14849 <div style="/* insecure input */"></div>
14850
14851 !! end
14852
14853 # More MSIE fun discovered by Tom Gilder
14854
14855 !! test
14856 MSIE CSS safety test: spurious slash
14857 !! wikitext
14858 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
14859 !! html
14860 <div style="/* insecure input */">evil</div>
14861
14862 !! end
14863
14864 !! test
14865 MSIE CSS safety test: hex code
14866 !! wikitext
14867 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
14868 !! html
14869 <div style="/* insecure input */">evil</div>
14870
14871 !! end
14872
14873 !! test
14874 MSIE CSS safety test: comment in url
14875 !! wikitext
14876 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
14877 !! html
14878 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
14879
14880 !! end
14881
14882 !! test
14883 MSIE CSS safety test: comment in expression
14884 !! wikitext
14885 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
14886 !! html
14887 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
14888
14889 !! end
14890
14891 !! test
14892 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
14893 !! wikitext
14894 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
14895 !! html
14896 <p style="/* invalid control char */">A</p>
14897
14898 !! end
14899
14900 !! test
14901 MSIE 6 CSS safety test: Fullwidth (bug 55332)
14902 !! wikitext
14903 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
14904 <div style="top:EXPRESSION(alert())">B</div>
14905 !! html
14906 <p style="/* insecure input */">A</p>
14907 <div style="/* insecure input */">B</div>
14908
14909 !! end
14910
14911 !! test
14912 MSIE 6 CSS safety test: IPA extensions (bug 55332)
14913 !! wikitext
14914 <div style="background-image:uʀʟ(javascript:alert())">A</div>
14915 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
14916 !! html
14917 <div style="/* insecure input */">A</div>
14918 <p style="/* insecure input */">B</p>
14919
14920 !! end
14921
14922 !! test
14923 MSIE 6 CSS safety test: sup/sub script (bug 55332)
14924 !! wikitext
14925 <div style="background-image:url⁽javascript:alert())">A</div>
14926 <div style="background-image:url₍javascript:alert())">B</div>
14927 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
14928 !! html
14929 <div style="/* insecure input */">A</div>
14930 <div style="/* insecure input */">B</div>
14931 <p style="/* insecure input */">C</p>
14932
14933 !! end
14934
14935 !! test
14936 Opera -o-link CSS
14937 !! wikitext
14938 <div
14939 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;"
14940 style="-o-link:attr(title);-o-link-source:current">X</div>
14941 !! html
14942 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
14943
14944 !! end
14945
14946 !! test
14947 MSIE 6 CSS safety test: Repetition markers (bug 55332)
14948 !! wikitext
14949 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
14950 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
14951 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
14952 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
14953 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
14954 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
14955 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
14956 !! html
14957 <p style="/* insecure input */">A</p>
14958 <p style="/* insecure input */">B</p>
14959 <p style="/* insecure input */">C</p>
14960 <p style="/* insecure input */">D</p>
14961 <p style="/* insecure input */">E</p>
14962 <p style="/* insecure input */">F</p>
14963 <p style="/* insecure input */">G</p>
14964
14965 !! end
14966
14967 !! test
14968 Table attribute legitimate extension
14969 !! wikitext
14970 {|
14971 !+ style="<nowiki>color:blue</nowiki>"| status
14972 |}
14973 !! html
14974 <table>
14975 <tr>
14976 <th style="color:blue"> status
14977 </th></tr></table>
14978
14979 !!end
14980
14981 !! test
14982 Table attribute safety
14983 !! wikitext
14984 {|
14985 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
14986 |}
14987 !! html
14988 <table>
14989 <tr>
14990 <th style="/* insecure input */"> status
14991 </th></tr></table>
14992
14993 !! end
14994
14995 !! test
14996 CSS line continuation 1
14997 !! wikitext
14998 <div style="background-image: u\&#10;rl(test.jpg);"></div>
14999 !! html
15000 <div style="/* insecure input */"></div>
15001
15002 !! end
15003
15004 !! test
15005 CSS line continuation 2
15006 !! wikitext
15007 <div style="background-image: u\&#13;rl(test.jpg); "></div>
15008 !! html
15009 <div style="/* insecure input */"></div>
15010
15011 !! end
15012
15013 !! article
15014 Template:Identity
15015 !! text
15016 {{{1}}}
15017 !! endarticle
15018
15019 !! test
15020 Expansion of multi-line templates in attribute values (bug 6255)
15021 !! wikitext
15022 <div style="background: {{identity|#00FF00}}">-</div>
15023 !! html
15024 <div style="background: #00FF00">-</div>
15025
15026 !! end
15027
15028
15029 !! test
15030 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
15031 !! wikitext
15032 <div style="background:
15033 #00FF00">-</div>
15034 !! html/php
15035 <div style="background: #00FF00">-</div>
15036
15037 !! html/parsoid
15038 <div style="background:
15039 #00FF00">-</div>
15040 !! end
15041
15042 !! test
15043 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
15044 !! wikitext
15045 <div style="background: &#10;#00FF00">-</div>
15046 !! html
15047 <div style="background: &#10;#00FF00">-</div>
15048
15049 !! end
15050
15051 !! test
15052 evil <math>-wiki-tags without Extension:Math enabled
15053 !! wikitext
15054 <math><img src="some evil external link"><script>some_evil_javascript();</script></math>
15055 !! html+tidy
15056 <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>
15057 !! end
15058
15059 ###
15060 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
15061 ###
15062 !! test
15063 Parser hook: empty input
15064 !! wikitext
15065 <tag></tag>
15066 !! html
15067 <pre>
15068 ''
15069 array (
15070 )
15071 </pre>
15072
15073 !! end
15074
15075 !! test
15076 Parser hook: empty input using terminated empty elements
15077 !! wikitext
15078 <tag/>
15079 !! html
15080 <pre>
15081 NULL
15082 array (
15083 )
15084 </pre>
15085
15086 !! end
15087
15088 !! test
15089 Parser hook: empty input using terminated empty elements (space before)
15090 !! wikitext
15091 <tag />
15092 !! html
15093 <pre>
15094 NULL
15095 array (
15096 )
15097 </pre>
15098
15099 !! end
15100
15101 !! test
15102 Parser hook: basic input
15103 !! wikitext
15104 <tag>input</tag>
15105 !! html
15106 <pre>
15107 'input'
15108 array (
15109 )
15110 </pre>
15111
15112 !! end
15113
15114
15115 !! test
15116 Parser hook: case insensitive
15117 !! wikitext
15118 <TAG>input</TAG>
15119 !! html
15120 <pre>
15121 'input'
15122 array (
15123 )
15124 </pre>
15125
15126 !! end
15127
15128
15129 !! test
15130 Parser hook: case insensitive, redux
15131 !! wikitext
15132 <TaG>input</TAg>
15133 !! html
15134 <pre>
15135 'input'
15136 array (
15137 )
15138 </pre>
15139
15140 !! end
15141
15142 !! test
15143 Parser hook: nested tags
15144 !! options
15145 noxml
15146 !! wikitext
15147 <tag><tag></tag></tag>
15148 !! html
15149 <pre>
15150 '<tag>'
15151 array (
15152 )
15153 </pre>&lt;/tag&gt;
15154
15155 !! end
15156
15157 !! test
15158 Parser hook: basic arguments
15159 !! wikitext
15160 <tag width=200 height = "100" depth = '50' square></tag>
15161 !! html
15162 <pre>
15163 ''
15164 array (
15165 'width' => '200',
15166 'height' => '100',
15167 'depth' => '50',
15168 'square' => 'square',
15169 )
15170 </pre>
15171
15172 !! end
15173
15174 !! test
15175 Parser hook: argument containing a forward slash (bug 5344)
15176 !! wikitext
15177 <tag filename='/tmp/bla'></tag>
15178 !! html
15179 <pre>
15180 ''
15181 array (
15182 'filename' => '/tmp/bla',
15183 )
15184 </pre>
15185
15186 !! end
15187
15188 !! test
15189 Parser hook: empty input using terminated empty elements (bug 2374)
15190 !! wikitext
15191 <tag foo=bar/>text
15192 !! html
15193 <pre>
15194 NULL
15195 array (
15196 'foo' => 'bar',
15197 )
15198 </pre>text
15199
15200 !! end
15201
15202 # </tag> should be output literally since there is no matching tag that begins it
15203 !! test
15204 Parser hook: basic arguments using terminated empty elements (bug 2374)
15205 !! wikitext
15206 <tag width=200 height = "100" depth = '50' square/>
15207 other stuff
15208 </tag>
15209 !! html
15210 <pre>
15211 NULL
15212 array (
15213 'width' => '200',
15214 'height' => '100',
15215 'depth' => '50',
15216 'square' => 'square',
15217 )
15218 </pre>
15219 <p>other stuff
15220 &lt;/tag&gt;
15221 </p>
15222 !! end
15223
15224 ###
15225 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
15226 ###
15227
15228 !! test
15229 Parser hook: static parser hook not inside a comment
15230 !! wikitext
15231 <statictag>hello, world</statictag>
15232 <statictag action=flush/>
15233 !! html
15234 <p>hello, world
15235 </p>
15236 !! end
15237
15238
15239 !! test
15240 Parser hook: static parser hook inside a comment
15241 !! wikitext
15242 <!-- <statictag>hello, world</statictag> -->
15243 <statictag action=flush/>
15244 !! html
15245 <p><br />
15246 </p>
15247 !! end
15248
15249 # Nested template calls; this case was broken by Parser.php rev 1.506,
15250 # since reverted.
15251
15252 !! article
15253 Template:One-parameter
15254 !! text
15255 (My parameter is: {{{1}}})
15256 !! endarticle
15257
15258 !! article
15259 Template:Map-one-parameter
15260 !! text
15261 {{{{{1}}}|{{{2}}}}}
15262 !! endarticle
15263
15264 !! test
15265 Nested template calls
15266 !! wikitext
15267 {{Map-one-parameter|One-parameter|param}}
15268 !! html
15269 <p>(My parameter is: param)
15270 </p>
15271 !! end
15272
15273
15274 ###
15275 ### Sanitizer
15276 ###
15277
15278 # HTML+Tidy effectively strips out the empty tags completely
15279 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
15280 # which Tidy would have done for the PHP parser had there been content inside it.
15281 !! test
15282 Sanitizer: Closing of open tags
15283 !! wikitext
15284 <s></s><table></table>
15285 !! html
15286 <s></s><table></table>
15287
15288 !! html/parsoid
15289 <p><s></s></p><table></table>
15290 !! end
15291
15292 !! test
15293 Sanitizer: Closing of open but not closed tags
15294 !! wikitext
15295 <s>foo
15296 !! html
15297 <p><s>foo</s>
15298 </p>
15299 !! end
15300
15301 !! test
15302 Sanitizer: Closing of closed but not open tags
15303 !! wikitext
15304 </s>
15305 !! html
15306 <p>&lt;/s&gt;
15307 </p>
15308 !! end
15309
15310 !! test
15311 Sanitizer: Closing of closed but not open table tags
15312 !! wikitext
15313 Table not started</td></tr></table>
15314 !! html
15315 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
15316 </p>
15317 !! end
15318
15319 !! test
15320 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
15321 !! wikitext
15322 <span id="æ: v">byte</span>[[#æ: v|backlink]]
15323 !! html
15324 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
15325 </p>
15326 !! end
15327
15328 # In HTML5, the restrictions are that id must contain at least one character,
15329 # and must not contain any space characters.
15330 !! test
15331 Sanitizer: Validating the contents of the id attribute (bug 4515)
15332 !! options
15333 disabled
15334 !! wikitext
15335 <br id="" /><br id="a space" />
15336 !! html
15337 Something ...
15338 !! end
15339
15340 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
15341 !! test
15342 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
15343 !! options
15344 disabled
15345 !! wikitext
15346 <br id="foo" /><br id="foo" />
15347 !! html
15348 Something need to be done. foo-2 ?
15349 !! end
15350
15351 !! test
15352 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
15353 !! wikitext
15354 <div itemscope>
15355 <meta itemprop="hello" content="world">
15356 <meta http-equiv="refresh" content="5">
15357 <meta itemprop="hello" http-equiv="refresh" content="5">
15358 <link itemprop="hello" href="{{SERVER}}">
15359 <link rel="stylesheet" href="{{SERVER}}">
15360 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
15361 </div>
15362 !! html
15363 <div itemscope="itemscope">
15364 <p> <meta itemprop="hello" content="world" />
15365 &lt;meta http-equiv="refresh" content="5"&gt;
15366 <meta itemprop="hello" content="5" />
15367 </p>
15368 <link itemprop="hello" href="http&#58;//example.org" />
15369 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
15370 <link itemprop="hello" href="http&#58;//example.org" />
15371 </div>
15372
15373 !! end
15374
15375 !! test
15376 Language converter: output gets cut off unexpectedly (bug 5757)
15377 !! options
15378 language=zh
15379 !! wikitext
15380 this bit is safe: }-
15381
15382 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
15383
15384 then we get cut off here: }-
15385
15386 all additional text is vanished
15387 !! html
15388 <p>this bit is safe: }-
15389 </p><p>but if we add a conversion instance: xxx
15390 </p><p>then we get cut off here: }-
15391 </p><p>all additional text is vanished
15392 </p>
15393 !! end
15394
15395 !! test
15396 Self closed html pairs (bug 5487)
15397 !! options
15398 !! wikitext
15399 <center><font id="bug" />Centered text</center>
15400 <div><font id="bug2" />In div text</div>
15401 !! html
15402 <center>&lt;font id="bug" /&gt;Centered text</center>
15403 <div>&lt;font id="bug2" /&gt;In div text</div>
15404
15405 !! end
15406
15407 #
15408 #
15409 #
15410
15411 !! test
15412 Punctuation: nbsp before exclamation
15413 !! wikitext
15414 C'est grave !
15415 !! html
15416 <p>C'est grave&#160;!
15417 </p>
15418 !! end
15419
15420 !! test
15421 Punctuation: CSS !important (bug 11874)
15422 !! wikitext
15423 <div style="width:50% !important">important</div>
15424 !! html
15425 <div style="width:50% !important">important</div>
15426
15427 !!end
15428
15429 !! test
15430 Punctuation: CSS ! important (bug 11874; with space after)
15431 !! wikitext
15432 <div style="width:50% ! important">important</div>
15433 !! html
15434 <div style="width:50% ! important">important</div>
15435
15436 !!end
15437
15438 !! test
15439 HTML bullet list, closed tags (bug 5497)
15440 !! wikitext
15441 <ul>
15442 <li>One</li>
15443 <li>Two</li>
15444 </ul>
15445 !! html/php
15446 <ul>
15447 <li>One</li>
15448 <li>Two</li>
15449 </ul>
15450
15451 !! html/parsoid
15452 <ul data-parsoid='{"stx":"html"}'>
15453 <li data-parsoid='{"stx":"html"}'>One</li>
15454 <li data-parsoid='{"stx":"html"}'>Two</li>
15455 </ul>
15456
15457 !! end
15458
15459 !! test
15460 HTML bullet list, unclosed tags (bug 5497)
15461 !! wikitext
15462 <ul>
15463 <li>One
15464 <li>Two
15465 </ul>
15466 !! html/php+tidy
15467 <ul>
15468 <li>One</li>
15469 <li>Two</li>
15470 </ul>
15471 !! html/parsoid
15472 <ul data-parsoid='{"stx":"html"}'>
15473 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
15474 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
15475 </ul>
15476
15477 !! end
15478
15479 !! test
15480 HTML ordered list, closed tags (bug 5497)
15481 !! wikitext
15482 <ol>
15483 <li>One</li>
15484 <li>Two</li>
15485 </ol>
15486 !! html/php
15487 <ol>
15488 <li>One</li>
15489 <li>Two</li>
15490 </ol>
15491
15492 !! html/parsoid
15493 <ol data-parsoid='{"stx":"html"}'>
15494 <li data-parsoid='{"stx":"html"}'>One</li>
15495 <li data-parsoid='{"stx":"html"}'>Two</li>
15496 </ol>
15497
15498 !! end
15499
15500 !! test
15501 HTML ordered list, unclosed tags (bug 5497)
15502 !! options
15503 !! wikitext
15504 <ol>
15505 <li>One
15506 <li>Two
15507 </ol>
15508 !! html/php+tidy
15509 <ol>
15510 <li>One</li>
15511 <li>Two</li>
15512 </ol>
15513 !! html/parsoid
15514 <ol data-parsoid='{"stx":"html"}'>
15515 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
15516 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
15517 </ol>
15518
15519 !! end
15520
15521 !! test
15522 HTML nested bullet list, closed tags (bug 5497)
15523 !! wikitext
15524 <ul>
15525 <li>One</li>
15526 <li>Two:
15527 <ul>
15528 <li>Sub-one</li>
15529 <li>Sub-two</li>
15530 </ul>
15531 </li>
15532 </ul>
15533 !! html
15534 <ul>
15535 <li>One</li>
15536 <li>Two:
15537 <ul>
15538 <li>Sub-one</li>
15539 <li>Sub-two</li>
15540 </ul>
15541 </li>
15542 </ul>
15543
15544 !! end
15545
15546 !! test
15547 HTML nested bullet list, open tags (bug 5497)
15548 !! wikitext
15549 <ul>
15550 <li>One
15551 <li>Two:
15552 <ul>
15553 <li>Sub-one
15554 <li>Sub-two
15555 </ul>
15556 </ul>
15557 !! html/php+tidy
15558 <ul>
15559 <li>One</li>
15560 <li>Two:
15561 <ul>
15562 <li>Sub-one</li>
15563 <li>Sub-two</li>
15564 </ul>
15565 </li>
15566 </ul>
15567 !! html/parsoid
15568 <ul>
15569 <li>One
15570 </li>
15571 <li>Two:
15572 <ul>
15573 <li>Sub-one
15574 </li>
15575 <li>Sub-two
15576 </li>
15577 </ul>
15578 </li>
15579 </ul>
15580
15581 !! end
15582
15583 !! test
15584 HTML nested ordered list, closed tags (bug 5497)
15585 !! wikitext
15586 <ol>
15587 <li>One</li>
15588 <li>Two:
15589 <ol>
15590 <li>Sub-one</li>
15591 <li>Sub-two</li>
15592 </ol>
15593 </li>
15594 </ol>
15595 !! html
15596 <ol>
15597 <li>One</li>
15598 <li>Two:
15599 <ol>
15600 <li>Sub-one</li>
15601 <li>Sub-two</li>
15602 </ol>
15603 </li>
15604 </ol>
15605
15606 !! end
15607
15608 !! test
15609 HTML nested ordered list, open tags (bug 5497)
15610 !! wikitext
15611 <ol>
15612 <li>One
15613 <li>Two:
15614 <ol>
15615 <li>Sub-one
15616 <li>Sub-two
15617 </ol>
15618 </ol>
15619 !! html/php
15620 <ol>
15621 <li>One
15622 <li>Two:
15623 <ol>
15624 <li>Sub-one
15625 <li>Sub-two
15626 </ol>
15627 </ol>
15628
15629 !! html/parsoid
15630 <ol>
15631 <li>One
15632 </li>
15633 <li>Two:
15634 <ol>
15635 <li>Sub-one
15636 </li>
15637 <li>Sub-two
15638 </li>
15639 </ol>
15640 </li>
15641 </ol>
15642
15643 !! end
15644
15645 !! test
15646 HTML ordered list item with parameters oddity
15647 !! wikitext
15648 <ol><li id="fragment">One</li>
15649 </ol>
15650 !! html
15651 <ol><li id="fragment">One</li>
15652 </ol>
15653
15654 !! end
15655
15656 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
15657 !!test
15658 bug 5918: autonumbering
15659 !! wikitext
15660 [http://first/] [http://second] [ftp://ftp]
15661
15662 ftp://inlineftp
15663
15664 [mailto:enclosed@mail.tld With target]
15665
15666 [mailto:enclosed@mail.tld]
15667
15668 mailto:inline@mail.tld
15669 !! html/php
15670 <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>
15671 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
15672 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
15673 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
15674 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
15675 </p>
15676 !! html/parsoid
15677 <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>
15678 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
15679 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
15680 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
15681 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
15682 !! end
15683
15684
15685 #
15686 # Security and HTML correctness
15687 # From Nick Jenkins' fuzz testing
15688 #
15689
15690 !! test
15691 Fuzz testing: Parser13
15692 !! wikitext
15693 {|
15694 | http://a|
15695 !! html
15696 <table>
15697 <tr>
15698 <td>
15699 </td>
15700 </tr>
15701 </table>
15702
15703 !! end
15704
15705 !! test
15706 Fuzz testing: Parser14
15707 !! wikitext
15708 == onmouseover= ==
15709 http://__TOC__
15710 !! html
15711 <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>
15712 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15713 <ul>
15714 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
15715 </ul>
15716 </div>
15717
15718
15719 !! html+tidy
15720 <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>
15721 <p>http://</p>
15722 <div id="toc" class="toc">
15723 <div id="toctitle">
15724 <h2>Contents</h2>
15725 </div>
15726 <ul>
15727 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
15728 </ul>
15729 </div>
15730 <p></p>
15731 !! end
15732
15733 !! test
15734 Fuzz testing: Parser14-table
15735 !! wikitext
15736 ==a==
15737 {| STYLE=__TOC__
15738 !! html
15739 <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>
15740 <table style="&#95;_TOC&#95;_">
15741 <tr><td></td></tr>
15742 </table>
15743
15744 !! html+tidy
15745 <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>
15746 <table style="__TOC__">
15747 <tr>
15748 <td></td>
15749 </tr>
15750 </table>
15751 !! end
15752
15753 # Known to produce bogus xml (extra </td>)
15754 !! test
15755 Fuzz testing: Parser16
15756 !! options
15757 noxml
15758 !! wikitext
15759 {|
15760 !https://||||||
15761 !! html
15762 <table>
15763 <tr>
15764 <th>https://</th>
15765 <th></th>
15766 <th></th>
15767 <th>
15768 </td>
15769 </tr>
15770 </table>
15771
15772 !! html+tidy
15773 <table>
15774 <tr>
15775 <th>https://</th>
15776 <th></th>
15777 <th></th>
15778 <th></th>
15779 </tr>
15780 </table>
15781 !! end
15782
15783 !! test
15784 Fuzz testing: Parser21
15785 !! wikitext
15786 {|
15787 ! irc://{{ftp://a" onmouseover="alert('hello world');"
15788 |
15789 !! html
15790 <table>
15791 <tr>
15792 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
15793 </th>
15794 <td>
15795 </td>
15796 </tr>
15797 </table>
15798
15799 !! end
15800
15801 !! test
15802 Fuzz testing: Parser22
15803 !! wikitext
15804 http://===r:::https://b
15805
15806 {|
15807 !! html
15808 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
15809 </p>
15810 <table>
15811 <tr><td></td></tr>
15812 </table>
15813
15814 !! end
15815
15816 # Known to produce bad XML for now
15817 !! test
15818 Fuzz testing: Parser24
15819 !! options
15820 noxml
15821 !! wikitext
15822 {|
15823 {{{|
15824 <u CLASS=
15825 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
15826 <br style="onmouseover='alert(document.cookie);' " />
15827
15828 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
15829 |
15830 !! html
15831 <table>
15832 {{{|
15833 <u class="&#124;">}}}} &gt;
15834 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
15835
15836 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
15837 <tr>
15838 <td></u>
15839 </td>
15840 </tr>
15841 </table>
15842
15843 !! end
15844
15845 # Note: the current result listed for this is not what the original one was,
15846 # but the original bug was JavaScript injection, which is fixed in any case.
15847 # It's not clear that the original result listed was any more correct than the
15848 # current one. Original result:
15849 # <p>{{{|
15850 # </p>
15851 # <li class="&#124;&#124;">
15852 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
15853 !!test
15854 Fuzz testing: Parser25 (bug 6055)
15855 !! wikitext
15856 {{{
15857 |
15858 <LI CLASS=||
15859 >
15860 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
15861 !! html
15862 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
15863 </p>
15864 !! end
15865
15866 !!test
15867 Fuzz testing: URL adjacent extension (with space, clean)
15868 !! wikitext
15869 http://example.com <nowiki>junk</nowiki>
15870 !! html/php
15871 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
15872 </p>
15873 !! html/parsoid
15874 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
15875 !! end
15876
15877 !!test
15878 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
15879 !! wikitext
15880 http://example.com<nowiki>junk</nowiki>
15881 !! html/php
15882 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
15883 </p>
15884 !! html/parsoid
15885 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
15886 !! end
15887
15888 !!test
15889 Fuzz testing: URL adjacent extension (no space, dirty; pre)
15890 !! wikitext
15891 http://example.com<pre>junk</pre>
15892 !! html/php
15893 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
15894
15895 !! html/php+tidy
15896 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
15897 <pre>
15898 junk
15899 </pre>
15900 !! html/parsoid
15901 <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>
15902 !!end
15903
15904 !!test
15905 Fuzz testing: image with bogus manual thumbnail
15906 !! wikitext
15907 [[Image:foobar.jpg|thumbnail= ]]
15908 !! html/php
15909 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
15910
15911 !! html/parsoid
15912 <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>
15913 !!end
15914
15915 !! test
15916 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
15917 !! wikitext
15918 <pre dir="&#10;"></pre>
15919 !! html
15920 <pre dir="&#10;"></pre>
15921
15922 !! end
15923
15924 !! test
15925 Parsing optional HTML elements (Bug 6171)
15926 !! options
15927 !! wikitext
15928 <table>
15929 <tr>
15930 <td> Some tabular data</td>
15931 <td> More tabular data ...
15932 <td> And yet som tabular data</td>
15933 </tr>
15934 </table>
15935 !! html
15936 <table>
15937 <tr>
15938 <td> Some tabular data</td>
15939 <td> More tabular data ...
15940 </td><td> And yet som tabular data</td>
15941 </tr>
15942 </table>
15943
15944 !! end
15945
15946 !! test
15947 Correct handling of <td>, <tr> (Bug 6171)
15948 !! options
15949 !! wikitext
15950 <table>
15951 <tr>
15952 <td> Some tabular data</td>
15953 <td> More tabular data ...</td>
15954 <td> And yet som tabular data</td>
15955 </tr>
15956 </table>
15957 !! html
15958 <table>
15959 <tr>
15960 <td> Some tabular data</td>
15961 <td> More tabular data ...</td>
15962 <td> And yet som tabular data</td>
15963 </tr>
15964 </table>
15965
15966 !! end
15967
15968
15969 !! test
15970 Parsing crashing regression (fr:JavaScript)
15971 !! wikitext
15972 </body></x>
15973 !! html
15974 <p>&lt;/body&gt;&lt;/x&gt;
15975 </p>
15976 !! end
15977
15978 !! test
15979 Inline wiki vs wiki block nesting
15980 !! wikitext
15981 '''Bold paragraph
15982
15983 New wiki paragraph
15984 !! html
15985 <p><b>Bold paragraph</b>
15986 </p><p>New wiki paragraph
15987 </p>
15988 !! end
15989
15990 # FIXME: The current php output is documented
15991 # and desired output is the parsoid target.
15992 !! test
15993 Inline HTML vs wiki block nesting
15994 !! wikitext
15995 <b>Bold paragraph
15996
15997 New wiki paragraph
15998 !! html/php
15999 <p><b>Bold paragraph
16000 </p><p>New wiki paragraph</b>
16001 </p>
16002 !! html/parsoid
16003 <p><b>Bold paragraph</b>
16004 </p><p>New wiki paragraph
16005 </p>
16006 !! end
16007
16008 # Original result was this:
16009 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
16010 # </p>
16011 # While that might be marginally more intuitive, maybe, the six-apostrophe
16012 # construct is clearly pathological and the result stated here (which is what
16013 # the parser actually does) is about as reasonable as anything.
16014 !!test
16015 Mixing markup for italics and bold
16016 !! options
16017 !! wikitext
16018 '''bold''''''bold''bolditalics'''''
16019 !! html
16020 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
16021 </p>
16022 !! end
16023
16024
16025 !! article
16026 Xyzzyx
16027 !! text
16028 Article for special page transclusion test
16029 !! endarticle
16030
16031 !! test
16032 Special page transclusion
16033 !! options
16034 !! wikitext
16035 {{Special:Prefixindex/Xyzzyx}}
16036 !! html
16037 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
16038
16039 !! end
16040
16041 !! test
16042 Special page transclusion twice (bug 5021)
16043 !! options
16044 !! wikitext
16045 {{Special:Prefixindex/Xyzzyx}}
16046 {{Special:Prefixindex/Xyzzyx}}
16047 !! html
16048 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
16049 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
16050
16051 !! end
16052
16053 !! test
16054 Transclusion of default MediaWiki message
16055 !! wikitext
16056 {{MediaWiki:Mainpage}}
16057 !! html
16058 <p>Main Page
16059 </p>
16060 !! end
16061
16062 !! test
16063 Transclusion of nonexistent MediaWiki message
16064 !! wikitext
16065 {{MediaWiki:Mainpagexxx}}
16066 !! html
16067 <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>
16068 </p>
16069 !! end
16070
16071 !! test
16072 Transclusion of MediaWiki message with underscore
16073 !! wikitext
16074 {{MediaWiki:history_short}}
16075 !! html
16076 <p>History
16077 </p>
16078 !! end
16079
16080 !! test
16081 Transclusion of MediaWiki message with space
16082 !! wikitext
16083 {{MediaWiki:history short}}
16084 !! html
16085 <p>History
16086 </p>
16087 !! end
16088
16089 !! test
16090 Invalid header with following text
16091 !! wikitext
16092 = x = y
16093 !! html
16094 <p>= x = y
16095 </p>
16096 !! end
16097
16098
16099 !! test
16100 Section extraction test (section 0)
16101 !! options
16102 section=0
16103 !! wikitext
16104 start
16105 ==a==
16106 ===aa===
16107 ====aaa====
16108 ==b==
16109 ===ba===
16110 ===bb===
16111 ====bba====
16112 ===bc===
16113 ==c==
16114 ===ca===
16115 !! html
16116 start
16117 !! end
16118
16119 !! test
16120 Section extraction test (section 1)
16121 !! options
16122 section=1
16123 !! wikitext
16124 start
16125 ==a==
16126 ===aa===
16127 ====aaa====
16128 ==b==
16129 ===ba===
16130 ===bb===
16131 ====bba====
16132 ===bc===
16133 ==c==
16134 ===ca===
16135 !! html
16136 ==a==
16137 ===aa===
16138 ====aaa====
16139 !! end
16140
16141 !! test
16142 Section extraction test (section 2)
16143 !! options
16144 section=2
16145 !! wikitext
16146 start
16147 ==a==
16148 ===aa===
16149 ====aaa====
16150 ==b==
16151 ===ba===
16152 ===bb===
16153 ====bba====
16154 ===bc===
16155 ==c==
16156 ===ca===
16157 !! html
16158 ===aa===
16159 ====aaa====
16160 !! end
16161
16162 !! test
16163 Section extraction test (section 3)
16164 !! options
16165 section=3
16166 !! wikitext
16167 start
16168 ==a==
16169 ===aa===
16170 ====aaa====
16171 ==b==
16172 ===ba===
16173 ===bb===
16174 ====bba====
16175 ===bc===
16176 ==c==
16177 ===ca===
16178 !! html
16179 ====aaa====
16180 !! end
16181
16182 !! test
16183 Section extraction test (section 4)
16184 !! options
16185 section=4
16186 !! wikitext
16187 start
16188 ==a==
16189 ===aa===
16190 ====aaa====
16191 ==b==
16192 ===ba===
16193 ===bb===
16194 ====bba====
16195 ===bc===
16196 ==c==
16197 ===ca===
16198 !! html
16199 ==b==
16200 ===ba===
16201 ===bb===
16202 ====bba====
16203 ===bc===
16204 !! end
16205
16206 !! test
16207 Section extraction test (section 5)
16208 !! options
16209 section=5
16210 !! wikitext
16211 start
16212 ==a==
16213 ===aa===
16214 ====aaa====
16215 ==b==
16216 ===ba===
16217 ===bb===
16218 ====bba====
16219 ===bc===
16220 ==c==
16221 ===ca===
16222 !! html
16223 ===ba===
16224 !! end
16225
16226 !! test
16227 Section extraction test (section 6)
16228 !! options
16229 section=6
16230 !! wikitext
16231 start
16232 ==a==
16233 ===aa===
16234 ====aaa====
16235 ==b==
16236 ===ba===
16237 ===bb===
16238 ====bba====
16239 ===bc===
16240 ==c==
16241 ===ca===
16242 !! html
16243 ===bb===
16244 ====bba====
16245 !! end
16246
16247 !! test
16248 Section extraction test (section 7)
16249 !! options
16250 section=7
16251 !! wikitext
16252 start
16253 ==a==
16254 ===aa===
16255 ====aaa====
16256 ==b==
16257 ===ba===
16258 ===bb===
16259 ====bba====
16260 ===bc===
16261 ==c==
16262 ===ca===
16263 !! html
16264 ====bba====
16265 !! end
16266
16267 !! test
16268 Section extraction test (section 8)
16269 !! options
16270 section=8
16271 !! wikitext
16272 start
16273 ==a==
16274 ===aa===
16275 ====aaa====
16276 ==b==
16277 ===ba===
16278 ===bb===
16279 ====bba====
16280 ===bc===
16281 ==c==
16282 ===ca===
16283 !! html
16284 ===bc===
16285 !! end
16286
16287 !! test
16288 Section extraction test (section 9)
16289 !! options
16290 section=9
16291 !! wikitext
16292 start
16293 ==a==
16294 ===aa===
16295 ====aaa====
16296 ==b==
16297 ===ba===
16298 ===bb===
16299 ====bba====
16300 ===bc===
16301 ==c==
16302 ===ca===
16303 !! html
16304 ==c==
16305 ===ca===
16306 !! end
16307
16308 !! test
16309 Section extraction test (section 10)
16310 !! options
16311 section=10
16312 !! wikitext
16313 start
16314 ==a==
16315 ===aa===
16316 ====aaa====
16317 ==b==
16318 ===ba===
16319 ===bb===
16320 ====bba====
16321 ===bc===
16322 ==c==
16323 ===ca===
16324 !! html
16325 ===ca===
16326 !! end
16327
16328 !! test
16329 Section extraction test (nonexistent section 11)
16330 !! options
16331 section=11
16332 !! wikitext
16333 start
16334 ==a==
16335 ===aa===
16336 ====aaa====
16337 ==b==
16338 ===ba===
16339 ===bb===
16340 ====bba====
16341 ===bc===
16342 ==c==
16343 ===ca===
16344 !! html
16345 !! end
16346
16347 !! test
16348 Section extraction test with bogus heading (section 1)
16349 !! options
16350 section=1
16351 !! wikitext
16352 ==a==
16353 ==bogus== not a legal section
16354 ==b==
16355 !! html
16356 ==a==
16357 ==bogus== not a legal section
16358 !! end
16359
16360 !! test
16361 Section extraction test with bogus heading (section 2)
16362 !! options
16363 section=2
16364 !! wikitext
16365 ==a==
16366 ==bogus== not a legal section
16367 ==b==
16368 !! html
16369 ==b==
16370 !! end
16371
16372 !! test
16373 Section extraction test with comment after heading (section 1)
16374 !! options
16375 section=1
16376 !! wikitext
16377 ==a==
16378 ==b== <!-- -->
16379 ==c==
16380 !! html
16381 ==a==
16382 !! end
16383
16384 !! test
16385 Section extraction test with comment after heading (section 2)
16386 !! options
16387 section=2
16388 !! wikitext
16389 ==a==
16390 ==b== <!-- -->
16391 ==c==
16392 !! html
16393 ==b== <!-- -->
16394 !! end
16395
16396 !! test
16397 Section extraction test with bogus <nowiki> heading (section 1)
16398 !! options
16399 section=1
16400 !! wikitext
16401 ==a==
16402 ==bogus== <nowiki>not a legal section</nowiki>
16403 ==b==
16404 !! html
16405 ==a==
16406 ==bogus== <nowiki>not a legal section</nowiki>
16407 !! end
16408
16409 !! test
16410 Section extraction test with bogus <nowiki> heading (section 2)
16411 !! options
16412 section=2
16413 !! wikitext
16414 ==a==
16415 ==bogus== <nowiki>not a legal section</nowiki>
16416 ==b==
16417 !! html
16418 ==b==
16419 !! end
16420
16421
16422 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
16423 # instead of respecting commented sections
16424 !! test
16425 Section extraction prefixed by comment (section 1)
16426 !! options
16427 section=1
16428 !! wikitext
16429 <!-- -->==sec1==
16430 ==sec2==
16431 !! html
16432 ==sec2==
16433 !!end
16434
16435 !! test
16436 Section extraction prefixed by comment (section 2)
16437 !! options
16438 section=2
16439 !! wikitext
16440 <!-- -->==sec1==
16441 ==sec2==
16442 !! html
16443
16444 !!end
16445
16446
16447 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
16448 # instead of respecting HTML-style headings
16449 !! test
16450 Section extraction, mixed wiki and html (section 1)
16451 !! options
16452 section=1
16453 !! wikitext
16454 <h2>unmarked</h2>
16455 unmarked
16456 ==1==
16457 one
16458 ==2==
16459 two
16460 !! html
16461 ==1==
16462 one
16463 !! end
16464
16465 !! test
16466 Section extraction, mixed wiki and html (section 2)
16467 !! options
16468 section=2
16469 !! wikitext
16470 <h2>unmarked</h2>
16471 unmarked
16472 ==1==
16473 one
16474 ==2==
16475 two
16476 !! html
16477 ==2==
16478 two
16479 !! end
16480
16481
16482 # Formerly testing for bug 3342
16483 !! test
16484 Section extraction, heading surrounded by <noinclude>
16485 !! options
16486 section=1
16487 !! wikitext
16488 <noinclude>==unmarked==</noinclude>
16489 ==marked==
16490 !! html
16491 ==marked==
16492 !!end
16493
16494 # Test behavior of bug 19910
16495 !! test
16496 Sectiion with all-equals
16497 !! options
16498 section=2
16499 !! wikitext
16500 ===
16501 The line above must have a trailing space
16502 === <!--
16503 --> <!-- -->
16504 But just in case it doesn't...
16505 !! html
16506 === <!--
16507 --> <!-- -->
16508 But just in case it doesn't...
16509 !! end
16510
16511 !! test
16512 Section replacement test (section 0)
16513 !! options
16514 replace=0,"xxx"
16515 !! wikitext
16516 start
16517 ==a==
16518 ===aa===
16519 ====aaa====
16520 ==b==
16521 ===ba===
16522 ===bb===
16523 ====bba====
16524 ===bc===
16525 ==c==
16526 ===ca===
16527 !! html
16528 xxx
16529
16530 ==a==
16531 ===aa===
16532 ====aaa====
16533 ==b==
16534 ===ba===
16535 ===bb===
16536 ====bba====
16537 ===bc===
16538 ==c==
16539 ===ca===
16540 !! end
16541
16542 !! test
16543 Section replacement test (section 1)
16544 !! options
16545 replace=1,"xxx"
16546 !! wikitext
16547 start
16548 ==a==
16549 ===aa===
16550 ====aaa====
16551 ==b==
16552 ===ba===
16553 ===bb===
16554 ====bba====
16555 ===bc===
16556 ==c==
16557 ===ca===
16558 !! html
16559 start
16560 xxx
16561
16562 ==b==
16563 ===ba===
16564 ===bb===
16565 ====bba====
16566 ===bc===
16567 ==c==
16568 ===ca===
16569 !! end
16570
16571 !! test
16572 Section replacement test (section 2)
16573 !! options
16574 replace=2,"xxx"
16575 !! wikitext
16576 start
16577 ==a==
16578 ===aa===
16579 ====aaa====
16580 ==b==
16581 ===ba===
16582 ===bb===
16583 ====bba====
16584 ===bc===
16585 ==c==
16586 ===ca===
16587 !! html
16588 start
16589 ==a==
16590 xxx
16591
16592 ==b==
16593 ===ba===
16594 ===bb===
16595 ====bba====
16596 ===bc===
16597 ==c==
16598 ===ca===
16599 !! end
16600
16601 !! test
16602 Section replacement test (section 3)
16603 !! options
16604 replace=3,"xxx"
16605 !! wikitext
16606 start
16607 ==a==
16608 ===aa===
16609 ====aaa====
16610 ==b==
16611 ===ba===
16612 ===bb===
16613 ====bba====
16614 ===bc===
16615 ==c==
16616 ===ca===
16617 !! html
16618 start
16619 ==a==
16620 ===aa===
16621 xxx
16622
16623 ==b==
16624 ===ba===
16625 ===bb===
16626 ====bba====
16627 ===bc===
16628 ==c==
16629 ===ca===
16630 !! end
16631
16632 !! test
16633 Section replacement test (section 4)
16634 !! options
16635 replace=4,"xxx"
16636 !! wikitext
16637 start
16638 ==a==
16639 ===aa===
16640 ====aaa====
16641 ==b==
16642 ===ba===
16643 ===bb===
16644 ====bba====
16645 ===bc===
16646 ==c==
16647 ===ca===
16648 !! html
16649 start
16650 ==a==
16651 ===aa===
16652 ====aaa====
16653 xxx
16654
16655 ==c==
16656 ===ca===
16657 !! end
16658
16659 !! test
16660 Section replacement test (section 5)
16661 !! options
16662 replace=5,"xxx"
16663 !! wikitext
16664 start
16665 ==a==
16666 ===aa===
16667 ====aaa====
16668 ==b==
16669 ===ba===
16670 ===bb===
16671 ====bba====
16672 ===bc===
16673 ==c==
16674 ===ca===
16675 !! html
16676 start
16677 ==a==
16678 ===aa===
16679 ====aaa====
16680 ==b==
16681 xxx
16682
16683 ===bb===
16684 ====bba====
16685 ===bc===
16686 ==c==
16687 ===ca===
16688 !! end
16689
16690 !! test
16691 Section replacement test (section 6)
16692 !! options
16693 replace=6,"xxx"
16694 !! wikitext
16695 start
16696 ==a==
16697 ===aa===
16698 ====aaa====
16699 ==b==
16700 ===ba===
16701 ===bb===
16702 ====bba====
16703 ===bc===
16704 ==c==
16705 ===ca===
16706 !! html
16707 start
16708 ==a==
16709 ===aa===
16710 ====aaa====
16711 ==b==
16712 ===ba===
16713 xxx
16714
16715 ===bc===
16716 ==c==
16717 ===ca===
16718 !! end
16719
16720 !! test
16721 Section replacement test (section 7)
16722 !! options
16723 replace=7,"xxx"
16724 !! wikitext
16725 start
16726 ==a==
16727 ===aa===
16728 ====aaa====
16729 ==b==
16730 ===ba===
16731 ===bb===
16732 ====bba====
16733 ===bc===
16734 ==c==
16735 ===ca===
16736 !! html
16737 start
16738 ==a==
16739 ===aa===
16740 ====aaa====
16741 ==b==
16742 ===ba===
16743 ===bb===
16744 xxx
16745
16746 ===bc===
16747 ==c==
16748 ===ca===
16749 !! end
16750
16751 !! test
16752 Section replacement test (section 8)
16753 !! options
16754 replace=8,"xxx"
16755 !! wikitext
16756 start
16757 ==a==
16758 ===aa===
16759 ====aaa====
16760 ==b==
16761 ===ba===
16762 ===bb===
16763 ====bba====
16764 ===bc===
16765 ==c==
16766 ===ca===
16767 !! html
16768 start
16769 ==a==
16770 ===aa===
16771 ====aaa====
16772 ==b==
16773 ===ba===
16774 ===bb===
16775 ====bba====
16776 xxx
16777
16778 ==c==
16779 ===ca===
16780 !!end
16781
16782 !! test
16783 Section replacement test (section 9)
16784 !! options
16785 replace=9,"xxx"
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
16799 start
16800 ==a==
16801 ===aa===
16802 ====aaa====
16803 ==b==
16804 ===ba===
16805 ===bb===
16806 ====bba====
16807 ===bc===
16808 xxx
16809 !! end
16810
16811 !! test
16812 Section replacement test (section 10)
16813 !! options
16814 replace=10,"xxx"
16815 !! wikitext
16816 start
16817 ==a==
16818 ===aa===
16819 ====aaa====
16820 ==b==
16821 ===ba===
16822 ===bb===
16823 ====bba====
16824 ===bc===
16825 ==c==
16826 ===ca===
16827 !! html
16828 start
16829 ==a==
16830 ===aa===
16831 ====aaa====
16832 ==b==
16833 ===ba===
16834 ===bb===
16835 ====bba====
16836 ===bc===
16837 ==c==
16838 xxx
16839 !! end
16840
16841 !! test
16842 Section replacement test with initial whitespace (bug 13728)
16843 !! options
16844 replace=2,"xxx"
16845 !! wikitext
16846 Preformatted initial line
16847 ==a==
16848 ===a===
16849 !! html
16850 Preformatted initial line
16851 ==a==
16852 xxx
16853 !! end
16854
16855
16856 !! test
16857 Section extraction, heading followed by pre with 20 spaces (bug 6398)
16858 !! options
16859 section=1
16860 !! wikitext
16861 ==a==
16862 a
16863 !! html
16864 ==a==
16865 a
16866 !! end
16867
16868 !! test
16869 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
16870 !! options
16871 section=1
16872 !! wikitext
16873 ==a==
16874 a
16875 !! html
16876 ==a==
16877 a
16878 !! end
16879
16880
16881 !! test
16882 Section extraction, <pre> around bogus header (bug 10309)
16883 !! options
16884 noxml section=2
16885 !! wikitext
16886 == Section One ==
16887 <pre>
16888 =======
16889 </pre>
16890
16891 == Section Two ==
16892 stuff
16893 !! html
16894 == Section Two ==
16895 stuff
16896 !! end
16897
16898 !! test
16899 Section replacement, <pre> around bogus header (bug 10309)
16900 !! options
16901 noxml replace=2,"xxx"
16902 !! wikitext
16903 == Section One ==
16904 <pre>
16905 =======
16906 </pre>
16907
16908 == Section Two ==
16909 stuff
16910 !! html
16911 == Section One ==
16912 <pre>
16913 =======
16914 </pre>
16915
16916 xxx
16917 !! end
16918
16919
16920
16921 !! test
16922 Handling of &#x0A; in URLs
16923 !! wikitext
16924 ** irc://&#x0A;a
16925 !! html/php
16926 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
16927
16928 !! html/parsoid
16929 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
16930 a">irc://
16931 a</a></li></ul></li></ul>
16932 !! end
16933
16934 !! test
16935 Handling of %0A in URLs
16936 !! wikitext
16937 ** irc://%0Aa
16938 !! html/php
16939 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
16940
16941 !! html/parsoid
16942 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
16943 !! end
16944
16945
16946 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
16947 !! test
16948 5 quotes, code coverage +1 line
16949 !! options
16950 parsoid=wt2html
16951 !! wikitext
16952 '''''
16953 !! html/php
16954 !! html/parsoid
16955 <p><b><i></i></b></p>
16956 !! end
16957
16958 # same html as previous, but wikitext adjusted to match parsoid html2wt
16959 # note that wt2html and html2html will put the <i> before the <b>
16960 !! test
16961 5 quotes, code coverage +1 line w/ nowiki (1)
16962 !! options
16963 parsoid=wt2wt,html2wt
16964 !! wikitext
16965 '''''<nowiki/>'''''
16966 !! html/php
16967 <p><i></i>
16968 </p>
16969 !! html/parsoid
16970 <p><b><i></i></b></p>
16971 !! end
16972
16973 # same as previous, just swapping the <i> and <b>
16974 !! test
16975 5 quotes, code coverage +1 line w/ nowiki (2)
16976 !! wikitext
16977 '''''<nowiki/>'''''
16978 !! html/php
16979 <p><i></i>
16980 </p>
16981 !! html/parsoid
16982 <p><i><b></b></i></p>
16983 !! end
16984
16985 !! test
16986 Special:Search page linking.
16987 !! wikitext
16988 {{Special:search}}
16989 !! html
16990 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
16991 </p>
16992 !! end
16993
16994 !! test
16995 {{!}} is a magic word
16996 !! wikitext
16997 {{!}} is a magic word there and {{!}} is still a magic word here
16998 !! html/php
16999 <p>| is a magic word there and | is still a magic word here
17000 </p>
17001 !! html/parsoid
17002 <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>
17003 !! end
17004
17005 !! test
17006 Say the magic word
17007 !! options
17008 title=[[Parser test]]
17009 !! wikitext
17010 * {{PAGENAME}}
17011 * {{PAGENAMEE}}
17012 * {{FULLPAGENAME}}
17013 * {{FULLPAGENAMEE}}
17014 * {{BASEPAGENAME}}
17015 * {{BASEPAGENAMEE}}
17016 * {{SUBPAGENAME}}
17017 * {{SUBPAGENAMEE}}
17018 * {{ROOTPAGENAME}}
17019 * {{ROOTPAGENAMEE}}
17020 * {{TALKPAGENAME}}
17021 * {{TALKPAGENAMEE}}
17022 * {{SUBJECTPAGENAME}}
17023 * {{SUBJECTPAGENAMEE}}
17024 * {{NAMESPACEE}}
17025 * {{NAMESPACE}}
17026 * {{NAMESPACENUMBER}}
17027 * {{TALKSPACE}}
17028 * {{TALKSPACEE}}
17029 * {{SUBJECTSPACE}}
17030 * {{SUBJECTSPACEE}}
17031 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
17032 !! html
17033 <ul><li> Parser test</li>
17034 <li> Parser_test</li>
17035 <li> Parser test</li>
17036 <li> Parser_test</li>
17037 <li> Parser test</li>
17038 <li> Parser_test</li>
17039 <li> Parser test</li>
17040 <li> Parser_test</li>
17041 <li> Parser test</li>
17042 <li> Parser_test</li>
17043 <li> Talk:Parser test</li>
17044 <li> Talk:Parser_test</li>
17045 <li> Parser test</li>
17046 <li> Parser_test</li>
17047 <li> </li>
17048 <li> </li>
17049 <li> 0</li>
17050 <li> Talk</li>
17051 <li> Talk</li>
17052 <li> </li>
17053 <li> </li>
17054 <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>
17055
17056 !! end
17057 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
17058
17059 !! test
17060 Gallery
17061 !! wikitext
17062 <gallery>
17063 image1.png |
17064 image2.gif|||||
17065
17066 image3|
17067 image4 |300px| centre
17068 image5.svg| http://///////
17069 [[x|xx]]]]
17070 * image6
17071 </gallery>
17072 !! html
17073 <ul class="gallery mw-gallery-traditional">
17074 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17075 <div class="thumb" style="height: 150px;">Image1.png</div>
17076 <div class="gallerytext">
17077 </div>
17078 </div></li>
17079 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17080 <div class="thumb" style="height: 150px;">Image2.gif</div>
17081 <div class="gallerytext">
17082 <p>||||
17083 </p>
17084 </div>
17085 </div></li>
17086 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17087 <div class="thumb" style="height: 150px;">Image3</div>
17088 <div class="gallerytext">
17089 </div>
17090 </div></li>
17091 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17092 <div class="thumb" style="height: 150px;">Image4</div>
17093 <div class="gallerytext">
17094 <p>300px| centre
17095 </p>
17096 </div>
17097 </div></li>
17098 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17099 <div class="thumb" style="height: 150px;">Image5.svg</div>
17100 <div class="gallerytext">
17101 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
17102 </p>
17103 </div>
17104 </div></li>
17105 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17106 <div class="thumb" style="height: 150px;">* image6</div>
17107 <div class="gallerytext">
17108 </div>
17109 </div></li>
17110 </ul>
17111
17112 !! end
17113
17114 !! test
17115 Gallery (with options)
17116 !! wikitext
17117 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
17118 File:Nonexistent.jpg|caption
17119 File:Nonexistent.jpg
17120 image:foobar.jpg|some '''caption''' [[Main Page]]
17121 image:foobar.jpg
17122 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
17123 </gallery>
17124 !! html
17125 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
17126 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
17127 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17128 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
17129 <div class="gallerytext">
17130 <p>caption
17131 </p>
17132 </div>
17133 </div></li>
17134 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17135 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
17136 <div class="gallerytext">
17137 </div>
17138 </div></li>
17139 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17140 <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>
17141 <div class="gallerytext">
17142 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
17143 </p>
17144 </div>
17145 </div></li>
17146 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17147 <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>
17148 <div class="gallerytext">
17149 </div>
17150 </div></li>
17151 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17152 <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>
17153 <div class="gallerytext">
17154 <p>Blabla|blabla.
17155 </p>
17156 </div>
17157 </div></li>
17158 </ul>
17159
17160 !! end
17161
17162 !! test
17163 Gallery with link that has fragment
17164 !! wikitext
17165 <gallery>
17166 image:foobar.jpg|link=Main_Page
17167 image:foobar.jpg|link=Main_Page#section
17168 image:foobar.jpg|link=Main Page#section|caption
17169 </gallery>
17170 !! html
17171 <ul class="gallery mw-gallery-traditional">
17172 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17173 <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>
17174 <div class="gallerytext">
17175 </div>
17176 </div></li>
17177 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17178 <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>
17179 <div class="gallerytext">
17180 </div>
17181 </div></li>
17182 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17183 <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>
17184 <div class="gallerytext">
17185 <p>caption
17186 </p>
17187 </div>
17188 </div></li>
17189 </ul>
17190
17191 !! end
17192
17193 !! test
17194 Gallery with wikitext inside caption
17195 !! wikitext
17196 <gallery>
17197 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
17198 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
17199 </gallery>
17200 !! html
17201 <ul class="gallery mw-gallery-traditional">
17202 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17203 <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>
17204 <div class="gallerytext">
17205 <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>
17206 </p>
17207 </div>
17208 </div></li>
17209 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17210 <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>
17211 <div class="gallerytext">
17212 <p>This is a test template
17213 </p>
17214 </div>
17215 </div></li>
17216 </ul>
17217
17218 !! end
17219
17220 !! test
17221 gallery (with showfilename option)
17222 !! wikitext
17223 <gallery showfilename>
17224 File:Nonexistent.jpg|caption
17225 File:Nonexistent.jpg
17226 image:foobar.jpg|some '''caption''' [[Main Page]]
17227 File:Foobar.jpg
17228 </gallery>
17229 !! html
17230 <ul class="gallery mw-gallery-traditional">
17231 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17232 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
17233 <div class="gallerytext">
17234 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
17235 caption
17236 </p>
17237 </div>
17238 </div></li>
17239 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17240 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
17241 <div class="gallerytext">
17242 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
17243 </p>
17244 </div>
17245 </div></li>
17246 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17247 <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>
17248 <div class="gallerytext">
17249 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
17250 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
17251 </p>
17252 </div>
17253 </div></li>
17254 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17255 <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>
17256 <div class="gallerytext">
17257 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
17258 </p>
17259 </div>
17260 </div></li>
17261 </ul>
17262
17263 !! end
17264
17265 !! test
17266 Gallery (with namespace-less filenames)
17267 !! wikitext
17268 <gallery>
17269 File:Nonexistent.jpg
17270 Nonexistent.jpg
17271 image:foobar.jpg
17272 foobar.jpg
17273 </gallery>
17274 !! html
17275 <ul class="gallery mw-gallery-traditional">
17276 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17277 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
17278 <div class="gallerytext">
17279 </div>
17280 </div></li>
17281 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17282 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
17283 <div class="gallerytext">
17284 </div>
17285 </div></li>
17286 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17287 <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>
17288 <div class="gallerytext">
17289 </div>
17290 </div></li>
17291 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17292 <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>
17293 <div class="gallerytext">
17294 </div>
17295 </div></li>
17296 </ul>
17297
17298 !! end
17299
17300 !! test
17301 HTML Hex character encoding (spells the word "JavaScript")
17302 !! options
17303 parsoid=wt2html,wt2wt,html2html
17304 !! wikitext
17305 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
17306 !! html/php
17307 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
17308 </p>
17309 !! html/php+tidy
17310 <p>JavaScript</p>
17311 !! html/parsoid
17312 <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>
17313 !! end
17314
17315 !! test
17316 HTML Hex character encoding bogus encoding (bug 26437 regression check)
17317 !! wikitext
17318 &#xsee;&#XSEE;
17319 !! html/php
17320 <p>&amp;#xsee;&amp;#XSEE;
17321 </p>
17322 !! html/parsoid
17323 <p>&amp;#xsee;&amp;#XSEE;</p>
17324 !! end
17325
17326 !! test
17327 HTML Hex character encoding mixed case
17328 !! options
17329 parsoid=wt2html,wt2wt,html2html
17330 !! wikitext
17331 &#xEE;&#Xee;
17332 !! html/php
17333 <p>&#xee;&#xee;
17334 </p>
17335 !! html/php+tidy
17336 <p>îî</p>
17337 !! html/parsoid
17338 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
17339 !! end
17340
17341 !! test
17342 __FORCETOC__ override
17343 !! wikitext
17344 __NEWSECTIONLINK__
17345 __FORCETOC__
17346 !! html
17347 <p><br />
17348 </p>
17349 !! end
17350
17351 !! test
17352 ISBN code coverage
17353 !! wikitext
17354 ISBN 978-0-1234-56&#x20;789
17355 !! html
17356 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
17357 </p>
17358 !! html+tidy
17359 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
17360 !! html/parsoid
17361 <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>
17362 !! end
17363
17364 !! test
17365 ISBN followed by 5 spaces
17366 !! wikitext
17367 ISBN
17368 !! html
17369 <p>ISBN
17370 </p>
17371 !! end
17372
17373 !! test
17374 Double ISBN
17375 !! wikitext
17376 ISBN ISBN 1234567890
17377 !! html/php
17378 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
17379 </p>
17380 !! html/parsoid
17381 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
17382 !! end
17383
17384 !! test
17385 ISBN with an X
17386 !! wikitext
17387 ISBN 3-462-04561-X
17388 ISBN 080442957X
17389 ISBN 978080442957X
17390 !! html/php
17391 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
17392 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
17393 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
17394 </p>
17395 !! html/parsoid
17396 <p><a href="./Special:BookSources/346204561X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
17397 <a href="./Special:BookSources/080442957X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
17398 <a href="./Special:BookSources/978080442957X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a></p>
17399 !! end
17400
17401 !! test
17402 ISBN with empty prefix (parsoid test)
17403 !! wikitext
17404 ISBN 1234567890
17405 !! html/php
17406 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
17407 </p>
17408 !! html/parsoid
17409 <p><a href="Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567890</a></p>
17410 !! end
17411
17412 !! test
17413 Bug 22905: <abbr> followed by ISBN followed by </a>
17414 !! wikitext
17415 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
17416 !! html/php
17417 <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>
17418 </p>
17419 !! html/parsoid
17420 <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>
17421 !! end
17422
17423 !! test
17424 Double RFC
17425 !! wikitext
17426 RFC RFC 1234
17427 !! html
17428 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
17429 </p>
17430 !! end
17431
17432 !! test
17433 Double RFC with a wiki link
17434 !! wikitext
17435 RFC [[RFC 1234]]
17436 !! html
17437 <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>
17438 </p>
17439 !! end
17440
17441 !! test
17442 RFC code coverage
17443 !! wikitext
17444 RFC 983&#x20;987
17445 !! html
17446 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
17447 </p>
17448 !! html+tidy
17449 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
17450 !! end
17451
17452 !! test
17453 Centre-aligned image
17454 !! wikitext
17455 [[Image:foobar.jpg|centre]]
17456 !! html
17457 <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>
17458
17459 !!end
17460
17461 !! test
17462 None-aligned image
17463 !! wikitext
17464 [[Image:foobar.jpg|none]]
17465 !! html
17466 <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>
17467
17468 !!end
17469
17470 !! test
17471 Width + Height sized image (using px) (height is ignored)
17472 !! wikitext
17473 [[Image:foobar.jpg|640x480px]]
17474 !! html
17475 <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>
17476 </p>
17477 !!end
17478
17479 !! test
17480 Width-sized image (using px, no following whitespace)
17481 !! wikitext
17482 [[Image:foobar.jpg|640px]]
17483 !! html
17484 <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>
17485 </p>
17486 !!end
17487
17488 !! test
17489 Width-sized image (using px, with following whitespace - test regression from r39467)
17490 !! wikitext
17491 [[Image:foobar.jpg|640px ]]
17492 !! html
17493 <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>
17494 </p>
17495 !!end
17496
17497 !! test
17498 Width-sized image (using px, with preceding whitespace - test regression from r39467)
17499 !! wikitext
17500 [[Image:foobar.jpg| 640px]]
17501 !! html
17502 <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>
17503 </p>
17504 !!end
17505
17506 !! test
17507 Image with page parameter
17508 !! options
17509 djvu
17510 !! wikitext
17511 [[File:LoremIpsum.djvu|page=2]]
17512 !! html/php
17513 <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>
17514 </p>
17515 !! html/parsoid
17516 <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>
17517 !! end
17518
17519 !! test
17520 Another italics / bold test
17521 !! wikitext
17522 ''' ''x'
17523 !! html
17524 <pre>'<i> </i>x'
17525 </pre>
17526 !!end
17527
17528 # FIXME: The php output seems broken. It's interleaving some open/close tags.
17529 !! test
17530 dt/dd/dl test
17531 !! wikitext
17532 :;;;::
17533 !! html/php
17534 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
17535
17536 !! html/parsoid
17537 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
17538
17539 !!end
17540
17541
17542 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
17543 !! test
17544 Images with the "|" character in the comment
17545 !! wikitext
17546 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
17547 !! html/php
17548 <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>
17549
17550 !! html/parsoid
17551 <figure class="mw-default-size" typeof="mw:Image/Thumb"><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="25" width="220"/></a><figcaption>An <a rel="mw:ExtLink" href="http://test/?param1=|left|&amp;param2=|x">external</a> URL</figcaption></figure>
17552 !! end
17553
17554 !! test
17555 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
17556 !! wikitext
17557 <html><script>alert(1);</script></html>
17558 !! html
17559 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
17560 </p>
17561 !! end
17562
17563 !! test
17564 HTML with raw HTML ($wgRawHtml==true)
17565 !! options
17566 wgRawHtml=1
17567 !! wikitext
17568 <html><script>alert(1);</script></html>
17569 !! html
17570 <p><script>alert(1);</script>
17571 </p>
17572 !! end
17573
17574 !! test
17575 Parents of subpages, one level up
17576 !! options
17577 subpage title=[[Subpage test/L1/L2/L3]]
17578 !! wikitext
17579 [[../|L2]]
17580 !! html
17581 <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>
17582 </p>
17583 !! end
17584
17585
17586 !! test
17587 Parents of subpages, one level up, not named
17588 !! options
17589 subpage title=[[Subpage test/L1/L2/L3]]
17590 !! wikitext
17591 [[../]]
17592 !! html
17593 <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>
17594 </p>
17595 !! end
17596
17597
17598
17599 !! test
17600 Parents of subpages, two levels up
17601 !! options
17602 subpage title=[[Subpage test/L1/L2/L3]]
17603 !! wikitext
17604 [[../../|L1]]2
17605
17606 [[../../|L1]]l
17607 !! html
17608 <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
17609 </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>
17610 </p>
17611 !! end
17612
17613 !! test
17614 Parents of subpages, two levels up, without trailing slash or name.
17615 !! options
17616 subpage title=[[Subpage test/L1/L2/L3]]
17617 !! wikitext
17618 [[../..]]
17619 !! html
17620 <p>[[../..]]
17621 </p>
17622 !! end
17623
17624 !! test
17625 Parents of subpages, two levels up, with lots of extra trailing slashes.
17626 !! options
17627 subpage title=[[Subpage test/L1/L2/L3]]
17628 !! wikitext
17629 [[../../////]]
17630 !! html
17631 <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>
17632 </p>
17633 !! end
17634
17635 !! article
17636 Subpage test/L1/L2/L3Sibling
17637 !! text
17638 Sibling article
17639 !! endarticle
17640
17641 !! test
17642 Transclusion of a sibling page (one level up)
17643 !! options
17644 subpage title=[[Subpage test/L1/L2/L3]]
17645 !! wikitext
17646 {{../L3Sibling}}
17647 !! html
17648 <p>Sibling article
17649 </p>
17650 !! end
17651
17652 !! test
17653 Transclusion of a child page
17654 !! options
17655 subpage title=[[Subpage test/L1/L2]]
17656 !! wikitext
17657 {{/L3Sibling}}
17658 !! html
17659 <p>Sibling article
17660 </p>
17661 !! end
17662
17663 !! test
17664 Non-transclusion because of too many up levels
17665 !! options
17666 subpage title=[[Subpage test/L1/L2/L3]]
17667 !! wikitext
17668 {{../../../../More than parent}}
17669 !! html
17670 <p>{{../../../../More than parent}}
17671 </p>
17672 !! end
17673
17674 !! test
17675 Definition list code coverage
17676 !! wikitext
17677 ; title : def
17678 ; title : def
17679 ;title: def
17680 !! html/php
17681 <dl><dt> title &#160;</dt>
17682 <dd> def</dd>
17683 <dt> title&#160;</dt>
17684 <dd> def</dd>
17685 <dt>title</dt>
17686 <dd> def</dd></dl>
17687
17688 !! html/parsoid
17689 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
17690 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
17691 <dt>title</dt><dd> def</dd></dl>
17692 !! end
17693
17694 !! test
17695 Don't fall for the self-closing div
17696 !! wikitext
17697 <div>hello world</div/>
17698 !! html
17699 <div>hello world</div>
17700
17701 !! end
17702
17703 !! test
17704 MSGNW magic word
17705 !! wikitext
17706 {{MSGNW:msg}}
17707 !! html
17708 <p>&#91;&#91;:Template:Msg&#93;&#93;
17709 </p>
17710 !! end
17711
17712 !! test
17713 RAW magic word
17714 !! wikitext
17715 {{RAW:QUERTY}}
17716 !! html
17717 <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>
17718 </p>
17719 !! end
17720
17721 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
17722 !! test
17723 Always escape literal '>' in output, not just after '<'
17724 !! wikitext
17725 ><>
17726 !! html
17727 <p>&gt;&lt;&gt;
17728 </p>
17729 !! end
17730
17731 !! test
17732 Template caching
17733 !! wikitext
17734 {{Test}}
17735 {{Test}}
17736 !! html
17737 <p>This is a test template
17738 This is a test template
17739 </p>
17740 !! end
17741
17742
17743 !! article
17744 MediaWiki:Fake
17745 !! text
17746 ==header==
17747 !! endarticle
17748
17749 !! test
17750 Inclusion of !userCanEdit() content
17751 !! wikitext
17752 {{MediaWiki:Fake}}
17753 !! html
17754 <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>
17755
17756 !! end
17757
17758
17759 !! test
17760 Out-of-order TOC heading levels
17761 !! wikitext
17762 ==2==
17763 ======6======
17764 ===3===
17765 =1=
17766 =====5=====
17767 ==2==
17768 !! html
17769 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17770 <ul>
17771 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
17772 <ul>
17773 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
17774 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
17775 </ul>
17776 </li>
17777 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
17778 <ul>
17779 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
17780 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
17781 </ul>
17782 </li>
17783 </ul>
17784 </div>
17785
17786 <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>
17787 <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>
17788 <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>
17789 <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>
17790 <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>
17791 <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>
17792
17793 !! end
17794
17795
17796 !! test
17797 ISBN with a dummy number
17798 !! wikitext
17799 ISBN ---
17800 !! html
17801 <p>ISBN ---
17802 </p>
17803 !! end
17804
17805
17806 !! test
17807 ISBN with space-delimited number
17808 !! wikitext
17809 ISBN 92 9017 032 8
17810 !! html
17811 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
17812 </p>
17813 !! end
17814
17815
17816 !! test
17817 ISBN with multiple spaces, no number
17818 !! wikitext
17819 ISBN foo
17820 !! html
17821 <p>ISBN foo
17822 </p>
17823 !! end
17824
17825
17826 !! test
17827 ISBN length
17828 !! wikitext
17829 ISBN 123456789
17830
17831 ISBN 1234567890
17832
17833 ISBN 12345678901
17834 !! html
17835 <p>ISBN 123456789
17836 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
17837 </p><p>ISBN 12345678901
17838 </p>
17839 !! end
17840
17841
17842 !! test
17843 ISBN with trailing year (bug 8110)
17844 !! wikitext
17845 ISBN 1-234-56789-0 - 2006
17846
17847 ISBN 1 234 56789 0 - 2006
17848 !! html
17849 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
17850 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
17851 </p>
17852 !! end
17853
17854
17855 !! test
17856 anchorencode
17857 !! wikitext
17858 {{anchorencode:foo bar©#%n}}
17859 !! html
17860 <p>foo_bar.C2.A9.23.25n
17861 </p>
17862 !! end
17863
17864 !! test
17865 anchorencode trims spaces
17866 !! wikitext
17867 {{anchorencode: __pretty__please__}}
17868 !! html
17869 <p>pretty_please
17870 </p>
17871 !! end
17872
17873 !! test
17874 anchorencode deals with links
17875 !! wikitext
17876 {{anchorencode: [[hello|world]] [[hi]]}}
17877 !! html
17878 <p>world_hi
17879 </p>
17880 !! end
17881
17882 !! test
17883 anchorencode deals with templates
17884 !! wikitext
17885 {{anchorencode: {{Foo}} }}
17886 !! html
17887 <p>FOO
17888 </p>
17889 !! end
17890
17891 !! test
17892 anchorencode encodes like the TOC generator: (bug 18431)
17893 !! wikitext
17894 === _ +:.3A%3A&&amp;]] ===
17895 {{anchorencode: _ +:.3A%3A&&amp;]] }}
17896 __NOEDITSECTION__
17897 !! html
17898 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
17899 <p>.2B:.3A.253A.26.26.5D.5D
17900 </p>
17901 !! end
17902
17903 !! test
17904 Bug 6200: blockquotes and paragraph formatting
17905 !! wikitext
17906 <blockquote>
17907 foo
17908 </blockquote>
17909
17910 bar
17911
17912 baz
17913 !! html
17914 <blockquote>
17915 <p>foo
17916 </p>
17917 </blockquote>
17918 <p>bar
17919 </p>
17920 <pre>baz
17921 </pre>
17922 !! end
17923
17924 !! test
17925 Bug 8293: Use of center tag ruins paragraph formatting
17926 !! wikitext
17927 <center>
17928 foo
17929 </center>
17930
17931 bar
17932
17933 baz
17934 !! html
17935 <center>
17936 <p>foo
17937 </p>
17938 </center>
17939 <p>bar
17940 </p>
17941 <pre>baz
17942 </pre>
17943 !! end
17944
17945 !!test
17946 Parsing of overlapping (improperly nested) inline html tags
17947 !! wikitext
17948 <span><s>x</span></s>
17949 !! html/php
17950 <p><span><s>x&lt;/span&gt;</s></span>
17951 </p>
17952 !! html/parsoid
17953 <p><span><s>x</s></span>
17954 </p>
17955 !!end
17956
17957 ###
17958 ### Language variants related tests
17959 ###
17960 !! test
17961 Self-link in language variants
17962 !! options
17963 title=[[Dunav]] language=sr
17964 !! wikitext
17965 Both [[Dunav]] and [[Дунав]] are names for this river.
17966 !! html
17967 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
17968 </p>
17969 !!end
17970
17971 !! article
17972 Дуна
17973 !! text
17974 content
17975 !! endarticle
17976
17977 !! test
17978 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
17979 !! options
17980 title=[[Duna]] language=sr
17981 !! wikitext
17982 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
17983 !! html
17984 <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.
17985 </p>
17986 !! end
17987
17988 !! test
17989 Link to a section of a variant of this title shouldn't be parsed as self-link
17990 !! options
17991 title=[[Duna]] language=sr
17992 !! wikitext
17993 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
17994 !! html
17995 <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.
17996 </p>
17997 !! end
17998
17999 !! test
18000 Link to pages in language variants
18001 !! options
18002 language=sr
18003 !! wikitext
18004 Main Page can be written as [[Маин Паге]]
18005 !! html
18006 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
18007 </p>
18008 !!end
18009
18010
18011 !! test
18012 Multiple links to pages in language variants
18013 !! options
18014 language=sr
18015 !! wikitext
18016 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
18017 !! html
18018 <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>.
18019 </p>
18020 !!end
18021
18022
18023 !! test
18024 Simple template in language variants
18025 !! options
18026 language=sr
18027 !! wikitext
18028 {{тест}}
18029 !! html
18030 <p>This is a test template
18031 </p>
18032 !! end
18033
18034
18035 !! test
18036 Template with explicit namespace in language variants
18037 !! options
18038 language=sr
18039 !! wikitext
18040 {{Template:тест}}
18041 !! html
18042 <p>This is a test template
18043 </p>
18044 !! end
18045
18046
18047 !! test
18048 Basic test for template parameter in language variants
18049 !! options
18050 language=sr
18051 !! wikitext
18052 {{парамтест|param=foo}}
18053 !! html
18054 <p>This is a test template with parameter foo
18055 </p>
18056 !! end
18057
18058
18059 !! test
18060 Simple category in language variants
18061 !! options
18062 language=sr cat
18063 !! wikitext
18064 [[Category:МедиаWики Усер'с Гуиде]]
18065 !! html
18066 <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>
18067 !! end
18068
18069
18070 !! article
18071 Category:分类
18072 !! text
18073 blah
18074 !! endarticle
18075
18076 !! article
18077 Category:分類
18078 !! text
18079 blah
18080 !! endarticle
18081
18082 !! test
18083 Don't convert blue categorylinks to another variant (bug 33210)
18084 !! options
18085 language=zh cat
18086 !! wikitext
18087 [[A]][[Category:分类]]
18088 !! html
18089 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
18090 !! end
18091
18092
18093 !! test
18094 Stripping -{}- tags (language variants)
18095 !! options
18096 language=sr
18097 !! wikitext
18098 Latin proverb: -{Ne nuntium necare}-
18099 !! html
18100 <p>Latin proverb: Ne nuntium necare
18101 </p>
18102 !! end
18103
18104
18105 !! test
18106 Prevent conversion with -{}- tags (language variants)
18107 !! options
18108 language=sr variant=sr-ec
18109 !! wikitext
18110 Latinski: -{Ne nuntium necare}-
18111 !! html
18112 <p>Латински: Ne nuntium necare
18113 </p>
18114 !! end
18115
18116
18117 !! test
18118 Prevent conversion of text with -{}- tags (language variants)
18119 !! options
18120 language=sr variant=sr-ec
18121 !! wikitext
18122 Latinski: -{Ne nuntium necare}-
18123 !! html
18124 <p>Латински: Ne nuntium necare
18125 </p>
18126 !! end
18127
18128
18129 !! test
18130 Prevent conversion of links with -{}- tags (language variants)
18131 !! options
18132 language=sr variant=sr-ec
18133 !! wikitext
18134 -{[[Main Page]]}-
18135 !! html
18136 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18137 </p>
18138 !! end
18139
18140
18141 !! test
18142 -{}- tags within headlines (within html for parserConvert())
18143 !! options
18144 language=sr variant=sr-ec
18145 !! wikitext
18146 == -{Naslov}- ==
18147 !! html
18148 <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>
18149
18150 !! end
18151
18152
18153 !! test
18154 Explicit definition of language variant alternatives
18155 !! options
18156 language=zh variant=zh-tw
18157 !! wikitext
18158 -{zh:China;zh-tw:Taiwan}-, not China
18159 !! html
18160 <p>Taiwan, not China
18161 </p>
18162 !! end
18163
18164
18165 !! test
18166 Conversion around HTML tags
18167 !! options
18168 language=sr variant=sr-ec
18169 !! wikitext
18170 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
18171 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
18172 !! html
18173 <p>
18174 <span title="ЛаCтин">ски</span>
18175 </p>
18176 !! end
18177
18178
18179 !! test
18180 Explicit session-wise language variant mapping (A flag and - flag)
18181 !! options
18182 language=zh variant=zh-tw
18183 !! wikitext
18184 Taiwan is not China.
18185 But -{A|zh:China;zh-tw:Taiwan}- is China,
18186 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
18187 and -{China}- is China.
18188 !! html
18189 <p>Taiwan is not China.
18190 But Taiwan is Taiwan,
18191 (This should be stripped!)
18192 and China is China.
18193 </p>
18194 !! end
18195
18196 !! test
18197 Explicit session-wise language variant mapping (H flag for hide)
18198 !! options
18199 language=zh variant=zh-tw
18200 !! wikitext
18201 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
18202 Taiwan is China.
18203 !! html
18204 <p>(This should be stripped!)
18205 Taiwan is Taiwan.
18206 </p>
18207 !! end
18208
18209 !! test
18210 Adding explicit conversion rule for title (T flag)
18211 !! options
18212 language=zh variant=zh-tw showtitle
18213 !! wikitext
18214 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
18215 !! html
18216 Taiwan
18217 <p>Should be stripped!
18218 </p>
18219 !! end
18220
18221 !! test
18222 Testing that changing the language variant here in the tests actually works
18223 !! options
18224 language=zh variant=zh showtitle
18225 !! wikitext
18226 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
18227 !! html
18228 China
18229 <p>Should be stripped!
18230 </p>
18231 !! end
18232
18233 !! test
18234 Recursive conversion of alt and title attrs shouldn't clear converter state
18235 !! options
18236 language=zh variant=zh-cn showtitle
18237 !! wikitext
18238 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
18239 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
18240 !! html
18241 China
18242 <p>
18243 Should be stripped<span title="Exclamation">!</span>
18244 </p>
18245 !! end
18246
18247 !! test
18248 Bug 24072: more test on conversion rule for title
18249 !! options
18250 language=zh variant=zh-tw showtitle
18251 !! wikitext
18252 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
18253 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
18254 !! html
18255 Taiwan
18256 <p>This should be stripped!
18257 This won't take interferes with the title rule.
18258 </p>
18259 !! end
18260
18261 !! test
18262 Partly disable title conversion if variant == main language code
18263 !! options
18264 language=zh variant=zh title=[[ZH]] showtitle
18265 !! wikitext
18266 -{T|zh-cn:CN;zh-tw:TW}-
18267 !! html
18268 ZH
18269 <p>
18270 </p>
18271 !! end
18272
18273 !! test
18274 Partly disable title conversion if variant == main language code, more
18275 !! options
18276 language=zh variant=zh title=[[ZH]] showtitle
18277 !! wikitext
18278 -{T|TW}-
18279 !! html
18280 ZH
18281 <p>
18282 </p>
18283 !! end
18284
18285 !! test
18286 Raw output of variant escape tags (R flag)
18287 !! options
18288 language=zh variant=zh-tw
18289 !! wikitext
18290 Raw: -{R|zh:China;zh-tw:Taiwan}-
18291 !! html
18292 <p>Raw: zh:China;zh-tw:Taiwan
18293 </p>
18294 !! end
18295
18296 !! test
18297 Nested using of manual convert syntax
18298 !! options
18299 language=zh variant=zh-hk
18300 !! wikitext
18301 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
18302 !! html
18303 <p>Nested: Hello Hong Kong!
18304 </p>
18305 !! end
18306
18307 !! test
18308 Proper conversion of text in external links
18309 !! options
18310 language=sr variant=sr-ec
18311 !! wikitext
18312 http://www.google.com
18313 gopher://www.google.com
18314 [http://www.google.com http://www.google.com]
18315 [gopher://www.google.com gopher://www.google.com]
18316 [https://www.google.com irc://www.google.com]
18317 [ftp://www.google.com www.google.com/ftp://dir]
18318 [//www.google.com www.google.com]
18319 !! html
18320 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
18321 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
18322 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
18323 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
18324 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
18325 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
18326 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
18327 </p>
18328 !! end
18329
18330 !! test
18331 Do not convert roman numbers to language variants
18332 !! options
18333 language=sr variant=sr-ec
18334 !! wikitext
18335 Fridrih IV je car.
18336 !! html
18337 <p>Фридрих IV је цар.
18338 </p>
18339 !! end
18340
18341 !! test
18342 Unclosed language converter markup "-{"
18343 !! options
18344 language=sr
18345 !! wikitext
18346 -{T|hello
18347 !! html
18348 <p>-{T|hello
18349 </p>
18350 !! end
18351
18352 !! test
18353 Don't convert raw rule "-{R|=&gt;}-" to "=>"
18354 !! options
18355 language=sr
18356 !! wikitext
18357 -{R|=&gt;}-
18358 !! html
18359 <p>=&gt;
18360 </p>
18361 !!end
18362
18363 !! test
18364 Don't break link parsing if language converter markup is in the caption.
18365 !! options
18366 language=sr variant=sr-ec
18367 !! wikitext
18368 [[Main Page|-{R|main page}-]]
18369 !! html
18370 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
18371 </p>
18372 !! end
18373
18374 # FIXME: This test is currently broken in the PHP parser (bug 52661)
18375 !! test
18376 Don't break image parsing if language converter markup is in the caption.
18377 !! options
18378 language=sr
18379 !! wikitext
18380 [[File:Foobar.jpg|-{R|caption}-]]
18381 !! html/parsoid
18382 <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>
18383 </p>
18384 !! end
18385
18386 # FIXME: This test is currently broken in the PHP parser (bug 52661)
18387 !! test
18388 Don't break list handling if language converter markup is in the item.
18389 !! options
18390 language=zh variant=zh-cn
18391 !! wikitext
18392 ;-{zh-cn:AAA;zh-tw:BBB}-
18393 !! html/php
18394 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
18395
18396 !! html/parsoid
18397 <dl><dt>AAA
18398 </dt></dl>
18399 !! end
18400
18401 # FIXME: This test is currently broken in the PHP parser (bug 52661)
18402 !! test
18403 Don't break table handling if language converter markup is in the cell.
18404 !! options
18405 language=sr variant=sr-ec
18406 !! wikitext
18407 {|
18408 |-
18409 | -{R|B}-
18410 |}
18411 !! html/php
18412 <table>
18413
18414 <tr>
18415 <td>Б}-
18416 </td></tr></table>
18417
18418 !! html/parsoid
18419 <table>
18420
18421 <tr>
18422 <td> B
18423 </td></tr></table>
18424
18425 !! end
18426
18427 !! test
18428 Bug 529: Uncovered bullet
18429 !! wikitext
18430 * Foo {{bullet}}
18431 !! html
18432 <ul><li> Foo </li>
18433 <li> Bar</li></ul>
18434
18435 !! end
18436
18437 # Plain MediaWiki does not remove empty lists, but tidy actually does.
18438 # Templates in Wikipedia rely on this behavior, as tidy has always been
18439 # enabled there. These tests are normally run *without* tidy, so specify the
18440 # full output here.
18441 # To test realistic parsing behavior, apply a tidy-like transformation to both
18442 # the expected output and your parser's output.
18443 !! test
18444 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
18445 !! wikitext
18446 ******* Foo {{bullet}}
18447 !! html
18448 <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>
18449 <li> Bar</li></ul>
18450
18451 !! end
18452
18453 !! test
18454 Bug 529: Uncovered table already at line-start
18455 !! wikitext
18456 x
18457
18458 {{table}}
18459 y
18460 !! html
18461 <p>x
18462 </p>
18463 <table>
18464 <tr>
18465 <td> 1 </td>
18466 <td> 2
18467 </td></tr>
18468 <tr>
18469 <td> 3 </td>
18470 <td> 4
18471 </td></tr></table>
18472 <p>y
18473 </p>
18474 !! end
18475
18476 !! test
18477 Bug 529: Uncovered bullet in parser function result
18478 !! wikitext
18479 * Foo {{lc:{{bullet}} }}
18480 !! html
18481 <ul><li> Foo </li>
18482 <li> bar</li></ul>
18483
18484 !! end
18485
18486 !! test
18487 Bug 5678: Double-parsed template argument
18488 !! wikitext
18489 {{lc:{{{1}}}|hello}}
18490 !! html
18491 <p>{{{1}}}
18492 </p>
18493 !! end
18494
18495 !! test
18496 Bug 5678: Double-parsed template invocation
18497 !! wikitext
18498 {{lc:{{paramtest {{!}} param = hello }} }}
18499 !! html
18500 <p>{{paramtest | param = hello }}
18501 </p>
18502 !! end
18503
18504 !! test
18505 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
18506 !! options
18507 language=cs
18508 title=[[Main Page]]
18509 !! wikitext
18510 {{PRVNÍVELKÉ:ěščř}}
18511 {{prvnívelké:ěščř}}
18512 {{PRVNÍMALÉ:ěščř}}
18513 {{prvnímalé:ěščř}}
18514 {{MALÁ:ěščř}}
18515 {{malá:ěščř}}
18516 {{VELKÁ:ěščř}}
18517 {{velká:ěščř}}
18518 !! html
18519 <p>Ěščř
18520 Ěščř
18521 ěščř
18522 ěščř
18523 ěščř
18524 ěščř
18525 ĚŠČŘ
18526 ĚŠČŘ
18527 </p>
18528 !! end
18529
18530 !! test
18531 Morwen/13: Unclosed link followed by heading
18532 !! wikitext
18533 [[link
18534 ==heading==
18535 !! html
18536 <p>[[link
18537 </p>
18538 <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>
18539
18540 !! end
18541
18542 !! test
18543 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
18544 !! wikitext
18545 {{foo|
18546 =heading=
18547 !! html
18548 <p>{{foo|
18549 </p>
18550 <h1><span class="mw-headline" id="heading">heading</span></h1>
18551
18552 !! end
18553
18554 !! test
18555 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
18556 !! wikitext
18557 {{foo|
18558 ==heading==
18559 !! html
18560 <p>{{foo|
18561 </p>
18562 <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>
18563
18564 !! end
18565
18566 !! test
18567 Tildes in comments
18568 !! options
18569 pst
18570 !! wikitext
18571 <!-- ~~~~ -->
18572 !! html
18573 <!-- ~~~~ -->
18574 !! end
18575
18576 !! test
18577 Paragraphs inside divs (no extra line breaks)
18578 !! wikitext
18579 <div>Line one
18580
18581 Line two</div>
18582 !! html
18583 <div>Line one
18584 Line two</div>
18585
18586 !! end
18587
18588 !! test
18589 Paragraphs inside divs (extra line break on open)
18590 !! wikitext
18591 <div>
18592 Line one
18593
18594 Line two</div>
18595 !! html
18596 <div>
18597 <p>Line one
18598 </p>
18599 Line two</div>
18600
18601 !! end
18602
18603 !! test
18604 Paragraphs inside divs (extra line break on close)
18605 !! wikitext
18606 <div>Line one
18607
18608 Line two
18609 </div>
18610 !! html
18611 <div>Line one
18612 <p>Line two
18613 </p>
18614 </div>
18615
18616 !! end
18617
18618 !! test
18619 Paragraphs inside divs (extra line break on open and close)
18620 !! wikitext
18621 <div>
18622 Line one
18623
18624 Line two
18625 </div>
18626 !! html
18627 <div>
18628 <p>Line one
18629 </p><p>Line two
18630 </p>
18631 </div>
18632
18633 !! end
18634
18635 !! test
18636 Nesting tags, paragraphs on lines which begin with <div>
18637 !! wikitext
18638 <div></div><strong>A
18639 B</strong>
18640 !! html/php+tidy
18641 <p><strong>A</strong></p>
18642 <p><strong>B</strong></p>
18643 !! html/parsoid
18644 <div></div>
18645 <p><strong>A
18646 B</strong>
18647 </p>
18648 !! end
18649
18650 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
18651 !! test
18652 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
18653 !! wikitext
18654 <blockquote>Line one
18655
18656 Line two</blockquote>
18657 !! html
18658 <blockquote>Line one
18659 Line two</blockquote>
18660
18661 !! html+tidy
18662 <blockquote>
18663 <p>Line one Line two</p>
18664 </blockquote>
18665 !! end
18666
18667 !! test
18668 Bug 6200: paragraphs inside blockquotes (extra line break on open)
18669 !! wikitext
18670 <blockquote>
18671 Line one
18672
18673 Line two</blockquote>
18674 !! html
18675 <blockquote>
18676 <p>Line one
18677 </p>
18678 Line two</blockquote>
18679
18680 !! html+tidy
18681 <blockquote>
18682 <p>Line one</p>
18683 Line two</blockquote>
18684 !! end
18685
18686 !! test
18687 Bug 6200: paragraphs inside blockquotes (extra line break on close)
18688 !! wikitext
18689 <blockquote>Line one
18690
18691 Line two
18692 </blockquote>
18693 !! html
18694 <blockquote>Line one
18695 <p>Line two
18696 </p>
18697 </blockquote>
18698
18699 !! html+tidy
18700 <blockquote>
18701 <p>Line one</p>
18702 <p>Line two</p>
18703 </blockquote>
18704 !! end
18705
18706 !! test
18707 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
18708 !! wikitext
18709 <blockquote>
18710 Line one
18711
18712 Line two
18713 </blockquote>
18714 !! html
18715 <blockquote>
18716 <p>Line one
18717 </p><p>Line two
18718 </p>
18719 </blockquote>
18720
18721 !! html+tidy
18722 <blockquote>
18723 <p>Line one</p>
18724 <p>Line two</p>
18725 </blockquote>
18726 !! end
18727
18728 !! test
18729 Paragraphs inside blockquotes/divs (no extra line breaks)
18730 !! wikitext
18731 <blockquote><div>Line one
18732
18733 Line two</div></blockquote>
18734 !! html
18735 <blockquote><div>Line one
18736 Line two</div></blockquote>
18737
18738 !! end
18739
18740 !! test
18741 Paragraphs inside blockquotes/divs (extra line break on open)
18742 !! wikitext
18743 <blockquote><div>
18744 Line one
18745
18746 Line two</div></blockquote>
18747 !! html
18748 <blockquote><div>
18749 <p>Line one
18750 </p>
18751 Line two</div></blockquote>
18752
18753 !! end
18754
18755 !! test
18756 Paragraphs inside blockquotes/divs (extra line break on close)
18757 !! wikitext
18758 <blockquote><div>Line one
18759
18760 Line two
18761 </div></blockquote>
18762 !! html
18763 <blockquote><div>Line one
18764 <p>Line two
18765 </p>
18766 </div></blockquote>
18767
18768 !! end
18769
18770 !! test
18771 Paragraphs inside blockquotes/divs (extra line break on open and close)
18772 !! wikitext
18773 <blockquote><div>
18774 Line one
18775
18776 Line two
18777 </div></blockquote>
18778 !! html
18779 <blockquote><div>
18780 <p>Line one
18781 </p><p>Line two
18782 </p>
18783 </div></blockquote>
18784
18785 !! end
18786
18787 !! test
18788 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
18789 !! options
18790 wgLinkHolderBatchSize=0
18791 !! wikitext
18792 [[meatball:1]]
18793 [[meatball:2]]
18794 [[meatball:3]]
18795 !! html
18796 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
18797 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
18798 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
18799 </p>
18800 !! end
18801
18802 !! test
18803 Free external link invading image caption
18804 !! wikitext
18805 [[Image:Foobar.jpg|thumb|http://x|hello]]
18806 !! html
18807 <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>
18808
18809 !! end
18810
18811 !! test
18812 Bug 15196: localised external link numbers
18813 !! options
18814 language=fa
18815 !! wikitext
18816 [http://en.wikipedia.org/]
18817 !! html/php
18818 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
18819 </p>
18820 !! html/parsoid
18821 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
18822 !! end
18823
18824 !! test
18825 Multibyte character in padleft
18826 !! wikitext
18827 {{padleft:-Hello|7|Æ}}
18828 !! html
18829 <p>Æ-Hello
18830 </p>
18831 !! end
18832
18833 !! test
18834 Multibyte character in padright
18835 !! wikitext
18836 {{padright:Hello-|7|Æ}}
18837 !! html
18838 <p>Hello-Æ
18839 </p>
18840 !! end
18841
18842 !!test
18843 formatdate parser function
18844 !! wikitext
18845 {{#formatdate:2009-03-24}}
18846 !! html
18847 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
18848 </p>
18849 !! end
18850
18851 !!test
18852 formatdate parser function, with default format
18853 !! wikitext
18854 {{#formatdate:2009-03-24|mdy}}
18855 !! html
18856 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
18857 </p>
18858 !! end
18859
18860 !! test
18861 Spacing of numbers in formatted dates
18862 !! wikitext
18863 {{#formatdate:January 15}}
18864 !! html
18865 <p><span class="mw-formatted-date" title="01-15">January 15</span>
18866 </p>
18867 !! end
18868
18869 !! test
18870 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
18871 !! options
18872 language=nl title=[[MediaWiki:Common.css]]
18873 !! wikitext
18874 {{#formatdate:2009-03-24|dmy}}
18875 !! html
18876 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
18877 </p>
18878 !! end
18879
18880 #
18881 #
18882 #
18883
18884 #
18885 # Edit comments
18886 #
18887
18888 !! test
18889 Edit comment with link
18890 !! options
18891 comment
18892 !! wikitext
18893 I like the [[Main Page]] a lot
18894 !! html
18895 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
18896 !!end
18897
18898 !! test
18899 Edit comment with link and link text
18900 !! options
18901 comment
18902 !! wikitext
18903 I like the [[Main Page|best pages]] a lot
18904 !! html
18905 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
18906 !!end
18907
18908 !! test
18909 Edit comment with link and link text with suffix
18910 !! options
18911 comment
18912 !! wikitext
18913 I like the [[Main Page|best page]]s a lot
18914 !! html
18915 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
18916 !!end
18917
18918 !! test
18919 Edit comment with section link (non-local, eg in history list)
18920 !! options
18921 comment title=[[Main Page]]
18922 !! wikitext
18923 /* External links */ removed bogus entries
18924 !! html
18925 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
18926 !!end
18927
18928 !! test
18929 Edit comment with section link and text before it (non-local, eg in history list)
18930 !! options
18931 comment title=[[Main Page]]
18932 !! wikitext
18933 pre-comment text /* External links */ removed bogus entries
18934 !! html
18935 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>
18936 !!end
18937
18938 !! test
18939 Edit comment with section link (local, eg in diff view)
18940 !! options
18941 comment local title=[[Main Page]]
18942 !! wikitext
18943 /* External links */ removed bogus entries
18944 !! html
18945 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
18946 !!end
18947
18948 !! test
18949 Edit comment with subpage link (bug 14080)
18950 !! options
18951 comment
18952 subpage
18953 title=[[Subpage test]]
18954 !! wikitext
18955 Poked at a [[/subpage]] here...
18956 !! html
18957 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
18958 !!end
18959
18960 !! test
18961 Edit comment with subpage link and link text (bug 14080)
18962 !! options
18963 comment
18964 subpage
18965 title=[[Subpage test]]
18966 !! wikitext
18967 Poked at a [[/subpage|neat little page]] here...
18968 !! html
18969 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
18970 !!end
18971
18972 !! test
18973 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
18974 !! options
18975 comment
18976 title=[[Subpage test]]
18977 !! wikitext
18978 Poked at a [[/subpage]] here...
18979 !! html
18980 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...
18981 !!end
18982
18983 !! test
18984 Edit comment with bare anchor link (local, as on diff)
18985 !! options
18986 comment
18987 local
18988 title=[[Main Page]]
18989 !! wikitext
18990 [[#section]]
18991 !! html
18992 <a href="#section">#section</a>
18993 !! end
18994
18995 !! test
18996 Edit comment with bare anchor link (non-local, as on history)
18997 !! options
18998 comment
18999 title=[[Main Page]]
19000 !! wikitext
19001 [[#section]]
19002 !! html
19003 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
19004 !! end
19005
19006 !! test
19007 Anchor starting with underscore
19008 !! wikitext
19009 [[#_ref|One]]
19010 !! html
19011 <p><a href="#_ref">One</a>
19012 </p>
19013 !! end
19014
19015 !! test
19016 Id starting with underscore
19017 !! wikitext
19018 <div id="_ref"></div>
19019 !! html
19020 <div id="_ref"></div>
19021
19022 !! end
19023
19024 !! test
19025 Space normalisation on autocomment (bug 22784)
19026 !! options
19027 comment
19028 title=[[Main Page]]
19029 !! wikitext
19030 /* __hello__world__ */
19031 !! html
19032 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
19033 !! end
19034
19035 !! test
19036 percent-encoding and + signs in comments (Bug 26410)
19037 !! options
19038 comment
19039 !! wikitext
19040 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
19041 !! html
19042 <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>
19043 !! end
19044
19045 # Parsoid doesn't support this yet: see bug 73581
19046 # but it *should* omit the 'src' attribute if the image is bad.
19047 # PHP side of tests was disabled in
19048 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
19049 # because of issues in the PHP parserTests infrastructure
19050 # (but the output below is indeed what the PHP side emits)
19051 !! test
19052 Bad images - basic functionality
19053 !! wikitext
19054 [[File:Bad.jpg]]
19055 !! DISABLED/html/php
19056 !! html/parsoid
19057 <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>
19058 !! end
19059
19060 !! test
19061 Bad images - bug 16039: text after bad image disappears
19062 !! wikitext
19063 Foo bar
19064 [[File:Bad.jpg]]
19065 Bar foo
19066 !! DISABLED/html/php
19067 <p>Foo bar
19068 </p><p>Bar foo
19069 </p>
19070 !! html/parsoid
19071 <p>Foo bar
19072 <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>
19073 Bar foo</p>
19074 !! end
19075
19076 !! test
19077 Verify that displaytitle works (bug #22501) no displaytitle
19078 !! options
19079 showtitle
19080 !! config
19081 wgAllowDisplayTitle=true
19082 wgRestrictDisplayTitle=false
19083 !! wikitext
19084 this is not the the title
19085 !! html
19086 Parser test
19087 <p>this is not the the title
19088 </p>
19089 !! end
19090
19091 !! test
19092 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
19093 !! options
19094 showtitle
19095 title=[[Screen]]
19096 !! config
19097 wgAllowDisplayTitle=true
19098 wgRestrictDisplayTitle=false
19099 !! wikitext
19100 this is not the the title
19101 {{DISPLAYTITLE:whatever}}
19102 !! html
19103 whatever
19104 <p>this is not the the title
19105 </p>
19106 !! end
19107
19108 !! test
19109 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
19110 !! options
19111 showtitle
19112 title=[[Screen]]
19113 !! config
19114 wgAllowDisplayTitle=true
19115 wgRestrictDisplayTitle=true
19116 !! wikitext
19117 this is not the the title
19118 {{DISPLAYTITLE:whatever}}
19119 !! html
19120 Screen
19121 <p>this is not the the title
19122 </p>
19123 !! end
19124
19125 !! test
19126 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
19127 !! options
19128 showtitle
19129 title=[[Screen]]
19130 !! config
19131 wgAllowDisplayTitle=true
19132 wgRestrictDisplayTitle=true
19133 !! wikitext
19134 this is not the the title
19135 {{DISPLAYTITLE:screen}}
19136 !! html
19137 screen
19138 <p>this is not the the title
19139 </p>
19140 !! end
19141
19142 !! test
19143 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
19144 !! options
19145 showtitle
19146 title=[[Screen]]
19147 !! config
19148 wgAllowDisplayTitle=false
19149 !! wikitext
19150 this is not the the title
19151 {{DISPLAYTITLE:screen}}
19152 !! html
19153 Screen
19154 <p>this is not the the title
19155 <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>
19156 </p>
19157 !! end
19158
19159 !! test
19160 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
19161 !! options
19162 showtitle
19163 title=[[Screen]]
19164 !! config
19165 wgAllowDisplayTitle=false
19166 !! wikitext
19167 this is not the the title
19168 !! html
19169 Screen
19170 <p>this is not the the title
19171 </p>
19172 !! end
19173
19174 !! test
19175 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
19176 !! options
19177 showtitle
19178 title=[[Screen]]
19179 !! config
19180 wgAllowDisplayTitle=true
19181 wgRestrictDisplayTitle=true
19182 !! wikitext
19183 this is not the the title
19184 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
19185 !! html
19186 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
19187 <p>this is not the the title
19188 </p>
19189 !! end
19190
19191 !! test
19192 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
19193 !! options
19194 showtitle
19195 title=[[Screen]]
19196 !! config
19197 wgAllowDisplayTitle=true
19198 wgRestrictDisplayTitle=true
19199 !! wikitext
19200 this is not the the title
19201 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
19202 !! html
19203 <span style="color: red;">s</span>creen
19204 <p>this is not the the title
19205 </p>
19206 !! end
19207
19208 !! test
19209 Page status indicators: Empty name is invalid
19210 !! options
19211 showindicators
19212 !! wikitext
19213 <indicator name=" "></indicator>
19214 <indicator></indicator>
19215 !! html
19216 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
19217 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
19218 </p>
19219 !! end
19220
19221 !! test
19222 Page status indicators: Weird syntaxes that are okay
19223 !! options
19224 showindicators
19225 !! wikitext
19226 <indicator name="empty" />
19227 <indicator name></indicator>
19228 !! html
19229 empty=
19230 name=
19231 <p><br />
19232 </p>
19233 !! end
19234
19235 !! test
19236 Page status indicators: Torture test
19237 !! options
19238 showindicators
19239 !! wikitext
19240 <indicator name="01">hello world</indicator>
19241 <indicator name="02">[[Main Page]]</indicator>
19242 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
19243 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
19244 <indicator name="05">* foo
19245 * bar</indicator>
19246 <indicator name="06"><nowiki>foo</nowiki></indicator>
19247 <indicator name="07"> Preformatted</indicator>
19248 <indicator name="08"><div>Broken tag</indicator>
19249 <indicator name="09">{| class=wikitable
19250 | cell
19251 |}</indicator>
19252 <indicator name="10">Two
19253
19254 paragraphs</indicator>
19255 !! html
19256 01=hello world
19257 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19258 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" />
19259 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>
19260 05=<ul><li> foo</li>
19261 <li> bar</li></ul>
19262
19263 06=foo
19264 07=<pre>Preformatted
19265 </pre>
19266 08=<div>Broken tag</div>
19267
19268 09=<table class="wikitable">
19269 <tr>
19270 <td> cell
19271 </td></tr></table>
19272
19273 10=<p>Two
19274 </p><p>paragraphs
19275 </p>
19276 <p><br />
19277 </p><p><br />
19278 </p><p><br />
19279 </p><p><br />
19280 </p><p><br />
19281 </p>
19282 !! end
19283
19284 !! test
19285 preload: check <noinclude> and <includeonly>
19286 !! options
19287 preload
19288 !! wikitext
19289 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
19290 !! html
19291 Hello kind world.
19292 !! end
19293
19294 !! test
19295 preload: check <onlyinclude>
19296 !! options
19297 preload
19298 !! wikitext
19299 Goodbye <onlyinclude>Hello world</onlyinclude>
19300 !! html
19301 Hello world
19302 !! end
19303
19304 !! test
19305 preload: can pass tags through if we want to
19306 !! options
19307 preload
19308 !! wikitext
19309 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
19310 !! html
19311 <includeonly>Hello world</includeonly>
19312 !! end
19313
19314 !! test
19315 preload: check that it doesn't try to do tricks
19316 !! options
19317 preload
19318 !! wikitext
19319 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
19320 !! html
19321 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
19322 !! end
19323
19324 !! test
19325 Play a bit with r67090 and bug 3158
19326 !! wikitext
19327 <div style="width:50% !important">&nbsp;</div>
19328 <div style="width:50%&nbsp;!important">&nbsp;</div>
19329 <div style="width:50%&#160;!important">&nbsp;</div>
19330 <div style="border : solid;">&nbsp;</div>
19331 !! html/php
19332 <div style="width:50% !important">&#160;</div>
19333 <div style="width:50% !important">&#160;</div>
19334 <div style="width:50% !important">&#160;</div>
19335 <div style="border&#160;: solid;">&#160;</div>
19336
19337 !! html/parsoid
19338 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
19339 <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>
19340 <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>
19341 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
19342
19343 !! end
19344
19345 !! test
19346 HTML5 data attributes
19347 !! wikitext
19348 <span data-foo="bar">Baz</span>
19349 <p data-abc-def_hij="">Quuz</p>
19350 !! html
19351 <p><span data-foo="bar">Baz</span>
19352 </p>
19353 <p data-abc-def_hij="">Quuz</p>
19354
19355 !! end
19356
19357 !! test
19358 percent-encoding and + signs in internal links (Bug 26410)
19359 !! wikitext
19360 [[User:+%]] [[Page+title%]]
19361 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
19362 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
19363 [[%33%45]] [[%33%45+]]
19364 !! html/php
19365 <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>
19366 <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>
19367 <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>
19368 <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>
19369 </p>
19370 !! html/parsoid
19371 <p><a rel="mw:WikiLink" href="User:+%" title="User:+%">User:+%</a> <a rel="mw:WikiLink" href="Page+title%" title="Page+title%">Page+title%</a> <a rel="mw:WikiLink" href="%+" title="%+">%+</a> <a rel="mw:WikiLink" href="%+" title="%+">%20</a> <a rel="mw:WikiLink" href="%+" title="%+">%+ </a> <a rel="mw:WikiLink" href="%+r" title="%+r">%+r</a> <a rel="mw:WikiLink" href="%" title="%">%</a> <a rel="mw:WikiLink" href="+" title="+">+</a> <span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"[[bar]]"}'><a href="./File:%+abc9"><img resource="./File:%25+abc9" src="./Special:FilePath/%+abc9" height="220" width="220"/></a></span> <a rel="mw:WikiLink" href="3E" title="3E">3E</a> <a rel="mw:WikiLink" href="3E+" title="3E+">3E+</a></p>
19372 !! end
19373
19374 !! test
19375 Special characters in embedded file links (bug 27679)
19376 !! wikitext
19377 [[File:Contains & ampersand.jpg]]
19378 [[File:Does not exist.jpg|Title with & ampersand]]
19379 !! html/php
19380 <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>
19381 <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>
19382 </p>
19383 !! html/parsoid
19384 <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>
19385 <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>
19386 !! end
19387
19388 !! test
19389 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
19390 !! wikitext
19391 Text&apos;s been normalized?
19392 !! html
19393 <p>Text&#39;s been normalized?
19394 </p>
19395 !! end
19396
19397 !! test
19398 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
19399 !! wikitext
19400 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
19401 !! html
19402 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
19403 </p>
19404 !! end
19405
19406 !! test
19407 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
19408 !! wikitext
19409 [http://www.example.org/ ideograms]
19410 !! html
19411 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
19412 </p>
19413 !! end
19414
19415 !! test
19416 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
19417 !! wikitext
19418 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
19419 !! html
19420 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
19421 </p>
19422 !! end
19423
19424 !! article
19425 Mediawiki:loop1
19426 !! text
19427 {{Identical|A}}
19428 !! endarticle
19429
19430 !! article
19431 Mediawiki:loop2
19432 !! text
19433 {{Identical|B}}
19434 !! endarticle
19435
19436 !! article
19437 Template:Identical
19438 !! text
19439 {{int:loop1}}
19440 {{int:loop2}}
19441 !! endarticle
19442
19443 !! test
19444 Bug 31098 Template which includes system messages which includes the template
19445 !! wikitext
19446 {{Identical}}
19447 !! html
19448 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
19449 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
19450 </p>
19451 !! end
19452
19453 !! test
19454 Bug31490 Turkish: ucfirst 'blah'
19455 !! options
19456 language=tr
19457 !! wikitext
19458 {{ucfirst:blah}}
19459 !! html
19460 <p>Blah
19461 </p>
19462 !! end
19463
19464 !! test
19465 Bug31490 Turkish: ucfirst 'ix'
19466 !! options
19467 language=tr
19468 !! wikitext
19469 {{ucfirst:ix}}
19470 !! html
19471 <p>İx
19472 </p>
19473 !! end
19474
19475 !! test
19476 Bug31490 Turkish: lcfirst 'BLAH'
19477 !! options
19478 language=tr
19479 !! wikitext
19480 {{lcfirst:BLAH}}
19481 !! html
19482 <p>bLAH
19483 </p>
19484 !! end
19485
19486 !! test
19487 Bug31490 Turkish: ucfırst (with a dotless i)
19488 !! options
19489 language=tr
19490 !! wikitext
19491 {{ucfırst:blah}}
19492 !! html
19493 <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>
19494 </p>
19495 !! end
19496
19497 !! test
19498 Bug31490 ucfırst (with a dotless i) with English language
19499 !! options
19500 language=en
19501 !! wikitext
19502 {{ucfırst:blah}}
19503 !! html
19504 <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>
19505 </p>
19506 !! end
19507
19508 !! test
19509 Bug 26375: TOC with italics
19510 !! options
19511 title=[[Main Page]]
19512 !! wikitext
19513 __TOC__
19514 == ''Lost'' episodes ==
19515 !! html
19516 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19517 <ul>
19518 <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>
19519 </ul>
19520 </div>
19521
19522 <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>
19523
19524 !! end
19525
19526 !! test
19527 Bug 26375: TOC with bold
19528 !! options
19529 title=[[Main Page]]
19530 !! wikitext
19531 __TOC__
19532 == '''should be bold''' then normal text ==
19533 !! html
19534 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19535 <ul>
19536 <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>
19537 </ul>
19538 </div>
19539
19540 <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>
19541
19542 !! end
19543
19544 !! test
19545 Bug 33845: Headings become cursive in TOC when they contain an image
19546 !! options
19547 title=[[Main Page]]
19548 !! wikitext
19549 __TOC__
19550 == Image [[Image:foobar.jpg]] ==
19551 !! html
19552 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19553 <ul>
19554 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
19555 </ul>
19556 </div>
19557
19558 <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>
19559
19560 !! end
19561
19562 !! test
19563 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
19564 !! options
19565 title=[[Main Page]]
19566 !! wikitext
19567 __TOC__
19568 == <blockquote>Quote</blockquote> ==
19569 !! html
19570 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19571 <ul>
19572 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
19573 </ul>
19574 </div>
19575
19576 <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>
19577
19578 !! html+tidy
19579 <p></p>
19580 <div id="toc" class="toc">
19581 <div id="toctitle">
19582 <h2>Contents</h2>
19583 </div>
19584 <ul>
19585 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
19586 </ul>
19587 </div>
19588 <p></p>
19589 <h2><span class="mw-headline" id="Quote"></span></h2>
19590 <blockquote>
19591 <p><span class="mw-headline" id="Quote">Quote</span></p>
19592 </blockquote>
19593 <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>
19594 !! end
19595
19596 !! test
19597 Unclosed tags in TOC
19598 !! options
19599 title=[[Main Page]]
19600 !! wikitext
19601 __TOC__
19602 == Proof: 2 < 3 ==
19603 <small>Hanc marginis exiguitas non caperet.</small>
19604 QED
19605 !! html
19606 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19607 <ul>
19608 <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>
19609 </ul>
19610 </div>
19611
19612 <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>
19613 <p><small>Hanc marginis exiguitas non caperet.</small>
19614 QED
19615 </p>
19616 !! end
19617
19618 !! test
19619 Multiple tags in TOC
19620 !! wikitext
19621 __TOC__
19622 == <i>Foo</i> <b>Bar</b> ==
19623
19624 == <i>Foo</i> <blockquote>Bar</blockquote> ==
19625 !! html
19626 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19627 <ul>
19628 <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>
19629 <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>
19630 </ul>
19631 </div>
19632
19633 <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>
19634 <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>
19635
19636 !! html+tidy
19637 <p></p>
19638 <div id="toc" class="toc">
19639 <div id="toctitle">
19640 <h2>Contents</h2>
19641 </div>
19642 <ul>
19643 <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>
19644 <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>
19645 </ul>
19646 </div>
19647 <p></p>
19648 <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>
19649 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
19650 <blockquote>
19651 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
19652 </blockquote>
19653 <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>
19654 !! end
19655
19656 !! test
19657 Tags with parameters in TOC
19658 !! wikitext
19659 __TOC__
19660 == <sup class="in-h2">Hello</sup> ==
19661
19662 == <sup class="a > b">Evilbye</sup> ==
19663 !! html
19664 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19665 <ul>
19666 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
19667 <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>
19668 </ul>
19669 </div>
19670
19671 <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>
19672 <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>
19673
19674 !! end
19675
19676 !! test
19677 span tags with directionality in TOC
19678 !! wikitext
19679 __TOC__
19680 == <span dir="ltr">C++</span> ==
19681
19682 == <span dir="rtl">זבנג!</span> ==
19683
19684 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
19685
19686 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
19687
19688 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
19689 !! html
19690 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19691 <ul>
19692 <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>
19693 <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>
19694 <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>
19695 <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>
19696 <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>
19697 </ul>
19698 </div>
19699
19700 <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>
19701 <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>
19702 <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>
19703 <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>
19704 <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>
19705
19706 !! end
19707
19708 !! test
19709 Bug 72884: bdi element in ToC
19710 !! wikitext
19711 __TOC__
19712 == <bdi>test</bdi> ==
19713 !! html
19714 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19715 <ul>
19716 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
19717 </ul>
19718 </div>
19719
19720 <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>
19721
19722 !! end
19723
19724 # Note that the html output does not have the <p></p>, but the
19725 # html+tidy output *does*. This is because the empty <p></p> is
19726 # removed by the sanitizer, but only when tidy is *not* enabled (!).
19727 !! test
19728 Empty <p> tag in TOC, removed by Sanitizer (T92892)
19729 !! wikitext
19730 __TOC__
19731 == x ==
19732 !! html
19733 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19734 <ul>
19735 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
19736 </ul>
19737 </div>
19738
19739 <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>
19740
19741 !! html+tidy
19742 <p></p>
19743 <div id="toc" class="toc">
19744 <div id="toctitle">
19745 <h2>Contents</h2>
19746 </div>
19747 <ul>
19748 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
19749 </ul>
19750 </div>
19751 <p></p>
19752 <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>
19753 !! end
19754
19755 !! article
19756 MediaWiki:Bug32057
19757 !! text
19758 == {{int:headline_sample}} ==
19759 !! endarticle
19760
19761 !! test
19762 Bug 32057: Title needed when expanding <h> nodes.
19763 !! options
19764 title=[[Main Page]]
19765 !! wikitext
19766 {{int:Bug32057}}
19767 !! html
19768 <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>
19769
19770 !! end
19771
19772 !! test
19773 Strip marker in urlencode
19774 !! wikitext
19775 {{urlencode:x<nowiki/>y}}
19776 {{urlencode:x<nowiki/>y|wiki}}
19777 {{urlencode:x<nowiki/>y|path}}
19778 !! html
19779 <p>xy
19780 xy
19781 xy
19782 </p>
19783 !! end
19784
19785 !! test
19786 Strip marker in lc
19787 !! wikitext
19788 {{lc:x<nowiki/>y}}
19789 !! html
19790 <p>xy
19791 </p>
19792 !! end
19793
19794 !! test
19795 Strip marker in uc
19796 !! wikitext
19797 {{uc:x<nowiki/>y}}
19798 !! html
19799 <p>XY
19800 </p>
19801 !! end
19802
19803 !! test
19804 Strip marker in formatNum
19805 !! wikitext
19806 {{formatnum:1<nowiki/>2}}
19807 {{formatnum:1<nowiki/>2|R}}
19808 !! html
19809 <p>12
19810 12
19811 </p>
19812 !! end
19813
19814 !! test
19815 Check noCommafy in formatNum
19816 !! options
19817 language=be-tarask
19818 !! wikitext
19819 {{formatnum:123456.78}}
19820 {{formatnum:123456.78|NOSEP}}
19821 !! html
19822 <p>123 456,78
19823 123456.78
19824 </p>
19825 !! end
19826
19827 !! test
19828 Wrong option for formatNum (bug 56199)
19829 !! wikitext
19830 {{formatnum:1,234.56|Random}}
19831 {{formatnum:1,234.56|EVERYTHING}}
19832 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
19833 !! html
19834 <p>1,234.56
19835 1,234.56
19836 1,234.56
19837 </p>
19838 !! end
19839
19840 !! test
19841 Strip marker in grammar
19842 !! options
19843 language=fi
19844 !! wikitext
19845 {{grammar:elative|foo<nowiki/>bar}}
19846 !! html
19847 <p>foobarista
19848 </p>
19849 !! end
19850
19851 !! test
19852 Strip marker in padleft
19853 !! wikitext
19854 {{padleft:|2|x<nowiki/>y}}
19855 !! html
19856 <p>xy
19857 </p>
19858 !! end
19859
19860 !! test
19861 Strip marker in padright
19862 !! wikitext
19863 {{padright:|2|x<nowiki/>y}}
19864 !! html
19865 <p>xy
19866 </p>
19867 !! end
19868
19869 !! test
19870 Strip marker in anchorencode
19871 !! wikitext
19872 {{anchorencode:x<nowiki/>y}}
19873 !! html
19874 <p>xy
19875 </p>
19876 !! end
19877
19878 !! test
19879 nowiki inside link inside heading (bug 18295)
19880 !! wikitext
19881 ==[[foo|x<nowiki>y</nowiki>z]]==
19882 !! html
19883 <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>
19884
19885 !! end
19886
19887 !! test
19888 new support for bdi element (bug 31817)
19889 !! wikitext
19890 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
19891 !! html
19892 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
19893
19894 !!end
19895
19896 !! test
19897 Ignore pipe between table row attributes
19898 !! wikitext
19899 {|
19900 | quux
19901 |- id=foo | style='color: red'
19902 | bar
19903 |}
19904 !! html
19905 <table>
19906 <tr>
19907 <td> quux
19908 </td></tr>
19909 <tr id="foo" style="color: red">
19910 <td> bar
19911 </td></tr></table>
19912
19913 !! end
19914
19915 !!test
19916 Gallery override link with WikiLink (bug 34852)
19917 !! wikitext
19918 <gallery>
19919 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
19920 </gallery>
19921 !! html
19922 <ul class="gallery mw-gallery-traditional">
19923 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19924 <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>
19925 <div class="gallerytext">
19926 <p>caption
19927 </p>
19928 </div>
19929 </div></li>
19930 </ul>
19931
19932 !! end
19933
19934 !!test
19935 Gallery override link with absolute external link (bug 34852)
19936 !! wikitext
19937 <gallery>
19938 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
19939 </gallery>
19940 !! html
19941 <ul class="gallery mw-gallery-traditional">
19942 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19943 <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>
19944 <div class="gallerytext">
19945 <p>caption
19946 </p>
19947 </div>
19948 </div></li>
19949 </ul>
19950
19951 !! end
19952
19953 !!test
19954 Gallery override link with malicious javascript (bug 34852)
19955 !! wikitext
19956 <gallery>
19957 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
19958 </gallery>
19959 !! html
19960 <ul class="gallery mw-gallery-traditional">
19961 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19962 <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>
19963 <div class="gallerytext">
19964 <p>caption
19965 </p>
19966 </div>
19967 </div></li>
19968 </ul>
19969
19970 !! end
19971
19972 !!test
19973 Gallery with invalid title as link (bug 43964)
19974 !! wikitext
19975 <gallery>
19976 File:foobar.jpg|link=<
19977 </gallery>
19978 !! html
19979 <ul class="gallery mw-gallery-traditional">
19980 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19981 <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>
19982 <div class="gallerytext">
19983 </div>
19984 </div></li>
19985 </ul>
19986
19987 !! end
19988
19989 !!test
19990 Language parser function
19991 !! wikitext
19992 {{#language:ar}}
19993 !! html
19994 <p>العربية
19995 </p>
19996 !! end
19997
19998 !!test
19999 Padleft and padright as substr
20000 !! wikitext
20001 {{padleft:|3|abcde}}
20002 {{padright:|3|abcde}}
20003 !! html
20004 <p>abc
20005 abc
20006 </p>
20007 !! end
20008
20009 !!test
20010 Special parser function
20011 !! wikitext
20012 {{#special:RandomPage}}
20013 {{#special:BaDtItLe}}
20014 {{#special:Foobar}}
20015 !! html
20016 <p>Special:Random
20017 Special:Badtitle
20018 Special:Foobar
20019 </p>
20020 !! end
20021
20022 !!test
20023 Bug 34939 - Case insensitive link parsing ([HttP://])
20024 !! wikitext
20025 [HttP://MediaWiki.Org/]
20026 !! html/php
20027 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
20028 </p>
20029 !! html/parsoid
20030 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
20031 !! end
20032
20033 !!test
20034 Bug 34939 - Case insensitive link parsing ([HttP:// title])
20035 !! wikitext
20036 [HttP://MediaWiki.Org/ MediaWiki]
20037 !! html
20038 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
20039 </p>
20040 !! end
20041
20042 !!test
20043 Bug 34939 - Case insensitive link parsing (HttP://)
20044 !! wikitext
20045 HttP://MediaWiki.Org/
20046 !! html/php
20047 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
20048 </p>
20049 !! html/parsoid
20050 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
20051 !! end
20052
20053 !!test
20054 Disable TOC
20055 !! options
20056 notoc
20057 !! wikitext
20058 Lead
20059 == Section 1 ==
20060 == Section 2 ==
20061 == Section 3 ==
20062 == Section 4 ==
20063 == Section 5 ==
20064 !! html
20065 <p>Lead
20066 </p>
20067
20068 <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>
20069 <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>
20070 <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>
20071 <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>
20072 <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>
20073
20074 !! end
20075
20076
20077 ###
20078 ### Parsoid-specific tests
20079 ### Parsoid-PHP parser incompatibilities
20080 ###
20081 !!test
20082 1. SOL-sensitive wikitext tokens as template-args
20083 !!options
20084 parsoid=wt2html,wt2wt
20085 !! wikitext
20086 {{echo|*a}}
20087 {{echo|#a}}
20088 {{echo|:a}}
20089 !! html
20090 <span about="#mwt1" typeof="mw:Transclusion">
20091 </span><ul about="#mwt1"><li>a</li>
20092 </ul>
20093 <span about="#mwt2" typeof="mw:Transclusion">
20094 </span><ol about="#mwt2"><li>a</li>
20095 </ol>
20096 <span about="#mwt3" typeof="mw:Transclusion">
20097 </span><dl about="#mwt3"><dd>a</dd>
20098 </dl>
20099 !!end
20100
20101 #### -----------------------------------------------------------------
20102 #### Parsoid-specific functionality tests
20103 #### -----------------------------------------------------------------
20104
20105 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
20106 # We know wt2wt will fail, but we expect selser to pass.
20107 # Due to the nature of our testing, wt2wt and selser tests will enter the
20108 # blacklist and we'll catch selser regressions based on changes to the
20109 # blacklist entries for selser tests.
20110 !! test
20111 1. Bad treebuilder fixup of formatting elt is cleaned up
20112 !! options
20113 parsoid=wt2html,wt2wt
20114 !! wikitext
20115 {|
20116 |
20117 <small>
20118 [[Image:Foobar.jpg|right|Test]]
20119 </small>
20120 |}
20121 !! html/parsoid
20122 <table>
20123 <tbody><tr><td>
20124 <small>
20125 <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>
20126 </small>
20127 </td></tr>
20128 </tbody></table>
20129 !! end
20130
20131 !! test
20132 2. Bad treebuilder fixup of formatting elt is cleaned up
20133 !! options
20134 parsoid=wt2html,wt2wt
20135 !! wikitext
20136 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
20137
20138 <small>[[Image:Foobar.jpg|right|300px]]</small>
20139 !! html/parsoid
20140 <p><b>foo</b></p>
20141 <figure class="mw-default-size" typeof="mw:Image/Thumb"><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="25" width="220"/></a><figcaption><b>caption</b></figcaption></figure>
20142 <p><b>bar</b></p>
20143 <small><figure class="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="34" width="300"/></a></figure></small>
20144 !! end
20145
20146 #### ----------------------------------------------------------------
20147 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
20148 #### tags. Parsoid's output for these tags differs from that of the
20149 #### PHP parser.
20150 #### ----------------------------------------------------------------
20151
20152 !!test
20153 Ref: 1. ref-location should be replaced with an index span
20154 !!options
20155 parsoid
20156 !! wikitext
20157 A <ref>foo</ref>
20158 B <ref name="x">foo</ref>
20159 C <ref name="y" />
20160 <references />
20161 !! html
20162 <p>A <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>
20163 B <span about="#mwt4" class="reference" 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">[2]</a></span>
20164 C <span about="#mwt6" class="reference" 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">[3]</a></span></p>
20165 <ol class="references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
20166 <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">foo</span></li>
20167 <li about="#cite_note-x-2" id="cite_note-x-2"><span rel="mw:referencedBy"><a href="#cite_ref-x_2-0">↑</a></span> <span id="mw-reference-text-cite_note-x-2" class="mw-reference-text">foo</span></li>
20168 <li about="#cite_note-y-3" id="cite_note-y-3"><span rel="mw:referencedBy"><a href="#cite_ref-y_3-0">↑</a></span> <span id="mw-reference-text-cite_note-y-3" class="mw-reference-text"></span></li>
20169 </ol>
20170 !!end
20171
20172 !!test
20173 Ref: 2. ref-tags with identical names should all get the same index
20174 !!options
20175 parsoid
20176 !! wikitext
20177 A <ref name="x">foo</ref>
20178 B <ref name="x" />
20179 <references />
20180 !! html
20181 <p>A <span about="#mwt2" class="reference" 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">[1]</a></span>
20182 B <span about="#mwt4" class="reference" 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">[1]</a></span></p>
20183 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
20184 <li about="#cite_note-x-1" id="cite_note-x-1"><span rel="mw:referencedBy">↑ <a href="#cite_ref-x_1-0">1.0</a> <a href="#cite_ref-x_1-1">1.1</a></span> <span id="mw-reference-text-cite_note-x-1" class="mw-reference-text">foo</span></li>
20185 </ol>
20186 !!end
20187
20188 !!test
20189 Ref: 3. spaces in ref-names should be ignored
20190 !!options
20191 parsoid
20192 !! wikitext
20193 A <ref name="x">foo</ref>
20194 B <ref name=" x " />
20195 C <ref name= x />
20196 <references />
20197 !! html
20198 <p>A <span about="#mwt2" class="reference" 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">[1]</a></span>
20199 B <span about="#mwt4" class="reference" 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">[1]</a></span>
20200 C <span about="#mwt6" class="reference" 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">[1]</a></span></p>
20201 <ol class="references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
20202 <li about="#cite_note-x-1" id="cite_note-x-1"><span rel="mw:referencedBy">↑ <a href="#cite_ref-x_1-0">1.0</a> <a href="#cite_ref-x_1-1">1.1</a> <a href="#cite_ref-x_1-2">1.2</a></span> <span id="mw-reference-text-cite_note-x-1" class="mw-reference-text">foo</span></li>
20203 </ol>
20204 !!end
20205
20206 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
20207 !!test
20208 Ref: 4. 'constructor' should be accepted as a valid ref-name
20209 !!options
20210 parsoid
20211 !! wikitext
20212 A <ref name="constructor">foo</ref>
20213 <references />
20214 !! html
20215 <p>A <span about="#mwt2" class="reference" 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">[1]</a></span></p>
20216 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20217 <li about="#cite_note-constructor-1" id="cite_note-constructor-1"><span rel="mw:referencedBy"><a href="#cite_ref-constructor_1-0">↑</a></span> <span id="mw-reference-text-cite_note-constructor-1" class="mw-reference-text">foo</span></li>
20218 </ol>
20219 !!end
20220
20221 !!test
20222 Ref: 5. body should accept generic wikitext
20223 !!options
20224 parsoid
20225 !! wikitext
20226 A <ref>
20227 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
20228 </ref>
20229
20230 <references />
20231 !! html
20232 <p>A <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></p>
20233
20234 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
20235 <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">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>
20236 </span></li>
20237 </ol>
20238 !!end
20239
20240 !!test
20241 Ref: 6. indent-pres should not be output in ref-body
20242 !!options
20243 parsoid
20244 !! wikitext
20245 A <ref>
20246 foo
20247 bar
20248 baz
20249 </ref>
20250
20251 <references />
20252 !! html
20253 <p>A <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></p>
20254
20255 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20256 <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">foo
20257 bar
20258 baz
20259 </span></li>
20260 </ol>
20261 !!end
20262
20263 !!test
20264 Ref: 7. No p-wrapping in ref-body
20265 !!options
20266 parsoid
20267 !! wikitext
20268 A <ref>
20269 foo
20270
20271 bar
20272
20273
20274 baz
20275
20276
20277
20278 booz
20279 </ref>
20280
20281 <references />
20282 !! html
20283 <p>A <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></p>
20284
20285 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20286 <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">foo
20287
20288 bar
20289
20290
20291 baz
20292
20293
20294
20295 booz
20296 </span></li>
20297 </ol>
20298 !!end
20299
20300 !!test
20301 Ref: 8. transclusion wikitext has lower precedence
20302 !!options
20303 parsoid
20304 !! wikitext
20305 A <ref> foo {{echo|</ref> B C}}
20306
20307 <references />
20308 !! html
20309 <p>A <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> B C<span typeof="mw:Nowiki">}}</span></p>
20310 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20311 <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">foo <span typeof="mw:Nowiki" data-parsoid='{"src":"{{","dsr":[12,14,0,0]}'>{{</span>echo|</span></li>
20312 </ol>
20313 !!end
20314
20315 !!test
20316 Ref: 9. unclosed comments should not leak out of ref-body
20317 !!options
20318 parsoid
20319 !! wikitext
20320 A <ref> foo <!--</ref> B C
20321 <references />
20322 !! html
20323 <p>A <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> B C</p>
20324 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20325 <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">foo <!----></span></li>
20326 </ol>
20327 !!end
20328
20329 !!test
20330 Ref: 10. Unclosed HTML tags should not leak out of ref-body
20331 !!options
20332 parsoid
20333 !! wikitext
20334 A <ref> <b> foo </ref> B C
20335
20336 <references />
20337 !! html
20338 <p>A <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> B C</p>
20339
20340
20341 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20342 <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"><b data-parsoid='{"stx":"html","autoInsertedEnd":true}'> foo </b></span></li>
20343 </ol>
20344 !!end
20345
20346 !!test
20347 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
20348 !!options
20349 parsoid
20350 !! wikitext
20351 A <ref>foo</ref> B
20352 C <ref>bar</ref> D
20353 <references />
20354 !! html
20355 <p>A <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> B
20356 C <span about="#mwt4" class="reference" 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">[2]</a></span> D</p>
20357 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
20358 <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">foo</span></li>
20359 <li about="#cite_note-2" id="cite_note-2"><span rel="mw:referencedBy"><a href="#cite_ref-2">↑</a></span> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar</span></li>
20360 </ol>
20361 !!end
20362
20363 !!test
20364 Ref: 12. ref-tags act as trailing newline migration barrier
20365 !!options
20366 parsoid
20367 !! wikitext
20368 <!--the newline at the end of this line moves out of the p-tag-->a
20369
20370 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
20371 <ref />
20372
20373 c
20374 <references />
20375 !! html
20376 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
20377
20378
20379 <p>b<!--the newline at the end of this line stays inside the p-tag--> <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{}}'><a href="#cite_note-1">[1]</a></span>
20380 <span about="#mwt4" class="reference" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{}}'><a href="#cite_note-2">[2]</a></span></p>
20381
20382 <p>c</p>
20383 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
20384 <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"></span></li>
20385 <li about="#cite_note-2" id="cite_note-2"><span rel="mw:referencedBy"><a href="#cite_ref-2">↑</a></span> <span id="mw-reference-text-cite_note-2" class="mw-reference-text"></span></li></ol>
20386 !!end
20387
20388 !!test
20389 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
20390 !!options
20391 parsoid
20392 !! wikitext
20393 <ref>foo</ref> A
20394 <ref>bar
20395 </ref> B
20396 <references />
20397 !! html
20398 <p><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> A
20399 <span about="#mwt4" class="reference" 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">[2]</a></span> B</p>
20400 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
20401 <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">foo</span></li>
20402 <li about="#cite_note-2" id="cite_note-2"><span rel="mw:referencedBy"><a href="#cite_ref-2">↑</a></span> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar
20403 </span></li>
20404 </ol>
20405 !!end
20406
20407 !!test
20408 Ref: 14. A nested ref-tag should be emitted as plain text
20409 !!options
20410 parsoid
20411 !! wikitext
20412 <ref>foo <ref>bar</ref> baz</ref>
20413
20414 <references />
20415 !! html
20416 <p><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>
20417 </p>
20418 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
20419 <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">foo &lt;ref>bar&lt;/ref> baz</span></li>
20420 </ol>
20421 !!end
20422
20423 !!test
20424 Ref: 15. ref-tags with identical names should get identical indexes
20425 !!options
20426 parsoid
20427 !! wikitext
20428 A1 <ref name="a">foo</ref> A2 <ref name="a" />
20429 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
20430
20431 <references />
20432 !! html
20433 <p>A1 <span about="#mwt3" class="reference" 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">[1]</a></span> A2 <span about="#mwt4" class="reference" 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">[1]</a></span>
20434 B1 <span about="#mwt7" class="reference" 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">[2]</a></span> B2 <span about="#mwt8" class="reference" 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">[2]</a></span></p>
20435
20436 <ol class="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">1.0</a> <a href="#cite_ref-a_1-1">1.1</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">2.0</a> <a href="#cite_ref-b_2-1">2.1</a></span> <span id="mw-reference-text-cite_note-b-2" class="mw-reference-text">bar</span></li>
20437 </ol>
20438 !!end
20439
20440 ## We don't bother wt2wt-ing non-standard whitespace
20441 !!test
20442 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
20443 !!options
20444 parsoid=wt2html
20445 !! wikitext
20446 A <ref >foo</ref >
20447
20448 <references />
20449 !! html
20450 <p>A <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></p>
20451 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20452 <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">foo</span></li></ol>
20453 !!end
20454
20455 !!test
20456 Ref: 17. Generate valid HTML5 id/about attributes
20457 !!options
20458 parsoid
20459 !!wikitext
20460 <ref name="a b">foo</ref>
20461
20462 <references />
20463 !!html
20464 <p><span class="reference" 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">[1]</a></span>
20465 </p>
20466
20467 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20468 <li about="#cite_note-a_b-1" id="cite_note-a_b-1"><span rel="mw:referencedBy"><a href="#cite_ref-a_b_1-0">↑</a></span> <span id="mw-reference-text-cite_note-a_b-1" class="mw-reference-text">foo</span></li>
20469 </ol>
20470 !!end
20471
20472 !!test
20473 Ref: 18. T58916: Extension attributes should be parsed as plain text
20474 !!options
20475 parsoid
20476 !!wikitext
20477 <ref name="{{echo|a}}">foo</ref>
20478
20479 <references />
20480 !!html
20481 <p><span class="reference" 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">[1]</a></span>
20482 </p>
20483
20484 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20485 <li about="#cite_note-.7B.7Becho.7Ca.7D.7D-1" id="cite_note-.7B.7Becho.7Ca.7D.7D-1"><span rel="mw:referencedBy"><a href="#cite_ref-.7B.7Becho.7Ca.7D.7D_1-0">↑</a></span> <span id="mw-reference-text-cite_note-.7B.7Becho.7Ca.7D.7D-1" class="mw-reference-text">foo</span></li>
20486 </ol>
20487 !!end
20488
20489 !!test
20490 Ref: 19. ref-tags with identical name encodings should get identical indexes
20491 !!options
20492 parsoid
20493 !! wikitext
20494 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
20495
20496 <references />
20497 !! html
20498 <p>1 <span about="#mwt3" class="reference" 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">[1]</a></span> 2 <span about="#mwt4" class="reference" 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">[1]</a></span>
20499 </p>
20500 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
20501 <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">1.0</a> <a href="#cite_ref-a_.26_b_1-1">1.1</a></span> <span id="mw-reference-text-cite_note-a_.26_b-1" class="mw-reference-text">foo</span></li>
20502 </ol>
20503 !!end
20504
20505 !!test
20506 Ref: 20. ref-tags with identical names but different content should keep it
20507 !!options
20508 parsoid
20509 !! wikitext
20510 A <ref name="foo">Foo one</ref>
20511 B <ref name="foo">Foo two</ref>
20512 C <ref name="foo" />
20513
20514 <references />
20515 !! html
20516 <p>A <span about="#mwt2" class="reference" 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">[1]</a></span>
20517 B <span about="#mwt4" class="reference" 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">[1]</a></span>
20518 C <span about="#mwt6" class="reference" 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">[1]</a></span></p>
20519
20520 <ol class="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">1.0</a> <a href="#cite_ref-foo_1-1">1.1</a> <a href="#cite_ref-foo_1-2">1.2</a></span> <span id="mw-reference-text-cite_note-foo-1" class="mw-reference-text">Foo one</span></li>
20521 </ol>
20522 !!end
20523
20524 !!test
20525 References: 1. references tag without any refs should be handled properly
20526 !!options
20527 parsoid
20528 !! wikitext
20529 <references />
20530 !! html
20531 <ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
20532 !!end
20533
20534 !!test
20535 References: 2. references tag with group only outputs references from that group
20536 !!options
20537 parsoid
20538 !! wikitext
20539 A <ref group="a">foo</ref>
20540 B <ref group="b">bar</ref>
20541 C <ref>baz</ref>
20542
20543 <references group="a" />
20544 <references />
20545 <references group="b" />
20546 !! html
20547 <p>A <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":{"group":"a"}}'><a href="#cite_note-1">[a 1]</a></span>
20548 B <span about="#mwt4" class="reference" 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">[b 1]</a></span>
20549 C <span class="reference" 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">[1]</a></span></p>
20550
20551 <ol class="references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{"group":"a"}}'>
20552 <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">foo</span></li>
20553 </ol>
20554 <ol class="references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'>
20555 <li about="#cite_note-3" id="cite_note-3"><span rel="mw:referencedBy"><a href="#cite_ref-3">↑</a></span> <span id="mw-reference-text-cite_note-3" class="mw-reference-text">baz</span></li>
20556 </ol>
20557 <ol class="references" typeof="mw:Extension/references" about="#mwt12" data-mw='{"name":"references","attrs":{"group":"b"}}'>
20558 <li about="#cite_note-2" id="cite_note-2"><span rel="mw:referencedBy"><a href="#cite_ref-2">↑</a></span> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar</span></li>
20559 </ol>
20560 !!end
20561
20562 !!test
20563 References: 3. ref list should be cleared after processing references
20564 !!options
20565 parsoid
20566 !! wikitext
20567 A <ref>foo</ref>
20568
20569 <references />
20570
20571 B <ref>bar</ref>
20572
20573 <references />
20574 !! html
20575 <p>A <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></p>
20576
20577 <ol class="references" typeof="mw:Extension/references" about="#mwt4" 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">foo</span></li>
20578 </ol>
20579
20580 <p>B <span about="#mwt6" class="reference" 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">[1]</a></span></p>
20581
20582 <ol class="references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
20583 <li about="#cite_note-2" id="cite_note-2"><span rel="mw:referencedBy"><a href="#cite_ref-2">↑</a></span> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar</span></li>
20584 </ol>
20585 !!end
20586
20587 !!test
20588 References: 4. only referenced group should be cleared after processing references
20589 !!options
20590 parsoid
20591 !! wikitext
20592 A <ref group="a">afoo</ref>
20593 B <ref>bfoo</ref>
20594
20595 <references group="a" />
20596
20597 C <ref>cfoo</ref>
20598
20599 <references />
20600 !! html
20601 <p>A <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":{"group":"a"}}'><a href="#cite_note-1">[a 1]</a></span>
20602 B <span about="#mwt4" class="reference" 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">[1]</a></span></p>
20603
20604 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{"group":"a"}}'><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">afoo</span></li>
20605 </ol>
20606
20607 <p>C <span about="#mwt8" class="reference" 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">[2]</a></span></p>
20608
20609 <ol class="references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-2" id="cite_note-2"><span rel="mw:referencedBy"><a href="#cite_ref-2">↑</a></span> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bfoo</span></li><li about="#cite_note-3" id="cite_note-3"><span rel="mw:referencedBy"><a href="#cite_ref-3">↑</a></span> <span id="mw-reference-text-cite_note-3" class="mw-reference-text">cfoo</span></li>
20610 </ol>
20611 !!end
20612
20613 !!test
20614 References: 5. ref tags in references should be processed while ignoring all other content
20615 !!options
20616 parsoid
20617 !! wikitext
20618 A <ref name="a" />
20619 B <ref name="b">bar</ref>
20620
20621 <references>
20622 <ref name="a">foo</ref>
20623 This should just get lost.
20624 </references>
20625 !! html
20626 <p>A <span about="#mwt2" class="reference" 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">[1]</a></span>
20627 B <span about="#mwt4" class="reference" 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">[2]</a></span></p>
20628
20629
20630 <ol class="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=\"reference\" 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\">[1]&lt;/a>&lt;/span>\n"},"attrs":{}}'><li about="#cite_note-a-1" id="cite_note-a-1"><span rel="mw:referencedBy"><a href="#cite_ref-a_1-0">↑</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">↑</a></span> <span id="mw-reference-text-cite_note-b-2" class="mw-reference-text">bar</span></li>
20631 </ol>
20632 !!end
20633
20634 !!test
20635 References: 6. <references /> from a transclusion
20636 !!options
20637 parsoid
20638 !! wikitext
20639 <ref>Foo</ref> {{echo|<references />}}
20640 !! html
20641 <p><span about="#mwt3" 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></p> <ol class="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"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">Foo</span></li>
20642 </ol>
20643 !!end
20644
20645 !! test
20646 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
20647 !! options
20648 parsoid
20649 !! wikitext
20650 A <ref>foo bar for a</ref>
20651 B <ref group="X" name="b" />
20652
20653 <references />
20654
20655 <references group="X">
20656 <ref name="b">foo</ref>
20657 </references>
20658 !! html
20659 <p>A <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>
20660 B <span about="#mwt4" class="reference" 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">[X 1]</a></span>
20661 </p>
20662
20663 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
20664 <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">foo bar for a</span></li>
20665 </ol>
20666
20667 <ol class="references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","body":{"extsrc":"&lt;ref name=\"b\">foo&lt;/ref>","html":"\n&lt;span about=\"#mwt10\" class=\"reference\" 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\">[X 1]&lt;/a>&lt;/span>\n"},"attrs":{"group":"X"}}'>
20668 <li about="#cite_note-b-2" id="cite_note-b-2"><span rel="mw:referencedBy"><a href="#cite_ref-b_2-0">↑</a></span> <span id="mw-reference-text-cite_note-b-2" class="mw-reference-text">foo</span></li>
20669 </ol>
20670 !! end
20671
20672 !! test
20673 References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
20674 !! options
20675 parsoid
20676 !! wikitext
20677 X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
20678 <references />
20679 !! html
20680 <p>X<span about="#mwt2" class="reference" 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">[1]</a></span></p>
20681 <ol class="references" typeof="mw:Extension/references" about="#mwt7" 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">foo <b data-parsoid='{"stx":"html"}'>bar</b> and baz boo</span></li>
20682 </ol>
20683 !!end
20684
20685 # This test only works in wt2html now as the <references /> are always generated
20686 # unless selser is active. Once T72722 is fixed, we should add a changes test
20687 # here to ensure that unrelated changes don't add the new <references /> in
20688 # wt2wt.
20689 !! test
20690 References: 9. Generate missing references list at the end
20691 !! options
20692 parsoid
20693 !! wikitext
20694 A <ref>foo</ref>
20695 B <ref group="inexistent">bar</ref>
20696 !! html
20697 <p>A <span 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> B <span class="reference" 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">[inexistent 1]</a></span></p>
20698 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
20699 <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">foo</span></li>
20700 </ol>
20701 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{"group":"inexistent"}}'>
20702 <li about="#cite_note-2" id="cite_note-2"><span rel="mw:referencedBy"><a href="#cite_ref-2">↑</a></span> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar</span></li>
20703 </ol>
20704 !! end
20705
20706 !! test
20707 References: 10. New <references/> shouldn't be added for unrelated edits.
20708 !! options
20709 parsoid={
20710 "modes": ["selser"],
20711 "changes": [["#x", "remove"]],
20712 "selser": "noauto"
20713 }
20714 !! wikitext
20715 Unrelated text<span id="x"> that's going to disappear</span>.
20716 A <ref>foo</ref>
20717 !! wikitext/edited
20718 Unrelated text.
20719 A <ref>foo</ref>
20720 !!end
20721
20722 !! test
20723 Entities in ref name
20724 !! options
20725 parsoid
20726 !! wikitext
20727 <ref name="test &amp; me">hi</ref>
20728 <references />
20729 !! html
20730 <p><span about="#mwt2" class="reference" 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">[1]</a></span></p>
20731 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20732 <li about="#cite_note-test_.26_me-1" id="cite_note-test_.26_me-1"><span rel="mw:referencedBy"><a href="#cite_ref-test_.26_me_1-0">↑</a></span> <span id="mw-reference-text-cite_note-test_.26_me-1" class="mw-reference-text">hi</span></li>
20733 </ol>
20734 !! end
20735
20736 # This test is wt2html only because we're permitting the serializer to produce
20737 # dirty diffs, normalizing the unclosed references to the self-closed version.
20738 !! test
20739 Generate references for unclosed references tag
20740 !! options
20741 parsoid=wt2html
20742 !! wikitext
20743 a<ref>foo</ref>
20744
20745 <references>
20746 !! html
20747 <p>a<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></p>
20748 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20749 <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">foo</span></li></ol>
20750 !! end
20751
20752 !! test
20753 New reference serializes on its own line
20754 !! options
20755 parsoid=wt2wt,html2wt
20756 !! wikitext
20757 foo
20758 <references />
20759 !! html
20760 foo<ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
20761 !! end
20762
20763 #### ----------------------------------------------------------------
20764 #### Parsoid-only testing of Parsoid's impl of LST
20765 #### Not implemented yet, see
20766 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
20767 #### ----------------------------------------------------------------
20768
20769 !!test
20770 LST Sections: 1. Simple section start and end
20771 !! wikitext
20772 <section begin="2011-05-16" />
20773 <section end="2014-04-10 (MW 1.23wmf22)" />
20774 !! html/parsoid
20775 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
20776 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
20777 !! end
20778
20779 #--------- Test stripping of empty nodes in template content ----------
20780 !!test
20781 Empty LI and TR nodes should be stripped from template content
20782 !!wikitext
20783 {{EmptyLITest}}
20784 {{EmptyTRTest}}
20785 !!html/parsoid
20786 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
20787 <li>a</li>
20788 <li>b</li>
20789 </ul>
20790 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
20791 <tbody>
20792 <tr>
20793 <td>foo</td>
20794 </tr>
20795 <tr>
20796 <td>bar</td>
20797 </tr>
20798 </tbody>
20799 </table>
20800 !!end
20801
20802 !!test
20803 Empty LI and TR nodes should not be stripped from top-level content
20804 !!wikitext
20805 * a
20806 *
20807 * b
20808 {|
20809 |-
20810 |-
20811 |foo
20812 |}
20813 !!html/parsoid
20814 <ul>
20815 <li> a</li>
20816 <li></li>
20817 <li> b</li>
20818 </ul>
20819 <table>
20820 <tbody>
20821 <tr></tr>
20822 <tr>
20823 <td>foo</td>
20824 </tr>
20825 </tbody>
20826 </table>
20827 !!end
20828
20829 !!test
20830 Empty TR nodes should not be stripped if they have any attributes set
20831 !!wikitext
20832 {{EmptyTRWithHTMLAttrTest}}
20833 !!html/parsoid
20834 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
20835 <tr align="center"></tr>
20836 <tr><td>foo</td></tr>
20837 <tr align="center"></tr>
20838 <tr><td>bar</td></tr>
20839 </table>
20840 !!end
20841
20842 #### ----------------------------------------------------------------
20843 #### The following section of tests are primarily to test
20844 #### wikitext escaping capabilities of Parsoid. Given that
20845 #### escaping can be done any number of ways, the wikitext (input)
20846 #### is always adjusted to reflect how Parsoid adds nowiki
20847 #### escape tags.
20848 ####
20849 #### We are marking several tests as parsoid-only since the
20850 #### HTML in the result section is different from what the
20851 #### PHP parser generates for it.
20852 #### ----------------------------------------------------------------
20853
20854
20855 #### --------------- Headings ---------------
20856 #### 0. Unnested
20857 #### 1. Nested inside html <h1>=foo=</h1>
20858 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
20859 #### 3. Nested inside html with wikitext split by html tags
20860 #### 4. No escape needed
20861 #### 5. Empty headings <h1></h1>
20862 #### 6. Heading chars in SOL context
20863 #### ----------------------------------------
20864 !! test
20865 Headings: 0. Unnested
20866 !! options
20867 parsoid
20868 !! wikitext
20869 <nowiki>=foo=</nowiki>
20870
20871 <nowiki> =foo= </nowiki>
20872 <!--cmt-->
20873 <nowiki>=foo=</nowiki>
20874
20875 =foo''a''<nowiki>=</nowiki>
20876 !! html
20877 <p><span typeof="mw:Nowiki">=foo=</span></p>
20878
20879 <p><span typeof="mw:Nowiki"> =foo= </span>
20880 <!--cmt-->
20881 <span typeof="mw:Nowiki">=foo=</span></p>
20882
20883 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
20884 !!end
20885
20886 # New headings and existing headings are handled differently
20887 !! test
20888 Headings: 1. Nested inside html
20889 !! options
20890 parsoid=html2wt
20891 !! html
20892 <h1>=foo=</h1>
20893 <h2>=foo=</h2>
20894 <h3>=foo=</h3>
20895
20896 <h1 data-parsoid=''>=foo=</h1>
20897 <h2 data-parsoid=''>=foo=</h2>
20898 <h3 data-parsoid=''>=foo=</h3>
20899 <h4 data-parsoid=''>=foo=</h4>
20900 <h5 data-parsoid=''>=foo=</h5>
20901 <h6 data-parsoid=''>=foo=</h6>
20902 !! wikitext
20903 = =foo= =
20904
20905 == =foo= ==
20906
20907 === =foo= ===
20908
20909 =<nowiki>=foo=</nowiki>=
20910 ==<nowiki>=foo=</nowiki>==
20911 ===<nowiki>=foo=</nowiki>===
20912 ====<nowiki>=foo=</nowiki>====
20913 =====<nowiki>=foo=</nowiki>=====
20914 ======<nowiki>=foo=</nowiki>======
20915
20916 !!end
20917
20918 !! test
20919 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
20920 !! options
20921 parsoid=html2wt
20922 !! html
20923 <h1>foo</h1>*bar
20924 <h1>foo</h1>=bar
20925 <h1>foo</h1>=bar=
20926 !! wikitext
20927 = foo =
20928 <nowiki>*</nowiki>bar
20929
20930 = foo =
20931 =bar
20932
20933 = foo =
20934 <nowiki>=bar=</nowiki>
20935 !!end
20936
20937 !! test
20938 Headings: 3. Nested inside html with wikitext split by html tags
20939 !! options
20940 parsoid=html2wt,wt2wt
20941 !! wikitext
20942 = ='''bold'''<nowiki>foo=</nowiki> =
20943 !! html/parsoid
20944 <h1>=<b>bold</b>foo=</h1>
20945 !!end
20946
20947 !! test
20948 Headings: 4a. No escaping needed (testing just h1 and h2)
20949 !! wikitext
20950 = =foo =
20951
20952 = foo= =
20953
20954 = =foo= =
20955
20956 = =foo= bar =
20957
20958 == =foo ==
20959
20960 == foo= ==
20961
20962 = = =
20963
20964 = ''=''foo= =
20965 !! html/parsoid
20966 <h1>=foo</h1>
20967 <h1>foo=</h1>
20968 <h1> =foo= </h1>
20969 <h1>=foo= bar</h1>
20970 <h2>=foo</h2>
20971 <h2>foo=</h2>
20972 <h1>=</h1>
20973 <h1><i>=</i>foo=</h1>
20974 !!end
20975
20976 !! test
20977 Headings: 4b. No escaping needed (inside p-tags)
20978 !! options
20979 parsoid=html2wt
20980 !! html
20981 <p>===
20982 =foo= x
20983 =foo= <s></s>
20984 </p>
20985 !! wikitext
20986 ===
20987 =foo= x
20988 =foo= <s></s>
20989 !!end
20990
20991 !! test
20992 Headings: 5. Empty headings
20993 !! options
20994 parsoid
20995 !! wikitext
20996 =<nowiki/>=
20997
20998 ==<nowiki/>==
20999
21000 ===<nowiki/>===
21001
21002 ====<nowiki/>====
21003
21004 =====<nowiki/>=====
21005
21006 ======<nowiki/>======
21007 !! html
21008 <h1></h1>
21009 <h2></h2>
21010 <h3></h3>
21011 <h4></h4>
21012 <h5></h5>
21013 <h6></h6>
21014 !!end
21015
21016 !! test
21017 Headings: 6a. Heading chars in SOL context (with trailing spaces)
21018 !! options
21019 parsoid
21020 !! wikitext
21021 <nowiki>=a=</nowiki>
21022
21023 <nowiki>=a=</nowiki>
21024
21025 <nowiki>=a=</nowiki>
21026
21027 <nowiki>=a=</nowiki>
21028 !! html
21029 <p>=a=</p>
21030 <p>=a= </p>
21031 <p>=a= </p>
21032 <p>=a= </p>
21033 !!end
21034
21035 !! test
21036 Headings: 6b. Heading chars in SOL context (with trailing newlines)
21037 !! options
21038 parsoid
21039 !! wikitext
21040 <nowiki>=a=
21041 b</nowiki>
21042
21043 <nowiki>=a=
21044 b</nowiki>
21045
21046 <nowiki>=a=
21047 b</nowiki>
21048
21049 <nowiki>=a=
21050 b</nowiki>
21051 !! html
21052 <p>=a=
21053 b</p>
21054 <p>=a=
21055 b</p>
21056 <p>=a=
21057 b</p>
21058 <p>=a=
21059 b</p>
21060 </p>
21061 !!end
21062
21063 !! test
21064 Headings: 6c. Heading chars in SOL context (leading newline break)
21065 !! options
21066 parsoid
21067 !! wikitext
21068 a
21069 <nowiki>=b=</nowiki>
21070 !! html
21071 <p>a
21072 =b=</p>
21073 !!end
21074
21075 !! test
21076 Headings: 6d. Heading chars in SOL context (with interspersed comments)
21077 !! options
21078 parsoid
21079 !! wikitext
21080 <!--c0--><nowiki>=a=</nowiki>
21081
21082 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
21083 !! html
21084 <p><!--c0-->=a=</p>
21085 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
21086 !!end
21087
21088 !! test
21089 Headings: 6d. Heading chars in SOL context (No escaping needed)
21090 !! options
21091 parsoid=html2wt
21092 !! html
21093 =a=<div>b</div>
21094 !! wikitext
21095 =a=<div>b</div>
21096 !!end
21097
21098 !! test
21099 Headings: 7. Insert a newline between new content and headings
21100 !! options
21101 parsoid=html2wt
21102 !! html
21103 <h2>NEW</h2>
21104 <p>new</p>
21105 <h2 data-parsoid='{"dsr":[0,5,2,2]}'>A</h2>
21106 <p data-parsoid='{"dsr":[6,7,0,0]}'>a</p>
21107 !! wikitext
21108 == NEW ==
21109 new
21110
21111 ==A==
21112 a
21113
21114 !! end
21115
21116 #### --------------- Lists ---------------
21117 #### 0. Outside nests (*foo, etc.)
21118 #### 1. Nested inside html <ul><li>*foo</li></ul>
21119 #### 2. Inside definition lists
21120 #### 3. Only bullets at start should be escaped
21121 #### 4. No escapes needed
21122 #### 5. No unnecessary escapes
21123 #### 6. Escape bullets in SOL position
21124 #### 7. Escape bullets in a multi-line context
21125 #### ----------------------------------------
21126
21127 !! test
21128 Lists: 0. Outside nests
21129 !! wikitext
21130 <nowiki>*</nowiki>foo
21131
21132 <nowiki>#</nowiki>foo
21133
21134 <nowiki>;Foo:</nowiki>bar
21135 !! html
21136 <p>*foo
21137 </p><p>#foo
21138 </p><p>;Foo:bar
21139 </p>
21140 !!end
21141
21142 !! test
21143 Lists: 1. Nested inside html
21144 !! wikitext
21145 *<nowiki>*foo</nowiki>
21146
21147 *<nowiki>#foo</nowiki>
21148
21149 *<nowiki>:foo</nowiki>
21150
21151 *<nowiki>;foo</nowiki>
21152
21153 #<nowiki>*foo</nowiki>
21154
21155 #<nowiki>#foo</nowiki>
21156
21157 #<nowiki>:foo</nowiki>
21158
21159 #<nowiki>;foo</nowiki>
21160 !! html
21161 <ul><li>*foo</li></ul>
21162 <ul><li>#foo</li></ul>
21163 <ul><li>:foo</li></ul>
21164 <ul><li>;foo</li></ul>
21165 <ol><li>*foo</li></ol>
21166 <ol><li>#foo</li></ol>
21167 <ol><li>:foo</li></ol>
21168 <ol><li>;foo</li></ol>
21169
21170 !!end
21171
21172 !! test
21173 Lists: 2. Inside definition lists
21174 !! wikitext
21175 ;<nowiki>;foo</nowiki>
21176
21177 ;<nowiki>:foo</nowiki>
21178
21179 ;<nowiki>:foo</nowiki>
21180 :bar
21181
21182 :<nowiki>:foo</nowiki>
21183 !! html
21184 <dl><dt>;foo</dt></dl>
21185 <dl><dt>:foo</dt></dl>
21186 <dl><dt>:foo</dt>
21187 <dd>bar</dd></dl>
21188 <dl><dd>:foo</dd></dl>
21189
21190 !!end
21191
21192 !! test
21193 Lists: 3. Only bullets at start of text should be escaped
21194 !! wikitext
21195 *<nowiki>*foo*bar</nowiki>
21196
21197 *<nowiki>*foo</nowiki>''it''*bar
21198 !! html
21199 <ul><li>*foo*bar</li></ul>
21200 <ul><li>*foo<i>it</i>*bar</li></ul>
21201
21202 !!end
21203
21204 !! test
21205 Lists: 4. No escapes needed
21206 !! options
21207 parsoid
21208 !! wikitext
21209 *foo*bar
21210
21211 *''foo''*bar
21212
21213 *[[Foo]]: bar
21214
21215 *[[Foo]]*bar
21216 !! html
21217 <ul>
21218 <li>foo*bar
21219 </li>
21220 </ul>
21221 <ul>
21222 <li><i>foo</i>*bar
21223 </li>
21224 </ul>
21225 <ul>
21226 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
21227 </li>
21228 </ul>
21229 <ul>
21230 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
21231 </li>
21232 </ul>
21233 !!end
21234
21235 !! test
21236 Lists: 5. No unnecessary escapes
21237 !! wikitext
21238 * bar <span><nowiki>[[foo]]</nowiki></span>
21239
21240 * =bar <span><nowiki>[[foo]]</nowiki></span>
21241
21242 * [[bar <span><nowiki>[[foo]]</nowiki></span>
21243
21244 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
21245
21246 * =bar <span>foo]]</span>=
21247
21248 * <s></s>: a
21249
21250 * ''* foo''
21251 !! html
21252 <ul><li> bar <span>[[foo]]</span></li></ul>
21253 <ul><li> =bar <span>[[foo]]</span></li></ul>
21254 <ul><li> [[bar <span>[[foo]]</span></li></ul>
21255 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
21256 <ul><li> =bar <span>foo]]</span>=</li></ul>
21257 <ul><li> <s></s>: a</li></ul>
21258 <ul><li> <i>* foo</i></li></ul>
21259
21260 !!end
21261
21262 !! test
21263 Lists: 6. Escape bullets in SOL position
21264 !! options
21265 parsoid=html2wt
21266 !! html
21267 <p><!--cmt-->*foo</p>
21268 !! wikitext
21269 <!--cmt--><nowiki>*</nowiki>foo
21270 !!end
21271
21272 !! test
21273 Lists: 7. Escape bullets in a multi-line context
21274 !! wikitext
21275 a
21276 <nowiki>*</nowiki>b
21277 !! html
21278 <p>a
21279 *b
21280 </p>
21281 !!end
21282
21283 !! test
21284 Lists: 8. Escape colons only if not present in tags
21285 !! options
21286 parsoid=html2wt
21287 !! html
21288 <dl><dt>a:b<i>c:d</i></dt></dl>
21289 !! wikitext
21290 ; <nowiki>a:b</nowiki>''c:d''
21291 !! end
21292
21293 #### --------------- HRs ---------------
21294 #### 1. Single line
21295 #### -----------------------------------
21296
21297 !! test
21298 HRs: 1. Single line
21299 !! wikitext
21300 ----<nowiki>----</nowiki>
21301 ----=foo=
21302 ----*foo
21303 !! html+tidy
21304 <hr />
21305 <p>----</p>
21306 <hr />
21307 <p>=foo=</p>
21308 <hr />
21309 <p>*foo</p>
21310 !! end
21311
21312 #### --------------- Tables ---------------
21313 #### 1a. Simple example
21314 #### 1b. No escaping needed (!foo)
21315 #### 1c. No escaping needed (|foo)
21316 #### 1d. No escaping needed (|}foo)
21317 ####
21318 #### 2a. Nested in td (<td>foo|bar</td>)
21319 #### 2b. Nested in td (<td>foo||bar</td>)
21320 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
21321 ####
21322 #### 3a. Nested in th (<th>foo!bar</th>)
21323 #### 3b. Nested in th (<th>foo!!bar</th>)
21324 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
21325 ####
21326 #### 4a. Escape -
21327 #### 4b. Escape +
21328 #### 4c. No escaping needed
21329 #### --------------------------------------
21330
21331 !! test
21332 Tables: 1a. Simple example
21333 !! wikitext
21334 <nowiki>{|
21335 |}</nowiki>
21336 !! html
21337 <p>{|
21338 |}
21339 </p>
21340 !! end
21341
21342 !! test
21343 Tables: 1b. No escaping needed
21344 !! wikitext
21345 !foo
21346 !! html
21347 <p>!foo
21348 </p>
21349 !! end
21350
21351 !! test
21352 Tables: 1c. No escaping needed
21353 !! wikitext
21354 |foo
21355 !! html
21356 <p>|foo
21357 </p>
21358 !! end
21359
21360 !! test
21361 Tables: 1d. No escaping needed
21362 !! wikitext
21363 |}foo
21364 !! html
21365 <p>|}foo
21366 </p>
21367 !! end
21368
21369 !! test
21370 Tables: 2a. Nested in td
21371 !! options
21372 parsoid=html2wt
21373 !! html/parsoid
21374 <table><tbody><tr>
21375 <td>foo|bar</td></tr>
21376 <tr><td>x<div>a|b</div></td>
21377 </tbody></table>
21378 !! wikitext
21379 {|
21380 |<nowiki>foo|bar</nowiki>
21381 |-
21382 |x<div><nowiki>a|b</nowiki></div>
21383 |}
21384 !! html/php+tidy
21385 <table>
21386 <tr>
21387 <td>foo|bar</td>
21388 </tr>
21389 <tr>
21390 <td>x
21391 <div>a|b</div>
21392 </td>
21393 </tr>
21394 </table>
21395 !! end
21396
21397 !! test
21398 Tables: 2b. Nested in td
21399 !! options
21400 parsoid=html2wt
21401 !! html/parsoid
21402 <table><tbody><tr>
21403 <td>foo||bar</td>
21404 <td>a<i>b||c</i></td>
21405 <td>a<i><div>b||c</div></i></td>
21406 </tr></tbody></table>
21407 !! wikitext
21408 {|
21409 |<nowiki>foo||bar</nowiki>
21410 |a''<nowiki>b||c</nowiki>''
21411 |a''<div><nowiki>b||c</nowiki></div>''
21412 |}
21413 !! html/php
21414 <table>
21415 <tr>
21416 <td>foo||bar
21417 </td>
21418 <td>a<i>b||c</i>
21419 </td>
21420 <td>a<i><div>b||c</div></i>
21421 </td></tr></table>
21422
21423 !! end
21424
21425 !! test
21426 Tables: 2c. Nested in td -- no escaping needed
21427 !! wikitext
21428 {|
21429
21430 |foo!!bar
21431 |}
21432 !! html/*
21433 <table>
21434
21435 <tr>
21436 <td>foo!!bar
21437 </td></tr></table>
21438
21439 !! end
21440
21441 !! test
21442 Tables: 3a. Nested in th
21443 !! wikitext
21444 {|
21445
21446 !foo!bar
21447 |}
21448 !! html/*
21449 <table>
21450
21451 <tr>
21452 <th>foo!bar
21453 </th></tr></table>
21454
21455 !! end
21456
21457 !! test
21458 Tables: 3b. Nested in th
21459 !! options
21460 parsoid=html2wt
21461 !! html/parsoid
21462 <table><tbody>
21463 <tr><th>foo!!bar</th>
21464 <th><i>foo|bar</i></th>
21465 <th><i>foo!!bar</i></th>
21466 <th><i><span>foo!!bar</span></i></th>
21467 </tr></tbody></table>
21468 !! wikitext
21469 {|
21470 !<nowiki>foo!!bar</nowiki>
21471 !''<nowiki>foo|bar</nowiki>''
21472 !''<nowiki>foo!!bar</nowiki>''
21473 !''<span><nowiki>foo!!bar</nowiki></span>''
21474 |}
21475 !! html/php
21476 <table>
21477 <tr>
21478 <th>foo!!bar
21479 </th>
21480 <th><i>foo|bar</i>
21481 </th>
21482 <th><i>foo!!bar</i>
21483 </th>
21484 <th><i><span>foo!!bar</span></i>
21485 </th></tr></table>
21486
21487 !! end
21488
21489 !! test
21490 Tables: 3c. Nested in th
21491 !! options
21492 parsoid=html2wt
21493 !! html/parsoid
21494 <table><tbody>
21495 <tr><th>foo||bar</th>
21496 <th><span typeof="mw:Nowiki">foo||bar</span></th>
21497 </tr></tbody></table>
21498 !! wikitext
21499 {|
21500 !<nowiki>foo||bar</nowiki>
21501 !<nowiki>foo||bar</nowiki>
21502 |}
21503 !! html/php
21504 <table>
21505 <tr>
21506 <th>foo||bar
21507 </th>
21508 <th>foo||bar
21509 </th></tr></table>
21510
21511 !! end
21512
21513 !! test
21514 Tables: 4a. Escape -
21515 !! options
21516 parsoid=html2wt
21517 !! html/*
21518 <table>
21519
21520 <tr>
21521 <th>-bar
21522 </th></tr>
21523 <tr>
21524 <td>-bar
21525 </td></tr></table>
21526
21527 !! wikitext
21528 {|
21529
21530 !-bar
21531
21532 |-
21533 |<nowiki>-bar</nowiki>
21534 |}
21535 !! end
21536
21537 !! test
21538 Tables: 4b. Escape +
21539 !! options
21540 parsoid=html2wt
21541 !! html/*
21542 <table>
21543
21544 <tr>
21545 <th>+bar
21546 </th></tr>
21547 <tr>
21548 <td>+bar
21549 </td></tr></table>
21550
21551 !! wikitext
21552 {|
21553
21554 !+bar
21555
21556 |-
21557 |<nowiki>+bar</nowiki>
21558 |}
21559 !! end
21560
21561 !! test
21562 Tables: 4c. No escaping needed
21563 !! wikitext
21564 {|
21565 |foo-bar
21566 |foo+bar
21567 |-
21568 |''foo''-bar
21569 |''foo''+bar
21570 |-
21571 |foo
21572 bar|baz
21573 +bar
21574 -bar
21575 |-
21576 |x
21577 <div>a|b</div>
21578 |}
21579 !! html/php
21580 <table>
21581 <tr>
21582 <td>foo-bar
21583 </td>
21584 <td>foo+bar
21585 </td></tr>
21586 <tr>
21587 <td><i>foo</i>-bar
21588 </td>
21589 <td><i>foo</i>+bar
21590 </td></tr>
21591 <tr>
21592 <td>foo
21593 <p>bar|baz
21594 +bar
21595 -bar
21596 </p>
21597 </td></tr>
21598 <tr>
21599 <td>x
21600 <div>a|b</div>
21601 </td></tr></table>
21602
21603 !! html/parsoid
21604 <table><tbody>
21605 <tr><td>foo-bar</td><td>foo+bar</td></tr>
21606 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
21607 <tr><td>foo
21608 <p>bar|baz
21609 +bar
21610 -bar</p></td></tr>
21611 <tr><td>x
21612 <div>a|b</div></td>
21613 </tbody></table>
21614 !! end
21615
21616 !! test
21617 Tables: 4d. No escaping needed
21618 !! wikitext
21619 {|
21620 |[[Foo]]-bar
21621 ||+1
21622 ||-2
21623 |}
21624 !! html/php
21625 <table>
21626 <tr>
21627 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
21628 </td>
21629 <td>+1
21630 </td>
21631 <td>-2
21632 </td></tr></table>
21633
21634 !! html/parsoid
21635 <table>
21636 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
21637 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
21638 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
21639 </tbody></table>
21640 !! end
21641
21642 !! test
21643 Tables: Digest broken attributes on table and tr tag
21644 !! options
21645 parsoid=wt2html
21646 !! wikitext
21647 {| || |} ++
21648 |- || || ++ --
21649 |- > [
21650 |}
21651 !! html
21652 <table>
21653 <tbody>
21654 <tr></tr>
21655 <tr></tr>
21656 </tbody></table>
21657 !! end
21658
21659 #### --------------- Links ----------------
21660 #### 1. Quote marks in link text
21661 #### 2. Wikilinks: Escapes needed
21662 #### 3. Wikilinks: No escapes needed
21663 #### 4. Extlinks: Escapes needed
21664 #### 5. Extlinks: No escapes needed
21665 #### --------------------------------------
21666 !! test
21667 Links 1. WikiLinks: No escapes needed
21668 !! wikitext
21669 [[Foo|Foo''boo'']]
21670 [[Foo|[Foobar]]]
21671 [[Foo|x [Foobar] x]]
21672 !! html/php
21673 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
21674 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
21675 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
21676 </p>
21677 !! html/parsoid
21678 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
21679 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
21680 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
21681 !! end
21682
21683 !! test
21684 Links 2. WikiLinks: Escapes needed
21685 !! options
21686 parsoid=html2wt
21687 !! html/parsoid
21688 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
21689 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
21690 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
21691 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
21692 <a href="Foo" rel="mw:WikiLink">|Bar</a>
21693 <a href="Foo" rel="mw:WikiLink">]]bar</a>
21694 <a href="Foo" rel="mw:WikiLink">[[bar</a>
21695 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
21696 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
21697 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
21698 !! wikitext
21699 [[Foo|<nowiki>Foobar]</nowiki>]]
21700 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
21701 [[Foo|<nowiki>[[Bar]]</nowiki>]]
21702 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
21703 [[Foo|<nowiki>|Bar</nowiki>]]
21704 [[Foo|<nowiki>]]bar</nowiki>]]
21705 [[Foo|<nowiki>[[bar</nowiki>]]
21706 [[Foo|<nowiki>x [[ y</nowiki>]]
21707 [[Foo|<nowiki>x ]] y</nowiki>]]
21708 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
21709 !! html/php
21710 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
21711 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
21712 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
21713 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
21714 <a href="/wiki/Foo" title="Foo">|Bar</a>
21715 <a href="/wiki/Foo" title="Foo">]]bar</a>
21716 <a href="/wiki/Foo" title="Foo">[[bar</a>
21717 <a href="/wiki/Foo" title="Foo">x [[ y</a>
21718 <a href="/wiki/Foo" title="Foo">x ]] y</a>
21719 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
21720 </p>
21721 !! end
21722
21723 !! test
21724 Links 3. WikiLinks: No escapes needed
21725 !! wikitext
21726 [[Foo|[Foobar]]
21727 [[Foo|foo|bar]]
21728 !! html/php
21729 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
21730 <a href="/wiki/Foo" title="Foo">foo|bar</a>
21731 </p>
21732 !! html/parsoid
21733 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
21734 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
21735 !! end
21736
21737 !! test
21738 Links 4. ExtLinks: Escapes needed
21739 !! options
21740 parsoid=html2wt
21741 !! html/parsoid
21742 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
21743 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
21744 <p>[http://google.com]</p>
21745 <p>[http://google.com google]</p>
21746 !! wikitext
21747 [http://google.com <nowiki>[google]</nowiki>]
21748 [http://google.com <nowiki>google]</nowiki>]
21749
21750 <nowiki>[http://google.com]</nowiki>
21751
21752 <nowiki>[http://google.com google]</nowiki>
21753
21754 !! html/php
21755 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
21756 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
21757 </p><p>[http://google.com]
21758 </p><p>[http://google.com google]
21759 </p>
21760 !! end
21761
21762 !! test
21763 Links 5. ExtLinks: No escapes needed
21764 !! wikitext
21765 [http://google.com [google]
21766 !! html/php
21767 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
21768 </p>
21769 !! html/parsoid
21770 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
21771 !! end
21772
21773 !! test
21774 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
21775 !! html/parsoid
21776 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
21777 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
21778 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
21779 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
21780 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
21781 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
21782 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
21783 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
21784 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
21785 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
21786 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
21787 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
21788 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
21789 </p>
21790 !! wikitext
21791 x<nowiki/>http://example.com<nowiki/>y
21792 http://example.com<nowiki/>?x
21793 http://example.com<nowiki/>&x
21794 http://example.com<nowiki/>'x
21795 http://example.com<nowiki/>,x
21796 http://example.com<nowiki/>.x
21797 http://example.com<nowiki/>;x
21798 http://example.com<nowiki/>:x
21799 http://example.com<nowiki/>;x
21800 http://example.com<nowiki/>!x
21801 http://example.com<nowiki/>=x
21802 http://example.com<nowiki/>(x)
21803 http://example.com(x<nowiki/>)
21804 !! end
21805
21806 !! test
21807 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
21808 !! html/parsoid
21809 <p>x
21810 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
21811 y
21812 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
21813 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
21814 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
21815 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
21816 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
21817 </p>
21818 !! wikitext
21819 x
21820 http://example.com
21821 y
21822 "http://example.com"
21823 (http://example.com)
21824 (http://example.com) foo
21825 http://example.com,
21826 http://example.com, foo
21827 !! html/php
21828 <p>x
21829 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
21830 y
21831 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
21832 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
21833 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
21834 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
21835 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
21836 </p>
21837 !! end
21838
21839 !! test
21840 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
21841 !! html/parsoid
21842 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
21843 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
21844 !! wikitext
21845 http://example.com.,;:!?\
21846 -http://example.com:
21847 !! html/php
21848 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
21849 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
21850 </p>
21851 !! end
21852
21853 !! test
21854 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
21855 !! html/parsoid
21856 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
21857 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
21858 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
21859 !! wikitext
21860 RFC 123<nowiki/>4
21861 RFC 123<nowiki/>y
21862 X<nowiki/>RFC 123<nowiki/>y
21863 !! end
21864
21865 !! test
21866 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
21867 !! html/parsoid
21868 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
21869 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
21870 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
21871 </p>
21872 !! wikitext
21873 RFC 123?foo
21874 RFC 123&foo
21875 -RFC 123-
21876 !! html/php
21877 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
21878 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
21879 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
21880 </p>
21881 !! end
21882
21883 !! test
21884 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
21885 !! html/parsoid
21886 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
21887 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
21888 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
21889 !! wikitext
21890 PMID 123<nowiki/>4
21891 PMID 123<nowiki/>y
21892 X<nowiki/>PMID 123<nowiki/>y
21893 !! end
21894
21895 !! test
21896 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
21897 !! html/parsoid
21898 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
21899 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
21900 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
21901 </p>
21902 !! wikitext
21903 PMID 123?foo
21904 PMID 123&foo
21905 -PMID 123-
21906 !! html/php
21907 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
21908 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
21909 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
21910 </p>
21911 !! end
21912
21913 !! test
21914 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
21915 !! html/parsoid
21916 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
21917 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
21918 a<a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
21919 </p>
21920 !! wikitext
21921 ISBN 1234567890<nowiki/>1
21922 ISBN 1234567890<nowiki/>x
21923 a<nowiki/>ISBN 1234567890<nowiki/>b
21924 !! end
21925
21926 !! test
21927 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
21928 !! html/parsoid
21929 <p>-<a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
21930 !! wikitext
21931 -ISBN 1234567890's
21932 !! html/php
21933 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
21934 </p>
21935 !! end
21936
21937 !! test
21938 Links 14. Protect link-like plain text. (Parsoid bug T78425)
21939 !! options
21940 parsoid=html2wt
21941 !! html/*
21942 <p>this is not a link: http://example.com
21943 </p>
21944 !! wikitext
21945 this is not a link: <nowiki>http://example.com</nowiki>
21946 !! end
21947
21948 !! test
21949 Links 15. Link trails can't become link prefixes.
21950 !! options
21951 language=is
21952 !! wikitext
21953 [[Söfnuður]]-[[00]]
21954 !! html/php
21955 <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>
21956 </p>
21957 !! html/parsoid
21958 <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>
21959 !! end
21960
21961 #### --------------- Quotes ---------------
21962 #### 1. Quotes inside <b> and <i>
21963 #### 2. Link fragments separated by <i> and <b> tags
21964 #### 3. Link fragments inside <i> and <b>
21965 #### 4. No escaping needed
21966 #### --------------------------------------
21967 !! test
21968 1a. Quotes inside <b> and <i>
21969 !! options
21970 parsoid=html2wt,wt2wt
21971 !! wikitext
21972 ''<nowiki/>'foo'''
21973 ''<nowiki>''foo''</nowiki>''
21974 ''<nowiki>'''foo'''</nowiki>''
21975 ''foo''<nowiki/>'s
21976 '''<nowiki/>'foo''''
21977 '''<nowiki>''foo''</nowiki>'''
21978 '''<nowiki>'''foo'''</nowiki>'''
21979 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
21980 '''foo'''<nowiki/>'s
21981 '''foo''
21982 ''foo''<nowiki/>'
21983 ''foo'''<nowiki/>'
21984 '''foo''<nowiki/>'
21985 ''''foo'''
21986 '''foo'''<nowiki/>'
21987 ''''foo'''<nowiki/>'
21988 ''fools'<span> errand</span>''
21989 ''<span>fool</span>'s errand''
21990 '<nowiki/>''foo'' bar '''baz''
21991 a|!*#-:;+-~[]{}b'''x''
21992 !! html/*
21993 <p><i>'foo'</i>
21994 <i>''foo''</i>
21995 <i>'''foo'''</i>
21996 <i>foo</i>'s
21997 <b>'foo'</b>
21998 <b>''foo''</b>
21999 <b>'''foo'''</b>
22000 <b>foo'<i>bar'</i>baz</b>
22001 <b>foo</b>'s
22002 '<i>foo</i>
22003 <i>foo</i>'
22004 <i>foo'</i>'
22005 '<i>foo</i>'
22006 '<b>foo</b>
22007 <b>foo</b>'
22008 '<b>foo</b>'
22009 <i>fools'<span> errand</span></i>
22010 <i><span>fool</span>'s errand</i>
22011 '<i>foo</i> bar '<i>baz</i>
22012 a|!*#-:;+-~[]{}b'<i>x</i>
22013 </p>
22014 !! end
22015
22016 !! test
22017 1b. Quotes inside <b> and <i> with other tags on same line
22018 !! options
22019 parsoid=html2wt,wt2wt
22020 !! wikitext
22021 '''a'' foo ''[[bar]]''
22022 ''a''' foo ''[[bar]]''
22023 ''a''' foo '''{{echo|[[bar]]}}'''
22024 [[foo]] x'''[[bar]]''
22025 '''foo'' <ref>test</ref>
22026 '''foo'' <div title="name">test</div>
22027 '''foo'' and <br> bar
22028 <references />
22029 !! html
22030 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
22031 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
22032 <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>
22033 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
22034 '<i>foo</i> <span class="reference" 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">[1]</a></span>
22035 '<i>foo</i> <div title="name">test</div>
22036 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
22037 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
22038 <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>
22039 </ol>
22040 !! end
22041
22042 !! test
22043 2. Link fragments separated by <i> and <b> tags
22044 !! wikitext
22045 [[''foo''<nowiki>hello]]</nowiki>
22046
22047 [['''foo'''<nowiki>hello]]</nowiki>
22048 !! html
22049 <p>[[<i>foo</i>hello]]
22050 </p><p>[[<b>foo</b>hello]]
22051 </p>
22052 !! end
22053
22054 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
22055 # this is one of the shortcomings of this format
22056 !! test
22057 3. Link fragments inside <i> and <b>
22058 !! wikitext
22059 ''[[foo''<nowiki>]]</nowiki>
22060
22061 '''[[foo'''<nowiki>]]</nowiki>
22062 !! html
22063 <p><i>[[foo</i>]]
22064 </p><p><b>[[foo</b>]]
22065 </p>
22066 !! end
22067
22068 !! test
22069 4. No escaping needed
22070 !! wikitext
22071 '<span>''bar''</span>'
22072 '<span>'''bar'''</span>'
22073 'a:b'foo
22074 !! html
22075 <p>'<span><i>bar</i></span>'
22076 '<span><b>bar</b></span>'
22077 'a:b'foo
22078 </p>
22079 !! end
22080
22081 #### ----------- Paragraphs ---------------
22082 #### 1. No unnecessary escapes
22083 #### --------------------------------------
22084
22085 !! test
22086 1. No unnecessary escapes
22087 !! wikitext
22088 bar <span><nowiki>[[foo]]</nowiki></span>
22089
22090 =bar <span><nowiki>[[foo]]</nowiki></span>
22091
22092 [[bar <span><nowiki>[[foo]]</nowiki></span>
22093
22094 ]]bar <span><nowiki>[[foo]]</nowiki></span>
22095
22096 =bar <span>foo]]</span><nowiki>=</nowiki>
22097 !! html
22098 <p>bar <span>[[foo]]</span>
22099 </p><p>=bar <span>[[foo]]</span>
22100 </p><p>[[bar <span>[[foo]]</span>
22101 </p><p>]]bar <span>[[foo]]</span>
22102 </p><p>=bar <span>foo]]</span>=
22103 </p>
22104 !!end
22105
22106 #### ----------------------- PRE --------------------------
22107 #### 1. Leading whitespace in SOL context should be escaped
22108 #### ------------------------------------------------------
22109 !! test
22110 1. Leading whitespace in SOL context should be escaped
22111 !! options
22112 parsoid
22113 !! wikitext
22114 <nowiki> </nowiki>a
22115
22116 <nowiki> </nowiki> a
22117
22118 <nowiki> </nowiki>a(tab)
22119
22120 <nowiki> </nowiki> a
22121 <!--cmt-->
22122 <nowiki> </nowiki> a
22123
22124 a
22125 <nowiki> </nowiki>b
22126
22127 a
22128 <nowiki> </nowiki>b
22129
22130 a
22131 <nowiki> </nowiki> b
22132 !! html
22133 <p> a</p>
22134 <p> a</p>
22135 <p> a(tab)</p>
22136 <p> a</p>
22137 <p><!--cmt--> a</p>
22138 <p>a
22139 b</p>
22140 <p>a
22141 b</p>
22142 <p>a
22143 b</p>
22144 !! end
22145
22146 !! test
22147 2. Leading whitespace in non-indent-pre contexts should not be escaped
22148 !! options
22149 parsoid
22150 !! wikitext
22151 foo <ref>''a''
22152 b</ref>
22153 <references />
22154 !! html
22155 <p>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></p>
22156 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22157 <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"><i data-parsoid='{"dsr":[9,14,2,2]}'>a</i>
22158 b</span></li>
22159 </ol>
22160 !! end
22161
22162 !! test
22163 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
22164 !! options
22165 parsoid
22166 !! wikitext
22167 <blockquote>
22168 a
22169 <span>b</span>
22170 c
22171 </blockquote>
22172 !! html
22173 <blockquote>
22174 <p>
22175 a
22176 <span>b</span>
22177 c</p>
22178 </blockquote>
22179 !! end
22180
22181 !! test
22182 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
22183 !! options
22184 parsoid
22185 !! wikitext
22186 [[File:Foobar.jpg|thumb|caption]]
22187 !! html/parsoid
22188 <figure class="mw-default-size" typeof="mw:Image/Thumb"><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="25" width="220"/></a><figcaption>caption</figcaption></figure>
22189 !! end
22190
22191 !! test
22192 5. Nowiki escaping should account for indent-pres
22193 !! options
22194 parsoid=html2wt
22195 !! html
22196 <pre>==foo==</pre>
22197 !! wikitext
22198 ==foo==
22199 !! end
22200
22201 #### --------------- Behavior Switches --------------------
22202 !! test
22203 1. Valid behavior switches should be escaped
22204 !! options
22205 parsoid=html2wt
22206 !! html
22207 __TOC__
22208 <i>__TOC__</i>
22209 !! wikitext
22210 <nowiki>__TOC__</nowiki>
22211 ''<nowiki>__TOC__</nowiki>''
22212 !! end
22213
22214 !! test
22215 2. Invalid behavior switches should not be escaped
22216 !! options
22217 parsoid=html2wt
22218 !! html
22219 __TOO__
22220 __|__
22221 !! wikitext
22222 __TOO__
22223 __|__
22224 !! end
22225
22226 #### --------------- HTML tags ---------------
22227 #### 1. a tags
22228 #### 2. other tags
22229 #### 3. multi-line html tag
22230 #### 4. extension tags
22231 #### -----------------------------------------
22232 !! test
22233 1. a tags
22234 !! options
22235 parsoid
22236 !! wikitext
22237 <a href="http://google.com">google</a>
22238 !! html
22239 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
22240 !! end
22241
22242 !! test
22243 2. other tags
22244 !! wikitext
22245 * <nowiki><div>foo</div></nowiki>
22246 * <nowiki><div style="color:red">foo</div></nowiki>
22247 * <nowiki><td></nowiki>
22248 !! html
22249 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
22250 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
22251 <li> &lt;td&gt;</li></ul>
22252
22253 !! end
22254
22255 !! test
22256 3. multi-line html tag
22257 !! wikitext
22258 <nowiki><div
22259 >foo</div
22260 ></nowiki>
22261 !! html
22262 <p>&lt;div
22263 &gt;foo&lt;/div
22264 &gt;
22265 </p>
22266 !! end
22267
22268 !! test
22269 4. extension tags
22270 !! wikitext
22271 <nowiki><ref>foo</ref></nowiki>
22272
22273 <nowiki><ref>bar</nowiki>
22274
22275 baz<nowiki></ref></nowiki>
22276 !! html
22277 <p>&lt;ref&gt;foo&lt;/ref&gt;
22278 </p><p>&lt;ref&gt;bar
22279 </p><p>baz&lt;/ref&gt;
22280 </p>
22281 !! end
22282
22283 #### --------------- Others ---------------
22284 !! test
22285 Escaping nowikis
22286 !! wikitext
22287 &lt;nowiki&gt;foo&lt;/nowiki&gt;
22288 !! html
22289 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
22290 </p>
22291 !! end
22292
22293 ## The quote-char in the input is necessary for triggering the bug
22294 !! test
22295 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
22296 !! options
22297 parsoid=wt2wt,html2wt
22298 !! wikitext
22299 foo's bar :
22300 !! html
22301 <p>foo's bar :</p>
22302 !! end
22303
22304 !! test
22305
22306 Tag-like HTML structures are passed through as text
22307 !! wikitext
22308 <x y>
22309
22310 <x.y>
22311
22312 <x-y>
22313
22314 1>2
22315
22316 x<y
22317
22318 a>b
22319
22320 1<d e>f
22321 !! html
22322 <p>&lt;x y&gt;
22323 </p><p>&lt;x.y&gt;
22324 </p><p>&lt;x-y&gt;
22325 </p><p>1&gt;2
22326 </p><p>x&lt;y
22327 </p><p>a&gt;b
22328 </p><p>1&lt;d e&gt;f
22329 </p>
22330 !! end
22331
22332 !! test
22333 HTML tag with necessary entities in attributes
22334 !! wikitext
22335 <span title="&amp;amp;">foo</span>
22336 !! html
22337 <p><span title="&amp;amp;">foo</span>
22338 </p>
22339 !! end
22340
22341 !! test
22342 HTML tag with 'unnecessary' entity encoding in attributes
22343 !! wikitext
22344 <span title="&amp;">foo</span>
22345 !! html
22346 <p><span title="&amp;">foo</span>
22347 </p>
22348 !! end
22349
22350 !! test
22351 HTML tag with broken attribute value quoting
22352 !! wikitext
22353 <span title="Hello world>Foo</span>
22354 !! html/php
22355 <p><span>Foo</span>
22356 </p>
22357 !! html/parsoid
22358 <p><span title="Hello world">Foo</span>
22359 </p>
22360 !! end
22361
22362 !! test
22363 Parsoid-only: HTML tag with broken attribute value quoting
22364 !! options
22365 parsoid
22366 !! wikitext
22367 <span title="Hello world>Foo</span>
22368 !! html
22369 <p><span title="Hello world">Foo</span>
22370 </p>
22371 !! end
22372
22373 !! test
22374 Table with broken attribute value quoting
22375 !! wikitext
22376 {|
22377 | title="Hello world|Foo
22378 |}
22379 !! html/php
22380 <table>
22381 <tr>
22382 <td>Foo
22383 </td></tr></table>
22384
22385 !! html/parsoid
22386 <table>
22387 <tr>
22388 <td title="Hello world">Foo
22389 </td></tr></table>
22390
22391 !! end
22392
22393 !! test
22394 Table with broken attribute value quoting on consecutive lines
22395 !! wikitext
22396 {|
22397 | title="Hello world|Foo
22398 | style="color:red|Bar
22399 |}
22400 !! html/php
22401 <table>
22402 <tr>
22403 <td>Foo
22404 </td>
22405 <td>Bar
22406 </td></tr></table>
22407
22408 !! html/parsoid
22409 <table><tbody>
22410 <tr>
22411 <td title="Hello world">Foo
22412 </td><td style="color: red">Bar
22413 </td></tr></tbody></table>
22414
22415 !! end
22416
22417 !! test
22418 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
22419 !! options
22420 parsoid
22421 !! wikitext
22422 {{}}
22423 !! html
22424 {{}}
22425 !! end
22426
22427 !! test
22428 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
22429 !! options
22430 parsoid
22431 !! wikitext
22432 }}{{
22433 !! html
22434 }}{{
22435 !! end
22436
22437 !!test
22438 Accept empty td cell attribute
22439 !! wikitext
22440 {|
22441 | align="center" | foo || |
22442 |}
22443 !! html
22444 <table>
22445 <tr>
22446 <td align="center"> foo </td>
22447 <td>
22448 </td></tr></table>
22449
22450 !!end
22451
22452 !!test
22453 Non-empty attributes in th-cells
22454 !! wikitext
22455 {|
22456 ! Foo !! style="color: red" | Bar
22457 |}
22458 !! html
22459 <table>
22460 <tr>
22461 <th> Foo </th>
22462 <th style="color: red"> Bar
22463 </th></tr></table>
22464
22465 !!end
22466
22467 !!test
22468 Accept empty attributes in th-cells
22469 !! wikitext
22470 {|
22471 !| foo !!| bar
22472 |}
22473 !! html
22474 <table>
22475 <tr>
22476 <th> foo </th>
22477 <th> bar
22478 </th></tr></table>
22479
22480 !!end
22481
22482 !!test
22483 Empty table rows go away
22484 !! wikitext
22485 {|
22486 | Hello
22487 | there
22488 |- class="foo"
22489 |-
22490 |}
22491 !! html
22492 <table>
22493 <tr>
22494 <td> Hello
22495 </td>
22496 <td> there
22497 </td></tr>
22498
22499 </table>
22500
22501 !! end
22502
22503 ###
22504 ### Parsoid-centric tests for testing RTing of inter-element separators
22505 ### Edge cases not tested by existing parser tests and specific to
22506 ### Parsoid-specific serialization strategies.
22507 ###
22508
22509 !!test
22510 RT-ed inter-element separators should be valid separators
22511 !! wikitext
22512 {|
22513 |- [[foo]]
22514 |}
22515 !! html
22516 <table>
22517
22518 </table>
22519
22520 !!end
22521
22522 # Parsoid-only since PHP parser relies on Tidy for correct output
22523 !!test
22524 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
22525 !!options
22526 parsoid
22527 !! wikitext
22528 {|
22529 |<small>foo
22530 bar
22531 |}
22532
22533 {|
22534 |<small>foo<small>
22535 |}
22536 !! html
22537 <table>
22538 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
22539 <p>bar</p></small></td></tr>
22540 </tbody></table>
22541
22542 <table>
22543 <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>
22544 </tbody></table>
22545 !!end
22546
22547 !!test
22548 Empty TD followed by TD with tpl-generated attribute
22549 !! wikitext
22550 {|
22551 |-
22552 |
22553 |{{echo|style='color:red'}}|foo
22554 |}
22555 !! html
22556 <table>
22557
22558 <tr>
22559 <td>
22560 </td>
22561 <td>foo
22562 </td></tr></table>
22563
22564 !!end
22565
22566 !!test
22567 Indented table with an empty td
22568 !! wikitext
22569 {|
22570 |-
22571 |
22572 |foo
22573 |}
22574 !! html
22575 <table>
22576
22577 <tr>
22578 <td>
22579 </td>
22580 <td>foo
22581 </td></tr></table>
22582
22583 !!end
22584
22585 ## We have some newline diffs RT-ing this edge case
22586 ## and it is not important enough -- we seem to be emitting
22587 ## at most 2 newlines after a </tr> and this is unrelated to
22588 ## the issue from T85627 that this is testing.
22589 !!test
22590 Indented table with blank lines in between (T85627)
22591 !! options
22592 parsoid=wt2html
22593 !! wikitext
22594 {|
22595 |foo
22596
22597
22598 |}
22599 !! html
22600 <table>
22601
22602 <tr>
22603 <td>foo
22604 </td></tr></table>
22605
22606 !!end
22607
22608 !!test
22609 Indented block & table
22610 !! wikitext
22611 <div>foo</div>
22612 {|
22613 |foo
22614 |}
22615 !! html/php
22616 <div>foo</div>
22617 <table>
22618 <tr>
22619 <td>foo
22620 </td></tr></table>
22621
22622 !! html/parsoid
22623 <div data-parsoid='{"stx":"html"}'>foo</div>
22624 <table><tbody>
22625 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
22626 </tbody></table>
22627 !!end
22628
22629 !! test
22630 Indent and comment before table row
22631 !! wikitext
22632 {|
22633 <!--hi-->|-
22634 | there
22635 |}
22636 !! html/php
22637 <table>
22638
22639 <tr>
22640 <td> there
22641 </td></tr></table>
22642
22643 !! html/parsoid
22644 <table>
22645 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
22646 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
22647 </tbody></table>
22648 !! end
22649
22650 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
22651 !!test
22652 Empty TR followed by a template-generated TR
22653 !!options
22654 parsoid
22655 !! wikitext
22656 {|
22657 |-
22658 {{echo|<tr><td>foo</td></tr>}}
22659 |}
22660 !! html
22661 <table>
22662 <tbody>
22663 <tr></tr>
22664 <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}}]}'>
22665 <td>foo</td></tr>
22666 </tbody></table>
22667 !!end
22668
22669 ## PHP and parsoid output differ for this, and since this is primarily
22670 ## for testing Parsoid's serializer, marking this Parsoid only
22671 !!test
22672 Empty TR followed by mixed-ws-comment line should RT correctly
22673 !!options
22674 parsoid
22675 !! wikitext
22676 {|
22677 |-
22678 <!--c-->
22679 |-
22680 <!--c--> <!--d-->
22681 |}
22682 !! html
22683 <table>
22684 <tbody>
22685 <tr></tr>
22686 <!--c-->
22687 <tr>
22688 <!--c--> </tr><!--d-->
22689 </tbody></table>
22690
22691 !!end
22692
22693 !!test
22694 Multi-line image caption generated by templates with/without trailing newlines
22695 !! wikitext
22696 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
22697 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
22698 !! html/parsoid
22699 <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>
22700 <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>
22701 !!end
22702
22703 !! test
22704 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
22705 !! options
22706 parsoid=html2wt
22707 !! html
22708 <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>
22709
22710 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
22711 !! wikitext
22712 <includeonly>foo</includeonly>
22713 new para
22714
22715 [[Category:Foo]]
22716
22717 = new heading =
22718 !! end
22719
22720 ## PHP emits broken html for this, and since this is primarily
22721 ## a Parsoid serializer test, marking this Parsoid only
22722 !!test
22723 Improperly nested inline or quotes tags with whitespace in between
22724 !!options
22725 parsoid
22726 !! wikitext
22727 <span> <s>x</span> </s>
22728 ''' ''x''' ''
22729 !! html
22730 <p><span> <s>x</s></span><s> </s>
22731 <b> <i>x</i></b><i> </i>
22732 </p>
22733 !!end
22734
22735 !!test
22736 Encapsulate protected attributes from wt
22737 !!options
22738 parsoid
22739 !! wikitext
22740 <div typeof="mw:placeholder stuff" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
22741 !! html
22742 <body><div data-x-typeof="mw:placeholder stuff" data-x-data-parsoid="weird" data-x-data-parsoid-other="no" data-x-about="time" data-x-rel="mw:true">foo</div>
22743 </body>
22744 !!end
22745
22746 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
22747 ## Having nested or stray pre tags results in the attempt to add duplicates,
22748 ## causing an assertion fail. This test tries to prevent that situation.
22749 !!test
22750 Ensure ParagraphWrapper can deal with stray closing pre tags
22751 !!options
22752 parsoid=wt2html
22753 !! wikitext
22754 plain text</pre>
22755 !! html
22756 plain text
22757 !!end
22758
22759 !!test
22760 1. Ensure fostered text content is wrapped in element nodes
22761 !!options
22762 parsoid=wt2html
22763 !! wikitext
22764 <table>hi</table><table>ho</table>
22765 !! html
22766 <p>hi</p>
22767 <table></table>
22768 <p>ho</p>
22769 <table></table>
22770 !!end
22771
22772 !!test
22773 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
22774 !!options
22775 parsoid=wt2html,wt2wt
22776 !! wikitext
22777 <table>
22778 <tr> || ||
22779 <td> a
22780 </table>
22781 !! html
22782 <p> || ||
22783 </p><table>
22784 <tbody><tr><td> a</td></tr>
22785 </tbody></table>
22786 !!end
22787
22788 !!test
22789 Encapsulation properly handles null DSR information from foster box
22790 !!options
22791 parsoid=wt2html,wt2wt
22792 !! wikitext
22793 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
22794 !! html
22795 <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>
22796 !!end
22797
22798 !!test
22799 1. Encapsulate foster-parented transclusion content
22800 !!options
22801 parsoid=wt2wt,wt2html
22802 !! wikitext
22803 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
22804 !! html
22805 <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>
22806 <tbody>
22807 <tr>
22808 <td>bar</td>
22809 </tr>
22810 </tbody>
22811 </table>
22812 !!end
22813
22814 !!test
22815 2. Encapsulate foster-parented transclusion content
22816 !!options
22817 parsoid=wt2wt,wt2html
22818 !! wikitext
22819 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
22820 !! html
22821 <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>
22822 <table>
22823 <tbody>
22824 <tr>
22825 <td>bar</td>
22826 </tr>
22827 </tbody>
22828 </table>
22829 !!end
22830
22831 !!test
22832 3. Encapsulate foster-parented transclusion content
22833 !!options
22834 parsoid=wt2wt,wt2html
22835 !! wikitext
22836 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
22837 !! html
22838 <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;]}">
22839 <p>foo</p>
22840 </div>
22841 <table>
22842 <tbody>
22843 <tr>
22844 <td>bar</td>
22845 </tr>
22846 </tbody>
22847 </table>
22848 !!end
22849
22850 !!test
22851 4. Encapsulate foster-parented transclusion content
22852 !!options
22853 parsoid=wt2wt,wt2html
22854 !! wikitext
22855 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
22856 !! html
22857 <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;]}">
22858 <p>foo</p>
22859 </div>
22860 <table>
22861 <tbody>
22862 <tr>
22863 <td>bar</td>
22864 </tr>
22865 </tbody>
22866 </table>
22867 !!end
22868
22869 !!test
22870 5. Encapsulate foster-parented transclusion content
22871 !!options
22872 parsoid=wt2wt,wt2html
22873 !! wikitext
22874 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
22875 !! html
22876 <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>
22877 <table>
22878 <tbody>
22879 <tr>
22880 <td>
22881 <div>
22882 <p>foo</p>
22883 </div>
22884 </td>
22885 </tr>
22886 </tbody>
22887 </table>
22888 !!end
22889
22890 !!test
22891 6. Encapsulate foster-parented transclusion content
22892 !!options
22893 parsoid=wt2wt,wt2html
22894 !! wikitext
22895 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
22896 !! html
22897 <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>
22898 <table>
22899 <tbody>
22900 <tr>
22901 <td>
22902 <div>
22903 <p>foo</p>
22904 </div>
22905 </td>
22906 </tr>
22907 </tbody>
22908 </table>
22909 <p>ok</p>
22910 !!end
22911
22912 !!test
22913 7. Encapsulate foster-parented transclusion content
22914 !!options
22915 parsoid=wt2wt,wt2html
22916 !! wikitext
22917 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
22918 !! html
22919 <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>
22920 <table>
22921 <tbody>
22922 <tr>
22923 <td>bar</td>
22924 </tr>
22925 </tbody>
22926 </table>
22927 !!end
22928
22929 !!test
22930 8. Encapsulate foster-parented transclusion content
22931 !!options
22932 parsoid=wt2wt,wt2html
22933 !! wikitext
22934 {{echo|a
22935 }}{|{{echo|style='color:red'}}
22936 |-
22937 |b
22938 |}
22939 !! html
22940 <p 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\n&quot;}},&quot;i&quot;:0}}]}">a</p><p typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;{|&quot;,{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;style&quot;:{&quot;wt&quot;:&quot;'color:red'&quot;}},&quot;i&quot;:0}},&quot;\n|-\n|b\n|}&quot;]}">{{{1}}}</p><table>
22941 <tbody>
22942 <tr>
22943 <td>b</td>
22944 </tr>
22945 </tbody>
22946 </table>
22947 !!end
22948
22949 !!test
22950 9. Encapsulate foster-parented transclusion content
22951 !!options
22952 parsoid=wt2wt,wt2html
22953 !! wikitext
22954 <table>{{echo|hi</table>hello}}
22955 !! html
22956 <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>
22957 !!end
22958
22959 !!test
22960 Table in fosterable position
22961 !!options
22962 parsoid=wt2html,wt2wt
22963 !! wikitext
22964 {{OpenTable}}
22965 <div>
22966 {|
22967 |}
22968 </div>
22969 |}
22970 !! html
22971 <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">
22972 </span>
22973 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
22974
22975 <table>
22976 </table>
22977 !!end
22978
22979 # Parsoid only for bug 64747
22980 !! test
22981 Properly encapsulate empty-content transclusions in fosterable positions
22982 !! wikitext
22983 <table>
22984 {{#if:|
22985 <td>foo</td>
22986 }}
22987 </table>
22988 !! html/parsoid
22989 <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":["","","",""]}]]}'>
22990
22991 </table>
22992 !! end
22993
22994 !!test
22995 Support <object> element with .data attribute
22996 !!options
22997 parsoid=html2wt
22998 !! html
22999 <object data="test.swf"></object>
23000 !! wikitext
23001 <object data="test.swf"></object>
23002 !!end
23003
23004 !! test
23005 Don't block XML namespace declaration
23006 !! wikitext
23007 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
23008 !! html/php
23009 <p><span>MediaWiki</span>
23010 </p>
23011 !! html/parsoid
23012 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
23013 !! end
23014
23015 # -----------------------------------------------------------------
23016 # The following section of tests are primarily to spec requirements
23017 # around serialization of new/edited content.
23018 #
23019 # All these tests are marked Parsoid html2wt and html2html only
23020 # ----------------------------------------------------------------
23021
23022 # 'mi' is a localinterwiki prefix as well as a language
23023 !! test
23024 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
23025 !! options
23026 parsoid=html2wt
23027 !! html
23028 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
23029 !! wikitext
23030 [[Foo]]
23031 !! end
23032
23033 # See T93839
23034 !! test
23035 New wikilinks should be serialized properly
23036 !! options
23037 parsoid=html2wt
23038 !! html
23039 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
23040 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
23041 !! wikitext
23042 [[Foo]]
23043 [[Foo]]
23044 !! end
23045
23046 !! test
23047 New wiki links (href variations)
23048 !! options
23049 parsoid=html2wt
23050 !! html
23051 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
23052 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
23053 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
23054 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
23055 !! wikitext
23056 [[Foo_bar]]
23057 [[Foo_bar]]
23058 [[Foo_bar]]
23059 [[Toxine bactérienne]]
23060 !! end
23061
23062 !! test
23063 New wiki links (content string variations)
23064 !! options
23065 parsoid=html2wt
23066 !! html
23067 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
23068 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
23069 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
23070 !! wikitext
23071 [[Foo_bar]]
23072 [[Foo bar]]
23073 [[Foo_bar|./Foo_bar]]
23074 !! end
23075
23076 !! test
23077 New category links (href variations)
23078 !! options
23079 parsoid=html2wt
23080 !! html
23081 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
23082 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
23083 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
23084 !! wikitext
23085 [[Category:Toxine bactérienne]]
23086 [[Category:Toxine bactérienne]]
23087 [[Category:Toxine bactérienne]]
23088 !! end
23089
23090 !! test
23091 New sol transparent links don't need indent-pre nowiki protection
23092 !! options
23093 parsoid=html2wt
23094 language=de
23095 !! html
23096 <link rel="mw:PageProp/redirect" href="./Main_Page">
23097 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
23098 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
23099 !! wikitext
23100 #WEITERLEITUNG [[Main Page]]
23101 <!-- this is good --> [[Category:Good]]
23102 <!-- this is great --> [[Kategorie:Great]]
23103 !! end
23104
23105 !! test
23106 New interlanguage links (href variations)
23107 !! options
23108 parsoid=html2wt
23109 !! html
23110 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
23111 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
23112 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
23113 !! wikitext
23114 [[es:Toxine bactérienne]]
23115 [[es:Toxine_bactérienne]]
23116 [[es:Toxine_bactérienne]]
23117 !! end
23118
23119 !! test
23120 Image: Modifying size of an image (1)
23121 !! options
23122 parsoid={
23123 "modes": ["wt2wt"],
23124 "changes": [
23125 ["img[height]", "attr", "height", "22"],
23126 ["img[width]", "attr", "width", "200"]
23127 ]
23128 }
23129 !! wikitext
23130 [[Image:Foobar.jpg|230x230px]]
23131 !! wikitext/edited
23132 [[Image:Foobar.jpg|200x200px]]
23133 !!end
23134
23135 !! test
23136 Image: Modifying size of an image (2)
23137 !! options
23138 parsoid={
23139 "modes": ["wt2wt"],
23140 "changes": [
23141 ["img[height]", "attr", "height", "100"],
23142 ["img[width]", "attr", "width", "500"]
23143 ]
23144 }
23145 !! wikitext
23146 [[Image:Foobar.jpg|230x230px]]
23147 !! wikitext/edited
23148 [[Image:Foobar.jpg|500x500px]]
23149 !!end
23150
23151 # Change in size is ignored so long as class='mw-default-size'
23152 !! test
23153 Image: Modifying size of an image (3)
23154 !! options
23155 parsoid={
23156 "modes": ["wt2wt"],
23157 "changes": [
23158 ["figure[class]", "removeClass", "mw-default-size"],
23159 ["figure img", "attr", "height", "19"],
23160 ["figure img", "attr", "width", "170"]
23161 ]
23162 }
23163 !! wikitext
23164 [[Image:Foobar.jpg|thumb]]
23165 !! wikitext/edited
23166 [[Image:Foobar.jpg|thumb|170x170px]]
23167 !!end
23168
23169 !! test
23170 Image: Modifying alignment of an image (bug 48665)
23171 !! options
23172 parsoid={
23173 "modes": ["wt2wt"],
23174 "changes": [
23175 ["figure[class]", "removeClass", "mw-halign-right"],
23176 ["figure[class]", "addClass", "mw-halign-left"]
23177 ]
23178 }
23179 !! wikitext
23180 [[Image:Foobar.jpg|thumb|caption|right]]
23181 !! wikitext/edited
23182 [[Image:Foobar.jpg|thumb|caption|left]]
23183 !! end
23184
23185 !! test
23186 Image: Modifying mw-default-size of an frameless image (bug 62805)
23187 !! options
23188 parsoid={
23189 "modes": ["wt2wt"],
23190 "changes": [
23191 ["figure.mw-default-size", "removeClass", "mw-default-size"]
23192 ]
23193 }
23194 !! wikitext
23195 [[Image:Foobar.jpg|frameless|right]]
23196 !! wikitext/edited
23197 [[Image:Foobar.jpg|frameless|right|220x220px]]
23198 !! end
23199
23200 !! test
23201 Image: Modifying valign of an image (bug 49221)
23202 !! options
23203 parsoid={
23204 "modes": ["wt2wt"],
23205 "changes": [
23206 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
23207 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
23208 ]
23209 }
23210 !! wikitext
23211 [[File:Foobar.jpg|20px|middle]]
23212 !! wikitext/edited
23213 [[File:Foobar.jpg|20px|text-top]]
23214 !! end
23215
23216 !! test
23217 Image: Modifying alt attribute of an image (bug 56400)
23218 !! options
23219 parsoid={
23220 "modes": ["wt2wt"],
23221 "changes": [
23222 ["img[alt]", "attr", "alt", "some alternate edited text"]
23223 ]
23224 }
23225 !! wikitext
23226 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
23227 !! wikitext/edited
23228 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
23229 !!end
23230
23231 !! test
23232 Image: Modifying caption of an image
23233 !! options
23234 parsoid={
23235 "modes": ["wt2wt"],
23236 "changes": [
23237 ["figcaption", "text", "new caption"]
23238 ]
23239 }
23240 !! wikitext
23241 [[Image:Foobar.jpg|thumb|original caption]]
23242 !! wikitext/edited
23243 [[Image:Foobar.jpg|thumb|new caption]]
23244 !!end
23245
23246 !! test
23247 Image: empty alt attribute (bug 48924)
23248 !! options
23249 parsoid
23250 !! wikitext
23251 [[File:Foobar.jpg|thumb|alt=|bar]]
23252 !! html
23253 <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>
23254 !! end
23255
23256 #!! test
23257 #Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
23258 #!! options
23259 #parsoid=html2wt
23260 #language=ar
23261 #!! html
23262 #<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>
23263 #!! wikitext
23264 #[[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
23265 #!! end
23266
23267 !! test
23268 Image: Block level image should have \n before and after
23269 !! wikitext
23270 123
23271 [[File:Foobar.jpg|right|thumb|150x150px]]
23272 456
23273 !! html/parsoid
23274 <p>123</p>
23275 <figure class="mw-halign-right" typeof="mw:Image/Thumb"><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="17" width="150"/></a></figure>
23276 <p>456</p>
23277 !!end
23278
23279 !! test
23280 Image: New block level image should have \n before and after (existing content)
23281 !! wikitext
23282 123
23283 [[File:Foobar.jpg|right|thumb|150x150px]]
23284 456
23285 !! html/parsoid
23286 <p>123</p>
23287 <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>
23288 <p>456</p>
23289 !!end
23290
23291 !! test
23292 Image: upright option (parsoid)
23293 !! options
23294 parsoid
23295 !! wikitext
23296 [[File:Foobar.jpg|thumb|upright|caption]]
23297 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
23298 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
23299 !! html
23300 <figure class="mw-default-size" typeof="mw:Image/Thumb"><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="19" width="170"/></a><figcaption>caption</figcaption></figure>
23301 <figure class="mw-default-size" typeof="mw:Image/Thumb"><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="12" width="110"/></a><figcaption>caption</figcaption></figure>
23302 <figure typeof="mw:Image/Thumb"><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="57" width="500"/></a><figcaption>caption</figcaption></figure>
23303 !!end
23304
23305 !! test
23306 Image: upright option is ignored on inline and frame images (parsoid)
23307 !! options
23308 parsoid
23309 !! wikitext
23310 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
23311 !! html
23312 <p><span 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="57" width="500"/></a></span></p>
23313 !!end
23314
23315 !! test
23316 Image: from basic HTML (1)
23317 !! options
23318 parsoid=html2wt
23319 !! html/parsoid
23320 <span typeof="mw:Image">
23321 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
23322 </span>
23323 !! wikitext
23324 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
23325 !! end
23326
23327 !! test
23328 Image: from basic HTML (2)
23329 !! options
23330 parsoid=html2wt
23331 !! html/parsoid
23332 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
23333 !! wikitext
23334 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
23335 !! end
23336
23337 !! test
23338 Image: from basic HTML (3)
23339 !! options
23340 parsoid=html2wt
23341 !! html/parsoid
23342 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
23343 !! wikitext
23344 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
23345 !! end
23346
23347 !! test
23348 Image: from basic HTML (4)
23349 !! options
23350 parsoid=html2wt
23351 !! html/parsoid
23352 <img src="./File:Foobar.jpg">
23353 !! wikitext
23354 [[File:Foobar.jpg|link=]]
23355 !! end
23356
23357 !! test
23358 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
23359 !! options
23360 parsoid=html2wt
23361 !! html
23362 <ul>
23363 <li><p>foo</p></li>
23364 </ul>
23365 !! wikitext
23366 * foo
23367 !! end
23368
23369 !! test
23370 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
23371 !! options
23372 parsoid=html2wt
23373 !! html
23374 <ul> <li>foo</li></ul>
23375 !! wikitext
23376 * foo
23377 !! end
23378
23379 !! test
23380 Don't strip leading whitespace when handling indent-pre suppressing tags
23381 !! options
23382 parsoid=html2wt
23383 !! html
23384 <table>
23385 <tr><td> indented row</td></tr>
23386 </table>
23387 <blockquote><p>
23388 <b>This is very bold of you!</b>
23389 </p>
23390 <table><tr><td>
23391 indented cell (no pre-wrapping!)
23392 </td></tr></table>
23393 </blockquote>
23394 <p>foo</p>
23395 <div>bar</div>
23396 !! wikitext
23397 {|
23398 | indented row
23399 |}
23400 <blockquote>
23401 '''This is very bold of you!'''
23402
23403 {|
23404 |
23405 indented cell (no pre-wrapping!)
23406 |}
23407 </blockquote>
23408 foo
23409 <div>bar</div>
23410 !! end
23411
23412 !! test
23413 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
23414 !! options
23415 parsoid=html2wt
23416 !! wikitext
23417 foo
23418 <nowiki> </nowiki><span>bar</span>
23419
23420 <span>foo2
23421 <nowiki> </nowiki></span>bar2
23422
23423 <div>foo</div>
23424 <nowiki> </nowiki><span>bar</span>
23425
23426 <div>
23427 <nowiki> </nowiki><span>foo</span>
23428 </div>
23429 !! html
23430 <p>foo</p>
23431 <span>bar</span>
23432
23433 <span>foo2
23434 </span>bar2
23435
23436 <div>foo</div>
23437 <span>bar</span>
23438
23439 <div>
23440 <span>foo</span>
23441 </div>
23442 !! end
23443
23444 !! test
23445 Lists: Add space after bullets
23446 !! options
23447 parsoid=html2wt
23448 !! html
23449 <ul>
23450 <li>foo</li>
23451 <li> bar</li>
23452 <li><span> baz</span></li>
23453 </ul>
23454 !! wikitext
23455 * foo
23456 * bar
23457 * <span> baz</span>
23458 !! end
23459
23460 !! test
23461 Lists: Dont insert newlines in a serialized list item.
23462 !! options
23463 parsoid=html2wt
23464 !! html
23465 <ul><li>a<br>b</li><li>c</li></ul>
23466 !! wikitext
23467 * a<br>b
23468 * c
23469 !! end
23470
23471 !! test
23472 Headings: Add space before/after == (Bug 51744)
23473 !! options
23474 parsoid=html2wt
23475 !! html
23476 <h2>foo</h2>
23477 <h2> bar</h2>
23478 <h2>baz </h2>
23479 <h2><span> baz</span></h2>
23480 !! wikitext
23481 == foo ==
23482
23483 == bar ==
23484
23485 == baz ==
23486
23487 == <span> baz</span> ==
23488 !! end
23489
23490 !! test
23491 Headings: Force metas to serialize before/after
23492 !! options
23493 parsoid=html2wt
23494 !! html
23495 <h2>hello there<link href="Category:A1" rel="mw:PageProp/Category" /></h2>
23496 <h2><link href="Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
23497
23498 <h2><!--foo--> <link href="Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
23499 !! wikitext
23500 == hello there ==
23501 [[Category:A1]]
23502
23503 [[Category:A2]]
23504 == hi pal ==
23505
23506 <!--foo--> [[Category:A3]]
23507 == how goes it ==
23508 !! end
23509
23510 !! test
23511 Parsoid: Serialize positional parameters with = in them as named parameter
23512 !! options
23513 parsoid=html2wt
23514 !! html
23515 <p about="#mwt1" typeof="mw:Transclusion"
23516 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
23517
23518 <p about="#mwt1" typeof="mw:Transclusion"
23519 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
23520
23521 <!--Orig params with data-parsoid has heuristics for handling = chars-->
23522 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
23523 <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>
23524 !! wikitext
23525 {{echo|1 = f=oo}}
23526
23527 {{echo|1 = f=oo|2 = bar}}
23528
23529 <!--Orig params with data-parsoid has heuristics for handling = chars-->
23530 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
23531 {{echo|<nowiki>f=oo</nowiki>|bar}}
23532 !! end
23533
23534 !! test
23535 Parsoid: Serialize positional parameters with = in extlink as named parameter
23536 !! options
23537 parsoid=html2wt
23538 !! html
23539 <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>
23540 !! wikitext
23541 {{echo|1 = http://stuff?is=ok}}
23542 !! end
23543
23544 !! test
23545 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
23546 !! options
23547 parsoid=html2wt
23548 !! html
23549 <div>a<p>b</p></div>
23550 <div>a
23551 <p>b</p></div>
23552 <div>
23553 a
23554 <p>b</p></div>
23555 !! wikitext
23556 <div>a
23557 b
23558 </div>
23559 <div>a
23560 b
23561 </div>
23562 <div>
23563 a
23564
23565 b
23566 </div>
23567 !! end
23568
23569 !! test
23570 Substrings resembling wikitext in hrefs should not get nowiki escapes
23571 !! options
23572 parsoid=html2wt
23573 !! html
23574 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
23575 !! wikitext
23576 [[Foo''bar''baz]]
23577 !! end
23578
23579 !! test
23580 Enforce single-line context in the serializer
23581 !! options
23582 parsoid=html2wt
23583 !! html
23584 <h2>testing
23585 123</h2>
23586
23587 <ul><li>asd
23588 sdf</li></ul>
23589 !! wikitext
23590 == testing 123 ==
23591
23592 * asd sdf
23593 !! end
23594
23595 #-----------------------------
23596 # I/B quote minimization tests
23597 #-----------------------------
23598
23599 !! test
23600 1. I/B quote minimization: wikitext-only tags should be combined
23601 !! options
23602 parsoid=html2wt
23603 !! html
23604 <p><i>A</i><i>B</i></p>
23605 <p><b>A</b><b>B</b></p>
23606 <p><i>A</i><b><i>B</i></b></p>
23607 <p><b>A</b><i><b>B</b></i></p>
23608 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
23609 <p><i><b>A</b></i><i><b>B</b></i></p>
23610 <p><i><b>A</b></i><b><i>B</i></b></p>
23611 <p><b><i>A</i></b><i><b>B</b></i></p>
23612 !! wikitext
23613 ''AB''
23614
23615 '''AB'''
23616
23617 ''A'''B'''''
23618
23619 '''A''B'''''
23620
23621 '''A''BC''D'''
23622
23623 '''''AB'''''
23624
23625 '''''AB'''''
23626
23627 '''''AB'''''
23628 !! end
23629
23630 !! test
23631 2. I/B quote minimization: wikitext and html tags should not be combined
23632 !! options
23633 parsoid=html2wt
23634 !! html
23635 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
23636 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
23637 !! wikitext
23638 ''A''<i>B</i>
23639
23640 ''A''<nowiki/>'''<i>B</i>'''
23641 !! end
23642
23643 !! test
23644 3. I/B quote minimization: templated content stops minimization
23645 !! options
23646 parsoid=html2wt
23647 !! html
23648 <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>
23649 <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>
23650 !! wikitext
23651 ''A''{{echo|''B''}}
23652
23653 ''A''{{echo|'''''B'''''}}
23654 !! end
23655
23656 !! test
23657 4. I/B quote minimization: new content should be mimimized with adjacent old content
23658 !! options
23659 parsoid=html2wt
23660 !! html
23661 <p><i>A</i><i>B</i></p>
23662 <p><b>A</b><b>B</b></p>
23663 <p><i>A</i><b><i>B</i></b></p>
23664 !! wikitext
23665 ''AB''
23666
23667 '''AB'''
23668
23669 ''A'''B'''''
23670 !! end
23671
23672 !! test
23673 5a. Merge adjacent quote nodes if they've been edited
23674 !! options
23675 parsoid={
23676 "modes": ["wt2wt", "selser"],
23677 "changes": [
23678 ["p", "contents", "remove", ":contains('b')"]
23679 ]
23680 }
23681 !! wikitext
23682 ''a''b''c''
23683 !! wikitext/edited
23684 ''ac''
23685 !! end
23686
23687 !! test
23688 5b. Merge adjacent quote nodes if they've been edited
23689 !! options
23690 parsoid={
23691 "modes": ["wt2wt", "selser"],
23692 "changes": [
23693 ["#x", "remove"]
23694 ]
23695 }
23696 !! wikitext
23697 ''a''<span id="x">b</span>''c''
23698 !! wikitext/edited
23699 ''ac''
23700 !! end
23701
23702 #------------------------------------
23703 # End of I/B quote minimization tests
23704 #------------------------------------
23705
23706 !!test
23707 Bug 54262: New entities
23708 !! options
23709 parsoid=html2wt
23710 !! wikitext
23711 &nbsp;
23712 !! html
23713 <span typeof="mw:Entity">&nbsp;</span>
23714 !! end
23715
23716 ## Note that there is no wikitext output for 'unknownproperty' ##
23717 ## Unknown magic words are silently dropped ##
23718
23719 !! test
23720 Magic words
23721 !! options
23722 parsoid=html2wt
23723 !! html
23724 <meta property='mw:PageProp/toc' />
23725 <meta property='mw:PageProp/notoc' />
23726 <meta property='mw:PageProp/forcetoc' />
23727 <meta property='mw:PageProp/index' />
23728 <meta property='mw:PageProp/noindex' />
23729 <meta property='mw:PageProp/nogallery' />
23730 <meta property='mw:PageProp/noeditsection' />
23731 <meta property='mw:PageProp/notitleconvert' />
23732 <meta property='mw:PageProp/nocontentconvert' />
23733 <meta property='mw:PageProp/unknownproperty' />
23734 !! wikitext
23735 __TOC__
23736 __NOTOC__
23737 __FORCETOC__
23738 __INDEX__
23739 __NOINDEX__
23740 __NOGALLERY__
23741 __NOEDITSECTION__
23742 __NOTITLECONVERT__
23743 __NOCONTENTCONVERT__
23744 !! end
23745
23746 !! test
23747 Consecutive <pre>s should not get merged
23748 !! options
23749 parsoid=html2wt,html2html
23750 !! html
23751 <pre>a</pre><pre>b</pre>
23752
23753 <pre>c
23754 </pre><pre>
23755 d</pre>
23756
23757 <pre>e
23758
23759 </pre><pre>
23760
23761 f</pre>
23762 !! wikitext
23763 a
23764
23765 b
23766
23767 c
23768
23769 d
23770
23771 e
23772
23773
23774
23775 f
23776 !! end
23777
23778 !! test
23779 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
23780 !! options
23781 parsoid=html2wt
23782 !! html
23783 <a rel="mw:ExtLink" href="./Special:BookSources/1234567890">ISBN 1234567895</a>
23784 !! wikitext
23785 [[Special:BookSources/1234567890|ISBN 1234567895]]
23786 !! end
23787
23788 !! test
23789 Edited RFC links not serializable as RFC links should serialize as extlinks
23790 !! options
23791 parsoid=html2wt
23792 !! html
23793 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
23794 !! wikitext
23795 [//tools.ietf.org/html/rfc123 New RFC]
23796 !! end
23797
23798 !! test
23799 Edited PMID links not serializable as PMID links should serialize as extlinks
23800 !! options
23801 parsoid=html2wt
23802 !! html
23803 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
23804 !! wikitext
23805 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
23806 !! end
23807
23808 !! test
23809 WTS of autolinks with trailing/surrounding context
23810 !! options
23811 parsoid=html2wt
23812 !! html/parsoid
23813 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
23814 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
23815 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
23816 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
23817 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
23818 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
23819 !! wikitext
23820 http://cscott.net<nowiki/>'''foo'''
23821
23822 http://cscott.net<b>foo</b>
23823
23824 '''http://cscott.net<nowiki/>'''
23825
23826 '''http://cscott.net '''
23827
23828 '''http://cscott.net<nowiki/>x'''
23829
23830 http://cscott.net<nowiki/>x
23831 !! end
23832
23833 !! test
23834 WTS of autolinks with nowikis (round-trip)
23835 !! wikitext
23836 x<nowiki/>http://cscott.net<nowiki/>x
23837 !! html/parsoid
23838 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
23839 !! end
23840
23841 # this is the "easy" test because it leaves in place all the
23842 # data-parsoid information indicating this is an autolink
23843 !! test
23844 WTS of autolinks with escapes (editing)
23845 !! options
23846 parsoid={
23847 "modes": ["wt2wt"],
23848 "changes": [
23849 [ "meta", "remove" ]
23850 ]
23851 }
23852 !! wikitext
23853 x<nowiki/>http://cscott.net<nowiki/>x
23854 !! wikitext/edited
23855 x<nowiki/>http://cscott.net<nowiki/>x
23856 !! end
23857
23858 !! test
23859 Edited Redirect link should emit a non-piped wikitext link
23860 !! options
23861 parsoid=html2wt
23862 !! html
23863 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
23864 !! wikitext
23865 #REDIRECT [[Bar]]
23866 !! end
23867
23868 !! test
23869 T75121: Infer extension name from typeOf if data-mw is not present
23870 !! options
23871 parsoid=html2wt
23872 !! html
23873 <div typeOf="mw:Extension/foo"></div>
23874 !! wikitext
23875 <foo />
23876 !! end
23877
23878 # Note that the <p> wrapping isn't present in PHP parser output
23879 # The important thing for this test is that P-wrapping doesn't
23880 # interfere with the <nowiki> protection for leading - in <td>
23881 # (which isn't necessary for <th>).
23882 !! test
23883 T88318: p-wrapped dash in table.
23884 !! options
23885 parsoid=html2wt,wt2wt
23886 !! html/parsoid
23887 <table><tbody>
23888 <tr><th><p>-</p></th><th><p>- </p></th></tr>
23889 <tr><td><p>-</p></td><td><p>- </p></td></tr>
23890 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
23891 </tbody></table>
23892 !! wikitext
23893 {|
23894 !-
23895 !-
23896 |-
23897 |<nowiki>-</nowiki>
23898 |<nowiki>- </nowiki>
23899 |-
23900 |<small>-</small>
23901 |<br>
23902 -
23903 |<br>
23904 -
23905 |}
23906 !! html/php+tidy
23907 <table>
23908 <tr>
23909 <th>-</th>
23910 <th>-</th>
23911 </tr>
23912 <tr>
23913 <td>-</td>
23914 <td>-</td>
23915 </tr>
23916 <tr>
23917 <td><small>-</small></td>
23918 <td><br />
23919 <p>-</p>
23920 </td>
23921 <td><br />
23922 <p>-</p>
23923 </td>
23924 </tr>
23925 </table>
23926 !! end
23927
23928 !! test
23929 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
23930 !! options
23931 parsoid=html2wt
23932 !! html
23933 <table id='mwAb'>
23934 <td id='mwAc'>foo</td>
23935 <td id='serialize-this'>bar</td>
23936 </table>
23937 !! wikitext
23938 {|
23939 |foo
23940 | id="serialize-this" |bar
23941 |}
23942 !! end
23943
23944 !! test
23945 Parsoid-like element ids should not be serialized to wikitext unless shadowed
23946 !! options
23947 parsoid=html2wt
23948 !! html
23949 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
23950 !! wikitext
23951 <div id="hello">ok</div>
23952 !! end
23953
23954 !! test
23955 WTS change modes
23956 !! options
23957 parsoid={
23958 "modes": ["wt2wt"],
23959 "changes": [
23960 [ "#xyz", "before", "<b>before</b> stuff " ],
23961 [ "#xyz", "after", " stuff <i>after</i>" ],
23962 [ "#xyz", "html", "x <b>y</b> z" ]
23963 ]
23964 }
23965 !! wikitext
23966 <span id="xyz">hello</span>
23967 !! wikitext/edited
23968 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
23969 !! end
23970
23971 !! test
23972 Never serialize a-tag as html, regardless of what data-parsoid has to say
23973 !! options
23974 parsoid=html2wt
23975 !! html
23976 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
23977 !! wikitext
23978 [[Foo]]
23979 !! end
23980
23981 # -----------------------------------------------------------------
23982 # End of section for Parsoid-only html2wt tests for serialization
23983 # of new content
23984 # -----------------------------------------------------------------
23985
23986 # -----------------------------------------------------------------
23987 # The following section of tests are primarily to spec behavior of
23988 # the selective serializer. All these tests have manual selser
23989 # changes. The automated selser changes for all tests handle the
23990 # wide variation of changes, but these tests here capture specs
23991 # deterministically.
23992 # ----------------------------------------------------------------
23993
23994 ## T90517
23995 !! test
23996 1. Selser: New comments should not be lost
23997 !! options
23998 parsoid={
23999 "modes": ["selser"],
24000 "changes": [
24001 [ "#a", "after", "<!--c1-->" ],
24002 [ "#b", "before", "<!--c2-->" ]
24003 ]
24004 }
24005 !! wikitext
24006 <span id="a">a</span>
24007
24008 <span id="b">b</span>
24009 !! wikitext/edited
24010 <span id="a">a</span><!--c1-->
24011
24012 <!--c2--><span id="b">b</span>
24013 !! end
24014
24015 ## T89383
24016 !! test
24017 2. Selser: Check for validity of DSR before using it
24018 !! options
24019 parsoid={
24020 "modes": ["selser"],
24021 "changes": [
24022 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
24023 ]
24024 }
24025 !! wikitext
24026 <span id="a">a</span>
24027 !! wikitext/edited
24028 {{DISPLAYTITLE:foo}}
24029 <span id="a">a</span>
24030 !! end
24031
24032
24033 TODO:
24034 more images
24035 more tables
24036 character entities
24037 and much more
24038 Try for 100% code coverage