1670fe4cc5caacd79b61370bf9628b870c9b990c
[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 for heading containing <span id="..."></span> (T96153)
13749 !! wikitext
13750 __FORCETOC__
13751 ==<span id="old-anchor"></span>New title==
13752 !! html
13753 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13754 <ul>
13755 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
13756 </ul>
13757 </div>
13758
13759 <h2><span class="mw-headline" id="New_title"><span id="old-anchor"></span>New title</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: New title">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
13760
13761 !! end
13762
13763 !! test
13764 TOC with wgMaxTocLevel=3 (bug 6204)
13765 !! options
13766 wgMaxTocLevel=3
13767 !! wikitext
13768 == title 1 ==
13769 === title 1.1 ===
13770 ==== title 1.1.1 ====
13771 === title 1.2 ===
13772 == title 2 ==
13773 === title 2.1 ===
13774 !! html
13775 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13776 <ul>
13777 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
13778 <ul>
13779 <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>
13780 <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>
13781 </ul>
13782 </li>
13783 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
13784 <ul>
13785 <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>
13786 </ul>
13787 </li>
13788 </ul>
13789 </div>
13790
13791 <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>
13792 <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>
13793 <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>
13794 <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>
13795 <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>
13796 <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>
13797
13798 !! end
13799
13800 !! test
13801 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
13802 !! options
13803 wgMaxTocLevel=3
13804 !! wikitext
13805 ==Section 1==
13806 ===Section 1.1===
13807 ====Section 1.1.1====
13808 ====Section 1.1.1.1====
13809 ==Section 2==
13810 !! html
13811 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13812 <ul>
13813 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
13814 <ul>
13815 <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>
13816 </ul>
13817 </li>
13818 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
13819 </ul>
13820 </div>
13821
13822 <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>
13823 <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>
13824 <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>
13825 <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>
13826 <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>
13827
13828 !! end
13829
13830
13831 !! test
13832 Resolving duplicate section names
13833 !! wikitext
13834 == Foo bar ==
13835 == Foo bar ==
13836 !! html
13837 <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>
13838 <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>
13839
13840 !! end
13841
13842 !! test
13843 Resolving duplicate section names with differing case (bug 10721)
13844 !! wikitext
13845 == Foo bar ==
13846 == Foo Bar ==
13847 !! html
13848 <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>
13849 <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>
13850
13851 !! end
13852
13853 !! article
13854 Template:sections
13855 !! text
13856 ===Section 1===
13857 ==Section 2==
13858 !! endarticle
13859
13860 !! test
13861 Template with sections, __NOTOC__
13862 !! wikitext
13863 __NOTOC__
13864 ==Section 0==
13865 {{sections}}
13866 ==Section 4==
13867 !! html
13868 <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>
13869 <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>
13870 <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>
13871 <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>
13872
13873 !! end
13874
13875 !! test
13876 __NOEDITSECTION__ keyword
13877 !! wikitext
13878 __NOEDITSECTION__
13879 ==Section 1==
13880 ==Section 2==
13881 !! html
13882 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
13883 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
13884
13885 !! end
13886
13887 !! test
13888 Link inside a section heading
13889 !! wikitext
13890 ==Section with a [[Main Page|link]] in it==
13891 !! html
13892 <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>
13893
13894 !! end
13895
13896 !! test
13897 TOC regression (T14077)
13898 !! wikitext
13899 __TOC__
13900 == title 1 ==
13901 === title 1.1 ===
13902 == title 2 ==
13903 !! html
13904 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13905 <ul>
13906 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
13907 <ul>
13908 <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>
13909 </ul>
13910 </li>
13911 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
13912 </ul>
13913 </div>
13914
13915 <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>
13916 <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>
13917 <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>
13918
13919 !! end
13920
13921 !! test
13922 BUG 1219 URL next to image (good)
13923 !! wikitext
13924 http://example.com [[File:Foobar.jpg]]
13925 !! html/php
13926 <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>
13927 </p>
13928 !! html/parsoid
13929 <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>
13930 !!end
13931
13932 !! test
13933 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
13934 !! wikitext
13935 ===
13936 The line above must have a trailing space!
13937 === <!--
13938 --> <!-- -->
13939 But just in case it doesn't...
13940 !! html
13941 <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>
13942 <p>The line above must have a trailing space!
13943 </p>
13944 <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>
13945 <p>But just in case it doesn't...
13946 </p>
13947 !! end
13948
13949 !! test
13950 Header with special characters (bug 25462)
13951 !! wikitext
13952 The tooltips shall not show entities to the user (ie. be double escaped)
13953
13954 == text > text ==
13955 section 1
13956
13957 == text < text ==
13958 section 2
13959
13960 == text & text ==
13961 section 3
13962
13963 == text ' text ==
13964 section 4
13965
13966 == text " text ==
13967 section 5
13968 !! html
13969 <p>The tooltips shall not show entities to the user (ie. be double escaped)
13970 </p>
13971 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13972 <ul>
13973 <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>
13974 <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>
13975 <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>
13976 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
13977 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
13978 </ul>
13979 </div>
13980
13981 <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>
13982 <p>section 1
13983 </p>
13984 <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>
13985 <p>section 2
13986 </p>
13987 <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>
13988 <p>section 3
13989 </p>
13990 <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>
13991 <p>section 4
13992 </p>
13993 <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>
13994 <p>section 5
13995 </p>
13996 !! end
13997
13998 !! test
13999 Header with space, plus and underscore as entity
14000 !! wikitext
14001 Id should not contain + for spaces
14002
14003 == Space between Text ==
14004 section 1
14005
14006 == Space-Entity&#32;between&#32;Text ==
14007 section 2
14008
14009 == Plus+between+Text ==
14010 section 3
14011
14012 == Plus-Entity&#43;between&#43;Text ==
14013 section 4
14014
14015 == Underscore_between_Text ==
14016 section 5
14017
14018 == Underscore-Entity&#95;between&#95;Text ==
14019 section 6
14020
14021 [[#Space between Text]]
14022 [[#Space-Entity&#32;between&#32;Text]]
14023 [[#Plus+between+Text]]
14024 [[#Plus-Entity&#43;between&#43;Text]]
14025 [[#Underscore_between_Text]]
14026 [[#Underscore-Entity&#95;between&#95;Text]]
14027 !! html
14028 <p>Id should not contain + for spaces
14029 </p>
14030 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14031 <ul>
14032 <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>
14033 <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>
14034 <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>
14035 <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>
14036 <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>
14037 <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>
14038 </ul>
14039 </div>
14040
14041 <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>
14042 <p>section 1
14043 </p>
14044 <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>
14045 <p>section 2
14046 </p>
14047 <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>
14048 <p>section 3
14049 </p>
14050 <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>
14051 <p>section 4
14052 </p>
14053 <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>
14054 <p>section 5
14055 </p>
14056 <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>
14057 <p>section 6
14058 </p><p><a href="#Space_between_Text">#Space between Text</a>
14059 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
14060 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
14061 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
14062 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
14063 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
14064 </p>
14065 !! end
14066
14067 !! test
14068 Headers with excess '=' characters
14069 (Are similar tests necessary beyond the 1st level?)
14070 !! wikitext
14071 =foo==
14072 ==foo=
14073 =''italic'' heading==
14074 ==''italic'' heading=
14075 !! html
14076 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14077 <ul>
14078 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
14079 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
14080 <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>
14081 <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>
14082 </ul>
14083 </div>
14084
14085 <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>
14086 <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>
14087 <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>
14088 <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>
14089
14090 !! end
14091
14092 !! test
14093 HTML headers vs TOC (bug 23393)
14094 (__NOEDITSECTION__ for clearer output, doesn't matter here)
14095 !! wikitext
14096 <h1>Header 1</h1>
14097 == Header 1.1 ==
14098 == Header 1.2 ==
14099
14100 <h1>Header 2
14101 </h1>
14102 == Header 2.1 ==
14103 == Header 2.2 ==
14104 __NOEDITSECTION__
14105 !! html
14106 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14107 <ul>
14108 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
14109 <ul>
14110 <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>
14111 <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>
14112 </ul>
14113 </li>
14114 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
14115 <ul>
14116 <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>
14117 <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>
14118 </ul>
14119 </li>
14120 </ul>
14121 </div>
14122
14123 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
14124 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
14125 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
14126 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
14127 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
14128 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
14129
14130 !! end
14131
14132 !! test
14133 Single-line or multiline-comments can follow headings
14134 !! options
14135 parsoid=wt2html,wt2wt
14136 !! wikitext
14137 ==foo==<!---->
14138 ==bar==<!--c1-->
14139 ==baz==<!--
14140 c2
14141 c3-->
14142 !! html
14143 <h2><span class="mw-headline" id="foo">foo</span></h2>
14144 <h2><span class="mw-headline" id="bar">bar</span></h2>
14145 <h2><span class="mw-headline" id="baz">baz</span></h2>
14146
14147 !! end
14148
14149 !! test
14150 BUG 1219 URL next to image (broken)
14151 !! wikitext
14152 http://example.com[[File:Foobar.jpg]]
14153 !! html/php
14154 <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>
14155 </p>
14156 !! html/parsoid
14157 <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>
14158 !!end
14159
14160 !! test
14161 Bug 1186 news: in the middle of text
14162 !! wikitext
14163 http://en.wikinews.org/wiki/Wikinews:Workplace
14164 !! html
14165 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
14166 </p>
14167 !!end
14168
14169
14170 !! test
14171 Namespaced link must have a title
14172 !! wikitext
14173 [[Project:]]
14174 !! html
14175 <p>[[Project:]]
14176 </p>
14177 !!end
14178
14179 !! test
14180 Namespaced link must have a title (bad fragment version)
14181 !! wikitext
14182 [[Project:#fragment]]
14183 !! html
14184 <p>[[Project:#fragment]]
14185 </p>
14186 !!end
14187
14188
14189 ###
14190 ### HTML tags and HTML attributes
14191 ###
14192
14193 !! test
14194 div with no attributes
14195 !! wikitext
14196 <div>HTML rocks</div>
14197 !! html
14198 <div>HTML rocks</div>
14199
14200 !! end
14201
14202 !! test
14203 div with double-quoted attribute
14204 !! wikitext
14205 <div id="rock">HTML rocks</div>
14206 !! html
14207 <div id="rock">HTML rocks</div>
14208
14209 !! end
14210
14211 !! test
14212 div with single-quoted attribute
14213 !! wikitext
14214 <div id='rock'>HTML rocks</div>
14215 !! html
14216 <div id="rock">HTML rocks</div>
14217
14218 !! end
14219
14220 !! test
14221 div with unquoted attribute
14222 !! wikitext
14223 <div id=rock>HTML rocks</div>
14224 !! html
14225 <div id="rock">HTML rocks</div>
14226
14227 !! end
14228
14229 !! test
14230 div with illegal double attributes
14231 !! wikitext
14232 <div id="a" id="b">HTML rocks</div>
14233 !! html
14234 <div id="b">HTML rocks</div>
14235
14236 !!end
14237
14238 # FIXME: produce empty string instead of "class" in the PHP parser, following
14239 # the HTML5 spec.
14240 !! test
14241 div with empty attribute value, space before equals
14242 !! options
14243 parsoid
14244 !! wikitext
14245 <div class =>HTML rocks</div>
14246 !! html
14247 <div class="">HTML rocks</div>
14248
14249 !! end
14250
14251 !! test
14252 div with multiple empty attribute values
14253 !! options
14254 parsoid
14255 !! wikitext
14256 <div id= title=>HTML rocks</div>
14257 !! html
14258 <div id="" title="">HTML rocks</div>
14259
14260 !! end
14261
14262 !! test
14263 table with multiple empty attribute values
14264 !! options
14265 parsoid
14266 !! wikitext
14267 {| title= id=
14268 | hi
14269 |}
14270 !! html
14271 <table title="" id="">
14272 <tbody><tr><td> hi</td></tr>
14273 </tbody></table>
14274 !! end
14275
14276 !! test
14277 div with braces in attribute value
14278 !! wikitext
14279 <div title="{}">Foo</div>
14280 !! html/php
14281 <div title="&#123;}">Foo</div>
14282
14283 !! html/parsoid
14284 <div title="{}">Foo</div>
14285 !! end
14286
14287 # This it very inconsistent in the PHP parser: it returns
14288 # class="class" if there is a space between the name and the equal sign (see
14289 # 'div with empty attribute value, space before equals'), but strips the
14290 # attribute completely if the space is missing. We hope that not much content
14291 # depends on this, so are implementing the behavior below in Parsoid for
14292 # consistencies' sake.
14293 # FIXME: fix this behavior in the PHP parser?
14294 !! test
14295 div with empty attribute value, no space before equals
14296 !! options
14297 parsoid=wt2html,html2html
14298 !! wikitext
14299 <div class=>HTML rocks</div>
14300 !! html/php
14301 <div>HTML rocks</div>
14302
14303 !! html/parsoid
14304 <div class="">HTML rocks</div>
14305 !! end
14306
14307 !! test
14308 HTML multiple attributes correction
14309 !! wikitext
14310 <p class="error" class="awesome">Awesome!</p>
14311 !! html
14312 <p class="awesome">Awesome!</p>
14313
14314 !!end
14315
14316 !! test
14317 Table multiple attributes correction
14318 !! wikitext
14319 {|
14320 !+ class="error" class="awesome"| status
14321 |}
14322 !! html
14323 <table>
14324 <tr>
14325 <th class="awesome"> status
14326 </th></tr></table>
14327
14328 !!end
14329
14330 !! test
14331 DIV IN UPPERCASE
14332 !! wikitext
14333 <DIV ID="x">HTML ROCKS</DIV>
14334 !! html
14335 <div id="x">HTML ROCKS</div>
14336
14337 !!end
14338
14339 !! test
14340 Non-ASCII pseudo-tags are rendered as text
14341 !! wikitext
14342 <khyô>
14343 !! html
14344 <p>&lt;khyô&gt;
14345 </p>
14346 !! end
14347
14348 !! test
14349 Pseudo-tag with URL 'name' renders as url link
14350 !! wikitext
14351 <http://example.com/>
14352 !! html
14353 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
14354 </p>
14355 !! end
14356
14357 !! test
14358 text with amp in the middle of nowhere
14359 !! wikitext
14360 Remember AT&T?
14361 !! html
14362 <p>Remember AT&amp;T?
14363 </p>
14364 !! end
14365
14366 !! test
14367 text with character entity: eacute
14368 !! wikitext
14369 I always thought &eacute; was a cute letter.
14370 !! html
14371 <p>I always thought &#233; was a cute letter.
14372 </p>
14373 !! html+tidy
14374 <p>I always thought é was a cute letter.</p>
14375 !! end
14376
14377 !! test
14378 text with entity-escaped character entity-like string: eacute
14379 !! wikitext
14380 I always thought &amp;eacute; was a cute letter.
14381 !! html
14382 <p>I always thought &amp;eacute; was a cute letter.
14383 </p>
14384 !! end
14385
14386 !! test
14387 text with undefined character entity: xacute
14388 !! wikitext
14389 I always thought &xacute; was a cute letter.
14390 !! html
14391 <p>I always thought &amp;xacute; was a cute letter.
14392 </p>
14393 !! end
14394
14395 # TODO: generalize to PHP parser?
14396 !! test
14397 HTML5 tags
14398 !! options
14399 parsoid
14400 !! wikitext
14401 <data value="5">five</data>
14402 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
14403 <mark>This highlighted text</mark>
14404 !! html
14405 <p><data value="5">five</data>
14406 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
14407 <mark>This highlighted text</mark></p>
14408 !! end
14409
14410 !! test
14411 HTML tag with leading space is parsed as text
14412 !! wikitext
14413 < div>foo< /div>
14414 !! html
14415 <p>&lt; div&gt;foo&lt; /div&gt;
14416 </p>
14417 !! end
14418
14419 ###
14420 ### Nesting tests (see bug 41545, 50604, 51081)
14421 ###
14422
14423 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
14424 # Note that html2wt is considerably more difficult if we use <b> in
14425 # the test case, instead of <big>
14426 !! test
14427 Ensure that HTML adoption agency algorithm is properly implemented.
14428 !! wikitext
14429 <big>X<big>Y</big>Z</big>
14430 !! html
14431 <p><big>X<big>Y</big>Z</big>
14432 </p>
14433 !! end
14434
14435 # This was bug 41545 in the PHP parser.
14436 # Note that tidy doesn't handle this correctly.
14437 !! test
14438 Nesting of <kbd>
14439 !! wikitext
14440 <kbd>X<kbd>Y</kbd>Z</kbd>
14441 !! html
14442 <p><kbd>X<kbd>Y</kbd>Z</kbd>
14443 </p>
14444 !! end
14445
14446 # The following cases were bug 51081 in the PHP parser.
14447 # Note that there are some other nestable tags (b, i, etc) which are
14448 # not covered; see bug 51081 for discussion.
14449
14450 # Note that tidy doesn't handle this correctly.
14451 !! test
14452 Nesting of <em>
14453 !! wikitext
14454 <em>X<em>Y</em>Z</em>
14455 !! html
14456 <p><em>X<em>Y</em>Z</em>
14457 </p>
14458 !! end
14459
14460 # Note that tidy doesn't handle this correctly.
14461 !! test
14462 Nesting of <strong>
14463 !! wikitext
14464 <strong>X<strong>Y</strong>Z</strong>
14465 !! html
14466 <p><strong>X<strong>Y</strong>Z</strong>
14467 </p>
14468 !! end
14469
14470 !! test
14471 Nesting of <q>
14472 !! wikitext
14473 <q>X<q>Y</q>Z</q>
14474 !! html+tidy
14475 <p><q>X<q>Y</q>Z</q></p>
14476 !! end
14477
14478 # Note that tidy doesn't handle this correctly.
14479 !! test
14480 Nesting of <ruby>
14481 !! wikitext
14482 <ruby>X<ruby>Y</ruby>Z</ruby>
14483 !! html
14484 <p><ruby>X<ruby>Y</ruby>Z</ruby>
14485 </p>
14486 !! end
14487
14488 # Note that tidy doesn't handle this correctly.
14489 !! test
14490 Nesting of <bdo>
14491 !! wikitext
14492 <bdo>X<bdo>Y</bdo>Z</bdo>
14493 !! html
14494 <p><bdo>X<bdo>Y</bdo>Z</bdo>
14495 </p>
14496 !! end
14497
14498
14499 ###
14500 ### Media links
14501 ###
14502
14503 !! test
14504 Media link
14505 !! wikitext
14506 [[Media:Foobar.jpg]]
14507 !! html
14508 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
14509 </p>
14510 !! end
14511
14512 !! test
14513 Media link with text
14514 !! wikitext
14515 [[Media:Foobar.jpg|A neat file to look at]]
14516 !! html
14517 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
14518 </p>
14519 !! end
14520
14521 # FIXME: this is still bad HTML tag nesting
14522 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
14523 !! test
14524 Media link with nasty text
14525 !! wikitext
14526 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
14527 !! html
14528 <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>
14529
14530 !! html+tidy
14531 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
14532 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
14533 !! end
14534
14535 !! test
14536 Media link to nonexistent file (bug 1702)
14537 !! wikitext
14538 [[Media:No such.jpg]]
14539 !! html
14540 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
14541 </p>
14542 !! end
14543
14544 !! test
14545 Image link to nonexistent file (bug 1850 - good)
14546 !! wikitext
14547 [[File:No_such.jpg]]
14548 !! html/php
14549 <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>
14550 </p>
14551 !! html/parsoid
14552 <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>
14553 !! end
14554
14555 !! test
14556 :Image link to nonexistent file (bug 1850 - bad)
14557 !! wikitext
14558 [[:Image:No such.jpg]]
14559 !! html/php
14560 <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>
14561 </p>
14562 !! html/parsoid
14563 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
14564 !! end
14565
14566
14567
14568 !! test
14569 Character reference normalization in link text (bug 1938)
14570 !! wikitext
14571 [[Main Page|this&that]]
14572 !! html
14573 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
14574 </p>
14575 !!end
14576
14577 !! article
14578 אַ
14579 !! text
14580 Test for unicode normalization
14581
14582 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
14583 !! endarticle
14584
14585 !! test
14586 (bug 19451) Links should refer to the normalized form.
14587 !! wikitext
14588 [[&#xFB2E;]]
14589 [[&#x5d0;&#x5b7;]]
14590 [[&#x5d0;ַ]]
14591 [[א&#x5b7;]]
14592 [[אַ]]
14593 !! html
14594 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
14595 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
14596 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
14597 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
14598 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
14599 </p>
14600 !! end
14601
14602 !! test
14603 Empty attribute crash test (bug 2067)
14604 !! wikitext
14605 <font color="">foo</font>
14606 !! html
14607 <p><font color="">foo</font>
14608 </p>
14609 !! end
14610
14611 !! test
14612 Empty attribute crash test single-quotes (bug 2067)
14613 !! wikitext
14614 <font color=''>foo</font>
14615 !! html
14616 <p><font color="">foo</font>
14617 </p>
14618 !! end
14619
14620 !! test
14621 Attribute test: equals, then nothing
14622 !! wikitext
14623 <font color=>foo</font>
14624 !! html
14625 <p><font>foo</font>
14626 </p>
14627 !! end
14628
14629 !! test
14630 Attribute test: unquoted value
14631 !! wikitext
14632 <font color=x>foo</font>
14633 !! html
14634 <p><font color="x">foo</font>
14635 </p>
14636 !! end
14637
14638 !! test
14639 Attribute test: unquoted but illegal value (hash)
14640 !! wikitext
14641 <font color=#x>foo</font>
14642 !! html
14643 <p><font color="#x">foo</font>
14644 </p>
14645 !! end
14646
14647 !! test
14648 Attribute test: no value
14649 !! wikitext
14650 <font color>foo</font>
14651 !! html
14652 <p><font color="color">foo</font>
14653 </p>
14654 !! end
14655
14656 !! test
14657 Bug 2095: link with three closing brackets
14658 !! wikitext
14659 [[Main Page]]]
14660 !! html/php
14661 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
14662 </p>
14663 !! html/parsoid
14664 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
14665 !! end
14666
14667 !! test
14668 Bug 2095: link with pipe and three closing brackets
14669 !! wikitext
14670 [[Main Page|link]]]
14671 !! html/php
14672 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
14673 </p>
14674 !! html/parsoid
14675 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
14676 !! end
14677
14678 !! test
14679 Bug 2095: link with pipe and three closing brackets, version 2
14680 !! wikitext
14681 [[Main Page|[http://example.com/]]]
14682 !! html/php
14683 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
14684 </p>
14685 !! html/parsoid
14686 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
14687 !! end
14688
14689
14690 ###
14691 ### Safety
14692 ###
14693
14694 !! article
14695 Template:Dangerous attribute
14696 !! text
14697 " onmouseover="alert(document.cookie)
14698 !! endarticle
14699
14700 !! article
14701 Template:Dangerous style attribute
14702 !! text
14703 border-size: expression(alert(document.cookie))
14704 !! endarticle
14705
14706 !! article
14707 Template:Div style
14708 !! text
14709 <div style="float: right; {{{1}}}">Magic div</div>
14710 !! endarticle
14711
14712 !! test
14713 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
14714 !! wikitext
14715 <div title="{{test}}"></div>
14716 !! html
14717 <div title="This is a test template"></div>
14718
14719 !! end
14720
14721 # Parsoid has enough context to handle this case
14722 !! test
14723 Bug 2304: HTML attribute safety (dangerous template; 2309)
14724 !! wikitext
14725 <div title="{{dangerous attribute}}"></div>
14726 !! html/php
14727 <div title=""></div>
14728
14729 !! html/parsoid
14730 <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>
14731 !! end
14732
14733 !! test
14734 Bug 2304: HTML attribute safety (dangerous style template; 2309)
14735 !! wikitext
14736 <div style="{{dangerous style attribute}}"></div>
14737 !! html
14738 <div style="/* insecure input */"></div>
14739
14740 !! end
14741
14742 !! test
14743 Bug 2304: HTML attribute safety (safe parameter; 2309)
14744 !! wikitext
14745 {{div style|width: 200px}}
14746 !! html
14747 <div style="float: right; width: 200px">Magic div</div>
14748
14749 !! end
14750
14751 !! test
14752 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
14753 !! wikitext
14754 {{div style|width: expression(alert(document.cookie))}}
14755 !! html
14756 <div style="/* insecure input */">Magic div</div>
14757
14758 !! end
14759
14760 !! test
14761 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
14762 !! wikitext
14763 {{div style|"><script>alert(document.cookie)</script>}}
14764 !! html
14765 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
14766
14767 !! end
14768
14769 !! test
14770 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
14771 !! wikitext
14772 {{div style|" ><script>alert(document.cookie)</script>}}
14773 !! html
14774 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
14775
14776 !! end
14777
14778 !! test
14779 Bug 2304: HTML attribute safety (link)
14780 !! wikitext
14781 <div title="[[Main Page]]"></div>
14782 !! html
14783 <div title="&#91;&#91;Main Page]]"></div>
14784
14785 !! end
14786
14787 !! test
14788 Bug 2304: HTML attribute safety (italics)
14789 !! wikitext
14790 <div title="''foobar''"></div>
14791 !! html
14792 <div title="&#39;&#39;foobar&#39;&#39;"></div>
14793
14794 !! end
14795
14796 !! test
14797 Bug 2304: HTML attribute safety (bold)
14798 !! wikitext
14799 <div title="'''foobar'''"></div>
14800 !! html
14801 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
14802
14803 !! end
14804
14805
14806 !! test
14807 Bug 2304: HTML attribute safety (ISBN)
14808 !! wikitext
14809 <div title="ISBN 1234567890"></div>
14810 !! html
14811 <div title="&#73;SBN 1234567890"></div>
14812
14813 !! end
14814
14815 !! test
14816 Bug 2304: HTML attribute safety (RFC)
14817 !! wikitext
14818 <div title="RFC 1234"></div>
14819 !! html
14820 <div title="&#82;FC 1234"></div>
14821
14822 !! end
14823
14824 !! test
14825 Bug 2304: HTML attribute safety (PMID)
14826 !! wikitext
14827 <div title="PMID 1234567890"></div>
14828 !! html
14829 <div title="&#80;MID 1234567890"></div>
14830
14831 !! end
14832
14833 !! test
14834 Bug 2304: HTML attribute safety (web link)
14835 !! wikitext
14836 <div title="http://example.com/"></div>
14837 !! html
14838 <div title="http&#58;//example.com/"></div>
14839
14840 !! end
14841
14842 !! test
14843 Bug 2304: HTML attribute safety (named web link)
14844 !! wikitext
14845 <div title="[http://example.com/ link]"></div>
14846 !! html
14847 <div title="&#91;http&#58;//example.com/ link]"></div>
14848
14849 !! end
14850
14851 !! test
14852 Bug 3244: HTML attribute safety (extension; safe)
14853 !! wikitext
14854 <div style="<nowiki>background:blue</nowiki>"></div>
14855 !! html
14856 <div style="background:blue"></div>
14857
14858 !! end
14859
14860 !! test
14861 Bug 3244: HTML attribute safety (extension; unsafe)
14862 !! wikitext
14863 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
14864 !! html
14865 <div style="/* insecure input */"></div>
14866
14867 !! end
14868
14869 # More MSIE fun discovered by Tom Gilder
14870
14871 !! test
14872 MSIE CSS safety test: spurious slash
14873 !! wikitext
14874 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
14875 !! html
14876 <div style="/* insecure input */">evil</div>
14877
14878 !! end
14879
14880 !! test
14881 MSIE CSS safety test: hex code
14882 !! wikitext
14883 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
14884 !! html
14885 <div style="/* insecure input */">evil</div>
14886
14887 !! end
14888
14889 !! test
14890 MSIE CSS safety test: comment in url
14891 !! wikitext
14892 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
14893 !! html
14894 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
14895
14896 !! end
14897
14898 !! test
14899 MSIE CSS safety test: comment in expression
14900 !! wikitext
14901 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
14902 !! html
14903 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
14904
14905 !! end
14906
14907 !! test
14908 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
14909 !! wikitext
14910 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
14911 !! html
14912 <p style="/* invalid control char */">A</p>
14913
14914 !! end
14915
14916 !! test
14917 MSIE 6 CSS safety test: Fullwidth (bug 55332)
14918 !! wikitext
14919 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
14920 <div style="top:EXPRESSION(alert())">B</div>
14921 !! html
14922 <p style="/* insecure input */">A</p>
14923 <div style="/* insecure input */">B</div>
14924
14925 !! end
14926
14927 !! test
14928 MSIE 6 CSS safety test: IPA extensions (bug 55332)
14929 !! wikitext
14930 <div style="background-image:uʀʟ(javascript:alert())">A</div>
14931 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
14932 !! html
14933 <div style="/* insecure input */">A</div>
14934 <p style="/* insecure input */">B</p>
14935
14936 !! end
14937
14938 !! test
14939 MSIE 6 CSS safety test: sup/sub script (bug 55332)
14940 !! wikitext
14941 <div style="background-image:url⁽javascript:alert())">A</div>
14942 <div style="background-image:url₍javascript:alert())">B</div>
14943 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
14944 !! html
14945 <div style="/* insecure input */">A</div>
14946 <div style="/* insecure input */">B</div>
14947 <p style="/* insecure input */">C</p>
14948
14949 !! end
14950
14951 !! test
14952 Opera -o-link CSS
14953 !! wikitext
14954 <div
14955 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;"
14956 style="-o-link:attr(title);-o-link-source:current">X</div>
14957 !! html
14958 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
14959
14960 !! end
14961
14962 !! test
14963 MSIE 6 CSS safety test: Repetition markers (bug 55332)
14964 !! wikitext
14965 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
14966 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
14967 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
14968 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
14969 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
14970 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
14971 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
14972 !! html
14973 <p style="/* insecure input */">A</p>
14974 <p style="/* insecure input */">B</p>
14975 <p style="/* insecure input */">C</p>
14976 <p style="/* insecure input */">D</p>
14977 <p style="/* insecure input */">E</p>
14978 <p style="/* insecure input */">F</p>
14979 <p style="/* insecure input */">G</p>
14980
14981 !! end
14982
14983 !! test
14984 Table attribute legitimate extension
14985 !! wikitext
14986 {|
14987 !+ style="<nowiki>color:blue</nowiki>"| status
14988 |}
14989 !! html
14990 <table>
14991 <tr>
14992 <th style="color:blue"> status
14993 </th></tr></table>
14994
14995 !!end
14996
14997 !! test
14998 Table attribute safety
14999 !! wikitext
15000 {|
15001 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
15002 |}
15003 !! html
15004 <table>
15005 <tr>
15006 <th style="/* insecure input */"> status
15007 </th></tr></table>
15008
15009 !! end
15010
15011 !! test
15012 CSS line continuation 1
15013 !! wikitext
15014 <div style="background-image: u\&#10;rl(test.jpg);"></div>
15015 !! html
15016 <div style="/* insecure input */"></div>
15017
15018 !! end
15019
15020 !! test
15021 CSS line continuation 2
15022 !! wikitext
15023 <div style="background-image: u\&#13;rl(test.jpg); "></div>
15024 !! html
15025 <div style="/* insecure input */"></div>
15026
15027 !! end
15028
15029 !! article
15030 Template:Identity
15031 !! text
15032 {{{1}}}
15033 !! endarticle
15034
15035 !! test
15036 Expansion of multi-line templates in attribute values (bug 6255)
15037 !! wikitext
15038 <div style="background: {{identity|#00FF00}}">-</div>
15039 !! html
15040 <div style="background: #00FF00">-</div>
15041
15042 !! end
15043
15044
15045 !! test
15046 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
15047 !! wikitext
15048 <div style="background:
15049 #00FF00">-</div>
15050 !! html/php
15051 <div style="background: #00FF00">-</div>
15052
15053 !! html/parsoid
15054 <div style="background:
15055 #00FF00">-</div>
15056 !! end
15057
15058 !! test
15059 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
15060 !! wikitext
15061 <div style="background: &#10;#00FF00">-</div>
15062 !! html
15063 <div style="background: &#10;#00FF00">-</div>
15064
15065 !! end
15066
15067 !! test
15068 evil <math>-wiki-tags without Extension:Math enabled
15069 !! wikitext
15070 <math><img src="some evil external link"><script>some_evil_javascript();</script></math>
15071 !! html+tidy
15072 <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>
15073 !! end
15074
15075 ###
15076 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
15077 ###
15078 !! test
15079 Parser hook: empty input
15080 !! wikitext
15081 <tag></tag>
15082 !! html
15083 <pre>
15084 ''
15085 array (
15086 )
15087 </pre>
15088
15089 !! end
15090
15091 !! test
15092 Parser hook: empty input using terminated empty elements
15093 !! wikitext
15094 <tag/>
15095 !! html
15096 <pre>
15097 NULL
15098 array (
15099 )
15100 </pre>
15101
15102 !! end
15103
15104 !! test
15105 Parser hook: empty input using terminated empty elements (space before)
15106 !! wikitext
15107 <tag />
15108 !! html
15109 <pre>
15110 NULL
15111 array (
15112 )
15113 </pre>
15114
15115 !! end
15116
15117 !! test
15118 Parser hook: basic input
15119 !! wikitext
15120 <tag>input</tag>
15121 !! html
15122 <pre>
15123 'input'
15124 array (
15125 )
15126 </pre>
15127
15128 !! end
15129
15130
15131 !! test
15132 Parser hook: case insensitive
15133 !! wikitext
15134 <TAG>input</TAG>
15135 !! html
15136 <pre>
15137 'input'
15138 array (
15139 )
15140 </pre>
15141
15142 !! end
15143
15144
15145 !! test
15146 Parser hook: case insensitive, redux
15147 !! wikitext
15148 <TaG>input</TAg>
15149 !! html
15150 <pre>
15151 'input'
15152 array (
15153 )
15154 </pre>
15155
15156 !! end
15157
15158 !! test
15159 Parser hook: nested tags
15160 !! options
15161 noxml
15162 !! wikitext
15163 <tag><tag></tag></tag>
15164 !! html
15165 <pre>
15166 '<tag>'
15167 array (
15168 )
15169 </pre>&lt;/tag&gt;
15170
15171 !! end
15172
15173 !! test
15174 Parser hook: basic arguments
15175 !! wikitext
15176 <tag width=200 height = "100" depth = '50' square></tag>
15177 !! html
15178 <pre>
15179 ''
15180 array (
15181 'width' => '200',
15182 'height' => '100',
15183 'depth' => '50',
15184 'square' => 'square',
15185 )
15186 </pre>
15187
15188 !! end
15189
15190 !! test
15191 Parser hook: argument containing a forward slash (bug 5344)
15192 !! wikitext
15193 <tag filename='/tmp/bla'></tag>
15194 !! html
15195 <pre>
15196 ''
15197 array (
15198 'filename' => '/tmp/bla',
15199 )
15200 </pre>
15201
15202 !! end
15203
15204 !! test
15205 Parser hook: empty input using terminated empty elements (bug 2374)
15206 !! wikitext
15207 <tag foo=bar/>text
15208 !! html
15209 <pre>
15210 NULL
15211 array (
15212 'foo' => 'bar',
15213 )
15214 </pre>text
15215
15216 !! end
15217
15218 # </tag> should be output literally since there is no matching tag that begins it
15219 !! test
15220 Parser hook: basic arguments using terminated empty elements (bug 2374)
15221 !! wikitext
15222 <tag width=200 height = "100" depth = '50' square/>
15223 other stuff
15224 </tag>
15225 !! html
15226 <pre>
15227 NULL
15228 array (
15229 'width' => '200',
15230 'height' => '100',
15231 'depth' => '50',
15232 'square' => 'square',
15233 )
15234 </pre>
15235 <p>other stuff
15236 &lt;/tag&gt;
15237 </p>
15238 !! end
15239
15240 ###
15241 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
15242 ###
15243
15244 !! test
15245 Parser hook: static parser hook not inside a comment
15246 !! wikitext
15247 <statictag>hello, world</statictag>
15248 <statictag action=flush/>
15249 !! html
15250 <p>hello, world
15251 </p>
15252 !! end
15253
15254
15255 !! test
15256 Parser hook: static parser hook inside a comment
15257 !! wikitext
15258 <!-- <statictag>hello, world</statictag> -->
15259 <statictag action=flush/>
15260 !! html
15261 <p><br />
15262 </p>
15263 !! end
15264
15265 # Nested template calls; this case was broken by Parser.php rev 1.506,
15266 # since reverted.
15267
15268 !! article
15269 Template:One-parameter
15270 !! text
15271 (My parameter is: {{{1}}})
15272 !! endarticle
15273
15274 !! article
15275 Template:Map-one-parameter
15276 !! text
15277 {{{{{1}}}|{{{2}}}}}
15278 !! endarticle
15279
15280 !! test
15281 Nested template calls
15282 !! wikitext
15283 {{Map-one-parameter|One-parameter|param}}
15284 !! html
15285 <p>(My parameter is: param)
15286 </p>
15287 !! end
15288
15289
15290 ###
15291 ### Sanitizer
15292 ###
15293
15294 # HTML+Tidy effectively strips out the empty tags completely
15295 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
15296 # which Tidy would have done for the PHP parser had there been content inside it.
15297 !! test
15298 Sanitizer: Closing of open tags
15299 !! wikitext
15300 <s></s><table></table>
15301 !! html
15302 <s></s><table></table>
15303
15304 !! html/parsoid
15305 <p><s></s></p><table></table>
15306 !! end
15307
15308 !! test
15309 Sanitizer: Closing of open but not closed tags
15310 !! wikitext
15311 <s>foo
15312 !! html
15313 <p><s>foo</s>
15314 </p>
15315 !! end
15316
15317 !! test
15318 Sanitizer: Closing of closed but not open tags
15319 !! wikitext
15320 </s>
15321 !! html
15322 <p>&lt;/s&gt;
15323 </p>
15324 !! end
15325
15326 !! test
15327 Sanitizer: Closing of closed but not open table tags
15328 !! wikitext
15329 Table not started</td></tr></table>
15330 !! html
15331 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
15332 </p>
15333 !! end
15334
15335 !! test
15336 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
15337 !! wikitext
15338 <span id="æ: v">byte</span>[[#æ: v|backlink]]
15339 !! html
15340 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
15341 </p>
15342 !! end
15343
15344 # In HTML5, the restrictions are that id must contain at least one character,
15345 # and must not contain any space characters.
15346 !! test
15347 Sanitizer: Validating the contents of the id attribute (bug 4515)
15348 !! options
15349 disabled
15350 !! wikitext
15351 <br id="" /><br id="a space" />
15352 !! html
15353 Something ...
15354 !! end
15355
15356 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
15357 !! test
15358 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
15359 !! options
15360 disabled
15361 !! wikitext
15362 <br id="foo" /><br id="foo" />
15363 !! html
15364 Something need to be done. foo-2 ?
15365 !! end
15366
15367 !! test
15368 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
15369 !! wikitext
15370 <div itemscope>
15371 <meta itemprop="hello" content="world">
15372 <meta http-equiv="refresh" content="5">
15373 <meta itemprop="hello" http-equiv="refresh" content="5">
15374 <link itemprop="hello" href="{{SERVER}}">
15375 <link rel="stylesheet" href="{{SERVER}}">
15376 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
15377 </div>
15378 !! html
15379 <div itemscope="itemscope">
15380 <p> <meta itemprop="hello" content="world" />
15381 &lt;meta http-equiv="refresh" content="5"&gt;
15382 <meta itemprop="hello" content="5" />
15383 </p>
15384 <link itemprop="hello" href="http&#58;//example.org" />
15385 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
15386 <link itemprop="hello" href="http&#58;//example.org" />
15387 </div>
15388
15389 !! end
15390
15391 !! test
15392 Language converter: output gets cut off unexpectedly (bug 5757)
15393 !! options
15394 language=zh
15395 !! wikitext
15396 this bit is safe: }-
15397
15398 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
15399
15400 then we get cut off here: }-
15401
15402 all additional text is vanished
15403 !! html
15404 <p>this bit is safe: }-
15405 </p><p>but if we add a conversion instance: xxx
15406 </p><p>then we get cut off here: }-
15407 </p><p>all additional text is vanished
15408 </p>
15409 !! end
15410
15411 !! test
15412 Self closed html pairs (bug 5487)
15413 !! options
15414 !! wikitext
15415 <center><font id="bug" />Centered text</center>
15416 <div><font id="bug2" />In div text</div>
15417 !! html
15418 <center>&lt;font id="bug" /&gt;Centered text</center>
15419 <div>&lt;font id="bug2" /&gt;In div text</div>
15420
15421 !! end
15422
15423 #
15424 #
15425 #
15426
15427 !! test
15428 Punctuation: nbsp before exclamation
15429 !! wikitext
15430 C'est grave !
15431 !! html
15432 <p>C'est grave&#160;!
15433 </p>
15434 !! end
15435
15436 !! test
15437 Punctuation: CSS !important (bug 11874)
15438 !! wikitext
15439 <div style="width:50% !important">important</div>
15440 !! html
15441 <div style="width:50% !important">important</div>
15442
15443 !!end
15444
15445 !! test
15446 Punctuation: CSS ! important (bug 11874; with space after)
15447 !! wikitext
15448 <div style="width:50% ! important">important</div>
15449 !! html
15450 <div style="width:50% ! important">important</div>
15451
15452 !!end
15453
15454 !! test
15455 HTML bullet list, closed tags (bug 5497)
15456 !! wikitext
15457 <ul>
15458 <li>One</li>
15459 <li>Two</li>
15460 </ul>
15461 !! html/php
15462 <ul>
15463 <li>One</li>
15464 <li>Two</li>
15465 </ul>
15466
15467 !! html/parsoid
15468 <ul data-parsoid='{"stx":"html"}'>
15469 <li data-parsoid='{"stx":"html"}'>One</li>
15470 <li data-parsoid='{"stx":"html"}'>Two</li>
15471 </ul>
15472
15473 !! end
15474
15475 !! test
15476 HTML bullet list, unclosed tags (bug 5497)
15477 !! wikitext
15478 <ul>
15479 <li>One
15480 <li>Two
15481 </ul>
15482 !! html/php+tidy
15483 <ul>
15484 <li>One</li>
15485 <li>Two</li>
15486 </ul>
15487 !! html/parsoid
15488 <ul data-parsoid='{"stx":"html"}'>
15489 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
15490 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
15491 </ul>
15492
15493 !! end
15494
15495 !! test
15496 HTML ordered list, closed tags (bug 5497)
15497 !! wikitext
15498 <ol>
15499 <li>One</li>
15500 <li>Two</li>
15501 </ol>
15502 !! html/php
15503 <ol>
15504 <li>One</li>
15505 <li>Two</li>
15506 </ol>
15507
15508 !! html/parsoid
15509 <ol data-parsoid='{"stx":"html"}'>
15510 <li data-parsoid='{"stx":"html"}'>One</li>
15511 <li data-parsoid='{"stx":"html"}'>Two</li>
15512 </ol>
15513
15514 !! end
15515
15516 !! test
15517 HTML ordered list, unclosed tags (bug 5497)
15518 !! options
15519 !! wikitext
15520 <ol>
15521 <li>One
15522 <li>Two
15523 </ol>
15524 !! html/php+tidy
15525 <ol>
15526 <li>One</li>
15527 <li>Two</li>
15528 </ol>
15529 !! html/parsoid
15530 <ol data-parsoid='{"stx":"html"}'>
15531 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
15532 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
15533 </ol>
15534
15535 !! end
15536
15537 !! test
15538 HTML nested bullet list, closed tags (bug 5497)
15539 !! wikitext
15540 <ul>
15541 <li>One</li>
15542 <li>Two:
15543 <ul>
15544 <li>Sub-one</li>
15545 <li>Sub-two</li>
15546 </ul>
15547 </li>
15548 </ul>
15549 !! html
15550 <ul>
15551 <li>One</li>
15552 <li>Two:
15553 <ul>
15554 <li>Sub-one</li>
15555 <li>Sub-two</li>
15556 </ul>
15557 </li>
15558 </ul>
15559
15560 !! end
15561
15562 !! test
15563 HTML nested bullet list, open tags (bug 5497)
15564 !! wikitext
15565 <ul>
15566 <li>One
15567 <li>Two:
15568 <ul>
15569 <li>Sub-one
15570 <li>Sub-two
15571 </ul>
15572 </ul>
15573 !! html/php+tidy
15574 <ul>
15575 <li>One</li>
15576 <li>Two:
15577 <ul>
15578 <li>Sub-one</li>
15579 <li>Sub-two</li>
15580 </ul>
15581 </li>
15582 </ul>
15583 !! html/parsoid
15584 <ul>
15585 <li>One
15586 </li>
15587 <li>Two:
15588 <ul>
15589 <li>Sub-one
15590 </li>
15591 <li>Sub-two
15592 </li>
15593 </ul>
15594 </li>
15595 </ul>
15596
15597 !! end
15598
15599 !! test
15600 HTML nested ordered list, closed tags (bug 5497)
15601 !! wikitext
15602 <ol>
15603 <li>One</li>
15604 <li>Two:
15605 <ol>
15606 <li>Sub-one</li>
15607 <li>Sub-two</li>
15608 </ol>
15609 </li>
15610 </ol>
15611 !! html
15612 <ol>
15613 <li>One</li>
15614 <li>Two:
15615 <ol>
15616 <li>Sub-one</li>
15617 <li>Sub-two</li>
15618 </ol>
15619 </li>
15620 </ol>
15621
15622 !! end
15623
15624 !! test
15625 HTML nested ordered list, open tags (bug 5497)
15626 !! wikitext
15627 <ol>
15628 <li>One
15629 <li>Two:
15630 <ol>
15631 <li>Sub-one
15632 <li>Sub-two
15633 </ol>
15634 </ol>
15635 !! html/php
15636 <ol>
15637 <li>One
15638 <li>Two:
15639 <ol>
15640 <li>Sub-one
15641 <li>Sub-two
15642 </ol>
15643 </ol>
15644
15645 !! html/parsoid
15646 <ol>
15647 <li>One
15648 </li>
15649 <li>Two:
15650 <ol>
15651 <li>Sub-one
15652 </li>
15653 <li>Sub-two
15654 </li>
15655 </ol>
15656 </li>
15657 </ol>
15658
15659 !! end
15660
15661 !! test
15662 HTML ordered list item with parameters oddity
15663 !! wikitext
15664 <ol><li id="fragment">One</li>
15665 </ol>
15666 !! html
15667 <ol><li id="fragment">One</li>
15668 </ol>
15669
15670 !! end
15671
15672 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
15673 !!test
15674 bug 5918: autonumbering
15675 !! wikitext
15676 [http://first/] [http://second] [ftp://ftp]
15677
15678 ftp://inlineftp
15679
15680 [mailto:enclosed@mail.tld With target]
15681
15682 [mailto:enclosed@mail.tld]
15683
15684 mailto:inline@mail.tld
15685 !! html/php
15686 <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>
15687 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
15688 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
15689 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
15690 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
15691 </p>
15692 !! html/parsoid
15693 <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>
15694 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
15695 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
15696 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
15697 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
15698 !! end
15699
15700
15701 #
15702 # Security and HTML correctness
15703 # From Nick Jenkins' fuzz testing
15704 #
15705
15706 !! test
15707 Fuzz testing: Parser13
15708 !! wikitext
15709 {|
15710 | http://a|
15711 !! html
15712 <table>
15713 <tr>
15714 <td>
15715 </td>
15716 </tr>
15717 </table>
15718
15719 !! end
15720
15721 !! test
15722 Fuzz testing: Parser14
15723 !! wikitext
15724 == onmouseover= ==
15725 http://__TOC__
15726 !! html
15727 <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>
15728 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15729 <ul>
15730 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
15731 </ul>
15732 </div>
15733
15734
15735 !! html+tidy
15736 <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>
15737 <p>http://</p>
15738 <div id="toc" class="toc">
15739 <div id="toctitle">
15740 <h2>Contents</h2>
15741 </div>
15742 <ul>
15743 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
15744 </ul>
15745 </div>
15746 <p></p>
15747 !! end
15748
15749 !! test
15750 Fuzz testing: Parser14-table
15751 !! wikitext
15752 ==a==
15753 {| STYLE=__TOC__
15754 !! html
15755 <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>
15756 <table style="&#95;_TOC&#95;_">
15757 <tr><td></td></tr>
15758 </table>
15759
15760 !! html+tidy
15761 <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>
15762 <table style="__TOC__">
15763 <tr>
15764 <td></td>
15765 </tr>
15766 </table>
15767 !! end
15768
15769 # Known to produce bogus xml (extra </td>)
15770 !! test
15771 Fuzz testing: Parser16
15772 !! options
15773 noxml
15774 !! wikitext
15775 {|
15776 !https://||||||
15777 !! html
15778 <table>
15779 <tr>
15780 <th>https://</th>
15781 <th></th>
15782 <th></th>
15783 <th>
15784 </td>
15785 </tr>
15786 </table>
15787
15788 !! html+tidy
15789 <table>
15790 <tr>
15791 <th>https://</th>
15792 <th></th>
15793 <th></th>
15794 <th></th>
15795 </tr>
15796 </table>
15797 !! end
15798
15799 !! test
15800 Fuzz testing: Parser21
15801 !! wikitext
15802 {|
15803 ! irc://{{ftp://a" onmouseover="alert('hello world');"
15804 |
15805 !! html
15806 <table>
15807 <tr>
15808 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
15809 </th>
15810 <td>
15811 </td>
15812 </tr>
15813 </table>
15814
15815 !! end
15816
15817 !! test
15818 Fuzz testing: Parser22
15819 !! wikitext
15820 http://===r:::https://b
15821
15822 {|
15823 !! html
15824 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
15825 </p>
15826 <table>
15827 <tr><td></td></tr>
15828 </table>
15829
15830 !! end
15831
15832 # Known to produce bad XML for now
15833 !! test
15834 Fuzz testing: Parser24
15835 !! options
15836 noxml
15837 !! wikitext
15838 {|
15839 {{{|
15840 <u CLASS=
15841 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
15842 <br style="onmouseover='alert(document.cookie);' " />
15843
15844 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
15845 |
15846 !! html
15847 <table>
15848 {{{|
15849 <u class="&#124;">}}}} &gt;
15850 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
15851
15852 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
15853 <tr>
15854 <td></u>
15855 </td>
15856 </tr>
15857 </table>
15858
15859 !! end
15860
15861 # Note: the current result listed for this is not what the original one was,
15862 # but the original bug was JavaScript injection, which is fixed in any case.
15863 # It's not clear that the original result listed was any more correct than the
15864 # current one. Original result:
15865 # <p>{{{|
15866 # </p>
15867 # <li class="&#124;&#124;">
15868 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
15869 !!test
15870 Fuzz testing: Parser25 (bug 6055)
15871 !! wikitext
15872 {{{
15873 |
15874 <LI CLASS=||
15875 >
15876 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
15877 !! html
15878 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
15879 </p>
15880 !! end
15881
15882 !!test
15883 Fuzz testing: URL adjacent extension (with space, clean)
15884 !! wikitext
15885 http://example.com <nowiki>junk</nowiki>
15886 !! html/php
15887 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
15888 </p>
15889 !! html/parsoid
15890 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
15891 !! end
15892
15893 !!test
15894 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
15895 !! wikitext
15896 http://example.com<nowiki>junk</nowiki>
15897 !! html/php
15898 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
15899 </p>
15900 !! html/parsoid
15901 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
15902 !! end
15903
15904 !!test
15905 Fuzz testing: URL adjacent extension (no space, dirty; pre)
15906 !! wikitext
15907 http://example.com<pre>junk</pre>
15908 !! html/php
15909 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
15910
15911 !! html/php+tidy
15912 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
15913 <pre>
15914 junk
15915 </pre>
15916 !! html/parsoid
15917 <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>
15918 !!end
15919
15920 !!test
15921 Fuzz testing: image with bogus manual thumbnail
15922 !! wikitext
15923 [[Image:foobar.jpg|thumbnail= ]]
15924 !! html/php
15925 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
15926
15927 !! html/parsoid
15928 <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>
15929 !!end
15930
15931 !! test
15932 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
15933 !! wikitext
15934 <pre dir="&#10;"></pre>
15935 !! html
15936 <pre dir="&#10;"></pre>
15937
15938 !! end
15939
15940 !! test
15941 Parsing optional HTML elements (Bug 6171)
15942 !! options
15943 !! wikitext
15944 <table>
15945 <tr>
15946 <td> Some tabular data</td>
15947 <td> More tabular data ...
15948 <td> And yet som tabular data</td>
15949 </tr>
15950 </table>
15951 !! html
15952 <table>
15953 <tr>
15954 <td> Some tabular data</td>
15955 <td> More tabular data ...
15956 </td><td> And yet som tabular data</td>
15957 </tr>
15958 </table>
15959
15960 !! end
15961
15962 !! test
15963 Correct handling of <td>, <tr> (Bug 6171)
15964 !! options
15965 !! wikitext
15966 <table>
15967 <tr>
15968 <td> Some tabular data</td>
15969 <td> More tabular data ...</td>
15970 <td> And yet som tabular data</td>
15971 </tr>
15972 </table>
15973 !! html
15974 <table>
15975 <tr>
15976 <td> Some tabular data</td>
15977 <td> More tabular data ...</td>
15978 <td> And yet som tabular data</td>
15979 </tr>
15980 </table>
15981
15982 !! end
15983
15984
15985 !! test
15986 Parsing crashing regression (fr:JavaScript)
15987 !! wikitext
15988 </body></x>
15989 !! html
15990 <p>&lt;/body&gt;&lt;/x&gt;
15991 </p>
15992 !! end
15993
15994 !! test
15995 Inline wiki vs wiki block nesting
15996 !! wikitext
15997 '''Bold paragraph
15998
15999 New wiki paragraph
16000 !! html
16001 <p><b>Bold paragraph</b>
16002 </p><p>New wiki paragraph
16003 </p>
16004 !! end
16005
16006 # FIXME: The current php output is documented
16007 # and desired output is the parsoid target.
16008 !! test
16009 Inline HTML vs wiki block nesting
16010 !! wikitext
16011 <b>Bold paragraph
16012
16013 New wiki paragraph
16014 !! html/php
16015 <p><b>Bold paragraph
16016 </p><p>New wiki paragraph</b>
16017 </p>
16018 !! html/parsoid
16019 <p><b>Bold paragraph</b>
16020 </p><p>New wiki paragraph
16021 </p>
16022 !! end
16023
16024 # Original result was this:
16025 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
16026 # </p>
16027 # While that might be marginally more intuitive, maybe, the six-apostrophe
16028 # construct is clearly pathological and the result stated here (which is what
16029 # the parser actually does) is about as reasonable as anything.
16030 !!test
16031 Mixing markup for italics and bold
16032 !! options
16033 !! wikitext
16034 '''bold''''''bold''bolditalics'''''
16035 !! html
16036 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
16037 </p>
16038 !! end
16039
16040
16041 !! article
16042 Xyzzyx
16043 !! text
16044 Article for special page transclusion test
16045 !! endarticle
16046
16047 !! test
16048 Special page transclusion
16049 !! options
16050 !! wikitext
16051 {{Special:Prefixindex/Xyzzyx}}
16052 !! html
16053 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
16054
16055 !! end
16056
16057 !! test
16058 Special page transclusion twice (bug 5021)
16059 !! options
16060 !! wikitext
16061 {{Special:Prefixindex/Xyzzyx}}
16062 {{Special:Prefixindex/Xyzzyx}}
16063 !! html
16064 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
16065 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
16066
16067 !! end
16068
16069 !! test
16070 Transclusion of default MediaWiki message
16071 !! wikitext
16072 {{MediaWiki:Mainpage}}
16073 !! html
16074 <p>Main Page
16075 </p>
16076 !! end
16077
16078 !! test
16079 Transclusion of nonexistent MediaWiki message
16080 !! wikitext
16081 {{MediaWiki:Mainpagexxx}}
16082 !! html
16083 <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>
16084 </p>
16085 !! end
16086
16087 !! test
16088 Transclusion of MediaWiki message with underscore
16089 !! wikitext
16090 {{MediaWiki:history_short}}
16091 !! html
16092 <p>History
16093 </p>
16094 !! end
16095
16096 !! test
16097 Transclusion of MediaWiki message with space
16098 !! wikitext
16099 {{MediaWiki:history short}}
16100 !! html
16101 <p>History
16102 </p>
16103 !! end
16104
16105 !! test
16106 Invalid header with following text
16107 !! wikitext
16108 = x = y
16109 !! html
16110 <p>= x = y
16111 </p>
16112 !! end
16113
16114
16115 !! test
16116 Section extraction test (section 0)
16117 !! options
16118 section=0
16119 !! wikitext
16120 start
16121 ==a==
16122 ===aa===
16123 ====aaa====
16124 ==b==
16125 ===ba===
16126 ===bb===
16127 ====bba====
16128 ===bc===
16129 ==c==
16130 ===ca===
16131 !! html
16132 start
16133 !! end
16134
16135 !! test
16136 Section extraction test (section 1)
16137 !! options
16138 section=1
16139 !! wikitext
16140 start
16141 ==a==
16142 ===aa===
16143 ====aaa====
16144 ==b==
16145 ===ba===
16146 ===bb===
16147 ====bba====
16148 ===bc===
16149 ==c==
16150 ===ca===
16151 !! html
16152 ==a==
16153 ===aa===
16154 ====aaa====
16155 !! end
16156
16157 !! test
16158 Section extraction test (section 2)
16159 !! options
16160 section=2
16161 !! wikitext
16162 start
16163 ==a==
16164 ===aa===
16165 ====aaa====
16166 ==b==
16167 ===ba===
16168 ===bb===
16169 ====bba====
16170 ===bc===
16171 ==c==
16172 ===ca===
16173 !! html
16174 ===aa===
16175 ====aaa====
16176 !! end
16177
16178 !! test
16179 Section extraction test (section 3)
16180 !! options
16181 section=3
16182 !! wikitext
16183 start
16184 ==a==
16185 ===aa===
16186 ====aaa====
16187 ==b==
16188 ===ba===
16189 ===bb===
16190 ====bba====
16191 ===bc===
16192 ==c==
16193 ===ca===
16194 !! html
16195 ====aaa====
16196 !! end
16197
16198 !! test
16199 Section extraction test (section 4)
16200 !! options
16201 section=4
16202 !! wikitext
16203 start
16204 ==a==
16205 ===aa===
16206 ====aaa====
16207 ==b==
16208 ===ba===
16209 ===bb===
16210 ====bba====
16211 ===bc===
16212 ==c==
16213 ===ca===
16214 !! html
16215 ==b==
16216 ===ba===
16217 ===bb===
16218 ====bba====
16219 ===bc===
16220 !! end
16221
16222 !! test
16223 Section extraction test (section 5)
16224 !! options
16225 section=5
16226 !! wikitext
16227 start
16228 ==a==
16229 ===aa===
16230 ====aaa====
16231 ==b==
16232 ===ba===
16233 ===bb===
16234 ====bba====
16235 ===bc===
16236 ==c==
16237 ===ca===
16238 !! html
16239 ===ba===
16240 !! end
16241
16242 !! test
16243 Section extraction test (section 6)
16244 !! options
16245 section=6
16246 !! wikitext
16247 start
16248 ==a==
16249 ===aa===
16250 ====aaa====
16251 ==b==
16252 ===ba===
16253 ===bb===
16254 ====bba====
16255 ===bc===
16256 ==c==
16257 ===ca===
16258 !! html
16259 ===bb===
16260 ====bba====
16261 !! end
16262
16263 !! test
16264 Section extraction test (section 7)
16265 !! options
16266 section=7
16267 !! wikitext
16268 start
16269 ==a==
16270 ===aa===
16271 ====aaa====
16272 ==b==
16273 ===ba===
16274 ===bb===
16275 ====bba====
16276 ===bc===
16277 ==c==
16278 ===ca===
16279 !! html
16280 ====bba====
16281 !! end
16282
16283 !! test
16284 Section extraction test (section 8)
16285 !! options
16286 section=8
16287 !! wikitext
16288 start
16289 ==a==
16290 ===aa===
16291 ====aaa====
16292 ==b==
16293 ===ba===
16294 ===bb===
16295 ====bba====
16296 ===bc===
16297 ==c==
16298 ===ca===
16299 !! html
16300 ===bc===
16301 !! end
16302
16303 !! test
16304 Section extraction test (section 9)
16305 !! options
16306 section=9
16307 !! wikitext
16308 start
16309 ==a==
16310 ===aa===
16311 ====aaa====
16312 ==b==
16313 ===ba===
16314 ===bb===
16315 ====bba====
16316 ===bc===
16317 ==c==
16318 ===ca===
16319 !! html
16320 ==c==
16321 ===ca===
16322 !! end
16323
16324 !! test
16325 Section extraction test (section 10)
16326 !! options
16327 section=10
16328 !! wikitext
16329 start
16330 ==a==
16331 ===aa===
16332 ====aaa====
16333 ==b==
16334 ===ba===
16335 ===bb===
16336 ====bba====
16337 ===bc===
16338 ==c==
16339 ===ca===
16340 !! html
16341 ===ca===
16342 !! end
16343
16344 !! test
16345 Section extraction test (nonexistent section 11)
16346 !! options
16347 section=11
16348 !! wikitext
16349 start
16350 ==a==
16351 ===aa===
16352 ====aaa====
16353 ==b==
16354 ===ba===
16355 ===bb===
16356 ====bba====
16357 ===bc===
16358 ==c==
16359 ===ca===
16360 !! html
16361 !! end
16362
16363 !! test
16364 Section extraction test with bogus heading (section 1)
16365 !! options
16366 section=1
16367 !! wikitext
16368 ==a==
16369 ==bogus== not a legal section
16370 ==b==
16371 !! html
16372 ==a==
16373 ==bogus== not a legal section
16374 !! end
16375
16376 !! test
16377 Section extraction test with bogus heading (section 2)
16378 !! options
16379 section=2
16380 !! wikitext
16381 ==a==
16382 ==bogus== not a legal section
16383 ==b==
16384 !! html
16385 ==b==
16386 !! end
16387
16388 !! test
16389 Section extraction test with comment after heading (section 1)
16390 !! options
16391 section=1
16392 !! wikitext
16393 ==a==
16394 ==b== <!-- -->
16395 ==c==
16396 !! html
16397 ==a==
16398 !! end
16399
16400 !! test
16401 Section extraction test with comment after heading (section 2)
16402 !! options
16403 section=2
16404 !! wikitext
16405 ==a==
16406 ==b== <!-- -->
16407 ==c==
16408 !! html
16409 ==b== <!-- -->
16410 !! end
16411
16412 !! test
16413 Section extraction test with bogus <nowiki> heading (section 1)
16414 !! options
16415 section=1
16416 !! wikitext
16417 ==a==
16418 ==bogus== <nowiki>not a legal section</nowiki>
16419 ==b==
16420 !! html
16421 ==a==
16422 ==bogus== <nowiki>not a legal section</nowiki>
16423 !! end
16424
16425 !! test
16426 Section extraction test with bogus <nowiki> heading (section 2)
16427 !! options
16428 section=2
16429 !! wikitext
16430 ==a==
16431 ==bogus== <nowiki>not a legal section</nowiki>
16432 ==b==
16433 !! html
16434 ==b==
16435 !! end
16436
16437
16438 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
16439 # instead of respecting commented sections
16440 !! test
16441 Section extraction prefixed by comment (section 1)
16442 !! options
16443 section=1
16444 !! wikitext
16445 <!-- -->==sec1==
16446 ==sec2==
16447 !! html
16448 ==sec2==
16449 !!end
16450
16451 !! test
16452 Section extraction prefixed by comment (section 2)
16453 !! options
16454 section=2
16455 !! wikitext
16456 <!-- -->==sec1==
16457 ==sec2==
16458 !! html
16459
16460 !!end
16461
16462
16463 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
16464 # instead of respecting HTML-style headings
16465 !! test
16466 Section extraction, mixed wiki and html (section 1)
16467 !! options
16468 section=1
16469 !! wikitext
16470 <h2>unmarked</h2>
16471 unmarked
16472 ==1==
16473 one
16474 ==2==
16475 two
16476 !! html
16477 ==1==
16478 one
16479 !! end
16480
16481 !! test
16482 Section extraction, mixed wiki and html (section 2)
16483 !! options
16484 section=2
16485 !! wikitext
16486 <h2>unmarked</h2>
16487 unmarked
16488 ==1==
16489 one
16490 ==2==
16491 two
16492 !! html
16493 ==2==
16494 two
16495 !! end
16496
16497
16498 # Formerly testing for bug 3342
16499 !! test
16500 Section extraction, heading surrounded by <noinclude>
16501 !! options
16502 section=1
16503 !! wikitext
16504 <noinclude>==unmarked==</noinclude>
16505 ==marked==
16506 !! html
16507 ==marked==
16508 !!end
16509
16510 # Test behavior of bug 19910
16511 !! test
16512 Sectiion with all-equals
16513 !! options
16514 section=2
16515 !! wikitext
16516 ===
16517 The line above must have a trailing space
16518 === <!--
16519 --> <!-- -->
16520 But just in case it doesn't...
16521 !! html
16522 === <!--
16523 --> <!-- -->
16524 But just in case it doesn't...
16525 !! end
16526
16527 !! test
16528 Section replacement test (section 0)
16529 !! options
16530 replace=0,"xxx"
16531 !! wikitext
16532 start
16533 ==a==
16534 ===aa===
16535 ====aaa====
16536 ==b==
16537 ===ba===
16538 ===bb===
16539 ====bba====
16540 ===bc===
16541 ==c==
16542 ===ca===
16543 !! html
16544 xxx
16545
16546 ==a==
16547 ===aa===
16548 ====aaa====
16549 ==b==
16550 ===ba===
16551 ===bb===
16552 ====bba====
16553 ===bc===
16554 ==c==
16555 ===ca===
16556 !! end
16557
16558 !! test
16559 Section replacement test (section 1)
16560 !! options
16561 replace=1,"xxx"
16562 !! wikitext
16563 start
16564 ==a==
16565 ===aa===
16566 ====aaa====
16567 ==b==
16568 ===ba===
16569 ===bb===
16570 ====bba====
16571 ===bc===
16572 ==c==
16573 ===ca===
16574 !! html
16575 start
16576 xxx
16577
16578 ==b==
16579 ===ba===
16580 ===bb===
16581 ====bba====
16582 ===bc===
16583 ==c==
16584 ===ca===
16585 !! end
16586
16587 !! test
16588 Section replacement test (section 2)
16589 !! options
16590 replace=2,"xxx"
16591 !! wikitext
16592 start
16593 ==a==
16594 ===aa===
16595 ====aaa====
16596 ==b==
16597 ===ba===
16598 ===bb===
16599 ====bba====
16600 ===bc===
16601 ==c==
16602 ===ca===
16603 !! html
16604 start
16605 ==a==
16606 xxx
16607
16608 ==b==
16609 ===ba===
16610 ===bb===
16611 ====bba====
16612 ===bc===
16613 ==c==
16614 ===ca===
16615 !! end
16616
16617 !! test
16618 Section replacement test (section 3)
16619 !! options
16620 replace=3,"xxx"
16621 !! wikitext
16622 start
16623 ==a==
16624 ===aa===
16625 ====aaa====
16626 ==b==
16627 ===ba===
16628 ===bb===
16629 ====bba====
16630 ===bc===
16631 ==c==
16632 ===ca===
16633 !! html
16634 start
16635 ==a==
16636 ===aa===
16637 xxx
16638
16639 ==b==
16640 ===ba===
16641 ===bb===
16642 ====bba====
16643 ===bc===
16644 ==c==
16645 ===ca===
16646 !! end
16647
16648 !! test
16649 Section replacement test (section 4)
16650 !! options
16651 replace=4,"xxx"
16652 !! wikitext
16653 start
16654 ==a==
16655 ===aa===
16656 ====aaa====
16657 ==b==
16658 ===ba===
16659 ===bb===
16660 ====bba====
16661 ===bc===
16662 ==c==
16663 ===ca===
16664 !! html
16665 start
16666 ==a==
16667 ===aa===
16668 ====aaa====
16669 xxx
16670
16671 ==c==
16672 ===ca===
16673 !! end
16674
16675 !! test
16676 Section replacement test (section 5)
16677 !! options
16678 replace=5,"xxx"
16679 !! wikitext
16680 start
16681 ==a==
16682 ===aa===
16683 ====aaa====
16684 ==b==
16685 ===ba===
16686 ===bb===
16687 ====bba====
16688 ===bc===
16689 ==c==
16690 ===ca===
16691 !! html
16692 start
16693 ==a==
16694 ===aa===
16695 ====aaa====
16696 ==b==
16697 xxx
16698
16699 ===bb===
16700 ====bba====
16701 ===bc===
16702 ==c==
16703 ===ca===
16704 !! end
16705
16706 !! test
16707 Section replacement test (section 6)
16708 !! options
16709 replace=6,"xxx"
16710 !! wikitext
16711 start
16712 ==a==
16713 ===aa===
16714 ====aaa====
16715 ==b==
16716 ===ba===
16717 ===bb===
16718 ====bba====
16719 ===bc===
16720 ==c==
16721 ===ca===
16722 !! html
16723 start
16724 ==a==
16725 ===aa===
16726 ====aaa====
16727 ==b==
16728 ===ba===
16729 xxx
16730
16731 ===bc===
16732 ==c==
16733 ===ca===
16734 !! end
16735
16736 !! test
16737 Section replacement test (section 7)
16738 !! options
16739 replace=7,"xxx"
16740 !! wikitext
16741 start
16742 ==a==
16743 ===aa===
16744 ====aaa====
16745 ==b==
16746 ===ba===
16747 ===bb===
16748 ====bba====
16749 ===bc===
16750 ==c==
16751 ===ca===
16752 !! html
16753 start
16754 ==a==
16755 ===aa===
16756 ====aaa====
16757 ==b==
16758 ===ba===
16759 ===bb===
16760 xxx
16761
16762 ===bc===
16763 ==c==
16764 ===ca===
16765 !! end
16766
16767 !! test
16768 Section replacement test (section 8)
16769 !! options
16770 replace=8,"xxx"
16771 !! wikitext
16772 start
16773 ==a==
16774 ===aa===
16775 ====aaa====
16776 ==b==
16777 ===ba===
16778 ===bb===
16779 ====bba====
16780 ===bc===
16781 ==c==
16782 ===ca===
16783 !! html
16784 start
16785 ==a==
16786 ===aa===
16787 ====aaa====
16788 ==b==
16789 ===ba===
16790 ===bb===
16791 ====bba====
16792 xxx
16793
16794 ==c==
16795 ===ca===
16796 !!end
16797
16798 !! test
16799 Section replacement test (section 9)
16800 !! options
16801 replace=9,"xxx"
16802 !! wikitext
16803 start
16804 ==a==
16805 ===aa===
16806 ====aaa====
16807 ==b==
16808 ===ba===
16809 ===bb===
16810 ====bba====
16811 ===bc===
16812 ==c==
16813 ===ca===
16814 !! html
16815 start
16816 ==a==
16817 ===aa===
16818 ====aaa====
16819 ==b==
16820 ===ba===
16821 ===bb===
16822 ====bba====
16823 ===bc===
16824 xxx
16825 !! end
16826
16827 !! test
16828 Section replacement test (section 10)
16829 !! options
16830 replace=10,"xxx"
16831 !! wikitext
16832 start
16833 ==a==
16834 ===aa===
16835 ====aaa====
16836 ==b==
16837 ===ba===
16838 ===bb===
16839 ====bba====
16840 ===bc===
16841 ==c==
16842 ===ca===
16843 !! html
16844 start
16845 ==a==
16846 ===aa===
16847 ====aaa====
16848 ==b==
16849 ===ba===
16850 ===bb===
16851 ====bba====
16852 ===bc===
16853 ==c==
16854 xxx
16855 !! end
16856
16857 !! test
16858 Section replacement test with initial whitespace (bug 13728)
16859 !! options
16860 replace=2,"xxx"
16861 !! wikitext
16862 Preformatted initial line
16863 ==a==
16864 ===a===
16865 !! html
16866 Preformatted initial line
16867 ==a==
16868 xxx
16869 !! end
16870
16871
16872 !! test
16873 Section extraction, heading followed by pre with 20 spaces (bug 6398)
16874 !! options
16875 section=1
16876 !! wikitext
16877 ==a==
16878 a
16879 !! html
16880 ==a==
16881 a
16882 !! end
16883
16884 !! test
16885 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
16886 !! options
16887 section=1
16888 !! wikitext
16889 ==a==
16890 a
16891 !! html
16892 ==a==
16893 a
16894 !! end
16895
16896
16897 !! test
16898 Section extraction, <pre> around bogus header (bug 10309)
16899 !! options
16900 noxml section=2
16901 !! wikitext
16902 == Section One ==
16903 <pre>
16904 =======
16905 </pre>
16906
16907 == Section Two ==
16908 stuff
16909 !! html
16910 == Section Two ==
16911 stuff
16912 !! end
16913
16914 !! test
16915 Section replacement, <pre> around bogus header (bug 10309)
16916 !! options
16917 noxml replace=2,"xxx"
16918 !! wikitext
16919 == Section One ==
16920 <pre>
16921 =======
16922 </pre>
16923
16924 == Section Two ==
16925 stuff
16926 !! html
16927 == Section One ==
16928 <pre>
16929 =======
16930 </pre>
16931
16932 xxx
16933 !! end
16934
16935
16936
16937 !! test
16938 Handling of &#x0A; in URLs
16939 !! wikitext
16940 ** irc://&#x0A;a
16941 !! html/php
16942 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
16943
16944 !! html/parsoid
16945 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
16946 a">irc://
16947 a</a></li></ul></li></ul>
16948 !! end
16949
16950 !! test
16951 Handling of %0A in URLs
16952 !! wikitext
16953 ** irc://%0Aa
16954 !! html/php
16955 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
16956
16957 !! html/parsoid
16958 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
16959 !! end
16960
16961
16962 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
16963 !! test
16964 5 quotes, code coverage +1 line
16965 !! options
16966 parsoid=wt2html
16967 !! wikitext
16968 '''''
16969 !! html/php
16970 !! html/parsoid
16971 <p><b><i></i></b></p>
16972 !! end
16973
16974 # same html as previous, but wikitext adjusted to match parsoid html2wt
16975 # note that wt2html and html2html will put the <i> before the <b>
16976 !! test
16977 5 quotes, code coverage +1 line w/ nowiki (1)
16978 !! options
16979 parsoid=wt2wt,html2wt
16980 !! wikitext
16981 '''''<nowiki/>'''''
16982 !! html/php
16983 <p><i></i>
16984 </p>
16985 !! html/parsoid
16986 <p><b><i></i></b></p>
16987 !! end
16988
16989 # same as previous, just swapping the <i> and <b>
16990 !! test
16991 5 quotes, code coverage +1 line w/ nowiki (2)
16992 !! wikitext
16993 '''''<nowiki/>'''''
16994 !! html/php
16995 <p><i></i>
16996 </p>
16997 !! html/parsoid
16998 <p><i><b></b></i></p>
16999 !! end
17000
17001 !! test
17002 Special:Search page linking.
17003 !! wikitext
17004 {{Special:search}}
17005 !! html
17006 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
17007 </p>
17008 !! end
17009
17010 !! test
17011 {{!}} is a magic word
17012 !! wikitext
17013 {{!}} is a magic word there and {{!}} is still a magic word here
17014 !! html/php
17015 <p>| is a magic word there and | is still a magic word here
17016 </p>
17017 !! html/parsoid
17018 <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>
17019 !! end
17020
17021 !! test
17022 Say the magic word
17023 !! options
17024 title=[[Parser test]]
17025 !! wikitext
17026 * {{PAGENAME}}
17027 * {{PAGENAMEE}}
17028 * {{FULLPAGENAME}}
17029 * {{FULLPAGENAMEE}}
17030 * {{BASEPAGENAME}}
17031 * {{BASEPAGENAMEE}}
17032 * {{SUBPAGENAME}}
17033 * {{SUBPAGENAMEE}}
17034 * {{ROOTPAGENAME}}
17035 * {{ROOTPAGENAMEE}}
17036 * {{TALKPAGENAME}}
17037 * {{TALKPAGENAMEE}}
17038 * {{SUBJECTPAGENAME}}
17039 * {{SUBJECTPAGENAMEE}}
17040 * {{NAMESPACEE}}
17041 * {{NAMESPACE}}
17042 * {{NAMESPACENUMBER}}
17043 * {{TALKSPACE}}
17044 * {{TALKSPACEE}}
17045 * {{SUBJECTSPACE}}
17046 * {{SUBJECTSPACEE}}
17047 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
17048 !! html
17049 <ul><li> Parser test</li>
17050 <li> Parser_test</li>
17051 <li> Parser test</li>
17052 <li> Parser_test</li>
17053 <li> Parser test</li>
17054 <li> Parser_test</li>
17055 <li> Parser test</li>
17056 <li> Parser_test</li>
17057 <li> Parser test</li>
17058 <li> Parser_test</li>
17059 <li> Talk:Parser test</li>
17060 <li> Talk:Parser_test</li>
17061 <li> Parser test</li>
17062 <li> Parser_test</li>
17063 <li> </li>
17064 <li> </li>
17065 <li> 0</li>
17066 <li> Talk</li>
17067 <li> Talk</li>
17068 <li> </li>
17069 <li> </li>
17070 <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>
17071
17072 !! end
17073 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
17074
17075 !! test
17076 Gallery
17077 !! wikitext
17078 <gallery>
17079 image1.png |
17080 image2.gif|||||
17081
17082 image3|
17083 image4 |300px| centre
17084 image5.svg| http://///////
17085 [[x|xx]]]]
17086 * image6
17087 </gallery>
17088 !! html
17089 <ul class="gallery mw-gallery-traditional">
17090 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17091 <div class="thumb" style="height: 150px;">Image1.png</div>
17092 <div class="gallerytext">
17093 </div>
17094 </div></li>
17095 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17096 <div class="thumb" style="height: 150px;">Image2.gif</div>
17097 <div class="gallerytext">
17098 <p>||||
17099 </p>
17100 </div>
17101 </div></li>
17102 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17103 <div class="thumb" style="height: 150px;">Image3</div>
17104 <div class="gallerytext">
17105 </div>
17106 </div></li>
17107 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17108 <div class="thumb" style="height: 150px;">Image4</div>
17109 <div class="gallerytext">
17110 <p>300px| centre
17111 </p>
17112 </div>
17113 </div></li>
17114 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17115 <div class="thumb" style="height: 150px;">Image5.svg</div>
17116 <div class="gallerytext">
17117 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
17118 </p>
17119 </div>
17120 </div></li>
17121 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17122 <div class="thumb" style="height: 150px;">* image6</div>
17123 <div class="gallerytext">
17124 </div>
17125 </div></li>
17126 </ul>
17127
17128 !! end
17129
17130 !! test
17131 Gallery (with options)
17132 !! wikitext
17133 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
17134 File:Nonexistent.jpg|caption
17135 File:Nonexistent.jpg
17136 image:foobar.jpg|some '''caption''' [[Main Page]]
17137 image:foobar.jpg
17138 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
17139 </gallery>
17140 !! html
17141 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
17142 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
17143 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17144 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
17145 <div class="gallerytext">
17146 <p>caption
17147 </p>
17148 </div>
17149 </div></li>
17150 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17151 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
17152 <div class="gallerytext">
17153 </div>
17154 </div></li>
17155 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17156 <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>
17157 <div class="gallerytext">
17158 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
17159 </p>
17160 </div>
17161 </div></li>
17162 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17163 <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>
17164 <div class="gallerytext">
17165 </div>
17166 </div></li>
17167 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17168 <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>
17169 <div class="gallerytext">
17170 <p>Blabla|blabla.
17171 </p>
17172 </div>
17173 </div></li>
17174 </ul>
17175
17176 !! end
17177
17178 !! test
17179 Gallery with link that has fragment
17180 !! wikitext
17181 <gallery>
17182 image:foobar.jpg|link=Main_Page
17183 image:foobar.jpg|link=Main_Page#section
17184 image:foobar.jpg|link=Main Page#section|caption
17185 </gallery>
17186 !! html
17187 <ul class="gallery mw-gallery-traditional">
17188 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17189 <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>
17190 <div class="gallerytext">
17191 </div>
17192 </div></li>
17193 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17194 <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>
17195 <div class="gallerytext">
17196 </div>
17197 </div></li>
17198 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17199 <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>
17200 <div class="gallerytext">
17201 <p>caption
17202 </p>
17203 </div>
17204 </div></li>
17205 </ul>
17206
17207 !! end
17208
17209 !! test
17210 Gallery with wikitext inside caption
17211 !! wikitext
17212 <gallery>
17213 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
17214 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
17215 </gallery>
17216 !! html
17217 <ul class="gallery mw-gallery-traditional">
17218 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17219 <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>
17220 <div class="gallerytext">
17221 <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>
17222 </p>
17223 </div>
17224 </div></li>
17225 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17226 <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>
17227 <div class="gallerytext">
17228 <p>This is a test template
17229 </p>
17230 </div>
17231 </div></li>
17232 </ul>
17233
17234 !! end
17235
17236 !! test
17237 gallery (with showfilename option)
17238 !! wikitext
17239 <gallery showfilename>
17240 File:Nonexistent.jpg|caption
17241 File:Nonexistent.jpg
17242 image:foobar.jpg|some '''caption''' [[Main Page]]
17243 File:Foobar.jpg
17244 </gallery>
17245 !! html
17246 <ul class="gallery mw-gallery-traditional">
17247 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17248 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
17249 <div class="gallerytext">
17250 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
17251 caption
17252 </p>
17253 </div>
17254 </div></li>
17255 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17256 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
17257 <div class="gallerytext">
17258 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
17259 </p>
17260 </div>
17261 </div></li>
17262 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17263 <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>
17264 <div class="gallerytext">
17265 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
17266 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
17267 </p>
17268 </div>
17269 </div></li>
17270 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17271 <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>
17272 <div class="gallerytext">
17273 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
17274 </p>
17275 </div>
17276 </div></li>
17277 </ul>
17278
17279 !! end
17280
17281 !! test
17282 Gallery (with namespace-less filenames)
17283 !! wikitext
17284 <gallery>
17285 File:Nonexistent.jpg
17286 Nonexistent.jpg
17287 image:foobar.jpg
17288 foobar.jpg
17289 </gallery>
17290 !! html
17291 <ul class="gallery mw-gallery-traditional">
17292 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17293 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
17294 <div class="gallerytext">
17295 </div>
17296 </div></li>
17297 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17298 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
17299 <div class="gallerytext">
17300 </div>
17301 </div></li>
17302 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17303 <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>
17304 <div class="gallerytext">
17305 </div>
17306 </div></li>
17307 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17308 <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>
17309 <div class="gallerytext">
17310 </div>
17311 </div></li>
17312 </ul>
17313
17314 !! end
17315
17316 !! test
17317 HTML Hex character encoding (spells the word "JavaScript")
17318 !! options
17319 parsoid=wt2html,wt2wt,html2html
17320 !! wikitext
17321 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
17322 !! html/php
17323 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
17324 </p>
17325 !! html/php+tidy
17326 <p>JavaScript</p>
17327 !! html/parsoid
17328 <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>
17329 !! end
17330
17331 !! test
17332 HTML Hex character encoding bogus encoding (bug 26437 regression check)
17333 !! wikitext
17334 &#xsee;&#XSEE;
17335 !! html/php
17336 <p>&amp;#xsee;&amp;#XSEE;
17337 </p>
17338 !! html/parsoid
17339 <p>&amp;#xsee;&amp;#XSEE;</p>
17340 !! end
17341
17342 !! test
17343 HTML Hex character encoding mixed case
17344 !! options
17345 parsoid=wt2html,wt2wt,html2html
17346 !! wikitext
17347 &#xEE;&#Xee;
17348 !! html/php
17349 <p>&#xee;&#xee;
17350 </p>
17351 !! html/php+tidy
17352 <p>îî</p>
17353 !! html/parsoid
17354 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
17355 !! end
17356
17357 !! test
17358 __FORCETOC__ override
17359 !! wikitext
17360 __NEWSECTIONLINK__
17361 __FORCETOC__
17362 !! html
17363 <p><br />
17364 </p>
17365 !! end
17366
17367 !! test
17368 ISBN code coverage
17369 !! wikitext
17370 ISBN 978-0-1234-56&#x20;789
17371 !! html
17372 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
17373 </p>
17374 !! html+tidy
17375 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
17376 !! html/parsoid
17377 <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>
17378 !! end
17379
17380 !! test
17381 ISBN followed by 5 spaces
17382 !! wikitext
17383 ISBN
17384 !! html
17385 <p>ISBN
17386 </p>
17387 !! end
17388
17389 !! test
17390 Double ISBN
17391 !! wikitext
17392 ISBN ISBN 1234567890
17393 !! html/php
17394 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
17395 </p>
17396 !! html/parsoid
17397 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
17398 !! end
17399
17400 !! test
17401 ISBN with an X
17402 !! wikitext
17403 ISBN 3-462-04561-X
17404 ISBN 080442957X
17405 ISBN 978080442957X
17406 !! html/php
17407 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
17408 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
17409 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
17410 </p>
17411 !! html/parsoid
17412 <p><a href="./Special:BookSources/346204561X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
17413 <a href="./Special:BookSources/080442957X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
17414 <a href="./Special:BookSources/978080442957X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a></p>
17415 !! end
17416
17417 !! test
17418 ISBN with empty prefix (parsoid test)
17419 !! wikitext
17420 ISBN 1234567890
17421 !! html/php
17422 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
17423 </p>
17424 !! html/parsoid
17425 <p><a href="Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567890</a></p>
17426 !! end
17427
17428 !! test
17429 Bug 22905: <abbr> followed by ISBN followed by </a>
17430 !! wikitext
17431 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
17432 !! html/php
17433 <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>
17434 </p>
17435 !! html/parsoid
17436 <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>
17437 !! end
17438
17439 !! test
17440 Double RFC
17441 !! wikitext
17442 RFC RFC 1234
17443 !! html
17444 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
17445 </p>
17446 !! end
17447
17448 !! test
17449 Double RFC with a wiki link
17450 !! wikitext
17451 RFC [[RFC 1234]]
17452 !! html
17453 <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>
17454 </p>
17455 !! end
17456
17457 !! test
17458 RFC code coverage
17459 !! wikitext
17460 RFC 983&#x20;987
17461 !! html
17462 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
17463 </p>
17464 !! html+tidy
17465 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
17466 !! end
17467
17468 !! test
17469 Centre-aligned image
17470 !! wikitext
17471 [[Image:foobar.jpg|centre]]
17472 !! html
17473 <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>
17474
17475 !!end
17476
17477 !! test
17478 None-aligned image
17479 !! wikitext
17480 [[Image:foobar.jpg|none]]
17481 !! html
17482 <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>
17483
17484 !!end
17485
17486 !! test
17487 Width + Height sized image (using px) (height is ignored)
17488 !! wikitext
17489 [[Image:foobar.jpg|640x480px]]
17490 !! html
17491 <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>
17492 </p>
17493 !!end
17494
17495 !! test
17496 Width-sized image (using px, no following whitespace)
17497 !! wikitext
17498 [[Image:foobar.jpg|640px]]
17499 !! html
17500 <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>
17501 </p>
17502 !!end
17503
17504 !! test
17505 Width-sized image (using px, with following whitespace - test regression from r39467)
17506 !! wikitext
17507 [[Image:foobar.jpg|640px ]]
17508 !! html
17509 <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>
17510 </p>
17511 !!end
17512
17513 !! test
17514 Width-sized image (using px, with preceding whitespace - test regression from r39467)
17515 !! wikitext
17516 [[Image:foobar.jpg| 640px]]
17517 !! html
17518 <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>
17519 </p>
17520 !!end
17521
17522 !! test
17523 Image with page parameter
17524 !! options
17525 djvu
17526 !! wikitext
17527 [[File:LoremIpsum.djvu|page=2]]
17528 !! html/php
17529 <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>
17530 </p>
17531 !! html/parsoid
17532 <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>
17533 !! end
17534
17535 !! test
17536 Another italics / bold test
17537 !! wikitext
17538 ''' ''x'
17539 !! html
17540 <pre>'<i> </i>x'
17541 </pre>
17542 !!end
17543
17544 # FIXME: The php output seems broken. It's interleaving some open/close tags.
17545 !! test
17546 dt/dd/dl test
17547 !! wikitext
17548 :;;;::
17549 !! html/php
17550 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
17551
17552 !! html/parsoid
17553 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
17554
17555 !!end
17556
17557
17558 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
17559 !! test
17560 Images with the "|" character in the comment
17561 !! wikitext
17562 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
17563 !! html/php
17564 <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>
17565
17566 !! html/parsoid
17567 <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>
17568 !! end
17569
17570 !! test
17571 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
17572 !! wikitext
17573 <html><script>alert(1);</script></html>
17574 !! html
17575 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
17576 </p>
17577 !! end
17578
17579 !! test
17580 HTML with raw HTML ($wgRawHtml==true)
17581 !! options
17582 wgRawHtml=1
17583 !! wikitext
17584 <html><script>alert(1);</script></html>
17585 !! html
17586 <p><script>alert(1);</script>
17587 </p>
17588 !! end
17589
17590 !! test
17591 Parents of subpages, one level up
17592 !! options
17593 subpage title=[[Subpage test/L1/L2/L3]]
17594 !! wikitext
17595 [[../|L2]]
17596 !! html
17597 <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>
17598 </p>
17599 !! end
17600
17601
17602 !! test
17603 Parents of subpages, one level up, not named
17604 !! options
17605 subpage title=[[Subpage test/L1/L2/L3]]
17606 !! wikitext
17607 [[../]]
17608 !! html
17609 <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>
17610 </p>
17611 !! end
17612
17613
17614
17615 !! test
17616 Parents of subpages, two levels up
17617 !! options
17618 subpage title=[[Subpage test/L1/L2/L3]]
17619 !! wikitext
17620 [[../../|L1]]2
17621
17622 [[../../|L1]]l
17623 !! html
17624 <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
17625 </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>
17626 </p>
17627 !! end
17628
17629 !! test
17630 Parents of subpages, two levels up, without trailing slash or name.
17631 !! options
17632 subpage title=[[Subpage test/L1/L2/L3]]
17633 !! wikitext
17634 [[../..]]
17635 !! html
17636 <p>[[../..]]
17637 </p>
17638 !! end
17639
17640 !! test
17641 Parents of subpages, two levels up, with lots of extra trailing slashes.
17642 !! options
17643 subpage title=[[Subpage test/L1/L2/L3]]
17644 !! wikitext
17645 [[../../////]]
17646 !! html
17647 <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>
17648 </p>
17649 !! end
17650
17651 !! article
17652 Subpage test/L1/L2/L3Sibling
17653 !! text
17654 Sibling article
17655 !! endarticle
17656
17657 !! test
17658 Transclusion of a sibling page (one level up)
17659 !! options
17660 subpage title=[[Subpage test/L1/L2/L3]]
17661 !! wikitext
17662 {{../L3Sibling}}
17663 !! html
17664 <p>Sibling article
17665 </p>
17666 !! end
17667
17668 !! test
17669 Transclusion of a child page
17670 !! options
17671 subpage title=[[Subpage test/L1/L2]]
17672 !! wikitext
17673 {{/L3Sibling}}
17674 !! html
17675 <p>Sibling article
17676 </p>
17677 !! end
17678
17679 !! test
17680 Non-transclusion because of too many up levels
17681 !! options
17682 subpage title=[[Subpage test/L1/L2/L3]]
17683 !! wikitext
17684 {{../../../../More than parent}}
17685 !! html
17686 <p>{{../../../../More than parent}}
17687 </p>
17688 !! end
17689
17690 !! test
17691 Definition list code coverage
17692 !! wikitext
17693 ; title : def
17694 ; title : def
17695 ;title: def
17696 !! html/php
17697 <dl><dt> title &#160;</dt>
17698 <dd> def</dd>
17699 <dt> title&#160;</dt>
17700 <dd> def</dd>
17701 <dt>title</dt>
17702 <dd> def</dd></dl>
17703
17704 !! html/parsoid
17705 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
17706 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
17707 <dt>title</dt><dd> def</dd></dl>
17708 !! end
17709
17710 !! test
17711 Don't fall for the self-closing div
17712 !! wikitext
17713 <div>hello world</div/>
17714 !! html
17715 <div>hello world</div>
17716
17717 !! end
17718
17719 !! test
17720 MSGNW magic word
17721 !! wikitext
17722 {{MSGNW:msg}}
17723 !! html
17724 <p>&#91;&#91;:Template:Msg&#93;&#93;
17725 </p>
17726 !! end
17727
17728 !! test
17729 RAW magic word
17730 !! wikitext
17731 {{RAW:QUERTY}}
17732 !! html
17733 <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>
17734 </p>
17735 !! end
17736
17737 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
17738 !! test
17739 Always escape literal '>' in output, not just after '<'
17740 !! wikitext
17741 ><>
17742 !! html
17743 <p>&gt;&lt;&gt;
17744 </p>
17745 !! end
17746
17747 !! test
17748 Template caching
17749 !! wikitext
17750 {{Test}}
17751 {{Test}}
17752 !! html
17753 <p>This is a test template
17754 This is a test template
17755 </p>
17756 !! end
17757
17758
17759 !! article
17760 MediaWiki:Fake
17761 !! text
17762 ==header==
17763 !! endarticle
17764
17765 !! test
17766 Inclusion of !userCanEdit() content
17767 !! wikitext
17768 {{MediaWiki:Fake}}
17769 !! html
17770 <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>
17771
17772 !! end
17773
17774
17775 !! test
17776 Out-of-order TOC heading levels
17777 !! wikitext
17778 ==2==
17779 ======6======
17780 ===3===
17781 =1=
17782 =====5=====
17783 ==2==
17784 !! html
17785 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17786 <ul>
17787 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
17788 <ul>
17789 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
17790 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
17791 </ul>
17792 </li>
17793 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
17794 <ul>
17795 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
17796 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
17797 </ul>
17798 </li>
17799 </ul>
17800 </div>
17801
17802 <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>
17803 <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>
17804 <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>
17805 <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>
17806 <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>
17807 <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>
17808
17809 !! end
17810
17811
17812 !! test
17813 ISBN with a dummy number
17814 !! wikitext
17815 ISBN ---
17816 !! html
17817 <p>ISBN ---
17818 </p>
17819 !! end
17820
17821
17822 !! test
17823 ISBN with space-delimited number
17824 !! wikitext
17825 ISBN 92 9017 032 8
17826 !! html
17827 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
17828 </p>
17829 !! end
17830
17831
17832 !! test
17833 ISBN with multiple spaces, no number
17834 !! wikitext
17835 ISBN foo
17836 !! html
17837 <p>ISBN foo
17838 </p>
17839 !! end
17840
17841
17842 !! test
17843 ISBN length
17844 !! wikitext
17845 ISBN 123456789
17846
17847 ISBN 1234567890
17848
17849 ISBN 12345678901
17850 !! html
17851 <p>ISBN 123456789
17852 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
17853 </p><p>ISBN 12345678901
17854 </p>
17855 !! end
17856
17857
17858 !! test
17859 ISBN with trailing year (bug 8110)
17860 !! wikitext
17861 ISBN 1-234-56789-0 - 2006
17862
17863 ISBN 1 234 56789 0 - 2006
17864 !! html
17865 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
17866 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
17867 </p>
17868 !! end
17869
17870
17871 !! test
17872 anchorencode
17873 !! wikitext
17874 {{anchorencode:foo bar©#%n}}
17875 !! html
17876 <p>foo_bar.C2.A9.23.25n
17877 </p>
17878 !! end
17879
17880 !! test
17881 anchorencode trims spaces
17882 !! wikitext
17883 {{anchorencode: __pretty__please__}}
17884 !! html
17885 <p>pretty_please
17886 </p>
17887 !! end
17888
17889 !! test
17890 anchorencode deals with links
17891 !! wikitext
17892 {{anchorencode: [[hello|world]] [[hi]]}}
17893 !! html
17894 <p>world_hi
17895 </p>
17896 !! end
17897
17898 !! test
17899 anchorencode deals with templates
17900 !! wikitext
17901 {{anchorencode: {{Foo}} }}
17902 !! html
17903 <p>FOO
17904 </p>
17905 !! end
17906
17907 !! test
17908 anchorencode encodes like the TOC generator: (bug 18431)
17909 !! wikitext
17910 === _ +:.3A%3A&&amp;]] ===
17911 {{anchorencode: _ +:.3A%3A&&amp;]] }}
17912 __NOEDITSECTION__
17913 !! html
17914 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
17915 <p>.2B:.3A.253A.26.26.5D.5D
17916 </p>
17917 !! end
17918
17919 !! test
17920 Bug 6200: blockquotes and paragraph formatting
17921 !! wikitext
17922 <blockquote>
17923 foo
17924 </blockquote>
17925
17926 bar
17927
17928 baz
17929 !! html
17930 <blockquote>
17931 <p>foo
17932 </p>
17933 </blockquote>
17934 <p>bar
17935 </p>
17936 <pre>baz
17937 </pre>
17938 !! end
17939
17940 !! test
17941 Bug 8293: Use of center tag ruins paragraph formatting
17942 !! wikitext
17943 <center>
17944 foo
17945 </center>
17946
17947 bar
17948
17949 baz
17950 !! html
17951 <center>
17952 <p>foo
17953 </p>
17954 </center>
17955 <p>bar
17956 </p>
17957 <pre>baz
17958 </pre>
17959 !! end
17960
17961 !!test
17962 Parsing of overlapping (improperly nested) inline html tags
17963 !! wikitext
17964 <span><s>x</span></s>
17965 !! html/php
17966 <p><span><s>x&lt;/span&gt;</s></span>
17967 </p>
17968 !! html/parsoid
17969 <p><span><s>x</s></span>
17970 </p>
17971 !!end
17972
17973 ###
17974 ### Language variants related tests
17975 ###
17976 !! test
17977 Self-link in language variants
17978 !! options
17979 title=[[Dunav]] language=sr
17980 !! wikitext
17981 Both [[Dunav]] and [[Дунав]] are names for this river.
17982 !! html
17983 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
17984 </p>
17985 !!end
17986
17987 !! article
17988 Дуна
17989 !! text
17990 content
17991 !! endarticle
17992
17993 !! test
17994 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
17995 !! options
17996 title=[[Duna]] language=sr
17997 !! wikitext
17998 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
17999 !! html
18000 <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.
18001 </p>
18002 !! end
18003
18004 !! test
18005 Link to a section of a variant of this title shouldn't be parsed as self-link
18006 !! options
18007 title=[[Duna]] language=sr
18008 !! wikitext
18009 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
18010 !! html
18011 <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.
18012 </p>
18013 !! end
18014
18015 !! test
18016 Link to pages in language variants
18017 !! options
18018 language=sr
18019 !! wikitext
18020 Main Page can be written as [[Маин Паге]]
18021 !! html
18022 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
18023 </p>
18024 !!end
18025
18026
18027 !! test
18028 Multiple links to pages in language variants
18029 !! options
18030 language=sr
18031 !! wikitext
18032 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
18033 !! html
18034 <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>.
18035 </p>
18036 !!end
18037
18038
18039 !! test
18040 Simple template in language variants
18041 !! options
18042 language=sr
18043 !! wikitext
18044 {{тест}}
18045 !! html
18046 <p>This is a test template
18047 </p>
18048 !! end
18049
18050
18051 !! test
18052 Template with explicit namespace in language variants
18053 !! options
18054 language=sr
18055 !! wikitext
18056 {{Template:тест}}
18057 !! html
18058 <p>This is a test template
18059 </p>
18060 !! end
18061
18062
18063 !! test
18064 Basic test for template parameter in language variants
18065 !! options
18066 language=sr
18067 !! wikitext
18068 {{парамтест|param=foo}}
18069 !! html
18070 <p>This is a test template with parameter foo
18071 </p>
18072 !! end
18073
18074
18075 !! test
18076 Simple category in language variants
18077 !! options
18078 language=sr cat
18079 !! wikitext
18080 [[Category:МедиаWики Усер'с Гуиде]]
18081 !! html
18082 <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>
18083 !! end
18084
18085
18086 !! article
18087 Category:分类
18088 !! text
18089 blah
18090 !! endarticle
18091
18092 !! article
18093 Category:分類
18094 !! text
18095 blah
18096 !! endarticle
18097
18098 !! test
18099 Don't convert blue categorylinks to another variant (bug 33210)
18100 !! options
18101 language=zh cat
18102 !! wikitext
18103 [[A]][[Category:分类]]
18104 !! html
18105 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
18106 !! end
18107
18108
18109 !! test
18110 Stripping -{}- tags (language variants)
18111 !! options
18112 language=sr
18113 !! wikitext
18114 Latin proverb: -{Ne nuntium necare}-
18115 !! html
18116 <p>Latin proverb: Ne nuntium necare
18117 </p>
18118 !! end
18119
18120
18121 !! test
18122 Prevent conversion with -{}- tags (language variants)
18123 !! options
18124 language=sr variant=sr-ec
18125 !! wikitext
18126 Latinski: -{Ne nuntium necare}-
18127 !! html
18128 <p>Латински: Ne nuntium necare
18129 </p>
18130 !! end
18131
18132
18133 !! test
18134 Prevent conversion of text with -{}- tags (language variants)
18135 !! options
18136 language=sr variant=sr-ec
18137 !! wikitext
18138 Latinski: -{Ne nuntium necare}-
18139 !! html
18140 <p>Латински: Ne nuntium necare
18141 </p>
18142 !! end
18143
18144
18145 !! test
18146 Prevent conversion of links with -{}- tags (language variants)
18147 !! options
18148 language=sr variant=sr-ec
18149 !! wikitext
18150 -{[[Main Page]]}-
18151 !! html
18152 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18153 </p>
18154 !! end
18155
18156
18157 !! test
18158 -{}- tags within headlines (within html for parserConvert())
18159 !! options
18160 language=sr variant=sr-ec
18161 !! wikitext
18162 == -{Naslov}- ==
18163 !! html
18164 <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>
18165
18166 !! end
18167
18168
18169 !! test
18170 Explicit definition of language variant alternatives
18171 !! options
18172 language=zh variant=zh-tw
18173 !! wikitext
18174 -{zh:China;zh-tw:Taiwan}-, not China
18175 !! html
18176 <p>Taiwan, not China
18177 </p>
18178 !! end
18179
18180
18181 !! test
18182 Conversion around HTML tags
18183 !! options
18184 language=sr variant=sr-ec
18185 !! wikitext
18186 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
18187 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
18188 !! html
18189 <p>
18190 <span title="ЛаCтин">ски</span>
18191 </p>
18192 !! end
18193
18194
18195 !! test
18196 Explicit session-wise language variant mapping (A flag and - flag)
18197 !! options
18198 language=zh variant=zh-tw
18199 !! wikitext
18200 Taiwan is not China.
18201 But -{A|zh:China;zh-tw:Taiwan}- is China,
18202 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
18203 and -{China}- is China.
18204 !! html
18205 <p>Taiwan is not China.
18206 But Taiwan is Taiwan,
18207 (This should be stripped!)
18208 and China is China.
18209 </p>
18210 !! end
18211
18212 !! test
18213 Explicit session-wise language variant mapping (H flag for hide)
18214 !! options
18215 language=zh variant=zh-tw
18216 !! wikitext
18217 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
18218 Taiwan is China.
18219 !! html
18220 <p>(This should be stripped!)
18221 Taiwan is Taiwan.
18222 </p>
18223 !! end
18224
18225 !! test
18226 Adding explicit conversion rule for title (T flag)
18227 !! options
18228 language=zh variant=zh-tw showtitle
18229 !! wikitext
18230 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
18231 !! html
18232 Taiwan
18233 <p>Should be stripped!
18234 </p>
18235 !! end
18236
18237 !! test
18238 Testing that changing the language variant here in the tests actually works
18239 !! options
18240 language=zh variant=zh showtitle
18241 !! wikitext
18242 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
18243 !! html
18244 China
18245 <p>Should be stripped!
18246 </p>
18247 !! end
18248
18249 !! test
18250 Recursive conversion of alt and title attrs shouldn't clear converter state
18251 !! options
18252 language=zh variant=zh-cn showtitle
18253 !! wikitext
18254 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
18255 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
18256 !! html
18257 China
18258 <p>
18259 Should be stripped<span title="Exclamation">!</span>
18260 </p>
18261 !! end
18262
18263 !! test
18264 Bug 24072: more test on conversion rule for title
18265 !! options
18266 language=zh variant=zh-tw showtitle
18267 !! wikitext
18268 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
18269 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
18270 !! html
18271 Taiwan
18272 <p>This should be stripped!
18273 This won't take interferes with the title rule.
18274 </p>
18275 !! end
18276
18277 !! test
18278 Partly disable title conversion if variant == main language code
18279 !! options
18280 language=zh variant=zh title=[[ZH]] showtitle
18281 !! wikitext
18282 -{T|zh-cn:CN;zh-tw:TW}-
18283 !! html
18284 ZH
18285 <p>
18286 </p>
18287 !! end
18288
18289 !! test
18290 Partly disable title conversion if variant == main language code, more
18291 !! options
18292 language=zh variant=zh title=[[ZH]] showtitle
18293 !! wikitext
18294 -{T|TW}-
18295 !! html
18296 ZH
18297 <p>
18298 </p>
18299 !! end
18300
18301 !! test
18302 Raw output of variant escape tags (R flag)
18303 !! options
18304 language=zh variant=zh-tw
18305 !! wikitext
18306 Raw: -{R|zh:China;zh-tw:Taiwan}-
18307 !! html
18308 <p>Raw: zh:China;zh-tw:Taiwan
18309 </p>
18310 !! end
18311
18312 !! test
18313 Strings evaluating false shouldn't be ignored by Language converter (T51072)
18314 !! options
18315 language=zh variant=zh-cn
18316 !! input
18317 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
18318 !! result
18319 <p>0
18320 </p>
18321 !! end
18322
18323 !! test
18324 Conversion rules from [numeric-only string] to [something else] (T48634)
18325 !! options
18326 language=zh variant=zh-cn
18327 !! input
18328 -{H|0=>zh-cn:B}--{H|0=>zh-cn:C;0=>zh-cn:D}--{H|0=>zh-hans:A}-012345-{A|zh-tw:0;zh-cn:E;}-012345
18329 !! result
18330 <p>D12345EE12345
18331 </p>
18332 !! end
18333
18334 !! test
18335 Bidirectional converter rule entries with an empty value should be ignored (T53551)
18336 !! options
18337 language=zh variant=zh-cn
18338 !! input
18339 -{H|zh-cn:foo;zh-tw:;}-foobar
18340 !! result
18341 <p>foobar
18342 </p>
18343 !! end
18344
18345 !! test
18346 Unidirectional converter rule entries with an empty "from" string should be ignored (T53551)
18347 !! options
18348 language=zh variant=zh-cn
18349 !! input
18350 -{H|=>zh-cn:foo;}-foobar
18351 !! result
18352 <p>foobar
18353 </p>
18354 !! end
18355
18356 !! test
18357 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
18358 !! options
18359 language=zh variant=zh-cn
18360 !! input
18361 -{H|}-foobar
18362 !! result
18363 <p>foobar
18364 </p>
18365 !! end
18366
18367 !! test
18368 Nested using of manual convert syntax
18369 !! options
18370 language=zh variant=zh-hk
18371 !! wikitext
18372 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
18373 !! html
18374 <p>Nested: Hello Hong Kong!
18375 </p>
18376 !! end
18377
18378 !! test
18379 Proper conversion of text in external links
18380 !! options
18381 language=sr variant=sr-ec
18382 !! wikitext
18383 http://www.google.com
18384 gopher://www.google.com
18385 [http://www.google.com http://www.google.com]
18386 [gopher://www.google.com gopher://www.google.com]
18387 [https://www.google.com irc://www.google.com]
18388 [ftp://www.google.com www.google.com/ftp://dir]
18389 [//www.google.com www.google.com]
18390 !! html
18391 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
18392 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
18393 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
18394 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
18395 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
18396 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
18397 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
18398 </p>
18399 !! end
18400
18401 !! test
18402 Do not convert roman numbers to language variants
18403 !! options
18404 language=sr variant=sr-ec
18405 !! wikitext
18406 Fridrih IV je car.
18407 !! html
18408 <p>Фридрих IV је цар.
18409 </p>
18410 !! end
18411
18412 !! test
18413 Unclosed language converter markup "-{"
18414 !! options
18415 language=sr
18416 !! wikitext
18417 -{T|hello
18418 !! html
18419 <p>-{T|hello
18420 </p>
18421 !! end
18422
18423 !! test
18424 Don't convert raw rule "-{R|=&gt;}-" to "=>"
18425 !! options
18426 language=sr
18427 !! wikitext
18428 -{R|=&gt;}-
18429 !! html
18430 <p>=&gt;
18431 </p>
18432 !!end
18433
18434 !! test
18435 Don't break link parsing if language converter markup is in the caption.
18436 !! options
18437 language=sr variant=sr-ec
18438 !! wikitext
18439 [[Main Page|-{R|main page}-]]
18440 !! html
18441 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
18442 </p>
18443 !! end
18444
18445 # FIXME: This test is currently broken in the PHP parser (bug 52661)
18446 !! test
18447 Don't break image parsing if language converter markup is in the caption.
18448 !! options
18449 language=sr
18450 !! wikitext
18451 [[File:Foobar.jpg|-{R|caption}-]]
18452 !! html/parsoid
18453 <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>
18454 </p>
18455 !! end
18456
18457 # FIXME: This test is currently broken in the PHP parser (bug 52661)
18458 !! test
18459 Don't break list handling if language converter markup is in the item.
18460 !! options
18461 language=zh variant=zh-cn
18462 !! wikitext
18463 ;-{zh-cn:AAA;zh-tw:BBB}-
18464 !! html/php
18465 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
18466
18467 !! html/parsoid
18468 <dl><dt>AAA
18469 </dt></dl>
18470 !! end
18471
18472 # FIXME: This test is currently broken in the PHP parser (bug 52661)
18473 !! test
18474 Don't break table handling if language converter markup is in the cell.
18475 !! options
18476 language=sr variant=sr-ec
18477 !! wikitext
18478 {|
18479 |-
18480 | -{R|B}-
18481 |}
18482 !! html/php
18483 <table>
18484
18485 <tr>
18486 <td>Б}-
18487 </td></tr></table>
18488
18489 !! html/parsoid
18490 <table>
18491
18492 <tr>
18493 <td> B
18494 </td></tr></table>
18495
18496 !! end
18497
18498 !! test
18499 Bug 529: Uncovered bullet
18500 !! wikitext
18501 * Foo {{bullet}}
18502 !! html
18503 <ul><li> Foo </li>
18504 <li> Bar</li></ul>
18505
18506 !! end
18507
18508 # Plain MediaWiki does not remove empty lists, but tidy actually does.
18509 # Templates in Wikipedia rely on this behavior, as tidy has always been
18510 # enabled there. These tests are normally run *without* tidy, so specify the
18511 # full output here.
18512 # To test realistic parsing behavior, apply a tidy-like transformation to both
18513 # the expected output and your parser's output.
18514 !! test
18515 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
18516 !! wikitext
18517 ******* Foo {{bullet}}
18518 !! html
18519 <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>
18520 <li> Bar</li></ul>
18521
18522 !! end
18523
18524 !! test
18525 Bug 529: Uncovered table already at line-start
18526 !! wikitext
18527 x
18528
18529 {{table}}
18530 y
18531 !! html
18532 <p>x
18533 </p>
18534 <table>
18535 <tr>
18536 <td> 1 </td>
18537 <td> 2
18538 </td></tr>
18539 <tr>
18540 <td> 3 </td>
18541 <td> 4
18542 </td></tr></table>
18543 <p>y
18544 </p>
18545 !! end
18546
18547 !! test
18548 Bug 529: Uncovered bullet in parser function result
18549 !! wikitext
18550 * Foo {{lc:{{bullet}} }}
18551 !! html
18552 <ul><li> Foo </li>
18553 <li> bar</li></ul>
18554
18555 !! end
18556
18557 !! test
18558 Bug 5678: Double-parsed template argument
18559 !! wikitext
18560 {{lc:{{{1}}}|hello}}
18561 !! html
18562 <p>{{{1}}}
18563 </p>
18564 !! end
18565
18566 !! test
18567 Bug 5678: Double-parsed template invocation
18568 !! wikitext
18569 {{lc:{{paramtest {{!}} param = hello }} }}
18570 !! html
18571 <p>{{paramtest | param = hello }}
18572 </p>
18573 !! end
18574
18575 !! test
18576 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
18577 !! options
18578 language=cs
18579 title=[[Main Page]]
18580 !! wikitext
18581 {{PRVNÍVELKÉ:ěščř}}
18582 {{prvnívelké:ěščř}}
18583 {{PRVNÍMALÉ:ěščř}}
18584 {{prvnímalé:ěščř}}
18585 {{MALÁ:ěščř}}
18586 {{malá:ěščř}}
18587 {{VELKÁ:ěščř}}
18588 {{velká:ěščř}}
18589 !! html
18590 <p>Ěščř
18591 Ěščř
18592 ěščř
18593 ěščř
18594 ěščř
18595 ěščř
18596 ĚŠČŘ
18597 ĚŠČŘ
18598 </p>
18599 !! end
18600
18601 !! test
18602 Morwen/13: Unclosed link followed by heading
18603 !! wikitext
18604 [[link
18605 ==heading==
18606 !! html
18607 <p>[[link
18608 </p>
18609 <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>
18610
18611 !! end
18612
18613 !! test
18614 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
18615 !! wikitext
18616 {{foo|
18617 =heading=
18618 !! html
18619 <p>{{foo|
18620 </p>
18621 <h1><span class="mw-headline" id="heading">heading</span></h1>
18622
18623 !! end
18624
18625 !! test
18626 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
18627 !! wikitext
18628 {{foo|
18629 ==heading==
18630 !! html
18631 <p>{{foo|
18632 </p>
18633 <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>
18634
18635 !! end
18636
18637 !! test
18638 Tildes in comments
18639 !! options
18640 pst
18641 !! wikitext
18642 <!-- ~~~~ -->
18643 !! html
18644 <!-- ~~~~ -->
18645 !! end
18646
18647 !! test
18648 Paragraphs inside divs (no extra line breaks)
18649 !! wikitext
18650 <div>Line one
18651
18652 Line two</div>
18653 !! html
18654 <div>Line one
18655 Line two</div>
18656
18657 !! end
18658
18659 !! test
18660 Paragraphs inside divs (extra line break on open)
18661 !! wikitext
18662 <div>
18663 Line one
18664
18665 Line two</div>
18666 !! html
18667 <div>
18668 <p>Line one
18669 </p>
18670 Line two</div>
18671
18672 !! end
18673
18674 !! test
18675 Paragraphs inside divs (extra line break on close)
18676 !! wikitext
18677 <div>Line one
18678
18679 Line two
18680 </div>
18681 !! html
18682 <div>Line one
18683 <p>Line two
18684 </p>
18685 </div>
18686
18687 !! end
18688
18689 !! test
18690 Paragraphs inside divs (extra line break on open and close)
18691 !! wikitext
18692 <div>
18693 Line one
18694
18695 Line two
18696 </div>
18697 !! html
18698 <div>
18699 <p>Line one
18700 </p><p>Line two
18701 </p>
18702 </div>
18703
18704 !! end
18705
18706 !! test
18707 Nesting tags, paragraphs on lines which begin with <div>
18708 !! wikitext
18709 <div></div><strong>A
18710 B</strong>
18711 !! html/php+tidy
18712 <p><strong>A</strong></p>
18713 <p><strong>B</strong></p>
18714 !! html/parsoid
18715 <div></div>
18716 <p><strong>A
18717 B</strong>
18718 </p>
18719 !! end
18720
18721 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
18722 !! test
18723 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
18724 !! wikitext
18725 <blockquote>Line one
18726
18727 Line two</blockquote>
18728 !! html
18729 <blockquote>Line one
18730 Line two</blockquote>
18731
18732 !! html+tidy
18733 <blockquote>
18734 <p>Line one Line two</p>
18735 </blockquote>
18736 !! end
18737
18738 !! test
18739 Bug 6200: paragraphs inside blockquotes (extra line break on open)
18740 !! wikitext
18741 <blockquote>
18742 Line one
18743
18744 Line two</blockquote>
18745 !! html
18746 <blockquote>
18747 <p>Line one
18748 </p>
18749 Line two</blockquote>
18750
18751 !! html+tidy
18752 <blockquote>
18753 <p>Line one</p>
18754 Line two</blockquote>
18755 !! end
18756
18757 !! test
18758 Bug 6200: paragraphs inside blockquotes (extra line break on close)
18759 !! wikitext
18760 <blockquote>Line one
18761
18762 Line two
18763 </blockquote>
18764 !! html
18765 <blockquote>Line one
18766 <p>Line two
18767 </p>
18768 </blockquote>
18769
18770 !! html+tidy
18771 <blockquote>
18772 <p>Line one</p>
18773 <p>Line two</p>
18774 </blockquote>
18775 !! end
18776
18777 !! test
18778 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
18779 !! wikitext
18780 <blockquote>
18781 Line one
18782
18783 Line two
18784 </blockquote>
18785 !! html
18786 <blockquote>
18787 <p>Line one
18788 </p><p>Line two
18789 </p>
18790 </blockquote>
18791
18792 !! html+tidy
18793 <blockquote>
18794 <p>Line one</p>
18795 <p>Line two</p>
18796 </blockquote>
18797 !! end
18798
18799 !! test
18800 Paragraphs inside blockquotes/divs (no extra line breaks)
18801 !! wikitext
18802 <blockquote><div>Line one
18803
18804 Line two</div></blockquote>
18805 !! html
18806 <blockquote><div>Line one
18807 Line two</div></blockquote>
18808
18809 !! end
18810
18811 !! test
18812 Paragraphs inside blockquotes/divs (extra line break on open)
18813 !! wikitext
18814 <blockquote><div>
18815 Line one
18816
18817 Line two</div></blockquote>
18818 !! html
18819 <blockquote><div>
18820 <p>Line one
18821 </p>
18822 Line two</div></blockquote>
18823
18824 !! end
18825
18826 !! test
18827 Paragraphs inside blockquotes/divs (extra line break on close)
18828 !! wikitext
18829 <blockquote><div>Line one
18830
18831 Line two
18832 </div></blockquote>
18833 !! html
18834 <blockquote><div>Line one
18835 <p>Line two
18836 </p>
18837 </div></blockquote>
18838
18839 !! end
18840
18841 !! test
18842 Paragraphs inside blockquotes/divs (extra line break on open and close)
18843 !! wikitext
18844 <blockquote><div>
18845 Line one
18846
18847 Line two
18848 </div></blockquote>
18849 !! html
18850 <blockquote><div>
18851 <p>Line one
18852 </p><p>Line two
18853 </p>
18854 </div></blockquote>
18855
18856 !! end
18857
18858 !! test
18859 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
18860 !! options
18861 wgLinkHolderBatchSize=0
18862 !! wikitext
18863 [[meatball:1]]
18864 [[meatball:2]]
18865 [[meatball:3]]
18866 !! html
18867 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
18868 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
18869 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
18870 </p>
18871 !! end
18872
18873 !! test
18874 Free external link invading image caption
18875 !! wikitext
18876 [[Image:Foobar.jpg|thumb|http://x|hello]]
18877 !! html
18878 <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>
18879
18880 !! end
18881
18882 !! test
18883 Bug 15196: localised external link numbers
18884 !! options
18885 language=fa
18886 !! wikitext
18887 [http://en.wikipedia.org/]
18888 !! html/php
18889 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
18890 </p>
18891 !! html/parsoid
18892 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
18893 !! end
18894
18895 !! test
18896 Multibyte character in padleft
18897 !! wikitext
18898 {{padleft:-Hello|7|Æ}}
18899 !! html
18900 <p>Æ-Hello
18901 </p>
18902 !! end
18903
18904 !! test
18905 Multibyte character in padright
18906 !! wikitext
18907 {{padright:Hello-|7|Æ}}
18908 !! html
18909 <p>Hello-Æ
18910 </p>
18911 !! end
18912
18913 !!test
18914 formatdate parser function
18915 !! wikitext
18916 {{#formatdate:2009-03-24}}
18917 !! html
18918 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
18919 </p>
18920 !! end
18921
18922 !!test
18923 formatdate parser function, with default format
18924 !! wikitext
18925 {{#formatdate:2009-03-24|mdy}}
18926 !! html
18927 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
18928 </p>
18929 !! end
18930
18931 !! test
18932 Spacing of numbers in formatted dates
18933 !! wikitext
18934 {{#formatdate:January 15}}
18935 !! html
18936 <p><span class="mw-formatted-date" title="01-15">January 15</span>
18937 </p>
18938 !! end
18939
18940 !! test
18941 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
18942 !! options
18943 language=nl title=[[MediaWiki:Common.css]]
18944 !! wikitext
18945 {{#formatdate:2009-03-24|dmy}}
18946 !! html
18947 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
18948 </p>
18949 !! end
18950
18951 #
18952 #
18953 #
18954
18955 #
18956 # Edit comments
18957 #
18958
18959 !! test
18960 Edit comment with link
18961 !! options
18962 comment
18963 !! wikitext
18964 I like the [[Main Page]] a lot
18965 !! html
18966 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
18967 !!end
18968
18969 !! test
18970 Edit comment with link and link text
18971 !! options
18972 comment
18973 !! wikitext
18974 I like the [[Main Page|best pages]] a lot
18975 !! html
18976 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
18977 !!end
18978
18979 !! test
18980 Edit comment with link and link text with suffix
18981 !! options
18982 comment
18983 !! wikitext
18984 I like the [[Main Page|best page]]s a lot
18985 !! html
18986 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
18987 !!end
18988
18989 !! test
18990 Edit comment with section link (non-local, eg in history list)
18991 !! options
18992 comment title=[[Main Page]]
18993 !! wikitext
18994 /* External links */ removed bogus entries
18995 !! html
18996 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
18997 !!end
18998
18999 !! test
19000 Edit comment with section link and text before it (non-local, eg in history list)
19001 !! options
19002 comment title=[[Main Page]]
19003 !! wikitext
19004 pre-comment text /* External links */ removed bogus entries
19005 !! html
19006 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>
19007 !!end
19008
19009 !! test
19010 Edit comment with section link (local, eg in diff view)
19011 !! options
19012 comment local title=[[Main Page]]
19013 !! wikitext
19014 /* External links */ removed bogus entries
19015 !! html
19016 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
19017 !!end
19018
19019 !! test
19020 Edit comment with subpage link (bug 14080)
19021 !! options
19022 comment
19023 subpage
19024 title=[[Subpage test]]
19025 !! wikitext
19026 Poked at a [[/subpage]] here...
19027 !! html
19028 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
19029 !!end
19030
19031 !! test
19032 Edit comment with subpage link and link text (bug 14080)
19033 !! options
19034 comment
19035 subpage
19036 title=[[Subpage test]]
19037 !! wikitext
19038 Poked at a [[/subpage|neat little page]] here...
19039 !! html
19040 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
19041 !!end
19042
19043 !! test
19044 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
19045 !! options
19046 comment
19047 title=[[Subpage test]]
19048 !! wikitext
19049 Poked at a [[/subpage]] here...
19050 !! html
19051 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...
19052 !!end
19053
19054 !! test
19055 Edit comment with bare anchor link (local, as on diff)
19056 !! options
19057 comment
19058 local
19059 title=[[Main Page]]
19060 !! wikitext
19061 [[#section]]
19062 !! html
19063 <a href="#section">#section</a>
19064 !! end
19065
19066 !! test
19067 Edit comment with bare anchor link (non-local, as on history)
19068 !! options
19069 comment
19070 title=[[Main Page]]
19071 !! wikitext
19072 [[#section]]
19073 !! html
19074 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
19075 !! end
19076
19077 !! test
19078 Anchor starting with underscore
19079 !! wikitext
19080 [[#_ref|One]]
19081 !! html
19082 <p><a href="#_ref">One</a>
19083 </p>
19084 !! end
19085
19086 !! test
19087 Id starting with underscore
19088 !! wikitext
19089 <div id="_ref"></div>
19090 !! html
19091 <div id="_ref"></div>
19092
19093 !! end
19094
19095 !! test
19096 Space normalisation on autocomment (bug 22784)
19097 !! options
19098 comment
19099 title=[[Main Page]]
19100 !! wikitext
19101 /* __hello__world__ */
19102 !! html
19103 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
19104 !! end
19105
19106 !! test
19107 percent-encoding and + signs in comments (Bug 26410)
19108 !! options
19109 comment
19110 !! wikitext
19111 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
19112 !! html
19113 <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>
19114 !! end
19115
19116 # Parsoid doesn't support this yet: see bug 73581
19117 # but it *should* omit the 'src' attribute if the image is bad.
19118 # PHP side of tests was disabled in
19119 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
19120 # because of issues in the PHP parserTests infrastructure
19121 # (but the output below is indeed what the PHP side emits)
19122 !! test
19123 Bad images - basic functionality
19124 !! wikitext
19125 [[File:Bad.jpg]]
19126 !! DISABLED/html/php
19127 !! html/parsoid
19128 <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>
19129 !! end
19130
19131 !! test
19132 Bad images - bug 16039: text after bad image disappears
19133 !! wikitext
19134 Foo bar
19135 [[File:Bad.jpg]]
19136 Bar foo
19137 !! DISABLED/html/php
19138 <p>Foo bar
19139 </p><p>Bar foo
19140 </p>
19141 !! html/parsoid
19142 <p>Foo bar
19143 <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>
19144 Bar foo</p>
19145 !! end
19146
19147 !! test
19148 Verify that displaytitle works (bug #22501) no displaytitle
19149 !! options
19150 showtitle
19151 !! config
19152 wgAllowDisplayTitle=true
19153 wgRestrictDisplayTitle=false
19154 !! wikitext
19155 this is not the the title
19156 !! html
19157 Parser test
19158 <p>this is not the the title
19159 </p>
19160 !! end
19161
19162 !! test
19163 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
19164 !! options
19165 showtitle
19166 title=[[Screen]]
19167 !! config
19168 wgAllowDisplayTitle=true
19169 wgRestrictDisplayTitle=false
19170 !! wikitext
19171 this is not the the title
19172 {{DISPLAYTITLE:whatever}}
19173 !! html
19174 whatever
19175 <p>this is not the the title
19176 </p>
19177 !! end
19178
19179 !! test
19180 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
19181 !! options
19182 showtitle
19183 title=[[Screen]]
19184 !! config
19185 wgAllowDisplayTitle=true
19186 wgRestrictDisplayTitle=true
19187 !! wikitext
19188 this is not the the title
19189 {{DISPLAYTITLE:whatever}}
19190 !! html
19191 Screen
19192 <p>this is not the the title
19193 </p>
19194 !! end
19195
19196 !! test
19197 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
19198 !! options
19199 showtitle
19200 title=[[Screen]]
19201 !! config
19202 wgAllowDisplayTitle=true
19203 wgRestrictDisplayTitle=true
19204 !! wikitext
19205 this is not the the title
19206 {{DISPLAYTITLE:screen}}
19207 !! html
19208 screen
19209 <p>this is not the the title
19210 </p>
19211 !! end
19212
19213 !! test
19214 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
19215 !! options
19216 showtitle
19217 title=[[Screen]]
19218 !! config
19219 wgAllowDisplayTitle=false
19220 !! wikitext
19221 this is not the the title
19222 {{DISPLAYTITLE:screen}}
19223 !! html
19224 Screen
19225 <p>this is not the the title
19226 <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>
19227 </p>
19228 !! end
19229
19230 !! test
19231 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
19232 !! options
19233 showtitle
19234 title=[[Screen]]
19235 !! config
19236 wgAllowDisplayTitle=false
19237 !! wikitext
19238 this is not the the title
19239 !! html
19240 Screen
19241 <p>this is not the the title
19242 </p>
19243 !! end
19244
19245 !! test
19246 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
19247 !! options
19248 showtitle
19249 title=[[Screen]]
19250 !! config
19251 wgAllowDisplayTitle=true
19252 wgRestrictDisplayTitle=true
19253 !! wikitext
19254 this is not the the title
19255 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
19256 !! html
19257 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
19258 <p>this is not the the title
19259 </p>
19260 !! end
19261
19262 !! test
19263 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
19264 !! options
19265 showtitle
19266 title=[[Screen]]
19267 !! config
19268 wgAllowDisplayTitle=true
19269 wgRestrictDisplayTitle=true
19270 !! wikitext
19271 this is not the the title
19272 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
19273 !! html
19274 <span style="color: red;">s</span>creen
19275 <p>this is not the the title
19276 </p>
19277 !! end
19278
19279 !! test
19280 Page status indicators: Empty name is invalid
19281 !! options
19282 showindicators
19283 !! wikitext
19284 <indicator name=" "></indicator>
19285 <indicator></indicator>
19286 !! html
19287 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
19288 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
19289 </p>
19290 !! end
19291
19292 !! test
19293 Page status indicators: Weird syntaxes that are okay
19294 !! options
19295 showindicators
19296 !! wikitext
19297 <indicator name="empty" />
19298 <indicator name></indicator>
19299 !! html
19300 empty=
19301 name=
19302 <p><br />
19303 </p>
19304 !! end
19305
19306 !! test
19307 Page status indicators: Torture test
19308 !! options
19309 showindicators
19310 !! wikitext
19311 <indicator name="01">hello world</indicator>
19312 <indicator name="02">[[Main Page]]</indicator>
19313 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
19314 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
19315 <indicator name="05">* foo
19316 * bar</indicator>
19317 <indicator name="06"><nowiki>foo</nowiki></indicator>
19318 <indicator name="07"> Preformatted</indicator>
19319 <indicator name="08"><div>Broken tag</indicator>
19320 <indicator name="09">{| class=wikitable
19321 | cell
19322 |}</indicator>
19323 <indicator name="10">Two
19324
19325 paragraphs</indicator>
19326 !! html
19327 01=hello world
19328 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19329 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" />
19330 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>
19331 05=<ul><li> foo</li>
19332 <li> bar</li></ul>
19333
19334 06=foo
19335 07=<pre>Preformatted
19336 </pre>
19337 08=<div>Broken tag</div>
19338
19339 09=<table class="wikitable">
19340 <tr>
19341 <td> cell
19342 </td></tr></table>
19343
19344 10=<p>Two
19345 </p><p>paragraphs
19346 </p>
19347 <p><br />
19348 </p><p><br />
19349 </p><p><br />
19350 </p><p><br />
19351 </p><p><br />
19352 </p>
19353 !! end
19354
19355 !! test
19356 preload: check <noinclude> and <includeonly>
19357 !! options
19358 preload
19359 !! wikitext
19360 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
19361 !! html
19362 Hello kind world.
19363 !! end
19364
19365 !! test
19366 preload: check <onlyinclude>
19367 !! options
19368 preload
19369 !! wikitext
19370 Goodbye <onlyinclude>Hello world</onlyinclude>
19371 !! html
19372 Hello world
19373 !! end
19374
19375 !! test
19376 preload: can pass tags through if we want to
19377 !! options
19378 preload
19379 !! wikitext
19380 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
19381 !! html
19382 <includeonly>Hello world</includeonly>
19383 !! end
19384
19385 !! test
19386 preload: check that it doesn't try to do tricks
19387 !! options
19388 preload
19389 !! wikitext
19390 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
19391 !! html
19392 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
19393 !! end
19394
19395 !! test
19396 Play a bit with r67090 and bug 3158
19397 !! wikitext
19398 <div style="width:50% !important">&nbsp;</div>
19399 <div style="width:50%&nbsp;!important">&nbsp;</div>
19400 <div style="width:50%&#160;!important">&nbsp;</div>
19401 <div style="border : solid;">&nbsp;</div>
19402 !! html/php
19403 <div style="width:50% !important">&#160;</div>
19404 <div style="width:50% !important">&#160;</div>
19405 <div style="width:50% !important">&#160;</div>
19406 <div style="border&#160;: solid;">&#160;</div>
19407
19408 !! html/parsoid
19409 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
19410 <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>
19411 <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>
19412 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
19413
19414 !! end
19415
19416 !! test
19417 HTML5 data attributes
19418 !! wikitext
19419 <span data-foo="bar">Baz</span>
19420 <p data-abc-def_hij="">Quuz</p>
19421 !! html
19422 <p><span data-foo="bar">Baz</span>
19423 </p>
19424 <p data-abc-def_hij="">Quuz</p>
19425
19426 !! end
19427
19428 !! test
19429 percent-encoding and + signs in internal links (Bug 26410)
19430 !! wikitext
19431 [[User:+%]] [[Page+title%]]
19432 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
19433 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
19434 [[%33%45]] [[%33%45+]]
19435 !! html/php
19436 <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>
19437 <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>
19438 <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>
19439 <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>
19440 </p>
19441 !! html/parsoid
19442 <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>
19443 !! end
19444
19445 !! test
19446 Special characters in embedded file links (bug 27679)
19447 !! wikitext
19448 [[File:Contains & ampersand.jpg]]
19449 [[File:Does not exist.jpg|Title with & ampersand]]
19450 !! html/php
19451 <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>
19452 <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>
19453 </p>
19454 !! html/parsoid
19455 <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>
19456 <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>
19457 !! end
19458
19459 !! test
19460 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
19461 !! wikitext
19462 Text&apos;s been normalized?
19463 !! html
19464 <p>Text&#39;s been normalized?
19465 </p>
19466 !! end
19467
19468 !! test
19469 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
19470 !! wikitext
19471 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
19472 !! html
19473 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
19474 </p>
19475 !! end
19476
19477 !! test
19478 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
19479 !! wikitext
19480 [http://www.example.org/ ideograms]
19481 !! html
19482 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
19483 </p>
19484 !! end
19485
19486 !! test
19487 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
19488 !! wikitext
19489 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
19490 !! html
19491 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
19492 </p>
19493 !! end
19494
19495 !! article
19496 Mediawiki:loop1
19497 !! text
19498 {{Identical|A}}
19499 !! endarticle
19500
19501 !! article
19502 Mediawiki:loop2
19503 !! text
19504 {{Identical|B}}
19505 !! endarticle
19506
19507 !! article
19508 Template:Identical
19509 !! text
19510 {{int:loop1}}
19511 {{int:loop2}}
19512 !! endarticle
19513
19514 !! test
19515 Bug 31098 Template which includes system messages which includes the template
19516 !! wikitext
19517 {{Identical}}
19518 !! html
19519 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
19520 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
19521 </p>
19522 !! end
19523
19524 !! test
19525 Bug31490 Turkish: ucfirst 'blah'
19526 !! options
19527 language=tr
19528 !! wikitext
19529 {{ucfirst:blah}}
19530 !! html
19531 <p>Blah
19532 </p>
19533 !! end
19534
19535 !! test
19536 Bug31490 Turkish: ucfirst 'ix'
19537 !! options
19538 language=tr
19539 !! wikitext
19540 {{ucfirst:ix}}
19541 !! html
19542 <p>İx
19543 </p>
19544 !! end
19545
19546 !! test
19547 Bug31490 Turkish: lcfirst 'BLAH'
19548 !! options
19549 language=tr
19550 !! wikitext
19551 {{lcfirst:BLAH}}
19552 !! html
19553 <p>bLAH
19554 </p>
19555 !! end
19556
19557 !! test
19558 Bug31490 Turkish: ucfırst (with a dotless i)
19559 !! options
19560 language=tr
19561 !! wikitext
19562 {{ucfırst:blah}}
19563 !! html
19564 <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>
19565 </p>
19566 !! end
19567
19568 !! test
19569 Bug31490 ucfırst (with a dotless i) with English language
19570 !! options
19571 language=en
19572 !! wikitext
19573 {{ucfırst:blah}}
19574 !! html
19575 <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>
19576 </p>
19577 !! end
19578
19579 !! test
19580 Bug 26375: TOC with italics
19581 !! options
19582 title=[[Main Page]]
19583 !! wikitext
19584 __TOC__
19585 == ''Lost'' episodes ==
19586 !! html
19587 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19588 <ul>
19589 <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>
19590 </ul>
19591 </div>
19592
19593 <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>
19594
19595 !! end
19596
19597 !! test
19598 Bug 26375: TOC with bold
19599 !! options
19600 title=[[Main Page]]
19601 !! wikitext
19602 __TOC__
19603 == '''should be bold''' then normal text ==
19604 !! html
19605 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19606 <ul>
19607 <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>
19608 </ul>
19609 </div>
19610
19611 <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>
19612
19613 !! end
19614
19615 !! test
19616 Bug 33845: Headings become cursive in TOC when they contain an image
19617 !! options
19618 title=[[Main Page]]
19619 !! wikitext
19620 __TOC__
19621 == Image [[Image:foobar.jpg]] ==
19622 !! html
19623 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19624 <ul>
19625 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
19626 </ul>
19627 </div>
19628
19629 <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>
19630
19631 !! end
19632
19633 !! test
19634 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
19635 !! options
19636 title=[[Main Page]]
19637 !! wikitext
19638 __TOC__
19639 == <blockquote>Quote</blockquote> ==
19640 !! html
19641 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19642 <ul>
19643 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
19644 </ul>
19645 </div>
19646
19647 <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>
19648
19649 !! html+tidy
19650 <p></p>
19651 <div id="toc" class="toc">
19652 <div id="toctitle">
19653 <h2>Contents</h2>
19654 </div>
19655 <ul>
19656 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
19657 </ul>
19658 </div>
19659 <p></p>
19660 <h2><span class="mw-headline" id="Quote"></span></h2>
19661 <blockquote>
19662 <p><span class="mw-headline" id="Quote">Quote</span></p>
19663 </blockquote>
19664 <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>
19665 !! end
19666
19667 !! test
19668 Unclosed tags in TOC
19669 !! options
19670 title=[[Main Page]]
19671 !! wikitext
19672 __TOC__
19673 == Proof: 2 < 3 ==
19674 <small>Hanc marginis exiguitas non caperet.</small>
19675 QED
19676 !! html
19677 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19678 <ul>
19679 <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>
19680 </ul>
19681 </div>
19682
19683 <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>
19684 <p><small>Hanc marginis exiguitas non caperet.</small>
19685 QED
19686 </p>
19687 !! end
19688
19689 !! test
19690 Multiple tags in TOC
19691 !! wikitext
19692 __TOC__
19693 == <i>Foo</i> <b>Bar</b> ==
19694
19695 == <i>Foo</i> <blockquote>Bar</blockquote> ==
19696 !! html
19697 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19698 <ul>
19699 <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>
19700 <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>
19701 </ul>
19702 </div>
19703
19704 <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>
19705 <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>
19706
19707 !! html+tidy
19708 <p></p>
19709 <div id="toc" class="toc">
19710 <div id="toctitle">
19711 <h2>Contents</h2>
19712 </div>
19713 <ul>
19714 <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>
19715 <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>
19716 </ul>
19717 </div>
19718 <p></p>
19719 <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>
19720 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
19721 <blockquote>
19722 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
19723 </blockquote>
19724 <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>
19725 !! end
19726
19727 !! test
19728 Tags with parameters in TOC
19729 !! wikitext
19730 __TOC__
19731 == <sup class="in-h2">Hello</sup> ==
19732
19733 == <sup class="a > b">Evilbye</sup> ==
19734 !! html
19735 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19736 <ul>
19737 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
19738 <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>
19739 </ul>
19740 </div>
19741
19742 <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>
19743 <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>
19744
19745 !! end
19746
19747 !! test
19748 span tags with directionality in TOC
19749 !! wikitext
19750 __TOC__
19751 == <span dir="ltr">C++</span> ==
19752
19753 == <span dir="rtl">זבנג!</span> ==
19754
19755 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
19756
19757 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
19758
19759 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
19760 !! html
19761 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19762 <ul>
19763 <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>
19764 <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>
19765 <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>
19766 <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>
19767 <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>
19768 </ul>
19769 </div>
19770
19771 <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>
19772 <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>
19773 <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>
19774 <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>
19775 <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>
19776
19777 !! end
19778
19779 !! test
19780 Bug 72884: bdi element in ToC
19781 !! wikitext
19782 __TOC__
19783 == <bdi>test</bdi> ==
19784 !! html
19785 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19786 <ul>
19787 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
19788 </ul>
19789 </div>
19790
19791 <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>
19792
19793 !! end
19794
19795 # Note that the html output does not have the <p></p>, but the
19796 # html+tidy output *does*. This is because the empty <p></p> is
19797 # removed by the sanitizer, but only when tidy is *not* enabled (!).
19798 !! test
19799 Empty <p> tag in TOC, removed by Sanitizer (T92892)
19800 !! wikitext
19801 __TOC__
19802 == x ==
19803 !! html
19804 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19805 <ul>
19806 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
19807 </ul>
19808 </div>
19809
19810 <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>
19811
19812 !! html+tidy
19813 <p></p>
19814 <div id="toc" class="toc">
19815 <div id="toctitle">
19816 <h2>Contents</h2>
19817 </div>
19818 <ul>
19819 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
19820 </ul>
19821 </div>
19822 <p></p>
19823 <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>
19824 !! end
19825
19826 !! article
19827 MediaWiki:Bug32057
19828 !! text
19829 == {{int:headline_sample}} ==
19830 !! endarticle
19831
19832 !! test
19833 Bug 32057: Title needed when expanding <h> nodes.
19834 !! options
19835 title=[[Main Page]]
19836 !! wikitext
19837 {{int:Bug32057}}
19838 !! html
19839 <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>
19840
19841 !! end
19842
19843 !! test
19844 Strip marker in urlencode
19845 !! wikitext
19846 {{urlencode:x<nowiki/>y}}
19847 {{urlencode:x<nowiki/>y|wiki}}
19848 {{urlencode:x<nowiki/>y|path}}
19849 !! html
19850 <p>xy
19851 xy
19852 xy
19853 </p>
19854 !! end
19855
19856 !! test
19857 Strip marker in lc
19858 !! wikitext
19859 {{lc:x<nowiki/>y}}
19860 !! html
19861 <p>xy
19862 </p>
19863 !! end
19864
19865 !! test
19866 Strip marker in uc
19867 !! wikitext
19868 {{uc:x<nowiki/>y}}
19869 !! html
19870 <p>XY
19871 </p>
19872 !! end
19873
19874 !! test
19875 Strip marker in formatNum
19876 !! wikitext
19877 {{formatnum:1<nowiki/>2}}
19878 {{formatnum:1<nowiki/>2|R}}
19879 !! html
19880 <p>12
19881 12
19882 </p>
19883 !! end
19884
19885 !! test
19886 Check noCommafy in formatNum
19887 !! options
19888 language=be-tarask
19889 !! wikitext
19890 {{formatnum:123456.78}}
19891 {{formatnum:123456.78|NOSEP}}
19892 !! html
19893 <p>123 456,78
19894 123456.78
19895 </p>
19896 !! end
19897
19898 !! test
19899 Wrong option for formatNum (bug 56199)
19900 !! wikitext
19901 {{formatnum:1,234.56|Random}}
19902 {{formatnum:1,234.56|EVERYTHING}}
19903 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
19904 !! html
19905 <p>1,234.56
19906 1,234.56
19907 1,234.56
19908 </p>
19909 !! end
19910
19911 !! test
19912 Strip marker in grammar
19913 !! options
19914 language=fi
19915 !! wikitext
19916 {{grammar:elative|foo<nowiki/>bar}}
19917 !! html
19918 <p>foobarista
19919 </p>
19920 !! end
19921
19922 !! test
19923 Strip marker in padleft
19924 !! wikitext
19925 {{padleft:|2|x<nowiki/>y}}
19926 !! html
19927 <p>xy
19928 </p>
19929 !! end
19930
19931 !! test
19932 Strip marker in padright
19933 !! wikitext
19934 {{padright:|2|x<nowiki/>y}}
19935 !! html
19936 <p>xy
19937 </p>
19938 !! end
19939
19940 !! test
19941 Strip marker in anchorencode
19942 !! wikitext
19943 {{anchorencode:x<nowiki/>y}}
19944 !! html
19945 <p>xy
19946 </p>
19947 !! end
19948
19949 !! test
19950 nowiki inside link inside heading (bug 18295)
19951 !! wikitext
19952 ==[[foo|x<nowiki>y</nowiki>z]]==
19953 !! html
19954 <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>
19955
19956 !! end
19957
19958 !! test
19959 new support for bdi element (bug 31817)
19960 !! wikitext
19961 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
19962 !! html
19963 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
19964
19965 !!end
19966
19967 !! test
19968 Ignore pipe between table row attributes
19969 !! wikitext
19970 {|
19971 | quux
19972 |- id=foo | style='color: red'
19973 | bar
19974 |}
19975 !! html
19976 <table>
19977 <tr>
19978 <td> quux
19979 </td></tr>
19980 <tr id="foo" style="color: red">
19981 <td> bar
19982 </td></tr></table>
19983
19984 !! end
19985
19986 !!test
19987 Gallery override link with WikiLink (bug 34852)
19988 !! wikitext
19989 <gallery>
19990 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
19991 </gallery>
19992 !! html
19993 <ul class="gallery mw-gallery-traditional">
19994 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19995 <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>
19996 <div class="gallerytext">
19997 <p>caption
19998 </p>
19999 </div>
20000 </div></li>
20001 </ul>
20002
20003 !! end
20004
20005 !!test
20006 Gallery override link with absolute external link (bug 34852)
20007 !! wikitext
20008 <gallery>
20009 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
20010 </gallery>
20011 !! html
20012 <ul class="gallery mw-gallery-traditional">
20013 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20014 <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>
20015 <div class="gallerytext">
20016 <p>caption
20017 </p>
20018 </div>
20019 </div></li>
20020 </ul>
20021
20022 !! end
20023
20024 !!test
20025 Gallery override link with malicious javascript (bug 34852)
20026 !! wikitext
20027 <gallery>
20028 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
20029 </gallery>
20030 !! html
20031 <ul class="gallery mw-gallery-traditional">
20032 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20033 <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>
20034 <div class="gallerytext">
20035 <p>caption
20036 </p>
20037 </div>
20038 </div></li>
20039 </ul>
20040
20041 !! end
20042
20043 !!test
20044 Gallery with invalid title as link (bug 43964)
20045 !! wikitext
20046 <gallery>
20047 File:foobar.jpg|link=<
20048 </gallery>
20049 !! html
20050 <ul class="gallery mw-gallery-traditional">
20051 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20052 <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>
20053 <div class="gallerytext">
20054 </div>
20055 </div></li>
20056 </ul>
20057
20058 !! end
20059
20060 !!test
20061 Language parser function
20062 !! wikitext
20063 {{#language:ar}}
20064 !! html
20065 <p>العربية
20066 </p>
20067 !! end
20068
20069 !!test
20070 Padleft and padright as substr
20071 !! wikitext
20072 {{padleft:|3|abcde}}
20073 {{padright:|3|abcde}}
20074 !! html
20075 <p>abc
20076 abc
20077 </p>
20078 !! end
20079
20080 !!test
20081 Special parser function
20082 !! wikitext
20083 {{#special:RandomPage}}
20084 {{#special:BaDtItLe}}
20085 {{#special:Foobar}}
20086 !! html
20087 <p>Special:Random
20088 Special:Badtitle
20089 Special:Foobar
20090 </p>
20091 !! end
20092
20093 !!test
20094 Bug 34939 - Case insensitive link parsing ([HttP://])
20095 !! wikitext
20096 [HttP://MediaWiki.Org/]
20097 !! html/php
20098 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
20099 </p>
20100 !! html/parsoid
20101 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
20102 !! end
20103
20104 !!test
20105 Bug 34939 - Case insensitive link parsing ([HttP:// title])
20106 !! wikitext
20107 [HttP://MediaWiki.Org/ MediaWiki]
20108 !! html
20109 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
20110 </p>
20111 !! end
20112
20113 !!test
20114 Bug 34939 - Case insensitive link parsing (HttP://)
20115 !! wikitext
20116 HttP://MediaWiki.Org/
20117 !! html/php
20118 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
20119 </p>
20120 !! html/parsoid
20121 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
20122 !! end
20123
20124 !!test
20125 Disable TOC
20126 !! options
20127 notoc
20128 !! wikitext
20129 Lead
20130 == Section 1 ==
20131 == Section 2 ==
20132 == Section 3 ==
20133 == Section 4 ==
20134 == Section 5 ==
20135 !! html
20136 <p>Lead
20137 </p>
20138
20139 <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>
20140 <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>
20141 <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>
20142 <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>
20143 <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>
20144
20145 !! end
20146
20147
20148 ###
20149 ### Parsoid-specific tests
20150 ### Parsoid-PHP parser incompatibilities
20151 ###
20152 !!test
20153 1. SOL-sensitive wikitext tokens as template-args
20154 !!options
20155 parsoid=wt2html,wt2wt
20156 !! wikitext
20157 {{echo|*a}}
20158 {{echo|#a}}
20159 {{echo|:a}}
20160 !! html
20161 <span about="#mwt1" typeof="mw:Transclusion">
20162 </span><ul about="#mwt1"><li>a</li>
20163 </ul>
20164 <span about="#mwt2" typeof="mw:Transclusion">
20165 </span><ol about="#mwt2"><li>a</li>
20166 </ol>
20167 <span about="#mwt3" typeof="mw:Transclusion">
20168 </span><dl about="#mwt3"><dd>a</dd>
20169 </dl>
20170 !!end
20171
20172 #### -----------------------------------------------------------------
20173 #### Parsoid-specific functionality tests
20174 #### -----------------------------------------------------------------
20175
20176 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
20177 # We know wt2wt will fail, but we expect selser to pass.
20178 # Due to the nature of our testing, wt2wt and selser tests will enter the
20179 # blacklist and we'll catch selser regressions based on changes to the
20180 # blacklist entries for selser tests.
20181 !! test
20182 1. Bad treebuilder fixup of formatting elt is cleaned up
20183 !! options
20184 parsoid=wt2html,wt2wt
20185 !! wikitext
20186 {|
20187 |
20188 <small>
20189 [[Image:Foobar.jpg|right|Test]]
20190 </small>
20191 |}
20192 !! html/parsoid
20193 <table>
20194 <tbody><tr><td>
20195 <small>
20196 <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>
20197 </small>
20198 </td></tr>
20199 </tbody></table>
20200 !! end
20201
20202 !! test
20203 2. Bad treebuilder fixup of formatting elt is cleaned up
20204 !! options
20205 parsoid=wt2html,wt2wt
20206 !! wikitext
20207 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
20208
20209 <small>[[Image:Foobar.jpg|right|300px]]</small>
20210 !! html/parsoid
20211 <p><b>foo</b></p>
20212 <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>
20213 <p><b>bar</b></p>
20214 <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>
20215 !! end
20216
20217 #### ----------------------------------------------------------------
20218 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
20219 #### tags. Parsoid's output for these tags differs from that of the
20220 #### PHP parser.
20221 #### ----------------------------------------------------------------
20222
20223 !!test
20224 Ref: 1. ref-location should be replaced with an index span
20225 !!options
20226 parsoid
20227 !! wikitext
20228 A <ref>foo</ref>
20229 B <ref name="x">foo</ref>
20230 C <ref name="y" />
20231 <references />
20232 !! html
20233 <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>
20234 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>
20235 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>
20236 <ol class="references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
20237 <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>
20238 <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>
20239 <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>
20240 </ol>
20241 !!end
20242
20243 !!test
20244 Ref: 2. ref-tags with identical names should all get the same index
20245 !!options
20246 parsoid
20247 !! wikitext
20248 A <ref name="x">foo</ref>
20249 B <ref name="x" />
20250 <references />
20251 !! html
20252 <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>
20253 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>
20254 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
20255 <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>
20256 </ol>
20257 !!end
20258
20259 !!test
20260 Ref: 3. spaces in ref-names should be ignored
20261 !!options
20262 parsoid
20263 !! wikitext
20264 A <ref name="x">foo</ref>
20265 B <ref name=" x " />
20266 C <ref name= x />
20267 <references />
20268 !! html
20269 <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>
20270 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>
20271 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>
20272 <ol class="references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
20273 <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>
20274 </ol>
20275 !!end
20276
20277 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
20278 !!test
20279 Ref: 4. 'constructor' should be accepted as a valid ref-name
20280 !!options
20281 parsoid
20282 !! wikitext
20283 A <ref name="constructor">foo</ref>
20284 <references />
20285 !! html
20286 <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>
20287 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20288 <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>
20289 </ol>
20290 !!end
20291
20292 !!test
20293 Ref: 5. body should accept generic wikitext
20294 !!options
20295 parsoid
20296 !! wikitext
20297 A <ref>
20298 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
20299 </ref>
20300
20301 <references />
20302 !! html
20303 <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>
20304
20305 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
20306 <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>
20307 </span></li>
20308 </ol>
20309 !!end
20310
20311 !!test
20312 Ref: 6. indent-pres should not be output in ref-body
20313 !!options
20314 parsoid
20315 !! wikitext
20316 A <ref>
20317 foo
20318 bar
20319 baz
20320 </ref>
20321
20322 <references />
20323 !! html
20324 <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>
20325
20326 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20327 <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
20328 bar
20329 baz
20330 </span></li>
20331 </ol>
20332 !!end
20333
20334 !!test
20335 Ref: 7. No p-wrapping in ref-body
20336 !!options
20337 parsoid
20338 !! wikitext
20339 A <ref>
20340 foo
20341
20342 bar
20343
20344
20345 baz
20346
20347
20348
20349 booz
20350 </ref>
20351
20352 <references />
20353 !! html
20354 <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>
20355
20356 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20357 <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
20358
20359 bar
20360
20361
20362 baz
20363
20364
20365
20366 booz
20367 </span></li>
20368 </ol>
20369 !!end
20370
20371 !!test
20372 Ref: 8. transclusion wikitext has lower precedence
20373 !!options
20374 parsoid
20375 !! wikitext
20376 A <ref> foo {{echo|</ref> B C}}
20377
20378 <references />
20379 !! html
20380 <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>
20381 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20382 <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>
20383 </ol>
20384 !!end
20385
20386 !!test
20387 Ref: 9. unclosed comments should not leak out of ref-body
20388 !!options
20389 parsoid
20390 !! wikitext
20391 A <ref> foo <!--</ref> B C
20392 <references />
20393 !! html
20394 <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>
20395 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20396 <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>
20397 </ol>
20398 !!end
20399
20400 !!test
20401 Ref: 10. Unclosed HTML tags should not leak out of ref-body
20402 !!options
20403 parsoid
20404 !! wikitext
20405 A <ref> <b> foo </ref> B C
20406
20407 <references />
20408 !! html
20409 <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>
20410
20411
20412 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20413 <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>
20414 </ol>
20415 !!end
20416
20417 !!test
20418 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
20419 !!options
20420 parsoid
20421 !! wikitext
20422 A <ref>foo</ref> B
20423 C <ref>bar</ref> D
20424 <references />
20425 !! html
20426 <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
20427 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>
20428 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
20429 <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>
20430 <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>
20431 </ol>
20432 !!end
20433
20434 !!test
20435 Ref: 12. ref-tags act as trailing newline migration barrier
20436 !!options
20437 parsoid
20438 !! wikitext
20439 <!--the newline at the end of this line moves out of the p-tag-->a
20440
20441 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
20442 <ref />
20443
20444 c
20445 <references />
20446 !! html
20447 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
20448
20449
20450 <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>
20451 <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>
20452
20453 <p>c</p>
20454 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
20455 <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>
20456 <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>
20457 !!end
20458
20459 !!test
20460 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
20461 !!options
20462 parsoid
20463 !! wikitext
20464 <ref>foo</ref> A
20465 <ref>bar
20466 </ref> B
20467 <references />
20468 !! html
20469 <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
20470 <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>
20471 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
20472 <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>
20473 <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
20474 </span></li>
20475 </ol>
20476 !!end
20477
20478 !!test
20479 Ref: 14. A nested ref-tag should be emitted as plain text
20480 !!options
20481 parsoid
20482 !! wikitext
20483 <ref>foo <ref>bar</ref> baz</ref>
20484
20485 <references />
20486 !! html
20487 <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>
20488 </p>
20489 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
20490 <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>
20491 </ol>
20492 !!end
20493
20494 !!test
20495 Ref: 15. ref-tags with identical names should get identical indexes
20496 !!options
20497 parsoid
20498 !! wikitext
20499 A1 <ref name="a">foo</ref> A2 <ref name="a" />
20500 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
20501
20502 <references />
20503 !! html
20504 <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>
20505 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>
20506
20507 <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>
20508 </ol>
20509 !!end
20510
20511 ## We don't bother wt2wt-ing non-standard whitespace
20512 !!test
20513 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
20514 !!options
20515 parsoid=wt2html
20516 !! wikitext
20517 A <ref >foo</ref >
20518
20519 <references />
20520 !! html
20521 <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>
20522 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20523 <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>
20524 !!end
20525
20526 !!test
20527 Ref: 17. Generate valid HTML5 id/about attributes
20528 !!options
20529 parsoid
20530 !!wikitext
20531 <ref name="a b">foo</ref>
20532
20533 <references />
20534 !!html
20535 <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>
20536 </p>
20537
20538 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20539 <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>
20540 </ol>
20541 !!end
20542
20543 !!test
20544 Ref: 18. T58916: Extension attributes should be parsed as plain text
20545 !!options
20546 parsoid
20547 !!wikitext
20548 <ref name="{{echo|a}}">foo</ref>
20549
20550 <references />
20551 !!html
20552 <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>
20553 </p>
20554
20555 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20556 <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>
20557 </ol>
20558 !!end
20559
20560 !!test
20561 Ref: 19. ref-tags with identical name encodings should get identical indexes
20562 !!options
20563 parsoid
20564 !! wikitext
20565 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
20566
20567 <references />
20568 !! html
20569 <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>
20570 </p>
20571 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
20572 <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>
20573 </ol>
20574 !!end
20575
20576 !!test
20577 Ref: 20. ref-tags with identical names but different content should keep it
20578 !!options
20579 parsoid
20580 !! wikitext
20581 A <ref name="foo">Foo one</ref>
20582 B <ref name="foo">Foo two</ref>
20583 C <ref name="foo" />
20584
20585 <references />
20586 !! html
20587 <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>
20588 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>
20589 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>
20590
20591 <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>
20592 </ol>
20593 !!end
20594
20595 !!test
20596 References: 1. references tag without any refs should be handled properly
20597 !!options
20598 parsoid
20599 !! wikitext
20600 <references />
20601 !! html
20602 <ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
20603 !!end
20604
20605 !!test
20606 References: 2. references tag with group only outputs references from that group
20607 !!options
20608 parsoid
20609 !! wikitext
20610 A <ref group="a">foo</ref>
20611 B <ref group="b">bar</ref>
20612 C <ref>baz</ref>
20613
20614 <references group="a" />
20615 <references />
20616 <references group="b" />
20617 !! html
20618 <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>
20619 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>
20620 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>
20621
20622 <ol class="references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{"group":"a"}}'>
20623 <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>
20624 </ol>
20625 <ol class="references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'>
20626 <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>
20627 </ol>
20628 <ol class="references" typeof="mw:Extension/references" about="#mwt12" data-mw='{"name":"references","attrs":{"group":"b"}}'>
20629 <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>
20630 </ol>
20631 !!end
20632
20633 !!test
20634 References: 3. ref list should be cleared after processing references
20635 !!options
20636 parsoid
20637 !! wikitext
20638 A <ref>foo</ref>
20639
20640 <references />
20641
20642 B <ref>bar</ref>
20643
20644 <references />
20645 !! html
20646 <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>
20647
20648 <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>
20649 </ol>
20650
20651 <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>
20652
20653 <ol class="references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
20654 <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>
20655 </ol>
20656 !!end
20657
20658 !!test
20659 References: 4. only referenced group should be cleared after processing references
20660 !!options
20661 parsoid
20662 !! wikitext
20663 A <ref group="a">afoo</ref>
20664 B <ref>bfoo</ref>
20665
20666 <references group="a" />
20667
20668 C <ref>cfoo</ref>
20669
20670 <references />
20671 !! html
20672 <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>
20673 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>
20674
20675 <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>
20676 </ol>
20677
20678 <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>
20679
20680 <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>
20681 </ol>
20682 !!end
20683
20684 !!test
20685 References: 5. ref tags in references should be processed while ignoring all other content
20686 !!options
20687 parsoid
20688 !! wikitext
20689 A <ref name="a" />
20690 B <ref name="b">bar</ref>
20691
20692 <references>
20693 <ref name="a">foo</ref>
20694 This should just get lost.
20695 </references>
20696 !! html
20697 <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>
20698 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>
20699
20700
20701 <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>
20702 </ol>
20703 !!end
20704
20705 !!test
20706 References: 6. <references /> from a transclusion
20707 !!options
20708 parsoid
20709 !! wikitext
20710 <ref>Foo</ref> {{echo|<references />}}
20711 !! html
20712 <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>
20713 </ol>
20714 !!end
20715
20716 !! test
20717 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
20718 !! options
20719 parsoid
20720 !! wikitext
20721 A <ref>foo bar for a</ref>
20722 B <ref group="X" name="b" />
20723
20724 <references />
20725
20726 <references group="X">
20727 <ref name="b">foo</ref>
20728 </references>
20729 !! html
20730 <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>
20731 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>
20732 </p>
20733
20734 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
20735 <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>
20736 </ol>
20737
20738 <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"}}'>
20739 <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>
20740 </ol>
20741 !! end
20742
20743 !! test
20744 References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
20745 !! options
20746 parsoid
20747 !! wikitext
20748 X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
20749 <references />
20750 !! html
20751 <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>
20752 <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>
20753 </ol>
20754 !!end
20755
20756 # This test only works in wt2html now as the <references /> are always generated
20757 # unless selser is active. Once T72722 is fixed, we should add a changes test
20758 # here to ensure that unrelated changes don't add the new <references /> in
20759 # wt2wt.
20760 !! test
20761 References: 9. Generate missing references list at the end
20762 !! options
20763 parsoid
20764 !! wikitext
20765 A <ref>foo</ref>
20766 B <ref group="inexistent">bar</ref>
20767 !! html
20768 <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>
20769 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
20770 <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>
20771 </ol>
20772 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{"group":"inexistent"}}'>
20773 <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>
20774 </ol>
20775 !! end
20776
20777 !! test
20778 References: 10. New <references/> shouldn't be added for unrelated edits.
20779 !! options
20780 parsoid={
20781 "modes": ["selser"],
20782 "changes": [["#x", "remove"]],
20783 "selser": "noauto"
20784 }
20785 !! wikitext
20786 Unrelated text<span id="x"> that's going to disappear</span>.
20787 A <ref>foo</ref>
20788 !! wikitext/edited
20789 Unrelated text.
20790 A <ref>foo</ref>
20791 !!end
20792
20793 !! test
20794 Entities in ref name
20795 !! options
20796 parsoid
20797 !! wikitext
20798 <ref name="test &amp; me">hi</ref>
20799 <references />
20800 !! html
20801 <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>
20802 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20803 <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>
20804 </ol>
20805 !! end
20806
20807 # This test is wt2html only because we're permitting the serializer to produce
20808 # dirty diffs, normalizing the unclosed references to the self-closed version.
20809 !! test
20810 Generate references for unclosed references tag
20811 !! options
20812 parsoid=wt2html
20813 !! wikitext
20814 a<ref>foo</ref>
20815
20816 <references>
20817 !! html
20818 <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>
20819 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20820 <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>
20821 !! end
20822
20823 !! test
20824 New reference serializes on its own line
20825 !! options
20826 parsoid=wt2wt,html2wt
20827 !! wikitext
20828 foo
20829 <references />
20830 !! html
20831 foo<ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
20832 !! end
20833
20834 #### ----------------------------------------------------------------
20835 #### Parsoid-only testing of Parsoid's impl of LST
20836 #### Not implemented yet, see
20837 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
20838 #### ----------------------------------------------------------------
20839
20840 !!test
20841 LST Sections: 1. Simple section start and end
20842 !! wikitext
20843 <section begin="2011-05-16" />
20844 <section end="2014-04-10 (MW 1.23wmf22)" />
20845 !! html/parsoid
20846 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
20847 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
20848 !! end
20849
20850 #--------- Test stripping of empty nodes in template content ----------
20851 !!test
20852 Empty LI and TR nodes should be stripped from template content
20853 !!wikitext
20854 {{EmptyLITest}}
20855 {{EmptyTRTest}}
20856 !!html/parsoid
20857 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
20858 <li>a</li>
20859 <li>b</li>
20860 </ul>
20861 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
20862 <tbody>
20863 <tr>
20864 <td>foo</td>
20865 </tr>
20866 <tr>
20867 <td>bar</td>
20868 </tr>
20869 </tbody>
20870 </table>
20871 !!end
20872
20873 !!test
20874 Empty LI and TR nodes should not be stripped from top-level content
20875 !!wikitext
20876 * a
20877 *
20878 * b
20879 {|
20880 |-
20881 |-
20882 |foo
20883 |}
20884 !!html/parsoid
20885 <ul>
20886 <li> a</li>
20887 <li></li>
20888 <li> b</li>
20889 </ul>
20890 <table>
20891 <tbody>
20892 <tr></tr>
20893 <tr>
20894 <td>foo</td>
20895 </tr>
20896 </tbody>
20897 </table>
20898 !!end
20899
20900 !!test
20901 Empty TR nodes should not be stripped if they have any attributes set
20902 !!wikitext
20903 {{EmptyTRWithHTMLAttrTest}}
20904 !!html/parsoid
20905 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
20906 <tr align="center"></tr>
20907 <tr><td>foo</td></tr>
20908 <tr align="center"></tr>
20909 <tr><td>bar</td></tr>
20910 </table>
20911 !!end
20912
20913 #### ----------------------------------------------------------------
20914 #### The following section of tests are primarily to test
20915 #### wikitext escaping capabilities of Parsoid. Given that
20916 #### escaping can be done any number of ways, the wikitext (input)
20917 #### is always adjusted to reflect how Parsoid adds nowiki
20918 #### escape tags.
20919 ####
20920 #### We are marking several tests as parsoid-only since the
20921 #### HTML in the result section is different from what the
20922 #### PHP parser generates for it.
20923 #### ----------------------------------------------------------------
20924
20925
20926 #### --------------- Headings ---------------
20927 #### 0. Unnested
20928 #### 1. Nested inside html <h1>=foo=</h1>
20929 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
20930 #### 3. Nested inside html with wikitext split by html tags
20931 #### 4. No escape needed
20932 #### 5. Empty headings <h1></h1>
20933 #### 6. Heading chars in SOL context
20934 #### ----------------------------------------
20935 !! test
20936 Headings: 0. Unnested
20937 !! options
20938 parsoid
20939 !! wikitext
20940 <nowiki>=foo=</nowiki>
20941
20942 <nowiki> =foo= </nowiki>
20943 <!--cmt-->
20944 <nowiki>=foo=</nowiki>
20945
20946 =foo''a''<nowiki>=</nowiki>
20947 !! html
20948 <p><span typeof="mw:Nowiki">=foo=</span></p>
20949
20950 <p><span typeof="mw:Nowiki"> =foo= </span>
20951 <!--cmt-->
20952 <span typeof="mw:Nowiki">=foo=</span></p>
20953
20954 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
20955 !!end
20956
20957 # New headings and existing headings are handled differently
20958 !! test
20959 Headings: 1. Nested inside html
20960 !! options
20961 parsoid=html2wt
20962 !! html
20963 <h1>=foo=</h1>
20964 <h2>=foo=</h2>
20965 <h3>=foo=</h3>
20966
20967 <h1 data-parsoid=''>=foo=</h1>
20968 <h2 data-parsoid=''>=foo=</h2>
20969 <h3 data-parsoid=''>=foo=</h3>
20970 <h4 data-parsoid=''>=foo=</h4>
20971 <h5 data-parsoid=''>=foo=</h5>
20972 <h6 data-parsoid=''>=foo=</h6>
20973 !! wikitext
20974 = =foo= =
20975
20976 == =foo= ==
20977
20978 === =foo= ===
20979
20980 =<nowiki>=foo=</nowiki>=
20981 ==<nowiki>=foo=</nowiki>==
20982 ===<nowiki>=foo=</nowiki>===
20983 ====<nowiki>=foo=</nowiki>====
20984 =====<nowiki>=foo=</nowiki>=====
20985 ======<nowiki>=foo=</nowiki>======
20986
20987 !!end
20988
20989 !! test
20990 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
20991 !! options
20992 parsoid=html2wt
20993 !! html
20994 <h1>foo</h1>*bar
20995 <h1>foo</h1>=bar
20996 <h1>foo</h1>=bar=
20997 !! wikitext
20998 = foo =
20999 <nowiki>*</nowiki>bar
21000
21001 = foo =
21002 =bar
21003
21004 = foo =
21005 <nowiki>=bar=</nowiki>
21006 !!end
21007
21008 !! test
21009 Headings: 3. Nested inside html with wikitext split by html tags
21010 !! options
21011 parsoid=html2wt,wt2wt
21012 !! wikitext
21013 = ='''bold'''<nowiki>foo=</nowiki> =
21014 !! html/parsoid
21015 <h1>=<b>bold</b>foo=</h1>
21016 !!end
21017
21018 !! test
21019 Headings: 4a. No escaping needed (testing just h1 and h2)
21020 !! wikitext
21021 = =foo =
21022
21023 = foo= =
21024
21025 = =foo= =
21026
21027 = =foo= bar =
21028
21029 == =foo ==
21030
21031 == foo= ==
21032
21033 = = =
21034
21035 = ''=''foo= =
21036 !! html/parsoid
21037 <h1>=foo</h1>
21038 <h1>foo=</h1>
21039 <h1> =foo= </h1>
21040 <h1>=foo= bar</h1>
21041 <h2>=foo</h2>
21042 <h2>foo=</h2>
21043 <h1>=</h1>
21044 <h1><i>=</i>foo=</h1>
21045 !!end
21046
21047 !! test
21048 Headings: 4b. No escaping needed (inside p-tags)
21049 !! options
21050 parsoid=html2wt
21051 !! html
21052 <p>===
21053 =foo= x
21054 =foo= <s></s>
21055 </p>
21056 !! wikitext
21057 ===
21058 =foo= x
21059 =foo= <s></s>
21060 !!end
21061
21062 !! test
21063 Headings: 5. Empty headings
21064 !! options
21065 parsoid
21066 !! wikitext
21067 =<nowiki/>=
21068
21069 ==<nowiki/>==
21070
21071 ===<nowiki/>===
21072
21073 ====<nowiki/>====
21074
21075 =====<nowiki/>=====
21076
21077 ======<nowiki/>======
21078 !! html
21079 <h1></h1>
21080 <h2></h2>
21081 <h3></h3>
21082 <h4></h4>
21083 <h5></h5>
21084 <h6></h6>
21085 !!end
21086
21087 !! test
21088 Headings: 6a. Heading chars in SOL context (with trailing spaces)
21089 !! options
21090 parsoid
21091 !! wikitext
21092 <nowiki>=a=</nowiki>
21093
21094 <nowiki>=a=</nowiki>
21095
21096 <nowiki>=a=</nowiki>
21097
21098 <nowiki>=a=</nowiki>
21099 !! html
21100 <p>=a=</p>
21101 <p>=a= </p>
21102 <p>=a= </p>
21103 <p>=a= </p>
21104 !!end
21105
21106 !! test
21107 Headings: 6b. Heading chars in SOL context (with trailing newlines)
21108 !! options
21109 parsoid
21110 !! wikitext
21111 <nowiki>=a=
21112 b</nowiki>
21113
21114 <nowiki>=a=
21115 b</nowiki>
21116
21117 <nowiki>=a=
21118 b</nowiki>
21119
21120 <nowiki>=a=
21121 b</nowiki>
21122 !! html
21123 <p>=a=
21124 b</p>
21125 <p>=a=
21126 b</p>
21127 <p>=a=
21128 b</p>
21129 <p>=a=
21130 b</p>
21131 </p>
21132 !!end
21133
21134 !! test
21135 Headings: 6c. Heading chars in SOL context (leading newline break)
21136 !! options
21137 parsoid
21138 !! wikitext
21139 a
21140 <nowiki>=b=</nowiki>
21141 !! html
21142 <p>a
21143 =b=</p>
21144 !!end
21145
21146 !! test
21147 Headings: 6d. Heading chars in SOL context (with interspersed comments)
21148 !! options
21149 parsoid
21150 !! wikitext
21151 <!--c0--><nowiki>=a=</nowiki>
21152
21153 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
21154 !! html
21155 <p><!--c0-->=a=</p>
21156 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
21157 !!end
21158
21159 !! test
21160 Headings: 6d. Heading chars in SOL context (No escaping needed)
21161 !! options
21162 parsoid=html2wt
21163 !! html
21164 =a=<div>b</div>
21165 !! wikitext
21166 =a=<div>b</div>
21167 !!end
21168
21169 !! test
21170 Headings: 7. Insert a newline between new content and headings
21171 !! options
21172 parsoid=html2wt
21173 !! html
21174 <h2>NEW</h2>
21175 <p>new</p>
21176 <h2 data-parsoid='{"dsr":[0,5,2,2]}'>A</h2>
21177 <p data-parsoid='{"dsr":[6,7,0,0]}'>a</p>
21178 !! wikitext
21179 == NEW ==
21180 new
21181
21182 ==A==
21183 a
21184
21185 !! end
21186
21187 #### --------------- Lists ---------------
21188 #### 0. Outside nests (*foo, etc.)
21189 #### 1. Nested inside html <ul><li>*foo</li></ul>
21190 #### 2. Inside definition lists
21191 #### 3. Only bullets at start should be escaped
21192 #### 4. No escapes needed
21193 #### 5. No unnecessary escapes
21194 #### 6. Escape bullets in SOL position
21195 #### 7. Escape bullets in a multi-line context
21196 #### ----------------------------------------
21197
21198 !! test
21199 Lists: 0. Outside nests
21200 !! wikitext
21201 <nowiki>*</nowiki>foo
21202
21203 <nowiki>#</nowiki>foo
21204
21205 <nowiki>;Foo:</nowiki>bar
21206 !! html
21207 <p>*foo
21208 </p><p>#foo
21209 </p><p>;Foo:bar
21210 </p>
21211 !!end
21212
21213 !! test
21214 Lists: 1. Nested inside html
21215 !! wikitext
21216 *<nowiki>*foo</nowiki>
21217
21218 *<nowiki>#foo</nowiki>
21219
21220 *<nowiki>:foo</nowiki>
21221
21222 *<nowiki>;foo</nowiki>
21223
21224 #<nowiki>*foo</nowiki>
21225
21226 #<nowiki>#foo</nowiki>
21227
21228 #<nowiki>:foo</nowiki>
21229
21230 #<nowiki>;foo</nowiki>
21231 !! html
21232 <ul><li>*foo</li></ul>
21233 <ul><li>#foo</li></ul>
21234 <ul><li>:foo</li></ul>
21235 <ul><li>;foo</li></ul>
21236 <ol><li>*foo</li></ol>
21237 <ol><li>#foo</li></ol>
21238 <ol><li>:foo</li></ol>
21239 <ol><li>;foo</li></ol>
21240
21241 !!end
21242
21243 !! test
21244 Lists: 2. Inside definition lists
21245 !! wikitext
21246 ;<nowiki>;foo</nowiki>
21247
21248 ;<nowiki>:foo</nowiki>
21249
21250 ;<nowiki>:foo</nowiki>
21251 :bar
21252
21253 :<nowiki>:foo</nowiki>
21254 !! html
21255 <dl><dt>;foo</dt></dl>
21256 <dl><dt>:foo</dt></dl>
21257 <dl><dt>:foo</dt>
21258 <dd>bar</dd></dl>
21259 <dl><dd>:foo</dd></dl>
21260
21261 !!end
21262
21263 !! test
21264 Lists: 3. Only bullets at start of text should be escaped
21265 !! wikitext
21266 *<nowiki>*foo*bar</nowiki>
21267
21268 *<nowiki>*foo</nowiki>''it''*bar
21269 !! html
21270 <ul><li>*foo*bar</li></ul>
21271 <ul><li>*foo<i>it</i>*bar</li></ul>
21272
21273 !!end
21274
21275 !! test
21276 Lists: 4. No escapes needed
21277 !! options
21278 parsoid
21279 !! wikitext
21280 *foo*bar
21281
21282 *''foo''*bar
21283
21284 *[[Foo]]: bar
21285
21286 *[[Foo]]*bar
21287 !! html
21288 <ul>
21289 <li>foo*bar
21290 </li>
21291 </ul>
21292 <ul>
21293 <li><i>foo</i>*bar
21294 </li>
21295 </ul>
21296 <ul>
21297 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
21298 </li>
21299 </ul>
21300 <ul>
21301 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
21302 </li>
21303 </ul>
21304 !!end
21305
21306 !! test
21307 Lists: 5. No unnecessary escapes
21308 !! wikitext
21309 * bar <span><nowiki>[[foo]]</nowiki></span>
21310
21311 * =bar <span><nowiki>[[foo]]</nowiki></span>
21312
21313 * [[bar <span><nowiki>[[foo]]</nowiki></span>
21314
21315 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
21316
21317 * =bar <span>foo]]</span>=
21318
21319 * <s></s>: a
21320
21321 * ''* foo''
21322 !! html
21323 <ul><li> bar <span>[[foo]]</span></li></ul>
21324 <ul><li> =bar <span>[[foo]]</span></li></ul>
21325 <ul><li> [[bar <span>[[foo]]</span></li></ul>
21326 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
21327 <ul><li> =bar <span>foo]]</span>=</li></ul>
21328 <ul><li> <s></s>: a</li></ul>
21329 <ul><li> <i>* foo</i></li></ul>
21330
21331 !!end
21332
21333 !! test
21334 Lists: 6. Escape bullets in SOL position
21335 !! options
21336 parsoid=html2wt
21337 !! html
21338 <p><!--cmt-->*foo</p>
21339 !! wikitext
21340 <!--cmt--><nowiki>*</nowiki>foo
21341 !!end
21342
21343 !! test
21344 Lists: 7. Escape bullets in a multi-line context
21345 !! wikitext
21346 a
21347 <nowiki>*</nowiki>b
21348 !! html
21349 <p>a
21350 *b
21351 </p>
21352 !!end
21353
21354 !! test
21355 Lists: 8. Escape colons only if not present in tags
21356 !! options
21357 parsoid=html2wt
21358 !! html
21359 <dl><dt>a:b<i>c:d</i></dt></dl>
21360 !! wikitext
21361 ; <nowiki>a:b</nowiki>''c:d''
21362 !! end
21363
21364 #### --------------- HRs ---------------
21365 #### 1. Single line
21366 #### -----------------------------------
21367
21368 !! test
21369 HRs: 1. Single line
21370 !! wikitext
21371 ----<nowiki>----</nowiki>
21372 ----=foo=
21373 ----*foo
21374 !! html+tidy
21375 <hr />
21376 <p>----</p>
21377 <hr />
21378 <p>=foo=</p>
21379 <hr />
21380 <p>*foo</p>
21381 !! end
21382
21383 #### --------------- Tables ---------------
21384 #### 1a. Simple example
21385 #### 1b. No escaping needed (!foo)
21386 #### 1c. No escaping needed (|foo)
21387 #### 1d. No escaping needed (|}foo)
21388 ####
21389 #### 2a. Nested in td (<td>foo|bar</td>)
21390 #### 2b. Nested in td (<td>foo||bar</td>)
21391 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
21392 ####
21393 #### 3a. Nested in th (<th>foo!bar</th>)
21394 #### 3b. Nested in th (<th>foo!!bar</th>)
21395 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
21396 ####
21397 #### 4a. Escape -
21398 #### 4b. Escape +
21399 #### 4c. No escaping needed
21400 #### --------------------------------------
21401
21402 !! test
21403 Tables: 1a. Simple example
21404 !! wikitext
21405 <nowiki>{|
21406 |}</nowiki>
21407 !! html
21408 <p>{|
21409 |}
21410 </p>
21411 !! end
21412
21413 !! test
21414 Tables: 1b. No escaping needed
21415 !! wikitext
21416 !foo
21417 !! html
21418 <p>!foo
21419 </p>
21420 !! end
21421
21422 !! test
21423 Tables: 1c. No escaping needed
21424 !! wikitext
21425 |foo
21426 !! html
21427 <p>|foo
21428 </p>
21429 !! end
21430
21431 !! test
21432 Tables: 1d. No escaping needed
21433 !! wikitext
21434 |}foo
21435 !! html
21436 <p>|}foo
21437 </p>
21438 !! end
21439
21440 !! test
21441 Tables: 2a. Nested in td
21442 !! options
21443 parsoid=html2wt
21444 !! html/parsoid
21445 <table><tbody><tr>
21446 <td>foo|bar</td></tr>
21447 <tr><td>x<div>a|b</div></td>
21448 </tbody></table>
21449 !! wikitext
21450 {|
21451 |<nowiki>foo|bar</nowiki>
21452 |-
21453 |x<div><nowiki>a|b</nowiki></div>
21454 |}
21455 !! html/php+tidy
21456 <table>
21457 <tr>
21458 <td>foo|bar</td>
21459 </tr>
21460 <tr>
21461 <td>x
21462 <div>a|b</div>
21463 </td>
21464 </tr>
21465 </table>
21466 !! end
21467
21468 !! test
21469 Tables: 2b. Nested in td
21470 !! options
21471 parsoid=html2wt
21472 !! html/parsoid
21473 <table><tbody><tr>
21474 <td>foo||bar</td>
21475 <td>a<i>b||c</i></td>
21476 <td>a<i><div>b||c</div></i></td>
21477 </tr></tbody></table>
21478 !! wikitext
21479 {|
21480 |<nowiki>foo||bar</nowiki>
21481 |a''<nowiki>b||c</nowiki>''
21482 |a''<div><nowiki>b||c</nowiki></div>''
21483 |}
21484 !! html/php
21485 <table>
21486 <tr>
21487 <td>foo||bar
21488 </td>
21489 <td>a<i>b||c</i>
21490 </td>
21491 <td>a<i><div>b||c</div></i>
21492 </td></tr></table>
21493
21494 !! end
21495
21496 !! test
21497 Tables: 2c. Nested in td -- no escaping needed
21498 !! wikitext
21499 {|
21500
21501 |foo!!bar
21502 |}
21503 !! html/*
21504 <table>
21505
21506 <tr>
21507 <td>foo!!bar
21508 </td></tr></table>
21509
21510 !! end
21511
21512 !! test
21513 Tables: 3a. Nested in th
21514 !! wikitext
21515 {|
21516
21517 !foo!bar
21518 |}
21519 !! html/*
21520 <table>
21521
21522 <tr>
21523 <th>foo!bar
21524 </th></tr></table>
21525
21526 !! end
21527
21528 !! test
21529 Tables: 3b. Nested in th
21530 !! options
21531 parsoid=html2wt
21532 !! html/parsoid
21533 <table><tbody>
21534 <tr><th>foo!!bar</th>
21535 <th><i>foo|bar</i></th>
21536 <th><i>foo!!bar</i></th>
21537 <th><i><span>foo!!bar</span></i></th>
21538 </tr></tbody></table>
21539 !! wikitext
21540 {|
21541 !<nowiki>foo!!bar</nowiki>
21542 !''<nowiki>foo|bar</nowiki>''
21543 !''<nowiki>foo!!bar</nowiki>''
21544 !''<span><nowiki>foo!!bar</nowiki></span>''
21545 |}
21546 !! html/php
21547 <table>
21548 <tr>
21549 <th>foo!!bar
21550 </th>
21551 <th><i>foo|bar</i>
21552 </th>
21553 <th><i>foo!!bar</i>
21554 </th>
21555 <th><i><span>foo!!bar</span></i>
21556 </th></tr></table>
21557
21558 !! end
21559
21560 !! test
21561 Tables: 3c. Nested in th
21562 !! options
21563 parsoid=html2wt
21564 !! html/parsoid
21565 <table><tbody>
21566 <tr><th>foo||bar</th>
21567 <th><span typeof="mw:Nowiki">foo||bar</span></th>
21568 </tr></tbody></table>
21569 !! wikitext
21570 {|
21571 !<nowiki>foo||bar</nowiki>
21572 !<nowiki>foo||bar</nowiki>
21573 |}
21574 !! html/php
21575 <table>
21576 <tr>
21577 <th>foo||bar
21578 </th>
21579 <th>foo||bar
21580 </th></tr></table>
21581
21582 !! end
21583
21584 !! test
21585 Tables: 4a. Escape -
21586 !! options
21587 parsoid=html2wt
21588 !! html/*
21589 <table>
21590
21591 <tr>
21592 <th>-bar
21593 </th></tr>
21594 <tr>
21595 <td>-bar
21596 </td></tr></table>
21597
21598 !! wikitext
21599 {|
21600
21601 !-bar
21602
21603 |-
21604 |<nowiki>-bar</nowiki>
21605 |}
21606 !! end
21607
21608 !! test
21609 Tables: 4b. Escape +
21610 !! options
21611 parsoid=html2wt
21612 !! html/*
21613 <table>
21614
21615 <tr>
21616 <th>+bar
21617 </th></tr>
21618 <tr>
21619 <td>+bar
21620 </td></tr></table>
21621
21622 !! wikitext
21623 {|
21624
21625 !+bar
21626
21627 |-
21628 |<nowiki>+bar</nowiki>
21629 |}
21630 !! end
21631
21632 !! test
21633 Tables: 4c. No escaping needed
21634 !! wikitext
21635 {|
21636 |foo-bar
21637 |foo+bar
21638 |-
21639 |''foo''-bar
21640 |''foo''+bar
21641 |-
21642 |foo
21643 bar|baz
21644 +bar
21645 -bar
21646 |-
21647 |x
21648 <div>a|b</div>
21649 |}
21650 !! html/php
21651 <table>
21652 <tr>
21653 <td>foo-bar
21654 </td>
21655 <td>foo+bar
21656 </td></tr>
21657 <tr>
21658 <td><i>foo</i>-bar
21659 </td>
21660 <td><i>foo</i>+bar
21661 </td></tr>
21662 <tr>
21663 <td>foo
21664 <p>bar|baz
21665 +bar
21666 -bar
21667 </p>
21668 </td></tr>
21669 <tr>
21670 <td>x
21671 <div>a|b</div>
21672 </td></tr></table>
21673
21674 !! html/parsoid
21675 <table><tbody>
21676 <tr><td>foo-bar</td><td>foo+bar</td></tr>
21677 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
21678 <tr><td>foo
21679 <p>bar|baz
21680 +bar
21681 -bar</p></td></tr>
21682 <tr><td>x
21683 <div>a|b</div></td>
21684 </tbody></table>
21685 !! end
21686
21687 !! test
21688 Tables: 4d. No escaping needed
21689 !! wikitext
21690 {|
21691 |[[Foo]]-bar
21692 ||+1
21693 ||-2
21694 |}
21695 !! html/php
21696 <table>
21697 <tr>
21698 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
21699 </td>
21700 <td>+1
21701 </td>
21702 <td>-2
21703 </td></tr></table>
21704
21705 !! html/parsoid
21706 <table>
21707 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
21708 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
21709 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
21710 </tbody></table>
21711 !! end
21712
21713 !! test
21714 Tables: Digest broken attributes on table and tr tag
21715 !! options
21716 parsoid=wt2html
21717 !! wikitext
21718 {| || |} ++
21719 |- || || ++ --
21720 |- > [
21721 |}
21722 !! html
21723 <table>
21724 <tbody>
21725 <tr></tr>
21726 <tr></tr>
21727 </tbody></table>
21728 !! end
21729
21730 #### --------------- Links ----------------
21731 #### 1. Quote marks in link text
21732 #### 2. Wikilinks: Escapes needed
21733 #### 3. Wikilinks: No escapes needed
21734 #### 4. Extlinks: Escapes needed
21735 #### 5. Extlinks: No escapes needed
21736 #### --------------------------------------
21737 !! test
21738 Links 1. WikiLinks: No escapes needed
21739 !! wikitext
21740 [[Foo|Foo''boo'']]
21741 [[Foo|[Foobar]]]
21742 [[Foo|x [Foobar] x]]
21743 !! html/php
21744 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
21745 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
21746 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
21747 </p>
21748 !! html/parsoid
21749 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
21750 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
21751 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
21752 !! end
21753
21754 !! test
21755 Links 2. WikiLinks: Escapes needed
21756 !! options
21757 parsoid=html2wt
21758 !! html/parsoid
21759 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
21760 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
21761 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
21762 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
21763 <a href="Foo" rel="mw:WikiLink">|Bar</a>
21764 <a href="Foo" rel="mw:WikiLink">]]bar</a>
21765 <a href="Foo" rel="mw:WikiLink">[[bar</a>
21766 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
21767 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
21768 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
21769 !! wikitext
21770 [[Foo|<nowiki>Foobar]</nowiki>]]
21771 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
21772 [[Foo|<nowiki>[[Bar]]</nowiki>]]
21773 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
21774 [[Foo|<nowiki>|Bar</nowiki>]]
21775 [[Foo|<nowiki>]]bar</nowiki>]]
21776 [[Foo|<nowiki>[[bar</nowiki>]]
21777 [[Foo|<nowiki>x [[ y</nowiki>]]
21778 [[Foo|<nowiki>x ]] y</nowiki>]]
21779 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
21780 !! html/php
21781 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
21782 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
21783 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
21784 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
21785 <a href="/wiki/Foo" title="Foo">|Bar</a>
21786 <a href="/wiki/Foo" title="Foo">]]bar</a>
21787 <a href="/wiki/Foo" title="Foo">[[bar</a>
21788 <a href="/wiki/Foo" title="Foo">x [[ y</a>
21789 <a href="/wiki/Foo" title="Foo">x ]] y</a>
21790 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
21791 </p>
21792 !! end
21793
21794 !! test
21795 Links 3. WikiLinks: No escapes needed
21796 !! wikitext
21797 [[Foo|[Foobar]]
21798 [[Foo|foo|bar]]
21799 !! html/php
21800 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
21801 <a href="/wiki/Foo" title="Foo">foo|bar</a>
21802 </p>
21803 !! html/parsoid
21804 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
21805 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
21806 !! end
21807
21808 !! test
21809 Links 4. ExtLinks: Escapes needed
21810 !! options
21811 parsoid=html2wt
21812 !! html/parsoid
21813 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
21814 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
21815 <p>[http://google.com]</p>
21816 <p>[http://google.com google]</p>
21817 !! wikitext
21818 [http://google.com <nowiki>[google]</nowiki>]
21819 [http://google.com <nowiki>google]</nowiki>]
21820
21821 <nowiki>[http://google.com]</nowiki>
21822
21823 <nowiki>[http://google.com google]</nowiki>
21824
21825 !! html/php
21826 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
21827 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
21828 </p><p>[http://google.com]
21829 </p><p>[http://google.com google]
21830 </p>
21831 !! end
21832
21833 !! test
21834 Links 5. ExtLinks: No escapes needed
21835 !! wikitext
21836 [http://google.com [google]
21837 !! html/php
21838 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
21839 </p>
21840 !! html/parsoid
21841 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
21842 !! end
21843
21844 !! test
21845 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
21846 !! html/parsoid
21847 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
21848 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
21849 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
21850 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
21851 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
21852 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
21853 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
21854 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
21855 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
21856 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
21857 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
21858 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
21859 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
21860 </p>
21861 !! wikitext
21862 x<nowiki/>http://example.com<nowiki/>y
21863 http://example.com<nowiki/>?x
21864 http://example.com<nowiki/>&x
21865 http://example.com<nowiki/>'x
21866 http://example.com<nowiki/>,x
21867 http://example.com<nowiki/>.x
21868 http://example.com<nowiki/>;x
21869 http://example.com<nowiki/>:x
21870 http://example.com<nowiki/>;x
21871 http://example.com<nowiki/>!x
21872 http://example.com<nowiki/>=x
21873 http://example.com<nowiki/>(x)
21874 http://example.com(x<nowiki/>)
21875 !! end
21876
21877 !! test
21878 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
21879 !! html/parsoid
21880 <p>x
21881 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
21882 y
21883 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
21884 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
21885 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
21886 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
21887 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
21888 </p>
21889 !! wikitext
21890 x
21891 http://example.com
21892 y
21893 "http://example.com"
21894 (http://example.com)
21895 (http://example.com) foo
21896 http://example.com,
21897 http://example.com, foo
21898 !! html/php
21899 <p>x
21900 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
21901 y
21902 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
21903 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
21904 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
21905 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
21906 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
21907 </p>
21908 !! end
21909
21910 !! test
21911 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
21912 !! html/parsoid
21913 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
21914 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
21915 !! wikitext
21916 http://example.com.,;:!?\
21917 -http://example.com:
21918 !! html/php
21919 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
21920 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
21921 </p>
21922 !! end
21923
21924 !! test
21925 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
21926 !! html/parsoid
21927 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
21928 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
21929 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
21930 !! wikitext
21931 RFC 123<nowiki/>4
21932 RFC 123<nowiki/>y
21933 X<nowiki/>RFC 123<nowiki/>y
21934 !! end
21935
21936 !! test
21937 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
21938 !! html/parsoid
21939 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
21940 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
21941 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
21942 </p>
21943 !! wikitext
21944 RFC 123?foo
21945 RFC 123&foo
21946 -RFC 123-
21947 !! html/php
21948 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
21949 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
21950 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
21951 </p>
21952 !! end
21953
21954 !! test
21955 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
21956 !! html/parsoid
21957 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
21958 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
21959 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
21960 !! wikitext
21961 PMID 123<nowiki/>4
21962 PMID 123<nowiki/>y
21963 X<nowiki/>PMID 123<nowiki/>y
21964 !! end
21965
21966 !! test
21967 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
21968 !! html/parsoid
21969 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
21970 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
21971 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
21972 </p>
21973 !! wikitext
21974 PMID 123?foo
21975 PMID 123&foo
21976 -PMID 123-
21977 !! html/php
21978 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
21979 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
21980 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
21981 </p>
21982 !! end
21983
21984 !! test
21985 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
21986 !! html/parsoid
21987 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
21988 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
21989 a<a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
21990 </p>
21991 !! wikitext
21992 ISBN 1234567890<nowiki/>1
21993 ISBN 1234567890<nowiki/>x
21994 a<nowiki/>ISBN 1234567890<nowiki/>b
21995 !! end
21996
21997 !! test
21998 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
21999 !! html/parsoid
22000 <p>-<a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
22001 !! wikitext
22002 -ISBN 1234567890's
22003 !! html/php
22004 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
22005 </p>
22006 !! end
22007
22008 !! test
22009 Links 14. Protect link-like plain text. (Parsoid bug T78425)
22010 !! options
22011 parsoid=html2wt
22012 !! html/*
22013 <p>this is not a link: http://example.com
22014 </p>
22015 !! wikitext
22016 this is not a link: <nowiki>http://example.com</nowiki>
22017 !! end
22018
22019 !! test
22020 Links 15. Link trails can't become link prefixes.
22021 !! options
22022 language=is
22023 !! wikitext
22024 [[Söfnuður]]-[[00]]
22025 !! html/php
22026 <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>
22027 </p>
22028 !! html/parsoid
22029 <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>
22030 !! end
22031
22032 #### --------------- Quotes ---------------
22033 #### 1. Quotes inside <b> and <i>
22034 #### 2. Link fragments separated by <i> and <b> tags
22035 #### 3. Link fragments inside <i> and <b>
22036 #### 4. No escaping needed
22037 #### --------------------------------------
22038 !! test
22039 1a. Quotes inside <b> and <i>
22040 !! options
22041 parsoid=html2wt,wt2wt
22042 !! wikitext
22043 ''<nowiki/>'foo'''
22044 ''<nowiki>''foo''</nowiki>''
22045 ''<nowiki>'''foo'''</nowiki>''
22046 ''foo''<nowiki/>'s
22047 '''<nowiki/>'foo''''
22048 '''<nowiki>''foo''</nowiki>'''
22049 '''<nowiki>'''foo'''</nowiki>'''
22050 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
22051 '''foo'''<nowiki/>'s
22052 '''foo''
22053 ''foo''<nowiki/>'
22054 ''foo'''<nowiki/>'
22055 '''foo''<nowiki/>'
22056 ''''foo'''
22057 '''foo'''<nowiki/>'
22058 ''''foo'''<nowiki/>'
22059 ''fools'<span> errand</span>''
22060 ''<span>fool</span>'s errand''
22061 '<nowiki/>''foo'' bar '''baz''
22062 a|!*#-:;+-~[]{}b'''x''
22063 !! html/*
22064 <p><i>'foo'</i>
22065 <i>''foo''</i>
22066 <i>'''foo'''</i>
22067 <i>foo</i>'s
22068 <b>'foo'</b>
22069 <b>''foo''</b>
22070 <b>'''foo'''</b>
22071 <b>foo'<i>bar'</i>baz</b>
22072 <b>foo</b>'s
22073 '<i>foo</i>
22074 <i>foo</i>'
22075 <i>foo'</i>'
22076 '<i>foo</i>'
22077 '<b>foo</b>
22078 <b>foo</b>'
22079 '<b>foo</b>'
22080 <i>fools'<span> errand</span></i>
22081 <i><span>fool</span>'s errand</i>
22082 '<i>foo</i> bar '<i>baz</i>
22083 a|!*#-:;+-~[]{}b'<i>x</i>
22084 </p>
22085 !! end
22086
22087 !! test
22088 1b. Quotes inside <b> and <i> with other tags on same line
22089 !! options
22090 parsoid=html2wt,wt2wt
22091 !! wikitext
22092 '''a'' foo ''[[bar]]''
22093 ''a''' foo ''[[bar]]''
22094 ''a''' foo '''{{echo|[[bar]]}}'''
22095 [[foo]] x'''[[bar]]''
22096 '''foo'' <ref>test</ref>
22097 '''foo'' <div title="name">test</div>
22098 '''foo'' and <br> bar
22099 <references />
22100 !! html
22101 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
22102 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
22103 <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>
22104 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
22105 '<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>
22106 '<i>foo</i> <div title="name">test</div>
22107 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
22108 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
22109 <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>
22110 </ol>
22111 !! end
22112
22113 !! test
22114 2. Link fragments separated by <i> and <b> tags
22115 !! wikitext
22116 [[''foo''<nowiki>hello]]</nowiki>
22117
22118 [['''foo'''<nowiki>hello]]</nowiki>
22119 !! html
22120 <p>[[<i>foo</i>hello]]
22121 </p><p>[[<b>foo</b>hello]]
22122 </p>
22123 !! end
22124
22125 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
22126 # this is one of the shortcomings of this format
22127 !! test
22128 3. Link fragments inside <i> and <b>
22129 !! wikitext
22130 ''[[foo''<nowiki>]]</nowiki>
22131
22132 '''[[foo'''<nowiki>]]</nowiki>
22133 !! html
22134 <p><i>[[foo</i>]]
22135 </p><p><b>[[foo</b>]]
22136 </p>
22137 !! end
22138
22139 !! test
22140 4. No escaping needed
22141 !! wikitext
22142 '<span>''bar''</span>'
22143 '<span>'''bar'''</span>'
22144 'a:b'foo
22145 !! html
22146 <p>'<span><i>bar</i></span>'
22147 '<span><b>bar</b></span>'
22148 'a:b'foo
22149 </p>
22150 !! end
22151
22152 #### ----------- Paragraphs ---------------
22153 #### 1. No unnecessary escapes
22154 #### --------------------------------------
22155
22156 !! test
22157 1. No unnecessary escapes
22158 !! wikitext
22159 bar <span><nowiki>[[foo]]</nowiki></span>
22160
22161 =bar <span><nowiki>[[foo]]</nowiki></span>
22162
22163 [[bar <span><nowiki>[[foo]]</nowiki></span>
22164
22165 ]]bar <span><nowiki>[[foo]]</nowiki></span>
22166
22167 =bar <span>foo]]</span><nowiki>=</nowiki>
22168 !! html
22169 <p>bar <span>[[foo]]</span>
22170 </p><p>=bar <span>[[foo]]</span>
22171 </p><p>[[bar <span>[[foo]]</span>
22172 </p><p>]]bar <span>[[foo]]</span>
22173 </p><p>=bar <span>foo]]</span>=
22174 </p>
22175 !!end
22176
22177 #### ----------------------- PRE --------------------------
22178 #### 1. Leading whitespace in SOL context should be escaped
22179 #### ------------------------------------------------------
22180 !! test
22181 1. Leading whitespace in SOL context should be escaped
22182 !! options
22183 parsoid
22184 !! wikitext
22185 <nowiki> </nowiki>a
22186
22187 <nowiki> </nowiki> a
22188
22189 <nowiki> </nowiki>a(tab)
22190
22191 <nowiki> </nowiki> a
22192 <!--cmt-->
22193 <nowiki> </nowiki> a
22194
22195 a
22196 <nowiki> </nowiki>b
22197
22198 a
22199 <nowiki> </nowiki>b
22200
22201 a
22202 <nowiki> </nowiki> b
22203 !! html
22204 <p> a</p>
22205 <p> a</p>
22206 <p> a(tab)</p>
22207 <p> a</p>
22208 <p><!--cmt--> a</p>
22209 <p>a
22210 b</p>
22211 <p>a
22212 b</p>
22213 <p>a
22214 b</p>
22215 !! end
22216
22217 !! test
22218 2. Leading whitespace in non-indent-pre contexts should not be escaped
22219 !! options
22220 parsoid
22221 !! wikitext
22222 foo <ref>''a''
22223 b</ref>
22224 <references />
22225 !! html
22226 <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>
22227 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22228 <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>
22229 b</span></li>
22230 </ol>
22231 !! end
22232
22233 !! test
22234 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
22235 !! options
22236 parsoid
22237 !! wikitext
22238 <blockquote>
22239 a
22240 <span>b</span>
22241 c
22242 </blockquote>
22243 !! html
22244 <blockquote>
22245 <p>
22246 a
22247 <span>b</span>
22248 c</p>
22249 </blockquote>
22250 !! end
22251
22252 !! test
22253 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
22254 !! options
22255 parsoid
22256 !! wikitext
22257 [[File:Foobar.jpg|thumb|caption]]
22258 !! html/parsoid
22259 <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>
22260 !! end
22261
22262 !! test
22263 5. Nowiki escaping should account for indent-pres
22264 !! options
22265 parsoid=html2wt
22266 !! html
22267 <pre>==foo==</pre>
22268 !! wikitext
22269 ==foo==
22270 !! end
22271
22272 #### --------------- Behavior Switches --------------------
22273 !! test
22274 1. Valid behavior switches should be escaped
22275 !! options
22276 parsoid=html2wt
22277 !! html
22278 __TOC__
22279 <i>__TOC__</i>
22280 !! wikitext
22281 <nowiki>__TOC__</nowiki>
22282 ''<nowiki>__TOC__</nowiki>''
22283 !! end
22284
22285 !! test
22286 2. Invalid behavior switches should not be escaped
22287 !! options
22288 parsoid=html2wt
22289 !! html
22290 __TOO__
22291 __|__
22292 !! wikitext
22293 __TOO__
22294 __|__
22295 !! end
22296
22297 #### --------------- HTML tags ---------------
22298 #### 1. a tags
22299 #### 2. other tags
22300 #### 3. multi-line html tag
22301 #### 4. extension tags
22302 #### -----------------------------------------
22303 !! test
22304 1. a tags
22305 !! options
22306 parsoid
22307 !! wikitext
22308 <a href="http://google.com">google</a>
22309 !! html
22310 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
22311 !! end
22312
22313 !! test
22314 2. other tags
22315 !! wikitext
22316 * <nowiki><div>foo</div></nowiki>
22317 * <nowiki><div style="color:red">foo</div></nowiki>
22318 * <nowiki><td></nowiki>
22319 !! html
22320 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
22321 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
22322 <li> &lt;td&gt;</li></ul>
22323
22324 !! end
22325
22326 !! test
22327 3. multi-line html tag
22328 !! wikitext
22329 <nowiki><div
22330 >foo</div
22331 ></nowiki>
22332 !! html
22333 <p>&lt;div
22334 &gt;foo&lt;/div
22335 &gt;
22336 </p>
22337 !! end
22338
22339 !! test
22340 4. extension tags
22341 !! wikitext
22342 <nowiki><ref>foo</ref></nowiki>
22343
22344 <nowiki><ref>bar</nowiki>
22345
22346 baz<nowiki></ref></nowiki>
22347 !! html
22348 <p>&lt;ref&gt;foo&lt;/ref&gt;
22349 </p><p>&lt;ref&gt;bar
22350 </p><p>baz&lt;/ref&gt;
22351 </p>
22352 !! end
22353
22354 #### --------------- Others ---------------
22355 !! test
22356 Escaping nowikis
22357 !! wikitext
22358 &lt;nowiki&gt;foo&lt;/nowiki&gt;
22359 !! html
22360 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
22361 </p>
22362 !! end
22363
22364 ## The quote-char in the input is necessary for triggering the bug
22365 !! test
22366 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
22367 !! options
22368 parsoid=wt2wt,html2wt
22369 !! wikitext
22370 foo's bar :
22371 !! html
22372 <p>foo's bar :</p>
22373 !! end
22374
22375 !! test
22376
22377 Tag-like HTML structures are passed through as text
22378 !! wikitext
22379 <x y>
22380
22381 <x.y>
22382
22383 <x-y>
22384
22385 1>2
22386
22387 x<y
22388
22389 a>b
22390
22391 1<d e>f
22392 !! html
22393 <p>&lt;x y&gt;
22394 </p><p>&lt;x.y&gt;
22395 </p><p>&lt;x-y&gt;
22396 </p><p>1&gt;2
22397 </p><p>x&lt;y
22398 </p><p>a&gt;b
22399 </p><p>1&lt;d e&gt;f
22400 </p>
22401 !! end
22402
22403 !! test
22404 HTML tag with necessary entities in attributes
22405 !! wikitext
22406 <span title="&amp;amp;">foo</span>
22407 !! html
22408 <p><span title="&amp;amp;">foo</span>
22409 </p>
22410 !! end
22411
22412 !! test
22413 HTML tag with 'unnecessary' entity encoding in attributes
22414 !! wikitext
22415 <span title="&amp;">foo</span>
22416 !! html
22417 <p><span title="&amp;">foo</span>
22418 </p>
22419 !! end
22420
22421 !! test
22422 HTML tag with broken attribute value quoting
22423 !! wikitext
22424 <span title="Hello world>Foo</span>
22425 !! html/php
22426 <p><span>Foo</span>
22427 </p>
22428 !! html/parsoid
22429 <p><span title="Hello world">Foo</span>
22430 </p>
22431 !! end
22432
22433 !! test
22434 Parsoid-only: HTML tag with broken attribute value quoting
22435 !! options
22436 parsoid
22437 !! wikitext
22438 <span title="Hello world>Foo</span>
22439 !! html
22440 <p><span title="Hello world">Foo</span>
22441 </p>
22442 !! end
22443
22444 !! test
22445 Table with broken attribute value quoting
22446 !! wikitext
22447 {|
22448 | title="Hello world|Foo
22449 |}
22450 !! html/php
22451 <table>
22452 <tr>
22453 <td>Foo
22454 </td></tr></table>
22455
22456 !! html/parsoid
22457 <table>
22458 <tr>
22459 <td title="Hello world">Foo
22460 </td></tr></table>
22461
22462 !! end
22463
22464 !! test
22465 Table with broken attribute value quoting on consecutive lines
22466 !! wikitext
22467 {|
22468 | title="Hello world|Foo
22469 | style="color:red|Bar
22470 |}
22471 !! html/php
22472 <table>
22473 <tr>
22474 <td>Foo
22475 </td>
22476 <td>Bar
22477 </td></tr></table>
22478
22479 !! html/parsoid
22480 <table><tbody>
22481 <tr>
22482 <td title="Hello world">Foo
22483 </td><td style="color: red">Bar
22484 </td></tr></tbody></table>
22485
22486 !! end
22487
22488 !! test
22489 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
22490 !! options
22491 parsoid
22492 !! wikitext
22493 {{}}
22494 !! html
22495 {{}}
22496 !! end
22497
22498 !! test
22499 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
22500 !! options
22501 parsoid
22502 !! wikitext
22503 }}{{
22504 !! html
22505 }}{{
22506 !! end
22507
22508 !!test
22509 Accept empty td cell attribute
22510 !! wikitext
22511 {|
22512 | align="center" | foo || |
22513 |}
22514 !! html
22515 <table>
22516 <tr>
22517 <td align="center"> foo </td>
22518 <td>
22519 </td></tr></table>
22520
22521 !!end
22522
22523 !!test
22524 Non-empty attributes in th-cells
22525 !! wikitext
22526 {|
22527 ! Foo !! style="color: red" | Bar
22528 |}
22529 !! html
22530 <table>
22531 <tr>
22532 <th> Foo </th>
22533 <th style="color: red"> Bar
22534 </th></tr></table>
22535
22536 !!end
22537
22538 !!test
22539 Accept empty attributes in th-cells
22540 !! wikitext
22541 {|
22542 !| foo !!| bar
22543 |}
22544 !! html
22545 <table>
22546 <tr>
22547 <th> foo </th>
22548 <th> bar
22549 </th></tr></table>
22550
22551 !!end
22552
22553 !!test
22554 Empty table rows go away
22555 !! wikitext
22556 {|
22557 | Hello
22558 | there
22559 |- class="foo"
22560 |-
22561 |}
22562 !! html
22563 <table>
22564 <tr>
22565 <td> Hello
22566 </td>
22567 <td> there
22568 </td></tr>
22569
22570 </table>
22571
22572 !! end
22573
22574 ###
22575 ### Parsoid-centric tests for testing RTing of inter-element separators
22576 ### Edge cases not tested by existing parser tests and specific to
22577 ### Parsoid-specific serialization strategies.
22578 ###
22579
22580 !!test
22581 RT-ed inter-element separators should be valid separators
22582 !! wikitext
22583 {|
22584 |- [[foo]]
22585 |}
22586 !! html
22587 <table>
22588
22589 </table>
22590
22591 !!end
22592
22593 # Parsoid-only since PHP parser relies on Tidy for correct output
22594 !!test
22595 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
22596 !!options
22597 parsoid
22598 !! wikitext
22599 {|
22600 |<small>foo
22601 bar
22602 |}
22603
22604 {|
22605 |<small>foo<small>
22606 |}
22607 !! html
22608 <table>
22609 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
22610 <p>bar</p></small></td></tr>
22611 </tbody></table>
22612
22613 <table>
22614 <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>
22615 </tbody></table>
22616 !!end
22617
22618 !!test
22619 Empty TD followed by TD with tpl-generated attribute
22620 !! wikitext
22621 {|
22622 |-
22623 |
22624 |{{echo|style='color:red'}}|foo
22625 |}
22626 !! html
22627 <table>
22628
22629 <tr>
22630 <td>
22631 </td>
22632 <td>foo
22633 </td></tr></table>
22634
22635 !!end
22636
22637 !!test
22638 Indented table with an empty td
22639 !! wikitext
22640 {|
22641 |-
22642 |
22643 |foo
22644 |}
22645 !! html
22646 <table>
22647
22648 <tr>
22649 <td>
22650 </td>
22651 <td>foo
22652 </td></tr></table>
22653
22654 !!end
22655
22656 ## We have some newline diffs RT-ing this edge case
22657 ## and it is not important enough -- we seem to be emitting
22658 ## at most 2 newlines after a </tr> and this is unrelated to
22659 ## the issue from T85627 that this is testing.
22660 !!test
22661 Indented table with blank lines in between (T85627)
22662 !! options
22663 parsoid=wt2html
22664 !! wikitext
22665 {|
22666 |foo
22667
22668
22669 |}
22670 !! html
22671 <table>
22672
22673 <tr>
22674 <td>foo
22675 </td></tr></table>
22676
22677 !!end
22678
22679 !!test
22680 Indented block & table
22681 !! wikitext
22682 <div>foo</div>
22683 {|
22684 |foo
22685 |}
22686 !! html/php
22687 <div>foo</div>
22688 <table>
22689 <tr>
22690 <td>foo
22691 </td></tr></table>
22692
22693 !! html/parsoid
22694 <div data-parsoid='{"stx":"html"}'>foo</div>
22695 <table><tbody>
22696 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
22697 </tbody></table>
22698 !!end
22699
22700 !! test
22701 Indent and comment before table row
22702 !! wikitext
22703 {|
22704 <!--hi-->|-
22705 | there
22706 |}
22707 !! html/php
22708 <table>
22709
22710 <tr>
22711 <td> there
22712 </td></tr></table>
22713
22714 !! html/parsoid
22715 <table>
22716 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
22717 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
22718 </tbody></table>
22719 !! end
22720
22721 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
22722 !!test
22723 Empty TR followed by a template-generated TR
22724 !!options
22725 parsoid
22726 !! wikitext
22727 {|
22728 |-
22729 {{echo|<tr><td>foo</td></tr>}}
22730 |}
22731 !! html
22732 <table>
22733 <tbody>
22734 <tr></tr>
22735 <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}}]}'>
22736 <td>foo</td></tr>
22737 </tbody></table>
22738 !!end
22739
22740 ## PHP and parsoid output differ for this, and since this is primarily
22741 ## for testing Parsoid's serializer, marking this Parsoid only
22742 !!test
22743 Empty TR followed by mixed-ws-comment line should RT correctly
22744 !!options
22745 parsoid
22746 !! wikitext
22747 {|
22748 |-
22749 <!--c-->
22750 |-
22751 <!--c--> <!--d-->
22752 |}
22753 !! html
22754 <table>
22755 <tbody>
22756 <tr></tr>
22757 <!--c-->
22758 <tr>
22759 <!--c--> </tr><!--d-->
22760 </tbody></table>
22761
22762 !!end
22763
22764 !!test
22765 Multi-line image caption generated by templates with/without trailing newlines
22766 !! wikitext
22767 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
22768 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
22769 !! html/parsoid
22770 <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>
22771 <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>
22772 !!end
22773
22774 !! test
22775 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
22776 !! options
22777 parsoid=html2wt
22778 !! html
22779 <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>
22780
22781 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
22782 !! wikitext
22783 <includeonly>foo</includeonly>
22784 new para
22785
22786 [[Category:Foo]]
22787
22788 = new heading =
22789 !! end
22790
22791 ## PHP emits broken html for this, and since this is primarily
22792 ## a Parsoid serializer test, marking this Parsoid only
22793 !!test
22794 Improperly nested inline or quotes tags with whitespace in between
22795 !!options
22796 parsoid
22797 !! wikitext
22798 <span> <s>x</span> </s>
22799 ''' ''x''' ''
22800 !! html
22801 <p><span> <s>x</s></span><s> </s>
22802 <b> <i>x</i></b><i> </i>
22803 </p>
22804 !!end
22805
22806 !!test
22807 Encapsulate protected attributes from wt
22808 !!options
22809 parsoid
22810 !! wikitext
22811 <div typeof="mw:placeholder stuff" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
22812 !! html
22813 <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>
22814 </body>
22815 !!end
22816
22817 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
22818 ## Having nested or stray pre tags results in the attempt to add duplicates,
22819 ## causing an assertion fail. This test tries to prevent that situation.
22820 !!test
22821 Ensure ParagraphWrapper can deal with stray closing pre tags
22822 !!options
22823 parsoid=wt2html
22824 !! wikitext
22825 plain text</pre>
22826 !! html
22827 plain text
22828 !!end
22829
22830 !!test
22831 1. Ensure fostered text content is wrapped in element nodes
22832 !!options
22833 parsoid=wt2html
22834 !! wikitext
22835 <table>hi</table><table>ho</table>
22836 !! html
22837 <p>hi</p>
22838 <table></table>
22839 <p>ho</p>
22840 <table></table>
22841 !!end
22842
22843 !!test
22844 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
22845 !!options
22846 parsoid=wt2html,wt2wt
22847 !! wikitext
22848 <table>
22849 <tr> || ||
22850 <td> a
22851 </table>
22852 !! html
22853 <p> || ||
22854 </p><table>
22855 <tbody><tr><td> a</td></tr>
22856 </tbody></table>
22857 !!end
22858
22859 !!test
22860 Encapsulation properly handles null DSR information from foster box
22861 !!options
22862 parsoid=wt2html,wt2wt
22863 !! wikitext
22864 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
22865 !! html
22866 <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>
22867 !!end
22868
22869 !!test
22870 1. Encapsulate foster-parented transclusion content
22871 !!options
22872 parsoid=wt2wt,wt2html
22873 !! wikitext
22874 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
22875 !! html
22876 <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>
22877 <tbody>
22878 <tr>
22879 <td>bar</td>
22880 </tr>
22881 </tbody>
22882 </table>
22883 !!end
22884
22885 !!test
22886 2. Encapsulate foster-parented transclusion content
22887 !!options
22888 parsoid=wt2wt,wt2html
22889 !! wikitext
22890 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
22891 !! html
22892 <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>
22893 <table>
22894 <tbody>
22895 <tr>
22896 <td>bar</td>
22897 </tr>
22898 </tbody>
22899 </table>
22900 !!end
22901
22902 !!test
22903 3. Encapsulate foster-parented transclusion content
22904 !!options
22905 parsoid=wt2wt,wt2html
22906 !! wikitext
22907 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
22908 !! html
22909 <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;]}">
22910 <p>foo</p>
22911 </div>
22912 <table>
22913 <tbody>
22914 <tr>
22915 <td>bar</td>
22916 </tr>
22917 </tbody>
22918 </table>
22919 !!end
22920
22921 !!test
22922 4. Encapsulate foster-parented transclusion content
22923 !!options
22924 parsoid=wt2wt,wt2html
22925 !! wikitext
22926 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
22927 !! html
22928 <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;]}">
22929 <p>foo</p>
22930 </div>
22931 <table>
22932 <tbody>
22933 <tr>
22934 <td>bar</td>
22935 </tr>
22936 </tbody>
22937 </table>
22938 !!end
22939
22940 !!test
22941 5. Encapsulate foster-parented transclusion content
22942 !!options
22943 parsoid=wt2wt,wt2html
22944 !! wikitext
22945 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
22946 !! html
22947 <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>
22948 <table>
22949 <tbody>
22950 <tr>
22951 <td>
22952 <div>
22953 <p>foo</p>
22954 </div>
22955 </td>
22956 </tr>
22957 </tbody>
22958 </table>
22959 !!end
22960
22961 !!test
22962 6. Encapsulate foster-parented transclusion content
22963 !!options
22964 parsoid=wt2wt,wt2html
22965 !! wikitext
22966 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
22967 !! html
22968 <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>
22969 <table>
22970 <tbody>
22971 <tr>
22972 <td>
22973 <div>
22974 <p>foo</p>
22975 </div>
22976 </td>
22977 </tr>
22978 </tbody>
22979 </table>
22980 <p>ok</p>
22981 !!end
22982
22983 !!test
22984 7. Encapsulate foster-parented transclusion content
22985 !!options
22986 parsoid=wt2wt,wt2html
22987 !! wikitext
22988 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
22989 !! html
22990 <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>
22991 <table>
22992 <tbody>
22993 <tr>
22994 <td>bar</td>
22995 </tr>
22996 </tbody>
22997 </table>
22998 !!end
22999
23000 !!test
23001 8. Encapsulate foster-parented transclusion content
23002 !!options
23003 parsoid=wt2wt,wt2html
23004 !! wikitext
23005 {{echo|a
23006 }}{|{{echo|style='color:red'}}
23007 |-
23008 |b
23009 |}
23010 !! html
23011 <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>
23012 <tbody>
23013 <tr>
23014 <td>b</td>
23015 </tr>
23016 </tbody>
23017 </table>
23018 !!end
23019
23020 !!test
23021 9. Encapsulate foster-parented transclusion content
23022 !!options
23023 parsoid=wt2wt,wt2html
23024 !! wikitext
23025 <table>{{echo|hi</table>hello}}
23026 !! html
23027 <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>
23028 !!end
23029
23030 !!test
23031 Table in fosterable position
23032 !!options
23033 parsoid=wt2html,wt2wt
23034 !! wikitext
23035 {{OpenTable}}
23036 <div>
23037 {|
23038 |}
23039 </div>
23040 |}
23041 !! html
23042 <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">
23043 </span>
23044 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
23045
23046 <table>
23047 </table>
23048 !!end
23049
23050 # Parsoid only for bug 64747
23051 !! test
23052 Properly encapsulate empty-content transclusions in fosterable positions
23053 !! wikitext
23054 <table>
23055 {{#if:|
23056 <td>foo</td>
23057 }}
23058 </table>
23059 !! html/parsoid
23060 <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":["","","",""]}]]}'>
23061
23062 </table>
23063 !! end
23064
23065 !!test
23066 Support <object> element with .data attribute
23067 !!options
23068 parsoid=html2wt
23069 !! html
23070 <object data="test.swf"></object>
23071 !! wikitext
23072 <object data="test.swf"></object>
23073 !!end
23074
23075 !! test
23076 Don't block XML namespace declaration
23077 !! wikitext
23078 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
23079 !! html/php
23080 <p><span>MediaWiki</span>
23081 </p>
23082 !! html/parsoid
23083 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
23084 !! end
23085
23086 # -----------------------------------------------------------------
23087 # The following section of tests are primarily to spec requirements
23088 # around serialization of new/edited content.
23089 #
23090 # All these tests are marked Parsoid html2wt and html2html only
23091 # ----------------------------------------------------------------
23092
23093 # 'mi' is a localinterwiki prefix as well as a language
23094 !! test
23095 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
23096 !! options
23097 parsoid=html2wt
23098 !! html
23099 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
23100 !! wikitext
23101 [[Foo]]
23102 !! end
23103
23104 # See T93839
23105 !! test
23106 New wikilinks should be serialized properly
23107 !! options
23108 parsoid=html2wt
23109 !! html
23110 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
23111 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
23112 !! wikitext
23113 [[Foo]]
23114 [[Foo]]
23115 !! end
23116
23117 !! test
23118 New wiki links (href variations)
23119 !! options
23120 parsoid=html2wt
23121 !! html
23122 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
23123 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
23124 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
23125 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
23126 !! wikitext
23127 [[Foo_bar]]
23128 [[Foo_bar]]
23129 [[Foo_bar]]
23130 [[Toxine bactérienne]]
23131 !! end
23132
23133 !! test
23134 New wiki links (content string variations)
23135 !! options
23136 parsoid=html2wt
23137 !! html
23138 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
23139 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
23140 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
23141 !! wikitext
23142 [[Foo_bar]]
23143 [[Foo bar]]
23144 [[Foo_bar|./Foo_bar]]
23145 !! end
23146
23147 !! test
23148 New category links (href variations)
23149 !! options
23150 parsoid=html2wt
23151 !! html
23152 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
23153 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
23154 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
23155 !! wikitext
23156 [[Category:Toxine bactérienne]]
23157 [[Category:Toxine bactérienne]]
23158 [[Category:Toxine bactérienne]]
23159 !! end
23160
23161 !! test
23162 New sol transparent links don't need indent-pre nowiki protection
23163 !! options
23164 parsoid=html2wt
23165 language=de
23166 !! html
23167 <link rel="mw:PageProp/redirect" href="./Main_Page">
23168 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
23169 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
23170 !! wikitext
23171 #WEITERLEITUNG [[Main Page]]
23172 <!-- this is good --> [[Category:Good]]
23173 <!-- this is great --> [[Kategorie:Great]]
23174 !! end
23175
23176 !! test
23177 New interlanguage links (href variations)
23178 !! options
23179 parsoid=html2wt
23180 !! html
23181 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
23182 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
23183 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
23184 !! wikitext
23185 [[es:Toxine bactérienne]]
23186 [[es:Toxine_bactérienne]]
23187 [[es:Toxine_bactérienne]]
23188 !! end
23189
23190 !! test
23191 Image: Modifying size of an image (1)
23192 !! options
23193 parsoid={
23194 "modes": ["wt2wt"],
23195 "changes": [
23196 ["img[height]", "attr", "height", "22"],
23197 ["img[width]", "attr", "width", "200"]
23198 ]
23199 }
23200 !! wikitext
23201 [[Image:Foobar.jpg|230x230px]]
23202 !! wikitext/edited
23203 [[Image:Foobar.jpg|200x200px]]
23204 !!end
23205
23206 !! test
23207 Image: Modifying size of an image (2)
23208 !! options
23209 parsoid={
23210 "modes": ["wt2wt"],
23211 "changes": [
23212 ["img[height]", "attr", "height", "100"],
23213 ["img[width]", "attr", "width", "500"]
23214 ]
23215 }
23216 !! wikitext
23217 [[Image:Foobar.jpg|230x230px]]
23218 !! wikitext/edited
23219 [[Image:Foobar.jpg|500x500px]]
23220 !!end
23221
23222 # Change in size is ignored so long as class='mw-default-size'
23223 !! test
23224 Image: Modifying size of an image (3)
23225 !! options
23226 parsoid={
23227 "modes": ["wt2wt"],
23228 "changes": [
23229 ["figure[class]", "removeClass", "mw-default-size"],
23230 ["figure img", "attr", "height", "19"],
23231 ["figure img", "attr", "width", "170"]
23232 ]
23233 }
23234 !! wikitext
23235 [[Image:Foobar.jpg|thumb]]
23236 !! wikitext/edited
23237 [[Image:Foobar.jpg|thumb|170x170px]]
23238 !!end
23239
23240 !! test
23241 Image: Modifying alignment of an image (bug 48665)
23242 !! options
23243 parsoid={
23244 "modes": ["wt2wt"],
23245 "changes": [
23246 ["figure[class]", "removeClass", "mw-halign-right"],
23247 ["figure[class]", "addClass", "mw-halign-left"]
23248 ]
23249 }
23250 !! wikitext
23251 [[Image:Foobar.jpg|thumb|caption|right]]
23252 !! wikitext/edited
23253 [[Image:Foobar.jpg|thumb|caption|left]]
23254 !! end
23255
23256 !! test
23257 Image: Modifying mw-default-size of an frameless image (bug 62805)
23258 !! options
23259 parsoid={
23260 "modes": ["wt2wt"],
23261 "changes": [
23262 ["figure.mw-default-size", "removeClass", "mw-default-size"]
23263 ]
23264 }
23265 !! wikitext
23266 [[Image:Foobar.jpg|frameless|right]]
23267 !! wikitext/edited
23268 [[Image:Foobar.jpg|frameless|right|220x220px]]
23269 !! end
23270
23271 !! test
23272 Image: Modifying valign of an image (bug 49221)
23273 !! options
23274 parsoid={
23275 "modes": ["wt2wt"],
23276 "changes": [
23277 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
23278 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
23279 ]
23280 }
23281 !! wikitext
23282 [[File:Foobar.jpg|20px|middle]]
23283 !! wikitext/edited
23284 [[File:Foobar.jpg|20px|text-top]]
23285 !! end
23286
23287 !! test
23288 Image: Modifying alt attribute of an image (bug 56400)
23289 !! options
23290 parsoid={
23291 "modes": ["wt2wt"],
23292 "changes": [
23293 ["img[alt]", "attr", "alt", "some alternate edited text"]
23294 ]
23295 }
23296 !! wikitext
23297 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
23298 !! wikitext/edited
23299 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
23300 !!end
23301
23302 !! test
23303 Image: Modifying caption of an image
23304 !! options
23305 parsoid={
23306 "modes": ["wt2wt"],
23307 "changes": [
23308 ["figcaption", "text", "new caption"]
23309 ]
23310 }
23311 !! wikitext
23312 [[Image:Foobar.jpg|thumb|original caption]]
23313 !! wikitext/edited
23314 [[Image:Foobar.jpg|thumb|new caption]]
23315 !!end
23316
23317 !! test
23318 Image: empty alt attribute (bug 48924)
23319 !! options
23320 parsoid
23321 !! wikitext
23322 [[File:Foobar.jpg|thumb|alt=|bar]]
23323 !! html
23324 <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>
23325 !! end
23326
23327 #!! test
23328 #Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
23329 #!! options
23330 #parsoid=html2wt
23331 #language=ar
23332 #!! html
23333 #<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>
23334 #!! wikitext
23335 #[[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
23336 #!! end
23337
23338 !! test
23339 Image: Block level image should have \n before and after
23340 !! wikitext
23341 123
23342 [[File:Foobar.jpg|right|thumb|150x150px]]
23343 456
23344 !! html/parsoid
23345 <p>123</p>
23346 <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>
23347 <p>456</p>
23348 !!end
23349
23350 !! test
23351 Image: New block level image should have \n before and after (existing content)
23352 !! wikitext
23353 123
23354 [[File:Foobar.jpg|right|thumb|150x150px]]
23355 456
23356 !! html/parsoid
23357 <p>123</p>
23358 <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>
23359 <p>456</p>
23360 !!end
23361
23362 !! test
23363 Image: upright option (parsoid)
23364 !! options
23365 parsoid
23366 !! wikitext
23367 [[File:Foobar.jpg|thumb|upright|caption]]
23368 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
23369 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
23370 !! html
23371 <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>
23372 <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>
23373 <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>
23374 !!end
23375
23376 !! test
23377 Image: upright option is ignored on inline and frame images (parsoid)
23378 !! options
23379 parsoid
23380 !! wikitext
23381 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
23382 !! html
23383 <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>
23384 !!end
23385
23386 !! test
23387 Image: from basic HTML (1)
23388 !! options
23389 parsoid=html2wt
23390 !! html/parsoid
23391 <span typeof="mw:Image">
23392 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
23393 </span>
23394 !! wikitext
23395 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
23396 !! end
23397
23398 !! test
23399 Image: from basic HTML (2)
23400 !! options
23401 parsoid=html2wt
23402 !! html/parsoid
23403 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
23404 !! wikitext
23405 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
23406 !! end
23407
23408 !! test
23409 Image: from basic HTML (3)
23410 !! options
23411 parsoid=html2wt
23412 !! html/parsoid
23413 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
23414 !! wikitext
23415 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
23416 !! end
23417
23418 !! test
23419 Image: from basic HTML (4)
23420 !! options
23421 parsoid=html2wt
23422 !! html/parsoid
23423 <img src="./File:Foobar.jpg">
23424 !! wikitext
23425 [[File:Foobar.jpg|link=]]
23426 !! end
23427
23428 !! test
23429 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
23430 !! options
23431 parsoid=html2wt
23432 !! html
23433 <ul>
23434 <li><p>foo</p></li>
23435 </ul>
23436 !! wikitext
23437 * foo
23438 !! end
23439
23440 !! test
23441 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
23442 !! options
23443 parsoid=html2wt
23444 !! html
23445 <ul> <li>foo</li></ul>
23446 !! wikitext
23447 * foo
23448 !! end
23449
23450 !! test
23451 Don't strip leading whitespace when handling indent-pre suppressing tags
23452 !! options
23453 parsoid=html2wt
23454 !! html
23455 <table>
23456 <tr><td> indented row</td></tr>
23457 </table>
23458 <blockquote><p>
23459 <b>This is very bold of you!</b>
23460 </p>
23461 <table><tr><td>
23462 indented cell (no pre-wrapping!)
23463 </td></tr></table>
23464 </blockquote>
23465 <p>foo</p>
23466 <div>bar</div>
23467 !! wikitext
23468 {|
23469 | indented row
23470 |}
23471 <blockquote>
23472 '''This is very bold of you!'''
23473
23474 {|
23475 |
23476 indented cell (no pre-wrapping!)
23477 |}
23478 </blockquote>
23479 foo
23480 <div>bar</div>
23481 !! end
23482
23483 !! test
23484 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
23485 !! options
23486 parsoid=html2wt
23487 !! wikitext
23488 foo
23489 <nowiki> </nowiki><span>bar</span>
23490
23491 <span>foo2
23492 <nowiki> </nowiki></span>bar2
23493
23494 <div>foo</div>
23495 <nowiki> </nowiki><span>bar</span>
23496
23497 <div>
23498 <nowiki> </nowiki><span>foo</span>
23499 </div>
23500 !! html
23501 <p>foo</p>
23502 <span>bar</span>
23503
23504 <span>foo2
23505 </span>bar2
23506
23507 <div>foo</div>
23508 <span>bar</span>
23509
23510 <div>
23511 <span>foo</span>
23512 </div>
23513 !! end
23514
23515 !! test
23516 Lists: Add space after bullets
23517 !! options
23518 parsoid=html2wt
23519 !! html
23520 <ul>
23521 <li>foo</li>
23522 <li> bar</li>
23523 <li><span> baz</span></li>
23524 </ul>
23525 !! wikitext
23526 * foo
23527 * bar
23528 * <span> baz</span>
23529 !! end
23530
23531 !! test
23532 Lists: Dont insert newlines in a serialized list item.
23533 !! options
23534 parsoid=html2wt
23535 !! html
23536 <ul><li>a<br>b</li><li>c</li></ul>
23537 !! wikitext
23538 * a<br>b
23539 * c
23540 !! end
23541
23542 !! test
23543 Headings: Add space before/after == (Bug 51744)
23544 !! options
23545 parsoid=html2wt
23546 !! html
23547 <h2>foo</h2>
23548 <h2> bar</h2>
23549 <h2>baz </h2>
23550 <h2><span> baz</span></h2>
23551 !! wikitext
23552 == foo ==
23553
23554 == bar ==
23555
23556 == baz ==
23557
23558 == <span> baz</span> ==
23559 !! end
23560
23561 !! test
23562 Headings: Force metas to serialize before/after
23563 !! options
23564 parsoid=html2wt
23565 !! html
23566 <h2>hello there<link href="Category:A1" rel="mw:PageProp/Category" /></h2>
23567 <h2><link href="Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
23568
23569 <h2><!--foo--> <link href="Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
23570 !! wikitext
23571 == hello there ==
23572 [[Category:A1]]
23573
23574 [[Category:A2]]
23575 == hi pal ==
23576
23577 <!--foo--> [[Category:A3]]
23578 == how goes it ==
23579 !! end
23580
23581 !! test
23582 Parsoid: Serialize positional parameters with = in them as named parameter
23583 !! options
23584 parsoid=html2wt
23585 !! html
23586 <p about="#mwt1" typeof="mw:Transclusion"
23587 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
23588
23589 <p about="#mwt1" typeof="mw:Transclusion"
23590 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
23591
23592 <!--Orig params with data-parsoid has heuristics for handling = chars-->
23593 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
23594 <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>
23595 !! wikitext
23596 {{echo|1 = f=oo}}
23597
23598 {{echo|1 = f=oo|2 = bar}}
23599
23600 <!--Orig params with data-parsoid has heuristics for handling = chars-->
23601 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
23602 {{echo|<nowiki>f=oo</nowiki>|bar}}
23603 !! end
23604
23605 !! test
23606 Parsoid: Serialize positional parameters with = in extlink as named parameter
23607 !! options
23608 parsoid=html2wt
23609 !! html
23610 <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>
23611 !! wikitext
23612 {{echo|1 = http://stuff?is=ok}}
23613 !! end
23614
23615 !! test
23616 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
23617 !! options
23618 parsoid=html2wt
23619 !! html
23620 <div>a<p>b</p></div>
23621 <div>a
23622 <p>b</p></div>
23623 <div>
23624 a
23625 <p>b</p></div>
23626 !! wikitext
23627 <div>a
23628 b
23629 </div>
23630 <div>a
23631 b
23632 </div>
23633 <div>
23634 a
23635
23636 b
23637 </div>
23638 !! end
23639
23640 !! test
23641 Substrings resembling wikitext in hrefs should not get nowiki escapes
23642 !! options
23643 parsoid=html2wt
23644 !! html
23645 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
23646 !! wikitext
23647 [[Foo''bar''baz]]
23648 !! end
23649
23650 !! test
23651 Enforce single-line context in the serializer
23652 !! options
23653 parsoid=html2wt
23654 !! html
23655 <h2>testing
23656 123</h2>
23657
23658 <ul><li>asd
23659 sdf</li></ul>
23660 !! wikitext
23661 == testing 123 ==
23662
23663 * asd sdf
23664 !! end
23665
23666 #-----------------------------
23667 # I/B quote minimization tests
23668 #-----------------------------
23669
23670 !! test
23671 1. I/B quote minimization: wikitext-only tags should be combined
23672 !! options
23673 parsoid=html2wt
23674 !! html
23675 <p><i>A</i><i>B</i></p>
23676 <p><b>A</b><b>B</b></p>
23677 <p><i>A</i><b><i>B</i></b></p>
23678 <p><b>A</b><i><b>B</b></i></p>
23679 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
23680 <p><i><b>A</b></i><i><b>B</b></i></p>
23681 <p><i><b>A</b></i><b><i>B</i></b></p>
23682 <p><b><i>A</i></b><i><b>B</b></i></p>
23683 !! wikitext
23684 ''AB''
23685
23686 '''AB'''
23687
23688 ''A'''B'''''
23689
23690 '''A''B'''''
23691
23692 '''A''BC''D'''
23693
23694 '''''AB'''''
23695
23696 '''''AB'''''
23697
23698 '''''AB'''''
23699 !! end
23700
23701 !! test
23702 2. I/B quote minimization: wikitext and html tags should not be combined
23703 !! options
23704 parsoid=html2wt
23705 !! html
23706 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
23707 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
23708 !! wikitext
23709 ''A''<i>B</i>
23710
23711 ''A''<nowiki/>'''<i>B</i>'''
23712 !! end
23713
23714 !! test
23715 3. I/B quote minimization: templated content stops minimization
23716 !! options
23717 parsoid=html2wt
23718 !! html
23719 <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>
23720 <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>
23721 !! wikitext
23722 ''A''{{echo|''B''}}
23723
23724 ''A''{{echo|'''''B'''''}}
23725 !! end
23726
23727 !! test
23728 4. I/B quote minimization: new content should be mimimized with adjacent old content
23729 !! options
23730 parsoid=html2wt
23731 !! html
23732 <p><i>A</i><i>B</i></p>
23733 <p><b>A</b><b>B</b></p>
23734 <p><i>A</i><b><i>B</i></b></p>
23735 !! wikitext
23736 ''AB''
23737
23738 '''AB'''
23739
23740 ''A'''B'''''
23741 !! end
23742
23743 !! test
23744 5a. Merge adjacent quote nodes if they've been edited
23745 !! options
23746 parsoid={
23747 "modes": ["wt2wt", "selser"],
23748 "changes": [
23749 ["p", "contents", "remove", ":contains('b')"]
23750 ]
23751 }
23752 !! wikitext
23753 ''a''b''c''
23754 !! wikitext/edited
23755 ''ac''
23756 !! end
23757
23758 !! test
23759 5b. Merge adjacent quote nodes if they've been edited
23760 !! options
23761 parsoid={
23762 "modes": ["wt2wt", "selser"],
23763 "changes": [
23764 ["#x", "remove"]
23765 ]
23766 }
23767 !! wikitext
23768 ''a''<span id="x">b</span>''c''
23769 !! wikitext/edited
23770 ''ac''
23771 !! end
23772
23773 #------------------------------------
23774 # End of I/B quote minimization tests
23775 #------------------------------------
23776
23777 !!test
23778 Bug 54262: New entities
23779 !! options
23780 parsoid=html2wt
23781 !! wikitext
23782 &nbsp;
23783 !! html
23784 <span typeof="mw:Entity">&nbsp;</span>
23785 !! end
23786
23787 ## Note that there is no wikitext output for 'unknownproperty' ##
23788 ## Unknown magic words are silently dropped ##
23789
23790 !! test
23791 Magic words
23792 !! options
23793 parsoid=html2wt
23794 !! html
23795 <meta property='mw:PageProp/toc' />
23796 <meta property='mw:PageProp/notoc' />
23797 <meta property='mw:PageProp/forcetoc' />
23798 <meta property='mw:PageProp/index' />
23799 <meta property='mw:PageProp/noindex' />
23800 <meta property='mw:PageProp/nogallery' />
23801 <meta property='mw:PageProp/noeditsection' />
23802 <meta property='mw:PageProp/notitleconvert' />
23803 <meta property='mw:PageProp/nocontentconvert' />
23804 <meta property='mw:PageProp/unknownproperty' />
23805 !! wikitext
23806 __TOC__
23807 __NOTOC__
23808 __FORCETOC__
23809 __INDEX__
23810 __NOINDEX__
23811 __NOGALLERY__
23812 __NOEDITSECTION__
23813 __NOTITLECONVERT__
23814 __NOCONTENTCONVERT__
23815 !! end
23816
23817 !! test
23818 Consecutive <pre>s should not get merged
23819 !! options
23820 parsoid=html2wt,html2html
23821 !! html
23822 <pre>a</pre><pre>b</pre>
23823
23824 <pre>c
23825 </pre><pre>
23826 d</pre>
23827
23828 <pre>e
23829
23830 </pre><pre>
23831
23832 f</pre>
23833 !! wikitext
23834 a
23835
23836 b
23837
23838 c
23839
23840 d
23841
23842 e
23843
23844
23845
23846 f
23847 !! end
23848
23849 !! test
23850 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
23851 !! options
23852 parsoid=html2wt
23853 !! html
23854 <a rel="mw:ExtLink" href="./Special:BookSources/1234567890">ISBN 1234567895</a>
23855 !! wikitext
23856 [[Special:BookSources/1234567890|ISBN 1234567895]]
23857 !! end
23858
23859 !! test
23860 Edited RFC links not serializable as RFC links should serialize as extlinks
23861 !! options
23862 parsoid=html2wt
23863 !! html
23864 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
23865 !! wikitext
23866 [//tools.ietf.org/html/rfc123 New RFC]
23867 !! end
23868
23869 !! test
23870 Edited PMID links not serializable as PMID links should serialize as extlinks
23871 !! options
23872 parsoid=html2wt
23873 !! html
23874 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
23875 !! wikitext
23876 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
23877 !! end
23878
23879 !! test
23880 WTS of autolinks with trailing/surrounding context
23881 !! options
23882 parsoid=html2wt
23883 !! html/parsoid
23884 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
23885 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
23886 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
23887 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
23888 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
23889 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
23890 !! wikitext
23891 http://cscott.net<nowiki/>'''foo'''
23892
23893 http://cscott.net<b>foo</b>
23894
23895 '''http://cscott.net<nowiki/>'''
23896
23897 '''http://cscott.net '''
23898
23899 '''http://cscott.net<nowiki/>x'''
23900
23901 http://cscott.net<nowiki/>x
23902 !! end
23903
23904 !! test
23905 WTS of autolinks with nowikis (round-trip)
23906 !! wikitext
23907 x<nowiki/>http://cscott.net<nowiki/>x
23908 !! html/parsoid
23909 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
23910 !! end
23911
23912 # this is the "easy" test because it leaves in place all the
23913 # data-parsoid information indicating this is an autolink
23914 !! test
23915 WTS of autolinks with escapes (editing)
23916 !! options
23917 parsoid={
23918 "modes": ["wt2wt"],
23919 "changes": [
23920 [ "meta", "remove" ]
23921 ]
23922 }
23923 !! wikitext
23924 x<nowiki/>http://cscott.net<nowiki/>x
23925 !! wikitext/edited
23926 x<nowiki/>http://cscott.net<nowiki/>x
23927 !! end
23928
23929 !! test
23930 Edited Redirect link should emit a non-piped wikitext link
23931 !! options
23932 parsoid=html2wt
23933 !! html
23934 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
23935 !! wikitext
23936 #REDIRECT [[Bar]]
23937 !! end
23938
23939 !! test
23940 T75121: Infer extension name from typeOf if data-mw is not present
23941 !! options
23942 parsoid=html2wt
23943 !! html
23944 <div typeOf="mw:Extension/foo"></div>
23945 !! wikitext
23946 <foo />
23947 !! end
23948
23949 # Note that the <p> wrapping isn't present in PHP parser output
23950 # The important thing for this test is that P-wrapping doesn't
23951 # interfere with the <nowiki> protection for leading - in <td>
23952 # (which isn't necessary for <th>).
23953 !! test
23954 T88318: p-wrapped dash in table.
23955 !! options
23956 parsoid=html2wt,wt2wt
23957 !! html/parsoid
23958 <table><tbody>
23959 <tr><th><p>-</p></th><th><p>- </p></th></tr>
23960 <tr><td><p>-</p></td><td><p>- </p></td></tr>
23961 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
23962 </tbody></table>
23963 !! wikitext
23964 {|
23965 !-
23966 !-
23967 |-
23968 |<nowiki>-</nowiki>
23969 |<nowiki>- </nowiki>
23970 |-
23971 |<small>-</small>
23972 |<br>
23973 -
23974 |<br>
23975 -
23976 |}
23977 !! html/php+tidy
23978 <table>
23979 <tr>
23980 <th>-</th>
23981 <th>-</th>
23982 </tr>
23983 <tr>
23984 <td>-</td>
23985 <td>-</td>
23986 </tr>
23987 <tr>
23988 <td><small>-</small></td>
23989 <td><br />
23990 <p>-</p>
23991 </td>
23992 <td><br />
23993 <p>-</p>
23994 </td>
23995 </tr>
23996 </table>
23997 !! end
23998
23999 !! test
24000 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
24001 !! options
24002 parsoid=html2wt
24003 !! html
24004 <table id='mwAb'>
24005 <td id='mwAc'>foo</td>
24006 <td id='serialize-this'>bar</td>
24007 </table>
24008 !! wikitext
24009 {|
24010 |foo
24011 | id="serialize-this" |bar
24012 |}
24013 !! end
24014
24015 !! test
24016 Parsoid-like element ids should not be serialized to wikitext unless shadowed
24017 !! options
24018 parsoid=html2wt
24019 !! html
24020 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
24021 !! wikitext
24022 <div id="hello">ok</div>
24023 !! end
24024
24025 !! test
24026 WTS change modes
24027 !! options
24028 parsoid={
24029 "modes": ["wt2wt"],
24030 "changes": [
24031 [ "#xyz", "before", "<b>before</b> stuff " ],
24032 [ "#xyz", "after", " stuff <i>after</i>" ],
24033 [ "#xyz", "html", "x <b>y</b> z" ]
24034 ]
24035 }
24036 !! wikitext
24037 <span id="xyz">hello</span>
24038 !! wikitext/edited
24039 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
24040 !! end
24041
24042 !! test
24043 Never serialize a-tag as html, regardless of what data-parsoid has to say
24044 !! options
24045 parsoid=html2wt
24046 !! html
24047 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
24048 !! wikitext
24049 [[Foo]]
24050 !! end
24051
24052 # -----------------------------------------------------------------
24053 # End of section for Parsoid-only html2wt tests for serialization
24054 # of new content
24055 # -----------------------------------------------------------------
24056
24057 # -----------------------------------------------------------------
24058 # The following section of tests are primarily to spec behavior of
24059 # the selective serializer. All these tests have manual selser
24060 # changes. The automated selser changes for all tests handle the
24061 # wide variation of changes, but these tests here capture specs
24062 # deterministically.
24063 # ----------------------------------------------------------------
24064
24065 ## T90517
24066 !! test
24067 1. Selser: New comments should not be lost
24068 !! options
24069 parsoid={
24070 "modes": ["selser"],
24071 "changes": [
24072 [ "#a", "after", "<!--c1-->" ],
24073 [ "#b", "before", "<!--c2-->" ]
24074 ]
24075 }
24076 !! wikitext
24077 <span id="a">a</span>
24078
24079 <span id="b">b</span>
24080 !! wikitext/edited
24081 <span id="a">a</span><!--c1-->
24082
24083 <!--c2--><span id="b">b</span>
24084 !! end
24085
24086 ## T89383
24087 !! test
24088 2. Selser: Check for validity of DSR before using it
24089 !! options
24090 parsoid={
24091 "modes": ["selser"],
24092 "changes": [
24093 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
24094 ]
24095 }
24096 !! wikitext
24097 <span id="a">a</span>
24098 !! wikitext/edited
24099 {{DISPLAYTITLE:foo}}
24100 <span id="a">a</span>
24101 !! end
24102
24103
24104 TODO:
24105 more images
24106 more tables
24107 character entities
24108 and much more
24109 Try for 100% code coverage