Emergency remove .mw-headline-anchor
[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 # comment run through Linker::formatComment() instead of main parser
30 # local format section links in edit comment text as local links
31 # notoc disable table of contents
32 # thumbsize=NNN set the default thumb size to NNNpx for this test
33 #
34 # You can also set the following parser properties via test options:
35 # wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
36 # wgLinkHolderBatchSize, wgRawHtml
37 #
38 # For testing purposes, temporary articles can created:
39 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
40 # where '/' denotes a newline.
41
42 # This is the standard article assumed to exist.
43 !! article
44 Main Page
45 !! text
46 blah blah
47 !! endarticle
48
49 !!article
50 Foo
51 !!text
52 FOO
53 !!endarticle
54
55 !!article
56 Template:Foo
57 !!text
58 FOO
59 !!endarticle
60
61 !! article
62 Template:Blank
63 !! text
64 !! endarticle
65
66 !! article
67 Template:pipe
68 !! text
69 |
70 !! endarticle
71
72 !! article
73 Template:=
74 !! text
75 <nowiki>=</nowiki>
76 !! endarticle
77
78 !!article
79 MediaWiki:bad image list
80 !!text
81 * [[File:Bad.jpg]] except [[Nasty page]]
82 !!endarticle
83
84 !! article
85 Template:inner list
86 !! text
87 * item 1
88 !! endarticle
89
90 !! article
91 Template:tbl-start
92 !! text
93 {|
94 !! endarticle
95
96 !! article
97 Template:tbl-end
98 !! text
99 |}
100 !! endarticle
101
102 !! article
103 Template:echo
104 !! text
105 {{{1}}}
106 !! endarticle
107
108 !! article
109 Template:echo_with_span
110 !! text
111 <span>{{{1}}}</span>
112 !! endarticle
113
114 !! article
115 Template:echo_with_div
116 !! text
117 <div>{{{1}}}</div>
118 !! endarticle
119
120 !! article
121 Template:table_attribs
122 !! text
123 <noinclude>
124 |</noinclude>style="color:red;"|Foo
125 !! endarticle
126
127 !! article
128 Template:table_attribs_2
129 !! text
130 <noinclude>
131 |</noinclude>style="color:red;"|Foo
132 |Bar||Baz
133 !! endarticle
134
135 !! article
136 Template:table_attribs_3
137 !! text
138 <noinclude>
139 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo
140 !! endarticle
141
142 !! article
143 Template:table_attribs_4
144 !! text
145 | style="background-color:#DC241f;" width="10px" |
146 !! endarticle
147
148 !! article
149 Template:table_header_cells
150 !! text
151 {{table_attribs}}!!style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
152 !! endarticle
153
154 !! article
155 Template:table_cells
156 !! text
157 {{table_attribs}}||style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
158 !! endarticle
159
160 !! article
161 Template:image_attribs
162 !! text
163 <noinclude>
164 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
165 !! endarticle
166
167 ## See T48811 for details
168 !! article
169 Template:mixed_attr_content_template
170 !! text
171 style="color:red;" title="T48811"
172 |-
173 |foo
174 !! endarticle
175
176 !! article
177 Template:definition_list
178 !! text
179 one
180 ::two
181 !! endarticle
182
183 !! article
184 A?b
185 !! text
186 Weirdo titles!
187 !! endarticle
188
189 !!article
190 Template:Bullet
191 !!text
192 * Bar
193 !!endarticle
194
195 !!article
196 Template:OpenTable
197 !!text
198 {|
199 !!endarticle
200
201 !!article
202 Template:EmptyLITest
203 !!text
204 *a
205 *
206 *
207 *b
208 !!endarticle
209
210 !!article
211 Template:EmptyTRTest
212 !!text
213 {|
214 |-
215 |-
216 |foo
217 |-
218 |-
219 |bar
220 |}
221 !!endarticle
222
223 !!article
224 Template:EmptyTRWithHTMLAttrTest
225 !!text
226 <table>
227 <tr align="center"></tr>
228 <tr><td>foo</td></tr>
229 <tr align="center"></tr>
230 <tr><td>bar</td></tr>
231 </table>
232 !!endarticle
233
234 ###
235 ### Basic tests
236 ###
237 !! test
238 Blank input
239 !! wikitext
240 !! html
241 !! end
242
243
244 !! test
245 Simple paragraph
246 !! wikitext
247 This is a simple paragraph.
248 !! html
249 <p>This is a simple paragraph.
250 </p>
251 !! end
252
253 !! test
254 Paragraphs with extra newline spacing
255 !! wikitext
256 foo
257
258 bar
259
260
261 baz
262
263
264
265 booz
266 !! html
267 <p>foo
268 </p><p>bar
269 </p><p><br />
270 baz
271 </p><p><br />
272 </p><p>booz
273 </p>
274 !! end
275
276 !! test
277 Paragraphs with newline spacing with comment lines in between
278 !! wikitext
279 ----
280 a
281 <!--foo-->
282 b
283 ----
284 a
285 <!--foo--><!--More than 1 comment, still stripped-->
286 b
287 ----
288 a
289 <!--foo--> <!----> <!-- bar -->
290 b
291 ----
292 a
293 <!--foo-->
294
295 b
296 ----
297 a
298
299 <!--foo-->
300 b
301 ----
302 a
303 <!--foo-->
304
305
306 b
307 ----
308 a
309
310
311 <!--foo-->
312 b
313 ----
314 !! html
315 <hr />
316 <p>a
317 b
318 </p>
319 <hr />
320 <p>a
321 b
322 </p>
323 <hr />
324 <p>a
325 b
326 </p>
327 <hr />
328 <p>a
329 </p><p>b
330 </p>
331 <hr />
332 <p>a
333 </p><p>b
334 </p>
335 <hr />
336 <p>a
337 </p><p><br />
338 b
339 </p>
340 <hr />
341 <p>a
342 </p><p><br />
343 b
344 </p>
345 <hr />
346
347 !! end
348
349 !! test
350 Paragraphs with newline spacing with non-empty white-space lines in between
351 !! wikitext
352 ----
353 a
354
355 b
356 ----
357 a
358
359
360 b
361 ----
362 !! html
363 <hr />
364 <p>a
365 </p><p>b
366 </p>
367 <hr />
368 <p>a
369 </p><p><br />
370 b
371 </p>
372 <hr />
373
374 !! end
375
376 !! test
377 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
378 !! wikitext
379 ----
380 a
381 <!--foo-->
382 b
383 ----
384 a
385 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
386 b
387 ----
388 a
389
390 <!--foo-->
391 <!--bar-->
392 b
393 ----
394 a
395
396 <!--foo-->
397 <!--bar-->
398
399 b
400 ----
401 !! html
402 <hr />
403 <p>a
404 b
405 </p>
406 <hr />
407 <p>a
408 b
409 </p>
410 <hr />
411 <p>a
412 </p><p>b
413 </p>
414 <hr />
415 <p>a
416 </p><p><br />
417 b
418 </p>
419 <hr />
420
421 !! end
422
423 !! test
424 Extra newlines: More paragraphs with indented comment
425 !! wikitext
426 a
427
428 <!--boo-->
429
430 b
431 !! html
432 <p>a
433 </p><p><br />
434 b
435 </p>
436 !!end
437
438 !! test
439 Extra newlines followed by heading
440 !! wikitext
441 a
442
443
444
445 =b=
446 [[a]]
447
448
449 =b=
450 !! html
451 <p>a
452 </p><p><br />
453 </p>
454 <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>
455 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
456 </p><p><br />
457 </p>
458 <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>
459
460 !! end
461
462 !! test
463 Extra newlines between heading and content are swallowed
464 !! wikitext
465 =b=
466
467
468
469 [[a]]
470 !! html
471 <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>
472 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
473 </p>
474 !! end
475
476 !! test
477 Parsing an URL
478 !! wikitext
479 http://fr.wikipedia.org/wiki/🍺
480 <!-- EasterEgg we love beer, better be able be able to link to it -->
481 !! html
482 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
483 </p>
484 !! end
485
486 # Note that the html+tidy output removes the spaces after the <li>,
487 # which is a bug (http://sourceforge.net/p/tidy/bugs/945/, etc).
488 # This is an issue for all tests with lists. We intentionally do
489 # *not* add html+tidy clauses for these, as we don't want to
490 # document/test the broken behavior. (Parsoid matches the non-tidy
491 # output in these cases.)
492
493 !! test
494 Simple list
495 !! wikitext
496 * Item 1
497 * Item 2
498 !! html
499 <ul><li> Item 1</li>
500 <li> Item 2</li></ul>
501
502 !! end
503
504 !! test
505 Italics and bold
506 !! wikitext
507 * plain
508 * plain''italic''plain
509 * plain''italic''plain''italic''plain
510 * plain'''bold'''plain
511 * plain'''bold'''plain'''bold'''plain
512 * plain''italic''plain'''bold'''plain
513 * plain'''bold'''plain''italic''plain
514 * plain''italic'''bold-italic'''italic''plain
515 * plain'''bold''bold-italic''bold'''plain
516 * plain'''''bold-italic'''italic''plain
517 * plain'''''bold-italic''bold'''plain
518 * plain''italic'''bold-italic'''''plain
519 * plain'''bold''bold-italic'''''plain
520 * plain l'''italic''plain
521 * plain l''''bold''' plain
522 !! html
523 <ul><li> plain</li>
524 <li> plain<i>italic</i>plain</li>
525 <li> plain<i>italic</i>plain<i>italic</i>plain</li>
526 <li> plain<b>bold</b>plain</li>
527 <li> plain<b>bold</b>plain<b>bold</b>plain</li>
528 <li> plain<i>italic</i>plain<b>bold</b>plain</li>
529 <li> plain<b>bold</b>plain<i>italic</i>plain</li>
530 <li> plain<i>italic<b>bold-italic</b>italic</i>plain</li>
531 <li> plain<b>bold<i>bold-italic</i>bold</b>plain</li>
532 <li> plain<i><b>bold-italic</b>italic</i>plain</li>
533 <li> plain<b><i>bold-italic</i>bold</b>plain</li>
534 <li> plain<i>italic<b>bold-italic</b></i>plain</li>
535 <li> plain<b>bold<i>bold-italic</i></b>plain</li>
536 <li> plain l'<i>italic</i>plain</li>
537 <li> plain l'<b>bold</b> plain</li></ul>
538
539 !! end
540
541 # this example taken from the [[simple:Moon]] article (bug 47326)
542 !! test
543 Italics and possessives (1)
544 !! wikitext
545 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
546 !! html
547 <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
548 </p>
549 !! end
550
551 # this example taken from [[en:Flaming Pie]] (bug 49926)
552 !! test
553 Italics and possessives (2)
554 !! wikitext
555 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
556 !! html
557 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
558 </p>
559 !! end
560
561 # this example taken from [[en:Dictionary]] (bug 49926)
562 !! test
563 Italics and possessives (3)
564 !! wikitext
565 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''.
566 !! html
567 <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>.
568 </p>
569 !! end
570
571
572 ###
573 ### 2-quote opening sequence tests
574 ###
575 !! test
576 Italics and bold: 2-quote opening sequence: (2,2)
577 !! wikitext
578 ''foo''
579 !! html
580 <p><i>foo</i>
581 </p>
582 !!end
583
584 !! test
585 Italics and bold: 2-quote opening sequence: (2,3)
586 !! wikitext
587 ''foo'''
588 !! html/*
589 <p><i>foo'</i>
590 </p>
591 !!end
592
593 !! test
594 Italics and bold: 2-quote opening sequence: (2,4)
595 !! options
596 parsoid=wt2html
597 !! wikitext
598 ''foo''''
599 !! html/*
600 <p><i>foo''</i>
601 </p>
602 !!end
603
604 # same html as previous, but wikitext adjusted to match parsoid html2wt
605 !! test
606 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
607 !! wikitext
608 ''foo<nowiki>''</nowiki>''
609 !! html
610 <p><i>foo''</i>
611 </p>
612 !! end
613
614 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
615 !! test
616 Italics and bold: 2-quote opening sequence: (2,5)
617 !! options
618 parsoid=wt2html
619 !! wikitext
620 ''foo'''''
621 !! html/php
622 <p><i>foo</i>
623 </p>
624 !! html/parsoid
625 <p><i>foo</i><b></b>
626 </p>
627 !!end
628
629 # same html as previous, but wikitext adjusted to match parsoid html2wt
630 !! test
631 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
632 !! wikitext
633 ''foo'''''<nowiki/>'''
634 !! html/php
635 <p><i>foo</i>
636 </p>
637 !! html/parsoid
638 <p><i>foo</i><b></b>
639 </p>
640 !! end
641
642
643 ###
644 ### 3-quote opening sequence tests
645 ###
646
647 !! test
648 Italics and bold: 3-quote opening sequence: (3,2)
649 !! wikitext
650 '''foo''
651 !! html/*
652 <p>'<i>foo</i>
653 </p>
654 !!end
655
656 !! test
657 Italics and bold: 3-quote opening sequence: (3,3)
658 !! wikitext
659 '''foo'''
660 !! html
661 <p><b>foo</b>
662 </p>
663 !!end
664
665 !! test
666 Italics and bold: 3-quote opening sequence: (3,4)
667 !! wikitext
668 '''foo''''
669 !! html/*
670 <p><b>foo'</b>
671 </p>
672 !!end
673
674 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
675 !! test
676 Italics and bold: 3-quote opening sequence: (3,5)
677 !! options
678 parsoid=wt2html
679 !! wikitext
680 '''foo'''''
681 !! html/php
682 <p><b>foo</b>
683 </p>
684 !! html/parsoid
685 <p><b>foo</b><i></i>
686 </p>
687 !!end
688
689 # same html as previous, but wikitext adjusted to match parsoid html2wt
690 !! test
691 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
692 !! wikitext
693 '''foo'''''<nowiki/>''
694 !! html/php
695 <p><b>foo</b>
696 </p>
697 !! html/parsoid
698 <p><b>foo</b><i></i>
699 </p>
700 !! end
701
702
703 ###
704 ### 4-quote opening sequence tests
705 ###
706
707 !! test
708 Italics and bold: 4-quote opening sequence: (4,2)
709 !! options
710 parsoid=wt2html
711 !! wikitext
712 ''''foo''
713 !! html/*
714 <p>''<i>foo</i>
715 </p>
716 !!end
717
718 # same html as previous, but wikitext adjusted to match parsoid html2wt
719 !! test
720 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
721 !! wikitext
722 <nowiki>''</nowiki>''foo''
723 !! html
724 <p>''<i>foo</i>
725 </p>
726 !! end
727
728 !! test
729 Italics and bold: 4-quote opening sequence: (4,3)
730 !! wikitext
731 ''''foo'''
732 !! html/*
733 <p>'<b>foo</b>
734 </p>
735 !!end
736
737 !! test
738 Italics and bold: 4-quote opening sequence: (4,4)
739 !! options
740 parsoid=wt2html
741 !! wikitext
742 ''''foo''''
743 !! html/*
744 <p>'<b>foo'</b>
745 </p>
746 !!end
747
748 # same html as previous, but wikitext adjusted to match parsoid html2wt
749 !! test
750 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
751 !! wikitext
752 '<nowiki/>'''foo''''
753 !! html
754 <p>'<b>foo'</b>
755 </p>
756 !! end
757
758 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
759 !! test
760 Italics and bold: 4-quote opening sequence: (4,5)
761 !! options
762 parsoid=wt2html
763 !! wikitext
764 ''''foo'''''
765 !! html/php
766 <p>'<b>foo</b>
767 </p>
768 !! html/parsoid
769 <p>'<b>foo</b><i></i>
770 </p>
771 !!end
772
773 # same html as previous, but wikitext adjusted to match parsoid html2wt
774 !! test
775 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
776 !! wikitext
777 '<nowiki/>'''foo'''''<nowiki/>''
778 !! html/php
779 <p>'<b>foo</b>
780 </p>
781 !! html/parsoid
782 <p>'<b>foo</b><i></i>
783 </p>
784 !! end
785
786
787 ###
788 ### 5-quote opening sequence tests
789 ###
790
791 !! test
792 Italics and bold: 5-quote opening sequence: (5,2)
793 !! options
794 parsoid=wt2html
795 !! wikitext
796 '''''foo''
797 !! html/*
798 <p><b><i>foo</i></b>
799 </p>
800 !!end
801
802 # same html as previous, but wikitext adjusted to match parsoid html2wt
803 # skipping wt2html and html2html because it wants to put <i> before <b>
804 !! test
805 Italics and bold: 5-quote opening sequence: (5,2+3)
806 !! options
807 parsoid=wt2wt,html2wt
808 !! wikitext
809 '''''foo'''''
810 !! html
811 <p><b><i>foo</i></b>
812 </p>
813 !! end
814
815 !! test
816 Italics and bold: 5-quote opening sequence: (5,3)
817 !! options
818 parsoid=wt2html
819 !! wikitext
820 '''''foo'''
821 !! html/*
822 <p><i><b>foo</b></i>
823 </p>
824 !!end
825
826 # same html as previous, but wikitext adjusted to match parsoid html2wt
827 !! test
828 Italics and bold: 5-quote opening sequence: (5,3+2)
829 !! wikitext
830 '''''foo'''''
831 !! html
832 <p><i><b>foo</b></i>
833 </p>
834 !! end
835
836 !! test
837 Italics and bold: 5-quote opening sequence: (5,4)
838 !! options
839 parsoid=wt2html
840 !! wikitext
841 '''''foo''''
842 !! html/*
843 <p><i><b>foo'</b></i>
844 </p>
845 !!end
846
847 !! test
848 Italics and bold: 5-quote opening sequence: (5,5)
849 !! wikitext
850 '''''foo'''''
851 !! html
852 <p><i><b>foo</b></i>
853 </p>
854 !!end
855
856 !! test
857 Italics and bold: 5-quote opening sequence: (5,6)
858 !! wikitext
859 '''''foo''''''
860 !! html/*
861 <p><i><b>foo'</b></i>
862 </p>
863 !! end
864
865 ###
866 ### multiple quote sequences in a line
867 ###
868 !! test
869 Italics and bold: multiple quote sequences: (2,4,2)
870 !! options
871 parsoid=wt2html
872 !! wikitext
873 ''foo''''bar''
874 !! html/*
875 <p><i>foo'<b>bar</b></i>
876 </p>
877 !!end
878
879
880 # same html as previous, but wikitext adjusted to match parsoid html2wt
881 !! test
882 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
883 !! wikitext
884 ''foo'<nowiki/>'''bar'''''
885 !! html
886 <p><i>foo'<b>bar</b></i>
887 </p>
888 !! end
889
890
891 !! test
892 Italics and bold: multiple quote sequences: (2,4,3)
893 !! options
894 parsoid=wt2html
895 !! wikitext
896 ''foo''''bar'''
897 !! html/*
898 <p><i>foo'<b>bar</b></i>
899 </p>
900 !!end
901
902
903 # same html as previous, but wikitext adjusted to match parsoid html2wt
904 !! test
905 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
906 !! wikitext
907 ''foo'<nowiki/>'''bar'''''
908 !! html
909 <p><i>foo'<b>bar</b></i>
910 </p>
911 !! end
912
913
914 !! test
915 Italics and bold: multiple quote sequences: (2,4,4)
916 !! options
917 parsoid=wt2html
918 !! wikitext
919 ''foo''''bar''''
920 !! html/*
921 <p><i>foo'<b>bar'</b></i>
922 </p>
923 !!end
924
925
926 # same html as previous, but wikitext adjusted to match parsoid html2wt
927 !! test
928 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
929 !! wikitext
930 ''foo'<nowiki/>'''bar'<nowiki/>'''''
931 !! html
932 <p><i>foo'<b>bar'</b></i>
933 </p>
934 !! end
935
936
937 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
938 !! test
939 Italics and bold: multiple quote sequences: (3,4,2)
940 !! options
941 parsoid=wt2html
942 !! wikitext
943 '''foo''''bar''
944 !! html/php
945 <p><b>foo'</b>bar
946 </p>
947 !! html/parsoid
948 <p><b>foo'</b>bar<i></i>
949 </p>
950 !!end
951
952 # same html as previous, but wikitext adjusted to match parsoid html2wt
953 !! test
954 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
955 !! options
956 parsoid
957 !! wikitext
958 '''<nowiki>foo'</nowiki>'''bar''<nowiki/>''
959 !! html/php
960 <p><b>foo'</b>bar
961 </p>
962 !! html/parsoid
963 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<i></i>
964 </p>
965 !! end
966
967
968 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
969 !! test
970 Italics and bold: multiple quote sequences: (3,4,3)
971 !! options
972 parsoid=wt2html
973 !! wikitext
974 '''foo''''bar'''
975 !! html/php
976 <p><b>foo'</b>bar
977 </p>
978 !! html/parsoid
979 <p><b>foo'</b>bar<b></b>
980 </p>
981 !!end
982
983 # same html as previous, but wikitext adjusted to match parsoid html2wt
984 !! test
985 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
986 !! wikitext
987 '''<nowiki>foo'</nowiki>'''bar'''<nowiki/>'''
988 !! html/php
989 <p><b>foo'</b>bar
990 </p>
991 !! html/parsoid
992 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<b></b>
993 </p>
994 !! end
995
996 ###
997 ### other quote tests
998 ###
999 !! test
1000 Italics and bold: other quote tests: (2,3,5)
1001 !! wikitext
1002 ''this is about '''foo's family'''''
1003 !! html
1004 <p><i>this is about <b>foo's family</b></i>
1005 </p>
1006 !!end
1007
1008
1009 !! test
1010 Italics and bold: other quote tests: (2,(3,3),2)
1011 !! wikitext
1012 ''this is about '''foo's''' family''
1013 !! html
1014 <p><i>this is about <b>foo's</b> family</i>
1015 </p>
1016 !!end
1017
1018
1019 !! test
1020 Italics and bold: other quote tests: (3,2,3,2)
1021 !! options
1022 parsoid=wt2html
1023 !! wikitext
1024 '''this is about ''foo'''s family''
1025 !! html/*
1026 <p><b>this is about <i>foo</i></b><i>s family</i>
1027 </p>
1028 !!end
1029
1030
1031 # same html as previous, but wikitext adjusted to match parsoid html2wt
1032 !! test
1033 Italics and bold: other quote tests: (3,2,3+2+2,2)
1034 !! wikitext
1035 '''this is about ''foo'''''<nowiki/>''s family''
1036 !! html
1037 <p><b>this is about <i>foo</i></b><i>s family</i>
1038 </p>
1039 !! end
1040
1041
1042 !! test
1043 Italics and bold: other quote tests: (3,2,3,3)
1044 !! wikitext
1045 '''this is about ''foo'''s family'''
1046 !! html/*
1047 <p>'<i>this is about </i>foo<b>s family</b>
1048 </p>
1049 !!end
1050
1051
1052 !! test
1053 Italics and bold: other quote tests: (3,(2,2),3)
1054 !! wikitext
1055 '''this is about ''foo's'' family'''
1056 !! html
1057 <p><b>this is about <i>foo's</i> family</b>
1058 </p>
1059 !!end
1060
1061
1062 !! test
1063 Italicized possessive
1064 !! wikitext
1065 The ''[[Main Page]]'''s talk page.
1066 !! html/php
1067 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1068 </p>
1069 !! html/parsoid
1070 <p>The <i><a rel="mw:WikiLink" href="Main_Page" title="Main Page">Main Page</a>'</i>s talk page.</p>
1071 !! end
1072
1073 !! test
1074 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
1075 (Requires tidy for PHP parser output to be fixed up)
1076 !! options
1077 parsoid=wt2html,wt2wt
1078 !! wikitext
1079 {|
1080 !''a!!''b
1081 |''a||''b
1082 |}
1083 !! html/php+tidy
1084 <table>
1085 <tr>
1086 <th><i>a</i></th>
1087 <th><i>b</i></th>
1088 <td><i>a</i></td>
1089 <td><i>b</i></td>
1090 </tr>
1091 </table>
1092 !! html/parsoid
1093 <table>
1094 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
1095 <td><i>a</i></td><td><i>b</i></td></tr>
1096 </tbody></table>
1097 !! end
1098
1099 ###
1100 ### Non-html5 tags
1101 ###
1102
1103 !! test
1104 Non-html5 tags should be accepted
1105 !! wikitext
1106 <center>''foo''</center>
1107 <big>''foo''</big>
1108 <font>''foo''</font>
1109 <strike>''foo''</strike>
1110 <tt>''foo''</tt>
1111 !! html
1112 <center><i>foo</i></center>
1113 <p><big><i>foo</i></big>
1114 <font><i>foo</i></font>
1115 <strike><i>foo</i></strike>
1116 <tt><i>foo</i></tt>
1117 </p>
1118 !! end
1119
1120 !! test
1121 <wbr> is valid wikitext (bug 52468)
1122 !! wikitext
1123 <wbr>
1124 !! html
1125 <p><wbr />
1126 </p>
1127 !! end
1128
1129 # <strike> is HTML4, <s> is HTML4/5.
1130 !! test
1131 <s> or <strike> for strikethrough
1132 !! wikitext
1133 <strike>strike</strike>
1134
1135 <s>s</s>
1136 !! html
1137 <p><strike>strike</strike>
1138 </p><p><s>s</s>
1139 </p>
1140 !! end
1141
1142 ## a not permitted
1143 ## i,b,br omitted
1144 !! test
1145 Text-level semantic html elements in wikitext
1146 !! wikitext
1147 <em>text</em>
1148 <strong>text</strong>
1149 <small>text</small>
1150 <s>text</s>
1151 <cite>text</cite>
1152 <q>text</q>
1153 <dfn>text</dfn>
1154 <abbr>text</abbr>
1155 <data>text</data>
1156 <time>text</time>
1157 <code>text</code>
1158 <var>text</var>
1159 <samp>text</samp>
1160 <kbd>text</kbd>
1161 <sub>text</sub>
1162 <u>text</u>
1163 <mark>text</mark>
1164 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1165 <bdi>text</bdi>
1166 <bdo>text</bdo>
1167 <span>text</span>
1168 <wbr />
1169 !! html
1170 <p><em>text</em>
1171 <strong>text</strong>
1172 <small>text</small>
1173 <s>text</s>
1174 <cite>text</cite>
1175 <q>text</q>
1176 <dfn>text</dfn>
1177 <abbr>text</abbr>
1178 <data>text</data>
1179 <time>text</time>
1180 <code>text</code>
1181 <var>text</var>
1182 <samp>text</samp>
1183 <kbd>text</kbd>
1184 <sub>text</sub>
1185 <u>text</u>
1186 <mark>text</mark>
1187 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1188 <bdi>text</bdi>
1189 <bdo>text</bdo>
1190 <span>text</span>
1191 <wbr />
1192 </p>
1193 !! end
1194
1195 # test cases taken from
1196 # http://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
1197 !! test
1198 Ruby markup (W3C-style)
1199 !! wikitext
1200 ; Mono-ruby for individual base characters
1201 : <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
1202 ; Group ruby
1203 : <ruby>今日<rt>きょう</rt></ruby>
1204 ; Jukugo ruby
1205 : <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
1206 ; Inline ruby
1207 : <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
1208 ; Double-sided ruby
1209 : <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
1210 <ruby>
1211 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1212 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1213 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1214 </ruby>
1215 !! html
1216 <dl><dt> Mono-ruby for individual base characters</dt>
1217 <dd> <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1218 <dt> Group ruby</dt>
1219 <dd> <ruby>今日<rt>きょう</rt></ruby></dd>
1220 <dt> Jukugo ruby</dt>
1221 <dd> <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1222 <dt> Inline ruby</dt>
1223 <dd> <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1224 <dt> Double-sided ruby</dt>
1225 <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>
1226 <p><ruby>
1227 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1228 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1229 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1230 </ruby>
1231 </p>
1232 !! end
1233
1234 # The next two test different paths in the sanitizer.
1235 !! test
1236 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
1237 !! wikitext
1238 <blockquote|>a</blockquote>
1239
1240 <b→> doesn't terminate </b→>
1241
1242 <bä> doesn't terminate </bä>
1243
1244 <boo> doesn't terminate </boo>
1245
1246 <s.foo> doesn't terminate </s.foo>
1247
1248 <sub-ID#1>
1249 !! html
1250 <p>&lt;blockquote|&gt;a&lt;/blockquote&gt;
1251 </p><p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1252 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1253 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1254 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1255 </p><p>&lt;sub-ID#1&gt;
1256 </p>
1257 !! end
1258
1259 # There is a tidy bug here: http://sourceforge.net/p/tidy/bugs/946/
1260 # If the non-word-character tag made it through the sanitizer, tidy
1261 # would munge it up.
1262 !! test
1263 Non-word characters don't terminate tag names + tidy
1264 !! wikitext
1265 <blockquote|>a</blockquote>
1266
1267 <b→> doesn't terminate </b→>
1268
1269 <bä> doesn't terminate </bä>
1270
1271 <boo> doesn't terminate </boo>
1272
1273 <s.foo> doesn't terminate </s.foo>
1274
1275 <sub-ID#1>
1276 !! html+tidy
1277 <p>&lt;blockquote|&gt;a</p>
1278 <p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;</p>
1279 <p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;</p>
1280 <p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;</p>
1281 <p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;</p>
1282 <p>&lt;sub-ID#1&gt;</p>
1283 !! end
1284
1285 ###
1286 ### See tests/parser/parserTestsParserHook.php for the <tåg> extension)
1287 ### This checks that HTML5 tags (with non-word characters in the tag
1288 ### name) make it safely through the parser -- the Sanitizer will
1289 ### munge them later, as it should.
1290 ###
1291 !! test
1292 Non-word characters are valid in extension tags (T19663)
1293 !! wikitext
1294 <tåg>tåg</tåg>
1295 !! html
1296 <pre>
1297 'tåg'
1298 array (
1299 )
1300 </pre>
1301
1302 !! end
1303
1304 !! test
1305 Isolated close tags should be treated as literal text (bug 52760)
1306 !! wikitext
1307 </b>
1308
1309 <s.foo>s</s>
1310 !! html+tidy
1311 <p>&lt;s.foo&gt;s</p>
1312 !! end
1313
1314 ###
1315 ### Special characters
1316 ###
1317
1318 !! test
1319 Bare pipe character (bug 52363)
1320 !! wikitext
1321 |
1322 !! html
1323 <p>|
1324 </p>
1325 !! end
1326
1327 !! test
1328 Bare pipe character from a template (bug 52363)
1329 !! wikitext
1330 {{pipe}}
1331 !! html
1332 <p>|
1333 </p>
1334 !! end
1335
1336 ###
1337 ### <nowiki> test cases
1338 ###
1339
1340 !! test
1341 <nowiki> unordered list
1342 !! wikitext
1343 <nowiki>* This is not an unordered list item.</nowiki>
1344 !! html
1345 <p>* This is not an unordered list item.
1346 </p>
1347 !! end
1348
1349 !! test
1350 <nowiki> spacing
1351 !! wikitext
1352 <nowiki>Lorem ipsum dolor
1353
1354 sed abit.
1355 sed nullum.
1356
1357 :and a colon
1358 </nowiki>
1359 !! html
1360 <p>Lorem ipsum dolor
1361
1362 sed abit.
1363 sed nullum.
1364
1365 :and a colon
1366
1367 </p>
1368 !! end
1369
1370 !! test
1371 nowiki 3
1372 !! wikitext
1373 :There is not nowiki.
1374 :There is <nowiki>nowiki</nowiki>.
1375
1376 #There is not nowiki.
1377 #There is <nowiki>nowiki</nowiki>.
1378
1379 *There is not nowiki.
1380 *There is <nowiki>nowiki</nowiki>.
1381 !! html
1382 <dl><dd>There is not nowiki.</dd>
1383 <dd>There is nowiki.</dd></dl>
1384 <ol><li>There is not nowiki.</li>
1385 <li>There is nowiki.</li></ol>
1386 <ul><li>There is not nowiki.</li>
1387 <li>There is nowiki.</li></ul>
1388
1389 !! end
1390
1391 !! test
1392 Entities inside <nowiki>
1393 !! wikitext
1394 <nowiki>&lt;</nowiki>
1395 !! html
1396 <p>&lt;
1397 </p>
1398 !! end
1399
1400 !! test
1401 Entities inside template parameters
1402 !! options
1403 parsoid
1404 !! wikitext
1405 {{echo|&ndash;}}
1406 !! html
1407 <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>
1408 !! end
1409
1410 !! test
1411 Properly escape nowiki when combined with other wiki markup
1412 !! options
1413 parsoid=html2wt
1414 !! html
1415 <p>* &lt;/nowiki&gt; tag</p>
1416 !! wikitext
1417 <nowiki>* &lt;/nowiki&gt;</nowiki> tag
1418 !! end
1419
1420 !! test
1421 T71950: 1. Put nowiki as close to cause as possible, even with non-quote escapable chars
1422 !! options
1423 parsoid=html2wt
1424 !! html
1425 <p>This text: L'<a rel="mw:WikiLink" href="./Foo">Foo</a>
1426 This text: L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1427 This text: L'''<a rel="mw:WikiLink" href="./Foo">Foo</a>''</p>
1428 !! wikitext
1429 This text: L'[[Foo]]
1430 This text: L<nowiki>''</nowiki>[[Foo]]
1431 This text: L<nowiki>'''</nowiki>[[Foo]]<nowiki>''</nowiki>
1432 !! end
1433
1434 # This test fails because wikitext whitespace is not normalized before comparing.
1435 !! test
1436 T71950: 2. Put nowiki as close to cause as possible, after ' :'
1437 !! options
1438 parsoid=html2wt
1439 !! html
1440 <p>This text : L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1441 </p>
1442 !! wikitext
1443 This text : L<nowiki>''</nowiki>[[Foo]]
1444 !! end
1445
1446 # This test and the next one are html2wt only as they test that incorrect wikitext
1447 # passed in template arguments gets escaped or wrapped in nowikis where required.
1448 !! test
1449 T71482: Use {{!}} instead of nowiki for single pipe in template argument
1450 !! options
1451 parsoid=html2wt
1452 !! html/parsoid
1453 <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>
1454 <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>
1455 !! wikitext
1456 {{echo|foo{{!}}bar}}
1457 {{echo|<nowiki>foo|bar |[[</nowiki>}}
1458 !! end
1459
1460 !! test
1461 T53961: Output correct nowikis in template arguments
1462 !! options
1463 parsoid=html2wt
1464 !! html/parsoid
1465 <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>
1466 <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>
1467 <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>
1468 <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>
1469 <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>
1470 !! wikitext
1471 {{echo|a [ b}}
1472 {{echo|a <nowiki>}}</nowiki> b}}
1473 {{echo|<nowiki>a [[ b</nowiki>}}
1474 {{echo|a {{!}} <nowiki>{{ ]]</nowiki>}}
1475 {{echo|a <nowiki>}</nowiki>}}
1476 !! end
1477
1478 ###
1479 ### Comments
1480 ###
1481 !! test
1482 Comments and Indent-Pre
1483 !! wikitext
1484 <!-- comment 1 --> asdf
1485
1486 <!-- comment 1 --> asdf
1487 <!-- comment 2 -->
1488
1489 <!-- comment 1 --> asdf
1490 <!-- comment 2 -->xyz
1491
1492 <!-- comment 1 --> asdf
1493 <!-- comment 2 --> xyz
1494 !! html
1495 <pre>asdf
1496 </pre>
1497 <pre>asdf
1498 </pre>
1499 <pre>asdf
1500 </pre>
1501 <p>xyz
1502 </p>
1503 <pre>asdf
1504 xyz
1505 </pre>
1506 !! end
1507
1508 !! test
1509 Comment test 2a
1510 !! wikitext
1511 asdf
1512 <!-- comment 1 -->
1513 jkl
1514 !! html
1515 <p>asdf
1516 jkl
1517 </p>
1518 !! end
1519
1520 !! test
1521 Comment test 2b
1522 !! wikitext
1523 asdf
1524 <!-- comment 1 -->
1525
1526 jkl
1527 !! html
1528 <p>asdf
1529 </p><p>jkl
1530 </p>
1531 !! end
1532
1533 !! test
1534 Comment test 3
1535 !! wikitext
1536 asdf
1537 <!-- comment 1 -->
1538 <!-- comment 2 -->
1539 jkl
1540 !! html
1541 <p>asdf
1542 jkl
1543 </p>
1544 !! end
1545
1546 !! test
1547 Comment test 4
1548 !! wikitext
1549 asdf<!-- comment 1 -->jkl
1550 !! html
1551 <p>asdfjkl
1552 </p>
1553 !! end
1554
1555 !! test
1556 Comment spacing
1557 !! wikitext
1558 a
1559 <!-- foo --> b <!-- bar -->
1560 c
1561 !! html
1562 <p>a
1563 </p>
1564 <pre> b
1565 </pre>
1566 <p>c
1567 </p>
1568 !! end
1569
1570 !! test
1571 Comment whitespace
1572 !! wikitext
1573 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1574 !! html
1575
1576 !! end
1577
1578 !! test
1579 Comment semantics and delimiters
1580 !! wikitext
1581 <!-- --><!----><!-----><!------>
1582 !! html
1583
1584 !! end
1585
1586 !! test
1587 Comment semantics and delimiters, redux
1588 !! wikitext
1589 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1590 -- foo -- funky huh? ... -->
1591 !! html
1592
1593 !! end
1594
1595 !! test
1596 Comment semantics and delimiters: directors cut
1597 !! wikitext
1598 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1599 everything starting with < followed by !-- until the first -- and > we see,
1600 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1601 -->-->
1602 !! html
1603 <p>--&gt;
1604 </p>
1605 !! end
1606
1607 !! test
1608 Comment semantics: nesting
1609 !! wikitext
1610 <!--<!-- no, we're not going to do anything fancy here -->-->
1611 !! html
1612 <p>--&gt;
1613 </p>
1614 !! end
1615
1616 !! test
1617 Comment semantics: unclosed comment at end
1618 !! wikitext
1619 <!--This comment will run out to the end of the document
1620 !! html
1621
1622 !! end
1623
1624 # Bug 58184: document parsoid's behaviour
1625 !! test
1626 Suppress comment closing tag in lenient browsers
1627 !! options
1628 parsoid=wt2html,html2html
1629 !! wikitext
1630 <!-- Browsers--!> think this is closed -->
1631 !! html/php
1632
1633 !! html/parsoid
1634 <!-- Browsers--¡> think this is closed -->
1635 !! end
1636
1637 !! test
1638 Comment in template title
1639 !! wikitext
1640 {{f<!---->oo}}
1641 !! html
1642 <p>FOO
1643 </p>
1644 !! end
1645
1646 !! test
1647 Comment on its own line post-expand
1648 !! wikitext
1649 a
1650 {{blank}}<!---->
1651 b
1652 !! html
1653 <p>a
1654 </p><p>b
1655 </p>
1656 !! end
1657
1658 !! test
1659 Comment on its own line post-expand with non-significant whitespace
1660 !! wikitext
1661 a
1662 {{blank}} <!---->
1663 b
1664 !! html
1665 <p>a
1666 </p><p>b
1667 </p>
1668 !! end
1669
1670 !! test
1671 Multiple comments should still parse as SOL-transparent
1672 !! options
1673 parsoid=wt2html,wt2wt
1674 !! wikitext
1675 <!--c1-->*a
1676 <!--c2--><!--c3--><!--c4-->*b
1677 !! html
1678 <ul>
1679 <li>a
1680 </li>
1681 <li>b
1682 </li>
1683 </ul>
1684 !! end
1685
1686 ###
1687 ### paragraph wrapping tests
1688 ###
1689 !! test
1690 No block tags
1691 !! wikitext
1692 a
1693
1694 b
1695 !! html
1696 <p>a
1697 </p><p>b
1698 </p>
1699 !! end
1700
1701 !! test
1702 Block tag on one line (<div>)
1703 !! wikitext
1704 a <div>foo</div>
1705
1706 b
1707 !! html
1708 a <div>foo</div>
1709 <p>b
1710 </p>
1711 !! html+tidy
1712 <p>a</p>
1713 <div>foo</div>
1714 <p>b</p>
1715 !! end
1716
1717 !! test
1718 Block tag on one line (<blockquote>)
1719 !! wikitext
1720 a <blockquote>foo</blockquote>
1721
1722 b
1723 !! html
1724 a <blockquote>foo</blockquote>
1725 <p>b
1726 </p>
1727 !! html+tidy
1728 <p>a</p>
1729 <blockquote>
1730 <p>foo</p>
1731 </blockquote>
1732 <p>b</p>
1733 !! end
1734
1735 !! test
1736 Block tag on both lines (<div>)
1737 !! wikitext
1738 a <div>foo</div>
1739
1740 b <div>foo</div>
1741 !! html
1742 a <div>foo</div>
1743 b <div>foo</div>
1744
1745 !! html+tidy
1746 <p>a</p>
1747 <div>foo</div>
1748 <p>b</p>
1749 <div>foo</div>
1750 !! end
1751
1752 !! test
1753 Block tag on both lines (<blockquote>)
1754 !! wikitext
1755 a <blockquote>foo</blockquote>
1756
1757 b <blockquote>foo</blockquote>
1758 !! html
1759 a <blockquote>foo</blockquote>
1760 b <blockquote>foo</blockquote>
1761
1762 !! html+tidy
1763 <p>a</p>
1764 <blockquote>
1765 <p>foo</p>
1766 </blockquote>
1767 <p>b</p>
1768 <blockquote>
1769 <p>foo</p>
1770 </blockquote>
1771 !! end
1772
1773 !! test
1774 Multiple lines without block tags
1775 !! wikitext
1776 <div>foo</div> a
1777 b
1778 c
1779 d<!--foo--> e
1780 x <div>foo</div> z
1781 !! html
1782 <div>foo</div> a
1783 <p>b
1784 c
1785 d e
1786 </p>
1787 x <div>foo</div> z
1788
1789 !! html+tidy
1790 <div>foo</div>
1791 <p>a</p>
1792 <p>b c d e</p>
1793 <p>x</p>
1794 <div>foo</div>
1795 <p>z</p>
1796 !! end
1797
1798 # Tidy strips out the empty <div> tags. Parsoid doesn't.
1799 # So, we have a separate section for Parsoid. We don't want
1800 # to mimic this stripping behavior in Parsoid. It affects
1801 # editing experience and also requires us to maintain additional
1802 # info for RT-ing.
1803 !! test
1804 Empty lines between lines with block tags
1805 !! wikitext
1806 <div></div>
1807
1808
1809 <div></div>a
1810
1811 b
1812 <div>a</div>b
1813
1814 <div>b</div>d
1815
1816
1817 <div>e</div>
1818 !! html
1819 <div></div>
1820 <p><br />
1821 </p>
1822 <div></div>a
1823 <p>b
1824 </p>
1825 <div>a</div>b
1826 <div>b</div>d
1827 <p><br />
1828 </p>
1829 <div>e</div>
1830
1831 !! html+tidy
1832 <p><br /></p>
1833 <p>a</p>
1834 <p>b</p>
1835 <div>a</div>
1836 <p>b</p>
1837 <div>b</div>
1838 <p>d</p>
1839 <p><br /></p>
1840 <div>e</div>
1841 !! html/parsoid
1842 <div data-parsoid='{"stx":"html"}'></div>
1843
1844 <p><br /></p>
1845 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
1846
1847 <p>b</p>
1848 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
1849
1850 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
1851
1852 <p><br /></p>
1853 <div data-parsoid='{"stx":"html"}'>e</div>
1854 !! end
1855
1856 ## PHP parser emits output which is broken
1857 !! test
1858 Unclosed HTML p-tags should be handled properly
1859 !! wikitext
1860 <div><p>foo</div>
1861 a
1862
1863 b
1864 !! html/php+tidy
1865 <div>
1866 <p>foo</p>
1867 </div>
1868 <p>a</p>
1869 <p>b</p>
1870 !! html/parsoid
1871 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
1872 <p>a</p>
1873 <p>b</p>
1874 !! end
1875
1876 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
1877 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
1878 ## them for now.
1879 !! test
1880 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
1881 !! options
1882 parsoid=wt2html
1883 !! wikitext
1884 a [[Category:A1]] [[Category:A2]]
1885 [[Category:A3]]
1886 [[Category:A4]]
1887 !! html/parsoid
1888 <p>a</p>
1889 <link href="Category:A1"/> <link href="Category:A2"/> <link href="Category:A3"/> <link href="Category:A4"/>
1890 !! end
1891
1892 !! test
1893 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
1894 !! options
1895 parsoid=wt2html
1896 !! wikitext
1897 [[Category:A1]]a
1898 !! html/parsoid
1899 <link href="Category:A1"/><p>a</p>
1900 !! end
1901
1902 ###
1903 ### Preformatted text
1904 ###
1905 !! test
1906 Preformatted text
1907 !! wikitext
1908 This is some
1909 Preformatted text
1910 With ''italic''
1911 And '''bold'''
1912 And a [[Main Page|link]]
1913 !! html
1914 <pre>This is some
1915 Preformatted text
1916 With <i>italic</i>
1917 And <b>bold</b>
1918 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
1919 </pre>
1920 !! end
1921
1922 !! test
1923 Tabs don't trigger preformatted text
1924 !! wikitext
1925 This is not
1926 preformatted text.
1927 This is preformatted text.
1928 So is this.
1929 !! html
1930 <p> This is not
1931 preformatted text.
1932 </p>
1933 <pre>This is preformatted text.
1934 So is this.
1935 </pre>
1936 !! end
1937
1938 !! test
1939 Ident preformatting with inline content
1940 !! wikitext
1941 a
1942 ''b''
1943 !! html
1944 <pre>a
1945 <i>b</i>
1946 </pre>
1947 !! end
1948
1949 !! test
1950 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
1951 !! wikitext
1952 <pre><nowiki>
1953 <b>
1954 <cite>
1955 <em>
1956 </nowiki></pre>
1957 !! html
1958 <pre>
1959 &lt;b&gt;
1960 &lt;cite&gt;
1961 &lt;em&gt;
1962 </pre>
1963
1964 !! end
1965
1966 !! test
1967 Regression with preformatted in <center>
1968 !! wikitext
1969 <center>
1970 Blah
1971 </center>
1972 !! html
1973 <center>
1974 <pre>Blah
1975 </pre>
1976 </center>
1977
1978 !! end
1979
1980 !! test
1981 Bug 52763: Preformatted in <blockquote>
1982 !! wikitext
1983 <blockquote>
1984 Blah
1985 {|
1986 |
1987 indented cell (no pre-wrapping!)
1988 |}
1989 </blockquote>
1990 !! html
1991 <blockquote>
1992 <p> Blah
1993 </p>
1994 <table>
1995 <tr>
1996 <td>
1997 <p> indented cell (no pre-wrapping!)
1998 </p>
1999 </td></tr></table>
2000 </blockquote>
2001
2002 !! end
2003
2004 !! test
2005 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
2006 !! wikitext
2007 <blockquote>
2008 Foo
2009
2010 Bar
2011 </blockquote>
2012 !! html
2013 <blockquote>
2014 <p>Foo
2015 </p><p>Bar
2016 </p>
2017 </blockquote>
2018
2019 !! end
2020
2021 !! test
2022 Bug 15491: <ins>/<del> in blockquote
2023 !! wikitext
2024 <blockquote>
2025 Foo <del>bar</del> <ins>baz</ins> quux
2026 </blockquote>
2027 !! html
2028 <blockquote>
2029 <p>Foo <del>bar</del> <ins>baz</ins> quux
2030 </p>
2031 </blockquote>
2032
2033 !! end
2034
2035 # Note that the p-wrapping is newline sensitive, which could be
2036 # considered a bug: tidy will wrap only the 'Foo' in the example
2037 # below in a <p> tag. (see comment 23-25 of bug #6200)
2038 !! test
2039 Bug 15491: <ins>/<del> in blockquote (2)
2040 !! wikitext
2041 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2042 </blockquote>
2043 !! html
2044 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2045 </blockquote>
2046
2047 !! html+tidy
2048 <blockquote>
2049 <p>Foo</p>
2050 <del>bar</del> <ins>baz</ins> quux</blockquote>
2051 !! end
2052
2053 !! test
2054 <pre> with attributes (bug 3202)
2055 !! wikitext
2056 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2057 !! html
2058 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2059
2060 !! end
2061
2062 !! test
2063 <pre> with width attribute (bug 3202)
2064 !! wikitext
2065 <pre width="8">Narrow screen goodies</pre>
2066 !! html
2067 <pre width="8">Narrow screen goodies</pre>
2068
2069 !! end
2070
2071 !! test
2072 <pre> with forbidden attribute (bug 3202)
2073 !! wikitext
2074 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
2075 !! html
2076 <pre width="8">Narrow screen goodies</pre>
2077
2078 !! end
2079
2080 !! test
2081 Entities inside <pre>
2082 !! wikitext
2083 <pre>&lt;</pre>
2084 !! html
2085 <pre>&lt;</pre>
2086
2087 !! end
2088
2089 !! test
2090 <pre> with forbidden attribute values (bug 3202)
2091 !! wikitext
2092 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
2093 !! html
2094 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
2095
2096 !! end
2097
2098 !! test
2099 <nowiki> inside <pre> (bug 13238)
2100 !! wikitext
2101 <pre>
2102 <nowiki>
2103 </pre>
2104 <pre>
2105 <nowiki></nowiki>
2106 </pre>
2107 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
2108 !! html
2109 <pre>
2110 &lt;nowiki&gt;
2111 </pre>
2112 <pre>
2113
2114 </pre>
2115 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2116
2117 !! end
2118
2119 !! test
2120 <nowiki> and <pre> preference (first one wins)
2121 !! wikitext
2122 <pre>
2123 <nowiki>
2124 </pre>
2125 </nowiki>
2126 </pre>
2127
2128 <nowiki>
2129 <pre>
2130 <nowiki>
2131 </pre>
2132 </nowiki>
2133 </pre>
2134
2135 !! html
2136 <pre>
2137 &lt;nowiki&gt;
2138 </pre>
2139 <p>&lt;/nowiki&gt;
2140 &lt;/pre&gt;
2141 </p><p>
2142 &lt;pre&gt;
2143 &lt;nowiki&gt;
2144 &lt;/pre&gt;
2145
2146 &lt;/pre&gt;
2147 </p>
2148 !! end
2149
2150 !! test
2151 </pre> inside nowiki
2152 !! wikitext
2153 <nowiki></pre></nowiki>
2154 !! html
2155 <p>&lt;/pre&gt;
2156 </p>
2157 !! end
2158
2159 # Parsoid doesn't strip empty tags, like Tidy does.
2160 !! test
2161 Empty pre; pre inside other HTML tags (bug 54946)
2162 !! options
2163 parsoid=wt2html,wt2wt
2164 !! wikitext
2165 a
2166
2167 <div><pre>
2168 foo
2169 </pre></div>
2170 <pre></pre>
2171 !! html/php
2172 <p>a
2173 </p>
2174 <div><pre>
2175 foo
2176 </pre></div>
2177 <pre></pre>
2178
2179 !! html/php+tidy
2180 <p>a</p>
2181 <div>
2182 <pre>
2183 foo
2184 </pre></div>
2185 !! html/parsoid
2186 <p>a</p>
2187
2188 <div><pre>foo
2189 </pre></div>
2190 <pre></pre>
2191 !! end
2192
2193 !! test
2194 HTML pre followed by indent-pre
2195 !! wikitext
2196 <pre>foo</pre>
2197 bar
2198 !! html
2199 <pre>foo</pre>
2200 <pre>bar
2201 </pre>
2202 !! end
2203
2204 !!test
2205 Block tag pre
2206 !!options
2207 parsoid
2208 !! wikitext
2209 <p><pre>foo</pre></p>
2210 !! html
2211 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2212 !!end
2213
2214 !!test
2215 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2216 !! wikitext
2217 {{echo|}}
2218 !! html
2219
2220 !!end
2221
2222 !!test
2223 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2224 !! wikitext
2225 {{echo|
2226 foo}}
2227 !! html
2228 <p>foo
2229 </p>
2230 !!end
2231
2232 !! test
2233 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2234 !! wikitext
2235 {{echo|a
2236 b}}
2237 !! html
2238 <pre>a
2239 </pre>
2240 <p>b
2241 </p>
2242 !!end
2243
2244 !! test
2245 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2246 !! wikitext
2247 {{echo|a
2248 b
2249 c
2250 d
2251 e
2252 }}
2253 !! html
2254 <pre>a
2255 </pre>
2256 <p>b
2257 c
2258 </p>
2259 <pre>d
2260 </pre>
2261 <p>e
2262 </p>
2263 !!end
2264
2265 !!test
2266 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2267 !! wikitext
2268 {{echo| foo}}
2269
2270 {{echo| foo}}{{echo| bar}}
2271
2272 {{echo| foo}}
2273 {{echo| bar}}
2274
2275 {{echo|<!--cmt--> foo}}
2276
2277 <!--cmt-->{{echo| foo}}
2278
2279 {{echo|{{echo| }}bar}}
2280 !! html
2281 <pre>foo
2282 </pre>
2283 <pre>foo bar
2284 </pre>
2285 <pre>foo
2286 bar
2287 </pre>
2288 <pre>foo
2289 </pre>
2290 <pre>foo
2291 </pre>
2292 <pre>bar
2293 </pre>
2294 !!end
2295
2296 !! test
2297 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2298 !! wikitext
2299 {{echo| }}a
2300
2301 {{echo|
2302 }}a
2303
2304 {{echo|
2305 b}}
2306
2307 {{echo|a
2308 }}b
2309
2310 {{echo|a
2311 }} b
2312 !! html
2313 <pre>a
2314 </pre>
2315 <p><br />
2316 </p>
2317 <pre>a
2318 </pre>
2319 <p><br />
2320 </p>
2321 <pre>b
2322 </pre>
2323 <p>a
2324 </p>
2325 <pre>b
2326 </pre>
2327 <p>a
2328 </p>
2329 <pre>b
2330 </pre>
2331 !!end
2332
2333 !! test
2334 Things that look like <pre> tags aren't treated as such
2335 !! wikitext
2336 Barack Obama <President> of the United States
2337 <President></President>
2338 !! html
2339 <p>Barack Obama &lt;President&gt; of the United States
2340 &lt;President&gt;&lt;/President&gt;
2341 </p>
2342 !! end
2343
2344 ## PHP parser discards the "<pre " string
2345 !! test
2346 Handle broken pre-like tags (bug 64025)
2347 !! options
2348 parsoid=wt2html
2349 !! wikitext
2350 {{echo|<pre <pre>x</pre>}}
2351
2352 <table><pre </table>
2353 !! html/php
2354 <pre>x</pre>
2355 <table><pre></pre></table>
2356
2357 !! html/parsoid
2358 <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>
2359
2360
2361 <p>&lt;pre </p>
2362
2363 <table></table>
2364 !! end
2365
2366 !! test
2367 Parsoid: handle pre with space after attribute
2368 !! options
2369 parsoid=wt2html
2370 !! wikitext
2371 <pre style="width:50%;" >{{echo|foo}}</pre>
2372 !! html
2373 <pre style="width:50%;">{{echo|foo}}</pre>
2374 !! end
2375
2376 # TODO / maybe: fix wt2wt for this
2377 !! test
2378 Parsoid: Don't paragraph-wrap fosterable content
2379 !! options
2380 parsoid=wt2html
2381 !! wikitext
2382 {|
2383 <td></td>
2384 <td></td>
2385
2386
2387
2388 |}
2389 !! html
2390 <table>
2391
2392 <tbody>
2393 <tr>
2394 <td></td>
2395
2396 <td></td></tr>
2397
2398
2399
2400 </tbody></table>
2401 !! end
2402
2403 !! test
2404 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2405 !! options
2406 parsoid=wt2html
2407 !! wikitext
2408 {|
2409 <td>
2410 <td>
2411 </td>
2412
2413
2414
2415 |}
2416 !! html
2417 <table>
2418
2419 <tbody>
2420 <tr>
2421 <td></td>
2422
2423 <td>
2424 </td></tr>
2425
2426
2427
2428 </tbody></table>
2429 !! end
2430
2431
2432 #--------------------------------------------------------------------
2433 # Transclusion parameter whitespace stripping tests
2434 # Behavior is different for positional and named parameters
2435 #--------------------------------------------------------------------
2436 !! test
2437 Templates: Strip leading and trailing whitespace from named-param values
2438 !! wikitext
2439 {{echo|1= a }}
2440
2441 {{echo|1= {{echo|b}} }}
2442
2443 {{echo| 1 =
2444 c }}
2445
2446 {{echo| 1 =
2447 * d
2448 }}
2449 !! html
2450 <p>a
2451 </p><p>b
2452 </p><p>c
2453 </p>
2454 <ul><li> d</li></ul>
2455
2456 !! end
2457
2458 !! test
2459 Templates: Don't strip whitespace from positional-param values
2460 !! wikitext
2461 {{echo|a }}
2462
2463 {{echo|{{echo|b}} }}
2464
2465 {{echo| c
2466 }}
2467
2468 {{echo| {{echo|d}}
2469 }}
2470
2471 {{echo|
2472 e}}
2473
2474 {{echo|
2475 * f}}
2476
2477 {{echo|
2478 }}g
2479 !! html
2480 <p>a
2481 </p><p>b
2482 </p>
2483 <pre>c
2484 </pre>
2485 <p><br />
2486 </p>
2487 <pre>d
2488 </pre>
2489 <p><br />
2490 </p>
2491 <pre>e
2492 </pre>
2493 <p><br />
2494 </p>
2495 <ul><li> f</li></ul>
2496 <p><br />
2497 </p>
2498 <pre>g
2499 </pre>
2500 !! end
2501
2502 !! test
2503 Templates: Handle empty comment-and-ws-only lines correctly
2504 !! wikitext
2505 {{echo|foo
2506 <!--should be ignored-->
2507 <!--should be ignored as well-->
2508 bar}}
2509 !! html
2510 <p>foo
2511 bar
2512 </p>
2513 !! end
2514
2515 !! test
2516 Templates: Handle comments in the target
2517 !! wikitext
2518 {{echo
2519 <!-- should be ignored -->
2520 |foo}}
2521
2522 {{echo<!-- should be ignored -->
2523 |foo}}
2524
2525 {{echo<!-- should be ignored -->|foo}}
2526
2527 {{<!-- should be ignored -->echo|foo}}
2528 !!html/parsoid
2529 <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>
2530
2531 <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>
2532
2533 <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>
2534
2535 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2536 !!end
2537
2538 !! test
2539 Templates: Handle comments in parameter names (bug 67657)
2540 !! wikitext
2541 {{echo|1
2542 <!-- should be ignored -->
2543 =foo}}
2544
2545 {{echo|
2546 <!-- should be ignored -->
2547 1 = foo}}
2548
2549 {{echo|1<!-- should be ignored --> = foo}}
2550
2551 {{echo|<!-- should be ignored -->1 = foo}}
2552 !!html/parsoid
2553 <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>
2554
2555 <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>
2556
2557 <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>
2558
2559 <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>
2560 !!end
2561
2562 !! test
2563 Templates: Other wikitext in parameter names (bug 67657)
2564 !! wikitext
2565 {{echo|''1''=foo}}
2566 !!html/parsoid
2567 <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>
2568 !!html/php
2569 <p>{{{1}}}
2570 </p>
2571 !!end
2572
2573 #--------------------------------------------------------------------
2574 # Transclusion parameter escaping tests
2575 #--------------------------------------------------------------------
2576 !! test
2577 Templates: Parsoid parameter escaping test 1
2578 !! options
2579 parsoid
2580 !! wikitext
2581 {{echo|[foo]|{{echo|[bar]}}}}
2582 !! html
2583 <p about="#mwt1" typeof="mw:Transclusion"
2584 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2585 !! end
2586
2587 !! test
2588 Parsoid: Pipes in external links in template parameter
2589 !! options
2590 parsoid
2591 !! wikitext
2592 {{echo|[{{echo|http://example.com}} link]}}
2593 !! html
2594 <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>
2595 !! end
2596
2597 !! test
2598 Parsoid: pipe in transclusion parameter
2599 !! options
2600 parsoid
2601 !! wikitext
2602 {{echo|http://foo.com/a&#124;b}}
2603 !! html
2604 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2605 typeof="mw:Transclusion"
2606 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>
2607 !! end
2608
2609 !! test
2610 Parsoid: Pipe in external link target and content in template parameter
2611 !! options
2612 parsoid=html2wt,wt2wt
2613 !! wikitext
2614 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2615 !! html
2616 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2617 typeof="mw:Transclusion"
2618 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2619 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2620 !! end
2621
2622 !! test
2623 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2624 !! options
2625 parsoid
2626 !! wikitext
2627 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2628 !! html
2629 <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>
2630 !! end
2631
2632 !! test
2633 Templates: Don't escape already nowiki-escaped text in template parameters
2634 !! options
2635 parsoid=html2wt,wt2wt
2636 !! wikitext
2637 {{echo|foo<nowiki>|</nowiki>bar}}
2638 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2639 {{echo|<nowiki></nowiki>}}
2640 !! html
2641 <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>
2642 <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>
2643 <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>
2644 </p>
2645 !! end
2646
2647 ## Bug 52824
2648 !! test
2649 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2650 !! options
2651 parsoid=html2wt,wt2wt
2652 !! wikitext
2653 {{echo|{{echo|1=bar}}}}
2654 !! html
2655 <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>
2656 !! end
2657
2658 ## Bug 56733
2659 !! test
2660 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2661 !! options
2662 parsoid
2663 !! wikitext
2664 {{echo|a : b}}
2665 !! html
2666 <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>
2667 !! end
2668
2669 ## Bug T73412
2670 !! test
2671 Templates: Preserve blank parameter names
2672 !! wikitext
2673 {{echo|=foo}}
2674 !! html/php
2675 <p>{{{1}}}
2676 </p>
2677 !! html/parsoid
2678 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2679 !! end
2680
2681 ###
2682 ### Parsoid-centric tests for testing RT edge cases for pre
2683 ###
2684
2685 !!test
2686 1a. Indent-Pre and Comments
2687 !! wikitext
2688 a
2689 <!--a-->
2690 c
2691 !! html
2692 <pre>a
2693 </pre>
2694 <p>c
2695 </p>
2696 !!end
2697
2698 !!test
2699 1b. Indent-Pre and Comments
2700 !! wikitext
2701 a
2702 <!--a-->
2703 c
2704 !! html
2705 <pre>a
2706 </pre>
2707 <p>c
2708 </p>
2709 !!end
2710
2711 !!test
2712 1c. Indent-Pre and Comments
2713 !! wikitext
2714 <!--a--> a
2715
2716 <!--a--> a
2717 !! html
2718 <pre> a
2719 </pre>
2720 <pre> a
2721 </pre>
2722 !!end
2723
2724 !!test
2725 1d. Indent-Pre and Comments
2726 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2727 !! wikitext
2728 <!--a--> a
2729
2730 <!--b-->b
2731 !! html
2732 <pre>a
2733 </pre>
2734 <pre>b
2735 </pre>
2736 !!end
2737
2738 !!test
2739 2a. Indent-Pre and tables
2740 !! wikitext
2741 {|
2742 |-
2743 !h1!!h2
2744 |foo||bar
2745 |}
2746 !! html
2747 <table>
2748
2749 <tr>
2750 <th>h1</th>
2751 <th>h2
2752 </th>
2753 <td>foo</td>
2754 <td>bar
2755 </td></tr></table>
2756
2757 !!end
2758
2759 !!test
2760 2b. Indent-Pre and tables
2761 !! wikitext
2762 {|
2763 |-
2764 |foo
2765 |}
2766 !! html
2767 <table>
2768
2769 <tr>
2770 <td>foo
2771 </td></tr></table>
2772
2773 !!end
2774
2775 !!test
2776 2c. Indent-Pre and tables (bug 42252)
2777 !! wikitext
2778 {|
2779 |+ foo
2780 ! | bar
2781 |}
2782 !! html
2783 <table>
2784 <caption> foo
2785 </caption>
2786 <tr>
2787 <th> bar
2788 </th></tr></table>
2789
2790 !!end
2791
2792 !!test
2793 2d. Indent-Pre and tables
2794 !! wikitext
2795 a
2796 {|
2797 | b
2798 |}
2799 !! html/php
2800 <pre>a
2801 </pre>
2802 <table>
2803 <tr>
2804 <td> b
2805 </td></tr></table>
2806
2807 !! html/parsoid
2808 <pre>a</pre>
2809 <table>
2810 <tbody><tr><td> b</td></tr>
2811 </tbody></table>
2812 !!end
2813
2814 !!test
2815 2e. Indent-Pre and table-line syntax
2816 !! wikitext
2817 a
2818 | b
2819 | c
2820 !! html/php
2821 <pre>a
2822 | b
2823 | c
2824 </pre>
2825 !!end
2826
2827 !!test
2828 2f. Indent-pre started by table-line syntax
2829 !! wikitext
2830 a
2831 | b
2832 | c
2833 !! html/php
2834 <p>a
2835 </p>
2836 <pre>| b
2837 | c
2838 </pre>
2839 !! html/parsoid
2840 <p>a</p>
2841 <pre>
2842 | b
2843 | c</pre>
2844 !!end
2845
2846 !!test
2847 3a. Indent-Pre and block tags (single-line html)
2848 !! wikitext
2849 a <p> foo </p>
2850 b <div> foo </div>
2851 c <blockquote> foo </blockquote>
2852 <span> foo </span>
2853 !! html
2854 a <p> foo </p>
2855 b <div> foo </div>
2856 c <blockquote> foo </blockquote>
2857 <pre><span> foo </span>
2858 </pre>
2859 !! html/parsoid
2860 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
2861 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
2862 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
2863 <pre><span> foo </span>
2864 </pre>
2865 !! html+tidy
2866 <p>a</p>
2867 <p>foo</p>
2868 <p>b</p>
2869 <div>foo</div>
2870 <p>c</p>
2871 <blockquote>
2872 <p>foo</p>
2873 </blockquote>
2874 <pre>
2875 <span> foo </span>
2876 </pre>
2877 !! end
2878
2879 !!test
2880 3b. Indent-Pre and block tags (multi-line html)
2881 !! wikitext
2882 a <span>foo</span>
2883 b <div> foo </div>
2884 !! html
2885 <pre>a <span>foo</span>
2886 </pre>
2887 b <div> foo </div>
2888
2889 !! html/parsoid
2890 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
2891 b <div data-parsoid='{"stx":"html"}'> foo </div>
2892 !! html+tidy
2893 <pre>
2894 a <span>foo</span>
2895 </pre>
2896 <p>b</p>
2897 <div>foo</div>
2898 !!end
2899
2900 !!test
2901 3c. Indent-Pre and block tags (pre-content on separate line)
2902 !! wikitext
2903 <p>
2904 foo
2905 </p>
2906
2907 <div>
2908 foo
2909 </div>
2910
2911 <center>
2912 foo
2913 </center>
2914
2915 <blockquote>
2916 foo
2917 </blockquote>
2918
2919 <blockquote>
2920 <pre>
2921 foo
2922 </pre>
2923 </blockquote>
2924
2925 <table><tr><td>
2926 foo
2927 </td></tr></table>
2928
2929 <ul><li>
2930 foo
2931 </li></ul>
2932
2933 !! html
2934 <p>
2935 foo
2936 </p>
2937 <div>
2938 <pre>foo
2939 </pre>
2940 </div>
2941 <center>
2942 <pre>foo
2943 </pre>
2944 </center>
2945 <blockquote>
2946 <p> foo
2947 </p>
2948 </blockquote>
2949 <blockquote>
2950 <pre>
2951 foo
2952 </pre>
2953 </blockquote>
2954 <table><tr><td>
2955 <pre>foo
2956 </pre>
2957 </td></tr></table>
2958 <ul><li>
2959 foo
2960 </li></ul>
2961
2962 !!end
2963
2964 !!test
2965 4. Indent-Pre and extension tags
2966 !! wikitext
2967 a <gallery>
2968 File:foobar.jpg
2969 </gallery>
2970 !! html
2971 a <ul class="gallery mw-gallery-traditional">
2972 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
2973 <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>
2974 <div class="gallerytext">
2975 </div>
2976 </div></li>
2977 </ul>
2978
2979 !! html+tidy
2980 <p>a</p>
2981 <ul class="gallery mw-gallery-traditional">
2982 <li class="gallerybox" style="width: 155px">
2983 <div style="width: 155px">
2984 <div class="thumb" style="width: 150px;">
2985 <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>
2986 </div>
2987 <div class="gallerytext"></div>
2988 </div>
2989 </li>
2990 </ul>
2991 !!end
2992
2993 !! test
2994 Table wikitext syntax outside wiki-tables
2995 !! wikitext
2996 a
2997 ! not a table heading
2998 |- not a table row
2999 | not a table cell
3000 | class="foo bar" | baz
3001 b
3002 |}
3003 |-
3004 c
3005 !! html
3006 <p>a
3007 ! not a table heading
3008 |- not a table row
3009 | not a table cell
3010 | class="foo bar" | baz
3011 b
3012 |}
3013 |-
3014 c
3015 </p>
3016 !! end
3017
3018 !!test
3019 Render paragraphs when indent-pre is suppressed in blocklevels
3020 !! wikitext
3021 <blockquote>
3022 foo
3023
3024 bar
3025 </blockquote>
3026 !! html
3027 <blockquote>
3028 <p> foo
3029 </p><p> bar
3030 </p>
3031 </blockquote>
3032
3033 !!end
3034
3035 !!test
3036 4. Multiple spaces at start-of-line
3037 !! wikitext
3038 <p> foo </p>
3039 foo
3040 {|
3041 |foo
3042 |}
3043 !! html
3044 <p> foo </p>
3045 <pre> foo
3046 </pre>
3047 <table>
3048 <tr>
3049 <td>foo
3050 </td></tr></table>
3051
3052 !!end
3053
3054 ## NOTE: the leading white-space chars on empty line are significant
3055 !! test
3056 5a. White-space in indent-pre
3057 !! wikitext
3058 a<br />
3059
3060 b
3061 !! html
3062 <pre>a<br />
3063
3064 b
3065 </pre>
3066 !! end
3067
3068 ## NOTE: the leading white-space chars on empty line are significant
3069 !! test
3070 5b. White-space in indent-pre
3071 !! wikitext
3072 a
3073
3074 b
3075
3076
3077 c
3078 !! html
3079 <pre>a
3080
3081 b
3082
3083
3084 c
3085 </pre>
3086 !! end
3087
3088 !! test
3089 5c. White-space in indent-pre
3090 !! wikitext
3091 ''a''
3092 ''b''
3093 ''c''
3094 !! html
3095 <pre><i>a</i>
3096 <i>b</i>
3097 <i>c</i>
3098 </pre>
3099 !! end
3100
3101 !! test
3102 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3103 !! wikitext
3104 a
3105
3106 <!-- continue -->
3107 b
3108
3109 c
3110
3111 d
3112 !! html
3113 <pre>a
3114
3115 b
3116 </pre>
3117 <pre>c
3118
3119 </pre>
3120 <p>d
3121 </p>
3122 !! end
3123
3124 !! test
3125 7a. Indent-pre and category links
3126 !! options
3127 parsoid=wt2html,wt2wt
3128 !! wikitext
3129 [[Category:foo]] <!-- No pre-wrapping -->
3130 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3131 !! html
3132 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre-wrapping -->
3133 <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 -->
3134 !! end
3135
3136 !! test
3137 7b. Indent-pre and category links
3138 !! options
3139 parsoid=wt2html,wt2wt
3140 !! wikitext
3141 [[Category:foo]] a
3142 [[Category:foo]] {{echo|b}}
3143 !! html
3144 <pre>
3145 <link rel="mw:PageProp/Category" href="./Category:Foo"> a
3146 <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>
3147 !! end
3148
3149 ###
3150 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3151 ###
3152
3153 !!test
3154 HTML-pre: 1. embedded newlines
3155 !! wikitext
3156 <pre>foo</pre>
3157
3158 <pre>
3159 foo
3160 </pre>
3161
3162 <pre>
3163
3164 foo
3165 </pre>
3166
3167 <pre>
3168
3169
3170 foo
3171 </pre>
3172 !! html
3173 <pre>foo</pre>
3174 <pre>
3175 foo
3176 </pre>
3177 <pre>
3178
3179 foo
3180 </pre>
3181 <pre>
3182
3183
3184 foo
3185 </pre>
3186
3187 !! html/parsoid
3188 <pre data-parsoid='{"stx":"html"}'>foo</pre>
3189
3190 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
3191 foo
3192 </pre>
3193
3194 <pre data-parsoid='{"stx":"html"}'>
3195
3196 foo
3197 </pre>
3198
3199 <pre data-parsoid='{"stx":"html"}'>
3200
3201
3202 foo
3203 </pre>
3204 !!end
3205
3206 !! test
3207 HTML-pre: big spaces
3208 !! wikitext
3209 <pre>
3210
3211
3212
3213
3214 haha
3215
3216
3217
3218
3219 haha
3220
3221
3222
3223
3224 </pre>
3225 !! html
3226 <pre>
3227
3228
3229
3230
3231 haha
3232
3233
3234
3235
3236 haha
3237
3238
3239
3240
3241 </pre>
3242
3243 !! html/parsoid
3244 <pre data-parsoid='{"stx":"html"}'>
3245
3246
3247
3248
3249 haha
3250
3251
3252
3253
3254 haha
3255
3256
3257
3258
3259 </pre>
3260 !! end
3261
3262 !!test
3263 HTML-pre: 2: indented text
3264 !! wikitext
3265 <pre>
3266 foo
3267 </pre>
3268 !! html
3269 <pre>
3270 foo
3271 </pre>
3272
3273 !!end
3274
3275 !!test
3276 HTML-pre: 3: other wikitext
3277 !! wikitext
3278 <pre>
3279 * foo
3280 # bar
3281 = no-h =
3282 '' no-italic ''
3283 [[ NoLink ]]
3284 </pre>
3285 !! html
3286 <pre>
3287 * foo
3288 # bar
3289 = no-h =
3290 '' no-italic ''
3291 [[ NoLink ]]
3292 </pre>
3293
3294 !!end
3295
3296 ###
3297 ### Definition lists
3298 ###
3299 !! test
3300 Simple definition
3301 !! wikitext
3302 ; name : Definition
3303 !! html
3304 <dl><dt> name&#160;</dt>
3305 <dd> Definition</dd></dl>
3306
3307 !! end
3308
3309 !! test
3310 Definition list for indentation only
3311 !! wikitext
3312 : Indented text
3313 !! html
3314 <dl><dd> Indented text</dd></dl>
3315
3316 !! end
3317
3318 !! test
3319 Definition list with no space
3320 !! wikitext
3321 ;name:Definition
3322 !! html
3323 <dl><dt>name</dt>
3324 <dd>Definition</dd></dl>
3325
3326 !!end
3327
3328 !! test
3329 Definition list with URL link
3330 !! wikitext
3331 ; http://example.com/ : definition
3332 !! html
3333 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3334 <dd> definition</dd></dl>
3335
3336 !! end
3337
3338 !! test
3339 Definition list with bracketed URL link
3340 !! wikitext
3341 ;[http://www.example.com/ Example]:Something about it
3342 !! html
3343 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3344 <dd>Something about it</dd></dl>
3345
3346 !! end
3347
3348 !! test
3349 Definition list with wikilink containing colon
3350 !! wikitext
3351 ; [[Help:FAQ]]: The least-read page on Wikipedia
3352 !! html
3353 <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>
3354 <dd> The least-read page on Wikipedia</dd></dl>
3355
3356 !! end
3357
3358 # At Brion's and JeLuF's insistence... :)
3359 !! test
3360 Definition list with news link containing colon
3361 !! wikitext
3362 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
3363 !! html/php
3364 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3365 <dd> This isn't even a real newsgroup!</dd></dl>
3366
3367 !! html/parsoid
3368 <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>
3369 !! end
3370
3371 !! test
3372 Malformed definition list with colon
3373 !! wikitext
3374 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3375 !! html
3376 <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>
3377
3378 !! end
3379
3380 !! test
3381 Definition lists: colon in external link text
3382 !! wikitext
3383 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3384 !! html
3385 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3386 <dd> OK, I made that up</dd></dl>
3387
3388 !! end
3389
3390 !! test
3391 Definition lists: colon in HTML attribute
3392 !! wikitext
3393 ;<b style="display: inline">bold</b>
3394 !! html
3395 <dl><dt><b style="display: inline">bold</b></dt></dl>
3396
3397 !! end
3398
3399 !! test
3400 Definition lists: self-closed tag
3401 !! wikitext
3402 ;one<br/>two : two-line fun
3403 !! html
3404 <dl><dt>one<br />two&#160;</dt>
3405 <dd> two-line fun</dd></dl>
3406
3407 !! end
3408
3409 !! test
3410 Bug 11748: Literal closing tags
3411 !! wikitext
3412 <dl>
3413 <dt>test 1</dt>
3414 <dd>test test test test test</dd>
3415 <dt>test 2</dt>
3416 <dd>test test test test test</dd>
3417 </dl>
3418 !! html
3419 <dl>
3420 <dt>test 1</dt>
3421 <dd>test test test test test</dd>
3422 <dt>test 2</dt>
3423 <dd>test test test test test</dd>
3424 </dl>
3425
3426 !! end
3427
3428 !! test
3429 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3430 !! wikitext
3431 <ul><li>
3432 ; term : description
3433 * unordered
3434 </li></ul>
3435 !! html
3436 <ul><li>
3437 <dl><dt> term&#160;</dt>
3438 <dd> description</dd></dl>
3439 <ul><li> unordered</li></ul>
3440 </li></ul>
3441
3442 !! end
3443
3444 !! test
3445
3446 Definition list with empty definition and following paragraph
3447 !! wikitext
3448 ; term:
3449 Paragraph text
3450 !! html
3451 <dl><dt> term</dt>
3452 <dd></dd></dl>
3453 <p>Paragraph text
3454 </p>
3455 !! end
3456
3457 !! test
3458 Nested definition lists using html syntax
3459 !! wikitext
3460 <dl><dt>x</dt>
3461 <dd>a</dd>
3462 <dd>b</dd></dl>
3463
3464 !! end
3465
3466 !! test
3467 Definition Lists: No nesting: Multiple dd's
3468 !! wikitext
3469 ;x
3470 :a
3471 :b
3472 !! html
3473 <dl><dt>x</dt>
3474 <dd>a</dd>
3475 <dd>b</dd></dl>
3476
3477 !! end
3478
3479 !! test
3480 Definition Lists: Indentation: Regular
3481 !! wikitext
3482 :i1
3483 ::i2
3484 :::i3
3485 !! html
3486 <dl><dd>i1
3487 <dl><dd>i2
3488 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3489
3490 !! end
3491
3492 !! test
3493 Definition Lists: Indentation: Missing 1st level
3494 !! wikitext
3495 ::i2
3496 :::i3
3497 !! html
3498 <dl><dd><dl><dd>i2
3499 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3500
3501 !! end
3502
3503 !! test
3504 Definition Lists: Indentation: Multi-level indent
3505 !! wikitext
3506 :::i3
3507 !! html
3508 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3509
3510 !! end
3511
3512 !! test
3513 Definition Lists: Hacky use to indent tables
3514 !! wikitext
3515 ::{|
3516 |foo
3517 |bar
3518 |}
3519 this text
3520 should be left alone
3521 !! html
3522 <dl><dd><dl><dd><table>
3523 <tr>
3524 <td>foo
3525 </td>
3526 <td>bar
3527 </td></tr></table></dd></dl></dd></dl>
3528 <p>this text
3529 should be left alone
3530 </p>
3531 !! end
3532
3533 !! test
3534 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3535 !! wikitext
3536 <!-- foo -->
3537 ::{|
3538 |foo
3539 |bar
3540 |}<!-- bar -->
3541 this text
3542 should be left alone
3543 !! html/parsoid
3544 <!-- foo -->
3545 <dl><dd><dl><dd><table><tr>
3546 <td>foo</td>
3547 <td>bar</td>
3548 </tr></table><!-- bar --></dd></dl></dd></dl>
3549 <p>this text
3550 should be left alone</p>
3551 !! end
3552
3553 !! test
3554 Definition Lists: Hacky use to indent tables, with comment before table
3555 !! wikitext
3556 ::<!-- foo -->{|
3557 |foo
3558 |}
3559 !! html/parsoid
3560 <dl><dd><dl><dd><!-- foo --><table><tr>
3561 <td>foo</td>
3562 </tr></table></dd></dl></dd></dl>
3563 !! end
3564
3565 # Bug 52473
3566 !! test
3567 Definition Lists: Hacky use to indent tables (WS-insensitive)
3568 !! options
3569 parsoid
3570 !! wikitext
3571 : {|
3572 |a
3573 |}
3574 !! html
3575 <dl>
3576 <dd> <table><tr><td>a</td></tr></table> </dd>
3577 </dl>
3578 !! end
3579 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3580 ## as an empty dt item. It also ignores all but the last ";" when followed
3581 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3582 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3583 ## ";"s.
3584 ##
3585 ## Ex: ";;t2 ::d2" is transformed into:
3586 ##
3587 ## <dl>
3588 ## <dt>t2 </dt>
3589 ## <dd>
3590 ## <dl>
3591 ## <dt></dt>
3592 ## <dd>d2</dd>
3593 ## </dl>
3594 ## </dd>
3595 ## </dl>
3596 ##
3597 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3598 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3599 ##
3600 ## <dl>
3601 ## <dt>
3602 ## <dl>
3603 ## <dt>t2 </dt>
3604 ## <dd>:d2</dd>
3605 ## </dl>
3606 ## </dt>
3607 ## </dl>
3608 ##
3609 ## All Parsoid only definition list tests have this difference.
3610 ##
3611 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
3612 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3613
3614 !! test
3615 Table / list interaction: indented table with lists in table contents
3616 !! wikitext
3617 :{|
3618 |-
3619 | a
3620 * b
3621 |-
3622 | c
3623 * d
3624 |}
3625 !! html
3626 <dl><dd><table>
3627
3628 <tr>
3629 <td> a
3630 <ul><li> b</li></ul>
3631 </td></tr>
3632 <tr>
3633 <td> c
3634 <ul><li> d</li></ul>
3635 </td></tr></table></dd></dl>
3636
3637 !! end
3638
3639 !!test
3640 Table / list interaction: lists nested in tables nested in indented lists
3641 !! wikitext
3642 :{|
3643 |
3644 :a
3645 :b
3646 |
3647 *c
3648 *d
3649 |}
3650
3651 *e
3652 *f
3653 !! html
3654 <dl><dd><table>
3655 <tr>
3656 <td>
3657 <dl><dd>a</dd>
3658 <dd>b</dd></dl>
3659 </td>
3660 <td>
3661 <ul><li>c</li>
3662 <li>d</li></ul>
3663 </td></tr></table></dd></dl>
3664 <ul><li>e</li>
3665 <li>f</li></ul>
3666
3667 !!end
3668
3669 !! test
3670 Definition Lists: Nesting: Multi-level (Parsoid only)
3671 !! options
3672 parsoid
3673 !! wikitext
3674 ;t1 :d1
3675 ;;t2 ::d2
3676 ;;;t3 :::d3
3677 !! html
3678 <dl>
3679 <dt>t1 </dt>
3680 <dd>d1</dd>
3681 <dt>
3682 <dl>
3683 <dt>t2 </dt>
3684 <dd>:d2</dd>
3685 <dt>
3686 <dl>
3687 <dt>t3 </dt>
3688 <dd>::d3</dd>
3689 </dl>
3690 </dt>
3691 </dl>
3692 </dt>
3693 </dl>
3694
3695
3696 !! end
3697
3698
3699 !! test
3700 Definition Lists: Nesting: Test 2 (Parsoid only)
3701 !! options
3702 parsoid
3703 !! wikitext
3704 ;t1
3705 ::d2
3706 !! html
3707 <dl>
3708 <dt>t1</dt>
3709 <dd>
3710 <dl>
3711 <dd>d2</dd>
3712 </dl>
3713 </dd>
3714 </dl>
3715
3716 !! end
3717
3718
3719 !! test
3720 Definition Lists: Nesting: Test 3 (Parsoid only)
3721 !! options
3722 parsoid
3723 !! wikitext
3724 :;t1
3725 ::::d2
3726 !! html
3727 <dl>
3728 <dd>
3729 <dl>
3730 <dt>t1</dt>
3731 <dd>
3732 <dl>
3733 <dd>
3734 <dl>
3735 <dd>d2</dd>
3736 </dl>
3737 </dd>
3738 </dl>
3739 </dd>
3740 </dl>
3741 </dd>
3742 </dl>
3743
3744 !! end
3745
3746
3747 !! test
3748 Definition Lists: Nesting: Test 4
3749 !! wikitext
3750 ::;t3
3751 :::d3
3752 !! html
3753 <dl><dd><dl><dd><dl><dt>t3</dt>
3754 <dd>d3</dd></dl></dd></dl></dd></dl>
3755
3756 !! end
3757
3758
3759 ## The Parsoid team believes the following three test exposes a
3760 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
3761 ## wrong to close the <dl> after the <dt> containing the <ul>.)
3762 ## It also exposes a "misfeature" in tidy, which doesn't like
3763 ## <dl> tags with a single <dt> child; it converts the <dt> into
3764 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
3765 !! test
3766 Definition Lists: Mixed Lists: Test 1
3767 !! wikitext
3768 :;* foo
3769 ::* bar
3770 :; baz
3771 !! html/php
3772 <dl><dd><dl><dt><ul><li> foo</li>
3773 <li> bar</li></ul></dt></dl>
3774 <dl><dt> baz</dt></dl></dd></dl>
3775
3776 !! html/php+tidy
3777 <dl>
3778 <dd>
3779 <dl>
3780 <dd>
3781 <ul>
3782 <li>foo</li>
3783 <li>bar</li>
3784 </ul>
3785 </dd>
3786 </dl>
3787 <dl>
3788 <dt>baz</dt>
3789 </dl>
3790 </dd>
3791 </dl>
3792 !! html/parsoid
3793 <dl>
3794 <dd><dl>
3795 <dt><ul>
3796 <li> foo
3797 </li>
3798 </ul></dt>
3799 <dd><ul>
3800 <li> bar
3801 </li>
3802 </ul></dd>
3803 <dt> baz</dt>
3804 </dl></dd>
3805 </dl>
3806 !! end
3807
3808 !! test
3809 Definition Lists: Mixed Lists: Test 2
3810 !! wikitext
3811 *: d1
3812 *: d2
3813 !! html
3814 <ul><li><dl><dd> d1</dd>
3815 <dd> d2</dd></dl></li></ul>
3816
3817 !! end
3818
3819
3820 !! test
3821 Definition Lists: Mixed Lists: Test 3
3822 !! wikitext
3823 *::: d1
3824 *::: d2
3825 !! html
3826 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
3827 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
3828
3829 !! end
3830
3831
3832 !! test
3833 Definition Lists: Mixed Lists: Test 4
3834 !! wikitext
3835 *;d1 :d2
3836 *;d3 :d4
3837 !! html
3838 <ul><li><dl><dt>d1&#160;</dt>
3839 <dd>d2</dd>
3840 <dt>d3&#160;</dt>
3841 <dd>d4</dd></dl></li></ul>
3842
3843 !! end
3844
3845
3846 !! test
3847 Definition Lists: Mixed Lists: Test 5
3848 !! wikitext
3849 *:d1
3850 *:: d2
3851 !! html
3852 <ul><li><dl><dd>d1
3853 <dl><dd> d2</dd></dl></dd></dl></li></ul>
3854
3855 !! end
3856
3857
3858 !! test
3859 Definition Lists: Mixed Lists: Test 6
3860 !! wikitext
3861 #*:d1
3862 #*::: d3
3863 !! html
3864 <ol><li><ul><li><dl><dd>d1
3865 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
3866
3867 !! end
3868
3869
3870 !! test
3871 Definition Lists: Mixed Lists: Test 7
3872 !! wikitext
3873 :* d1
3874 :* d2
3875 !! html
3876 <dl><dd><ul><li> d1</li>
3877 <li> d2</li></ul></dd></dl>
3878
3879 !! end
3880
3881
3882 !! test
3883 Definition Lists: Mixed Lists: Test 8
3884 !! wikitext
3885 :* d1
3886 ::* d2
3887 !! html
3888 <dl><dd><ul><li> d1</li></ul>
3889 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
3890
3891 !! end
3892
3893
3894 !! test
3895 Definition Lists: Mixed Lists: Test 9
3896 !! wikitext
3897 *;foo :bar
3898 !! html
3899 <ul><li><dl><dt>foo&#160;</dt>
3900 <dd>bar</dd></dl></li></ul>
3901
3902 !! end
3903
3904
3905 !! test
3906 Definition Lists: Mixed Lists: Test 10
3907 !! wikitext
3908 *#;foo :bar
3909 !! html
3910 <ul><li><ol><li><dl><dt>foo&#160;</dt>
3911 <dd>bar</dd></dl></li></ol></li></ul>
3912
3913 !! end
3914
3915 # The Parsoid team disagrees with the PHP parser's seemingly-random
3916 # rules regarding dd/dt on the next two tests. Parsoid is more
3917 # consistent, and recognizes the shared nesting and keeps the
3918 # still-open tags around until the nesting is complete.
3919 # (And tidy again converts <dt> to <dd> before 'bar'.)
3920
3921 !! test
3922 Definition Lists: Mixed Lists: Test 11
3923 !! wikitext
3924 *#*#;*;;foo :bar
3925 *#*#;boo :baz
3926 !! html/php
3927 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
3928 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
3929 <dl><dt>boo&#160;</dt>
3930 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
3931
3932 !! html/php+tidy
3933 <ul>
3934 <li>
3935 <ol>
3936 <li>
3937 <ul>
3938 <li>
3939 <ol>
3940 <li>
3941 <dl>
3942 <dt>foo&#160;</dt>
3943 <dd>
3944 <ul>
3945 <li>
3946 <dl>
3947 <dd>
3948 <dl>
3949 <dt>bar</dt>
3950 </dl>
3951 </dd>
3952 </dl>
3953 </li>
3954 </ul>
3955 </dd>
3956 </dl>
3957 <dl>
3958 <dt>boo&#160;</dt>
3959 <dd>baz</dd>
3960 </dl>
3961 </li>
3962 </ol>
3963 </li>
3964 </ul>
3965 </li>
3966 </ol>
3967 </li>
3968 </ul>
3969 !! html/parsoid
3970 <ul>
3971 <li>
3972 <ol>
3973 <li>
3974 <ul>
3975 <li>
3976 <ol>
3977 <li>
3978 <dl>
3979 <dt>
3980 <ul>
3981 <li>
3982 <dl>
3983 <dt>
3984 <dl>
3985 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3986 <dd data-parsoid='{"stx":"row"}'>bar</dd>
3987 </dl></dt>
3988 </dl></li>
3989 </ul></dt>
3990 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3991 <dd data-parsoid='{"stx":"row"}'>baz</dd>
3992 </dl></li>
3993 </ol></li>
3994 </ul></li>
3995 </ol></li>
3996 </ul>
3997 !! end
3998
3999
4000 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
4001 !! test
4002 Definition Lists: Weird Ones: Test 1
4003 !! wikitext
4004 *#;*::;; foo : bar (who uses this?)
4005 !! html/php
4006 <ul><li><ol><li><dl><dt> foo&#160;</dt>
4007 <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>
4008
4009 !! html/php+tidy
4010 <ul>
4011 <li>
4012 <ol>
4013 <li>
4014 <dl>
4015 <dt>foo&#160;</dt>
4016 <dd>
4017 <ul>
4018 <li>
4019 <dl>
4020 <dd>
4021 <dl>
4022 <dd>
4023 <dl>
4024 <dd>
4025 <dl>
4026 <dt>bar (who uses this?)</dt>
4027 </dl>
4028 </dd>
4029 </dl>
4030 </dd>
4031 </dl>
4032 </dd>
4033 </dl>
4034 </li>
4035 </ul>
4036 </dd>
4037 </dl>
4038 </li>
4039 </ol>
4040 </li>
4041 </ul>
4042 !! html/parsoid
4043 <ul>
4044 <li>
4045 <ol>
4046 <li>
4047 <dl>
4048 <dt>
4049 <ul>
4050 <li>
4051 <dl>
4052 <dd>
4053 <dl>
4054 <dd>
4055 <dl>
4056 <dt>
4057 <dl>
4058 <dt> foo<span typeof="mw:Placeholder">&nbsp;</span></dt>
4059 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
4060 </dl></dt>
4061 </dl></dd>
4062 </dl></dd>
4063 </dl></li>
4064 </ul></dt>
4065 </dl></li>
4066 </ol></li>
4067 </ul>
4068 !! end
4069
4070 !! test
4071 Definition Lists: colons occurring in tags
4072 !! wikitext
4073 ;a:b
4074 ;'''a:b'''
4075 ;<i>a:b</i>
4076 ;<span>a:b</span>
4077 ;<div>a:b</div>
4078 ;<div>a
4079 :b</div>
4080 ;{{echo|a:b}}
4081 ;{{echo|''a:b''}}
4082 !! html+tidy
4083 <dl>
4084 <dt>a</dt>
4085 <dd>b</dd>
4086 <dt><b>a:b</b></dt>
4087 <dt><i>a:b</i></dt>
4088 <dt><span>a:b</span></dt>
4089 <dd>
4090 <div>a:b</div>
4091 </dd>
4092 <dd>
4093 <div>a
4094 <dl>
4095 <dd>b</dd>
4096 </dl>
4097 </div>
4098 </dd>
4099 <dt>a</dt>
4100 <dd>b</dd>
4101 <dt><i>a:b</i></dt>
4102 </dl>
4103 !! end
4104
4105 !! test
4106 Definition Lists: colons and tables 1
4107 !! wikitext
4108 :{|
4109 | x
4110 |}
4111 :{|
4112 | y
4113 |}
4114 !! html
4115 <dl><dd><table>
4116 <tr>
4117 <td> x
4118 </td></tr></table></dd></dl>
4119 <dl><dd><table>
4120 <tr>
4121 <td> y
4122 </td></tr></table></dd></dl>
4123
4124 !! end
4125
4126 # Parsoid's output (as documented below) differs from php's in this case.
4127 # This is probably a bug. If we fixup parsoid to match php's output, the
4128 # above test should pass and the below test case can be removed. It is
4129 # unclear which output is more desirable.
4130
4131 !! test
4132 Definition Lists: colons and tables 2
4133 !! wikitext
4134 :{|
4135 | x
4136 |}
4137 :{|
4138 | y
4139 |}
4140 !! html/parsoid
4141 <dl><dd><table>
4142 <tr>
4143 <td> x
4144 </td></tr></table></dd>
4145 <dd><table>
4146 <tr>
4147 <td> y
4148 </td></tr></table></dd></dl>
4149 !! end
4150
4151 !! test
4152 Definition Lists: template interaction
4153 !! wikitext
4154 ::{{definition_list}}
4155
4156 :one
4157 ::{{definition_list}}
4158 :::two
4159 :::three
4160 ::four
4161 !! html/parsoid
4162 <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">
4163 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4164
4165 <dl><dd data-parsoid='{}'>one
4166 <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">
4167 </span><dd about="#mwt2">two
4168 <dl><dd>two</dd>
4169 <dd>three</dd></dl></dd>
4170 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4171 !! end
4172
4173
4174 ###
4175 ### External links
4176 ###
4177 !! test
4178 External links: non-bracketed
4179 !! wikitext
4180 Non-bracketed: http://example.com
4181 !! html
4182 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4183 </p>
4184 !! end
4185
4186 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4187 !! test
4188 External links: numbered
4189 !! wikitext
4190 Numbered: [http://example.com]
4191 Numbered: [http://example.net]
4192 Numbered: [http://example.com]
4193 !! html/php
4194 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4195 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4196 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4197 </p>
4198 !! html/parsoid
4199 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
4200 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
4201 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
4202 !!end
4203
4204 !! test
4205 External links: specified text
4206 !! wikitext
4207 Specified text: [http://example.com link]
4208 !! html
4209 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4210 </p>
4211 !!end
4212
4213 !! test
4214 External links: trail
4215 !! wikitext
4216 Linktrails should not work for external links: [http://example.com link]s
4217 !! html
4218 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4219 </p>
4220 !! end
4221
4222 !! test
4223 External links: dollar sign in URL
4224 !! wikitext
4225 http://example.com/1$2345
4226 !! html
4227 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4228 </p>
4229 !! end
4230
4231 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4232 !! test
4233 External links: dollar sign in URL (autonumber)
4234 !! wikitext
4235 [http://example.com/1$2345]
4236 !! html/php
4237 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4238 </p>
4239 !! html/parsoid
4240 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4241 !!end
4242
4243 !! test
4244 External links: open square bracket forbidden in URL (bug 4377)
4245 !! options
4246 parsoid=wt2html,wt2wt,html2html
4247 !! wikitext
4248 http://example.com/1[2345
4249 !! html/php
4250 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4251 </p>
4252 !! html/parsoid
4253 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4254 !! end
4255
4256 !! test
4257 External links: open square bracket forbidden in URL (named) (bug 4377)
4258 !! options
4259 parsoid=wt2html,html2html
4260 !! wikitext
4261 [http://example.com/1[2345]
4262 !! html/php
4263 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4264 </p>
4265 !! html/parsoid
4266 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4267 !!end
4268
4269 # parsoid adds a space before the link name
4270 !! test
4271 External links: open square bracket forbidden in URL (named) (bug 4377)
4272 Parsoid variant.
4273 !! wikitext
4274 [http://example.com/1 [2345]
4275 !! html
4276 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4277 </p>
4278 !!end
4279
4280 !! test
4281 External links: nowiki in URL link text (bug 6230)
4282 !! wikitext
4283 [http://example.com/ <nowiki>''example site''</nowiki>]
4284 !! html
4285 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4286 </p>
4287 !! end
4288
4289 !! test
4290 External links: newline forbidden in text (bug 6230 regression check)
4291 !! wikitext
4292 [http://example.com/ first
4293 second]
4294 !! html
4295 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4296 second]
4297 </p>
4298 !!end
4299
4300 !! test
4301 External links: Pipe char between url and text
4302 !! wikitext
4303 [http://example.com | link]
4304 !! html
4305 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4306 </p>
4307 !!end
4308
4309 !! test
4310 External links: protocol-relative URL in brackets
4311 !! wikitext
4312 [//example.com/ Test]
4313 !! html
4314 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4315 </p>
4316 !! end
4317
4318 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4319 !! test
4320 External links: protocol-relative URL in brackets without text
4321 !! wikitext
4322 [//example.com]
4323 !! html/php
4324 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4325 </p>
4326 !! html/parsoid
4327 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4328 !! end
4329
4330 !! test
4331 External links: protocol-relative URL in free text is left alone
4332 !! wikitext
4333 //example.com/Foo
4334 !! html
4335 <p>//example.com/Foo
4336 </p>
4337 !!end
4338
4339 !! test
4340 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
4341 !! wikitext
4342 foo//example.com/Foo
4343 !! html
4344 <p>foo//example.com/Foo
4345 </p>
4346 !! end
4347
4348 !! test
4349 External links: with no contents
4350 !! wikitext
4351 [http://en.wikipedia.org/wiki/Foo]
4352
4353 [[wikipedia:Foo|Bar]]
4354
4355 [[wikipedia:Foo|<span>Bar</span>]]
4356 !! html/php
4357 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4358 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4359 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4360 </p>
4361 !! html/parsoid
4362 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4363 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4364 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4365 !! end
4366
4367 !! test
4368 External links: Free with trailing punctuation
4369 !! wikitext
4370 http://example.com,
4371 http://example.com;
4372 http://example.com\
4373 http://example.com.
4374 http://example.com:
4375 http://example.com!
4376 http://example.com?
4377 http://example.com)
4378 http://example.com/url_with_(brackets)
4379 (http://example.com/url_without_brackets)
4380 http://example.com/url_with_entity&nbsp;
4381 http://example.com/url_with_entity&#xA0;
4382 http://example.com/url_with_entity&#160;
4383 http://example.com/url_with_entity&lt;
4384 http://example.com/url_with_entity&#x3C;
4385 http://example.com/url_with_entity&#60;
4386 !! html/php
4387 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4388 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4389 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4390 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4391 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4392 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4393 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4394 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4395 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4396 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4397 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4398 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4399 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4400 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4401 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity%3C">http://example.com/url_with_entity%3C</a>
4402 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity%3C">http://example.com/url_with_entity%3C</a>
4403 </p>
4404 !! html/parsoid
4405 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>,
4406 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>;
4407 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>\
4408 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>.
4409 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:
4410 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>!
4411 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>?
4412 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)
4413 <a rel="mw:ExtLink" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4414 (<a rel="mw:ExtLink" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4415 <a rel="mw:ExtLink" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4416 <a rel="mw:ExtLink" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4417 <a rel="mw:ExtLink" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4418 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity">&lt;</span>
4419 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&lt;">http://example.com/url_with_entity&lt;</a>
4420 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&lt;">http://example.com/url_with_entity&lt;</a></p>
4421 !! end
4422
4423 !! test
4424 External links: No preceding word characters allowed (bug 65278)
4425 !! wikitext
4426 NOPEhttp://example.com
4427 N0http://example.com
4428 ok:http://example.com
4429 ok-http://example.com
4430 !! html
4431 <p>NOPEhttp://example.com
4432 N0http://example.com
4433 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4434 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4435 </p>
4436 !! end
4437
4438 !! test
4439 External image
4440 !! wikitext
4441 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4442 !! html
4443 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4444 </p>
4445 !! end
4446
4447 !! test
4448 External image from https
4449 !! wikitext
4450 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4451 !! html
4452 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4453 </p>
4454 !! end
4455
4456 !! test
4457 External image (when not allowed)
4458 !! options
4459 wgAllowExternalImages=0
4460 !! wikitext
4461 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4462 !! html
4463 <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>
4464 </p>
4465 !! end
4466
4467 !! test
4468 Link to non-http image, no img tag
4469 !! wikitext
4470 Link to non-http image, no img tag: ftp://example.com/test.jpg
4471 !! html
4472 <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>
4473 </p>
4474 !! end
4475
4476 !! test
4477 External links: terminating separator
4478 !! wikitext
4479 Terminating separator: http://example.com/thing,
4480 !! html
4481 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4482 </p>
4483 !! end
4484
4485 !! test
4486 External links: intervening separator
4487 !! wikitext
4488 Intervening separator: http://example.com/1,2,3
4489 !! html
4490 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4491 </p>
4492 !! end
4493
4494 !! test
4495 External links: old bug with URL in query
4496 !! wikitext
4497 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4498 !! html
4499 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4500 </p>
4501 !! end
4502
4503 !! test
4504 External links: old URL-in-URL bug, mixed protocols
4505 !! wikitext
4506 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4507 !! html
4508 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4509 </p>
4510 !!end
4511
4512 !! test
4513 External links: URL in text
4514 !! wikitext
4515 URL in text: [http://example.com http://example.com]
4516 !! html
4517 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4518 </p>
4519 !! end
4520
4521 !! test
4522 External links: Clickable images
4523 !! wikitext
4524 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4525 !! html/php
4526 <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>
4527 </p>
4528 !! html/parsoid
4529 <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>
4530 !! end
4531
4532 !! test
4533 External links: raw ampersand
4534 !! wikitext
4535 Old &amp; use: http://x&y
4536 !! html
4537 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4538 </p>
4539 !! end
4540
4541 !! test
4542 External links: encoded ampersand
4543 !! wikitext
4544 Old &amp; use: http://x&amp;y
4545 !! html/php
4546 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4547 </p>
4548 !! html/parsoid
4549 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4550 !! end
4551
4552 !! test
4553 External links: encoded equals (bug 6102)
4554 !! wikitext
4555 http://example.com/?foo&#61;bar
4556 !! html/php
4557 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4558 </p>
4559 !! html/parsoid
4560 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4561 !! end
4562
4563 ##
4564 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4565 ## does it number them. As discussed in bug 53505, we can identify
4566 ## autonumbered links via CSS.
4567 ##
4568
4569 !! test
4570 External links: [raw ampersand]
4571 !! wikitext
4572 Old &amp; use: [http://x&y]
4573 !! html/php
4574 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4575 </p>
4576 !! html/parsoid
4577 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4578 !! end
4579
4580 # note that parsoid html is identical to [raw ampersand] case; so html2wt
4581 # mode will return the [raw ampersand] wikitext
4582 !! test
4583 External links: [encoded ampersand]
4584 !! options
4585 parsoid=wt2html,wt2wt,html2html
4586 !! wikitext
4587 Old &amp; use: [http://x&amp;y]
4588 !! html/php
4589 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4590 </p>
4591 !! html/parsoid
4592 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4593 !! end
4594
4595 !! test
4596 External links: [raw equals]
4597 !! wikitext
4598 [http://example.com/?foo=bar]
4599 !! html/php
4600 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4601 </p>
4602 !! html/parsoid
4603 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4604 !! end
4605
4606 # note that parsoid html is identical to [raw equals] case; so html2wt
4607 # mode will return the [raw equals] wikitext
4608 !! test
4609 External links: [encoded equals] (bug 6102)
4610 !! options
4611 parsoid=wt2html,wt2wt,html2html
4612 !! wikitext
4613 [http://example.com/?foo&#61;bar]
4614 !! html/php
4615 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4616 </p>
4617 !! html/parsoid
4618 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4619 !! end
4620
4621 # xxx parsoid strips the IDN character, so the round-trip tests will
4622 # obviously fail and are disabled. --cscott
4623 !! test
4624 External links: [IDN ignored character reference in hostname; strip it right off]
4625 !! options
4626 parsoid=wt2html,wt2wt,html2html
4627 !! wikitext
4628 [http://e&zwnj;xample.com/]
4629 !! html/php
4630 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
4631 </p>
4632 !! html/parsoid
4633 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
4634 !! end
4635
4636 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
4637 # Where an external link could easily circumvent the sanitization of the text of
4638 # a link like this (where an IDN-ignore character is in the URL somewhere), this
4639 # test demands a higher standard. That's a bit strange.
4640 #
4641 # Example:
4642 #
4643 # http://e‌xample.com -> [http://example.com|http://example.com]
4644 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
4645 #
4646 # The first example is sanitized, but the second is not. Any security benefits
4647 # from this production are trivial to circumvent. Either remove this test and
4648 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
4649 # the test accordingly.
4650 #
4651 # All our love,
4652 # The Parsoid team.
4653 # xxx parsoid strips the IDN character, so the round-trip tests will
4654 # obviously fail and are disabled. --cscott
4655 !! test
4656 External links: IDN ignored character reference in hostname; strip it right off
4657 !! options
4658 parsoid=wt2html,html2html
4659 !! wikitext
4660 http://e&zwnj;xample.com/
4661 !! html/php
4662 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
4663 </p>
4664 !! html/parsoid
4665 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
4666 !! end
4667
4668 !! test
4669 External links: www.jpeg.org (bug 554)
4670 !! wikitext
4671 http://www.jpeg.org
4672 !! html
4673 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
4674 </p>
4675 !! end
4676
4677 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4678 !! test
4679 External links: URL within URL (original bug 2)
4680 !! wikitext
4681 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
4682 !! html/php
4683 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
4684 </p>
4685 !! html/parsoid
4686 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
4687 !! end
4688
4689 !! test
4690 BUG 361: URL inside bracketed URL
4691 !! wikitext
4692 [http://www.example.com/foo http://www.example.com/bar]
4693 !! html
4694 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
4695 </p>
4696 !! end
4697
4698 !! test
4699 BUG 361: URL within URL, not bracketed
4700 !! wikitext
4701 http://www.example.com/foo?=http://www.example.com/bar
4702 !! html
4703 <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>
4704 </p>
4705 !! end
4706
4707 !! test
4708 BUG 289: ">"-token in URL-tail
4709 !! wikitext
4710 http://www.example.com/<hello>
4711 !! html
4712 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
4713 </p>
4714 !!end
4715
4716 !! test
4717 BUG 289: literal ">"-token in URL-tail
4718 !! wikitext
4719 http://www.example.com/<b>html</b>
4720 !! html/php
4721 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
4722 </p>
4723 !! html/parsoid
4724 <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>
4725 !! end
4726
4727 !! test
4728 BUG 289: ">"-token in bracketed URL
4729 !! wikitext
4730 [http://www.example.com/<hello> stuff]
4731 !! html
4732 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
4733 </p>
4734 !!end
4735
4736 !! test
4737 BUG 289: literal ">"-token in bracketed URL
4738 !! wikitext
4739 [http://www.example.com/<b>html</b> stuff]
4740 !! html
4741 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
4742 </p>
4743 !!end
4744
4745 !! test
4746 BUG 289: literal double quote at end of URL
4747 !! wikitext
4748 http://www.example.com/"hello"
4749 !! html
4750 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
4751 </p>
4752 !!end
4753
4754 !! test
4755 BUG 289: literal double quote in bracketed URL
4756 !! wikitext
4757 [http://www.example.com/"hello" stuff]
4758 !! html
4759 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
4760 </p>
4761 !!end
4762
4763 !! test
4764 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
4765 !! wikitext
4766 [http://www.example.com test]
4767 !! html
4768 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
4769 </p>
4770 !! end
4771
4772 !! test
4773 External links: link text with spaces
4774 !! wikitext
4775 [http://www.example.com a b c]
4776 [http://www.example.com ''a'' ''b'']
4777 !! html
4778 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
4779 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
4780 </p>
4781 !! end
4782
4783 !! test
4784 External links: wiki links within external link (Bug 3695)
4785 !! wikitext
4786 [http://example.com [[wikilink]] embedded in ext link]
4787 !! html/php
4788 <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>
4789 </p>
4790 !! html/parsoid
4791 <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>
4792 !! end
4793
4794 !! test
4795 BUG 787: Links with one slash after the url protocol are invalid
4796 !! wikitext
4797 http:/example.com
4798
4799 [http:/example.com title]
4800 !! html
4801 <p>http:/example.com
4802 </p><p>[http:/example.com title]
4803 </p>
4804 !! end
4805
4806 !! test
4807 Bracketed external links with template-generated invalid target
4808 !! wikitext
4809 [{{echo|http:/example.com}} title]
4810 !! html
4811 <p>[http:/example.com title]
4812 </p>
4813 !! end
4814
4815 !! test
4816 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
4817 !! wikitext
4818 ''[http://example.com text'']
4819 [http://example.com '''text]'''
4820 ''Something [http://example.com in italic'']
4821 ''Something [http://example.com mixed''''', even bold]'''
4822 '''''Now [http://example.com both''''']
4823 !! html
4824 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
4825 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
4826 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
4827 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
4828 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
4829 </p>
4830 !! end
4831
4832
4833 !! test
4834 Bug 4781: %26 in URL
4835 !! wikitext
4836 http://www.example.com/?title=AT%26T
4837 !! html/php
4838 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
4839 </p>
4840 !! html/parsoid
4841 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
4842 !! end
4843
4844 # According to http://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
4845 # % is actually legal in HTML5. Any change in output would need testing though.
4846 !! test
4847 Bug 4781, 5267: %25 in URL
4848 !! wikitext
4849 http://www.example.com/?title=100%25_Bran
4850 !! html/php
4851 <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>
4852 </p>
4853 !! html/parsoid
4854 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
4855 !! end
4856
4857 !! test
4858 Bug 4781, 5267: %28, %29 in URL
4859 !! wikitext
4860 http://www.example.com/?title=Ben-Hur_%281959_film%29
4861 !! html/php
4862 <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>
4863 </p>
4864 !! html/parsoid
4865 <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>
4866 !! end
4867
4868
4869 !! test
4870 Bug 4781: %26 in autonumber URL
4871 !! wikitext
4872 [http://www.example.com/?title=AT%26T]
4873 !! html/php
4874 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
4875 </p>
4876 !! html/parsoid
4877 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
4878 !! end
4879
4880 !! test
4881 Bug 4781, 5267: %26 in autonumber URL
4882 !! wikitext
4883 [http://www.example.com/?title=100%25_Bran]
4884 !! html/php
4885 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
4886 </p>
4887 !! html/parsoid
4888 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
4889 !! end
4890
4891 !! test
4892 Bug 4781, 5267: %28, %29 in autonumber URL
4893 !! wikitext
4894 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
4895 !! html/php
4896 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
4897 </p>
4898 !! html/parsoid
4899 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
4900 !! end
4901
4902
4903 !! test
4904 Bug 4781: %26 in bracketed URL
4905 !! wikitext
4906 [http://www.example.com/?title=AT%26T link]
4907 !! html/php
4908 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
4909 </p>
4910 !! html/parsoid
4911 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
4912 !! end
4913
4914 !! test
4915 Bug 4781, 5267: %25 in bracketed URL
4916 !! wikitext
4917 [http://www.example.com/?title=100%25_Bran link]
4918 !! html
4919 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
4920 </p>
4921 !! end
4922
4923 !! test
4924 Bug 4781, 5267: %28, %29 in bracketed URL
4925 !! wikitext
4926 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
4927 !! html/php
4928 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
4929 </p>
4930 !! html/parsoid
4931 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
4932 !! end
4933
4934 !! test
4935 External link containing a period in the anchor. (bug 63947)
4936 !! wikitext
4937 [//foo.org/bar#baz. bang]
4938
4939 [//foo.org/bar. bang]
4940 !! html/php
4941 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
4942 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
4943 </p>
4944 !! html/parsoid
4945 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
4946 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
4947 !! end
4948
4949 !! test
4950 External link containing a single quote. (bug 63947)
4951 !! wikitext
4952 [//foo.org/bar'baz]
4953
4954 [//foo.org/bar'baz bang]
4955 !! html/php
4956 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
4957 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
4958 </p>
4959 !! html/parsoid
4960 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
4961 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
4962 !! end
4963
4964
4965 !! test
4966 External link containing a period in the anchor. (bug 63947)
4967 !! wikitext
4968 [//foo.org/bar#baz. bang]
4969
4970 [//foo.org/bar. bang]
4971 !! html/php
4972 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
4973 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
4974 </p>
4975 !! html/parsoid
4976 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
4977 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
4978 !! end
4979
4980 !! test
4981 External link containing a single quote. (bug 63947)
4982 !! wikitext
4983 [//foo.org/bar'baz]
4984
4985 [//foo.org/bar'baz bang]
4986 !! html/php
4987 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
4988 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
4989 </p>
4990 !! html/parsoid
4991 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
4992 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
4993 !! end
4994
4995
4996 !! test
4997 External link containing double-single-quotes in text '' (bug 4598 sanity check)
4998 !! wikitext
4999 Some [http://example.com/ pretty ''italics'' and stuff]!
5000 !! html
5001 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5002 </p>
5003 !! end
5004
5005 !! test
5006 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
5007 !! wikitext
5008 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5009 !! html
5010 <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>
5011 </p>
5012 !! end
5013
5014 !! test
5015 External link containing double-single-quotes with no space separating the url from text in italics
5016 !! wikitext
5017 [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]].]
5018 !! html/php
5019 <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>
5020 </p>
5021 !! html/php+tidy
5022 <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>
5023 !! html/parsoid
5024 <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>
5025 !! end
5026
5027 !! test
5028 External link with comments in link text
5029 !! wikitext
5030 [http://www.google.com Google <!-- comment -->]
5031 !! html
5032 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5033 </p>
5034 !! end
5035
5036 !! test
5037 URL-encoding in URL functions (single parameter)
5038 !! wikitext
5039 {{localurl:Some page|amp=&}}
5040 !! html
5041 <p>/index.php?title=Some_page&amp;amp=&amp;
5042 </p>
5043 !! end
5044
5045 !! test
5046 URL-encoding in URL functions (multiple parameters)
5047 !! wikitext
5048 {{localurl:Some page|q=?&amp=&}}
5049 !! html
5050 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5051 </p>
5052 !! end
5053
5054 !! test
5055 Brackets in urls
5056 !! wikitext
5057 http://example.com/index.php?foozoid%5B%5D=bar
5058
5059 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5060 !! html/php
5061 <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>
5062 </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>
5063 </p>
5064 !! html/parsoid
5065 <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>
5066
5067 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
5068 !! end
5069
5070 !! test
5071 IPv6 urls (bug 21261)
5072 !! options
5073 disabled
5074 !! wikitext
5075 http://[2404:130:0:1000::187:2]/index.php
5076 !! html
5077 <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>
5078 </p>
5079 !! end
5080
5081 !! test
5082 Non-extlinks in brackets
5083 !! wikitext
5084 [foo]
5085 [foo bar]
5086 [foo ''bar'']
5087 [fool's] errand
5088 [fool's errand]
5089 [{{echo|foo}}]
5090 [{{echo|foo}} bar]
5091 [{{echo|foo}} ''bar'']
5092 [{{echo|foo}}l's] errand
5093 [{{echo|foo}}l's errand]
5094 [url={{echo|foo}}]
5095 [url=http://example.com]
5096 !! html
5097 <p>[foo]
5098 [foo bar]
5099 [foo <i>bar</i>]
5100 [fool's] errand
5101 [fool's errand]
5102 [foo]
5103 [foo bar]
5104 [foo <i>bar</i>]
5105 [fool's] errand
5106 [fool's errand]
5107 [url=foo]
5108 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5109 </p>
5110 !! end
5111
5112 !! test
5113 Percent encoding in external links
5114 !! wikitext
5115 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
5116 !! html/php
5117 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
5118 </p>
5119 !! html/parsoid
5120 <p><a rel="mw:ExtLink"
5121 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
5122 !! end
5123
5124 !! test
5125 Use url link syntax for links where the content is equal the link target
5126 !! wikitext
5127 http://example.com
5128 !! html/php
5129 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5130 </p>
5131 !! html/parsoid
5132 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5133 !! end
5134
5135 !! test
5136 Parenthesis in external links, especially URL links
5137 !! wikitext
5138 http://example.com)
5139
5140 http://example.com/test)
5141
5142 http://example.com/(test)
5143
5144 http://example.com/((test)
5145
5146 (http://example.com/(test))
5147
5148 (http://example.com/(test)))))
5149
5150 http://example.com/a)b
5151
5152 [http://example.com) foo]
5153 !! html/php
5154 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5155 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
5156 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
5157 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
5158 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
5159 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
5160 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
5161 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5162 </p>
5163 !! html/parsoid
5164 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
5165 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
5166 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
5167 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
5168 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
5169 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
5170 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
5171 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
5172 !! end
5173
5174 !! test
5175 Parenthesis in external links, w/ transclusion or comment
5176 !! wikitext
5177 (http://example.com/{{echo|hi}})
5178
5179 (http://example.com<!-- hi -->)
5180 !! html/php
5181 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5182 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5183 </p>
5184 !! html/parsoid
5185 <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>
5186
5187 <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>
5188 !! end
5189
5190 !! test
5191 Replace invalid link targets when serializing
5192 !! options
5193 parsoid=html2wt
5194 !! html
5195 <a rel="mw:WikiLink" href="./]] foo [[bar">Manual</a>
5196 !! wikitext
5197 [[MediaWiki:Badtitletext|Manual]]
5198 !! end
5199
5200 ###
5201 ### Quotes
5202 ###
5203
5204 !! test
5205 Quotes
5206 !! wikitext
5207 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5208
5209 Normal text. '''''Bold italic text.''''' Normal text.
5210 !! html
5211 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5212 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5213 </p>
5214 !! end
5215
5216
5217 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5218 # parser strips. The wikitext contains just the first half of the bold
5219 # quote pair.
5220 !! test
5221 Unclosed and unmatched quotes
5222 !! wikitext
5223 '''''Bold italic text '''with bold deactivated''' in between.'''''
5224
5225 '''''Bold italic text ''with italic deactivated'' in between.'''''
5226
5227 '''Bold text..
5228
5229 ..spanning two paragraphs (should not work).'''
5230
5231 '''Bold tag left open
5232
5233 ''Italic tag left open
5234
5235 Normal text.
5236
5237 <!-- Unmatching number of opening, closing tags: -->
5238 '''This year''''s election ''should'' beat '''last year''''s.
5239
5240 ''Tom'''s car is bigger than ''Susan'''s.
5241
5242 Plain ''italic'''s plain
5243 !! html/php
5244 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5245 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5246 </p><p><b>Bold text..</b>
5247 </p><p>..spanning two paragraphs (should not work).
5248 </p><p><b>Bold tag left open</b>
5249 </p><p><i>Italic tag left open</i>
5250 </p><p>Normal text.
5251 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5252 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5253 </p><p>Plain <i>italic'</i>s plain
5254 </p>
5255 !! html/parsoid
5256 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5257 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5258 </p><p><b>Bold text..</b>
5259 </p><p>..spanning two paragraphs (should not work).<b></b>
5260 </p><p><b>Bold tag left open</b>
5261 </p><p><i>Italic tag left open</i>
5262 </p><p>Normal text.
5263 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5264 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5265 </p><p>Plain <i>italic'</i>s plain
5266 </p>
5267 !! end
5268
5269 ###
5270 ### Tables
5271 ###
5272 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5273 ###
5274
5275 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5276 # is the bare minimum required by the spec, see:
5277 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5278 # Parsoid team replies: empty table tags are legal in HTML5
5279 !! test
5280 A table with no data.
5281 !! options
5282 parsoid=wt2html
5283 !! wikitext
5284 {||}
5285 !! html/php
5286
5287 !! html/parsoid
5288 <table></table>
5289
5290 !! end
5291
5292 !! test
5293 A table with stray table end tags on start tag line (wt2html)
5294 !! options
5295 parsoid=wt2html
5296 !! wikitext
5297 {|style="color: red;"|}
5298
5299 {|style="color: red;" |}
5300 |foo
5301 |}
5302
5303 {|style="color: red;"|} id="foo"
5304 |foo
5305 |}
5306
5307 {|style="color: red;" |} id="foo"
5308 |foo
5309 |}
5310 !! html
5311 <table style="color: red;"></table>
5312
5313 <table style="color: red;">
5314 <tbody><tr>
5315 <td>foo</td>
5316 </tr></tbody>
5317 </table>
5318
5319 <table style="color: red;" id="foo">
5320 <tbody><tr>
5321 <td>foo</td>
5322 </tr></tbody>
5323 </table>
5324
5325 <table style="color: red;" id="foo">
5326 <tbody><tr>
5327 <td>foo</td>
5328 </tr></tbody>
5329 </table>
5330
5331 !! end
5332
5333 !! test
5334 A table with no data (take 2)
5335 !! wikitext
5336 {|
5337 |}
5338 !! html/parsoid
5339 <table></table>
5340 !! end
5341
5342 # A table with nothing but a caption is invalid XHTML, we might want to render
5343 # this as <p>caption</p>
5344 # Parsoid team replies: table with only a caption is legal in HTML5
5345 !! test
5346 A table with nothing but a caption
5347 !! wikitext
5348 {|
5349 |+ caption
5350 |}
5351 !! html/php
5352 <table>
5353 <caption> caption
5354 </caption><tr><td></td></tr></table>
5355
5356 !! html/parsoid
5357 <table><caption> caption</caption></table>
5358 !! end
5359
5360 !! test
5361 A table with caption with default-spaced attributes and a table row
5362 !! wikitext
5363 {|
5364 |+ style="color: red;" | caption1
5365 |-
5366 | foo
5367 |}
5368 !! html
5369 <table>
5370 <caption style="color: red;"> caption1
5371 </caption>
5372 <tr>
5373 <td> foo
5374 </td></tr></table>
5375
5376 !! end
5377
5378 !! test
5379 A table with captions with non-default spaced attributes and a table row
5380 !! wikitext
5381 {|
5382 |+style="color: red;"|caption2
5383 |+ style="color: red;"| caption3
5384 |-
5385 | foo
5386 |}
5387 !! html
5388 <table>
5389 <caption style="color: red;">caption2
5390 </caption>
5391 <caption style="color: red;"> caption3
5392 </caption>
5393 <tr>
5394 <td> foo
5395 </td></tr></table>
5396
5397 !! end
5398
5399 !! test
5400 Table td-cell syntax variations
5401 !! wikitext
5402 {|
5403 | foo bar foo | baz
5404 | foo bar foo || baz
5405 | style='color:red;' | baz
5406 | style='color:red;' || baz
5407 |}
5408 !! html
5409 <table>
5410 <tr>
5411 <td> baz
5412 </td>
5413 <td> foo bar foo </td>
5414 <td> baz
5415 </td>
5416 <td style="color:red;"> baz
5417 </td>
5418 <td> style='color:red;' </td>
5419 <td> baz
5420 </td></tr></table>
5421
5422 !! end
5423
5424 !! test
5425 Simple table
5426 !! wikitext
5427 {|
5428 | 1 || 2
5429 |-
5430 | 3 || 4
5431 |}
5432 !! html
5433 <table>
5434 <tr>
5435 <td> 1 </td>
5436 <td> 2
5437 </td></tr>
5438 <tr>
5439 <td> 3 </td>
5440 <td> 4
5441 </td></tr></table>
5442
5443 !! end
5444
5445 !! test
5446 Simple table but with multiple dashes for row wikitext
5447 !! wikitext
5448 {|
5449 | foo
5450 |-----
5451 | bar
5452 |}
5453 !! html
5454 <table>
5455 <tr>
5456 <td> foo
5457 </td></tr>
5458 <tr>
5459 <td> bar
5460 </td></tr></table>
5461
5462 !! end
5463 !! test
5464 Multiplication table
5465 !! wikitext
5466 {| border="1" cellpadding="2"
5467 |+Multiplication table
5468 |-
5469 ! &times; !! 1 !! 2 !! 3
5470 |-
5471 ! 1
5472 | 1 || 2 || 3
5473 |-
5474 ! 2
5475 | 2 || 4 || 6
5476 |-
5477 ! 3
5478 | 3 || 6 || 9
5479 |-
5480 ! 4
5481 | 4 || 8 || 12
5482 |-
5483 ! 5
5484 | 5 || 10 || 15
5485 |}
5486 !! html
5487 <table border="1" cellpadding="2">
5488 <caption>Multiplication table
5489 </caption>
5490 <tr>
5491 <th> &#215; </th>
5492 <th> 1 </th>
5493 <th> 2 </th>
5494 <th> 3
5495 </th></tr>
5496 <tr>
5497 <th> 1
5498 </th>
5499 <td> 1 </td>
5500 <td> 2 </td>
5501 <td> 3
5502 </td></tr>
5503 <tr>
5504 <th> 2
5505 </th>
5506 <td> 2 </td>
5507 <td> 4 </td>
5508 <td> 6
5509 </td></tr>
5510 <tr>
5511 <th> 3
5512 </th>
5513 <td> 3 </td>
5514 <td> 6 </td>
5515 <td> 9
5516 </td></tr>
5517 <tr>
5518 <th> 4
5519 </th>
5520 <td> 4 </td>
5521 <td> 8 </td>
5522 <td> 12
5523 </td></tr>
5524 <tr>
5525 <th> 5
5526 </th>
5527 <td> 5 </td>
5528 <td> 10 </td>
5529 <td> 15
5530 </td></tr></table>
5531
5532 !! end
5533
5534 !! test
5535 Accept "||" in table headings
5536 !! wikitext
5537 {|
5538 !h1 || h2
5539 |}
5540 !! html
5541 <table>
5542 <tr>
5543 <th>h1 </th>
5544 <th> h2
5545 </th></tr></table>
5546
5547 !! end
5548
5549 !! test
5550 Accept "!!" in table data
5551 !! wikitext
5552 {|
5553 | Foo!! ||
5554 |}
5555 !! html
5556 <table>
5557 <tr>
5558 <td> Foo!! </td>
5559 <td>
5560 </td></tr></table>
5561
5562 !! html/parsoid
5563 <table>
5564 <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>
5565 </tbody></table>
5566 !! end
5567
5568 !! test
5569 Accept "||" in indented table headings
5570 !! wikitext
5571 :{|
5572 !h1 || h2
5573 |}
5574 !! html
5575 <dl><dd><table>
5576 <tr>
5577 <th>h1 </th>
5578 <th> h2
5579 </th></tr></table></dd></dl>
5580
5581 !! end
5582
5583 !! test
5584 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
5585 !! wikitext
5586 {|
5587 !| h1
5588 || a
5589 |}
5590 !! html
5591 <table>
5592 <tr>
5593 <th> h1
5594 </th>
5595 <td> a
5596 </td></tr></table>
5597
5598 !! end
5599
5600 !!test
5601 Accept "| !" at start of line in tables (ignore !-attribute)
5602 !! wikitext
5603 {|
5604 |-
5605 | !style="color:red" | bar
5606 |}
5607 !! html
5608 <table>
5609
5610 <tr>
5611 <td> bar
5612 </td></tr></table>
5613
5614 !!end
5615
5616 !!test
5617 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 +/-
5618 !! wikitext
5619 {|
5620 |-
5621 |style='color:red;'|+1
5622 |style='color:blue;'|-1
5623 |-
5624 | 1 || 2 || 3
5625 | 1 ||+2 ||-3
5626 |-
5627 | +1
5628 | -1
5629 |}
5630 !! html
5631 <table>
5632
5633 <tr>
5634 <td style="color:red;">+1
5635 </td>
5636 <td style="color:blue;">-1
5637 </td></tr>
5638 <tr>
5639 <td> 1 </td>
5640 <td> 2 </td>
5641 <td> 3
5642 </td>
5643 <td> 1 </td>
5644 <td>+2 </td>
5645 <td>-3
5646 </td></tr>
5647 <tr>
5648 <td> +1
5649 </td>
5650 <td> -1
5651 </td></tr></table>
5652
5653 !!end
5654
5655 !! test
5656 Table rowspan
5657 !! wikitext
5658 {| border=1
5659 | Cell 1, row 1
5660 |rowspan=2| Cell 2, row 1 (and 2)
5661 | Cell 3, row 1
5662 |-
5663 | Cell 1, row 2
5664 | Cell 3, row 2
5665 |}
5666 !! html
5667 <table border="1">
5668 <tr>
5669 <td> Cell 1, row 1
5670 </td>
5671 <td rowspan="2"> Cell 2, row 1 (and 2)
5672 </td>
5673 <td> Cell 3, row 1
5674 </td></tr>
5675 <tr>
5676 <td> Cell 1, row 2
5677 </td>
5678 <td> Cell 3, row 2
5679 </td></tr></table>
5680
5681 !! end
5682
5683 !! test
5684 Nested table
5685 !! wikitext
5686 {| border=1
5687 | &alpha;
5688 |
5689 {| bgcolor=#ABCDEF border=2
5690 |nested
5691 |-
5692 |table
5693 |}
5694 |the original table again
5695 |}
5696 !! html
5697 <table border="1">
5698 <tr>
5699 <td> &#945;
5700 </td>
5701 <td>
5702 <table bgcolor="#ABCDEF" border="2">
5703 <tr>
5704 <td>nested
5705 </td></tr>
5706 <tr>
5707 <td>table
5708 </td></tr></table>
5709 </td>
5710 <td>the original table again
5711 </td></tr></table>
5712
5713 !! end
5714
5715 !! test
5716 Invalid attributes in table cell (bug 1830)
5717 !! wikitext
5718 {|
5719 |Cell:|broken
5720 |}
5721 !! html
5722 <table>
5723 <tr>
5724 <td>broken
5725 </td></tr></table>
5726
5727 !! end
5728
5729 # The "|}" to close the table is missing from the input, so parsoid's
5730 # *2wt modes will fail.
5731 !! test
5732 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
5733 !! options
5734 parsoid=wt2html,html2html
5735 !! wikitext
5736 {|
5737 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
5738 !! html/php
5739 <table>
5740 <tr>
5741 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
5742 <td>]" onmouseover="alert(document.cookie)"&gt;test
5743 </td>
5744 </tr>
5745 </table>
5746
5747 !! html/parsoid
5748 <table><tbody>
5749 <tr>
5750 <td><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
5751 !! end
5752
5753 # FIXME: The php output is broken.
5754 !! test
5755 ! and || in td attributes should not be parsed as <th>/<td>
5756 !! wikitext
5757 {|
5758 | style="color: red !important;" data-contrived="put this here ||" | foo
5759 |}
5760 !! html/php
5761 <table>
5762 <tr>
5763 <td> style="color: red !important;" data-contrived="put this here </td>
5764 <td> foo
5765 </td></tr></table>
5766
5767 !! html/parsoid
5768 <table>
5769 <tbody><tr><td style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"autoInsertedEnd":true}'> foo</td></tr>
5770 </tbody></table>
5771 !! end
5772
5773 !! test
5774 Indented table markup mixed with indented pre content (proposed in bug 6200)
5775 !! wikitext
5776 <table>
5777 <tr>
5778 <td>
5779 Text that should be rendered preformatted
5780 </td>
5781 </tr>
5782 </table>
5783 !! html
5784 <table>
5785 <tr>
5786 <td>
5787 <pre>Text that should be rendered preformatted
5788 </pre>
5789 </td>
5790 </tr>
5791 </table>
5792
5793 !! end
5794
5795 !! test
5796 1. Template-generated table cell attributes and cell content
5797 !! wikitext
5798 {|
5799 |{{table_attribs}}
5800 | {{table_attribs}}
5801 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
5802 |align=center {{table_attribs}}
5803 | <!--foo--> align=center <!--bar--> {{table_attribs}}
5804 |}
5805 !! html
5806 <table>
5807 <tr>
5808 <td style="color:red;">Foo
5809 </td>
5810 <td style="color:red;">Foo
5811 </td>
5812 <td style="color:red;">Foo
5813 </td>
5814 <td align="center" style="color:red;">Foo
5815 </td>
5816 <td align="center" style="color:red;">Foo
5817 </td></tr></table>
5818
5819 !! end
5820
5821 !! test
5822 2. Template-generated table cell attributes and cell content
5823 !! wikitext
5824 {|
5825 |{{table_attribs_2}}
5826 |}
5827 !! html/php
5828 <table>
5829 <tr>
5830 <td style="color:red;">Foo
5831 </td>
5832 <td>Bar</td>
5833 <td>Baz
5834 </td></tr></table>
5835
5836 !! html/parsoid
5837 <table>
5838 <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>
5839 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
5840 </tbody></table>
5841 !! end
5842
5843 !! test
5844 3. Template-generated table cell attributes and cell content
5845 !! wikitext
5846 {|
5847 !align=center {{table_header_cells}}
5848 |-
5849 |align=center {{table_cells}}
5850 |}
5851 !! html/php
5852 <table>
5853 <tr>
5854 <th align="center" style="color:red;">Foo</th>
5855 <th style="color:red;"><i>Bar</i></th>
5856 <th style="color:brown;"><i>Foo</i> and Baz
5857 </th></tr>
5858 <tr>
5859 <td align="center" style="color:red;">Foo</td>
5860 <td style="color:red;"><i>Bar</i></td>
5861 <td style="color:brown;"><i>Foo</i> and Baz
5862 </td></tr></table>
5863
5864 !! html/parsoid
5865 <table>
5866 <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>
5867 <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>
5868 </tbody></table>
5869 !! end
5870
5871 !! test
5872 Table with row followed by newlines and table heading
5873 !! wikitext
5874 {|
5875 |-
5876
5877 ! foo
5878 |}
5879 !! html
5880 <table>
5881
5882
5883 <tr>
5884 <th> foo
5885 </th></tr></table>
5886
5887 !! end
5888
5889 !! test
5890 Table with empty line following the start tag
5891 !! wikitext
5892 {|
5893
5894 |-
5895 | foo
5896 |}
5897 !! html
5898 <table>
5899
5900
5901 <tr>
5902 <td> foo
5903 </td></tr></table>
5904
5905 !! end
5906
5907 # FIXME: Preserve the attribute properly (with an empty string as value) in
5908 # the PHP parser. Parsoid implements the behavior below.
5909 !! test
5910 Table attributes with empty value
5911 !! wikitext
5912 {|
5913 | style=| hello
5914 |}
5915 !! html/parsoid
5916 <table>
5917 <tbody>
5918 <tr>
5919 <td style=""> hello
5920 </td></tr></tbody></table>
5921
5922 !! end
5923
5924 !! test
5925 Wikitext table with a lot of comments
5926 !! wikitext
5927 {|
5928 <!-- c0 -->
5929 | foo
5930 <!-- c1 -->
5931 |- <!-- c2 -->
5932 <!-- c3 -->
5933 |<!-- c4 -->
5934 <!-- c5 -->
5935 |}
5936 !! html
5937 <table>
5938 <tr>
5939 <td> foo
5940 </td></tr>
5941 <tr>
5942 <td>
5943 </td></tr></table>
5944
5945 !! end
5946
5947 !! test
5948 Wikitext table with double-line table cell
5949 !! wikitext
5950 {|
5951 |a
5952 b
5953 |}
5954 !! html
5955 <table>
5956 <tr>
5957 <td>a
5958 <p>b
5959 </p>
5960 </td></tr></table>
5961
5962 !! end
5963
5964 !! test
5965 Table cell with a single comment
5966 !! wikitext
5967 {|
5968 | <!-- c1 -->
5969 | a
5970 |}
5971 !! html
5972 <table>
5973 <tr>
5974 <td>
5975 </td>
5976 <td> a
5977 </td></tr></table>
5978
5979 !! end
5980
5981 !! test
5982 Table-cell after a comment-only-empty-line
5983 !! wikitext
5984 {|
5985 |a
5986 <!--c1-->
5987 <!--c2-->| b
5988 |}
5989 !! html
5990 <table>
5991 <tr>
5992 <td>a
5993 </td>
5994 <td> b
5995 </td></tr></table>
5996
5997 !! html/parsoid
5998 <table>
5999 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
6000 <!--c1-->
6001 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
6002 </tbody></table>
6003
6004 !! end
6005
6006 !! test
6007 Build table with {{!}}
6008 !! wikitext
6009 {{{!}} class="wikitable"
6010 ! header
6011 ! second header
6012 {{!}}- style="color:red;"
6013 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
6014 {{!}}}
6015 !! html
6016 <table class="wikitable">
6017 <tr>
6018 <th> header
6019 </th>
6020 <th> second header
6021 </th></tr>
6022 <tr style="color:red;">
6023 <td> data </td>
6024 <td style="color:red;"> second data
6025 </td></tr></table>
6026
6027 !! end
6028
6029 !! test
6030 Build table with pipe as data
6031 !! wikitext
6032 {| class="wikitable"
6033 ! header
6034 ! second header
6035 |- style="color:red;"
6036 | data || style="color:red;" | second data
6037 |-
6038 | style="color:red;" | data with | || style="color:red;" | second data with |
6039 |-
6040 || data with | ||| second data with |
6041 |}
6042 !! html
6043 <table class="wikitable">
6044 <tr>
6045 <th> header
6046 </th>
6047 <th> second header
6048 </th></tr>
6049 <tr style="color:red;">
6050 <td> data </td>
6051 <td style="color:red;"> second data
6052 </td></tr>
6053 <tr>
6054 <td style="color:red;"> data with | </td>
6055 <td style="color:red;"> second data with |
6056 </td></tr>
6057 <tr>
6058 <td> data with | </td>
6059 <td> second data with |
6060 </td></tr></table>
6061
6062 !! end
6063
6064 !! test
6065 Build table with wikilink
6066 !! wikitext
6067 {| class="wikitable"
6068 ! header || second header
6069 |- style="color:red;"
6070 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
6071 |-
6072 | data || second data [[Main Page|link|text with pipe]]
6073 |}
6074 !! html
6075 <table class="wikitable">
6076 <tr>
6077 <th> header </th>
6078 <th> second header
6079 </th></tr>
6080 <tr style="color:red;">
6081 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
6082 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
6083 </td></tr>
6084 <tr>
6085 <td> data </td>
6086 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
6087 </td></tr></table>
6088
6089 !! end
6090
6091 # The expected HTML structure in this test is debatable. The PHP parser does
6092 # not parse this kind of table at all. The main focus for Parsoid is on
6093 # round-tripping, so this output is ok for now. TODO: revisit!
6094 !! test
6095 Wikitext table with html-syntax row
6096 !! wikitext
6097 {|
6098 |-
6099 <td>foo</td>
6100 |}
6101 !! html/parsoid
6102 <table>
6103 <tbody>
6104 <tr>
6105 <td>foo</td></tr></tbody></table>
6106 !! end
6107
6108 ## Note that Parsoid output differs from PHP and PHP+tidy here.
6109 ## The lack of <tr> tags in the PHP output is arguably a bug in the
6110 ## PHP parser, which tidy then compounds by fostering the content
6111 ## entirely out of the table. Parsoid recognizes the table context
6112 ## and generates <tr> and <td> wrappers as needed. Hopefully nobody
6113 ## depends on PHP's treatment of broken table markup!
6114 !! test
6115 Implicit <td> after a |-
6116 !! options
6117 parsoid=wt2html,html2html
6118 !! wikitext
6119 {|
6120 |-
6121 a
6122 |}
6123 !! html/php
6124 <table>
6125
6126 a
6127 </table>
6128
6129 !! html/php+tidy
6130 <p>a</p>
6131 !! html/parsoid
6132 <table>
6133 <tr><td>a</td></tr>
6134 </table>
6135 !! end
6136
6137 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
6138 !! test
6139 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
6140 !! options
6141 parsoid=wt2html,html2html
6142 !! wikitext
6143 {|
6144 |-
6145 |
6146 a
6147 |-
6148 b
6149 |}
6150 !! html/php
6151 <table>
6152
6153 <tr>
6154 <td>
6155 <pre>a
6156 </pre>
6157 </td></tr>
6158 b
6159 </table>
6160
6161 !! html/php+tidy
6162 <p>b</p>
6163 <table>
6164 <tr>
6165 <td>
6166 <pre>
6167 a
6168 </pre></td>
6169 </tr>
6170 </table>
6171 !! html/parsoid
6172 <table>
6173 <tbody>
6174 <tr><td><pre>a</pre></td></tr>
6175 <tr><td> b</td></tr>
6176 </tbody>
6177 </table>
6178 !! end
6179
6180 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
6181 # Parsoid generates the missing <td>, so wt2wt won't succeed.
6182 !! test
6183 Lists should be recognized in an implicit <td> context
6184 !! options
6185 parsoid=wt2html,html2html
6186 !! wikitext
6187 {|
6188 |-
6189 *a
6190 |}
6191 !! html/php
6192 <table>
6193
6194 <ul><li>a</li></ul>
6195 </table>
6196
6197 !! html/php+tidy
6198 <ul>
6199 <li>a</li>
6200 </ul>
6201 !! html/parsoid
6202 <table>
6203 <tr>
6204 <td><ul>
6205 <li>a</li>
6206 </ul></td>
6207 </tr>
6208 </table>
6209 !! end
6210
6211 !! test
6212 Table cells not properly parsed in an implicit-td context
6213 !! wikitext
6214 {|
6215 |-
6216 {{table_attribs_4}} || a || b
6217 |}
6218 !! html/php+tidy
6219 <table>
6220 <tr>
6221 <td style="background-color:#DC241f;" width="10px"></td>
6222 <td>a</td>
6223 <td>b</td>
6224 </tr>
6225 </table>
6226 !! html/parsoid
6227 <table>
6228 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
6229 <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>
6230 </tbody></table>
6231 !! end
6232
6233 !! test
6234 Parsoid: Round-trip tables directly followed by content (bug 51219)
6235 !! options
6236 parsoid=wt2html,wt2wt
6237 !! wikitext
6238 {|
6239 |foo
6240 |} bar
6241
6242 {|
6243 |baz
6244 |}<b>quux</b>
6245 !! html+tidy
6246 <table>
6247 <tr>
6248 <td>foo</td>
6249 </tr>
6250 </table>
6251 <p>bar</p>
6252 <table>
6253 <tr>
6254 <td>baz</td>
6255 </tr>
6256 </table>
6257 <p><b>quux</b></p>
6258 !! end
6259
6260 !! test
6261 Parsoid: Default to a newline after tables in new content (bug 51219)
6262 !! options
6263 parsoid=html2wt
6264 !! html
6265 <table><tbody>
6266 <tr><td>foo</td></tr></tbody></table> bar
6267 <table><tbody>
6268 <tr><td>baz</td></tr></tbody></table><b>quux</b>
6269 !! wikitext
6270 {|
6271 |foo
6272 |}
6273 <nowiki> </nowiki>bar
6274 {|
6275 |baz
6276 |}
6277 '''quux'''
6278 !! end
6279
6280 !! test
6281 Parsoid: newline inducing block nodes don't suppress <nowiki>
6282 !! options
6283 parsoid=html2wt
6284 !! html
6285 a<h1>foo</h1>
6286 !! wikitext
6287 <nowiki> </nowiki>a
6288
6289 = foo =
6290 !! end
6291
6292 !! test
6293 Parsoid: Row-syntax table headings followed by comment & table cells
6294 !! options
6295 parsoid=wt2html,wt2wt
6296 !! wikitext
6297 {|
6298 ! foo || bar
6299 <!-- foo --> || baz || quux
6300 |}
6301 !! html/php
6302 <table>
6303 <tr>
6304 <th> foo </th>
6305 <th> bar
6306 </th>
6307 <td> baz </td>
6308 <td> quux
6309 </td></tr></table>
6310
6311 !! html/parsoid
6312 <table>
6313 <tbody><tr><th> foo </th><th> bar
6314 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
6315 </tbody></table>
6316 !! end
6317
6318
6319 # PHP throws away the (semi-broken) "foo" class here; Parsoid
6320 # preserves it.
6321 !!test
6322 Parsoid: Recover better from broken table attributes
6323 !!options
6324 parsoid=wt2html
6325 !!wikitext
6326 {| class="foo
6327 | class="bar" |
6328 foo
6329 |}
6330 !!html/php+tidy
6331 <table>
6332 <tr>
6333 <td class="bar">
6334 <p>foo</p>
6335 </td>
6336 </tr>
6337 </table>
6338 !!html/parsoid
6339 <table class="foo">
6340 <tr>
6341 <td class="bar">
6342 <p>foo</p></td></tr>
6343 </tbody></table>
6344 !!end
6345
6346 !! test
6347 Strip unsupported table tags
6348 !! options
6349 parsoid=html2wt
6350 !! html
6351 <table>
6352 <thead>
6353 <tr>
6354 <th>Month</th>
6355 <th>Savings</th>
6356 </tr>
6357 </thead>
6358 <tbody>
6359 <tr>
6360 <td>January</td>
6361 <td>$100</td>
6362 </tr>
6363 <tr>
6364 <td>February</td>
6365 <td>$80</td>
6366 </tr>
6367 </tbody>
6368 <tfoot>
6369 <tr>
6370 <td>Sum</td>
6371 <td>$180</td>
6372 </tr>
6373 </tfoot>
6374 </table>
6375 !! wikitext
6376 {|
6377
6378 !Month
6379 !Savings
6380
6381 |January
6382 |$100
6383
6384 |-
6385 |February
6386 |$80
6387
6388 |Sum
6389 |$180
6390
6391 |}
6392 !! end
6393
6394 !!test
6395 Testing serialization after deletion of table cells
6396 !!options
6397 parsoid={
6398 "modes": ["wt2wt"],
6399 "changes": [
6400 ["#x", "remove"]
6401 ]
6402 }
6403 !!wikitext
6404 {|
6405 !h1 !!h2 !!h3
6406 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
6407 |}
6408 !! wikitext/edited
6409 {|
6410 !h1 !!h2 !!h3
6411 |c2 |||c3
6412 |}
6413 !!end
6414
6415 ###
6416 ### Internal links
6417 ###
6418 !! test
6419 Plain link, capitalized
6420 !! wikitext
6421 [[Main Page]]
6422 !! html
6423 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6424 </p>
6425 !! end
6426
6427 !! test
6428 Plain link, uncapitalized
6429 !! wikitext
6430 [[main Page]]
6431 !! html
6432 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
6433 </p>
6434 !! end
6435
6436 !! test
6437 Piped link
6438 !! wikitext
6439 [[Main Page|The Main Page]]
6440 !! html
6441 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
6442 </p>
6443 !! end
6444
6445 !! test
6446 Piped link with comment in link text
6447 !! wikitext
6448 [[Main Page|The Main<!--front--> Page]]
6449 !! html
6450 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
6451 </p>
6452 !! end
6453
6454 !! test
6455 Piped link with multiple pipe characters in link text
6456 !! wikitext
6457 [[Main Page||The|Main|Page|]]
6458 !! html/php
6459 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
6460 </p>
6461 !! html/parsoid
6462 <p><a rel="mw:WikiLink" href="Main_Page" title="Main Page">|The|Main|Page|</a></p>
6463 !! end
6464
6465 !! test
6466 Broken link
6467 !! wikitext
6468 [[Zigzagzogzagzig]]
6469 !! html
6470 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
6471 </p>
6472 !! end
6473
6474 !! test
6475 Broken link with fragment
6476 !! wikitext
6477 [[Zigzagzogzagzig#zug]]
6478 !! html
6479 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
6480 </p>
6481 !! end
6482
6483 !! test
6484 Special page link with fragment
6485 !! wikitext
6486 [[Special:Version#anchor]]
6487 !! html
6488 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
6489 </p>
6490 !! end
6491
6492 !! test
6493 Nonexistent special page link with fragment
6494 !! wikitext
6495 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
6496 !! html
6497 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
6498 </p>
6499 !! end
6500
6501 !! test
6502 Link with prefix
6503 !! wikitext
6504 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
6505 !! html
6506 <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>
6507 </p>
6508 !! end
6509
6510 !! test
6511 Link with suffix
6512 !! wikitext
6513 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
6514 !! html
6515 <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>!!!
6516 </p>
6517 !! end
6518
6519 !! article
6520 prefixed article
6521 !! text
6522 Some text
6523 !! endarticle
6524
6525 !! test
6526 Bug 43661: Piped links with identical prefixes
6527 !! wikitext
6528 [[prefixed article|prefixed articles with spaces]]
6529
6530 [[prefixed article|prefixed articlesaoeu]]
6531
6532 [[Main Page|Main Page test]]
6533 !! html
6534 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
6535 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
6536 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
6537 </p>
6538 !! end
6539
6540
6541 !! test
6542 Link with HTML entity in suffix / tail
6543 !! wikitext
6544 [[Main Page]]&quot;, [[Main Page]]&#97;
6545 !! html/php
6546 <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;
6547 </p>
6548 !! html/parsoid
6549 <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>
6550 !! end
6551
6552 !! test
6553 Link with 3 brackets
6554 !! wikitext
6555 [[[Main Page]]]
6556 !! html
6557 <p>[[[Main Page]]]
6558 </p>
6559 !! end
6560
6561 !! test
6562 Link with 4 brackets
6563 !! wikitext
6564 [[[[Main Page]]]]
6565 !! html
6566 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
6567 </p>
6568 !! end
6569
6570 !! test
6571 Piped link with 3 brackets
6572 !! wikitext
6573 [[[main page|the main page]]]
6574 !! html
6575 <p>[[[main page|the main page]]]
6576 </p>
6577 !! end
6578
6579 !! test
6580 Piped link with extlink-like text
6581 !! wikitext
6582 [[Main Page|[bar]]]
6583 [[Main Page|This is a [bar]]]
6584 !! html/php
6585 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
6586 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
6587 </p>
6588 !! html/parsoid
6589 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
6590 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a></p>
6591 !! end
6592
6593 !! test
6594 Link with multiple pipes
6595 !! wikitext
6596 [[Main Page|The|Main|Page]]
6597 !! html
6598 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
6599 </p>
6600 !! end
6601
6602 # Note that parsoid does not munge anchor text; all non-space
6603 # characters are valid in HTML5 ids.
6604 !! test
6605 Anchor containing a #. (bug 63430)
6606 !! wikitext
6607 [[Main Page#And#Link]]
6608 !! html/php
6609 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
6610 </p>
6611 !! html/parsoid
6612 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link" title="Main Page">Main Page#And#Link</a></p>
6613 !! end
6614
6615 !! test
6616 Link to namespaces
6617 !! wikitext
6618 [[Talk:Parser testing]], [[Meta:Disclaimers]]
6619 !! html
6620 <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>
6621 </p>
6622 !! end
6623
6624 !! test
6625 Link with space in namespace
6626 !! wikitext
6627 [[User talk:Foo bar]]
6628 !! html
6629 <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>
6630 </p>
6631 !! end
6632
6633 !! article
6634 MemoryAlpha:AlphaTest
6635 !! text
6636 This is an article in the MemoryAlpha namespace
6637 (which shadows the memoryalpha interwiki link).
6638 !! endarticle
6639
6640 !! test
6641 Namespace takes precedence over interwiki link (bug 51680)
6642 !! wikitext
6643 [[MemoryAlpha:AlphaTest]]
6644 !! html
6645 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
6646 </p>
6647 !! end
6648
6649 # The previous test doesn't work correctly in html2*, due to not recognizing the
6650 # link as an internal one. This one checks for the correct behavior.
6651 !! test
6652 Link to namespace preferred over interwiki with correct rel attribute
6653 !! options
6654 parsoid=html2wt,html2html
6655 !! html
6656 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
6657 !! wikitext
6658 [[MemoryAlpha:AlphaTest]]
6659 !! end
6660
6661 !! test
6662 Piped link to namespace
6663 !! wikitext
6664 [[Meta:Disclaimers|The disclaimers]]
6665 !! html
6666 <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>
6667 </p>
6668 !! end
6669
6670 !! test
6671 Link containing }
6672 !! wikitext
6673 [[Usually caused by a typo (oops}]]
6674 !! html
6675 <p>[[Usually caused by a typo (oops}]]
6676 </p>
6677 !! end
6678
6679 !! article
6680 7% Solution
6681 !! text
6682 Just a test of an article title containing a percent.
6683 !! endarticle
6684
6685 !! test
6686 Link containing % (not as a hex sequence)
6687 !! wikitext
6688 [[7% Solution]]
6689 !! html/php
6690 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
6691 </p>
6692 !! html/parsoid
6693 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
6694 !! end
6695
6696 # note that the parsoid HTML is identical to the previous test output,
6697 # so the previous test ensures that the html2wt mode will generate the
6698 # "not as a hex sequence" wikitext.
6699 !! test
6700 Link containing % as a single hex sequence interpreted to char
6701 !! options
6702 parsoid=wt2wt,wt2html,html2html
6703 !! wikitext
6704 [[7%25 Solution]]
6705 !! html/php
6706 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
6707 </p>
6708 !! html/parsoid
6709 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
6710 !!end
6711
6712 !! test
6713 Link containing % as a double hex sequence interpreted to hex sequence
6714 !! wikitext
6715 [[7%2525 Solution]]
6716 !! html
6717 <p>[[7%2525 Solution]]
6718 </p>
6719 !!end
6720
6721 # note that parsoid does not munge anchor text; all non-space
6722 # characters are valid in HTML5 anchors.
6723 !! test
6724 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
6725 Example for such a section: == < ==
6726 !! wikitext
6727 [[%23%3c]][[%23%3e]]
6728 !! html/php
6729 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
6730 </p>
6731 !! html/parsoid
6732 <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>
6733 !! end
6734
6735 !! test
6736 Link containing "<#" and ">#" as a hex sequences
6737 !! wikitext
6738 [[%3c%23]][[%3e%23]]
6739 !! html
6740 <p>[[%3c%23]][[%3e%23]]
6741 </p>
6742 !! end
6743
6744 !! test
6745 Link containing an equals sign
6746 !! wikitext
6747 [[Special:BookSources/isbn=4-00-026157-6]]
6748 !! html/php
6749 <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>
6750 </p>
6751 !! html/parsoid
6752 <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>
6753 !! end
6754
6755 !! article
6756 Foo~bar
6757 !! text
6758 Just a test of an article title containing a tilde.
6759 !! endarticle
6760
6761 # note that links containing signatures, like [[Foo~~~~]], are
6762 # massaged by the pre-save transform (PST) and so the tildes are never
6763 # seen by the parser.
6764 !! test
6765 Link containing a tilde
6766 !! wikitext
6767 [[Foo~bar]]
6768 !! html/php
6769 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
6770 </p>
6771 !! html/parsoid
6772 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
6773 !! end
6774
6775 !! test
6776 Link containing double-single-quotes '' (bug 4598)
6777 !! wikitext
6778 [[Lista d''e paise d''o munno]]
6779 !! html/php
6780 <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>
6781 </p>
6782 !! html/parsoid
6783 <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>
6784 !! end
6785
6786 !! test
6787 Link containing double-single-quotes '' in text (bug 4598 sanity check)
6788 !! wikitext
6789 Some [[Link|pretty ''italics'' and stuff]]!
6790 !! html/php
6791 <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>!
6792 </p>
6793 !! html/parsoid
6794 <p>Some <a rel="mw:WikiLink" href="Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
6795 !! end
6796
6797 !! test
6798 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
6799 !! wikitext
6800 ''Some [[Link|pretty ''italics'' and stuff]]!''
6801 !! html
6802 <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>
6803 </p>
6804 !! end
6805
6806 !! test
6807 Link with double quotes in title part (literal) and alternate part (interpreted)
6808 !! wikitext
6809 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
6810
6811 [[''Pentecoste'']]
6812
6813 [[''Pentecoste''|Pentecoste]]
6814
6815 [[''Pentecoste''|''Pentecoste'']]
6816 !! html/php
6817 <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>
6818 </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>
6819 </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>
6820 </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>
6821 </p>
6822 !! html/parsoid
6823 <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>
6824 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
6825 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
6826 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
6827 !! end
6828
6829 !! test
6830 Broken image links with HTML captions (bug 39700)
6831 !! wikitext
6832 [[File:Nonexistent|<script></script>]]
6833 [[File:Nonexistent|100x100px|<script></script>]]
6834 [[File:Nonexistent|&lt;]]
6835 [[File:Nonexistent|a<i>b</i>c]]
6836 !! html/php
6837 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
6838 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
6839 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
6840 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
6841 </p>
6842 !! html/parsoid
6843 <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>
6844 <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>
6845 <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>
6846 <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>
6847 !! end
6848
6849 !! test
6850 Plain link to URL
6851 !! wikitext
6852 [[http://www.example.com]]
6853 !! html/php
6854 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
6855 </p>
6856 !! html/parsoid
6857 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
6858 !! end
6859
6860 !! test
6861 Plain link to URL with link text
6862 !! wikitext
6863 [[http://www.example.com Link text]]
6864 !! html
6865 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
6866 </p>
6867 !! end
6868
6869 !! test
6870 Plain link to protocol-relative URL
6871 !! wikitext
6872 [[//www.example.com]]
6873 !! html/php
6874 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
6875 </p>
6876 !! html/parsoid
6877 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
6878 !! end
6879
6880 !! test
6881 Plain link to protocol-relative URL with link text
6882 !! wikitext
6883 [[//www.example.com Link text]]
6884 !! html
6885 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
6886 </p>
6887 !! end
6888
6889 !! test
6890 Plain link to page with question mark in title
6891 !! wikitext
6892 [[A?b]]
6893
6894 [[A?b|Baz]]
6895 !! html
6896 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
6897 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
6898 </p>
6899 !! end
6900
6901
6902 # I'm fairly sure the expected result here is wrong.
6903 # We want these to be URL links, not pseudo-pages with URLs for titles....
6904 # However the current output is also pretty screwy.
6905 #
6906 # ----
6907 # I'm changing it to match the current output--it arguably makes more
6908 # sense in the light of the test above. Old expected result was:
6909 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
6910 #</p>
6911 # But I think this test is bordering on "garbage in, garbage out" anyway.
6912 # -- wtm
6913 !! test
6914 Piped link to URL
6915 !! wikitext
6916 Piped link to URL: [[http://www.example.com|an example URL]]
6917 !! html/php
6918 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
6919 </p>
6920 !! html/parsoid
6921 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
6922 !! end
6923
6924 !! test
6925 BUG 2: [[page|http://url/]] should link to page, not http://url/
6926 !! wikitext
6927 [[Main Page|http://url/]]
6928 !! html/php
6929 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
6930 </p>
6931 !! html/parsoid
6932 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
6933 !! end
6934
6935 # Parsoid does not mark self-links, by design.
6936 !! test
6937 BUG 337: Escaped self-links should be bold
6938 !! options
6939 title=[[Bug462]]
6940 !! wikitext
6941 [[Bu&#103;462]] [[Bug462]]
6942 !! html/php
6943 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
6944 </p>
6945 !! html/php+tidy
6946 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
6947 !! html/parsoid
6948 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
6949 !! end
6950
6951 !! test
6952 Self-link to section should not be bold
6953 !! options
6954 title=[[Main Page]]
6955 !! wikitext
6956 [[Main Page#section]]
6957 !! html
6958 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
6959 </p>
6960 !! end
6961
6962 !! article
6963 00
6964 !! text
6965 This is 00.
6966 !! endarticle
6967
6968 !!test
6969 Self-link to numeric title
6970 !!options
6971 title=[[0]]
6972 !! wikitext
6973 [[0]]
6974 !! html
6975 <p><strong class="selflink">0</strong>
6976 </p>
6977 !!end
6978
6979 !!test
6980 Link to numeric-equivalent title
6981 !!options
6982 title=[[0]]
6983 !! wikitext
6984 [[00]]
6985 !! html
6986 <p><a href="/wiki/00" title="00">00</a>
6987 </p>
6988 !!end
6989
6990 !! test
6991 <nowiki> inside a link
6992 !! wikitext
6993 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
6994 !! html
6995 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
6996 </p>
6997 !! end
6998
6999 !! test
7000 Non-breaking spaces in title
7001 !! wikitext
7002 [[&nbsp; Main &nbsp; Page &nbsp;]]
7003 !! html
7004 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
7005 </p>
7006 !!end
7007
7008 !! test
7009 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
7010 !! options
7011 language=ca
7012 !! wikitext
7013 '''[[Main Page]]'''
7014 !! html
7015 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
7016 </p>
7017 !! end
7018
7019 !! test
7020 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
7021 !! options
7022 language=ca
7023 !! wikitext
7024 ''[[Main Page]]''
7025 !! html
7026 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
7027 </p>
7028 !! end
7029
7030 !! test
7031 Internal link with en linktrail: no apostrophes (bug 27473)
7032 !! options
7033 language=en
7034 !! wikitext
7035 [[Something]]'nice
7036 !! html
7037 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
7038 </p>
7039 !! end
7040
7041 !! test
7042 Internal link with ca linktrail with apostrophes (bug 27473)
7043 !! options
7044 language=ca
7045 !! wikitext
7046 [[Something]]'nice
7047 !! html
7048 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
7049 </p>
7050 !! end
7051
7052 !! test
7053 Internal link with kaa linktrail with apostrophes (bug 27473)
7054 !! options
7055 language=kaa
7056 !! wikitext
7057 [[Something]]'nice
7058 !! html
7059 <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>
7060 </p>
7061 !! end
7062
7063 !! test
7064 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
7065 !! wikitext
7066 [[User:Foo/Test/63636:Bar|Test]]
7067 !! html/php
7068 <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>
7069 </p>
7070 !! html/parsoid
7071 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
7072 !! end
7073
7074 !! test
7075 Purely hash wikilink
7076 !! options
7077 title=[[User:test/123]]
7078 !! wikitext
7079 [[#a|b]]
7080 !! html/php
7081 <p><a href="#a">b</a>
7082 </p>
7083 !! html/parsoid
7084 <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>
7085 !! end
7086
7087 !! test
7088 1. Interaction of linktrail and template encapsulation
7089 !! options
7090 parsoid
7091 !! wikitext
7092 {{echo|[[Foo]]}}l
7093 !! html
7094 <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>
7095 !! end
7096
7097 !! test
7098 2. Interaction of linktrail and template encapsulation
7099 !! options
7100 parsoid
7101 !! wikitext
7102 {{echo|Some [[Fool]]}}s
7103 !! html
7104 <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>
7105 !! end
7106
7107 !! test
7108 3. Interaction of linktrail and template encapsulation
7109 !! options
7110 parsoid
7111 !! wikitext
7112 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
7113 !! html
7114 <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>
7115 !! end
7116
7117 !! article
7118 Söfnuður
7119 !! text
7120 Test.
7121 !! endarticle
7122
7123 !! test
7124 Internal link with is link prefix
7125 !! options
7126 language=is
7127 !! wikitext
7128 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
7129 !! html
7130 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
7131 </p>
7132 !! end
7133
7134 !! article
7135 Mótmælendatrú
7136 !! text
7137 Test.
7138 !! endarticle
7139
7140 !! test
7141 Internal link with is link trail and link prefix
7142 !! options
7143 language=is
7144 !! wikitext
7145 [[mótmælendatrú|xxx]]ar
7146 [[mótmælendatrú]]ar
7147 mótmælenda[[söfnuður]]
7148 mótmælenda[[söfnuður|söfnuðir]]
7149 mótmælenda[[söfnuður|söfnuðir]]xxx
7150 !! html
7151 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
7152 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
7153 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
7154 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
7155 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
7156 </p>
7157 !! end
7158
7159 !! test
7160 Parsoid link trail escaping
7161 !! options
7162 parsoid=html2wt,html2html
7163 !! html
7164 <p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p>
7165 !! wikitext
7166 [[apple]]<nowiki/>s
7167 !! end
7168
7169 !! test
7170 Parsoid link prefix escaping
7171 !! options
7172 language=is
7173 parsoid=html2wt,html2html
7174 !! html
7175 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p>
7176 !! wikitext
7177 Aðrir mótmælenda<nowiki/>[[söfnuður]]
7178 !! end
7179
7180 !! test
7181 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
7182 !! wikitext
7183 [[Foo| bar]]
7184
7185 [[Foo| ''bar'']]
7186
7187 [http://wp.org foo]
7188
7189 [http://wp.org ''foo'']
7190 !! html
7191 <p><a href="/wiki/Foo" title="Foo"> bar</a>
7192 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
7193 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
7194 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
7195 </p>
7196 !! end
7197
7198 !! test
7199 Parsoid: Scoped parsing should handle mixed transclusions and plain text
7200 !! options
7201 parsoid
7202 !! wikitext
7203 [[Foo|{{echo|a}} b {{echo|c}}]]
7204 !! html
7205 <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>
7206 !! end
7207
7208 !! test
7209 Link with angle bracket after anchor
7210 !! wikitext
7211 [[Foo#<bar>]]
7212 !! html/php
7213 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
7214 </p>
7215 !! html/parsoid
7216 <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>
7217 !! end
7218
7219 ###
7220 ### Interwiki links (see maintenance/interwiki.sql)
7221 ###
7222
7223 !! test
7224 Inline interwiki link
7225 !! options
7226 parsoid=wt2html,wt2wt,html2html
7227 !! wikitext
7228 [[MeatBall:SoftSecurity]]
7229 !! html/php
7230 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
7231 </p>
7232 !! html/parsoid
7233 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
7234 !! end
7235
7236 !! test
7237 Inline interwiki link with empty title (bug 2372)
7238 !! options
7239 parsoid=wt2html,wt2wt,html2html
7240 !! wikitext
7241 [[MeatBall:]]
7242 !! html/php
7243 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
7244 </p>
7245 !! html/parsoid
7246 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
7247 !! end
7248
7249 !! test
7250 Interwiki link encoding conversion (bug 1636)
7251 !! wikitext
7252 *[[Wikipedia:ro:Olteni&#0355;a]]
7253 *[[Wikipedia:ro:Olteni&#355;a]]
7254 !! html
7255 <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>
7256 <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>
7257
7258 !! html+tidy
7259 <ul>
7260 <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>
7261 <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>
7262 </ul>
7263 !! end
7264
7265 !! test
7266 Interwiki link with fragment (bug 2130)
7267 !! wikitext
7268 [[MeatBall:SoftSecurity#foo]]
7269 !! html
7270 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
7271 </p>
7272 !! end
7273
7274 # Ideally the wikipedia: prefix here should be proto-relative too
7275 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
7276 # define the 'en' prefix, and originally the test used 'wikipedia',
7277 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
7278 # article.
7279 !! test
7280 Different interwiki prefixes mapping to the same URL
7281 !! wikitext
7282 [[:en:Foo]]
7283
7284 [[:en:Foo|Foo]]
7285
7286 [[wikipedia:Foo]]
7287
7288 [[:wikipedia:Foo|Foo]]
7289
7290 [[wikipedia:en:Foo]]
7291
7292 [[:wikipedia:en:Foo]]
7293
7294 [[ wikiPEdia :Foo]]
7295 !! html/parsoid
7296 <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>
7297
7298 <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>
7299
7300 <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>
7301
7302 <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>
7303
7304 <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>
7305
7306 <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>
7307
7308 <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>
7309 !! end
7310
7311 !! test
7312 Interwiki links that cannot be represented in wiki syntax
7313 !! wikitext
7314 [[meatball:ok]]
7315 [[meatball:ok#foo|ok with fragment]]
7316 [[meatball:ok_as_well?|ok ending with ? mark]]
7317 [http://de.wikipedia.org/wiki/Foo?action=history has query]
7318 [http://de.wikipedia.org/wiki/#foo is just fragment]
7319
7320 !! html/php
7321 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
7322 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
7323 <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>
7324 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
7325 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
7326 </p>
7327 !! html/parsoid
7328 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
7329 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
7330 <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>
7331 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
7332 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
7333 !! end
7334
7335 !! test
7336 Interwiki links: trail
7337 !! wikitext
7338 [[wikipedia:Foo|Ba]]r
7339 !! html/php
7340 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
7341 </p>
7342 !! html/parsoid
7343 <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>
7344 !! end
7345
7346 !! test
7347 Local interwiki link
7348 !! options
7349 parsoid=wt2html,wt2wt,html2html
7350 !! wikitext
7351 [[local:Template:Foo]]
7352 !! html/php
7353 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
7354 </p>
7355 !! html/parsoid
7356 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
7357 !! end
7358
7359 # Parsoid does not mark self-links, by design.
7360 !! test
7361 Local interwiki link: self-link to current page
7362 !! options
7363 title=[[Main Page]]
7364 parsoid=wt2html,wt2wt,html2html
7365 !! wikitext
7366 [[local:Main Page]]
7367 !! html/php
7368 <p><strong class="selflink">local:Main Page</strong>
7369 </p>
7370 !! html/parsoid
7371 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
7372 !! end
7373
7374 !! test
7375 Local interwiki link: prefix only (bug 64167)
7376 !! options
7377 parsoid=wt2html,wt2wt,html2html
7378 !! wikitext
7379 [[local:]]
7380 !! html/php
7381 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
7382 </p>
7383 !! html/parsoid
7384 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
7385 !! end
7386
7387 !! test
7388 Local interwiki link: with additional interwiki prefix (bug 61357)
7389 !! options
7390 parsoid=wt2html,wt2wt,html2html
7391 !! wikitext
7392 [[local:meatball:Hello]]
7393 !! html/php
7394 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
7395 </p>
7396 !! html/parsoid
7397 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
7398 !! end
7399
7400 !! test
7401 Multiple local interwiki link prefixes
7402 !! wikitext
7403 [[local:local:local:local:mi:local:Foo]]
7404 !! options
7405 parsoid=wt2html,wt2wt,html2html
7406 !! html/php
7407 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
7408 </p>
7409 !! html/parsoid
7410 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
7411 !! end
7412
7413 ###
7414 ### Interlanguage links
7415 ### Language links (so that searching for '### language' matches..)
7416 ###
7417
7418 !! test
7419 Interlanguage link
7420 !! options
7421 parsoid=wt2html,wt2wt,html2html
7422 !! wikitext
7423 Blah blah blah
7424 [[zh:Chinese]]
7425 !! html/php
7426 <p>Blah blah blah
7427 </p>
7428 !! html/parsoid
7429 <p>Blah blah blah</p>
7430 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7431 !! end
7432
7433 !! test
7434 Interlanguage link with spacing
7435 !! options
7436 parsoid=wt2html,wt2wt,html2html
7437 !! wikitext
7438 Blah blah blah
7439 [[ zh : Chinese ]]
7440 !! html/php
7441 <p>Blah blah blah
7442 </p>
7443 !! html/parsoid
7444 <p>Blah blah blah</p>
7445 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7446 !! end
7447
7448 !! test
7449 Double interlanguage link
7450 !! options
7451 parsoid=wt2html,wt2wt,html2html
7452 !! wikitext
7453 Blah blah blah
7454 [[es:Spanish]]
7455 [[zh:Chinese]]
7456 !! html/php
7457 <p>Blah blah blah
7458 </p>
7459 !! html/parsoid
7460 <p>Blah blah blah</p>
7461 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
7462 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7463 !! end
7464
7465 !! test
7466 Interlanguage link variations
7467 !! options
7468 parsoid=wt2html,wt2wt,html2html
7469 !! wikitext
7470 Blah blah blah
7471 [[ es :Spanish]]
7472 [[ ZH :Chinese]]
7473 [[es:Foo_bar]]
7474 [[es:Foo bar]]
7475 !! html/php
7476 <p>Blah blah blah
7477 </p>
7478 !! html/parsoid
7479 <p>Blah blah blah</p>
7480 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
7481 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
7482 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
7483 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
7484 !! end
7485
7486 !! test
7487 Interlanguage link, with prefix links
7488 !! options
7489 language=ln
7490 !! wikitext
7491 Blah blah blah
7492 [[zh:Chinese]]
7493 !! html/php
7494 <p>Blah blah blah
7495 </p>
7496 !! html/parsoid
7497 <p>Blah blah blah</p>
7498 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7499 !! end
7500
7501 !! test
7502 Double interlanguage link, with prefix links (bug 8897)
7503 !! options
7504 language=ln
7505 !! wikitext
7506 Blah blah blah
7507 [[es:Spanish]]
7508 [[zh:Chinese]]
7509 !! html/php
7510 <p>Blah blah blah
7511 </p>
7512 !! html/parsoid
7513 <p>Blah blah blah</p>
7514 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
7515 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7516 !! end
7517
7518 !! test
7519 "Extra" interlanguage links (bug 32189 / gerrit 111390)
7520 !! wikitext
7521 Blah blah blah
7522 [[mul:Article]]
7523 !! html/php
7524 <p>Blah blah blah
7525 </p>
7526 !! html/parsoid
7527 <p>Blah blah blah</p>
7528 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
7529 !! end
7530
7531 !! test
7532 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
7533 !! options
7534 language=ln
7535 !! wikitext
7536 [[WW&nbsp;II]]
7537 !! html
7538 <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>
7539 </p>
7540 !! end
7541
7542 !! test
7543 Parsoid bug 53221: Wikilinks should be properly entity-escaped
7544 !! options
7545 parsoid=html2wt
7546 !! html
7547 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
7548 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
7549 !! wikitext
7550 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
7551
7552 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
7553 !! end
7554
7555 !! test
7556 Parsoid: handle constructor well
7557 !! wikitext
7558 [[constructor]]
7559
7560 [[constructor:foo]]
7561 !! html/php
7562 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
7563 </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>
7564 </p>
7565 !! html/parsoid
7566 <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>
7567
7568 <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>
7569 !! end
7570
7571 !! article
7572 ko:
7573 !! text
7574 Test.
7575 !! endarticle
7576
7577 # Note that `ko` isn't a known interlanguage prefix
7578 !! test
7579 Parsoid: recognize interlanguage links without a target page
7580 !! options
7581 ill
7582 !! wikitext
7583 [[es:]]
7584
7585 [[ko:]]
7586 !! html/php
7587 es:
7588 !! html/parsoid
7589 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
7590
7591 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
7592 !! end
7593
7594 # Note that `ko` isn't a known interwiki prefix
7595 !! test
7596 Parsoid: recognize interwiki links without a target page
7597 !! options
7598 parsoid=wt2html,wt2wt,html2html
7599 !! wikitext
7600 [[:es:]]
7601
7602 [[:ko:]]
7603 !! html/php
7604 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
7605 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
7606 </p>
7607 !! html/parsoid
7608 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
7609 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
7610 !! end
7611
7612 !! test
7613 Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
7614 !! wikitext
7615 [[mi:Foo]]
7616 !! html/php
7617 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
7618 </p>
7619 !! html/parsoid
7620 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
7621 !! end
7622
7623 !! test
7624 Interlanguage link with preceding local interwiki link (bug 68085)
7625 !! options
7626 parsoid=wt2html,wt2wt,html2html
7627 !! wikitext
7628 Blah blah blah
7629 [[local:es:Spanish]]
7630 !! html/php
7631 <p>Blah blah blah
7632 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
7633 </p>
7634 !! html/parsoid
7635 <p>Blah blah blah
7636 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
7637 !! end
7638
7639 !! test
7640 Looks like an interlanguage link, but is actually a local interwiki
7641 !! options
7642 parsoid=wt2html,wt2wt,html2html
7643 !! wikitext
7644 Blah blah blah
7645 [[mi:Template:Foo]]
7646 !! html/php
7647 <p>Blah blah blah
7648 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
7649 </p>
7650 !! html/parsoid
7651 <p>Blah blah blah
7652 <a rel="mw:WikiLink" href="Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
7653 !! end
7654
7655 ###
7656 ### Redirects, Parsoid-only
7657 ###
7658 !! test
7659 1. Simple redirect to page
7660 !! options
7661 parsoid
7662 !! wikitext
7663 #REDIRECT [[Main Page]]
7664 !! html
7665 <link rel="mw:PageProp/redirect" href="./Main_Page">
7666 !! end
7667
7668 # Only wt2html and html2html since "Main_Page" will serialize to "Main Page"
7669 !! test
7670 2. Other redirect variants
7671 !! options
7672 parsoid=wt2html,wt2wt
7673 !! wikitext
7674 #REDIRECT [[Main_Page]]
7675 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
7676 !! html/parsoid
7677 <link rel="mw:PageProp/redirect" href="./Main_Page"><link rel="mw:PageProp/redirect" href="./%5B%5BBar%5D%5D">
7678 !! end
7679
7680 !! test
7681 Empty redirect
7682 !! options
7683 parsoid=wt2html,wt2wt
7684 !! wikitext
7685 #REDIRECT [[]]
7686 !! html
7687 <ol>
7688 <li>REDIRECT [[]]</li></ol>
7689 !! end
7690
7691 !! test
7692 Optional colon in #REDIRECT
7693 !! options
7694 # the colon is archaic syntax. we support it for wt2html, but we
7695 # don't care that it roundtrips back to the modern syntax.
7696 parsoid=wt2html,html2html
7697 !! wikitext
7698 #REDIRECT:[[Main Page]]
7699 !! html
7700 <link rel="mw:PageProp/redirect" href="./Main_Page">
7701 !! end
7702
7703 !! test
7704 Whitespace in #REDIRECT with optional colon
7705 !! options
7706 # the colon and gratuitous whitespace is archaic syntax. we support
7707 # it for wt2html, but we don't care that it roundtrips back to the
7708 # modern syntax (without extra whitespace)
7709 parsoid=wt2html,html2html
7710 !! wikitext
7711
7712 #REDIRECT
7713 :
7714 [[Main Page]]
7715 !! html
7716 <link rel="mw:PageProp/redirect" href="./Main_Page">
7717 !! end
7718
7719 !! test
7720 Piped link in #REDIRECT
7721 !! options
7722 # content after piped link is ignored. we support this syntax,
7723 # but don't care that the piped link is lost when we roundtrip this.
7724 parsoid=wt2html
7725 !! wikitext
7726 #REDIRECT [[Main Page|bar]]
7727 !! html
7728 <link rel="mw:PageProp/redirect" href="./Main_Page">
7729 !! end
7730
7731 !! test
7732 Redirect to category
7733 !! options
7734 parsoid=wt2html
7735 !! wikitext
7736 #REDIRECT [[Category:Foo]]
7737 !! html
7738 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
7739 !! end
7740
7741 !! test
7742 Redirect to category with URL encoding
7743 !! options
7744 parsoid=wt2html
7745 !! wikitext
7746 #REDIRECT [[Category%3AFoo]]
7747 !! html
7748 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
7749 !! end
7750
7751 !! test
7752 Redirect to category page
7753 !! options
7754 parsoid=wt2html,html2html
7755 !! wikitext
7756 #REDIRECT [[:Category:Foo]]
7757 !! html
7758 <p><a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Category:Foo</a></p>
7759 !! end
7760
7761 !! test
7762 Redirect to image page (1)
7763 !! options
7764 parsoid
7765 !! wikitext
7766 #REDIRECT [[File:Wiki.png]]
7767 !! html
7768 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
7769 !! end
7770
7771 !! test
7772 Redirect to image page (2)
7773 !! options
7774 parsoid
7775 !! wikitext
7776 #REDIRECT [[Image:Wiki.png]]
7777 !! html
7778 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
7779 !! end
7780
7781 !! test
7782 Redirect to language
7783 !! options
7784 parsoid
7785 !! wikitext
7786 #REDIRECT [[en:File:Wiki.png]]
7787 !! html
7788 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
7789 !! end
7790
7791 !! test
7792 Redirect to interwiki
7793 !! options
7794 parsoid
7795 !! wikitext
7796 #REDIRECT [[meatball:File:Wiki.png]]
7797 !! html
7798 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
7799 !! end
7800
7801 !! test
7802 Non-English #REDIRECT
7803 !! options
7804 parsoid
7805 language=is
7806 !! wikitext
7807 #TILVÍSUN [[Main Page]]
7808 !! html
7809 <link rel="mw:PageProp/redirect" href="./Main_Page">
7810 !! end
7811
7812 !! test
7813 New redirect
7814 !! options
7815 parsoid=html2wt
7816 !! html
7817 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"></p>
7818 !! wikitext
7819 Foo
7820 #REDIRECT [[Foo]]
7821 !! end
7822
7823 ##
7824 ## XHTML tidiness
7825 ###
7826
7827 !! test
7828 <br> to <br />
7829 !! wikitext
7830 1<br>2<br />3
7831 !! html
7832 <p>1<br />2<br />3
7833 </p>
7834 !! end
7835
7836 !! test
7837 Broken br tag sanitization
7838 !! wikitext
7839 </br>
7840 !! html/php
7841 <p>&lt;/br&gt;
7842 </p>
7843 !! end
7844
7845 # TODO: Fix html2html mode (bug 51055)!
7846 !! test
7847 Parsoid: Broken br tag recognition
7848 !! options
7849 parsoid=wt2html
7850 !! wikitext
7851 </br>
7852
7853 <br/ >
7854 !! html+tidy
7855 <p><br /></p>
7856 <p><br /></p>
7857 !! end
7858
7859 !! test
7860 Incorrecly removing closing slashes from correctly formed XHTML
7861 !! wikitext
7862 <br style="clear:both;" />
7863 !! html
7864 <p><br style="clear:both;" />
7865 </p>
7866 !! end
7867
7868 !! test
7869 Failing to transform badly formed HTML into correct XHTML
7870 !! wikitext
7871 <br style="clear: left;">
7872 <br style="clear: right;">
7873 <br style="clear: both;">
7874 !! html
7875 <p><br style="clear: left;" />
7876 <br style="clear: right;" />
7877 <br style="clear: both;" />
7878 </p>
7879 !!end
7880
7881 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
7882 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
7883 !! test
7884 Handling html with a div self-closing tag
7885 !! wikitext
7886 <div title />
7887 <div title/>
7888 <div title/ >
7889 <div title=bar />
7890 <div title=bar/>
7891 <div title=bar/ >
7892 !! html/php
7893 <p>&lt;div title /&gt;
7894 &lt;div title/&gt;
7895 </p>
7896 <div>
7897 <p>&lt;div title=bar /&gt;
7898 &lt;div title=bar/&gt;
7899 </p>
7900 <div title="bar/"></div>
7901 </div>
7902
7903 !! html/parsoid
7904 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
7905 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
7906 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
7907 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
7908 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
7909 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
7910 !! end
7911
7912 !! test
7913 Handling html with a br self-closing tag
7914 !! wikitext
7915 <br title />
7916 <br title/>
7917 <br title/ >
7918 <br title=bar />
7919 <br title=bar/>
7920 <br title=bar/ >
7921 !! html/php
7922 <p><br title="title" />
7923 <br title="title" />
7924 <br />
7925 <br title="bar" />
7926 <br title="bar" />
7927 <br title="bar/" />
7928 </p>
7929 !! html/parsoid
7930 <p><br title="" />
7931 <br title="" />
7932 <br title="" />
7933 <br title="bar" />
7934 <br title="bar" />
7935 <br title="bar/" />
7936 </p>
7937 !! end
7938
7939 !! test
7940 Horizontal ruler (should it add that extra space?)
7941 !! wikitext
7942 <hr>
7943 <hr >
7944 foo <hr
7945 > bar
7946 !! html+tidy
7947 <hr />
7948 <hr />
7949 <p>foo</p>
7950 <hr />
7951 <p>bar</p>
7952 !! end
7953
7954 !! test
7955 Horizontal ruler -- 4+ dashes render hr
7956 !! wikitext
7957 ----
7958 !! html
7959 <hr />
7960
7961 !! end
7962
7963 !! test
7964 Horizontal ruler -- eats additional dashes on the same line
7965 !! wikitext
7966 ---------
7967 !! html
7968 <hr />
7969
7970 !! end
7971
7972 !! test
7973 Horizontal ruler -- does not collapse dashes on consecutive lines
7974 !! wikitext
7975 ----
7976 ----
7977 !! html
7978 <hr />
7979 <hr />
7980
7981 !! end
7982
7983 !! test
7984 Horizontal ruler -- <4 dashes render as plain text
7985 !! wikitext
7986 ---
7987 !! html
7988 <p>---
7989 </p>
7990 !! end
7991
7992 !! test
7993 Horizontal ruler -- Supports content following dashes on same line
7994 !! wikitext
7995 ---- Foo
7996 !! html
7997 <hr /> Foo
7998
7999 !! html+tidy
8000 <hr />
8001 <p>Foo</p>
8002 !! end
8003
8004 ###
8005 ### Block-level elements
8006 ###
8007 !! test
8008 Common list
8009 !! wikitext
8010 *Common list
8011 * item 2
8012 *item 3
8013 !! html
8014 <ul><li>Common list</li>
8015 <li> item 2</li>
8016 <li>item 3</li></ul>
8017
8018 !! end
8019
8020 !! test
8021 Numbered list
8022 !! wikitext
8023 #Numbered list
8024 #item 2
8025 # item 3
8026 !! html
8027 <ol><li>Numbered list</li>
8028 <li>item 2</li>
8029 <li> item 3</li></ol>
8030
8031 !! end
8032
8033 !! test
8034 Mixed list
8035 !! wikitext
8036 *Mixed list
8037 *# with numbers
8038 ** and bullets
8039 *# and numbers
8040 *bullets again
8041 **bullet level 2
8042 ***bullet level 3
8043 ***#Number on level 4
8044 **bullet level 2
8045 **#Number on level 3
8046 **#Number on level 3
8047 *#number level 2
8048 *Level 1
8049 *** Level 3
8050 #** Level 3, but ordered
8051 !! html
8052 <ul><li>Mixed list
8053 <ol><li> with numbers</li></ol>
8054 <ul><li> and bullets</li></ul>
8055 <ol><li> and numbers</li></ol></li>
8056 <li>bullets again
8057 <ul><li>bullet level 2
8058 <ul><li>bullet level 3
8059 <ol><li>Number on level 4</li></ol></li></ul></li>
8060 <li>bullet level 2
8061 <ol><li>Number on level 3</li>
8062 <li>Number on level 3</li></ol></li></ul>
8063 <ol><li>number level 2</li></ol></li>
8064 <li>Level 1
8065 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
8066 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
8067
8068 !! end
8069
8070 !! test
8071 Nested lists 1
8072 !! wikitext
8073 *foo
8074 **bar
8075 !! html
8076 <ul><li>foo
8077 <ul><li>bar</li></ul></li></ul>
8078
8079 !! end
8080
8081 !! test
8082 Nested lists 2
8083 !! wikitext
8084 **foo
8085 *bar
8086 !! html
8087 <ul><li><ul><li>foo</li></ul></li>
8088 <li>bar</li></ul>
8089
8090 !! end
8091
8092 !! test
8093 Nested lists 3 (first element empty)
8094 !! wikitext
8095 *
8096 **bar
8097 !! html
8098 <ul><li>
8099 <ul><li>bar</li></ul></li></ul>
8100
8101 !! end
8102
8103 !! test
8104 Nested lists 4 (first element empty)
8105 !! wikitext
8106 **
8107 *bar
8108 !! html
8109 <ul><li><ul><li></li></ul></li>
8110 <li>bar</li></ul>
8111
8112 !! end
8113
8114 !! test
8115 Nested lists 5 (both elements empty)
8116 !! wikitext
8117 **
8118 *
8119 !! html
8120 <ul><li><ul><li></li></ul></li>
8121 <li></li></ul>
8122
8123 !! end
8124
8125 !! test
8126 Nested lists 6 (both elements empty)
8127 !! wikitext
8128 *
8129 **
8130 !! html
8131 <ul><li>
8132 <ul><li></li></ul></li></ul>
8133
8134 !! end
8135
8136 !! test
8137 Nested lists 7 (skip initial nesting levels)
8138 !! wikitext
8139 *** foo
8140 !! html
8141 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
8142
8143 !! end
8144
8145 !! test
8146 Nested lists 8 (multiple nesting transitions)
8147 !! wikitext
8148 * foo
8149 *** bar
8150 ** baz
8151 * boo
8152 !! html
8153 <ul><li> foo
8154 <ul><li><ul><li> bar</li></ul></li>
8155 <li> baz</li></ul></li>
8156 <li> boo</li></ul>
8157
8158 !! end
8159
8160 !! test
8161 Nested lists 9 (extension interaction)
8162 !! options
8163 parsoid
8164 !! wikitext
8165 *<references />
8166 !! html/parsoid
8167 <ul><li data-parsoid='{}'><ol class="references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
8168 !! end
8169
8170 !! test
8171 1. Lists with start-of-line-transparent tokens before bullets: Comments
8172 !! wikitext
8173 *foo
8174 *<!--cmt-->bar
8175 <!--cmt-->*baz
8176 !! html
8177 <ul><li>foo</li>
8178 <li>bar</li>
8179 <li>baz</li></ul>
8180
8181 !! end
8182
8183 !! test
8184 2. Lists with start-of-line-transparent tokens before bullets: Template close
8185 !! wikitext
8186 *foo {{echo|bar
8187 }}*baz
8188 !! html
8189 <ul><li>foo bar</li>
8190 <li>baz</li></ul>
8191
8192 !! end
8193
8194 !! test
8195 List items are not parsed correctly following a <pre> block (bug 785)
8196 !! wikitext
8197 * <pre>foo</pre>
8198 * <pre>bar</pre>
8199 * zar
8200 !! html
8201 <ul><li> <pre>foo</pre></li>
8202 <li> <pre>bar</pre></li>
8203 <li> zar</li></ul>
8204
8205 !! end
8206
8207 !! test
8208 List items from template
8209 !! wikitext
8210
8211 {{inner list}}
8212 * item 2
8213
8214 * item 0
8215 {{inner list}}
8216 * item 2
8217
8218 * item 0
8219 * notSOL{{inner list}}
8220 * item 2
8221 !! html
8222 <ul><li> item 1</li>
8223 <li> item 2</li></ul>
8224 <ul><li> item 0</li>
8225 <li> item 1</li>
8226 <li> item 2</li></ul>
8227 <ul><li> item 0</li>
8228 <li> notSOL</li>
8229 <li> item 1</li>
8230 <li> item 2</li></ul>
8231
8232 !! end
8233
8234 !! test
8235 List interrupted by empty line or heading
8236 !! wikitext
8237 * foo
8238
8239 ** bar
8240 == A heading ==
8241 * Another list item
8242 !! html
8243 <ul><li> foo</li></ul>
8244 <ul><li><ul><li> bar</li></ul></li></ul>
8245 <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>
8246 <ul><li> Another list item</li></ul>
8247
8248 !!end
8249
8250 !!test
8251 Multiple list tags generated by templates
8252 !! wikitext
8253 {{echo|<li>}}a
8254 {{echo|<li>}}b
8255 {{echo|<li>}}c
8256 !! html
8257 <li>a
8258 <li>b
8259 <li>c</li>
8260 </li>
8261 </li>
8262
8263 !! html+tidy
8264 <ul>
8265 <li>a</li>
8266 <li>b</li>
8267 <li>c</li>
8268 </ul>
8269 !!end
8270
8271 !!test
8272 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
8273 !! wikitext
8274 *a
8275 <!--This line will NOT split the list-->
8276 *b
8277 <!--This line will NOT split the list either-->
8278 *c
8279 <!--foo--> <!----> <!--This line NOT split the list either-->
8280 *d
8281 !! html
8282 <ul><li>a</li>
8283 <li>b</li>
8284 <li>c</li>
8285 <li>d</li></ul>
8286
8287 !!end
8288
8289 !!test
8290 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
8291 !! wikitext
8292 *a
8293 <!--This line will NOT split the list-->
8294 *b
8295 <!--This line will NOT split the list either-->
8296 *c
8297 <!--foo--> <!----> <!--This line NOT split the list
8298 either-->
8299 *d
8300 !! html
8301 <ul><li>a</li>
8302 <li>b</li>
8303 <li>c</li>
8304 <li>d</li></ul>
8305
8306 !!end
8307
8308 !!test
8309 Test the li-hack
8310 (The PHP parser relies on Tidy for the hack)
8311 !!options
8312 parsoid=wt2html,wt2wt
8313 !! wikitext
8314 * foo
8315 * <li>li-hack
8316 * {{echo|<li>templated li-hack}}
8317 * <!--foo--> <li> unsupported li-hack with preceding comments
8318
8319 <ul>
8320 <li><li>not a li-hack
8321 </li>
8322 </ul>
8323 !! html+tidy
8324 <ul>
8325 <li>foo</li>
8326 <li>li-hack</li>
8327 <li>templated li-hack</li>
8328 <li>unsupported li-hack with preceding comments</li>
8329 </ul>
8330 <ul>
8331 <li>not a li-hack</li>
8332 </ul>
8333 !!end
8334
8335 !! test
8336 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
8337 !! options
8338 parsoid
8339 !! wikitext
8340 # foo
8341 ## bar
8342 * foo
8343 ** bar
8344 : foo
8345 :: bar
8346 !! html
8347 <ol>
8348 <li> foo<ol>
8349 <li> bar</li>
8350 </ol></li>
8351 </ol><ul>
8352 <li> foo<ul>
8353 <li> bar</li>
8354 </ul></li>
8355 </ul><dl>
8356 <dd> foo<dl>
8357 <dd> bar</dd>
8358 </dl></dd>
8359 </dl>
8360 !! end
8361
8362 !! test
8363 Parsoid: Test of whitespace serialization with Templated bullets
8364 !! options
8365 parsoid
8366 !! wikitext
8367 * {{bullet}}
8368 !! html
8369 <ul>
8370 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
8371 </ul>
8372 !! end
8373
8374 # ------------------------------------------------------------------------
8375 # The next set of tests are about Parsoid's ability to handle badly nested
8376 # tags (parse, minimize scope of fixup, and roundtrip back)
8377 # ------------------------------------------------------------------------
8378
8379 !! test
8380 Unbalanced closing block tags break a list
8381 (php parser relies on Tidy to fix up)
8382 !! wikitext
8383 <div>
8384 *a</div><div>
8385 *b</div>
8386 !! html+tidy
8387 <div>
8388 <ul>
8389 <li>a</li>
8390 </ul>
8391 </div>
8392 <div>
8393 <ul>
8394 <li>b</li>
8395 </ul>
8396 </div>
8397 !! end
8398
8399 # Parsoid fails this test, but it might be tricky to support properly.
8400 # See bug 68395.
8401 !! test
8402 Unbalanced closing non-block tags don't break a list
8403 (php parser relies on Tidy to fix up)
8404 !! wikitext
8405 <span>
8406 *a</span><span>
8407 *b</span>
8408 !! html/php+tidy
8409 <ul>
8410 <li><span>a</span></li>
8411 <li><span>b</span></li>
8412 </ul>
8413 !! html/parsoid
8414 <span>
8415 <ul>
8416 <li>a<span></span>
8417 </li>
8418 <li>b
8419 </li>
8420 </ul>
8421 </span>
8422 !! end
8423
8424 !! test
8425 Unclosed formatting tags that straddle lists are closed and reopened
8426 (php parser relies on Tidy to fix up)
8427 !! options
8428 parsoid=wt2html,wt2wt,html2html
8429 !! wikitext
8430 # <s> a
8431 # b </s>
8432 !! html/php+tidy
8433 <ol>
8434 <li><s>a</s></li>
8435 <li><s>b</s></li>
8436 </ol>
8437 !! html/parsoid
8438 <ol><li> <s> a</s></li>
8439 <li><s> b </s></li></ol>
8440 !! end
8441
8442 # See bug 68395.
8443 !!test
8444 1. List embedded in a formatting tag
8445 !! wikitext
8446 <small>
8447 * foo
8448 </small>
8449 !! html/php+tidy
8450 <ul>
8451 <li><small>foo</small></li>
8452 </ul>
8453 !! html/parsoid
8454 <small>
8455 <ul>
8456 <li> foo</li>
8457 </ul>
8458 </small>
8459 !!end
8460
8461 ## Ugly Parsoid output here
8462 ## Not sure what the right output is.
8463 !!test
8464 2. List embedded in a formatting tag
8465 !! wikitext
8466 <small>
8467 *a
8468 *b</small>
8469 !! html/php+tidy
8470 <ul>
8471 <li><small>a</small></li>
8472 <li><small>b</small></li>
8473 </ul>
8474 !! html/parsoid
8475 <small></small>
8476 <ul><small>
8477 <li>a</li>
8478 </small>
8479 <li><small>b</small></li>
8480 </ul>
8481 !!end
8482
8483 # Ugly Parsoid and PHP parser output here
8484 # Not sure if we want to make this a test!
8485 #
8486 ## !!test
8487 ## 3. Unclosed formatting tags in list elements
8488 ## !! wikitext
8489 ## *<small>a
8490 ## *<small>b
8491 ## !! html/php+tidy
8492 ## <ul>
8493 ## <li><small>a</small></li>
8494 ## <li><small><small>b</small></small></li>
8495 ## </ul>
8496 ## !! html/parsoid
8497 ## <ul>
8498 ## <li><small>a</small></li>
8499 ## <small>
8500 ## <li><small>b</small></li>
8501 ## </small></ul>
8502 ## !!end
8503
8504 # This is a bug in the PHP parser + tidy combination.
8505 # (The </tr> tag gets parsed as text and html-escaped by PHP,
8506 # and then fostered out of the table by tidy.)
8507 # We believe the Parsoid output to be correct.
8508 !! test
8509 Table with missing opening <tr> tag
8510 !! options
8511 parsoid=wt2html,wt2wt
8512 !! wikitext
8513 <table>
8514 <td>foo</td>
8515 </tr>
8516 </table>
8517 !! html+tidy
8518 <table>
8519 <tr>
8520 <td>foo</td>
8521 </tr>
8522 </table>
8523 !! end
8524
8525 ###
8526 ### Magic Words
8527 ###
8528
8529 # Note that the current date is hard-coded as
8530 # 1970-01-01T00:02:03Z (a Thursday)
8531 # when running parser tests. The timezone is also fixed to GMT, so
8532 # local date will be identical to current date.
8533
8534 !! test
8535 Magic Word: {{CURRENTDAY}}
8536 !! wikitext
8537 {{CURRENTDAY}}
8538 !! html
8539 <p>1
8540 </p>
8541 !! end
8542
8543 !! test
8544 Magic Word: {{CURRENTDAY2}}
8545 !! wikitext
8546 {{CURRENTDAY2}}
8547 !! html
8548 <p>01
8549 </p>
8550 !! end
8551
8552 !! test
8553 Magic Word: {{CURRENTDAYNAME}}
8554 !! wikitext
8555 {{CURRENTDAYNAME}}
8556 !! html
8557 <p>Thursday
8558 </p>
8559 !! end
8560
8561 !! test
8562 Magic Word: {{CURRENTDOW}}
8563 !! wikitext
8564 {{CURRENTDOW}}
8565 !! html
8566 <p>4
8567 </p>
8568 !! end
8569
8570 !! test
8571 Magic Word: {{CURRENTMONTH}}
8572 !! wikitext
8573 {{CURRENTMONTH}}
8574 !! html
8575 <p>01
8576 </p>
8577 !! end
8578
8579 !! test
8580 Magic Word: {{CURRENTMONTH1}}
8581 !! wikitext
8582 {{CURRENTMONTH1}}
8583 !! html
8584 <p>1
8585 </p>
8586 !! end
8587
8588 !! test
8589 Magic Word: {{CURRENTMONTHABBREV}}
8590 !! wikitext
8591 {{CURRENTMONTHABBREV}}
8592 !! html
8593 <p>Jan
8594 </p>
8595 !! end
8596
8597 !! test
8598 Magic Word: {{CURRENTMONTHNAME}}
8599 !! wikitext
8600 {{CURRENTMONTHNAME}}
8601 !! html
8602 <p>January
8603 </p>
8604 !! end
8605
8606 !! test
8607 Magic Word: {{CURRENTMONTHNAMEGEN}}
8608 !! wikitext
8609 {{CURRENTMONTHNAMEGEN}}
8610 !! html
8611 <p>January
8612 </p>
8613 !! end
8614
8615 !! test
8616 Magic Word: {{CURRENTTIME}}
8617 !! wikitext
8618 {{CURRENTTIME}}
8619 !! html
8620 <p>00:02
8621 </p>
8622 !! end
8623
8624 !! test
8625 Magic Word: {{CURRENTHOUR}}
8626 !! wikitext
8627 {{CURRENTHOUR}}
8628 !! html
8629 <p>00
8630 </p>
8631 !! end
8632
8633 !! test
8634 Magic Word: {{CURRENTWEEK}} (@bug 4594)
8635 !! wikitext
8636 {{CURRENTWEEK}}
8637 !! html
8638 <p>1
8639 </p>
8640 !! end
8641
8642 !! test
8643 Magic Word: {{CURRENTYEAR}}
8644 !! wikitext
8645 {{CURRENTYEAR}}
8646 !! html
8647 <p>1970
8648 </p>
8649 !! end
8650
8651 !! test
8652 Magic Word: {{CURRENTTIMESTAMP}}
8653 !! wikitext
8654 {{CURRENTTIMESTAMP}}
8655 !! html
8656 <p>19700101000203
8657 </p>
8658 !! end
8659
8660 !! test
8661 Magic Words LOCAL (UTC)
8662 !! wikitext
8663 * {{LOCALMONTH}}
8664 * {{LOCALMONTH1}}
8665 * {{LOCALMONTHNAME}}
8666 * {{LOCALMONTHNAMEGEN}}
8667 * {{LOCALMONTHABBREV}}
8668 * {{LOCALDAY}}
8669 * {{LOCALDAY2}}
8670 * {{LOCALDAYNAME}}
8671 * {{LOCALYEAR}}
8672 * {{LOCALTIME}}
8673 * {{LOCALHOUR}}
8674 * {{LOCALWEEK}}
8675 * {{LOCALDOW}}
8676 * {{LOCALTIMESTAMP}}
8677 !! html
8678 <ul><li> 01</li>
8679 <li> 1</li>
8680 <li> January</li>
8681 <li> January</li>
8682 <li> Jan</li>
8683 <li> 1</li>
8684 <li> 01</li>
8685 <li> Thursday</li>
8686 <li> 1970</li>
8687 <li> 00:02</li>
8688 <li> 00</li>
8689 <li> 1</li>
8690 <li> 4</li>
8691 <li> 19700101000203</li></ul>
8692
8693 !! end
8694
8695 !! test
8696 Magic Word: {{FULLPAGENAME}}
8697 !! options
8698 title=[[User:Ævar Arnfjörð Bjarmason]]
8699 !! wikitext
8700 {{FULLPAGENAME}}
8701 !! html
8702 <p>User:Ævar Arnfjörð Bjarmason
8703 </p>
8704 !! end
8705
8706 !! test
8707 Magic Word: {{FULLPAGENAMEE}}
8708 !! options
8709 title=[[User:Ævar Arnfjörð Bjarmason]]
8710 !! wikitext
8711 {{FULLPAGENAMEE}}
8712 !! html
8713 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8714 </p>
8715 !! end
8716
8717 !! test
8718 Magic Word: {{TALKSPACE}}
8719 !! options
8720 title=[[User:Ævar Arnfjörð Bjarmason]]
8721 !! wikitext
8722 {{TALKSPACE}}
8723 !! html
8724 <p>User talk
8725 </p>
8726 !! end
8727
8728 !! test
8729 Magic Word: {{TALKSPACE}}, same namespace
8730 !! options
8731 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8732 !! wikitext
8733 {{TALKSPACE}}
8734 !! html
8735 <p>User talk
8736 </p>
8737 !! end
8738
8739 !! test
8740 Magic Word: {{TALKSPACE}}, main namespace
8741 !! options
8742 title=[[Parser Test]]
8743 !! wikitext
8744 {{TALKSPACE}}
8745 !! html
8746 <p>Talk
8747 </p>
8748 !! end
8749
8750 !! test
8751 Magic Word: {{TALKSPACEE}}
8752 !! options
8753 title=[[User:Ævar Arnfjörð Bjarmason]]
8754 !! wikitext
8755 {{TALKSPACEE}}
8756 !! html
8757 <p>User_talk
8758 </p>
8759 !! end
8760
8761 !! test
8762 Magic Word: {{SUBJECTSPACE}}
8763 !! options
8764 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8765 !! wikitext
8766 {{SUBJECTSPACE}}
8767 !! html
8768 <p>User
8769 </p>
8770 !! end
8771
8772 !! test
8773 Magic Word: {{SUBJECTSPACE}}, same namespace
8774 !! options
8775 title=[[User:Ævar Arnfjörð Bjarmason]]
8776 !! wikitext
8777 {{SUBJECTSPACE}}
8778 !! html
8779 <p>User
8780 </p>
8781 !! end
8782
8783 !! test
8784 Magic Word: {{SUBJECTSPACE}}, main namespace
8785 !! options
8786 title=[[Parser Test]]
8787 !! wikitext
8788 {{SUBJECTSPACE}}
8789 !! html
8790
8791 !! end
8792
8793 !! test
8794 Magic Word: {{SUBJECTSPACEE}}
8795 !! options
8796 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8797 !! wikitext
8798 {{SUBJECTSPACEE}}
8799 !! html
8800 <p>User
8801 </p>
8802 !! end
8803
8804 !! test
8805 Magic Word: {{NAMESPACE}}
8806 !! options
8807 title=[[User:Ævar Arnfjörð Bjarmason]]
8808 !! wikitext
8809 {{NAMESPACE}}
8810 !! html
8811 <p>User
8812 </p>
8813 !! end
8814
8815 !! test
8816 Magic Word: {{NAMESPACEE}}
8817 !! options
8818 title=[[User:Ævar Arnfjörð Bjarmason]]
8819 !! wikitext
8820 {{NAMESPACEE}}
8821 !! html
8822 <p>User
8823 </p>
8824 !! end
8825
8826 !! test
8827 Magic Word: {{NAMESPACENUMBER}}
8828 !! options
8829 title=[[User:Ævar Arnfjörð Bjarmason]]
8830 !! wikitext
8831 {{NAMESPACENUMBER}}
8832 !! html
8833 <p>2
8834 </p>
8835 !! end
8836
8837 !! test
8838 Magic Word: {{SUBPAGENAME}}
8839 !! options
8840 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
8841 !! wikitext
8842 {{SUBPAGENAME}}
8843 !! html
8844 <p>sub ö
8845 </p>
8846 !! end
8847
8848 !! test
8849 Magic Word: {{SUBPAGENAMEE}}
8850 !! options
8851 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
8852 !! wikitext
8853 {{SUBPAGENAMEE}}
8854 !! html
8855 <p>sub_%C3%B6
8856 </p>
8857 !! end
8858
8859 !! test
8860 Magic Word: {{ROOTPAGENAME}}
8861 !! options
8862 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
8863 !! wikitext
8864 {{ROOTPAGENAME}}
8865 !! html
8866 <p>Ævar Arnfjörð Bjarmason
8867 </p>
8868 !! end
8869
8870 !! test
8871 Magic Word: {{ROOTPAGENAMEE}}
8872 !! options
8873 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
8874 !! wikitext
8875 {{ROOTPAGENAMEE}}
8876 !! html
8877 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8878 </p>
8879 !! end
8880
8881 !! test
8882 Magic Word: {{BASEPAGENAME}}
8883 !! options
8884 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
8885 !! wikitext
8886 {{BASEPAGENAME}}
8887 !! html
8888 <p>Ævar Arnfjörð Bjarmason
8889 </p>
8890 !! end
8891
8892 !! test
8893 Magic Word: {{BASEPAGENAMEE}}
8894 !! options
8895 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
8896 !! wikitext
8897 {{BASEPAGENAMEE}}
8898 !! html
8899 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8900 </p>
8901 !! end
8902
8903 !! test
8904 Magic Word: {{TALKPAGENAME}}
8905 !! options
8906 title=[[User:Ævar Arnfjörð Bjarmason]]
8907 !! wikitext
8908 {{TALKPAGENAME}}
8909 !! html
8910 <p>User talk:Ævar Arnfjörð Bjarmason
8911 </p>
8912 !! end
8913
8914 !! test
8915 Magic Word: {{TALKPAGENAMEE}}
8916 !! options
8917 title=[[User:Ævar Arnfjörð Bjarmason]]
8918 !! wikitext
8919 {{TALKPAGENAMEE}}
8920 !! html
8921 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8922 </p>
8923 !! end
8924
8925 !! test
8926 Magic Word: {{SUBJECTPAGENAME}}
8927 !! options
8928 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8929 !! wikitext
8930 {{SUBJECTPAGENAME}}
8931 !! html
8932 <p>User:Ævar Arnfjörð Bjarmason
8933 </p>
8934 !! end
8935
8936 !! test
8937 Magic Word: {{SUBJECTPAGENAMEE}}
8938 !! options
8939 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8940 !! wikitext
8941 {{SUBJECTPAGENAMEE}}
8942 !! html
8943 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8944 </p>
8945 !! end
8946
8947 !! test
8948 Magic Word: {{NUMBEROFFILES}}
8949 !! wikitext
8950 {{NUMBEROFFILES}}
8951 !! html
8952 <p>5
8953 </p>
8954 !! end
8955
8956 !! test
8957 Magic Word: {{PAGENAME}}
8958 !! options
8959 title=[[User:Ævar Arnfjörð Bjarmason]]
8960 !! wikitext
8961 {{PAGENAME}}
8962 !! html
8963 <p>Ævar Arnfjörð Bjarmason
8964 </p>
8965 !! end
8966
8967 !! test
8968 Magic Word: {{PAGENAME}} with metacharacters
8969 !! options
8970 title=[['foo & bar = baz']]
8971 !! wikitext
8972 ''{{PAGENAME}}''
8973 !! html/php
8974 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
8975 </p>
8976 !! html+tidy
8977 <p><i>'foo &amp; bar = baz'</i></p>
8978 !! end
8979
8980 !! test
8981 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
8982 !! options
8983 title=[[*RFC 1234 http://example.com/]]
8984 !! wikitext
8985 {{PAGENAME}}
8986 !! html/php
8987 <p>&#42;RFC&#32;1234 http&#58;//example.com/
8988 </p>
8989 !! html+tidy
8990 <p>*RFC 1234 http://example.com/</p>
8991 !! end
8992
8993 !! test
8994 Magic Word: {{PAGENAMEE}}
8995 !! options
8996 title=[[User:Ævar Arnfjörð Bjarmason]]
8997 !! wikitext
8998 {{PAGENAMEE}}
8999 !! html
9000 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9001 </p>
9002 !! end
9003
9004 !! test
9005 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
9006 !! options
9007 title=[[*RFC 1234 http://example.com/]]
9008 !! wikitext
9009 {{PAGENAMEE}}
9010 !! html/php
9011 <p>&#42;RFC_1234_http&#58;//example.com/
9012 </p>
9013 !! html+tidy
9014 <p>*RFC_1234_http://example.com/</p>
9015 !! end
9016
9017 !! test
9018 Magic Word: {{REVISIONID}}
9019 !! wikitext
9020 {{REVISIONID}}
9021 !! html
9022 <p>1337
9023 </p>
9024 !! end
9025
9026 !! test
9027 Magic Word: {{SCRIPTPATH}}
9028 !! wikitext
9029 {{SCRIPTPATH}}
9030 !! html
9031 <p>/
9032 </p>
9033 !! end
9034
9035 !! test
9036 Magic Word: {{STYLEPATH}}
9037 !! wikitext
9038 {{STYLEPATH}}
9039 !! html
9040 <p>/skins
9041 </p>
9042 !! end
9043
9044 !! test
9045 Magic Word: {{SERVER}}
9046 !! wikitext
9047 {{SERVER}}
9048 !! html
9049 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9050 </p>
9051 !! end
9052
9053 !! test
9054 Magic Word: {{SERVERNAME}}
9055 !! wikitext
9056 {{SERVERNAME}}
9057 !! html
9058 <p>example.org
9059 </p>
9060 !! end
9061
9062 !! test
9063 Magic Word: {{SITENAME}}
9064 !! wikitext
9065 {{SITENAME}}
9066 !! html
9067 <p>MediaWiki
9068 </p>
9069 !! end
9070
9071 !! test
9072 Case-sensitive magic words, when cased differently, should just be template transclusions
9073 !! wikitext
9074 {{CurrentMonth}}
9075 {{currentday}}
9076 {{cURreNTweEK}}
9077 {{currentHour}}
9078 !! html
9079 <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>
9080 <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>
9081 <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>
9082 <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>
9083 </p>
9084 !! end
9085
9086 !! test
9087 Case-insensitive magic words should still work with weird casing.
9088 !! wikitext
9089 {{sErVeRNaMe}}
9090 {{LCFirst:AOEU}}
9091 {{ucFIRST:aoeu}}
9092 {{SERver}}
9093 !! html
9094 <p>example.org
9095 aOEU
9096 Aoeu
9097 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9098 </p>
9099 !! end
9100
9101 # From plwiki:PLOS_ONE
9102 !! test
9103 Parsoid: Page property magic word with magic word contents
9104 !! wikitext
9105 {{DISPLAYTITLE:''{{PAGENAME}}''}}
9106 !! html/parsoid
9107 <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>"}]]}'/>
9108 !! end
9109
9110 !! test
9111 Parsoid: Template-generated DISPLAYTITLE
9112 !! wikitext
9113 {{{{echo|DISPLAYTITLE}}:Foo}}
9114 !! html/parsoid
9115 <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}}]}'/>
9116 !! end
9117
9118 !! test
9119 Namespace 1 {{ns:1}}
9120 !! wikitext
9121 {{ns:1}}
9122 !! html
9123 <p>Talk
9124 </p>
9125 !! end
9126
9127 !! test
9128 Namespace 1 {{ns:01}}
9129 !! wikitext
9130 {{ns:01}}
9131 !! html
9132 <p>Talk
9133 </p>
9134 !! end
9135
9136 !! test
9137 Namespace 0 {{ns:0}} (bug 4783)
9138 !! wikitext
9139 {{ns:0}}
9140 !! html
9141
9142 !! end
9143
9144 !! test
9145 Namespace 0 {{ns:00}} (bug 4783)
9146 !! wikitext
9147 {{ns:00}}
9148 !! html
9149
9150 !! end
9151
9152 !! test
9153 Namespace -1 {{ns:-1}}
9154 !! wikitext
9155 {{ns:-1}}
9156 !! html
9157 <p>Special
9158 </p>
9159 !! end
9160
9161 !! test
9162 Namespace User {{ns:User}}
9163 !! wikitext
9164 {{ns:User}}
9165 !! html
9166 <p>User
9167 </p>
9168 !! end
9169
9170 !! test
9171 Namespace User talk {{ns:User_talk}}
9172 !! wikitext
9173 {{ns:User_talk}}
9174 !! html
9175 <p>User talk
9176 </p>
9177 !! end
9178
9179 !! test
9180 Namespace User talk {{ns:uSeR tAlK}}
9181 !! wikitext
9182 {{ns:uSeR tAlK}}
9183 !! html
9184 <p>User talk
9185 </p>
9186 !! end
9187
9188 !! test
9189 Namespace File {{ns:File}}
9190 !! wikitext
9191 {{ns:File}}
9192 !! html
9193 <p>File
9194 </p>
9195 !! end
9196
9197 !! test
9198 Namespace File {{ns:Image}}
9199 !! wikitext
9200 {{ns:Image}}
9201 !! html
9202 <p>File
9203 </p>
9204 !! end
9205
9206 !! test
9207 Namespace (lang=de) Benutzer {{ns:User}}
9208 !! options
9209 language=de
9210 !! wikitext
9211 {{ns:User}}
9212 !! html
9213 <p>Benutzer
9214 </p>
9215 !! end
9216
9217 !! test
9218 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
9219 !! options
9220 language=de
9221 !! wikitext
9222 {{ns:3}}
9223 !! html
9224 <p>Benutzer Diskussion
9225 </p>
9226 !! end
9227
9228
9229 !! test
9230 Urlencode
9231 !! wikitext
9232 {{urlencode:hi world?!}}
9233 {{urlencode:hi world?!|WIKI}}
9234 {{urlencode:hi world?!|PATH}}
9235 {{urlencode:hi world?!|QUERY}}
9236 !! html
9237 <p>hi+world%3F%21
9238 hi_world%3F!
9239 hi%20world%3F%21
9240 hi+world%3F%21
9241 </p>
9242 !! end
9243
9244 !! test
9245 Magic Word: prioritize type info over data-parsoid
9246 !! options
9247 parsoid=html2wt
9248 !! html
9249 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
9250 !! wikitext
9251 __FORCETOC__
9252 !! end
9253
9254 !! test
9255 Magic Word: serialize on separate line (parsoid)
9256 !! options
9257 parsoid=wt2wt,html2wt
9258 !! wikitext
9259 foo
9260 __NOTOC__
9261 bar
9262 !! html
9263 foo<meta property="mw:PageProp/notoc"/>bar
9264 !! end
9265
9266 !! test
9267 Magic Word: rt non-english wikis
9268 !! options
9269 parsoid=wt2wt
9270 language=de
9271 !! wikitext
9272 __NOEDITSECTION__
9273 !! html
9274 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
9275 !! end
9276
9277 ###
9278 ### Magic links
9279 ###
9280 !! test
9281 Magic links: internal link to RFC (bug 479)
9282 !! wikitext
9283 [[RFC 123]]
9284 !! html
9285 <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>
9286 </p>
9287 !! end
9288
9289 !! test
9290 Magic links: RFC (bug 479)
9291 !! wikitext
9292 RFC 822
9293 !! html
9294 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
9295 </p>
9296 !! end
9297
9298 !! test
9299 Magic links: RFC (bug 65278)
9300 !! wikitext
9301 This is RFC 822 but thisRFC 822 is not RFC 822linked.
9302 !! html
9303 <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.
9304 </p>
9305 !! end
9306
9307 !! test
9308 Magic links: RFC (w/ non-newline whitespace, bug 28950/29025)
9309 !! wikitext
9310 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
9311 RFC
9312 822
9313 !! html
9314 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
9315 RFC
9316 822
9317 </p>
9318 !! end
9319
9320 !! test
9321 Magic links: ISBN (bug 1937)
9322 !! wikitext
9323 ISBN 0-306-40615-2
9324 !! html
9325 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
9326 </p>
9327 !! end
9328
9329 !! test
9330 Magic links: ISBN (bug 65278)
9331 !! wikitext
9332 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
9333 !! html/php
9334 <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.
9335 </p>
9336 !! html/parsoid
9337 <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>
9338 !! end
9339
9340 !! test
9341 Magic links: ISBN (w/ non-newline whitespace, bug 28950/29025)
9342 !! wikitext
9343 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
9344 ISBN
9345 9780316098113
9346 ISBN 978
9347 0316098113
9348 !! html
9349 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
9350 ISBN
9351 9780316098113
9352 ISBN 978
9353 0316098113
9354 </p>
9355 !! end
9356
9357 !! test
9358 Magic links: PMID incorrectly converts space to underscore
9359 !! wikitext
9360 PMID 1234
9361 !! html
9362 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
9363 </p>
9364 !! end
9365
9366 !! test
9367 Magic links: PMID (bug 65278)
9368 !! wikitext
9369 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
9370 !! html
9371 <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.
9372 </p>
9373 !! end
9374
9375 !! test
9376 Magic links: PMID (w/ non-newline whitespace, bug 28950/29025)
9377 !! wikitext
9378 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
9379 PMID
9380 1234
9381 !! html
9382 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
9383 PMID
9384 1234
9385 </p>
9386 !! end
9387
9388 ###
9389 ### Templates
9390 ####
9391
9392 !! test
9393 Nonexistent template
9394 !! wikitext
9395 {{thistemplatedoesnotexist}}
9396 !! html
9397 <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>
9398 </p>
9399 !! end
9400
9401 !! test
9402 Template with invalid target containing tags
9403 !! wikitext
9404 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
9405 !! html
9406 <p>{{a<b>b</b>|foo|a=b|a = b}}
9407 </p>
9408 !! end
9409
9410 !! test
9411 Template with invalid target containing unclosed tag
9412 !! wikitext
9413 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
9414 !! html
9415 <p>{{a<b>|foo|a=b|a = b}}</b>
9416 </p>
9417 !! end
9418
9419 !! test
9420 Template with invalid target containing wikilink
9421 !! wikitext
9422 {{[[Main Page]]}}
9423 !! html/php
9424 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
9425 </p>
9426 !! html/parsoid
9427 <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>
9428 !! end
9429
9430 !! test
9431 Template with just whitespace in it, bug #68421
9432 !! wikitext
9433 {{echo|{{ }}}}
9434 !! html/parsoid
9435 <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>
9436 !! end
9437
9438 !! article
9439 Template:test
9440 !! text
9441 This is a test template
9442 !! endarticle
9443
9444 !! test
9445 Simple template
9446 !! wikitext
9447 {{test}}
9448 !! html
9449 <p>This is a test template
9450 </p>
9451 !! end
9452
9453 !! test
9454 Template with explicit namespace
9455 !! wikitext
9456 {{Template:test}}
9457 !! html
9458 <p>This is a test template
9459 </p>
9460 !! end
9461
9462
9463 !! article
9464 Template:paramtest
9465 !! text
9466 This is a test template with parameter {{{param}}}
9467 !! endarticle
9468
9469 !! test
9470 Template parameter
9471 !! wikitext
9472 {{paramtest|param=foo}}
9473 !! html
9474 <p>This is a test template with parameter foo
9475 </p>
9476 !! end
9477
9478 !! article
9479 Template:paramtestnum
9480 !! text
9481 [[{{{1}}}|{{{2}}}]]
9482 !! endarticle
9483
9484 !! test
9485 Template unnamed parameter
9486 !! wikitext
9487 {{paramtestnum|Main Page|the main page}}
9488 !! html
9489 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
9490 </p>
9491 !! end
9492
9493 !! article
9494 Template:templatesimple
9495 !! text
9496 (test)
9497 !! endarticle
9498
9499 !! article
9500 Template:templateredirect
9501 !! text
9502 #redirect [[Template:templatesimple]]
9503 !! endarticle
9504
9505 !! article
9506 Template:templateasargtestnum
9507 !! text
9508 {{{{{1}}}}}
9509 !! endarticle
9510
9511 !! article
9512 Template:templateasargtest
9513 !! text
9514 {{template{{{templ}}}}}
9515 !! endarticle
9516
9517 !! article
9518 Template:templateasargtest2
9519 !! text
9520 {{{{{templ}}}}}
9521 !! endarticle
9522
9523 !! test
9524 Template with template name as unnamed argument
9525 !! wikitext
9526 {{templateasargtestnum|templatesimple}}
9527 !! html
9528 <p>(test)
9529 </p>
9530 !! end
9531
9532 !! test
9533 Template with template name as argument
9534 !! wikitext
9535 {{templateasargtest|templ=simple}}
9536 !! html
9537 <p>(test)
9538 </p>
9539 !! end
9540
9541 !! test
9542 Template with template name as argument (2)
9543 !! wikitext
9544 {{templateasargtest2|templ=templatesimple}}
9545 !! html
9546 <p>(test)
9547 </p>
9548 !! end
9549
9550 !! article
9551 Template:templateasargtestdefault
9552 !! text
9553 {{{{{templ|templatesimple}}}}}
9554 !! endarticle
9555
9556 !! article
9557 Template:templa
9558 !! text
9559 '''templ'''
9560 !! endarticle
9561
9562 !! test
9563 Template with default value
9564 !! wikitext
9565 {{templateasargtestdefault}}
9566 !! html
9567 <p>(test)
9568 </p>
9569 !! end
9570
9571 !! test
9572 Template with default value (value set)
9573 !! wikitext
9574 {{templateasargtestdefault|templ=templa}}
9575 !! html
9576 <p><b>templ</b>
9577 </p>
9578 !! end
9579
9580 !! test
9581 Template redirect
9582 !! wikitext
9583 {{templateredirect}}
9584 !! html
9585 <p>(test)
9586 </p>
9587 !! end
9588
9589 !! test
9590 Template with argument in separate line
9591 !! wikitext
9592 {{ templateasargtest |
9593 templ = simple }}
9594 !! html
9595 <p>(test)
9596 </p>
9597 !! end
9598
9599 !! test
9600 Template with complex template as argument
9601 !! wikitext
9602 {{paramtest|
9603 param ={{ templateasargtest |
9604 templ = simple }}}}
9605 !! html
9606 <p>This is a test template with parameter (test)
9607 </p>
9608 !! end
9609
9610 !! test
9611 Template with thumb image (with link in description)
9612 !! wikitext
9613 {{paramtest|param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
9614 !! html/php
9615 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>
9616
9617 !! html+tidy
9618 <p>This is a test template with parameter</p>
9619 <div class="thumb tright">
9620 <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>
9621 <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>
9622 </div>
9623 </div>
9624 !! html/parsoid
9625 <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>
9626 !! end
9627
9628 !! article
9629 Template:complextemplate
9630 !! text
9631 {{{1}}} {{paramtest|
9632 param ={{{param}}}}}
9633 !! endarticle
9634
9635 !! test
9636 Template with complex arguments
9637 !! wikitext
9638 {{complextemplate|
9639 param ={{ templateasargtest |
9640 templ = simple }}|[[Template:complextemplate|link]]}}
9641 !! html
9642 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
9643 </p>
9644 !! end
9645
9646 !! test
9647 BUG 553: link with two variables in a piped link
9648 !! wikitext
9649 {|
9650 |[[{{{1}}}|{{{2}}}]]
9651 |}
9652 !! html
9653 <table>
9654 <tr>
9655 <td>[[{{{1}}}|{{{2}}}]]
9656 </td></tr></table>
9657
9658 !! end
9659
9660 !! test
9661 Magic variable as template parameter
9662 !! wikitext
9663 {{paramtest|param={{SITENAME}}}}
9664 !! html
9665 <p>This is a test template with parameter MediaWiki
9666 </p>
9667 !! end
9668
9669 !! article
9670 Template:linktest
9671 !! text
9672 [[{{{param}}}|link]]
9673 !! endarticle
9674
9675 !! test
9676 Template parameter as link source
9677 !! wikitext
9678 {{linktest|param=Main Page}}
9679 !! html
9680 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
9681 </p>
9682 !! end
9683
9684 !!article
9685 Template:paramtest2
9686 !! text
9687 including another template, {{paramtest|param={{{arg}}}}}
9688 !! endarticle
9689
9690 !! test
9691 Template passing argument to another template
9692 !! wikitext
9693 {{paramtest2|arg='hmm'}}
9694 !! html
9695 <p>including another template, This is a test template with parameter 'hmm'
9696 </p>
9697 !! end
9698
9699 !! article
9700 Template:Linktest2
9701 !! text
9702 Main Page
9703 !! endarticle
9704
9705 !! test
9706 Template as link source
9707 !! wikitext
9708 [[{{linktest2}}]]
9709
9710 [[{{linktest2}}|Main Page]]
9711
9712 [[{{linktest2}}]]Page
9713 !! html
9714 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
9715 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
9716 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
9717 </p>
9718 !! end
9719
9720
9721 !! article
9722 Template:loop1
9723 !! text
9724 {{loop2}}
9725 !! endarticle
9726
9727 !! article
9728 Template:loop2
9729 !! text
9730 {{loop1}}
9731 !! endarticle
9732
9733 !! test
9734 Template infinite loop
9735 !! wikitext
9736 {{loop1}}
9737 !! html
9738 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
9739 </p>
9740 !! end
9741
9742 !! test
9743 Template from main namespace
9744 !! wikitext
9745 {{:Main Page}}
9746 !! html
9747 <p>blah blah
9748 </p>
9749 !! end
9750
9751 !! article
9752 Template:table
9753 !! text
9754 {|
9755 | 1 || 2
9756 |-
9757 | 3 || 4
9758 |}
9759 !! endarticle
9760
9761 !! test
9762 BUG 529: Template with table, not included at beginning of line
9763 !! wikitext
9764 foo {{table}}
9765 !! html
9766 <p>foo
9767 </p>
9768 <table>
9769 <tr>
9770 <td> 1 </td>
9771 <td> 2
9772 </td></tr>
9773 <tr>
9774 <td> 3 </td>
9775 <td> 4
9776 </td></tr></table>
9777
9778 !! end
9779
9780 !! test
9781 BUG 523: Template shouldn't eat newline (or add an extra one before table)
9782 !! wikitext
9783 foo
9784 {{table}}
9785 !! html
9786 <p>foo
9787 </p>
9788 <table>
9789 <tr>
9790 <td> 1 </td>
9791 <td> 2
9792 </td></tr>
9793 <tr>
9794 <td> 3 </td>
9795 <td> 4
9796 </td></tr></table>
9797
9798 !! end
9799
9800 !! test
9801 BUG 41: Template parameters shown as broken links
9802 !! wikitext
9803 {{{parameter}}}
9804 !! html
9805 <p>{{{parameter}}}
9806 </p>
9807 !! end
9808
9809 !! test
9810 Template with targets containing wikilinks
9811 !! wikitext
9812 {{[[foo]]}}
9813
9814 {{[[{{echo|foo}}]]}}
9815
9816 {{{{echo|[[foo}}]]}}
9817 !! html
9818 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
9819 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
9820 </p><p>{{[[foo}}]]
9821 </p>
9822 !! end
9823
9824 !! article
9825 Template:MSGNW test
9826 !! text
9827 ''None'' of '''this''' should be
9828 * interpreted
9829 but rather passed unmodified
9830 {{test}}
9831 <gallery>
9832 File:Foobar.jpg
9833 </gallery>
9834 !! endarticle
9835
9836 # hmm, fix this or just deprecate msgnw and document its behavior?
9837 !! test
9838 msgnw keyword
9839 !! wikitext
9840 {{msgnw:MSGNW test}}
9841 !! html
9842 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
9843 &#42; interpreted
9844 &#32;but rather passed unmodified
9845 &#123;&#123;test&#125;&#125;
9846 &#60;gallery&#62;
9847 File:Foobar.jpg
9848 &#60;/gallery&#62;
9849 </p>
9850 !! end
9851
9852 !! test
9853 int keyword
9854 !! wikitext
9855 {{int:youhavenewmessages|lots of money|not!}}
9856 !! html
9857 <p>You have lots of money (not!).
9858 </p>
9859 !! end
9860
9861 !! article
9862 Template:Includes
9863 !! text
9864 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
9865 !! endarticle
9866
9867 !! test
9868 <includeonly> and <noinclude> being included
9869 !! wikitext
9870 {{Includes}}
9871 !! html
9872 <p>Foobar
9873 </p>
9874 !! end
9875
9876 !! article
9877 Template:Includes2
9878 !! text
9879 <onlyinclude>Foo</onlyinclude>bar
9880 !! endarticle
9881
9882 !! test
9883 <onlyinclude> being included
9884 !! wikitext
9885 {{Includes2}}
9886 !! html
9887 <p>Foo
9888 </p>
9889 !! end
9890
9891
9892 !! article
9893 Template:Includes3
9894 !! text
9895 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
9896 !! endarticle
9897
9898 !! test
9899 <onlyinclude> and <includeonly> being included
9900 !! wikitext
9901 {{Includes3}}
9902 !! html
9903 <p>Foo
9904 </p>
9905 !! end
9906
9907 !! test
9908 <includeonly> and <noinclude> on a page
9909 !! wikitext
9910 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
9911 !! html
9912 <p>Foozar
9913 </p>
9914 !! end
9915
9916 !! test
9917 Un-closed <noinclude>
9918 !! wikitext
9919 <noinclude>
9920 !! html
9921 !! end
9922
9923 !! test
9924 <onlyinclude> on a page
9925 !! wikitext
9926 <onlyinclude>Foo</onlyinclude>bar
9927 !! html
9928 <p>Foobar
9929 </p>
9930 !! end
9931
9932 !! test
9933 Un-closed <onlyinclude>
9934 !! wikitext
9935 <onlyinclude>
9936 !! html
9937 !! end
9938
9939 !!test
9940 Self-closed noinclude, includeonly, onlyinclude tags
9941 !! wikitext
9942 <noinclude />
9943 <includeonly />
9944 <onlyinclude />
9945 !! html
9946 <p><br />
9947 </p>
9948 !!end
9949
9950 !!test
9951 Unbalanced includeonly and noinclude tags
9952 !! wikitext
9953 {|
9954 |a</noinclude>
9955 |b</noinclude></noinclude>
9956 |c</noinclude></includeonly>
9957 |d</includeonly></includeonly>
9958 |}
9959 !! html
9960 <table>
9961 <tr>
9962 <td>a
9963 </td>
9964 <td>b
9965 </td>
9966 <td>c&lt;/includeonly&gt;
9967 </td>
9968 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
9969 </td></tr></table>
9970
9971 !!end
9972
9973 !! article
9974 Template:Includeonly section
9975 !! text
9976 <includeonly>
9977 ==Includeonly section==
9978 </includeonly>
9979 ==Section T-1==
9980 !!endarticle
9981
9982 !! test
9983 Bug 6563: Edit link generation for section shown by <includeonly>
9984 !! wikitext
9985 {{includeonly section}}
9986 !! html
9987 <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>
9988 <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>
9989
9990 !! end
9991
9992 # Uses same input as the contents of [[Template:Includeonly section]]
9993 !! test
9994 Bug 6563: Section extraction for section shown by <includeonly>
9995 !! options
9996 section=T-2
9997 !! wikitext
9998 <includeonly>
9999 ==Includeonly section==
10000 </includeonly>
10001 ==Section T-2==
10002 !! html
10003 ==Section T-2==
10004 !! end
10005
10006 !! test
10007 Bug 6563: Edit link generation for section suppressed by <includeonly>
10008 !! wikitext
10009 <includeonly>
10010 ==Includeonly section==
10011 </includeonly>
10012 ==Section 1==
10013 !! html
10014 <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>
10015
10016 !! end
10017
10018 !! test
10019 Bug 6563: Section extraction for section suppressed by <includeonly>
10020 !! options
10021 section=1
10022 !! wikitext
10023 <includeonly>
10024 ==Includeonly section==
10025 </includeonly>
10026 ==Section 1==
10027 !! html
10028 ==Section 1==
10029 !! end
10030
10031 !! test
10032 Un-closed <includeonly>
10033 !! wikitext
10034 <includeonly>
10035 !! html
10036 !! end
10037
10038 !! test
10039 Includes and comments at SOL
10040 !! wikitext
10041 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
10042
10043 <noinclude>
10044 some
10045 </noinclude>* stuff
10046 * here
10047
10048 <includeonly>can have stuff</includeonly>=== here ===
10049
10050 !! html/php
10051 <h2><span class="mw-headline" id="hu">hu</span></h2>
10052 <p>some
10053 </p>
10054 <ul><li> stuff</li>
10055 <li> here</li></ul>
10056 <h3><span class="mw-headline" id="here">here</span></h3>
10057
10058 !! html/parsoid
10059 <!-- 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>
10060
10061 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
10062 <p>some</p>
10063 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
10064 <li> here</li></ul>
10065
10066 <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>
10067
10068 !! end
10069
10070 # TODO: test with DOM fragment reuse!
10071 !! test
10072 Parsoid: DOM fragment reuse
10073 !! options
10074 parsoid=wt2wt,wt2html
10075 !! wikitext
10076 a{{echo|b<table></table>c}}d
10077
10078 a{{echo|b
10079 <table></table>
10080 c}}d
10081
10082 {{echo|a
10083
10084 <table></table>
10085
10086 b}}
10087 !! html
10088 <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>
10089
10090 <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">
10091 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
10092 </span><p about="#mwt2">cd</p>
10093
10094 <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">
10095
10096 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
10097
10098 </span><p about="#mwt3">b</p>
10099 !! end
10100
10101 !! test
10102 Parsoid: Merge double tds (bug 50603)
10103 !! options
10104 parsoid
10105 !! wikitext
10106 {|
10107 |{{echo|{{!}} foo}}
10108 |}
10109 !! html
10110 <table><tbody>
10111 <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>
10112 </tbody></table>
10113 !! end
10114
10115 !! test
10116 Parsoid: Merge double tds in nested transclusion content (bug 50603)
10117 !! options
10118 parsoid
10119 !! wikitext
10120 {{echo|<div>}}
10121 {|
10122 |{{echo|{{!}} foo}}
10123 |}
10124 {{echo|</div>}}
10125 !! html
10126 <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}}]}'>
10127 <table><tbody>
10128 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
10129 </tbody></table>
10130 </div>
10131 !! end
10132
10133 ###
10134 ### <includeonly> and <noinclude> in attributes
10135 ###
10136 !!test
10137 0. includeonly around the entire attribute
10138 !! wikitext
10139 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
10140 !! html
10141 <p><span id="v2">bar</span>
10142 </p>
10143 !!end
10144
10145 !!test
10146 1. includeonly in html attr key
10147 !! wikitext
10148 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
10149 !! html
10150 <p><span id="foo">bar</span>
10151 </p>
10152 !!end
10153
10154 !!test
10155 2. includeonly in html attr value
10156 !! wikitext
10157 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
10158 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
10159 !! html
10160 <p><span id="v1">bar</span>
10161 <span id="v1">bar</span>
10162 </p>
10163 !!end
10164
10165 !!test
10166 3. includeonly in part of an attr value
10167 !! wikitext
10168 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
10169 !! html
10170 <p><span style="color:red;">bar</span>
10171 </p>
10172 !!end
10173
10174 !!test
10175 4. includeonly in table attributes
10176 !! wikitext
10177 {|
10178 |- <noinclude>
10179 |-
10180 |a
10181 </noinclude>
10182 |- <includeonly>
10183 |-
10184 |b
10185 </includeonly>
10186 |}
10187 !! html
10188 <table>
10189
10190
10191 <tr>
10192 <td>a
10193 </td></tr>
10194 </table>
10195
10196 !!end
10197
10198 ###
10199 ### Token Stream Patcher tests
10200 ###
10201 ### These tests won't always pass wt2wt and other modes because
10202 ### on serialization, the table will be output on a new line.
10203 ### For now, we are blacklisting them, and using this to test selser.
10204 ###
10205
10206 !!test
10207 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
10208 !!options
10209 parsoid=wt2html,wt2wt
10210 !!wikitext
10211 {{echo|}}{| width = '100%'
10212 |foo
10213 |}
10214 !!html/parsoid
10215 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
10216 <tbody><tr><td>foo</td></tr>
10217 </tbody></table>
10218 !!end
10219
10220 !!test
10221 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
10222 !!options
10223 parsoid=wt2html,wt2wt
10224 !!wikitext
10225 <includeonly>a</includeonly>{| {{{b}}}
10226 |c
10227 |}
10228 !!html/parsoid
10229 <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}}}":""}}'>
10230 <tbody><tr><td>c</td></tr>
10231 </tbody></table>
10232
10233 !!end
10234
10235 ###
10236 ### Testing parsing of templates where a template arg
10237 ### has the same name as the template itself.
10238 ###
10239
10240 !! article
10241 Template:quote
10242 !! text
10243 {{{quote|{{{1}}}}}}
10244 !! endarticle
10245
10246 !!test
10247 Templates: Template Name/Arg clash: 1. Use of positional param
10248 !! wikitext
10249 {{quote|foo}}
10250 !! html
10251 <p>foo
10252 </p>
10253 !!end
10254
10255 !!test
10256 Templates: Template Name/Arg clash: 2. Use of named param
10257 !! wikitext
10258 {{quote|quote=foo}}
10259 !! html
10260 <p>foo
10261 </p>
10262 !!end
10263
10264 !!test
10265 Templates: Template Name/Arg clash: 3. Use of named param with empty input
10266 !! wikitext
10267 {{quote|quote}}
10268 !! html
10269 <p>quote
10270 </p>
10271 !!end
10272
10273 ###
10274 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
10275 ###
10276
10277 !!test
10278 Templates: 1. Simple use
10279 !! wikitext
10280 {{echo|Foo}}
10281 !! html
10282 <p>Foo
10283 </p>
10284 !!end
10285
10286 !!test
10287 Templates: 2. Inside a block tag
10288 !! wikitext
10289 <div>{{echo|Foo}}</div>
10290 <blockquote>{{echo|Foo}}</blockquote>
10291 !! html
10292 <div>Foo</div>
10293 <blockquote>Foo</blockquote>
10294
10295 !! html+tidy
10296 <div>Foo</div>
10297 <blockquote>
10298 <p>Foo</p>
10299 </blockquote>
10300 !!end
10301
10302 !!test
10303 Templates: P-wrapping: 1a. Templates on consecutive lines
10304 !! wikitext
10305 {{echo|Foo}}
10306 {{echo|bar}}
10307 !! html
10308 <p>Foo
10309 bar
10310 </p>
10311 !!end
10312
10313 !!test
10314 Templates: P-wrapping: 1b. Templates on consecutive lines
10315 !! wikitext
10316 Foo
10317
10318 {{echo|bar}}
10319 {{echo|baz}}
10320 !! html
10321 <p>Foo
10322 </p><p>bar
10323 baz
10324 </p>
10325 !!end
10326
10327 !!test
10328 Templates: P-wrapping: 1c. Templates on consecutive lines
10329 !! wikitext
10330 {{echo|Foo}}
10331 {{echo|bar}} <div>baz</div>
10332 !! html
10333 <p>Foo
10334 </p>
10335 bar <div>baz</div>
10336
10337 !! html+tidy
10338 <p>Foo</p>
10339 <p>bar</p>
10340 <div>baz</div>
10341 !! end
10342
10343 !!test
10344 Templates: P-wrapping: 1d. Template preceded by comment-only line
10345 !!options
10346 parsoid
10347 !! wikitext
10348 <!-- foo -->
10349 {{echo|Bar}}
10350 !! html
10351 <!-- foo -->
10352
10353 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
10354 !!end
10355
10356 !!test
10357 Templates: Inline Text: 1. Multiple template uses
10358 !! wikitext
10359 {{echo|Foo}}bar{{echo|baz}}
10360 !! html
10361 <p>Foobarbaz
10362 </p>
10363 !!end
10364
10365 !!test
10366 Templates: Inline Text: 2. Back-to-back template uses
10367 !! wikitext
10368 {{echo|Foo}}{{echo|bar}}
10369 !! html
10370 <p>Foobar
10371 </p>
10372 !!end
10373
10374 !!test
10375 Templates: Block Tags: 1. Multiple template uses
10376 !! wikitext
10377 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
10378 !! html
10379 <div>Foo</div><div>bar</div><div>baz</div>
10380
10381 !!end
10382
10383 !!test
10384 Templates: Block Tags: 2. Back-to-back template uses
10385 !! wikitext
10386 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
10387 !! html
10388 <div>Foo</div><div>bar</div>
10389
10390 !!end
10391
10392 # This is an edge case relating to paragraph wrapping.
10393 !!test
10394 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
10395 !! wikitext
10396 {{echo|a
10397 b</p>}}
10398 !! html/parsoid
10399 <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
10400 b</p>
10401 !!end
10402
10403 !!test
10404 Templates: Links: 1. Simple example
10405 !! wikitext
10406 {{echo|[[Foo|bar]]}}
10407 !! html
10408 <p><a href="/wiki/Foo" title="Foo">bar</a>
10409 </p>
10410 !!end
10411
10412 !!test
10413 Templates: Links: 2. Generation of link href
10414 !! wikitext
10415 [[{{echo|Foo}}|bar]]
10416 !! html
10417 <p><a href="/wiki/Foo" title="Foo">bar</a>
10418 </p>
10419 !!end
10420
10421 !!test
10422 Templates: Links: 3. Generation of part of a link href
10423 !! wikitext
10424 [[Fo{{echo|o}}|bar]]
10425
10426 [[Foo{{echo|bar}}]]
10427
10428 [[Foo{{echo|bar}}baz]]
10429
10430 [[Foo{{echo|bar}}|bar]]
10431
10432 [[:Foo{{echo|bar}}]]
10433
10434 [[:Foo{{echo|bar}}|bar]]
10435 !! html
10436 <p><a href="/wiki/Foo" title="Foo">bar</a>
10437 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
10438 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
10439 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
10440 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
10441 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
10442 </p>
10443 !!end
10444
10445 !!test
10446 Templates: Links: 4. Multiple templates generating link href
10447 !! wikitext
10448 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
10449 !! html
10450 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
10451 </p>
10452 !!end
10453
10454 !!test
10455 Templates: Links: 5. Generation of link text
10456 !! wikitext
10457 [[Foo|{{echo|bar}}]]
10458 !! html
10459 <p><a href="/wiki/Foo" title="Foo">bar</a>
10460 </p>
10461 !!end
10462
10463 !!test
10464 Templates: Links: 5. Nested templates (only outermost template should be marked)
10465 !! wikitext
10466 {{echo|[[{{echo|Foo}}|bar]]}}
10467 !! html
10468 <p><a href="/wiki/Foo" title="Foo">bar</a>
10469 </p>
10470 !!end
10471
10472 !!test
10473 Templates: HTML Tag: 1. Generation of HTML attr. key
10474 !! wikitext
10475 <div {{echo|style}}="color:red;">foo</div>
10476 !! html
10477 <div style="color:red;">foo</div>
10478
10479 !!end
10480
10481 !!test
10482 Templates: HTML Tag: 2. Generation of HTML attr. value
10483 !! wikitext
10484 <div style={{echo|'color:red;'}}>foo</div>
10485 !! html
10486 <div style="color:red;">foo</div>
10487
10488 !!end
10489
10490 !!test
10491 Templates: HTML Tag: 3. Generation of HTML attr key and value
10492 !! wikitext
10493 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
10494 !! html
10495 <div style="color:red;">foo</div>
10496
10497 !!end
10498
10499 !!test
10500 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
10501 !! wikitext
10502 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
10503 !! html
10504 <div title="This is a long title with just one piece templated">foo</div>
10505
10506 !!end
10507
10508 !!test
10509 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
10510 !! wikitext
10511 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
10512 !! html
10513 <div title="This is a long title with just one piece templated">foo</div>
10514
10515 !!end
10516
10517 !!test
10518 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
10519 !! wikitext
10520 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
10521 !! html
10522 <div title="This is a long title with just one piece templated">foo</div>
10523
10524 !!end
10525
10526 # SSS FIXME: While it is great we added support for all this,
10527 # do we want to make this part of the spec? Maybe we want to
10528 # deprecate this kind of usage in the future?
10529 !!test
10530 Templates: HTML Tag: 7. Generation of partial attribute key string
10531 !! wikitext
10532 <div st{{echo|yle}}="color:red;">foo</div>
10533 !! html
10534 <div style="color:red;">foo</div>
10535
10536 !!end
10537
10538 !! test
10539 Templates: HTML Tag: 8. Template-generated attribute (k=v)
10540 !! wikitext
10541 <div {{echo|1=id="v1"}}>bar</div>
10542 !! html
10543 <div id="v1">bar</div>
10544
10545 !!end
10546
10547 !! test
10548 Templates: HTML Tag: 9. Multiple template-generated attributes
10549 !! wikitext
10550 <div {{echo|1=id="v1" title="foo"}}>bar</div>
10551 !! html
10552 <div id="v1" title="foo">bar</div>
10553
10554 !!end
10555
10556 !! test
10557 Templates: Support for templates generating attributes and content
10558 !! wikitext
10559 {| {{mixed_attr_content_template}}
10560 |-
10561 |bar
10562 |}
10563 !! html/php
10564 <table style="color:red;" title="T48811">
10565
10566 <tr>
10567 <td>foo
10568 </td></tr>
10569 <tr>
10570 <td>bar
10571 </td></tr></table>
10572
10573 !! html/parsoid
10574 <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|}"]}'>
10575 <tbody><tr>
10576 <td>foo</td></tr>
10577 <tr>
10578 <td>bar</td></tr>
10579 </tbody></table>
10580 !!end
10581
10582 !! test
10583 1. Entities and nowikis inside templated attributes should be handled correctly
10584 !! wikitext
10585 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
10586 !! html/php
10587 <div style="background:#f9f9f9;">foo</div>
10588
10589 !! html/parsoid
10590 <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>
10591 !! end
10592
10593 !! test
10594 2. Entities and nowikis inside templated attributes should be handled correctly
10595 !! wikitext
10596 {|
10597 |{{table_attribs_3}}
10598 |}
10599 !! html/php
10600 <table>
10601 <tr>
10602 <td style="background:#f9f9f9;">Foo
10603 </td></tr></table>
10604
10605 !! html/parsoid
10606 <table>
10607 <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>
10608 </tbody></table>
10609 !! end
10610
10611 !!test
10612 Templates: HTML Tables: 1. Generating start of a HTML table
10613 !! wikitext
10614 {{echo|<table><tr><td>foo</td>}}</tr></table>
10615 !! html
10616 <table><tr><td>foo</td></tr></table>
10617
10618 !!end
10619
10620 !!test
10621 Templates: HTML Tables: 2a. Generating middle of a HTML table
10622 !! wikitext
10623 <table><tr>{{echo|<td>foo</td>}}</tr></table>
10624 !! html
10625 <table><tr><td>foo</td></tr></table>
10626
10627 !!end
10628
10629 !!test
10630 Templates: HTML Tables: 2b. Generating middle of a HTML table
10631 !! wikitext
10632 <table>{{echo|<tr><td>foo</td></tr>}}</table>
10633 !! html
10634 <table><tr><td>foo</td></tr></table>
10635
10636 !!end
10637
10638 !!test
10639 Templates: HTML Tables: 3. Generating end of a HTML table
10640 !! wikitext
10641 <table><tr>{{echo|<td>foo</td></tr></table>}}
10642 !! html
10643 <table><tr><td>foo</td></tr></table>
10644
10645 !!end
10646
10647 !!test
10648 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
10649 !! wikitext
10650 {{echo|<table>}}<tr><td>foo</td></tr></table>
10651 !! html
10652 <table><tr><td>foo</td></tr></table>
10653
10654 !!end
10655
10656 !!test
10657 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
10658 !! wikitext
10659 <table>{{echo|<tr>}}<td>foo</td></tr></table>
10660 !! html
10661 <table><tr><td>foo</td></tr></table>
10662
10663 !!end
10664
10665 !!test
10666 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
10667 !! wikitext
10668 <table><tr>{{echo|<td>}}foo</td></tr></table>
10669 !! html
10670 <table><tr><td>foo</td></tr></table>
10671
10672 !!end
10673
10674 !!test
10675 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
10676 !! wikitext
10677 <table><tr><td>foo{{echo|</td>}}</tr></table>
10678 !! html
10679 <table><tr><td>foo</td></tr></table>
10680
10681 !!end
10682
10683 !!test
10684 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
10685 !! wikitext
10686 <table><tr><td>foo</td>{{echo|</tr>}}</table>
10687 !! html
10688 <table><tr><td>foo</td></tr></table>
10689
10690 !!end
10691
10692 !!test
10693 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
10694 !! wikitext
10695 <table><tr><td>foo</td></tr>{{echo|</table>}}
10696 !! html
10697 <table><tr><td>foo</td></tr></table>
10698
10699 !!end
10700
10701 !!test
10702 Templates: HTML Tables: 5. Proper fostering of categories from inside
10703 !!options
10704 parsoid=wt2html,wt2wt
10705 !! wikitext
10706 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
10707 <!--Two categories (Bug 50330)-->
10708 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
10709 !! html
10710 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
10711 <!--Two categories (Bug 50330)-->
10712 <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>
10713 !!end
10714
10715 !!test
10716 Templates: Wiki Tables: 1a. Fostering of entire template content
10717 !! wikitext
10718 {|
10719 {{echo|a}}
10720 |}
10721 !! html
10722 <table>
10723 a
10724 <tr><td></td></tr></table>
10725
10726 !! html+tidy
10727 <p>a</p>
10728 <table>
10729 <tr>
10730 <td></td>
10731 </tr>
10732 </table>
10733 !! end
10734
10735 !!test
10736 Templates: Wiki Tables: 1b. Fostering of entire template content
10737 !! wikitext
10738 {|
10739 {{echo|<div>}}
10740 foo
10741 {{echo|</div>}}
10742 |}
10743 !! html
10744 <table>
10745 <div>
10746 <p>foo
10747 </p>
10748 </div>
10749 <tr><td></td></tr></table>
10750
10751 !! html+tidy
10752 <div>
10753 <p>foo</p>
10754 </div>
10755 <table>
10756 <tr>
10757 <td></td>
10758 </tr>
10759 </table>
10760 !! end
10761
10762 !!test
10763 Templates: Wiki Tables: 2. Fostering of partial template content
10764 !! wikitext
10765 {|
10766 {{echo|a
10767 <div>b</div>}}
10768 |}
10769 !! html
10770 <table>
10771 a
10772 <div>b</div>
10773 <tr><td></td></tr></table>
10774
10775 !! html+tidy
10776 <p>a</p>
10777 <div>b</div>
10778 <table>
10779 <tr>
10780 <td></td>
10781 </tr>
10782 </table>
10783 !! end
10784
10785 !!test
10786 Templates: Wiki Tables: 3. td-content via multiple templates
10787 !! wikitext
10788 {|
10789 {{echo|{{pipe}}a}}{{echo|b}}
10790 |}
10791 !! html
10792 <table>
10793 <tr>
10794 <td>ab
10795 </td></tr></table>
10796
10797 !!end
10798
10799 !!test
10800 Templates: Wiki Tables: 4. Templated tags, no content
10801 !! wikitext
10802 {{tbl-start}}
10803 {{tbl-end}}
10804 !! html
10805 <table>
10806 <tr><td></td></tr></table>
10807
10808 !!end
10809
10810 !!test
10811 Templates: Wiki Tables: 5. Templated tags, regular td-tags
10812 !! wikitext
10813 {{tbl-start}}
10814 |foo
10815 {{tbl-end}}
10816 !! html
10817 <table>
10818 <tr>
10819 <td>foo
10820 </td></tr></table>
10821
10822 !!end
10823
10824 !!test
10825 Templates: Wiki Tables: 6. Templated tags, templated td-tags
10826 !! wikitext
10827 {{tbl-start}}
10828 {{!}}foo
10829 {{tbl-end}}
10830 !! html
10831 <table>
10832 <tr>
10833 <td>foo
10834 </td></tr></table>
10835
10836 !!end
10837
10838 !!test
10839 Templates: Lists: Multi-line list-items via templates
10840 !! wikitext
10841 *{{echo|a {{nonexistent|
10842 unused}}}}
10843 *{{echo|b {{nonexistent|
10844 unused}}}}
10845 !! html
10846 <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>
10847 <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>
10848
10849 !!end
10850
10851 !!test
10852 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
10853 !! wikitext
10854 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
10855 !! html
10856 <p><i>ab</i>c<i>d</i>e
10857 </p>
10858 !!end
10859
10860 !!test
10861 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
10862 (PHP parser generates misnested html)
10863 !! wikitext
10864 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
10865 !! html/parsoid
10866 <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>
10867 !!end
10868
10869 !!test
10870 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
10871 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
10872 !! options
10873 parsoid=wt2html,wt2wt
10874 !! wikitext
10875 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
10876 !! html
10877 <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>
10878 <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>
10879 <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>
10880 !!end
10881
10882 !!test
10883 Templates: Ugly nesting: 4. Divs opened/closed across templates
10884 !! wikitext
10885 a<div>b{{echo|c</div>d}}e
10886 !! html
10887 a<div>bc</div>de
10888
10889 !! html+tidy
10890 <p>a</p>
10891 <div>bc</div>
10892 <p>de</p>
10893 !! end
10894
10895 !!test
10896 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
10897 (Parsoid-centric)
10898 !! options
10899 parsoid
10900 !! wikitext
10901 {|
10902 |{{echo|foo</table>}}
10903 |bar
10904 |}
10905 !! html
10906 <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|}"]}'>
10907
10908 <tbody>
10909 <tr>
10910 <td>foo</td></tr></tbody></table><span about="#mwt1">
10911 </span><span about="#mwt1">|bar</span><span about="#mwt1">
10912 |}</span>
10913 !!end
10914
10915 !!test
10916 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
10917 (Parsoid-centric)
10918 !! options
10919 parsoid
10920 !! wikitext
10921 <table>
10922 <tr>
10923 <td>
10924 <table>
10925 <tr>
10926 <td>1. {{echo|foo </table>}}</td>
10927 <td> bar </td>
10928 <td>2. {{echo|baz </table>}}</td>
10929 </tr>
10930 <tr>
10931 <td>abc</td>
10932 </tr>
10933 </table>
10934 </td>
10935 </tr>
10936 <tr>
10937 <td>xyz</td>
10938 </tr>
10939 </table>
10940 !! html
10941 <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>"]}'>
10942 <tbody><tr>
10943 <td>
10944 <table>
10945 <tbody><tr>
10946 <td>1. foo </td></tr></tbody></table></td>
10947 <td> bar </td>
10948 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
10949 </span><span about="#mwt2">
10950 </span><span about="#mwt2">
10951 </span><span about="#mwt2">abc</span><span about="#mwt2">
10952 </span><span about="#mwt2">
10953 </span><span about="#mwt2">
10954 </span><span about="#mwt2">
10955 </span><span about="#mwt2">
10956 </span><span about="#mwt2">
10957 </span><span about="#mwt2">xyz</span><span about="#mwt2">
10958 </span><span about="#mwt2">
10959 </span>
10960 !!end
10961
10962 !! test
10963 Templates: Ugly templates: 3. newline-only template parameter
10964 !! wikitext
10965 foo {{echo|
10966 }}
10967 !! html
10968 <p>foo
10969 </p>
10970 !! end
10971
10972 # This looks like a bug: a single newline triggers p/br for some reason.
10973 !! test
10974 Templates: Ugly templates: 4. newline-only template parameter inconsistency
10975 !! wikitext
10976 {{echo|
10977 }}
10978 !! html
10979 <p><br />
10980 </p>
10981 !! end
10982
10983 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
10984 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
10985 !! test
10986 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
10987 !! wikitext
10988 {{echo|<table>}}
10989 {{echo|<div>foo}}
10990 {{echo|</table>}}
10991 !! html/parsoid
10992 <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
10993 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
10994 </table>
10995 !! end
10996
10997 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
10998 # that are "identical" and generate nesting cycles in the algorithm
10999 !! test
11000 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
11001 !! wikitext
11002 {{echo|<table><tr><td><table>}}
11003 {{echo|<div>}}
11004 {{echo|</div>}}
11005 !! html/parsoid
11006 <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"}'>
11007 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
11008 </table></td></tr></tbody></table>
11009 !! end
11010
11011 !!test
11012 Parser Functions: 1. Simple example
11013 !! wikitext
11014 {{uc:foo}}
11015 !! html
11016 <p>FOO
11017 </p>
11018 !!end
11019
11020 !!test
11021 Parser Functions: 2. Nested use (only outermost should be marked up)
11022 !! wikitext
11023 {{uc:{{lc:FOO}}}}
11024 !! html
11025 <p>FOO
11026 </p>
11027 !!end
11028
11029 ###
11030 ### Pre-save transform tests
11031 ###
11032 !! test
11033 pre-save transform: subst:
11034 !! options
11035 PST
11036 !! wikitext
11037 {{subst:test}}
11038 !! html
11039 This is a test template
11040 !! end
11041
11042 !! test
11043 pre-save transform: normal template
11044 !! options
11045 PST
11046 !! wikitext
11047 {{test}}
11048 !! html
11049 {{test}}
11050 !! end
11051
11052 !! test
11053 pre-save transform: nonexistent template
11054 !! options
11055 PST
11056 !! wikitext
11057 {{thistemplatedoesnotexist}}
11058 !! html
11059 {{thistemplatedoesnotexist}}
11060 !! end
11061
11062
11063 !! test
11064 pre-save transform: subst magic variables
11065 !! options
11066 PST
11067 !! wikitext
11068 {{subst:SITENAME}}
11069 !! html
11070 MediaWiki
11071 !! end
11072
11073 # This is bug 89, which I fixed. -- wtm
11074 !! test
11075 pre-save transform: subst: templates with parameters
11076 !! options
11077 pst
11078 !! wikitext
11079 {{subst:paramtest|param="something else"}}
11080 !! html
11081 This is a test template with parameter "something else"
11082 !! end
11083
11084 !! article
11085 Template:nowikitest
11086 !! text
11087 <nowiki>'''not wiki'''</nowiki>
11088 !! endarticle
11089
11090 !! test
11091 pre-save transform: nowiki in subst (bug 1188)
11092 !! options
11093 pst
11094 !! wikitext
11095 {{subst:nowikitest}}
11096 !! html
11097 <nowiki>'''not wiki'''</nowiki>
11098 !! end
11099
11100
11101 !! article
11102 Template:commenttest
11103 !! text
11104 This template has <!-- a comment --> in it.
11105 !! endarticle
11106
11107 !! test
11108 pre-save transform: comment in subst (bug 1936)
11109 !! options
11110 pst
11111 !! wikitext
11112 {{subst:commenttest}}
11113 !! html
11114 This template has <!-- a comment --> in it.
11115 !! end
11116
11117 !! test
11118 pre-save transform: unclosed tag
11119 !! options
11120 pst noxml
11121 !! wikitext
11122 <nowiki>'''not wiki'''
11123 !! html
11124 <nowiki>'''not wiki'''
11125 !! end
11126
11127 !! test
11128 pre-save transform: mixed tag case
11129 !! options
11130 pst noxml
11131 !! wikitext
11132 <NOwiki>'''not wiki'''</noWIKI>
11133 !! html
11134 <NOwiki>'''not wiki'''</noWIKI>
11135 !! end
11136
11137 !! test
11138 pre-save transform: unclosed comment in <nowiki>
11139 !! options
11140 pst noxml
11141 !! wikitext
11142 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
11143 !! html
11144 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
11145 !!end
11146
11147 # Leading @ in this template definition works around a limitation
11148 # in parsoid's parserTests which otherwise strips the <span> from the
11149 # result (confusing it for a template wrapper)
11150 !! article
11151 Template:dangerous
11152 !!text
11153 @<span onmouseover="alert('crap')">Oh no</span>
11154 !!endarticle
11155
11156 !!test
11157 (confirming safety of fix for subst bug 1936)
11158 !! wikitext
11159 {{Template:dangerous}}
11160 !! html
11161 <p>@<span>Oh no</span>
11162 </p>
11163 !! end
11164
11165 !! test
11166 pre-save transform: comment containing gallery (bug 5024)
11167 !! options
11168 pst
11169 !! wikitext
11170 <!-- <gallery>data</gallery> -->
11171 !! html
11172 <!-- <gallery>data</gallery> -->
11173 !!end
11174
11175 !! test
11176 pre-save transform: comment containing extension
11177 !! options
11178 pst
11179 !! wikitext
11180 <!-- <tag>data</tag> -->
11181 !! html
11182 <!-- <tag>data</tag> -->
11183 !!end
11184
11185 !! test
11186 pre-save transform: comment containing nowiki
11187 !! options
11188 pst
11189 !! wikitext
11190 <!-- <nowiki>data</nowiki> -->
11191 !! html
11192 <!-- <nowiki>data</nowiki> -->
11193 !!end
11194
11195 !! test
11196 pre-save transform: <noinclude> in subst (bug 3298)
11197 !! options
11198 pst
11199 !! wikitext
11200 {{subst:Includes}}
11201 !! html
11202 Foobar
11203 !! end
11204
11205 !! test
11206 pre-save transform: <onlyinclude> in subst (bug 3298)
11207 !! options
11208 pst
11209 !! wikitext
11210 {{subst:Includes2}}
11211 !! html
11212 Foo
11213 !! end
11214
11215 !! article
11216 Template:SubstTest
11217 !!text
11218 {{<includeonly>subst:</includeonly>Includes}}
11219 !! endarticle
11220
11221 !! article
11222 Template:SafeSubstTest
11223 !! text
11224 {{<includeonly>safesubst:</includeonly>Includes}}
11225 !! endarticle
11226
11227 !! test
11228 bug 22297: safesubst: works during PST
11229 !! options
11230 pst
11231 !! wikitext
11232 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
11233 !! html
11234 FoobarFoobar
11235 !! end
11236
11237 !! test
11238 bug 22297: safesubst: works during normal parse
11239 !! wikitext
11240 {{SafeSubstTest}}
11241 !! html
11242 <p>Foobar
11243 </p>
11244 !! end
11245
11246 !! test
11247 subst: does not work during normal parse
11248 !! wikitext
11249 {{SubstTest}}
11250 !! html
11251 <p>{{subst:Includes}}
11252 </p>
11253 !! end
11254
11255 !! test
11256 pre-save transform: context links ("pipe trick")
11257 !! options
11258 pst
11259 !! wikitext
11260 [[Article (context)|]]
11261 [[Bar:Article|]]
11262 [[:Bar:Article|]]
11263 [[Bar:Article (context)|]]
11264 [[:Bar:Article (context)|]]
11265 [[|Article]]
11266 [[|Article (context)]]
11267 [[Bar:X (Y) Z|]]
11268 [[:Bar:X (Y) Z|]]
11269 !! html
11270 [[Article (context)|Article]]
11271 [[Bar:Article|Article]]
11272 [[:Bar:Article|Article]]
11273 [[Bar:Article (context)|Article]]
11274 [[:Bar:Article (context)|Article]]
11275 [[Article]]
11276 [[Article (context)]]
11277 [[Bar:X (Y) Z|X (Y) Z]]
11278 [[:Bar:X (Y) Z|X (Y) Z]]
11279 !! end
11280
11281 !! test
11282 pre-save transform: context links ("pipe trick") with interwiki prefix
11283 !! options
11284 pst
11285 !! wikitext
11286 [[interwiki:Article|]]
11287 [[:interwiki:Article|]]
11288 [[interwiki:Bar:Article|]]
11289 [[:interwiki:Bar:Article|]]
11290 !! html
11291 [[interwiki:Article|Article]]
11292 [[:interwiki:Article|Article]]
11293 [[interwiki:Bar:Article|Bar:Article]]
11294 [[:interwiki:Bar:Article|Bar:Article]]
11295 !! end
11296
11297 !! test
11298 pre-save transform: context links ("pipe trick") with parens in title
11299 !! options
11300 pst title=[[Somearticle (context)]]
11301 !! wikitext
11302 [[|Article]]
11303 !! html
11304 [[Article (context)|Article]]
11305 !! end
11306
11307 !! test
11308 pre-save transform: context links ("pipe trick") with comma in title
11309 !! options
11310 pst title=[[Someplace, Somewhere]]
11311 !! wikitext
11312 [[|Otherplace]]
11313 [[Otherplace, Elsewhere|]]
11314 [[Otherplace, Elsewhere, Anywhere|]]
11315 !! html
11316 [[Otherplace, Somewhere|Otherplace]]
11317 [[Otherplace, Elsewhere|Otherplace]]
11318 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
11319 !! end
11320
11321 !! test
11322 pre-save transform: context links ("pipe trick") with parens and comma
11323 !! options
11324 pst title=[[Someplace (IGNORED), Somewhere]]
11325 !! wikitext
11326 [[|Otherplace]]
11327 [[Otherplace (place), Elsewhere|]]
11328 !! html
11329 [[Otherplace, Somewhere|Otherplace]]
11330 [[Otherplace (place), Elsewhere|Otherplace]]
11331 !! end
11332
11333 !! test
11334 pre-save transform: context links ("pipe trick") with comma and parens
11335 !! options
11336 pst title=[[Who, me? (context)]]
11337 !! wikitext
11338 [[|Yes, you.]]
11339 [[Me, Myself, and I (1937 song)|]]
11340 !! html
11341 [[Yes, you. (context)|Yes, you.]]
11342 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
11343 !! end
11344
11345 !! test
11346 pre-save transform: context links ("pipe trick") with namespace
11347 !! options
11348 pst title=[[Ns:Somearticle]]
11349 !! wikitext
11350 [[|Article]]
11351 !! html
11352 [[Ns:Article|Article]]
11353 !! end
11354
11355 !! test
11356 pre-save transform: context links ("pipe trick") with namespace and parens
11357 !! options
11358 pst title=[[Ns:Somearticle (context)]]
11359 !! wikitext
11360 [[|Article]]
11361 !! html
11362 [[Ns:Article (context)|Article]]
11363 !! end
11364
11365 !! test
11366 pre-save transform: context links ("pipe trick") with namespace and comma
11367 !! options
11368 pst title=[[Ns:Somearticle, Context, Whatever]]
11369 !! wikitext
11370 [[|Article]]
11371 !! html
11372 [[Ns:Article, Context, Whatever|Article]]
11373 !! end
11374
11375 !! test
11376 pre-save transform: context links ("pipe trick") with namespace, comma and parens
11377 !! options
11378 pst title=[[Ns:Somearticle, Context (context)]]
11379 !! wikitext
11380 [[|Article]]
11381 !! html
11382 [[Ns:Article (context)|Article]]
11383 !! end
11384
11385 !! test
11386 pre-save transform: context links ("pipe trick") with namespace, parens and comma
11387 !! options
11388 pst title=[[Ns:Somearticle (IGNORED), Context]]
11389 !! wikitext
11390 [[|Article]]
11391 !! html
11392 [[Ns:Article, Context|Article]]
11393 !! end
11394
11395 !! test
11396 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
11397 !! options
11398 pst
11399 !! wikitext
11400 [[Article(context)|]]
11401 [[Bar:Article(context)|]]
11402 [[:Bar:Article(context)|]]
11403 [[|Article(context)]]
11404 [[Bar:X(Y)Z|]]
11405 [[:Bar:X(Y)Z|]]
11406 !! html
11407 [[Article(context)|Article]]
11408 [[Bar:Article(context)|Article]]
11409 [[:Bar:Article(context)|Article]]
11410 [[Article(context)]]
11411 [[Bar:X(Y)Z|X(Y)Z]]
11412 [[:Bar:X(Y)Z|X(Y)Z]]
11413 !! end
11414
11415 !! test
11416 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
11417 !! options
11418 pst
11419 !! wikitext
11420 [[Article (context)|]]
11421 [[Bar:Article (context)|]]
11422 [[:Bar:Article (context)|]]
11423 [[|Article (context)]]
11424 [[Bar:X (Y) Z|]]
11425 [[:Bar:X (Y) Z|]]
11426 !! html
11427 [[Article (context)|Article]]
11428 [[Bar:Article (context)|Article]]
11429 [[:Bar:Article (context)|Article]]
11430 [[Article (context)]]
11431 [[Bar:X (Y) Z|X (Y) Z]]
11432 [[:Bar:X (Y) Z|X (Y) Z]]
11433 !! end
11434
11435 !! test
11436 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
11437 !! options
11438 pst
11439 !! wikitext
11440 [[Article(context)|]]
11441 [[Bar:Article(context)|]]
11442 [[:Bar:Article(context)|]]
11443 [[|Article(context)]]
11444 [[Bar:X(Y)Z|]]
11445 [[:Bar:X(Y)Z|]]
11446 !! html
11447 [[Article(context)|Article]]
11448 [[Bar:Article(context)|Article]]
11449 [[:Bar:Article(context)|Article]]
11450 [[Article(context)]]
11451 [[Bar:X(Y)Z|X(Y)Z]]
11452 [[:Bar:X(Y)Z|X(Y)Z]]
11453 !! end
11454
11455 !! test
11456 pre-save transform: context links ("pipe trick") with commas (bug 21660)
11457 !! options
11458 pst
11459 !! wikitext
11460 [[Article (context), context|]]
11461 [[Article (context),context|]]
11462 [[Bar:Article (context), context|]]
11463 [[Bar:Article (context),context|]]
11464 [[:Bar:Article (context), context|]]
11465 [[:Bar:Article (context),context|]]
11466 !! html
11467 [[Article (context), context|Article]]
11468 [[Article (context),context|Article]]
11469 [[Bar:Article (context), context|Article]]
11470 [[Bar:Article (context),context|Article]]
11471 [[:Bar:Article (context), context|Article]]
11472 [[:Bar:Article (context),context|Article]]
11473 !! end
11474
11475 !! test
11476 pre-save transform: trim trailing empty lines
11477 !! options
11478 pst
11479 !! wikitext
11480 Empty lines are trimmed
11481
11482
11483
11484
11485 !! html
11486 Empty lines are trimmed
11487 !! end
11488
11489 !! test
11490 pre-save transform: Signature expansion
11491 !! options
11492 pst
11493 !! wikitext
11494 * ~~~
11495 * <noinclude>~~~</noinclude>
11496 * <includeonly>~~~</includeonly>
11497 * <onlyinclude>~~~</onlyinclude>
11498 !! html
11499 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
11500 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
11501 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
11502 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
11503 !! end
11504
11505
11506 !! test
11507 pre-save transform: Signature expansion in nowiki tags (bug 93)
11508 !! options
11509 pst disabled
11510 !! wikitext
11511 Shall not expand:
11512
11513 <nowiki>~~~~</nowiki>
11514
11515 <includeonly><nowiki>~~~~</nowiki></includeonly>
11516
11517 <noinclude><nowiki>~~~~</nowiki></noinclude>
11518
11519 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
11520
11521 {{subst:Foo}} shall be converted to FOO
11522
11523 As well as inside noinclude/onlyinclude
11524 <noinclude>{{subst:Foo}}</noinclude>
11525 <onlyinclude>{{subst:Foo}}</onlyinclude>
11526
11527 But not inside includeonly
11528 <includeonly>{{subst:Foo}}</includeonly>
11529 !! html
11530 Shall not expand:
11531
11532 <nowiki>~~~~</nowiki>
11533
11534 <includeonly><nowiki>~~~~</nowiki></includeonly>
11535
11536 <noinclude><nowiki>~~~~</nowiki></noinclude>
11537
11538 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
11539
11540 FOO shall be converted to FOO
11541
11542 As well as inside noinclude/onlyinclude
11543 <noinclude>FOO</noinclude>
11544 <onlyinclude>FOO</onlyinclude>
11545
11546 But not inside includeonly
11547 <includeonly>{{subst:Foo}}</includeonly>
11548 !! end
11549
11550 !! test
11551 Parsoid: Recognize nowiki with trailing space in tags
11552 !! options
11553 parsoid=wt2html
11554 !! wikitext
11555 <nowiki ><div>[[foo]]</nowiki >
11556
11557 a<nowiki / >b
11558
11559 c<nowiki />d
11560
11561 e<nowiki/ >f
11562 !! html
11563 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
11564 <p>ab</p>
11565 <p>cd</p>
11566 <p>ef</p>
11567 !! end
11568
11569 !! test
11570 Parsoid: Recognize nowiki with odd capitalization
11571 !! options
11572 parsoid=wt2html
11573 !! wikitext
11574 <noWikI ><div>[[foo]]</Nowiki >
11575 !! html
11576 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
11577 !! end
11578
11579
11580 !! test
11581 Parsoid: Escape nowiki with trailing space in tags
11582 !! options
11583 parsoid=html2wt
11584 !! html
11585 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
11586 <p>a&lt;nowiki /&gt;b</p>
11587 <p>c&lt;nowiki/ &gt;d</p>
11588 !! wikitext
11589 &lt;nowiki &gt; foo &lt;/nowiki &gt;
11590
11591 a&lt;nowiki /&gt;b
11592
11593 c&lt;nowiki/ &gt;d
11594 !! end
11595
11596 !! test
11597 Parsoid: Escape weird noWikI capitalizations
11598 !! options
11599 parsoid=html2wt
11600 !! html
11601 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
11602 !! wikitext
11603 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
11604 !! end
11605
11606 ###
11607 ### Message transform tests
11608 ###
11609 !! test
11610 message transform: magic variables
11611 !! options
11612 msg
11613 !! wikitext
11614 {{SITENAME}}
11615 !! html
11616 MediaWiki
11617 !! end
11618
11619 !! test
11620 message transform: should not transform wiki markup
11621 !! options
11622 msg
11623 !! wikitext
11624 ''test''
11625 !! html
11626 ''test''
11627 !! end
11628
11629 !! test
11630 message transform: <noinclude> in transcluded template (bug 4926)
11631 !! options
11632 msg
11633 !! wikitext
11634 {{Includes}}
11635 !! html
11636 Foobar
11637 !! end
11638
11639 !! test
11640 message transform: <onlyinclude> in transcluded template (bug 4926)
11641 !! options
11642 msg
11643 !! wikitext
11644 {{Includes2}}
11645 !! html
11646 Foo
11647 !! end
11648
11649 !! test
11650 {{#special:}} page name, known
11651 !! options
11652 msg
11653 !! wikitext
11654 {{#special:Recentchanges}}
11655 !! html
11656 Special:RecentChanges
11657 !! end
11658
11659 !! test
11660 {{#special:}} page name with subpage, known
11661 !! options
11662 msg
11663 !! wikitext
11664 {{#special:Recentchanges/param}}
11665 !! html
11666 Special:RecentChanges/param
11667 !! end
11668
11669 !! test
11670 {{#special:}} page name, unknown
11671 !! options
11672 msg
11673 !! wikitext
11674 {{#special:foobar nonexistent}}
11675 !! html
11676 Special:Foobar nonexistent
11677 !! end
11678
11679 !! test
11680 {{#speciale:}} page name, known
11681 !! options
11682 msg
11683 !! wikitext
11684 {{#speciale:Recentchanges}}
11685 !! html
11686 Special:RecentChanges
11687 !! end
11688
11689 !! test
11690 {{#speciale:}} page name with subpage, known
11691 !! options
11692 msg
11693 !! wikitext
11694 {{#speciale:Recentchanges/param}}
11695 !! html
11696 Special:RecentChanges/param
11697 !! end
11698
11699 !! test
11700 {{#speciale:}} page name, unknown
11701 !! options
11702 msg
11703 !! wikitext
11704 {{#speciale:foobar nonexistent}}
11705 !! html
11706 Special:Foobar_nonexistent
11707 !! end
11708
11709 ###
11710 ### Images
11711 ###
11712 ### For Parsoid-specific tests, see
11713 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
11714
11715 !! test
11716 Simple image
11717 !! options
11718 parsoid=wt2html,wt2wt,html2html
11719 !! wikitext
11720 [[Image:foobar.jpg]]
11721 !! html/php
11722 <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>
11723 </p>
11724 !! html/parsoid
11725 <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" height="220" width="1941"></a></span></p>
11726 !! end
11727
11728 !! test
11729 Simple image (using File: namespace, now canonical)
11730 !! wikitext
11731 [[File:Foobar.jpg]]
11732 !! html/php
11733 <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>
11734 </p>
11735 !! html/parsoid
11736 <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" height="220" width="1941"></a></span></p>
11737 !! end
11738
11739 !! test
11740 Right-aligned image
11741 !! wikitext
11742 [[File:Foobar.jpg|right]]
11743 !! html/php
11744 <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>
11745
11746 !! html/parsoid
11747 <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" height="220" width="1941"></a></figure>
11748 !! end
11749
11750 !! test
11751 Image with caption
11752 !! wikitext
11753 [[File:Foobar.jpg|right|Caption text]]
11754 !! html/php
11755 <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>
11756
11757 !! html/parsoid
11758 <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" height="220" width="1941"></a><figcaption>Caption text</figcaption></figure>
11759 !! end
11760
11761 !! test
11762 Image with caption, bug 53312 #1
11763 !! wikitext
11764 [[File:Foobar.jpg|right|Caption page stuff]]
11765 !! html/php
11766 <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>
11767
11768 !! html/parsoid
11769 <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" height="220" width="1941"></a><figcaption>Caption page stuff</figcaption></figure>
11770 !! end
11771
11772 !! test
11773 Image with caption, bug 53312 #2
11774 !! wikitext
11775 [[File:Foobar.jpg|right|Caption page=]]
11776 !! html/php
11777 <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>
11778
11779 !! html/parsoid
11780 <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" height="220" width="1941"></a><figcaption>Caption page=</figcaption></figure>
11781 !! end
11782
11783 !! test
11784 Image with caption, bug 53312 #3
11785 !! wikitext
11786 [[File:Foobar.jpg|right|Caption page=stuff]]
11787 !! html/php
11788 <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>
11789
11790 !! html/parsoid
11791 <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" height="220" width="1941"></a><figcaption>Caption page=stuff</figcaption></figure>
11792 !! end
11793
11794 !! test
11795 Allow empty links in image captions (Bug 60753)
11796 !! options
11797 thumbsize=220
11798 !! wikitext
11799 [[File:Foobar.jpg|thumb|Caption [[Link1]]
11800 [[]]
11801 [[Link2]]
11802 ]]
11803 !! html/php
11804 <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>
11805
11806 !! html/parsoid
11807 <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" 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>
11808 [[]]
11809 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
11810 </figcaption></figure>
11811 !! end
11812
11813 !! test
11814 Titles in unlinked images (T23454)
11815 !! wikitext
11816 [[File:Foobar.jpg|link=|stuff]]
11817 !! html/php
11818 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
11819 </p>
11820 !! end
11821
11822 !! test
11823 Link with empty target
11824 !! wikitext
11825 [[]]
11826 !! html
11827 <p>[[]]
11828 </p>
11829 !! end
11830
11831 !! test
11832 Image with link trail
11833 !! wikitext
11834 Linktrails should not work for images: [[File:Foobar.jpg]]s
11835 !! html/php
11836 <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
11837 </p>
11838 !! html/parsoid
11839 <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" height="220" width="1941"/></a></span>s</p>
11840 !! end
11841
11842 !! test
11843 Image with empty attribute
11844 !! options
11845 parsoid=wt2html,wt2wt,html2html
11846 !! wikitext
11847 [[File:Foobar.jpg|right||Caption text]]
11848 !! html/php
11849 <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>
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" height="220" width="1941"></a><figcaption>Caption text</figcaption></figure>
11853 !! end
11854
11855 !! test
11856 1. Block image with individual attributes from templates
11857 !! wikitext
11858 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
11859 !! html/php
11860 <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>
11861
11862 !! html/parsoid
11863 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt2" data-mw='{"attribs":[["thumbnail",{"html":"thumb"}],["width",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[24,38,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;137px&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">137px&lt;/span>"}]]}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" height="16" width="137"/></a><figcaption>This is a caption</figcaption></figure>
11864 !! end
11865
11866 !! test
11867 2. Block Image with individual attributes from templates
11868 !! wikitext
11869 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
11870 !! html/php
11871 <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>
11872
11873 !! html/parsoid
11874 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt3" data-mw='{"attribs":[["thumbnail",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[18,32,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;thumb&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">thumb&lt;/span>"}],["width",{"html":"&lt;span about=\"#mwt2\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[33,47,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;137px&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">137px&lt;/span>"}]]}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" height="16" width="137"/></a><figcaption>This is a caption</figcaption></figure>
11875 !! end
11876
11877 !! test
11878 3. Inline image with individual attributes from templates
11879 !! wikitext
11880 [[File:Foobar.jpg|{{echo|50px}}]]
11881 !! html/php
11882 <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>
11883 </p>
11884 !! html/parsoid
11885 <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" height="6" width="50"/></a></span></p>
11886 !! end
11887
11888 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
11889 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
11890 !! test
11891 Image with multiple attributes from the same template
11892 !! wikitext
11893 [[File:Foobar.jpg|{{image_attribs}}]]
11894 !! html/php
11895 <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>
11896
11897 !! html/parsoid
11898 <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" height="220" width="1941"></a><figcaption>Caption text</figcaption></figure>
11899 !! end
11900
11901 !! test
11902 Image with link tails
11903 !! options
11904 thumbsize=220
11905 !! wikitext
11906 123[[File:Foobar.jpg]]456
11907 123[[File:Foobar.jpg|right]]456
11908 123[[File:Foobar.jpg|thumb]]456
11909 !! html/php
11910 <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
11911 </p>
11912 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
11913 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
11914
11915 !! html/php+tidy
11916 <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>
11917 <p>123</p>
11918 <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>
11919 <p>456 123</p>
11920 <div class="thumb tright">
11921 <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>
11922 <div class="thumbcaption">
11923 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
11924 </div>
11925 </div>
11926 </div>
11927 <p>456</p>
11928 !! html/parsoid
11929 <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" height="220" width="1941"></a></span>456</p>
11930 <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" height="220" width="1941"></a></figure><p>456</p>
11931 <p>123</p><figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" height="25" width="220"></a></figure><p>456</p>
11932 !! end
11933
11934 !! test
11935 Image with multiple captions -- only last one is accepted
11936 !! wikitext
11937 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
11938 !! html/php
11939 <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>
11940
11941 !! html/parsoid
11942 <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" height="220" width="1941"></a><figcaption>Caption3 - accepted</figcaption></figure>
11943 !! end
11944
11945 !! test
11946 Image with multiple widths -- use last
11947 !! wikitext
11948 [[File:Foobar.jpg|200px|300px|caption]]
11949 !! html/php
11950 <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>
11951 </p>
11952 !! html/parsoid
11953 <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" height="34" width="300"/></a></span></p>
11954 !! end
11955
11956 !! test
11957 Image with multiple alignments -- use first (bug 48664)
11958 !! options
11959 thumbsize=220
11960 !! wikitext
11961 [[File:Foobar.jpg|thumb|left|right|center|caption]]
11962
11963 [[File:Foobar.jpg|middle|text-top|caption]]
11964 !! html/php
11965 <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>
11966 <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>
11967 </p>
11968 !! html/parsoid
11969 <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" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
11970 <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" height="220" width="1941"/></a></span></p>
11971 !! end
11972
11973 !! test
11974 Image with width attribute at different positions
11975 !! wikitext
11976 [[File:Foobar.jpg|200px|right|Caption]]
11977 [[File:Foobar.jpg|right|200px|Caption]]
11978 [[File:Foobar.jpg|right|Caption|200px]]
11979 !! html/php
11980 <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>
11981 <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>
11982 <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>
11983
11984 !! html/parsoid
11985 <figure class="mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" height="23" width="200"></a><figcaption>Caption</figcaption></figure>
11986 <figure class="mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" height="23" width="200"></a><figcaption>Caption</figcaption></figure>
11987 <figure class="mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" height="23" width="200"></a><figcaption>Caption</figcaption></figure>
11988 !! end
11989
11990 # a sad bit of backward-compatibility
11991 !! test
11992 Image with size specified with pxpx (bug 13500, 51628)
11993 !! options
11994 parsoid=wt2html,wt2wt,html2html
11995 !! wikitext
11996 [[File:Foobar.jpg|20pxpx]]
11997 [[File:Foobar.jpg|200x20pxpx]]
11998 !! html/php
11999 <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>
12000 <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>
12001 </p>
12002 !! html/parsoid
12003 <p><span typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" 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" height="20" width="177"/></a></span></p>
12004 !! end
12005
12006 !! test
12007 Image with link parameter, wiki target
12008 !! wikitext
12009 [[File:Foobar.jpg|link=Main Page]]
12010 !! html/php
12011 <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>
12012 </p>
12013 !! html/parsoid
12014 <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" height="220" width="1941"></a></span></p>
12015 !! end
12016
12017 # parsoid bug 49293 (part 1)
12018 !! test
12019 Image with link parameter, URL target
12020 !! wikitext
12021 [[File:Foobar.jpg|link=http://example.com/]]
12022 !! html/php
12023 <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>
12024 </p>
12025 !! html/parsoid
12026 <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" height="220" width="1941"></a></span></p>
12027 !! end
12028
12029 # parsoid bug 49293 (part 2)
12030 !! test
12031 Image with link parameter, protocol-less URL target
12032 !! wikitext
12033 [[File:Foobar.jpg|link=//example.com/]]
12034 !! html/php
12035 <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>
12036 </p>
12037 !! html/parsoid
12038 <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" height="220" width="1941"></a></span></p>
12039 !! end
12040
12041 !! test
12042 Image with link parameter, wgExternalLinkTarget
12043 !! wikitext
12044 [[Image:foobar.jpg|link=http://example.com/]]
12045 !! config
12046 wgExternalLinkTarget='foobar'
12047 !! html
12048 <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>
12049 </p>
12050 !! end
12051
12052 !! test
12053 Image with link parameter, wgNoFollowLinks set to false
12054 !! wikitext
12055 [[Image:foobar.jpg|link=http://example.com/]]
12056 !! config
12057 wgNoFollowLinks=false
12058 !! html
12059 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
12060 </p>
12061 !! end
12062
12063 !! test
12064 Image with link parameter, wgNoFollowDomainExceptions
12065 !! wikitext
12066 [[Image:foobar.jpg|link=http://example.com/]]
12067 !! config
12068 wgNoFollowDomainExceptions='example.com'
12069 !! html
12070 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
12071 </p>
12072 !! end
12073
12074 !! test
12075 Image with link parameter, wgExternalLinkTarget, unnamed parameter
12076 !! wikitext
12077 [[Image:foobar.jpg|link=http://example.com/|Title]]
12078 !! config
12079 wgExternalLinkTarget='foobar'
12080 !! html
12081 <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>
12082 </p>
12083 !! end
12084
12085 !! test
12086 Image with empty link parameter
12087 !! wikitext
12088 [[File:Foobar.jpg|link=]]
12089 !! html/php
12090 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
12091 </p>
12092 !! html/parsoid
12093 <p><span class="mw-default-size" typeof="mw:Image"><span><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></span></span></p>
12094 !! end
12095
12096 !! test
12097 Image with link parameter (wiki target) and unnamed parameter
12098 !! wikitext
12099 [[File:Foobar.jpg|link=Main_Page|Title]]
12100 !! html/php
12101 <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>
12102 </p>
12103 !! html/parsoid
12104 <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" height="220" width="1941"></a></span></p>
12105 !! end
12106
12107 !! test
12108 Image with link parameter (URL target) and unnamed parameter
12109 !! wikitext
12110 [[File:Foobar.jpg|link=http://example.com/|Title]]
12111 !! html/php
12112 <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>
12113 </p>
12114 !! html/parsoid
12115 <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" height="220" width="1941"></a></span></p>
12116 !! end
12117
12118 !! test
12119 Thumbnail image with link parameter
12120 !! options
12121 thumbsize=220
12122 parsoid=wt2html,wt2wt,html2html
12123 !! wikitext
12124 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
12125 !! html/php
12126 <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>
12127
12128 !! html/parsoid
12129 <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" height="25" width="220"/></a><figcaption>Title</figcaption></figure>
12130 !! end
12131
12132 !! test
12133 Manually-specified thumbnail image
12134 !! options
12135 thumbsize=220
12136 !! wikitext
12137 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
12138 !! html/php
12139 <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>
12140
12141 !! html/parsoid
12142 <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" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
12143 !! end
12144
12145 !! test
12146 Manually-specified thumbnail image with explicit link to wiki page
12147 !! options
12148 thumbsize=220
12149 parsoid=wt2html,wt2wt,html2html
12150 !! wikitext
12151 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
12152 !! html/php
12153 <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>
12154
12155 !! html/parsoid
12156 <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" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
12157 !! end
12158
12159 !! test
12160 Manually-specified thumbnail image with explicit link to url
12161 !! options
12162 thumbsize=220
12163 parsoid=wt2html,wt2wt,html2html
12164 !! wikitext
12165 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
12166 !! html/php
12167 <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>
12168
12169 !! html/parsoid
12170 <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" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
12171 !! end
12172
12173 !! test
12174 Manually-specified thumbnail image with explicit no link
12175 !! options
12176 thumbsize=220
12177 parsoid=wt2html,wt2wt,html2html
12178 !! wikitext
12179 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
12180 !! html/php
12181 <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>
12182
12183 !! html/parsoid
12184 <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" height="135" width="135"/></span><figcaption>Title</figcaption></figure>
12185 !! end
12186
12187 !! test
12188 Manually-specified thumbnail image with explicit link and alt text
12189 !! options
12190 thumbsize=220
12191 parsoid=wt2html,wt2wt,html2html
12192 !! wikitext
12193 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
12194 !! html/php
12195 <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>
12196
12197 !! html/parsoid
12198 <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" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
12199 !! end
12200
12201 !! test
12202 Image with frame and link
12203 !! options
12204 parsoid=wt2html,wt2wt,html2html
12205 !! wikitext
12206 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
12207 !! html/php
12208 <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>
12209
12210 !! html/parsoid
12211 <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" 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>
12212 !! end
12213
12214 !! test
12215 Image with frame and link and explicit alt
12216 !! options
12217 parsoid=wt2html,wt2wt,html2html
12218 !! wikitext
12219 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
12220 !! html/php
12221 <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>
12222
12223 !! html/parsoid
12224 <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" 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>
12225 !! end
12226
12227 !! test
12228 Image with wiki markup in implicit alt
12229 !! options
12230 parsoid=wt2html,wt2wt,html2html
12231 !! wikitext
12232 [[Image:Foobar.jpg|testing '''bold''' in alt]]
12233
12234 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
12235 !! html/php
12236 <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>
12237 </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>
12238 </p>
12239 !! html/parsoid
12240 <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" height="220" width="1941"/></a></span></p>
12241 <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" height="220" width="1941"/></a></span></p>
12242 !! end
12243
12244 !! test
12245 Alt image option should handle most kinds of wikitext without barfing
12246 !! wikitext
12247 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
12248 !! html/php
12249 <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>
12250
12251 !! html/parsoid
12252 <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" 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>
12253 !! end
12254
12255 ###################
12256 # Conflicting image format options.
12257 # First option specified should 'win'.
12258 # All three cases in each test should be identical.
12259
12260 !! test
12261 Image with 'frameless' first.
12262 !! options
12263 parsoid=wt2html,wt2wt,html2html
12264 !! wikitext
12265 [[File:Foobar.jpg|frameless|caption]]
12266
12267 [[File:Foobar.jpg|frameless|frame|caption]]
12268
12269 [[File:Foobar.jpg|frameless|thumb|caption]]
12270 !! html/php
12271 <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>
12272 </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>
12273 </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>
12274 </p>
12275 !! html/parsoid
12276 <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" height="25" width="220"/></a></span></p>
12277 <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" height="25" width="220"/></a></span></p>
12278 <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" height="25" width="220"/></a></span></p>
12279 !! end
12280
12281 !! test
12282 Image with 'frame' first.
12283 !! options
12284 parsoid=wt2html,wt2wt,html2html
12285 !! wikitext
12286 [[File:Foobar.jpg|frame|caption]]
12287 [[File:Foobar.jpg|frame|frameless|caption]]
12288 [[File:Foobar.jpg|frame|thumb|caption]]
12289 !! html/php
12290 <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>
12291 <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>
12292 <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>
12293
12294 !! html/parsoid
12295 <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" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
12296 <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" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
12297 <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" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
12298 !! end
12299
12300 !! test
12301 Image with 'thumb' first.
12302 !! options
12303 parsoid=wt2html,wt2wt,html2html
12304 !! wikitext
12305 [[File:Foobar.jpg|thumb|caption]]
12306 [[File:Foobar.jpg|thumb|frameless|caption]]
12307 [[File:Foobar.jpg|thumb|frame|caption]]
12308 !! html/php
12309 <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>
12310 <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>
12311 <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>
12312
12313 !! html/parsoid
12314 <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" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
12315 <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" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
12316 <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" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
12317 !! end
12318
12319 ###################
12320 # Image sizing.
12321 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
12322 # and https://bugzilla.wikimedia.org/show_bug.cgi?id=62258
12323 # Foobar has actual size of 1941x220
12324 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
12325 # a scalable format.
12326 # 2. Framed images always ignore size options; always render at default size.
12327 # 3. "Unspecified format" and border are the only types which can be
12328 # enlarged.
12329
12330 !! test
12331 Image: "unspecified format" and border enlarge
12332 !! options
12333 parsoid=wt2html,wt2wt,html2html
12334 !! wikitext
12335 [[File:Foobar.jpg|2000px]]
12336
12337 [[File:Foobar.jpg|border|2000px]]
12338 !! html/php
12339 <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>
12340 </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>
12341 </p>
12342 !! html/parsoid
12343 <p><span typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="227" width="2000"/></a></span></p>
12344 <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" height="227" width="2000"/></a></span></p>
12345 !! end
12346
12347 !! test
12348 Image: "unspecified format" and border reduce
12349 !! options
12350 parsoid=wt2html,wt2wt,html2html
12351 !! wikitext
12352 [[File:Foobar.jpg|1000px]]
12353
12354 [[File:Foobar.jpg|border|1000px]]
12355 !! html/php
12356 <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>
12357 </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>
12358 </p>
12359 !! html/parsoid
12360 <p><span typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="113" width="1000"/></a></span></p>
12361 <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" height="113" width="1000"/></a></span></p>
12362 !! end
12363
12364 !! test
12365 Image: thumbs reduce
12366 !! options
12367 parsoid=wt2html,wt2wt,html2html
12368 !! wikitext
12369 [[File:Foobar.jpg|thumb|50px]]
12370 !! html/php
12371 <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>
12372
12373 !! html/parsoid
12374 <figure typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="6" width="50"/></a></figure>
12375 !! end
12376
12377 !! test
12378 Image: bitmap thumbs can't be enlarged past original size, but vector can.
12379 !! options
12380 parsoid=wt2html,wt2wt,html2html
12381 !! wikitext
12382 [[File:Foobar.jpg|thumb|2000px]]
12383
12384 [[File:Foobar.svg|thumb|2000px]]
12385 !! html/php
12386 <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>
12387 <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>
12388
12389 !! html/parsoid
12390 <figure typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></figure>
12391 <figure typeof="mw:Image/Thumb"><a href="File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/f/ff/Foobar.svg" height="1500" width="2000"/></a></figure>
12392 !! end
12393
12394 !! test
12395 Image: frameless can reduce in size
12396 !! options
12397 parsoid=wt2html,wt2wt,html2html
12398 !! wikitext
12399 [[File:Foobar.jpg|frameless|50px]]
12400 !! html/php
12401 <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>
12402 </p>
12403 !! html/parsoid
12404 <p><span typeof="mw:Image/Frameless"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="6" width="50"/></a></span></p>
12405 !! end
12406
12407 !! test
12408 Image: bitmap frameless can't be enlarged past original size, but vector can
12409 !! options
12410 parsoid=wt2html,wt2wt,html2html
12411 !! wikitext
12412 [[File:Foobar.jpg|frameless|2000px]]
12413
12414 [[File:Foobar.svg|frameless|2000px]]
12415 !! html/php
12416 <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>
12417 </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>
12418 </p>
12419 !! html/parsoid
12420 <p><span typeof="mw:Image/Frameless"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></span></p>
12421 <p><span typeof="mw:Image/Frameless"><a href="File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/f/ff/Foobar.svg" height="1500" width="2000"/></a></span></p>
12422 !! end
12423
12424 !! test
12425 Image: framed images are always unscaled.
12426 !! options
12427 parsoid=wt2html,wt2wt,html2html
12428 !! wikitext
12429 [[File:Foobar.jpg|frame]]
12430
12431 [[File:Foobar.jpg|frame|50px]]
12432
12433 [[File:Foobar.jpg|frame|50x50px]]
12434
12435 [[File:Foobar.jpg|frame|2000px]]
12436 !! html/php
12437 <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>
12438 <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>
12439 <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>
12440 <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>
12441
12442 !! html/parsoid
12443 <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" height="220" width="1941"/></a></figure>
12444 <figure typeof="mw:Image/Frame"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></figure>
12445 <figure typeof="mw:Image/Frame"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></figure>
12446 <figure typeof="mw:Image/Frame"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></figure>
12447 !! end
12448
12449 ###################
12450
12451 !! test
12452 Link to image page- image page normally doesn't exists, hence edit link
12453 Add test with existing image page
12454 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
12455 !! wikitext
12456 [[:Image:test]]
12457 !! html
12458 <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>
12459 </p>
12460 !! end
12461
12462 !! test
12463 bug 18784 Link to non-existent image page with caption should use caption as link text
12464 !! wikitext
12465 [[:Image:test|caption]]
12466 !! html
12467 <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>
12468 </p>
12469 !! end
12470
12471 !! test
12472 Frameless image caption with a free URL
12473 !! wikitext
12474 [[File:Foobar.jpg|http://example.com]]
12475 !! html/php
12476 <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>
12477 </p>
12478 !! html/parsoid
12479 <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" height="220" width="1941"/></a></span></p>
12480 !! end
12481
12482 !! test
12483 Thumbnail image caption with a free URL
12484 !! options
12485 thumbsize=220
12486 !! wikitext
12487 [[File:Foobar.jpg|thumb|http://example.com]]
12488 !! html/php
12489 <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>
12490
12491 !! html/parsoid
12492 <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" height="25" width="220"/></a><figcaption><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></figcaption></figure>
12493 !! end
12494
12495 !! test
12496 Thumbnail image caption with a free URL and explicit alt
12497 !! options
12498 thumbsize=220
12499 parsoid=wt2html,wt2wt,html2html
12500 !! wikitext
12501 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
12502 !! html/php
12503 <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>
12504
12505 !! html/parsoid
12506 <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" height="25" width="220"/></a><figcaption><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></figcaption></figure>
12507 !! end
12508
12509 !! test
12510 SVG thumbnails with no language set
12511 !! options
12512 !! wikitext
12513 [[File:Foobar.svg|thumb|caption]]
12514 !! html/php
12515 <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>
12516
12517 !! html/parsoid
12518 <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" height="165" width="220"/></a><figcaption>caption</figcaption></figure>
12519 !! end
12520
12521 !! test
12522 SVG thumbnails with language de
12523 !! options
12524 parsoid=wt2html,wt2wt,html2html
12525 !! wikitext
12526 [[File:Foobar.svg|thumb|caption|lang=de]]
12527 !! html/php
12528 <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>
12529
12530 !! html/parsoid
12531 <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" height="165" width="220"/></a><figcaption>caption</figcaption></figure>
12532 !! end
12533
12534 !! test
12535 SVG thumbnails with invalid language code
12536 !! options
12537 parsoid=wt2html,wt2wt,html2html
12538 !! wikitext
12539 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
12540 !! html/php
12541 <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>
12542
12543 !! html/parsoid
12544 <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" height="165" width="220"/></a><figcaption>lang=invalid.language.code</figcaption></figure>
12545 !! end
12546
12547 !! test
12548 BUG 1887: A ISBN with a thumbnail
12549 !! wikitext
12550 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
12551 !! html/php
12552 <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>
12553
12554 !! html/parsoid
12555 <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" height="25" width="220"/></a><figcaption><a href="Special:BookSources/1235467890" rel="mw:ExtLink">ISBN 1235467890</a></figcaption></figure>
12556 !! end
12557
12558 !! test
12559 BUG 1887: A RFC with a thumbnail
12560 !! wikitext
12561 [[File:Foobar.jpg|thumb|This is RFC 12354]]
12562 !! html/php
12563 <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>
12564
12565 !! html/parsoid
12566 <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" height="25" width="220"/></a><figcaption>This is <a href="//tools.ietf.org/html/rfc12354" rel="mw:ExtLink">RFC 12354</a></figcaption></figure>
12567 !! end
12568
12569 !! test
12570 BUG 1887: A mailto link with a thumbnail
12571 !! wikitext
12572 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
12573 !! html/php
12574 <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>
12575
12576 !! html/parsoid
12577 <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" height="25" width="220"/></a><figcaption>Please <a rel="mw:ExtLink" href="mailto:nobody@example.com">mailto:nobody@example.com</a></figcaption></figure>
12578 !! end
12579
12580 # Pending resolution to bug 368
12581 !! test
12582 BUG 648: Frameless image caption with a link
12583 !! wikitext
12584 [[File:Foobar.jpg|text with a [[link]] in it]]
12585 !! html/php
12586 <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>
12587 </p>
12588 !! html/parsoid
12589 <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" height="220" width="1941"/></a></span></p>
12590 !! end
12591
12592 !! test
12593 BUG 648: Frameless image caption with a link (suffix)
12594 !! wikitext
12595 [[File:Foobar.jpg|text with a [[link]]foo in it]]
12596 !! html/php
12597 <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>
12598 </p>
12599 !! html/parsoid
12600 <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" height="220" width="1941"/></a></span></p>
12601 !! end
12602
12603 !! test
12604 BUG 648: Frameless image caption with an interwiki link
12605 !! wikitext
12606 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
12607 !! html/php
12608 <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>
12609 </p>
12610 !! html/parsoid
12611 <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" height="220" width="1941"/></a></span></p>
12612 !! end
12613
12614 !! test
12615 BUG 648: Frameless image caption with a piped interwiki link
12616 !! wikitext
12617 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
12618 !! html/php
12619 <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>
12620 </p>
12621 !! html/parsoid
12622 <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" height="220" width="1941"/></a></span></p>
12623 !! end
12624
12625 !! test
12626 Escape HTML special chars in image alt text
12627 !! wikitext
12628 [[File:Foobar.jpg|& < > "]]
12629 !! html/php
12630 <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>
12631 </p>
12632 !! html/parsoid
12633 <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" height="220" width="1941"/></a></span></p>
12634 !! end
12635
12636 !! test
12637 BUG 499: Alt text should have &#1234;, not &amp;1234;
12638 !! wikitext
12639 [[File:Foobar.jpg|&#9792;]]
12640 !! html/php
12641 <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>
12642 </p>
12643 !! html/parsoid
12644 <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" height="220" width="1941"/></a></span></p>
12645 !! end
12646
12647 !! test
12648 Broken image caption with link
12649 !! options
12650 parsoid=wt2html,wt2wt,html2html
12651 !! wikitext
12652 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
12653 !! html/php
12654 <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.
12655 </p>
12656 !! html/parsoid
12657 <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>
12658 !! end
12659
12660 !! test
12661 Image caption containing another image
12662 !! wikitext
12663 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
12664 !! html/php
12665 <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>
12666
12667 !! html/parsoid
12668 <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" 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" height="135" width="135"/></a></span> inside it!</figcaption></figure>
12669 !! end
12670
12671 !! test
12672 Image: caption containing a newline
12673 !! wikitext
12674 [[File:Foobar.jpg|This
12675 *is some text]]
12676 !! html/php
12677 <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>
12678 </p>
12679 !! html/parsoid
12680 <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" height="220" width="1941"/></a></span></p>
12681 !!end
12682
12683 !!test
12684 Image: caption containing leading space
12685 (The leading space should not trigger nowiki escaping in wt2wt mode)
12686 !! wikitext
12687 [[File:Foobar.jpg|thumb| bar]]
12688 !! html/php
12689 <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>
12690
12691 !! html/parsoid
12692 <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" height="25" width="220"/></a><figcaption> bar</figcaption></figure>
12693 !!end
12694
12695 !! test
12696 Image: caption containing a table
12697 !! options
12698 parsoid=wt2html,wt2wt,html2html
12699 !! wikitext
12700 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
12701 {|
12702 ! Foo !! Bar
12703 |-
12704 | Foo1 || Bar1
12705 |}
12706 and some more text.]]
12707 !! html/php
12708 <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>
12709
12710 !! html/parsoid
12711 <figure typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="23" width="200"/></a><figcaption>This is an example image thumbnail caption with a table
12712 <table>
12713 <tbody>
12714 <tr><th>Foo </th><th>Bar</th></tr>
12715 <tr>
12716 <td>Foo1 </td>
12717 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
12718 !! end
12719
12720 !! test
12721 Bug 3090: External links other than http: in image captions
12722 !! wikitext
12723 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
12724 !! html/php
12725 <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>
12726
12727 !! html/parsoid
12728 <figure typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" 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>
12729 !! end
12730
12731 !! test
12732 Custom class
12733 !! options
12734 parsoid=wt2html,wt2wt,html2html
12735 !! wikitext
12736 [[Image:foobar.jpg|a|class=b]]
12737 !! html/php
12738 <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>
12739 </p>
12740 !! html/parsoid
12741 <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" height="220" width="1941"/></a></span></p>
12742 !! end
12743
12744 !! test
12745 Localized image handling (1).
12746 !! options
12747 parsoid=wt2html,wt2wt,html2html
12748 language=es
12749 !! wikitext
12750 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
12751 !! html/php
12752 <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>
12753
12754 !! html/parsoid
12755 <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" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
12756 !! end
12757
12758 !! test
12759 Localized image handling (2).
12760 !! options
12761 thumbsize=220
12762 parsoid=wt2html,wt2wt,html2html
12763 language=es
12764 !! wikitext
12765 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
12766 !! html/php
12767 <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>
12768
12769 !! html/parsoid
12770 <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" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
12771 !! end
12772
12773 !! test
12774 "border", "frameless" and "class" attributes on an image.
12775 !! options
12776 thumbsize=220
12777 parsoid=wt2html,wt2wt,html2html
12778 !! wikitext
12779 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
12780 !! html/php
12781 <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>
12782 </p>
12783 !! html/parsoid
12784 <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" height="25" width="220"/></a></span></p>
12785 !! end
12786
12787 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
12788 !! test
12789 Invalid image attributes (bug 62500)
12790 !! options
12791 thumbsize=220
12792 parsoid=wt2html,wt2wt,html2html
12793 !! wikitext
12794 [[File:Foobar.jpg|thumb|float|left|caption]]
12795
12796 [[File:Foobar.jpg|thumb|righ|caption]]
12797
12798 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
12799 !! html/php
12800 <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>
12801 <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>
12802 <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>
12803
12804 !! html/parsoid
12805 <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" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
12806 <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" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
12807 <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" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
12808 !! end
12809
12810 !! article
12811 File:Barfoo.jpg
12812 !! text
12813 #REDIRECT [[File:Barfoo.jpg]]
12814 !! endarticle
12815
12816 # FIXME: Parsoid should run this test -- but we'd need to teach the
12817 # mockAPI about the redirected Barfoo.jpg image.
12818 !! test
12819 Redirected image
12820 !! wikitext
12821 [[Image:Barfoo.jpg]]
12822 !! html/php
12823 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
12824 </p>
12825 !! end
12826
12827 !! test
12828 Missing image with uploads disabled
12829 !! options
12830 wgEnableUploads=0
12831 !! wikitext
12832 [[File:Foobaz.jpg]]
12833 !! html/php
12834 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
12835 </p>
12836 !! html/parsoid
12837 <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>
12838 !! end
12839
12840 # Parsoid-specific testing for images
12841 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
12842 # Currently imperfect due to a flaw in the Parsoid testrunner
12843 # Work in progress
12844 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
12845 # image tests.
12846
12847 !! test
12848 Parsoid-specific image handling - simple image with size and middle alignment
12849 !! wikitext
12850 [[File:Foobar.jpg|middle|50px]]
12851 !! html/parsoid
12852 <p><span class="mw-valign-middle" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50"></a></span></p>
12853 !! end
12854
12855 !! test
12856 Parsoid-specific image handling - simple image with size, middle alignment,
12857 non-standard namespace alias
12858 !! options
12859 parsoid=wt2wt,wt2html,html2html
12860 !! wikitext
12861 [[Image:Foobar.jpg|middle|50px]]
12862 !! html/parsoid
12863 <p><span class="mw-valign-middle" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50"></a></span></p>
12864 !! end
12865
12866 !! test
12867 Parsoid-specific image handling - simple image with size and middle alignment
12868 (existing content)
12869 !! wikitext
12870 [[File:Foobar.jpg|50px|middle]]
12871 !! html/parsoid
12872 <p><span class="mw-valign-middle" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"width","ak":"50px"},{"ck":"middle","ak":"middle"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"6","width":"50"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
12873 !! end
12874
12875 !! test
12876 Parsoid-specific image handling - simple image with size and middle alignment
12877 and non-standard namespace name
12878 !! options
12879 parsoid=wt2html,wt2wt,html2html
12880 !! wikitext
12881 [[Image:Foobar.jpg|50px|middle]]
12882 !! html/parsoid
12883 <p><span class="mw-valign-middle" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50"></a></span></p>
12884 !! end
12885
12886 !! test
12887 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
12888 !! wikitext
12889 [[File:Foobar.jpg|500x10px|baseline|caption]]
12890 !! html/parsoid
12891 <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" height="10" width="89" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"10","width":"89"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
12892 !! end
12893
12894 !! test
12895 Parsoid-specific image handling - simple image with border and size spec
12896 !! wikitext
12897 [[File:Foobar.jpg|50px|border|caption]]
12898 !! html/parsoid
12899 <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" height="6" width="50" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"6","width":"50"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
12900 !! end
12901
12902 !! test
12903 Parsoid-specific image handling - thumbnail with halign, valign, and caption
12904 !! wikitext
12905 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
12906 !! html/parsoid
12907 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" height="25" width="220" /></a><figcaption>caption content</figcaption></figure>
12908 !! end
12909
12910 !! test
12911 Parsoid-specific image handling - thumbnail with halign, valign, and caption
12912 (existing content)
12913 !! wikitext
12914 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
12915 !! html/parsoid
12916 <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" 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>
12917 !! end
12918
12919 !! test
12920 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
12921 !! wikitext
12922 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
12923 !! html/parsoid
12924 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50" /></a><figcaption>caption</figcaption></figure>
12925 !! end
12926
12927 !! test
12928 Parsoid-specific image handling - thumbnail with specific size, halign,
12929 valign, and caption (existing content)
12930 !! wikitext
12931 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
12932 !! html/parsoid
12933 <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" 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>
12934 !! end
12935
12936 !! test
12937 Parsoid-specific image handling - framed image with specific size and caption
12938 (size is ignored)
12939 !! options
12940 parsoid=wt2html,wt2wt,html2html
12941 !! wikitext
12942 [[File:Foobar.jpg|frame|500x50px|caption]]
12943 !! html/parsoid
12944 <figure typeof="mw:Image/Frame"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941" /></a><figcaption>caption</figcaption></figure>
12945 !! end
12946
12947 !! test
12948 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
12949 (size is ignored)
12950 !! options
12951 parsoid=wt2html,wt2wt,html2html
12952 !! wikitext
12953 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
12954 !! html/parsoid
12955 <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" height="220" width="1941" /></a><figcaption>caption</figcaption></figure>
12956 !! end
12957
12958 !! test
12959 Parsoid-specific image handling - frameless image with specific size, border, and caption
12960 !! wikitext
12961 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
12962 !! html/parsoid
12963 <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" height="50" width="442" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"50","width":"442"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
12964 !! end
12965
12966 !! test
12967 Parsoid-specific image handling - simple image with a formatted caption
12968 !! wikitext
12969 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
12970 !! html/parsoid
12971 <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" height="220" width="1941"></a></span></p>
12972 !! end
12973
12974 !! test
12975 Parsoid-specific image handling - caption with a template in it
12976 !! wikitext
12977 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
12978 !! html/parsoid
12979 <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" 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>
12980 !! end
12981
12982 !! test
12983 Parsoid-specific image handling - caption with unbalanced tags in it
12984 !! options
12985 parsoid=wt2html,wt2wt,html2html
12986 !! wikitext
12987 foo
12988 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
12989 bar
12990 !! html/parsoid
12991 <p>foo</p>
12992 <figure typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="23" width="200"></a><figcaption>This caption has a <center>unbalanced tag in it.</center></figcaption></figure>
12993 <p>bar</p>
12994 !! end
12995
12996 !! test
12997 Parsoid-specific image handling - empty caption (1)
12998 !! options
12999 parsoid=wt2html,wt2wt
13000 !! wikitext
13001 [[File:Foobar.jpg|thumb|]]
13002 !! html/parsoid
13003 <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" height="25" width="220"/></a><figcaption></figcaption></figure>
13004 !! end
13005
13006 # empty captions don't get serialized unless we're in the "round trip" case
13007 !! test
13008 Parsoid-specific image handling - empty caption (2)
13009 !! options
13010 parsoid=html2wt
13011 !! html/parsoid
13012 <figure class="mw-default-size" typeof="mw:Image/Thumb">
13013 <a href="File:Foobar.jpg">
13014 <img resource="./File:Foobar.jpg"
13015 src="//example.com/images/3/3a/Foobar.jpg"
13016 height="25" width="220"/>
13017 </a>
13018 <figcaption></figcaption>
13019 </figure>
13020 !! wikitext
13021 [[File:Foobar.jpg|thumb]]
13022 !! end
13023
13024 !! test
13025 Parsoid-specific image handling - whitespace caption
13026 !! wikitext
13027 [[File:Foobar.jpg|thumb| ]]
13028 !! html/parsoid
13029 <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" height="25" width="220"/></a><figcaption> </figcaption></figure>
13030 !! end
13031
13032 !! test
13033 Parsoid-specific image handling - lang option
13034 !! wikitext
13035 foo
13036 [[File:Foobar.svg|lang=de|caption]]
13037 bar
13038 !! html/parsoid
13039 <p>foo
13040 <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" height="180" width="240"/></a></span>
13041 bar</p>
13042 !! end
13043
13044
13045 ###
13046 ### Subpages
13047 ###
13048 !! article
13049 Subpage test/subpage
13050 !! text
13051 foo
13052 !! endarticle
13053
13054 !! test
13055 Subpage link
13056 !! options
13057 subpage title=[[Subpage test]]
13058 !! wikitext
13059 [[/subpage]]
13060 !! html
13061 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
13062 </p>
13063 !! end
13064
13065 !! test
13066 Subpage noslash link
13067 !! options
13068 subpage title=[[Subpage test]]
13069 !! wikitext
13070 [[/subpage/]]
13071 !! html
13072 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
13073 </p>
13074 !! end
13075
13076 !! article
13077 Subpage test/1/2/subpage
13078 !! text
13079 blah
13080 !! endarticle
13081
13082 !! test
13083 Relative subpage noslash link
13084 !! options
13085 parsoid=wt2wt,wt2html,html2html
13086 subpage title=[[Subpage test/1/2/3/4]]
13087 !! wikitext
13088 [[../../subpage/]]
13089
13090 [[../../subpage]]
13091 !! html/php
13092 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
13093 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
13094 </p>
13095 !! html/parsoid
13096 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
13097 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
13098 !! end
13099
13100 !! test
13101 Parsoid: dot-slash prefixed wikilinks
13102 !! wikitext
13103 [[./foo]]
13104
13105 [[././bar]]
13106
13107 [[././baz/]]
13108 !! html/php
13109 <p>[[./foo]]
13110 </p><p>[[././bar]]
13111 </p><p>[[././baz/]]
13112 </p>
13113 !! html/parsoid
13114 <p>[[./foo]]
13115 </p><p>[[././bar]]
13116 </p><p>[[././baz/]]
13117 </p>
13118 !! end
13119
13120 !! test
13121 Render invalid page names as plain text (bug 51090)
13122 !! wikitext
13123 [[./../foo|bar]]
13124 [[foo�|bar]]
13125 [[foo/.|bar]]
13126 [[foo/..|bar]]
13127 [[foo~~~bar]]
13128 [[foo>bar]]
13129 [[foo[bar]]
13130 [[.]]
13131 [[..]]
13132 [[foo././bar]]
13133
13134 [[{{echo|./../foo}}|bar]]
13135 [[{{echo|foo/.}}|bar]]
13136 [[{{echo|foo/..}}|bar]]
13137 [[{{echo|foo~~~~bar}}]]
13138 [[{{echo|foo>bar}}]]
13139 [[{{echo|foo././bar}}]]
13140 [[{{echo|foo{bar}}]]
13141 [[{{echo|foo}bar}}]]
13142 [[{{echo|foo[bar}}]]
13143 [[{{echo|foo]bar}}]]
13144 [[{{echo|foo<bar}}]]
13145 !!html/php
13146 <p>[[./../foo|bar]]
13147 [[foo�|bar]]
13148 [[foo/.|bar]]
13149 [[foo/..|bar]]
13150 [[foo~~~bar]]
13151 [[foo&gt;bar]]
13152 [[foo[bar]]
13153 [[.]]
13154 [[..]]
13155 [[foo././bar]]
13156 </p><p>[[./../foo|bar]]
13157 [[foo/.|bar]]
13158 [[foo/..|bar]]
13159 [[foo~~~~bar]]
13160 [[foo&gt;bar]]
13161 [[foo././bar]]
13162 [[foo{bar]]
13163 [[foo}bar]]
13164 [[foo[bar]]
13165 [[foo]bar]]
13166 [[foo&lt;bar]]
13167 </p>
13168 !!html/parsoid
13169 <p>[[./../foo|bar]]
13170 [[foo�|bar]]
13171 [[foo/.|bar]]
13172 [[foo/..|bar]]
13173 [[foo~~~bar]]
13174 [[foo>bar]]
13175 [[foo[bar]]
13176 [[.]]
13177 [[..]]
13178 [[foo././bar]]</p>
13179
13180 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
13181 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
13182 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
13183 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
13184 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
13185 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
13186 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
13187 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
13188 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
13189 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
13190 [[<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>
13191 !!end
13192
13193 !! test
13194 Disabled subpages
13195 !! wikitext
13196 [[/subpage]]
13197 !! html
13198 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
13199 </p>
13200 !! end
13201
13202 !! test
13203 BUG 561: {{/Subpage}}
13204 !! options
13205 subpage title=[[Page]]
13206 !! wikitext
13207 {{/Subpage}}
13208 !! html
13209 <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>
13210 </p>
13211 !! end
13212
13213 ###
13214 ### Categories
13215 ###
13216 !! article
13217 Category:MediaWiki User's Guide
13218 !! text
13219 blah
13220 !! endarticle
13221
13222 !! test
13223 Link to category
13224 !! wikitext
13225 [[:Category:MediaWiki User's Guide]]
13226 !! html
13227 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
13228 </p>
13229 !! end
13230
13231 !! test
13232 Simple category
13233 !! options
13234 cat
13235 !! wikitext
13236 [[Category:MediaWiki User's Guide]]
13237 !! html
13238 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
13239 !! end
13240
13241 !! test
13242 PAGESINCATEGORY invalid title fatal (r33546 fix)
13243 !! wikitext
13244 {{PAGESINCATEGORY:<bogus>}}
13245 !! html
13246 <p>0
13247 </p>
13248 !! end
13249
13250 !! test
13251 Category with different sort key
13252 !! options
13253 cat
13254 !! wikitext
13255 [[Category:MediaWiki User's Guide|Foo]]
13256 !! html
13257 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
13258 !! end
13259
13260 !! test
13261 Category with identical sort key
13262 !! options
13263 cat
13264 !! wikitext
13265 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
13266 !! html
13267 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
13268 !! end
13269
13270 !! test
13271 Category with empty sort key
13272 !! options
13273 cat
13274 pst
13275 !! wikitext
13276 [[Category:MediaWiki User's Guide|]]
13277 !! html
13278 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
13279 !! end
13280
13281 !! test
13282 Category with empty sort key and parentheses
13283 !! options
13284 cat
13285 pst
13286 !! wikitext
13287 [[Category:Foo (bar)|]]
13288 !! html
13289 [[Category:Foo (bar)|Foo]]
13290 !! end
13291
13292 !! test
13293 Category with link tail
13294 !! options
13295 cat
13296 pst
13297 !! wikitext
13298 123[[Category:Foo]]456
13299 !! html
13300 123[[Category:Foo]]456
13301 !! end
13302
13303 !! test
13304 Category with template
13305 !! options
13306 cat
13307 pst
13308 !! wikitext
13309 [[Category:{{echo|Foo}}]]
13310 !! html
13311 [[Category:{{echo|Foo}}]]
13312 !! end
13313
13314 !! test
13315 Category with template in sort key
13316 !! options
13317 cat
13318 pst
13319 !! wikitext
13320 [[Category:Foo|{{echo|Bar}}]]
13321 !! html
13322 [[Category:Foo|{{echo|Bar}}]]
13323 !! end
13324
13325 !! test
13326 Category with template in sort key and title
13327 !! options
13328 cat
13329 pst
13330 !! wikitext
13331 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
13332 !! html
13333 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
13334 !! end
13335
13336 !! test
13337 Category / paragraph interactions
13338 !! wikitext
13339 Foo [[Category:Baz]] Bar
13340
13341 Foo [[Category:Baz]]
13342 Bar
13343
13344 Foo
13345 [[Category:Baz]]
13346 Bar
13347
13348 Foo
13349 [[Category:Baz]] Bar
13350
13351 Foo
13352 [[Category:Baz]]
13353 [[Category:Baz]]
13354 [[Category:Baz]]
13355 Bar
13356
13357 [[Category:Baz]]
13358 [[Category:Baz]]
13359 [[Category:Baz]]
13360
13361 [[Category:Baz]]
13362 {{echo|[[Category:Baz]]}}
13363 [[Category:Baz]]
13364 !! html
13365 <p>Foo Bar
13366 </p><p>Foo
13367 Bar
13368 </p><p>Foo
13369 Bar
13370 </p><p>Foo Bar
13371 </p><p>Foo
13372 Bar
13373 </p>
13374 !! end
13375
13376 !! test
13377 Parsoid: Serialize link to category page with colon escape
13378 !! options
13379 parsoid
13380 !! wikitext
13381
13382 [[:Category:Foo]]
13383 [[:Category:Foo|Bar]]
13384 !! html
13385 <p>
13386 <a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Category:Foo</a>
13387 <a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Bar</a>
13388 </p>
13389 !! end
13390
13391 !! test
13392 Parsoid: Link prefix/suffixes aren't applied to category links
13393 !! options
13394 parsoid=wt2html,wt2wt,html2html
13395 language=is
13396 !! wikitext
13397 x[[Category:Foo]]y
13398 !! html
13399 <p>x<link rel="mw:PageProp/Category" href="Category:Foo">y</p>
13400 !! end
13401
13402 !! test
13403 Parsoid: Serialize link to file page with colon escape
13404 !! options
13405 parsoid
13406 !! wikitext
13407
13408 [[:File:Foo.png]]
13409 [[:File:Foo.png|Bar]]
13410 !! html
13411 <p>
13412 <a rel="mw:WikiLink" href="File:Foo.png" title="File:Foo.png">File:Foo.png</a>
13413 <a rel="mw:WikiLink" href="File:Foo.png" title="File:Foo.png">Bar</a>
13414 </p>
13415 !! end
13416
13417 !! test
13418 Parsoid: Serialize a genuine category link without colon escape
13419 !! options
13420 parsoid
13421 !! wikitext
13422 [[Category:Foo]]
13423 [[Category:Foo|Bar]]
13424 !! html
13425 <link rel="mw:PageProp/Category" href="Category:Foo">
13426 <link rel="mw:PageProp/Category" href="Category:Foo#Bar">
13427 !! end
13428
13429 !! test
13430 Normalize hrefs properly before testing for invalid link targets (bug 70894)
13431 !! options
13432 parsoid=html2wt
13433 !! html
13434 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
13435 !! wikitext
13436 [[Category:Toxine bactérienne]]
13437 !! end
13438
13439 !! test
13440 Parsoid: Defaultsort
13441 !! wikitext
13442 {{DEFAULTSORT:Foo}}
13443 !! html/parsoid
13444 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
13445 !! end
13446
13447 !! test
13448 Parsoid: Defaultsort (template-generated)
13449 !! wikitext
13450 {{{{echo|DEFAULTSORT}}:Foo}}
13451 !! html/parsoid
13452 <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}}]}'/>
13453 !! end
13454
13455 ###
13456 ### Inter-language links
13457 ###
13458 !! test
13459 Interlanguage links
13460 !! options
13461 ill
13462 !! wikitext
13463 [[es:Alimento]]
13464 [[fr:Nourriture]]
13465 [[zh:食品]]
13466 !! html/php
13467 es:Alimento fr:Nourriture zh:食品
13468 !! html/parsoid
13469 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
13470 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
13471 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
13472 !! end
13473
13474 !! test
13475 Duplicate interlanguage links (bug 24502)
13476 !! options
13477 ill
13478 !! wikitext
13479 [[es:1]]
13480 [[es:2]]
13481 [[fr:1]]
13482 [[fr:2]]
13483 !! html/php
13484 es:1 fr:1
13485 !! html/parsoid
13486 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
13487 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
13488 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
13489 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
13490 !! end
13491
13492 ###
13493 ### Sections
13494 ###
13495 !! test
13496 Basic section headings
13497 !! wikitext
13498 == Headline 1 ==
13499 Some text
13500
13501 ==Headline 2==
13502 More
13503 ===Smaller headline===
13504 Blah blah
13505 !! html
13506 <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>
13507 <p>Some text
13508 </p>
13509 <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>
13510 <p>More
13511 </p>
13512 <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>
13513 <p>Blah blah
13514 </p>
13515 !! end
13516
13517 !! test
13518 Section headings with TOC
13519 !! wikitext
13520 == Headline 1 ==
13521 === Subheadline 1 ===
13522 ===== Skipping a level =====
13523 ====== Skipping a level ======
13524
13525 == Headline 2 ==
13526 Some text
13527 ===Another headline===
13528 !! html
13529 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13530 <ul>
13531 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
13532 <ul>
13533 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
13534 <ul>
13535 <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>
13536 <ul>
13537 <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>
13538 </ul>
13539 </li>
13540 </ul>
13541 </li>
13542 </ul>
13543 </li>
13544 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
13545 <ul>
13546 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
13547 </ul>
13548 </li>
13549 </ul>
13550 </div>
13551
13552 <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>
13553 <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>
13554 <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>
13555 <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>
13556 <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>
13557 <p>Some text
13558 </p>
13559 <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>
13560
13561 !! end
13562
13563 !! test
13564 TOC anchors don't collide
13565 !! wikitext
13566 __FORCETOC__
13567 == Headline 2 ==
13568 == Headline ==
13569 == Headline 2 ==
13570 == Headline ==
13571 !! html
13572 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13573 <ul>
13574 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
13575 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
13576 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
13577 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
13578 </ul>
13579 </div>
13580
13581 <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>
13582 <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>
13583 <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>
13584 <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>
13585
13586 !! end
13587
13588 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
13589 !! test
13590 Handling of sections up to level 6 and beyond
13591 !! wikitext
13592 = Level 1 Heading=
13593 == Level 2 Heading==
13594 === Level 3 Heading===
13595 ==== Level 4 Heading====
13596 ===== Level 5 Heading=====
13597 ====== Level 6 Heading======
13598 ======= Level 7 Heading=======
13599 ======== Level 8 Heading========
13600 ========= Level 9 Heading=========
13601 ========== Level 10 Heading==========
13602 !! html
13603 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13604 <ul>
13605 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
13606 <ul>
13607 <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>
13608 <ul>
13609 <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>
13610 <ul>
13611 <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>
13612 <ul>
13613 <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>
13614 <ul>
13615 <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>
13616 <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>
13617 <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>
13618 <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>
13619 <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>
13620 </ul>
13621 </li>
13622 </ul>
13623 </li>
13624 </ul>
13625 </li>
13626 </ul>
13627 </li>
13628 </ul>
13629 </li>
13630 </ul>
13631 </div>
13632
13633 <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>
13634 <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>
13635 <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>
13636 <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>
13637 <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>
13638 <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>
13639 <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>
13640 <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>
13641 <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>
13642 <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>
13643
13644 !! end
13645
13646 !! test
13647 TOC regression (T11764)
13648 !! wikitext
13649 == title 1 ==
13650 === title 1.1 ===
13651 ==== title 1.1.1 ====
13652 === title 1.2 ===
13653 == title 2 ==
13654 === title 2.1 ===
13655 !! html
13656 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13657 <ul>
13658 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
13659 <ul>
13660 <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>
13661 <ul>
13662 <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>
13663 </ul>
13664 </li>
13665 <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>
13666 </ul>
13667 </li>
13668 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
13669 <ul>
13670 <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>
13671 </ul>
13672 </li>
13673 </ul>
13674 </div>
13675
13676 <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>
13677 <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>
13678 <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>
13679 <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>
13680 <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>
13681 <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>
13682
13683 !! end
13684
13685 !! test
13686 TOC with wgMaxTocLevel=3 (bug 6204)
13687 !! options
13688 wgMaxTocLevel=3
13689 !! wikitext
13690 == title 1 ==
13691 === title 1.1 ===
13692 ==== title 1.1.1 ====
13693 === title 1.2 ===
13694 == title 2 ==
13695 === title 2.1 ===
13696 !! html
13697 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13698 <ul>
13699 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
13700 <ul>
13701 <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>
13702 <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>
13703 </ul>
13704 </li>
13705 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
13706 <ul>
13707 <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>
13708 </ul>
13709 </li>
13710 </ul>
13711 </div>
13712
13713 <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>
13714 <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>
13715 <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>
13716 <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>
13717 <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>
13718 <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>
13719
13720 !! end
13721
13722 !! test
13723 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
13724 !! options
13725 wgMaxTocLevel=3
13726 !! wikitext
13727 ==Section 1==
13728 ===Section 1.1===
13729 ====Section 1.1.1====
13730 ====Section 1.1.1.1====
13731 ==Section 2==
13732 !! html
13733 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13734 <ul>
13735 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
13736 <ul>
13737 <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>
13738 </ul>
13739 </li>
13740 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
13741 </ul>
13742 </div>
13743
13744 <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>
13745 <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>
13746 <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>
13747 <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>
13748 <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>
13749
13750 !! end
13751
13752
13753 !! test
13754 Resolving duplicate section names
13755 !! wikitext
13756 == Foo bar ==
13757 == Foo bar ==
13758 !! html
13759 <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>
13760 <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>
13761
13762 !! end
13763
13764 !! test
13765 Resolving duplicate section names with differing case (bug 10721)
13766 !! wikitext
13767 == Foo bar ==
13768 == Foo Bar ==
13769 !! html
13770 <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>
13771 <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>
13772
13773 !! end
13774
13775 !! article
13776 Template:sections
13777 !! text
13778 ===Section 1===
13779 ==Section 2==
13780 !! endarticle
13781
13782 !! test
13783 Template with sections, __NOTOC__
13784 !! wikitext
13785 __NOTOC__
13786 ==Section 0==
13787 {{sections}}
13788 ==Section 4==
13789 !! html
13790 <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>
13791 <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>
13792 <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>
13793 <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>
13794
13795 !! end
13796
13797 !! test
13798 __NOEDITSECTION__ keyword
13799 !! wikitext
13800 __NOEDITSECTION__
13801 ==Section 1==
13802 ==Section 2==
13803 !! html
13804 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
13805 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
13806
13807 !! end
13808
13809 !! test
13810 Link inside a section heading
13811 !! wikitext
13812 ==Section with a [[Main Page|link]] in it==
13813 !! html
13814 <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>
13815
13816 !! end
13817
13818 !! test
13819 TOC regression (T14077)
13820 !! wikitext
13821 __TOC__
13822 == title 1 ==
13823 === title 1.1 ===
13824 == title 2 ==
13825 !! html
13826 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13827 <ul>
13828 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
13829 <ul>
13830 <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>
13831 </ul>
13832 </li>
13833 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
13834 </ul>
13835 </div>
13836
13837 <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>
13838 <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>
13839 <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>
13840
13841 !! end
13842
13843 !! test
13844 BUG 1219 URL next to image (good)
13845 !! wikitext
13846 http://example.com [[File:Foobar.jpg]]
13847 !! html/php
13848 <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>
13849 </p>
13850 !! html/parsoid
13851 <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" height="220" width="1941"/></a></span></p>
13852 !!end
13853
13854 !! test
13855 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
13856 !! wikitext
13857 ===
13858 The line above must have a trailing space!
13859 === <!--
13860 --> <!-- -->
13861 But just in case it doesn't...
13862 !! html
13863 <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>
13864 <p>The line above must have a trailing space!
13865 </p>
13866 <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>
13867 <p>But just in case it doesn't...
13868 </p>
13869 !! end
13870
13871 !! test
13872 Header with special characters (bug 25462)
13873 !! wikitext
13874 The tooltips shall not show entities to the user (ie. be double escaped)
13875
13876 == text > text ==
13877 section 1
13878
13879 == text < text ==
13880 section 2
13881
13882 == text & text ==
13883 section 3
13884
13885 == text ' text ==
13886 section 4
13887
13888 == text " text ==
13889 section 5
13890 !! html
13891 <p>The tooltips shall not show entities to the user (ie. be double escaped)
13892 </p>
13893 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13894 <ul>
13895 <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>
13896 <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>
13897 <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>
13898 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
13899 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
13900 </ul>
13901 </div>
13902
13903 <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 > text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
13904 <p>section 1
13905 </p>
13906 <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>
13907 <p>section 2
13908 </p>
13909 <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>
13910 <p>section 3
13911 </p>
13912 <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>
13913 <p>section 4
13914 </p>
13915 <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>
13916 <p>section 5
13917 </p>
13918 !! end
13919
13920 !! test
13921 Header with space, plus and underscore as entity
13922 !! wikitext
13923 Id should not contain + for spaces
13924
13925 == Space between Text ==
13926 section 1
13927
13928 == Space-Entity&#32;between&#32;Text ==
13929 section 2
13930
13931 == Plus+between+Text ==
13932 section 3
13933
13934 == Plus-Entity&#43;between&#43;Text ==
13935 section 4
13936
13937 == Underscore_between_Text ==
13938 section 5
13939
13940 == Underscore-Entity&#95;between&#95;Text ==
13941 section 6
13942
13943 [[#Space between Text]]
13944 [[#Space-Entity&#32;between&#32;Text]]
13945 [[#Plus+between+Text]]
13946 [[#Plus-Entity&#43;between&#43;Text]]
13947 [[#Underscore_between_Text]]
13948 [[#Underscore-Entity&#95;between&#95;Text]]
13949 !! html
13950 <p>Id should not contain + for spaces
13951 </p>
13952 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13953 <ul>
13954 <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>
13955 <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>
13956 <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>
13957 <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>
13958 <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>
13959 <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>
13960 </ul>
13961 </div>
13962
13963 <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>
13964 <p>section 1
13965 </p>
13966 <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>
13967 <p>section 2
13968 </p>
13969 <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>
13970 <p>section 3
13971 </p>
13972 <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>
13973 <p>section 4
13974 </p>
13975 <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>
13976 <p>section 5
13977 </p>
13978 <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>
13979 <p>section 6
13980 </p><p><a href="#Space_between_Text">#Space between Text</a>
13981 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
13982 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
13983 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
13984 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
13985 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
13986 </p>
13987 !! end
13988
13989 !! test
13990 Headers with excess '=' characters
13991 (Are similar tests necessary beyond the 1st level?)
13992 !! wikitext
13993 =foo==
13994 ==foo=
13995 =''italic'' heading==
13996 ==''italic'' heading=
13997 !! html
13998 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13999 <ul>
14000 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
14001 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
14002 <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>
14003 <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>
14004 </ul>
14005 </div>
14006
14007 <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>
14008 <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>
14009 <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>
14010 <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>
14011
14012 !! end
14013
14014 !! test
14015 HTML headers vs TOC (bug 23393)
14016 (__NOEDITSECTION__ for clearer output, doesn't matter here)
14017 !! wikitext
14018 <h1>Header 1</h1>
14019 == Header 1.1 ==
14020 == Header 1.2 ==
14021
14022 <h1>Header 2
14023 </h1>
14024 == Header 2.1 ==
14025 == Header 2.2 ==
14026 __NOEDITSECTION__
14027 !! html
14028 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14029 <ul>
14030 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
14031 <ul>
14032 <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>
14033 <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>
14034 </ul>
14035 </li>
14036 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
14037 <ul>
14038 <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>
14039 <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>
14040 </ul>
14041 </li>
14042 </ul>
14043 </div>
14044
14045 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
14046 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
14047 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
14048 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
14049 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
14050 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
14051
14052 !! end
14053
14054 !! test
14055 Single-line or multiline-comments can follow headings
14056 !! options
14057 parsoid=wt2html,wt2wt
14058 !! wikitext
14059 ==foo==<!---->
14060 ==bar==<!--c1-->
14061 ==baz==<!--
14062 c2
14063 c3-->
14064 !! html
14065 <h2><span class="mw-headline" id="foo">foo</span></h2>
14066 <h2><span class="mw-headline" id="bar">bar</span></h2>
14067 <h2><span class="mw-headline" id="baz">baz</span></h2>
14068
14069 !! end
14070
14071 !! test
14072 BUG 1219 URL next to image (broken)
14073 !! wikitext
14074 http://example.com[[File:Foobar.jpg]]
14075 !! html/php
14076 <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>
14077 </p>
14078 !! html/parsoid
14079 <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" height="220" width="1941"/></a></span></p>
14080 !!end
14081
14082 !! test
14083 Bug 1186 news: in the middle of text
14084 !! wikitext
14085 http://en.wikinews.org/wiki/Wikinews:Workplace
14086 !! html
14087 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
14088 </p>
14089 !!end
14090
14091
14092 !! test
14093 Namespaced link must have a title
14094 !! wikitext
14095 [[Project:]]
14096 !! html
14097 <p>[[Project:]]
14098 </p>
14099 !!end
14100
14101 !! test
14102 Namespaced link must have a title (bad fragment version)
14103 !! wikitext
14104 [[Project:#fragment]]
14105 !! html
14106 <p>[[Project:#fragment]]
14107 </p>
14108 !!end
14109
14110
14111 ###
14112 ### HTML tags and HTML attributes
14113 ###
14114
14115 !! test
14116 div with no attributes
14117 !! wikitext
14118 <div>HTML rocks</div>
14119 !! html
14120 <div>HTML rocks</div>
14121
14122 !! end
14123
14124 !! test
14125 div with double-quoted attribute
14126 !! wikitext
14127 <div id="rock">HTML rocks</div>
14128 !! html
14129 <div id="rock">HTML rocks</div>
14130
14131 !! end
14132
14133 !! test
14134 div with single-quoted attribute
14135 !! wikitext
14136 <div id='rock'>HTML rocks</div>
14137 !! html
14138 <div id="rock">HTML rocks</div>
14139
14140 !! end
14141
14142 !! test
14143 div with unquoted attribute
14144 !! wikitext
14145 <div id=rock>HTML rocks</div>
14146 !! html
14147 <div id="rock">HTML rocks</div>
14148
14149 !! end
14150
14151 !! test
14152 div with illegal double attributes
14153 !! wikitext
14154 <div id="a" id="b">HTML rocks</div>
14155 !! html
14156 <div id="b">HTML rocks</div>
14157
14158 !!end
14159
14160 # FIXME: produce empty string instead of "class" in the PHP parser, following
14161 # the HTML5 spec.
14162 !! test
14163 div with empty attribute value, space before equals
14164 !! options
14165 parsoid
14166 !! wikitext
14167 <div class =>HTML rocks</div>
14168 !! html
14169 <div class="">HTML rocks</div>
14170
14171 !! end
14172
14173 !! test
14174 div with multiple empty attribute values
14175 !! options
14176 parsoid
14177 !! wikitext
14178 <div id= title=>HTML rocks</div>
14179 !! html
14180 <div id="" title="">HTML rocks</div>
14181
14182 !! end
14183
14184 !! test
14185 table with multiple empty attribute values
14186 !! options
14187 parsoid
14188 !! wikitext
14189 {| title= id=
14190 | hi
14191 |}
14192 !! html
14193 <table title="" id="">
14194 <tbody><tr><td> hi</td></tr>
14195 </tbody></table>
14196 !! end
14197
14198 !! test
14199 div with braces in attribute value
14200 !! wikitext
14201 <div title="{}">Foo</div>
14202 !! html/php
14203 <div title="&#123;}">Foo</div>
14204
14205 !! html/parsoid
14206 <div title="{}">Foo</div>
14207 !! end
14208
14209 # This it very inconsistent in the PHP parser: it returns
14210 # class="class" if there is a space between the name and the equal sign (see
14211 # 'div with empty attribute value, space before equals'), but strips the
14212 # attribute completely if the space is missing. We hope that not much content
14213 # depends on this, so are implementing the behavior below in Parsoid for
14214 # consistencies' sake.
14215 # FIXME: fix this behavior in the PHP parser?
14216 !! test
14217 div with empty attribute value, no space before equals
14218 !! options
14219 parsoid=wt2html,html2html
14220 !! wikitext
14221 <div class=>HTML rocks</div>
14222 !! html/php
14223 <div>HTML rocks</div>
14224
14225 !! html/parsoid
14226 <div class="">HTML rocks</div>
14227 !! end
14228
14229 !! test
14230 HTML multiple attributes correction
14231 !! wikitext
14232 <p class="error" class="awesome">Awesome!</p>
14233 !! html
14234 <p class="awesome">Awesome!</p>
14235
14236 !!end
14237
14238 !! test
14239 Table multiple attributes correction
14240 !! wikitext
14241 {|
14242 !+ class="error" class="awesome"| status
14243 |}
14244 !! html
14245 <table>
14246 <tr>
14247 <th class="awesome"> status
14248 </th></tr></table>
14249
14250 !!end
14251
14252 !! test
14253 DIV IN UPPERCASE
14254 !! wikitext
14255 <DIV ID="x">HTML ROCKS</DIV>
14256 !! html
14257 <div id="x">HTML ROCKS</div>
14258
14259 !!end
14260
14261 !! test
14262 Non-ASCII pseudo-tags are rendered as text
14263 !! wikitext
14264 <khyô>
14265 !! html
14266 <p>&lt;khyô&gt;
14267 </p>
14268 !! end
14269
14270 !! test
14271 Pseudo-tag with URL 'name' renders as url link
14272 !! wikitext
14273 <http://example.com/>
14274 !! html
14275 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
14276 </p>
14277 !! end
14278
14279 !! test
14280 text with amp in the middle of nowhere
14281 !! wikitext
14282 Remember AT&T?
14283 !! html
14284 <p>Remember AT&amp;T?
14285 </p>
14286 !! end
14287
14288 !! test
14289 text with character entity: eacute
14290 !! wikitext
14291 I always thought &eacute; was a cute letter.
14292 !! html
14293 <p>I always thought &#233; was a cute letter.
14294 </p>
14295 !! html+tidy
14296 <p>I always thought é was a cute letter.</p>
14297 !! end
14298
14299 !! test
14300 text with entity-escaped character entity-like string: eacute
14301 !! wikitext
14302 I always thought &amp;eacute; was a cute letter.
14303 !! html
14304 <p>I always thought &amp;eacute; was a cute letter.
14305 </p>
14306 !! end
14307
14308 !! test
14309 text with undefined character entity: xacute
14310 !! wikitext
14311 I always thought &xacute; was a cute letter.
14312 !! html
14313 <p>I always thought &amp;xacute; was a cute letter.
14314 </p>
14315 !! end
14316
14317 # TODO: generalize to PHP parser?
14318 !! test
14319 HTML5 tags
14320 !! options
14321 parsoid
14322 !! wikitext
14323 <data value="5">five</data>
14324 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
14325 <mark>This highlighted text</mark>
14326 !! html
14327 <p><data value="5">five</data>
14328 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
14329 <mark>This highlighted text</mark></p>
14330 !! end
14331
14332 !! test
14333 HTML tag with leading space is parsed as text
14334 !! wikitext
14335 < div>foo< /div>
14336 !! html
14337 <p>&lt; div&gt;foo&lt; /div&gt;
14338 </p>
14339 !! end
14340
14341 ###
14342 ### Nesting tests (see bug 41545, 50604, 51081)
14343 ###
14344
14345 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
14346 # Note that html2wt is considerably more difficult if we use <b> in
14347 # the test case, instead of <big>
14348 !! test
14349 Ensure that HTML adoption agency algorithm is properly implemented.
14350 !! wikitext
14351 <big>X<big>Y</big>Z</big>
14352 !! html
14353 <p><big>X<big>Y</big>Z</big>
14354 </p>
14355 !! end
14356
14357 # This was bug 41545 in the PHP parser.
14358 # Note that tidy doesn't handle this correctly.
14359 !! test
14360 Nesting of <kbd>
14361 !! wikitext
14362 <kbd>X<kbd>Y</kbd>Z</kbd>
14363 !! html
14364 <p><kbd>X<kbd>Y</kbd>Z</kbd>
14365 </p>
14366 !! end
14367
14368 # The following cases were bug 51081 in the PHP parser.
14369 # Note that there are some other nestable tags (b, i, etc) which are
14370 # not covered; see bug 51081 for discussion.
14371
14372 # Note that tidy doesn't handle this correctly.
14373 !! test
14374 Nesting of <em>
14375 !! wikitext
14376 <em>X<em>Y</em>Z</em>
14377 !! html
14378 <p><em>X<em>Y</em>Z</em>
14379 </p>
14380 !! end
14381
14382 # Note that tidy doesn't handle this correctly.
14383 !! test
14384 Nesting of <strong>
14385 !! wikitext
14386 <strong>X<strong>Y</strong>Z</strong>
14387 !! html
14388 <p><strong>X<strong>Y</strong>Z</strong>
14389 </p>
14390 !! end
14391
14392 !! test
14393 Nesting of <q>
14394 !! wikitext
14395 <q>X<q>Y</q>Z</q>
14396 !! html+tidy
14397 <p><q>X<q>Y</q>Z</q></p>
14398 !! end
14399
14400 # Note that tidy doesn't handle this correctly.
14401 !! test
14402 Nesting of <ruby>
14403 !! wikitext
14404 <ruby>X<ruby>Y</ruby>Z</ruby>
14405 !! html
14406 <p><ruby>X<ruby>Y</ruby>Z</ruby>
14407 </p>
14408 !! end
14409
14410 # Note that tidy doesn't handle this correctly.
14411 !! test
14412 Nesting of <bdo>
14413 !! wikitext
14414 <bdo>X<bdo>Y</bdo>Z</bdo>
14415 !! html
14416 <p><bdo>X<bdo>Y</bdo>Z</bdo>
14417 </p>
14418 !! end
14419
14420
14421 ###
14422 ### Media links
14423 ###
14424
14425 !! test
14426 Media link
14427 !! wikitext
14428 [[Media:Foobar.jpg]]
14429 !! html
14430 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
14431 </p>
14432 !! end
14433
14434 !! test
14435 Media link with text
14436 !! wikitext
14437 [[Media:Foobar.jpg|A neat file to look at]]
14438 !! html
14439 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
14440 </p>
14441 !! end
14442
14443 # FIXME: this is still bad HTML tag nesting
14444 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
14445 !! test
14446 Media link with nasty text
14447 !! wikitext
14448 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
14449 !! html
14450 <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>
14451
14452 !! html+tidy
14453 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
14454 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
14455 !! end
14456
14457 !! test
14458 Media link to nonexistent file (bug 1702)
14459 !! wikitext
14460 [[Media:No such.jpg]]
14461 !! html
14462 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
14463 </p>
14464 !! end
14465
14466 !! test
14467 Image link to nonexistent file (bug 1850 - good)
14468 !! wikitext
14469 [[File:No_such.jpg]]
14470 !! html/php
14471 <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>
14472 </p>
14473 !! html/parsoid
14474 <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>
14475 !! end
14476
14477 !! test
14478 :Image link to nonexistent file (bug 1850 - bad)
14479 !! wikitext
14480 [[:Image:No such.jpg]]
14481 !! html/php
14482 <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>
14483 </p>
14484 !! html/parsoid
14485 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
14486 !! end
14487
14488
14489
14490 !! test
14491 Character reference normalization in link text (bug 1938)
14492 !! wikitext
14493 [[Main Page|this&that]]
14494 !! html
14495 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
14496 </p>
14497 !!end
14498
14499 !! article
14500 אַ
14501 !! text
14502 Test for unicode normalization
14503
14504 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
14505 !! endarticle
14506
14507 !! test
14508 (bug 19451) Links should refer to the normalized form.
14509 !! wikitext
14510 [[&#xFB2E;]]
14511 [[&#x5d0;&#x5b7;]]
14512 [[&#x5d0;ַ]]
14513 [[א&#x5b7;]]
14514 [[אַ]]
14515 !! html
14516 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
14517 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
14518 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
14519 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
14520 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
14521 </p>
14522 !! end
14523
14524 !! test
14525 Empty attribute crash test (bug 2067)
14526 !! wikitext
14527 <font color="">foo</font>
14528 !! html
14529 <p><font color="">foo</font>
14530 </p>
14531 !! end
14532
14533 !! test
14534 Empty attribute crash test single-quotes (bug 2067)
14535 !! wikitext
14536 <font color=''>foo</font>
14537 !! html
14538 <p><font color="">foo</font>
14539 </p>
14540 !! end
14541
14542 !! test
14543 Attribute test: equals, then nothing
14544 !! wikitext
14545 <font color=>foo</font>
14546 !! html
14547 <p><font>foo</font>
14548 </p>
14549 !! end
14550
14551 !! test
14552 Attribute test: unquoted value
14553 !! wikitext
14554 <font color=x>foo</font>
14555 !! html
14556 <p><font color="x">foo</font>
14557 </p>
14558 !! end
14559
14560 !! test
14561 Attribute test: unquoted but illegal value (hash)
14562 !! wikitext
14563 <font color=#x>foo</font>
14564 !! html
14565 <p><font color="#x">foo</font>
14566 </p>
14567 !! end
14568
14569 !! test
14570 Attribute test: no value
14571 !! wikitext
14572 <font color>foo</font>
14573 !! html
14574 <p><font color="color">foo</font>
14575 </p>
14576 !! end
14577
14578 !! test
14579 Bug 2095: link with three closing brackets
14580 !! wikitext
14581 [[Main Page]]]
14582 !! html/php
14583 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
14584 </p>
14585 !! html/parsoid
14586 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
14587 !! end
14588
14589 !! test
14590 Bug 2095: link with pipe and three closing brackets
14591 !! wikitext
14592 [[Main Page|link]]]
14593 !! html/php
14594 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
14595 </p>
14596 !! html/parsoid
14597 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
14598 !! end
14599
14600 !! test
14601 Bug 2095: link with pipe and three closing brackets, version 2
14602 !! wikitext
14603 [[Main Page|[http://example.com/]]]
14604 !! html/php
14605 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
14606 </p>
14607 !! html/parsoid
14608 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
14609 !! end
14610
14611
14612 ###
14613 ### Safety
14614 ###
14615
14616 !! article
14617 Template:Dangerous attribute
14618 !! text
14619 " onmouseover="alert(document.cookie)
14620 !! endarticle
14621
14622 !! article
14623 Template:Dangerous style attribute
14624 !! text
14625 border-size: expression(alert(document.cookie))
14626 !! endarticle
14627
14628 !! article
14629 Template:Div style
14630 !! text
14631 <div style="float: right; {{{1}}}">Magic div</div>
14632 !! endarticle
14633
14634 !! test
14635 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
14636 !! wikitext
14637 <div title="{{test}}"></div>
14638 !! html
14639 <div title="This is a test template"></div>
14640
14641 !! end
14642
14643 # Parsoid has enough context to handle this case
14644 !! test
14645 Bug 2304: HTML attribute safety (dangerous template; 2309)
14646 !! wikitext
14647 <div title="{{dangerous attribute}}"></div>
14648 !! html/php
14649 <div title=""></div>
14650
14651 !! html/parsoid
14652 <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>
14653 !! end
14654
14655 !! test
14656 Bug 2304: HTML attribute safety (dangerous style template; 2309)
14657 !! wikitext
14658 <div style="{{dangerous style attribute}}"></div>
14659 !! html
14660 <div style="/* insecure input */"></div>
14661
14662 !! end
14663
14664 !! test
14665 Bug 2304: HTML attribute safety (safe parameter; 2309)
14666 !! wikitext
14667 {{div style|width: 200px}}
14668 !! html
14669 <div style="float: right; width: 200px">Magic div</div>
14670
14671 !! end
14672
14673 !! test
14674 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
14675 !! wikitext
14676 {{div style|width: expression(alert(document.cookie))}}
14677 !! html
14678 <div style="/* insecure input */">Magic div</div>
14679
14680 !! end
14681
14682 !! test
14683 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
14684 !! wikitext
14685 {{div style|"><script>alert(document.cookie)</script>}}
14686 !! html
14687 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
14688
14689 !! end
14690
14691 !! test
14692 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
14693 !! wikitext
14694 {{div style|" ><script>alert(document.cookie)</script>}}
14695 !! html
14696 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
14697
14698 !! end
14699
14700 !! test
14701 Bug 2304: HTML attribute safety (link)
14702 !! wikitext
14703 <div title="[[Main Page]]"></div>
14704 !! html
14705 <div title="&#91;&#91;Main Page]]"></div>
14706
14707 !! end
14708
14709 !! test
14710 Bug 2304: HTML attribute safety (italics)
14711 !! wikitext
14712 <div title="''foobar''"></div>
14713 !! html
14714 <div title="&#39;&#39;foobar&#39;&#39;"></div>
14715
14716 !! end
14717
14718 !! test
14719 Bug 2304: HTML attribute safety (bold)
14720 !! wikitext
14721 <div title="'''foobar'''"></div>
14722 !! html
14723 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
14724
14725 !! end
14726
14727
14728 !! test
14729 Bug 2304: HTML attribute safety (ISBN)
14730 !! wikitext
14731 <div title="ISBN 1234567890"></div>
14732 !! html
14733 <div title="&#73;SBN 1234567890"></div>
14734
14735 !! end
14736
14737 !! test
14738 Bug 2304: HTML attribute safety (RFC)
14739 !! wikitext
14740 <div title="RFC 1234"></div>
14741 !! html
14742 <div title="&#82;FC 1234"></div>
14743
14744 !! end
14745
14746 !! test
14747 Bug 2304: HTML attribute safety (PMID)
14748 !! wikitext
14749 <div title="PMID 1234567890"></div>
14750 !! html
14751 <div title="&#80;MID 1234567890"></div>
14752
14753 !! end
14754
14755 !! test
14756 Bug 2304: HTML attribute safety (web link)
14757 !! wikitext
14758 <div title="http://example.com/"></div>
14759 !! html
14760 <div title="http&#58;//example.com/"></div>
14761
14762 !! end
14763
14764 !! test
14765 Bug 2304: HTML attribute safety (named web link)
14766 !! wikitext
14767 <div title="[http://example.com/ link]"></div>
14768 !! html
14769 <div title="&#91;http&#58;//example.com/ link]"></div>
14770
14771 !! end
14772
14773 !! test
14774 Bug 3244: HTML attribute safety (extension; safe)
14775 !! wikitext
14776 <div style="<nowiki>background:blue</nowiki>"></div>
14777 !! html
14778 <div style="background:blue"></div>
14779
14780 !! end
14781
14782 !! test
14783 Bug 3244: HTML attribute safety (extension; unsafe)
14784 !! wikitext
14785 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
14786 !! html
14787 <div style="/* insecure input */"></div>
14788
14789 !! end
14790
14791 # More MSIE fun discovered by Tom Gilder
14792
14793 !! test
14794 MSIE CSS safety test: spurious slash
14795 !! wikitext
14796 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
14797 !! html
14798 <div style="/* insecure input */">evil</div>
14799
14800 !! end
14801
14802 !! test
14803 MSIE CSS safety test: hex code
14804 !! wikitext
14805 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
14806 !! html
14807 <div style="/* insecure input */">evil</div>
14808
14809 !! end
14810
14811 !! test
14812 MSIE CSS safety test: comment in url
14813 !! wikitext
14814 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
14815 !! html
14816 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
14817
14818 !! end
14819
14820 !! test
14821 MSIE CSS safety test: comment in expression
14822 !! wikitext
14823 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
14824 !! html
14825 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
14826
14827 !! end
14828
14829 !! test
14830 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
14831 !! wikitext
14832 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
14833 !! html
14834 <p style="/* invalid control char */">A</p>
14835
14836 !! end
14837
14838 !! test
14839 MSIE 6 CSS safety test: Fullwidth (bug 55332)
14840 !! wikitext
14841 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
14842 <div style="top:EXPRESSION(alert())">B</div>
14843 !! html
14844 <p style="/* insecure input */">A</p>
14845 <div style="/* insecure input */">B</div>
14846
14847 !! end
14848
14849 !! test
14850 MSIE 6 CSS safety test: IPA extensions (bug 55332)
14851 !! wikitext
14852 <div style="background-image:uʀʟ(javascript:alert())">A</div>
14853 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
14854 !! html
14855 <div style="/* insecure input */">A</div>
14856 <p style="/* insecure input */">B</p>
14857
14858 !! end
14859
14860 !! test
14861 MSIE 6 CSS safety test: sup/sub script (bug 55332)
14862 !! wikitext
14863 <div style="background-image:url⁽javascript:alert())">A</div>
14864 <div style="background-image:url₍javascript:alert())">B</div>
14865 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
14866 !! html
14867 <div style="/* insecure input */">A</div>
14868 <div style="/* insecure input */">B</div>
14869 <p style="/* insecure input */">C</p>
14870
14871 !! end
14872
14873 !! test
14874 Opera -o-link CSS
14875 !! wikitext
14876 <div
14877 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;"
14878 style="-o-link:attr(title);-o-link-source:current">X</div>
14879 !! html
14880 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
14881
14882 !! end
14883
14884 !! test
14885 MSIE 6 CSS safety test: Repetition markers (bug 55332)
14886 !! wikitext
14887 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
14888 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
14889 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
14890 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
14891 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
14892 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
14893 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
14894 !! html
14895 <p style="/* insecure input */">A</p>
14896 <p style="/* insecure input */">B</p>
14897 <p style="/* insecure input */">C</p>
14898 <p style="/* insecure input */">D</p>
14899 <p style="/* insecure input */">E</p>
14900 <p style="/* insecure input */">F</p>
14901 <p style="/* insecure input */">G</p>
14902
14903 !! end
14904
14905 !! test
14906 Table attribute legitimate extension
14907 !! wikitext
14908 {|
14909 !+ style="<nowiki>color:blue</nowiki>"| status
14910 |}
14911 !! html
14912 <table>
14913 <tr>
14914 <th style="color:blue"> status
14915 </th></tr></table>
14916
14917 !!end
14918
14919 !! test
14920 Table attribute safety
14921 !! wikitext
14922 {|
14923 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
14924 |}
14925 !! html
14926 <table>
14927 <tr>
14928 <th style="/* insecure input */"> status
14929 </th></tr></table>
14930
14931 !! end
14932
14933 !! test
14934 CSS line continuation 1
14935 !! wikitext
14936 <div style="background-image: u\&#10;rl(test.jpg);"></div>
14937 !! html
14938 <div style="/* insecure input */"></div>
14939
14940 !! end
14941
14942 !! test
14943 CSS line continuation 2
14944 !! wikitext
14945 <div style="background-image: u\&#13;rl(test.jpg); "></div>
14946 !! html
14947 <div style="/* insecure input */"></div>
14948
14949 !! end
14950
14951 !! article
14952 Template:Identity
14953 !! text
14954 {{{1}}}
14955 !! endarticle
14956
14957 !! test
14958 Expansion of multi-line templates in attribute values (bug 6255)
14959 !! wikitext
14960 <div style="background: {{identity|#00FF00}}">-</div>
14961 !! html
14962 <div style="background: #00FF00">-</div>
14963
14964 !! end
14965
14966
14967 !! test
14968 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
14969 !! wikitext
14970 <div style="background:
14971 #00FF00">-</div>
14972 !! html/php
14973 <div style="background: #00FF00">-</div>
14974
14975 !! html/parsoid
14976 <div style="background:
14977 #00FF00">-</div>
14978 !! end
14979
14980 !! test
14981 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
14982 !! wikitext
14983 <div style="background: &#10;#00FF00">-</div>
14984 !! html
14985 <div style="background: &#10;#00FF00">-</div>
14986
14987 !! end
14988
14989 !! test
14990 evil <math>-wiki-tags without Extension:Math enabled
14991 !! wikitext
14992 <math><img src="some evil external link"><script>some_evil_javascript();</script></math>
14993 !! html+tidy
14994 <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>
14995 !! end
14996
14997 ###
14998 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
14999 ###
15000 !! test
15001 Parser hook: empty input
15002 !! wikitext
15003 <tag></tag>
15004 !! html
15005 <pre>
15006 ''
15007 array (
15008 )
15009 </pre>
15010
15011 !! end
15012
15013 !! test
15014 Parser hook: empty input using terminated empty elements
15015 !! wikitext
15016 <tag/>
15017 !! html
15018 <pre>
15019 NULL
15020 array (
15021 )
15022 </pre>
15023
15024 !! end
15025
15026 !! test
15027 Parser hook: empty input using terminated empty elements (space before)
15028 !! wikitext
15029 <tag />
15030 !! html
15031 <pre>
15032 NULL
15033 array (
15034 )
15035 </pre>
15036
15037 !! end
15038
15039 !! test
15040 Parser hook: basic input
15041 !! wikitext
15042 <tag>input</tag>
15043 !! html
15044 <pre>
15045 'input'
15046 array (
15047 )
15048 </pre>
15049
15050 !! end
15051
15052
15053 !! test
15054 Parser hook: case insensitive
15055 !! wikitext
15056 <TAG>input</TAG>
15057 !! html
15058 <pre>
15059 'input'
15060 array (
15061 )
15062 </pre>
15063
15064 !! end
15065
15066
15067 !! test
15068 Parser hook: case insensitive, redux
15069 !! wikitext
15070 <TaG>input</TAg>
15071 !! html
15072 <pre>
15073 'input'
15074 array (
15075 )
15076 </pre>
15077
15078 !! end
15079
15080 !! test
15081 Parser hook: nested tags
15082 !! options
15083 noxml
15084 !! wikitext
15085 <tag><tag></tag></tag>
15086 !! html
15087 <pre>
15088 '<tag>'
15089 array (
15090 )
15091 </pre>&lt;/tag&gt;
15092
15093 !! end
15094
15095 !! test
15096 Parser hook: basic arguments
15097 !! wikitext
15098 <tag width=200 height = "100" depth = '50' square></tag>
15099 !! html
15100 <pre>
15101 ''
15102 array (
15103 'width' => '200',
15104 'height' => '100',
15105 'depth' => '50',
15106 'square' => 'square',
15107 )
15108 </pre>
15109
15110 !! end
15111
15112 !! test
15113 Parser hook: argument containing a forward slash (bug 5344)
15114 !! wikitext
15115 <tag filename='/tmp/bla'></tag>
15116 !! html
15117 <pre>
15118 ''
15119 array (
15120 'filename' => '/tmp/bla',
15121 )
15122 </pre>
15123
15124 !! end
15125
15126 !! test
15127 Parser hook: empty input using terminated empty elements (bug 2374)
15128 !! wikitext
15129 <tag foo=bar/>text
15130 !! html
15131 <pre>
15132 NULL
15133 array (
15134 'foo' => 'bar',
15135 )
15136 </pre>text
15137
15138 !! end
15139
15140 # </tag> should be output literally since there is no matching tag that begins it
15141 !! test
15142 Parser hook: basic arguments using terminated empty elements (bug 2374)
15143 !! wikitext
15144 <tag width=200 height = "100" depth = '50' square/>
15145 other stuff
15146 </tag>
15147 !! html
15148 <pre>
15149 NULL
15150 array (
15151 'width' => '200',
15152 'height' => '100',
15153 'depth' => '50',
15154 'square' => 'square',
15155 )
15156 </pre>
15157 <p>other stuff
15158 &lt;/tag&gt;
15159 </p>
15160 !! end
15161
15162 ###
15163 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
15164 ###
15165
15166 !! test
15167 Parser hook: static parser hook not inside a comment
15168 !! wikitext
15169 <statictag>hello, world</statictag>
15170 <statictag action=flush/>
15171 !! html
15172 <p>hello, world
15173 </p>
15174 !! end
15175
15176
15177 !! test
15178 Parser hook: static parser hook inside a comment
15179 !! wikitext
15180 <!-- <statictag>hello, world</statictag> -->
15181 <statictag action=flush/>
15182 !! html
15183 <p><br />
15184 </p>
15185 !! end
15186
15187 # Nested template calls; this case was broken by Parser.php rev 1.506,
15188 # since reverted.
15189
15190 !! article
15191 Template:One-parameter
15192 !! text
15193 (My parameter is: {{{1}}})
15194 !! endarticle
15195
15196 !! article
15197 Template:Map-one-parameter
15198 !! text
15199 {{{{{1}}}|{{{2}}}}}
15200 !! endarticle
15201
15202 !! test
15203 Nested template calls
15204 !! wikitext
15205 {{Map-one-parameter|One-parameter|param}}
15206 !! html
15207 <p>(My parameter is: param)
15208 </p>
15209 !! end
15210
15211
15212 ###
15213 ### Sanitizer
15214 ###
15215
15216 # HTML+Tidy effectively strips out the empty tags completely
15217 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
15218 # which Tidy would have done for the PHP parser had there been content inside it.
15219 !! test
15220 Sanitizer: Closing of open tags
15221 !! wikitext
15222 <s></s><table></table>
15223 !! html
15224 <s></s><table></table>
15225
15226 !! html/parsoid
15227 <p><s></s></p><table></table>
15228 !! end
15229
15230 !! test
15231 Sanitizer: Closing of open but not closed tags
15232 !! wikitext
15233 <s>foo
15234 !! html
15235 <p><s>foo</s>
15236 </p>
15237 !! end
15238
15239 !! test
15240 Sanitizer: Closing of closed but not open tags
15241 !! wikitext
15242 </s>
15243 !! html
15244 <p>&lt;/s&gt;
15245 </p>
15246 !! end
15247
15248 !! test
15249 Sanitizer: Closing of closed but not open table tags
15250 !! wikitext
15251 Table not started</td></tr></table>
15252 !! html
15253 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
15254 </p>
15255 !! end
15256
15257 !! test
15258 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
15259 !! wikitext
15260 <span id="æ: v">byte</span>[[#æ: v|backlink]]
15261 !! html
15262 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
15263 </p>
15264 !! end
15265
15266 # In HTML5, the restrictions are that id must contain at least one character,
15267 # and must not contain any space characters.
15268 !! test
15269 Sanitizer: Validating the contents of the id attribute (bug 4515)
15270 !! options
15271 disabled
15272 !! wikitext
15273 <br id="" /><br id="a space" />
15274 !! html
15275 Something ...
15276 !! end
15277
15278 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
15279 !! test
15280 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
15281 !! options
15282 disabled
15283 !! wikitext
15284 <br id="foo" /><br id="foo" />
15285 !! html
15286 Something need to be done. foo-2 ?
15287 !! end
15288
15289 !! test
15290 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
15291 !! wikitext
15292 <div itemscope>
15293 <meta itemprop="hello" content="world">
15294 <meta http-equiv="refresh" content="5">
15295 <meta itemprop="hello" http-equiv="refresh" content="5">
15296 <link itemprop="hello" href="{{SERVER}}">
15297 <link rel="stylesheet" href="{{SERVER}}">
15298 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
15299 </div>
15300 !! html
15301 <div itemscope="itemscope">
15302 <p> <meta itemprop="hello" content="world" />
15303 &lt;meta http-equiv="refresh" content="5"&gt;
15304 <meta itemprop="hello" content="5" />
15305 </p>
15306 <link itemprop="hello" href="http&#58;//example.org" />
15307 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
15308 <link itemprop="hello" href="http&#58;//example.org" />
15309 </div>
15310
15311 !! end
15312
15313 !! test
15314 Language converter: output gets cut off unexpectedly (bug 5757)
15315 !! options
15316 language=zh
15317 !! wikitext
15318 this bit is safe: }-
15319
15320 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
15321
15322 then we get cut off here: }-
15323
15324 all additional text is vanished
15325 !! html
15326 <p>this bit is safe: }-
15327 </p><p>but if we add a conversion instance: xxx
15328 </p><p>then we get cut off here: }-
15329 </p><p>all additional text is vanished
15330 </p>
15331 !! end
15332
15333 !! test
15334 Self closed html pairs (bug 5487)
15335 !! options
15336 !! wikitext
15337 <center><font id="bug" />Centered text</center>
15338 <div><font id="bug2" />In div text</div>
15339 !! html
15340 <center>&lt;font id="bug" /&gt;Centered text</center>
15341 <div>&lt;font id="bug2" /&gt;In div text</div>
15342
15343 !! end
15344
15345 #
15346 #
15347 #
15348
15349 !! test
15350 Punctuation: nbsp before exclamation
15351 !! wikitext
15352 C'est grave !
15353 !! html
15354 <p>C'est grave&#160;!
15355 </p>
15356 !! end
15357
15358 !! test
15359 Punctuation: CSS !important (bug 11874)
15360 !! wikitext
15361 <div style="width:50% !important">important</div>
15362 !! html
15363 <div style="width:50% !important">important</div>
15364
15365 !!end
15366
15367 !! test
15368 Punctuation: CSS ! important (bug 11874; with space after)
15369 !! wikitext
15370 <div style="width:50% ! important">important</div>
15371 !! html
15372 <div style="width:50% ! important">important</div>
15373
15374 !!end
15375
15376 !! test
15377 HTML bullet list, closed tags (bug 5497)
15378 !! wikitext
15379 <ul>
15380 <li>One</li>
15381 <li>Two</li>
15382 </ul>
15383 !! html/php
15384 <ul>
15385 <li>One</li>
15386 <li>Two</li>
15387 </ul>
15388
15389 !! html/parsoid
15390 <ul data-parsoid='{"stx":"html"}'>
15391 <li data-parsoid='{"stx":"html"}'>One</li>
15392 <li data-parsoid='{"stx":"html"}'>Two</li>
15393 </ul>
15394
15395 !! end
15396
15397 !! test
15398 HTML bullet list, unclosed tags (bug 5497)
15399 !! wikitext
15400 <ul>
15401 <li>One
15402 <li>Two
15403 </ul>
15404 !! html/php+tidy
15405 <ul>
15406 <li>One</li>
15407 <li>Two</li>
15408 </ul>
15409 !! html/parsoid
15410 <ul data-parsoid='{"stx":"html"}'>
15411 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
15412 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
15413 </ul>
15414
15415 !! end
15416
15417 !! test
15418 HTML ordered list, closed tags (bug 5497)
15419 !! wikitext
15420 <ol>
15421 <li>One</li>
15422 <li>Two</li>
15423 </ol>
15424 !! html/php
15425 <ol>
15426 <li>One</li>
15427 <li>Two</li>
15428 </ol>
15429
15430 !! html/parsoid
15431 <ol data-parsoid='{"stx":"html"}'>
15432 <li data-parsoid='{"stx":"html"}'>One</li>
15433 <li data-parsoid='{"stx":"html"}'>Two</li>
15434 </ol>
15435
15436 !! end
15437
15438 !! test
15439 HTML ordered list, unclosed tags (bug 5497)
15440 !! options
15441 !! wikitext
15442 <ol>
15443 <li>One
15444 <li>Two
15445 </ol>
15446 !! html/php+tidy
15447 <ol>
15448 <li>One</li>
15449 <li>Two</li>
15450 </ol>
15451 !! html/parsoid
15452 <ol data-parsoid='{"stx":"html"}'>
15453 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
15454 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
15455 </ol>
15456
15457 !! end
15458
15459 !! test
15460 HTML nested bullet list, closed tags (bug 5497)
15461 !! wikitext
15462 <ul>
15463 <li>One</li>
15464 <li>Two:
15465 <ul>
15466 <li>Sub-one</li>
15467 <li>Sub-two</li>
15468 </ul>
15469 </li>
15470 </ul>
15471 !! html
15472 <ul>
15473 <li>One</li>
15474 <li>Two:
15475 <ul>
15476 <li>Sub-one</li>
15477 <li>Sub-two</li>
15478 </ul>
15479 </li>
15480 </ul>
15481
15482 !! end
15483
15484 !! test
15485 HTML nested bullet list, open tags (bug 5497)
15486 !! wikitext
15487 <ul>
15488 <li>One
15489 <li>Two:
15490 <ul>
15491 <li>Sub-one
15492 <li>Sub-two
15493 </ul>
15494 </ul>
15495 !! html/php+tidy
15496 <ul>
15497 <li>One</li>
15498 <li>Two:
15499 <ul>
15500 <li>Sub-one</li>
15501 <li>Sub-two</li>
15502 </ul>
15503 </li>
15504 </ul>
15505 !! html/parsoid
15506 <ul>
15507 <li>One
15508 </li>
15509 <li>Two:
15510 <ul>
15511 <li>Sub-one
15512 </li>
15513 <li>Sub-two
15514 </li>
15515 </ul>
15516 </li>
15517 </ul>
15518
15519 !! end
15520
15521 !! test
15522 HTML nested ordered list, closed tags (bug 5497)
15523 !! wikitext
15524 <ol>
15525 <li>One</li>
15526 <li>Two:
15527 <ol>
15528 <li>Sub-one</li>
15529 <li>Sub-two</li>
15530 </ol>
15531 </li>
15532 </ol>
15533 !! html
15534 <ol>
15535 <li>One</li>
15536 <li>Two:
15537 <ol>
15538 <li>Sub-one</li>
15539 <li>Sub-two</li>
15540 </ol>
15541 </li>
15542 </ol>
15543
15544 !! end
15545
15546 !! test
15547 HTML nested ordered list, open tags (bug 5497)
15548 !! wikitext
15549 <ol>
15550 <li>One
15551 <li>Two:
15552 <ol>
15553 <li>Sub-one
15554 <li>Sub-two
15555 </ol>
15556 </ol>
15557 !! html/php
15558 <ol>
15559 <li>One
15560 <li>Two:
15561 <ol>
15562 <li>Sub-one
15563 <li>Sub-two
15564 </ol>
15565 </ol>
15566
15567 !! html/parsoid
15568 <ol>
15569 <li>One
15570 </li>
15571 <li>Two:
15572 <ol>
15573 <li>Sub-one
15574 </li>
15575 <li>Sub-two
15576 </li>
15577 </ol>
15578 </li>
15579 </ol>
15580
15581 !! end
15582
15583 !! test
15584 HTML ordered list item with parameters oddity
15585 !! wikitext
15586 <ol><li id="fragment">One</li>
15587 </ol>
15588 !! html
15589 <ol><li id="fragment">One</li>
15590 </ol>
15591
15592 !! end
15593
15594 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
15595 !!test
15596 bug 5918: autonumbering
15597 !! wikitext
15598 [http://first/] [http://second] [ftp://ftp]
15599
15600 ftp://inlineftp
15601
15602 [mailto:enclosed@mail.tld With target]
15603
15604 [mailto:enclosed@mail.tld]
15605
15606 mailto:inline@mail.tld
15607 !! html/php
15608 <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>
15609 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
15610 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
15611 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
15612 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
15613 </p>
15614 !! html/parsoid
15615 <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>
15616 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
15617 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
15618 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
15619 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
15620 !! end
15621
15622
15623 #
15624 # Security and HTML correctness
15625 # From Nick Jenkins' fuzz testing
15626 #
15627
15628 !! test
15629 Fuzz testing: Parser13
15630 !! wikitext
15631 {|
15632 | http://a|
15633 !! html
15634 <table>
15635 <tr>
15636 <td>
15637 </td>
15638 </tr>
15639 </table>
15640
15641 !! end
15642
15643 !! test
15644 Fuzz testing: Parser14
15645 !! wikitext
15646 == onmouseover= ==
15647 http://__TOC__
15648 !! html
15649 <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>
15650 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15651 <ul>
15652 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
15653 </ul>
15654 </div>
15655
15656
15657 !! html+tidy
15658 <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>
15659 <p>http://</p>
15660 <div id="toc" class="toc">
15661 <div id="toctitle">
15662 <h2>Contents</h2>
15663 </div>
15664 <ul>
15665 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
15666 </ul>
15667 </div>
15668 <p></p>
15669 !! end
15670
15671 !! test
15672 Fuzz testing: Parser14-table
15673 !! wikitext
15674 ==a==
15675 {| STYLE=__TOC__
15676 !! html
15677 <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>
15678 <table style="&#95;_TOC&#95;_">
15679 <tr><td></td></tr>
15680 </table>
15681
15682 !! html+tidy
15683 <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>
15684 <table style="__TOC__">
15685 <tr>
15686 <td></td>
15687 </tr>
15688 </table>
15689 !! end
15690
15691 # Known to produce bogus xml (extra </td>)
15692 !! test
15693 Fuzz testing: Parser16
15694 !! options
15695 noxml
15696 !! wikitext
15697 {|
15698 !https://||||||
15699 !! html
15700 <table>
15701 <tr>
15702 <th>https://</th>
15703 <th></th>
15704 <th></th>
15705 <th>
15706 </td>
15707 </tr>
15708 </table>
15709
15710 !! html+tidy
15711 <table>
15712 <tr>
15713 <th>https://</th>
15714 <th></th>
15715 <th></th>
15716 <th></th>
15717 </tr>
15718 </table>
15719 !! end
15720
15721 !! test
15722 Fuzz testing: Parser21
15723 !! wikitext
15724 {|
15725 ! irc://{{ftp://a" onmouseover="alert('hello world');"
15726 |
15727 !! html
15728 <table>
15729 <tr>
15730 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
15731 </th>
15732 <td>
15733 </td>
15734 </tr>
15735 </table>
15736
15737 !! end
15738
15739 !! test
15740 Fuzz testing: Parser22
15741 !! wikitext
15742 http://===r:::https://b
15743
15744 {|
15745 !! html
15746 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
15747 </p>
15748 <table>
15749 <tr><td></td></tr>
15750 </table>
15751
15752 !! end
15753
15754 # Known to produce bad XML for now
15755 !! test
15756 Fuzz testing: Parser24
15757 !! options
15758 noxml
15759 !! wikitext
15760 {|
15761 {{{|
15762 <u CLASS=
15763 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
15764 <br style="onmouseover='alert(document.cookie);' " />
15765
15766 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
15767 |
15768 !! html
15769 <table>
15770 {{{|
15771 <u class="&#124;">}}}} &gt;
15772 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
15773
15774 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
15775 <tr>
15776 <td></u>
15777 </td>
15778 </tr>
15779 </table>
15780
15781 !! end
15782
15783 # Note: the current result listed for this is not what the original one was,
15784 # but the original bug was JavaScript injection, which is fixed in any case.
15785 # It's not clear that the original result listed was any more correct than the
15786 # current one. Original result:
15787 # <p>{{{|
15788 # </p>
15789 # <li class="&#124;&#124;">
15790 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
15791 !!test
15792 Fuzz testing: Parser25 (bug 6055)
15793 !! wikitext
15794 {{{
15795 |
15796 <LI CLASS=||
15797 >
15798 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
15799 !! html
15800 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
15801 </p>
15802 !! end
15803
15804 !!test
15805 Fuzz testing: URL adjacent extension (with space, clean)
15806 !! wikitext
15807 http://example.com <nowiki>junk</nowiki>
15808 !! html/php
15809 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
15810 </p>
15811 !! html/parsoid
15812 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
15813 !! end
15814
15815 !!test
15816 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
15817 !! wikitext
15818 http://example.com<nowiki>junk</nowiki>
15819 !! html/php
15820 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
15821 </p>
15822 !! html/parsoid
15823 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
15824 !! end
15825
15826 !!test
15827 Fuzz testing: URL adjacent extension (no space, dirty; pre)
15828 !! wikitext
15829 http://example.com<pre>junk</pre>
15830 !! html/php
15831 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
15832
15833 !! html/php+tidy
15834 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
15835 <pre>
15836 junk
15837 </pre>
15838 !! html/parsoid
15839 <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>
15840 !!end
15841
15842 !!test
15843 Fuzz testing: image with bogus manual thumbnail
15844 !! wikitext
15845 [[Image:foobar.jpg|thumbnail= ]]
15846 !! html/php
15847 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
15848
15849 !! html/parsoid
15850 <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>
15851 !!end
15852
15853 !! test
15854 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
15855 !! wikitext
15856 <pre dir="&#10;"></pre>
15857 !! html
15858 <pre dir="&#10;"></pre>
15859
15860 !! end
15861
15862 !! test
15863 Parsing optional HTML elements (Bug 6171)
15864 !! options
15865 !! wikitext
15866 <table>
15867 <tr>
15868 <td> Some tabular data</td>
15869 <td> More tabular data ...
15870 <td> And yet som tabular data</td>
15871 </tr>
15872 </table>
15873 !! html
15874 <table>
15875 <tr>
15876 <td> Some tabular data</td>
15877 <td> More tabular data ...
15878 </td><td> And yet som tabular data</td>
15879 </tr>
15880 </table>
15881
15882 !! end
15883
15884 !! test
15885 Correct handling of <td>, <tr> (Bug 6171)
15886 !! options
15887 !! wikitext
15888 <table>
15889 <tr>
15890 <td> Some tabular data</td>
15891 <td> More tabular data ...</td>
15892 <td> And yet som tabular data</td>
15893 </tr>
15894 </table>
15895 !! html
15896 <table>
15897 <tr>
15898 <td> Some tabular data</td>
15899 <td> More tabular data ...</td>
15900 <td> And yet som tabular data</td>
15901 </tr>
15902 </table>
15903
15904 !! end
15905
15906
15907 !! test
15908 Parsing crashing regression (fr:JavaScript)
15909 !! wikitext
15910 </body></x>
15911 !! html
15912 <p>&lt;/body&gt;&lt;/x&gt;
15913 </p>
15914 !! end
15915
15916 !! test
15917 Inline wiki vs wiki block nesting
15918 !! wikitext
15919 '''Bold paragraph
15920
15921 New wiki paragraph
15922 !! html
15923 <p><b>Bold paragraph</b>
15924 </p><p>New wiki paragraph
15925 </p>
15926 !! end
15927
15928 # FIXME: The current php output is documented
15929 # and desired output is the parsoid target.
15930 !! test
15931 Inline HTML vs wiki block nesting
15932 !! wikitext
15933 <b>Bold paragraph
15934
15935 New wiki paragraph
15936 !! html/php
15937 <p><b>Bold paragraph
15938 </p><p>New wiki paragraph</b>
15939 </p>
15940 !! html/parsoid
15941 <p><b>Bold paragraph</b>
15942 </p><p>New wiki paragraph
15943 </p>
15944 !! end
15945
15946 # Original result was this:
15947 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
15948 # </p>
15949 # While that might be marginally more intuitive, maybe, the six-apostrophe
15950 # construct is clearly pathological and the result stated here (which is what
15951 # the parser actually does) is about as reasonable as anything.
15952 !!test
15953 Mixing markup for italics and bold
15954 !! options
15955 !! wikitext
15956 '''bold''''''bold''bolditalics'''''
15957 !! html
15958 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
15959 </p>
15960 !! end
15961
15962
15963 !! article
15964 Xyzzyx
15965 !! text
15966 Article for special page transclusion test
15967 !! endarticle
15968
15969 !! test
15970 Special page transclusion
15971 !! options
15972 !! wikitext
15973 {{Special:Prefixindex/Xyzzyx}}
15974 !! html
15975 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
15976
15977 !! end
15978
15979 !! test
15980 Special page transclusion twice (bug 5021)
15981 !! options
15982 !! wikitext
15983 {{Special:Prefixindex/Xyzzyx}}
15984 {{Special:Prefixindex/Xyzzyx}}
15985 !! html
15986 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
15987 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
15988
15989 !! end
15990
15991 !! test
15992 Transclusion of default MediaWiki message
15993 !! wikitext
15994 {{MediaWiki:Mainpage}}
15995 !! html
15996 <p>Main Page
15997 </p>
15998 !! end
15999
16000 !! test
16001 Transclusion of nonexistent MediaWiki message
16002 !! wikitext
16003 {{MediaWiki:Mainpagexxx}}
16004 !! html
16005 <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>
16006 </p>
16007 !! end
16008
16009 !! test
16010 Transclusion of MediaWiki message with underscore
16011 !! wikitext
16012 {{MediaWiki:history_short}}
16013 !! html
16014 <p>History
16015 </p>
16016 !! end
16017
16018 !! test
16019 Transclusion of MediaWiki message with space
16020 !! wikitext
16021 {{MediaWiki:history short}}
16022 !! html
16023 <p>History
16024 </p>
16025 !! end
16026
16027 !! test
16028 Invalid header with following text
16029 !! wikitext
16030 = x = y
16031 !! html
16032 <p>= x = y
16033 </p>
16034 !! end
16035
16036
16037 !! test
16038 Section extraction test (section 0)
16039 !! options
16040 section=0
16041 !! wikitext
16042 start
16043 ==a==
16044 ===aa===
16045 ====aaa====
16046 ==b==
16047 ===ba===
16048 ===bb===
16049 ====bba====
16050 ===bc===
16051 ==c==
16052 ===ca===
16053 !! html
16054 start
16055 !! end
16056
16057 !! test
16058 Section extraction test (section 1)
16059 !! options
16060 section=1
16061 !! wikitext
16062 start
16063 ==a==
16064 ===aa===
16065 ====aaa====
16066 ==b==
16067 ===ba===
16068 ===bb===
16069 ====bba====
16070 ===bc===
16071 ==c==
16072 ===ca===
16073 !! html
16074 ==a==
16075 ===aa===
16076 ====aaa====
16077 !! end
16078
16079 !! test
16080 Section extraction test (section 2)
16081 !! options
16082 section=2
16083 !! wikitext
16084 start
16085 ==a==
16086 ===aa===
16087 ====aaa====
16088 ==b==
16089 ===ba===
16090 ===bb===
16091 ====bba====
16092 ===bc===
16093 ==c==
16094 ===ca===
16095 !! html
16096 ===aa===
16097 ====aaa====
16098 !! end
16099
16100 !! test
16101 Section extraction test (section 3)
16102 !! options
16103 section=3
16104 !! wikitext
16105 start
16106 ==a==
16107 ===aa===
16108 ====aaa====
16109 ==b==
16110 ===ba===
16111 ===bb===
16112 ====bba====
16113 ===bc===
16114 ==c==
16115 ===ca===
16116 !! html
16117 ====aaa====
16118 !! end
16119
16120 !! test
16121 Section extraction test (section 4)
16122 !! options
16123 section=4
16124 !! wikitext
16125 start
16126 ==a==
16127 ===aa===
16128 ====aaa====
16129 ==b==
16130 ===ba===
16131 ===bb===
16132 ====bba====
16133 ===bc===
16134 ==c==
16135 ===ca===
16136 !! html
16137 ==b==
16138 ===ba===
16139 ===bb===
16140 ====bba====
16141 ===bc===
16142 !! end
16143
16144 !! test
16145 Section extraction test (section 5)
16146 !! options
16147 section=5
16148 !! wikitext
16149 start
16150 ==a==
16151 ===aa===
16152 ====aaa====
16153 ==b==
16154 ===ba===
16155 ===bb===
16156 ====bba====
16157 ===bc===
16158 ==c==
16159 ===ca===
16160 !! html
16161 ===ba===
16162 !! end
16163
16164 !! test
16165 Section extraction test (section 6)
16166 !! options
16167 section=6
16168 !! wikitext
16169 start
16170 ==a==
16171 ===aa===
16172 ====aaa====
16173 ==b==
16174 ===ba===
16175 ===bb===
16176 ====bba====
16177 ===bc===
16178 ==c==
16179 ===ca===
16180 !! html
16181 ===bb===
16182 ====bba====
16183 !! end
16184
16185 !! test
16186 Section extraction test (section 7)
16187 !! options
16188 section=7
16189 !! wikitext
16190 start
16191 ==a==
16192 ===aa===
16193 ====aaa====
16194 ==b==
16195 ===ba===
16196 ===bb===
16197 ====bba====
16198 ===bc===
16199 ==c==
16200 ===ca===
16201 !! html
16202 ====bba====
16203 !! end
16204
16205 !! test
16206 Section extraction test (section 8)
16207 !! options
16208 section=8
16209 !! wikitext
16210 start
16211 ==a==
16212 ===aa===
16213 ====aaa====
16214 ==b==
16215 ===ba===
16216 ===bb===
16217 ====bba====
16218 ===bc===
16219 ==c==
16220 ===ca===
16221 !! html
16222 ===bc===
16223 !! end
16224
16225 !! test
16226 Section extraction test (section 9)
16227 !! options
16228 section=9
16229 !! wikitext
16230 start
16231 ==a==
16232 ===aa===
16233 ====aaa====
16234 ==b==
16235 ===ba===
16236 ===bb===
16237 ====bba====
16238 ===bc===
16239 ==c==
16240 ===ca===
16241 !! html
16242 ==c==
16243 ===ca===
16244 !! end
16245
16246 !! test
16247 Section extraction test (section 10)
16248 !! options
16249 section=10
16250 !! wikitext
16251 start
16252 ==a==
16253 ===aa===
16254 ====aaa====
16255 ==b==
16256 ===ba===
16257 ===bb===
16258 ====bba====
16259 ===bc===
16260 ==c==
16261 ===ca===
16262 !! html
16263 ===ca===
16264 !! end
16265
16266 !! test
16267 Section extraction test (nonexistent section 11)
16268 !! options
16269 section=11
16270 !! wikitext
16271 start
16272 ==a==
16273 ===aa===
16274 ====aaa====
16275 ==b==
16276 ===ba===
16277 ===bb===
16278 ====bba====
16279 ===bc===
16280 ==c==
16281 ===ca===
16282 !! html
16283 !! end
16284
16285 !! test
16286 Section extraction test with bogus heading (section 1)
16287 !! options
16288 section=1
16289 !! wikitext
16290 ==a==
16291 ==bogus== not a legal section
16292 ==b==
16293 !! html
16294 ==a==
16295 ==bogus== not a legal section
16296 !! end
16297
16298 !! test
16299 Section extraction test with bogus heading (section 2)
16300 !! options
16301 section=2
16302 !! wikitext
16303 ==a==
16304 ==bogus== not a legal section
16305 ==b==
16306 !! html
16307 ==b==
16308 !! end
16309
16310 !! test
16311 Section extraction test with comment after heading (section 1)
16312 !! options
16313 section=1
16314 !! wikitext
16315 ==a==
16316 ==b== <!-- -->
16317 ==c==
16318 !! html
16319 ==a==
16320 !! end
16321
16322 !! test
16323 Section extraction test with comment after heading (section 2)
16324 !! options
16325 section=2
16326 !! wikitext
16327 ==a==
16328 ==b== <!-- -->
16329 ==c==
16330 !! html
16331 ==b== <!-- -->
16332 !! end
16333
16334 !! test
16335 Section extraction test with bogus <nowiki> heading (section 1)
16336 !! options
16337 section=1
16338 !! wikitext
16339 ==a==
16340 ==bogus== <nowiki>not a legal section</nowiki>
16341 ==b==
16342 !! html
16343 ==a==
16344 ==bogus== <nowiki>not a legal section</nowiki>
16345 !! end
16346
16347 !! test
16348 Section extraction test with bogus <nowiki> heading (section 2)
16349 !! options
16350 section=2
16351 !! wikitext
16352 ==a==
16353 ==bogus== <nowiki>not a legal section</nowiki>
16354 ==b==
16355 !! html
16356 ==b==
16357 !! end
16358
16359
16360 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
16361 # instead of respecting commented sections
16362 !! test
16363 Section extraction prefixed by comment (section 1)
16364 !! options
16365 section=1
16366 !! wikitext
16367 <!-- -->==sec1==
16368 ==sec2==
16369 !! html
16370 ==sec2==
16371 !!end
16372
16373 !! test
16374 Section extraction prefixed by comment (section 2)
16375 !! options
16376 section=2
16377 !! wikitext
16378 <!-- -->==sec1==
16379 ==sec2==
16380 !! html
16381
16382 !!end
16383
16384
16385 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
16386 # instead of respecting HTML-style headings
16387 !! test
16388 Section extraction, mixed wiki and html (section 1)
16389 !! options
16390 section=1
16391 !! wikitext
16392 <h2>unmarked</h2>
16393 unmarked
16394 ==1==
16395 one
16396 ==2==
16397 two
16398 !! html
16399 ==1==
16400 one
16401 !! end
16402
16403 !! test
16404 Section extraction, mixed wiki and html (section 2)
16405 !! options
16406 section=2
16407 !! wikitext
16408 <h2>unmarked</h2>
16409 unmarked
16410 ==1==
16411 one
16412 ==2==
16413 two
16414 !! html
16415 ==2==
16416 two
16417 !! end
16418
16419
16420 # Formerly testing for bug 3342
16421 !! test
16422 Section extraction, heading surrounded by <noinclude>
16423 !! options
16424 section=1
16425 !! wikitext
16426 <noinclude>==unmarked==</noinclude>
16427 ==marked==
16428 !! html
16429 ==marked==
16430 !!end
16431
16432 # Test behavior of bug 19910
16433 !! test
16434 Sectiion with all-equals
16435 !! options
16436 section=2
16437 !! wikitext
16438 ===
16439 The line above must have a trailing space
16440 === <!--
16441 --> <!-- -->
16442 But just in case it doesn't...
16443 !! html
16444 === <!--
16445 --> <!-- -->
16446 But just in case it doesn't...
16447 !! end
16448
16449 !! test
16450 Section replacement test (section 0)
16451 !! options
16452 replace=0,"xxx"
16453 !! wikitext
16454 start
16455 ==a==
16456 ===aa===
16457 ====aaa====
16458 ==b==
16459 ===ba===
16460 ===bb===
16461 ====bba====
16462 ===bc===
16463 ==c==
16464 ===ca===
16465 !! html
16466 xxx
16467
16468 ==a==
16469 ===aa===
16470 ====aaa====
16471 ==b==
16472 ===ba===
16473 ===bb===
16474 ====bba====
16475 ===bc===
16476 ==c==
16477 ===ca===
16478 !! end
16479
16480 !! test
16481 Section replacement test (section 1)
16482 !! options
16483 replace=1,"xxx"
16484 !! wikitext
16485 start
16486 ==a==
16487 ===aa===
16488 ====aaa====
16489 ==b==
16490 ===ba===
16491 ===bb===
16492 ====bba====
16493 ===bc===
16494 ==c==
16495 ===ca===
16496 !! html
16497 start
16498 xxx
16499
16500 ==b==
16501 ===ba===
16502 ===bb===
16503 ====bba====
16504 ===bc===
16505 ==c==
16506 ===ca===
16507 !! end
16508
16509 !! test
16510 Section replacement test (section 2)
16511 !! options
16512 replace=2,"xxx"
16513 !! wikitext
16514 start
16515 ==a==
16516 ===aa===
16517 ====aaa====
16518 ==b==
16519 ===ba===
16520 ===bb===
16521 ====bba====
16522 ===bc===
16523 ==c==
16524 ===ca===
16525 !! html
16526 start
16527 ==a==
16528 xxx
16529
16530 ==b==
16531 ===ba===
16532 ===bb===
16533 ====bba====
16534 ===bc===
16535 ==c==
16536 ===ca===
16537 !! end
16538
16539 !! test
16540 Section replacement test (section 3)
16541 !! options
16542 replace=3,"xxx"
16543 !! wikitext
16544 start
16545 ==a==
16546 ===aa===
16547 ====aaa====
16548 ==b==
16549 ===ba===
16550 ===bb===
16551 ====bba====
16552 ===bc===
16553 ==c==
16554 ===ca===
16555 !! html
16556 start
16557 ==a==
16558 ===aa===
16559 xxx
16560
16561 ==b==
16562 ===ba===
16563 ===bb===
16564 ====bba====
16565 ===bc===
16566 ==c==
16567 ===ca===
16568 !! end
16569
16570 !! test
16571 Section replacement test (section 4)
16572 !! options
16573 replace=4,"xxx"
16574 !! wikitext
16575 start
16576 ==a==
16577 ===aa===
16578 ====aaa====
16579 ==b==
16580 ===ba===
16581 ===bb===
16582 ====bba====
16583 ===bc===
16584 ==c==
16585 ===ca===
16586 !! html
16587 start
16588 ==a==
16589 ===aa===
16590 ====aaa====
16591 xxx
16592
16593 ==c==
16594 ===ca===
16595 !! end
16596
16597 !! test
16598 Section replacement test (section 5)
16599 !! options
16600 replace=5,"xxx"
16601 !! wikitext
16602 start
16603 ==a==
16604 ===aa===
16605 ====aaa====
16606 ==b==
16607 ===ba===
16608 ===bb===
16609 ====bba====
16610 ===bc===
16611 ==c==
16612 ===ca===
16613 !! html
16614 start
16615 ==a==
16616 ===aa===
16617 ====aaa====
16618 ==b==
16619 xxx
16620
16621 ===bb===
16622 ====bba====
16623 ===bc===
16624 ==c==
16625 ===ca===
16626 !! end
16627
16628 !! test
16629 Section replacement test (section 6)
16630 !! options
16631 replace=6,"xxx"
16632 !! wikitext
16633 start
16634 ==a==
16635 ===aa===
16636 ====aaa====
16637 ==b==
16638 ===ba===
16639 ===bb===
16640 ====bba====
16641 ===bc===
16642 ==c==
16643 ===ca===
16644 !! html
16645 start
16646 ==a==
16647 ===aa===
16648 ====aaa====
16649 ==b==
16650 ===ba===
16651 xxx
16652
16653 ===bc===
16654 ==c==
16655 ===ca===
16656 !! end
16657
16658 !! test
16659 Section replacement test (section 7)
16660 !! options
16661 replace=7,"xxx"
16662 !! wikitext
16663 start
16664 ==a==
16665 ===aa===
16666 ====aaa====
16667 ==b==
16668 ===ba===
16669 ===bb===
16670 ====bba====
16671 ===bc===
16672 ==c==
16673 ===ca===
16674 !! html
16675 start
16676 ==a==
16677 ===aa===
16678 ====aaa====
16679 ==b==
16680 ===ba===
16681 ===bb===
16682 xxx
16683
16684 ===bc===
16685 ==c==
16686 ===ca===
16687 !! end
16688
16689 !! test
16690 Section replacement test (section 8)
16691 !! options
16692 replace=8,"xxx"
16693 !! wikitext
16694 start
16695 ==a==
16696 ===aa===
16697 ====aaa====
16698 ==b==
16699 ===ba===
16700 ===bb===
16701 ====bba====
16702 ===bc===
16703 ==c==
16704 ===ca===
16705 !! html
16706 start
16707 ==a==
16708 ===aa===
16709 ====aaa====
16710 ==b==
16711 ===ba===
16712 ===bb===
16713 ====bba====
16714 xxx
16715
16716 ==c==
16717 ===ca===
16718 !!end
16719
16720 !! test
16721 Section replacement test (section 9)
16722 !! options
16723 replace=9,"xxx"
16724 !! wikitext
16725 start
16726 ==a==
16727 ===aa===
16728 ====aaa====
16729 ==b==
16730 ===ba===
16731 ===bb===
16732 ====bba====
16733 ===bc===
16734 ==c==
16735 ===ca===
16736 !! html
16737 start
16738 ==a==
16739 ===aa===
16740 ====aaa====
16741 ==b==
16742 ===ba===
16743 ===bb===
16744 ====bba====
16745 ===bc===
16746 xxx
16747 !! end
16748
16749 !! test
16750 Section replacement test (section 10)
16751 !! options
16752 replace=10,"xxx"
16753 !! wikitext
16754 start
16755 ==a==
16756 ===aa===
16757 ====aaa====
16758 ==b==
16759 ===ba===
16760 ===bb===
16761 ====bba====
16762 ===bc===
16763 ==c==
16764 ===ca===
16765 !! html
16766 start
16767 ==a==
16768 ===aa===
16769 ====aaa====
16770 ==b==
16771 ===ba===
16772 ===bb===
16773 ====bba====
16774 ===bc===
16775 ==c==
16776 xxx
16777 !! end
16778
16779 !! test
16780 Section replacement test with initial whitespace (bug 13728)
16781 !! options
16782 replace=2,"xxx"
16783 !! wikitext
16784 Preformatted initial line
16785 ==a==
16786 ===a===
16787 !! html
16788 Preformatted initial line
16789 ==a==
16790 xxx
16791 !! end
16792
16793
16794 !! test
16795 Section extraction, heading followed by pre with 20 spaces (bug 6398)
16796 !! options
16797 section=1
16798 !! wikitext
16799 ==a==
16800 a
16801 !! html
16802 ==a==
16803 a
16804 !! end
16805
16806 !! test
16807 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
16808 !! options
16809 section=1
16810 !! wikitext
16811 ==a==
16812 a
16813 !! html
16814 ==a==
16815 a
16816 !! end
16817
16818
16819 !! test
16820 Section extraction, <pre> around bogus header (bug 10309)
16821 !! options
16822 noxml section=2
16823 !! wikitext
16824 == Section One ==
16825 <pre>
16826 =======
16827 </pre>
16828
16829 == Section Two ==
16830 stuff
16831 !! html
16832 == Section Two ==
16833 stuff
16834 !! end
16835
16836 !! test
16837 Section replacement, <pre> around bogus header (bug 10309)
16838 !! options
16839 noxml replace=2,"xxx"
16840 !! wikitext
16841 == Section One ==
16842 <pre>
16843 =======
16844 </pre>
16845
16846 == Section Two ==
16847 stuff
16848 !! html
16849 == Section One ==
16850 <pre>
16851 =======
16852 </pre>
16853
16854 xxx
16855 !! end
16856
16857
16858
16859 !! test
16860 Handling of &#x0A; in URLs
16861 !! wikitext
16862 ** irc://&#x0A;a
16863 !! html/php
16864 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
16865
16866 !! html/parsoid
16867 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
16868 a">irc://
16869 a</a></li></ul></li></ul>
16870 !! end
16871
16872 !! test
16873 Handling of %0A in URLs
16874 !! wikitext
16875 ** irc://%0Aa
16876 !! html/php
16877 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
16878
16879 !! html/parsoid
16880 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
16881 !! end
16882
16883
16884 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
16885 !! test
16886 5 quotes, code coverage +1 line
16887 !! options
16888 parsoid=wt2html
16889 !! wikitext
16890 '''''
16891 !! html/php
16892 !! html/parsoid
16893 <p><b><i></i></b></p>
16894 !! end
16895
16896 # same html as previous, but wikitext adjusted to match parsoid html2wt
16897 # note that wt2html and html2html will put the <i> before the <b>
16898 !! test
16899 5 quotes, code coverage +1 line w/ nowiki (1)
16900 !! options
16901 parsoid=wt2wt,html2wt
16902 !! wikitext
16903 '''''<nowiki/>'''''
16904 !! html/php
16905 <p><i></i>
16906 </p>
16907 !! html/parsoid
16908 <p><b><i></i></b></p>
16909 !! end
16910
16911 # same as previous, just swapping the <i> and <b>
16912 !! test
16913 5 quotes, code coverage +1 line w/ nowiki (2)
16914 !! wikitext
16915 '''''<nowiki/>'''''
16916 !! html/php
16917 <p><i></i>
16918 </p>
16919 !! html/parsoid
16920 <p><i><b></b></i></p>
16921 !! end
16922
16923 !! test
16924 Special:Search page linking.
16925 !! wikitext
16926 {{Special:search}}
16927 !! html
16928 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
16929 </p>
16930 !! end
16931
16932 !! test
16933 {{!}} is a magic word
16934 !! wikitext
16935 {{!}} is a magic word there and {{!}} is still a magic word here
16936 !! html/php
16937 <p>| is a magic word there and | is still a magic word here
16938 </p>
16939 !! html/parsoid
16940 <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>
16941 !! end
16942
16943 !! test
16944 Say the magic word
16945 !! options
16946 title=[[Parser test]]
16947 !! wikitext
16948 * {{PAGENAME}}
16949 * {{PAGENAMEE}}
16950 * {{FULLPAGENAME}}
16951 * {{FULLPAGENAMEE}}
16952 * {{BASEPAGENAME}}
16953 * {{BASEPAGENAMEE}}
16954 * {{SUBPAGENAME}}
16955 * {{SUBPAGENAMEE}}
16956 * {{ROOTPAGENAME}}
16957 * {{ROOTPAGENAMEE}}
16958 * {{TALKPAGENAME}}
16959 * {{TALKPAGENAMEE}}
16960 * {{SUBJECTPAGENAME}}
16961 * {{SUBJECTPAGENAMEE}}
16962 * {{NAMESPACEE}}
16963 * {{NAMESPACE}}
16964 * {{NAMESPACENUMBER}}
16965 * {{TALKSPACE}}
16966 * {{TALKSPACEE}}
16967 * {{SUBJECTSPACE}}
16968 * {{SUBJECTSPACEE}}
16969 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
16970 !! html
16971 <ul><li> Parser test</li>
16972 <li> Parser_test</li>
16973 <li> Parser test</li>
16974 <li> Parser_test</li>
16975 <li> Parser test</li>
16976 <li> Parser_test</li>
16977 <li> Parser test</li>
16978 <li> Parser_test</li>
16979 <li> Parser test</li>
16980 <li> Parser_test</li>
16981 <li> Talk:Parser test</li>
16982 <li> Talk:Parser_test</li>
16983 <li> Parser test</li>
16984 <li> Parser_test</li>
16985 <li> </li>
16986 <li> </li>
16987 <li> 0</li>
16988 <li> Talk</li>
16989 <li> Talk</li>
16990 <li> </li>
16991 <li> </li>
16992 <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>
16993
16994 !! end
16995 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
16996
16997 !! test
16998 Gallery
16999 !! wikitext
17000 <gallery>
17001 image1.png |
17002 image2.gif|||||
17003
17004 image3|
17005 image4 |300px| centre
17006 image5.svg| http://///////
17007 [[x|xx]]]]
17008 * image6
17009 </gallery>
17010 !! html
17011 <ul class="gallery mw-gallery-traditional">
17012 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17013 <div class="thumb" style="height: 150px;">Image1.png</div>
17014 <div class="gallerytext">
17015 </div>
17016 </div></li>
17017 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17018 <div class="thumb" style="height: 150px;">Image2.gif</div>
17019 <div class="gallerytext">
17020 <p>||||
17021 </p>
17022 </div>
17023 </div></li>
17024 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17025 <div class="thumb" style="height: 150px;">Image3</div>
17026 <div class="gallerytext">
17027 </div>
17028 </div></li>
17029 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17030 <div class="thumb" style="height: 150px;">Image4</div>
17031 <div class="gallerytext">
17032 <p>300px| centre
17033 </p>
17034 </div>
17035 </div></li>
17036 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17037 <div class="thumb" style="height: 150px;">Image5.svg</div>
17038 <div class="gallerytext">
17039 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
17040 </p>
17041 </div>
17042 </div></li>
17043 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17044 <div class="thumb" style="height: 150px;">* image6</div>
17045 <div class="gallerytext">
17046 </div>
17047 </div></li>
17048 </ul>
17049
17050 !! end
17051
17052 !! test
17053 Gallery (with options)
17054 !! wikitext
17055 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
17056 File:Nonexistent.jpg|caption
17057 File:Nonexistent.jpg
17058 image:foobar.jpg|some '''caption''' [[Main Page]]
17059 image:foobar.jpg
17060 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
17061 </gallery>
17062 !! html
17063 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
17064 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
17065 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17066 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
17067 <div class="gallerytext">
17068 <p>caption
17069 </p>
17070 </div>
17071 </div></li>
17072 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17073 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
17074 <div class="gallerytext">
17075 </div>
17076 </div></li>
17077 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17078 <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>
17079 <div class="gallerytext">
17080 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
17081 </p>
17082 </div>
17083 </div></li>
17084 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17085 <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>
17086 <div class="gallerytext">
17087 </div>
17088 </div></li>
17089 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17090 <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>
17091 <div class="gallerytext">
17092 <p>Blabla|blabla.
17093 </p>
17094 </div>
17095 </div></li>
17096 </ul>
17097
17098 !! end
17099
17100 !! test
17101 Gallery with link that has fragment
17102 !! wikitext
17103 <gallery>
17104 image:foobar.jpg|link=Main_Page
17105 image:foobar.jpg|link=Main_Page#section
17106 image:foobar.jpg|link=Main Page#section|caption
17107 </gallery>
17108 !! html
17109 <ul class="gallery mw-gallery-traditional">
17110 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17111 <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>
17112 <div class="gallerytext">
17113 </div>
17114 </div></li>
17115 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17116 <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>
17117 <div class="gallerytext">
17118 </div>
17119 </div></li>
17120 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17121 <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>
17122 <div class="gallerytext">
17123 <p>caption
17124 </p>
17125 </div>
17126 </div></li>
17127 </ul>
17128
17129 !! end
17130
17131 !! test
17132 Gallery with wikitext inside caption
17133 !! wikitext
17134 <gallery>
17135 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
17136 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
17137 </gallery>
17138 !! html
17139 <ul class="gallery mw-gallery-traditional">
17140 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17141 <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>
17142 <div class="gallerytext">
17143 <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>
17144 </p>
17145 </div>
17146 </div></li>
17147 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17148 <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>
17149 <div class="gallerytext">
17150 <p>This is a test template
17151 </p>
17152 </div>
17153 </div></li>
17154 </ul>
17155
17156 !! end
17157
17158 !! test
17159 gallery (with showfilename option)
17160 !! wikitext
17161 <gallery showfilename>
17162 File:Nonexistent.jpg|caption
17163 File:Nonexistent.jpg
17164 image:foobar.jpg|some '''caption''' [[Main Page]]
17165 File:Foobar.jpg
17166 </gallery>
17167 !! html
17168 <ul class="gallery mw-gallery-traditional">
17169 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17170 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
17171 <div class="gallerytext">
17172 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
17173 caption
17174 </p>
17175 </div>
17176 </div></li>
17177 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17178 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
17179 <div class="gallerytext">
17180 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
17181 </p>
17182 </div>
17183 </div></li>
17184 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17185 <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>
17186 <div class="gallerytext">
17187 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
17188 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
17189 </p>
17190 </div>
17191 </div></li>
17192 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17193 <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>
17194 <div class="gallerytext">
17195 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
17196 </p>
17197 </div>
17198 </div></li>
17199 </ul>
17200
17201 !! end
17202
17203 !! test
17204 Gallery (with namespace-less filenames)
17205 !! wikitext
17206 <gallery>
17207 File:Nonexistent.jpg
17208 Nonexistent.jpg
17209 image:foobar.jpg
17210 foobar.jpg
17211 </gallery>
17212 !! html
17213 <ul class="gallery mw-gallery-traditional">
17214 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17215 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
17216 <div class="gallerytext">
17217 </div>
17218 </div></li>
17219 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17220 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
17221 <div class="gallerytext">
17222 </div>
17223 </div></li>
17224 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17225 <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>
17226 <div class="gallerytext">
17227 </div>
17228 </div></li>
17229 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17230 <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>
17231 <div class="gallerytext">
17232 </div>
17233 </div></li>
17234 </ul>
17235
17236 !! end
17237
17238 !! test
17239 HTML Hex character encoding (spells the word "JavaScript")
17240 !! options
17241 parsoid=wt2html,wt2wt,html2html
17242 !! wikitext
17243 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
17244 !! html/php
17245 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
17246 </p>
17247 !! html/php+tidy
17248 <p>JavaScript</p>
17249 !! html/parsoid
17250 <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>
17251 !! end
17252
17253 !! test
17254 HTML Hex character encoding bogus encoding (bug 26437 regression check)
17255 !! wikitext
17256 &#xsee;&#XSEE;
17257 !! html/php
17258 <p>&amp;#xsee;&amp;#XSEE;
17259 </p>
17260 !! html/parsoid
17261 <p>&amp;#xsee;&amp;#XSEE;</p>
17262 !! end
17263
17264 !! test
17265 HTML Hex character encoding mixed case
17266 !! options
17267 parsoid=wt2html,wt2wt,html2html
17268 !! wikitext
17269 &#xEE;&#Xee;
17270 !! html/php
17271 <p>&#xee;&#xee;
17272 </p>
17273 !! html/php+tidy
17274 <p>îî</p>
17275 !! html/parsoid
17276 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
17277 !! end
17278
17279 !! test
17280 __FORCETOC__ override
17281 !! wikitext
17282 __NEWSECTIONLINK__
17283 __FORCETOC__
17284 !! html
17285 <p><br />
17286 </p>
17287 !! end
17288
17289 !! test
17290 ISBN code coverage
17291 !! wikitext
17292 ISBN 978-0-1234-56&#x20;789
17293 !! html
17294 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
17295 </p>
17296 !! html+tidy
17297 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
17298 !! html/parsoid
17299 <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>
17300 !! end
17301
17302 !! test
17303 ISBN followed by 5 spaces
17304 !! wikitext
17305 ISBN
17306 !! html
17307 <p>ISBN
17308 </p>
17309 !! end
17310
17311 !! test
17312 Double ISBN
17313 !! wikitext
17314 ISBN ISBN 1234567890
17315 !! html/php
17316 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
17317 </p>
17318 !! html/parsoid
17319 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
17320 !! end
17321
17322 !! test
17323 ISBN with an X
17324 !! wikitext
17325 ISBN 3-462-04561-X
17326 ISBN 080442957X
17327 ISBN 978080442957X
17328 !! html/php
17329 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
17330 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
17331 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
17332 </p>
17333 !! html/parsoid
17334 <p><a href="./Special:BookSources/346204561X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
17335 <a href="./Special:BookSources/080442957X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
17336 <a href="./Special:BookSources/978080442957X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a></p>
17337 !! end
17338
17339 !! test
17340 ISBN with empty prefix (parsoid test)
17341 !! wikitext
17342 ISBN 1234567890
17343 !! html/php
17344 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
17345 </p>
17346 !! html/parsoid
17347 <p><a href="Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567890</a></p>
17348 !! end
17349
17350 !! test
17351 Bug 22905: <abbr> followed by ISBN followed by </a>
17352 !! wikitext
17353 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
17354 !! html/php
17355 <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>
17356 </p>
17357 !! html/parsoid
17358 <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>
17359 !! end
17360
17361 !! test
17362 Double RFC
17363 !! wikitext
17364 RFC RFC 1234
17365 !! html
17366 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
17367 </p>
17368 !! end
17369
17370 !! test
17371 Double RFC with a wiki link
17372 !! wikitext
17373 RFC [[RFC 1234]]
17374 !! html
17375 <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>
17376 </p>
17377 !! end
17378
17379 !! test
17380 RFC code coverage
17381 !! wikitext
17382 RFC 983&#x20;987
17383 !! html
17384 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
17385 </p>
17386 !! html+tidy
17387 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
17388 !! end
17389
17390 !! test
17391 Centre-aligned image
17392 !! wikitext
17393 [[Image:foobar.jpg|centre]]
17394 !! html
17395 <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>
17396
17397 !!end
17398
17399 !! test
17400 None-aligned image
17401 !! wikitext
17402 [[Image:foobar.jpg|none]]
17403 !! html
17404 <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>
17405
17406 !!end
17407
17408 !! test
17409 Width + Height sized image (using px) (height is ignored)
17410 !! wikitext
17411 [[Image:foobar.jpg|640x480px]]
17412 !! html
17413 <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>
17414 </p>
17415 !!end
17416
17417 !! test
17418 Width-sized image (using px, no following whitespace)
17419 !! wikitext
17420 [[Image:foobar.jpg|640px]]
17421 !! html
17422 <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>
17423 </p>
17424 !!end
17425
17426 !! test
17427 Width-sized image (using px, with following whitespace - test regression from r39467)
17428 !! wikitext
17429 [[Image:foobar.jpg|640px ]]
17430 !! html
17431 <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>
17432 </p>
17433 !!end
17434
17435 !! test
17436 Width-sized image (using px, with preceding whitespace - test regression from r39467)
17437 !! wikitext
17438 [[Image:foobar.jpg| 640px]]
17439 !! html
17440 <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>
17441 </p>
17442 !!end
17443
17444 !! test
17445 Image with page parameter
17446 !! options
17447 djvu
17448 !! wikitext
17449 [[File:LoremIpsum.djvu|page=2]]
17450 !! html/php
17451 <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>
17452 </p>
17453 !! html/parsoid
17454 <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" height="3508" width="2480" data-parsoid='{"a":{"resource":"./File:LoremIpsum.djvu","height":"3508","width":"2480"},"sa":{"resource":"File:LoremIpsum.djvu"}}'/></a></span></p>
17455 !! end
17456
17457 !! test
17458 Another italics / bold test
17459 !! wikitext
17460 ''' ''x'
17461 !! html
17462 <pre>'<i> </i>x'
17463 </pre>
17464 !!end
17465
17466 # FIXME: The php output seems broken. It's interleaving some open/close tags.
17467 !! test
17468 dt/dd/dl test
17469 !! wikitext
17470 :;;;::
17471 !! html/php
17472 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
17473
17474 !! html/parsoid
17475 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
17476
17477 !!end
17478
17479
17480 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
17481 !! test
17482 Images with the "|" character in the comment
17483 !! wikitext
17484 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
17485 !! html/php
17486 <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>
17487
17488 !! html/parsoid
17489 <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" height="25" width="220"/></a><figcaption>An <a rel="mw:ExtLink" href="http://test/?param1=|left|&amp;param2=|x">external</a> URL</figcaption></figure>
17490 !! end
17491
17492 !! test
17493 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
17494 !! wikitext
17495 <html><script>alert(1);</script></html>
17496 !! html
17497 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
17498 </p>
17499 !! end
17500
17501 !! test
17502 HTML with raw HTML ($wgRawHtml==true)
17503 !! options
17504 wgRawHtml=1
17505 !! wikitext
17506 <html><script>alert(1);</script></html>
17507 !! html
17508 <p><script>alert(1);</script>
17509 </p>
17510 !! end
17511
17512 !! test
17513 Parents of subpages, one level up
17514 !! options
17515 subpage title=[[Subpage test/L1/L2/L3]]
17516 !! wikitext
17517 [[../|L2]]
17518 !! html
17519 <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>
17520 </p>
17521 !! end
17522
17523
17524 !! test
17525 Parents of subpages, one level up, not named
17526 !! options
17527 subpage title=[[Subpage test/L1/L2/L3]]
17528 !! wikitext
17529 [[../]]
17530 !! html
17531 <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>
17532 </p>
17533 !! end
17534
17535
17536
17537 !! test
17538 Parents of subpages, two levels up
17539 !! options
17540 subpage title=[[Subpage test/L1/L2/L3]]
17541 !! wikitext
17542 [[../../|L1]]2
17543
17544 [[../../|L1]]l
17545 !! html
17546 <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
17547 </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>
17548 </p>
17549 !! end
17550
17551 !! test
17552 Parents of subpages, two levels up, without trailing slash or name.
17553 !! options
17554 subpage title=[[Subpage test/L1/L2/L3]]
17555 !! wikitext
17556 [[../..]]
17557 !! html
17558 <p>[[../..]]
17559 </p>
17560 !! end
17561
17562 !! test
17563 Parents of subpages, two levels up, with lots of extra trailing slashes.
17564 !! options
17565 subpage title=[[Subpage test/L1/L2/L3]]
17566 !! wikitext
17567 [[../../////]]
17568 !! html
17569 <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>
17570 </p>
17571 !! end
17572
17573 !! article
17574 Subpage test/L1/L2/L3Sibling
17575 !! text
17576 Sibling article
17577 !! endarticle
17578
17579 !! test
17580 Transclusion of a sibling page (one level up)
17581 !! options
17582 subpage title=[[Subpage test/L1/L2/L3]]
17583 !! wikitext
17584 {{../L3Sibling}}
17585 !! html
17586 <p>Sibling article
17587 </p>
17588 !! end
17589
17590 !! test
17591 Transclusion of a child page
17592 !! options
17593 subpage title=[[Subpage test/L1/L2]]
17594 !! wikitext
17595 {{/L3Sibling}}
17596 !! html
17597 <p>Sibling article
17598 </p>
17599 !! end
17600
17601 !! test
17602 Non-transclusion because of too many up levels
17603 !! options
17604 subpage title=[[Subpage test/L1/L2/L3]]
17605 !! wikitext
17606 {{../../../../More than parent}}
17607 !! html
17608 <p>{{../../../../More than parent}}
17609 </p>
17610 !! end
17611
17612 !! test
17613 Definition list code coverage
17614 !! wikitext
17615 ; title : def
17616 ; title : def
17617 ;title: def
17618 !! html/php
17619 <dl><dt> title &#160;</dt>
17620 <dd> def</dd>
17621 <dt> title&#160;</dt>
17622 <dd> def</dd>
17623 <dt>title</dt>
17624 <dd> def</dd></dl>
17625
17626 !! html/parsoid
17627 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
17628 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
17629 <dt>title</dt><dd> def</dd></dl>
17630 !! end
17631
17632 !! test
17633 Don't fall for the self-closing div
17634 !! wikitext
17635 <div>hello world</div/>
17636 !! html
17637 <div>hello world</div>
17638
17639 !! end
17640
17641 !! test
17642 MSGNW magic word
17643 !! wikitext
17644 {{MSGNW:msg}}
17645 !! html
17646 <p>&#91;&#91;:Template:Msg&#93;&#93;
17647 </p>
17648 !! end
17649
17650 !! test
17651 RAW magic word
17652 !! wikitext
17653 {{RAW:QUERTY}}
17654 !! html
17655 <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>
17656 </p>
17657 !! end
17658
17659 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
17660 !! test
17661 Always escape literal '>' in output, not just after '<'
17662 !! wikitext
17663 ><>
17664 !! html
17665 <p>&gt;&lt;&gt;
17666 </p>
17667 !! end
17668
17669 !! test
17670 Template caching
17671 !! wikitext
17672 {{Test}}
17673 {{Test}}
17674 !! html
17675 <p>This is a test template
17676 This is a test template
17677 </p>
17678 !! end
17679
17680
17681 !! article
17682 MediaWiki:Fake
17683 !! text
17684 ==header==
17685 !! endarticle
17686
17687 !! test
17688 Inclusion of !userCanEdit() content
17689 !! wikitext
17690 {{MediaWiki:Fake}}
17691 !! html
17692 <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>
17693
17694 !! end
17695
17696
17697 !! test
17698 Out-of-order TOC heading levels
17699 !! wikitext
17700 ==2==
17701 ======6======
17702 ===3===
17703 =1=
17704 =====5=====
17705 ==2==
17706 !! html
17707 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17708 <ul>
17709 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
17710 <ul>
17711 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
17712 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
17713 </ul>
17714 </li>
17715 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
17716 <ul>
17717 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
17718 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
17719 </ul>
17720 </li>
17721 </ul>
17722 </div>
17723
17724 <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>
17725 <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>
17726 <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>
17727 <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>
17728 <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>
17729 <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>
17730
17731 !! end
17732
17733
17734 !! test
17735 ISBN with a dummy number
17736 !! wikitext
17737 ISBN ---
17738 !! html
17739 <p>ISBN ---
17740 </p>
17741 !! end
17742
17743
17744 !! test
17745 ISBN with space-delimited number
17746 !! wikitext
17747 ISBN 92 9017 032 8
17748 !! html
17749 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
17750 </p>
17751 !! end
17752
17753
17754 !! test
17755 ISBN with multiple spaces, no number
17756 !! wikitext
17757 ISBN foo
17758 !! html
17759 <p>ISBN foo
17760 </p>
17761 !! end
17762
17763
17764 !! test
17765 ISBN length
17766 !! wikitext
17767 ISBN 123456789
17768
17769 ISBN 1234567890
17770
17771 ISBN 12345678901
17772 !! html
17773 <p>ISBN 123456789
17774 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
17775 </p><p>ISBN 12345678901
17776 </p>
17777 !! end
17778
17779
17780 !! test
17781 ISBN with trailing year (bug 8110)
17782 !! wikitext
17783 ISBN 1-234-56789-0 - 2006
17784
17785 ISBN 1 234 56789 0 - 2006
17786 !! html
17787 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
17788 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
17789 </p>
17790 !! end
17791
17792
17793 !! test
17794 anchorencode
17795 !! wikitext
17796 {{anchorencode:foo bar©#%n}}
17797 !! html
17798 <p>foo_bar.C2.A9.23.25n
17799 </p>
17800 !! end
17801
17802 !! test
17803 anchorencode trims spaces
17804 !! wikitext
17805 {{anchorencode: __pretty__please__}}
17806 !! html
17807 <p>pretty_please
17808 </p>
17809 !! end
17810
17811 !! test
17812 anchorencode deals with links
17813 !! wikitext
17814 {{anchorencode: [[hello|world]] [[hi]]}}
17815 !! html
17816 <p>world_hi
17817 </p>
17818 !! end
17819
17820 !! test
17821 anchorencode deals with templates
17822 !! wikitext
17823 {{anchorencode: {{Foo}} }}
17824 !! html
17825 <p>FOO
17826 </p>
17827 !! end
17828
17829 !! test
17830 anchorencode encodes like the TOC generator: (bug 18431)
17831 !! wikitext
17832 === _ +:.3A%3A&&amp;]] ===
17833 {{anchorencode: _ +:.3A%3A&&amp;]] }}
17834 __NOEDITSECTION__
17835 !! html
17836 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
17837 <p>.2B:.3A.253A.26.26.5D.5D
17838 </p>
17839 !! end
17840
17841 !! test
17842 Bug 6200: blockquotes and paragraph formatting
17843 !! wikitext
17844 <blockquote>
17845 foo
17846 </blockquote>
17847
17848 bar
17849
17850 baz
17851 !! html
17852 <blockquote>
17853 <p>foo
17854 </p>
17855 </blockquote>
17856 <p>bar
17857 </p>
17858 <pre>baz
17859 </pre>
17860 !! end
17861
17862 !! test
17863 Bug 8293: Use of center tag ruins paragraph formatting
17864 !! wikitext
17865 <center>
17866 foo
17867 </center>
17868
17869 bar
17870
17871 baz
17872 !! html
17873 <center>
17874 <p>foo
17875 </p>
17876 </center>
17877 <p>bar
17878 </p>
17879 <pre>baz
17880 </pre>
17881 !! end
17882
17883 !!test
17884 Parsing of overlapping (improperly nested) inline html tags
17885 !! wikitext
17886 <span><s>x</span></s>
17887 !! html/php
17888 <p><span><s>x&lt;/span&gt;</s></span>
17889 </p>
17890 !! html/parsoid
17891 <p><span><s>x</s></span>
17892 </p>
17893 !!end
17894
17895 ###
17896 ### Language variants related tests
17897 ###
17898 !! test
17899 Self-link in language variants
17900 !! options
17901 title=[[Dunav]] language=sr
17902 !! wikitext
17903 Both [[Dunav]] and [[Дунав]] are names for this river.
17904 !! html
17905 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
17906 </p>
17907 !!end
17908
17909 !! article
17910 Дуна
17911 !! text
17912 content
17913 !! endarticle
17914
17915 !! test
17916 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
17917 !! options
17918 title=[[Duna]] language=sr
17919 !! wikitext
17920 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
17921 !! html
17922 <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.
17923 </p>
17924 !! end
17925
17926 !! test
17927 Link to a section of a variant of this title shouldn't be parsed as self-link
17928 !! options
17929 title=[[Duna]] language=sr
17930 !! wikitext
17931 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
17932 !! html
17933 <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.
17934 </p>
17935 !! end
17936
17937 !! test
17938 Link to pages in language variants
17939 !! options
17940 language=sr
17941 !! wikitext
17942 Main Page can be written as [[Маин Паге]]
17943 !! html
17944 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
17945 </p>
17946 !!end
17947
17948
17949 !! test
17950 Multiple links to pages in language variants
17951 !! options
17952 language=sr
17953 !! wikitext
17954 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
17955 !! html
17956 <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>.
17957 </p>
17958 !!end
17959
17960
17961 !! test
17962 Simple template in language variants
17963 !! options
17964 language=sr
17965 !! wikitext
17966 {{тест}}
17967 !! html
17968 <p>This is a test template
17969 </p>
17970 !! end
17971
17972
17973 !! test
17974 Template with explicit namespace in language variants
17975 !! options
17976 language=sr
17977 !! wikitext
17978 {{Template:тест}}
17979 !! html
17980 <p>This is a test template
17981 </p>
17982 !! end
17983
17984
17985 !! test
17986 Basic test for template parameter in language variants
17987 !! options
17988 language=sr
17989 !! wikitext
17990 {{парамтест|param=foo}}
17991 !! html
17992 <p>This is a test template with parameter foo
17993 </p>
17994 !! end
17995
17996
17997 !! test
17998 Simple category in language variants
17999 !! options
18000 language=sr cat
18001 !! wikitext
18002 [[Category:МедиаWики Усер'с Гуиде]]
18003 !! html
18004 <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>
18005 !! end
18006
18007
18008 !! article
18009 Category:分类
18010 !! text
18011 blah
18012 !! endarticle
18013
18014 !! article
18015 Category:分類
18016 !! text
18017 blah
18018 !! endarticle
18019
18020 !! test
18021 Don't convert blue categorylinks to another variant (bug 33210)
18022 !! options
18023 language=zh cat
18024 !! wikitext
18025 [[A]][[Category:分类]]
18026 !! html
18027 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
18028 !! end
18029
18030
18031 !! test
18032 Stripping -{}- tags (language variants)
18033 !! options
18034 language=sr
18035 !! wikitext
18036 Latin proverb: -{Ne nuntium necare}-
18037 !! html
18038 <p>Latin proverb: Ne nuntium necare
18039 </p>
18040 !! end
18041
18042
18043 !! test
18044 Prevent conversion with -{}- tags (language variants)
18045 !! options
18046 language=sr variant=sr-ec
18047 !! wikitext
18048 Latinski: -{Ne nuntium necare}-
18049 !! html
18050 <p>Латински: Ne nuntium necare
18051 </p>
18052 !! end
18053
18054
18055 !! test
18056 Prevent conversion of text with -{}- tags (language variants)
18057 !! options
18058 language=sr variant=sr-ec
18059 !! wikitext
18060 Latinski: -{Ne nuntium necare}-
18061 !! html
18062 <p>Латински: Ne nuntium necare
18063 </p>
18064 !! end
18065
18066
18067 !! test
18068 Prevent conversion of links with -{}- tags (language variants)
18069 !! options
18070 language=sr variant=sr-ec
18071 !! wikitext
18072 -{[[Main Page]]}-
18073 !! html
18074 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18075 </p>
18076 !! end
18077
18078
18079 !! test
18080 -{}- tags within headlines (within html for parserConvert())
18081 !! options
18082 language=sr variant=sr-ec
18083 !! wikitext
18084 == -{Naslov}- ==
18085 !! html
18086 <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>
18087
18088 !! end
18089
18090
18091 !! test
18092 Explicit definition of language variant alternatives
18093 !! options
18094 language=zh variant=zh-tw
18095 !! wikitext
18096 -{zh:China;zh-tw:Taiwan}-, not China
18097 !! html
18098 <p>Taiwan, not China
18099 </p>
18100 !! end
18101
18102
18103 !! test
18104 Conversion around HTML tags
18105 !! options
18106 language=sr variant=sr-ec
18107 !! wikitext
18108 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
18109 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
18110 !! html
18111 <p>
18112 <span title="ЛаCтин">ски</span>
18113 </p>
18114 !! end
18115
18116
18117 !! test
18118 Explicit session-wise language variant mapping (A flag and - flag)
18119 !! options
18120 language=zh variant=zh-tw
18121 !! wikitext
18122 Taiwan is not China.
18123 But -{A|zh:China;zh-tw:Taiwan}- is China,
18124 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
18125 and -{China}- is China.
18126 !! html
18127 <p>Taiwan is not China.
18128 But Taiwan is Taiwan,
18129 (This should be stripped!)
18130 and China is China.
18131 </p>
18132 !! end
18133
18134 !! test
18135 Explicit session-wise language variant mapping (H flag for hide)
18136 !! options
18137 language=zh variant=zh-tw
18138 !! wikitext
18139 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
18140 Taiwan is China.
18141 !! html
18142 <p>(This should be stripped!)
18143 Taiwan is Taiwan.
18144 </p>
18145 !! end
18146
18147 !! test
18148 Adding explicit conversion rule for title (T flag)
18149 !! options
18150 language=zh variant=zh-tw showtitle
18151 !! wikitext
18152 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
18153 !! html
18154 Taiwan
18155 <p>Should be stripped!
18156 </p>
18157 !! end
18158
18159 !! test
18160 Testing that changing the language variant here in the tests actually works
18161 !! options
18162 language=zh variant=zh showtitle
18163 !! wikitext
18164 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
18165 !! html
18166 China
18167 <p>Should be stripped!
18168 </p>
18169 !! end
18170
18171 !! test
18172 Recursive conversion of alt and title attrs shouldn't clear converter state
18173 !! options
18174 language=zh variant=zh-cn showtitle
18175 !! wikitext
18176 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
18177 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
18178 !! html
18179 China
18180 <p>
18181 Should be stripped<span title="Exclamation">!</span>
18182 </p>
18183 !! end
18184
18185 !! test
18186 Bug 24072: more test on conversion rule for title
18187 !! options
18188 language=zh variant=zh-tw showtitle
18189 !! wikitext
18190 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
18191 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
18192 !! html
18193 Taiwan
18194 <p>This should be stripped!
18195 This won't take interferes with the title rule.
18196 </p>
18197 !! end
18198
18199 !! test
18200 Partly disable title conversion if variant == main language code
18201 !! options
18202 language=zh variant=zh title=[[ZH]] showtitle
18203 !! wikitext
18204 -{T|zh-cn:CN;zh-tw:TW}-
18205 !! html
18206 ZH
18207 <p>
18208 </p>
18209 !! end
18210
18211 !! test
18212 Partly disable title conversion if variant == main language code, more
18213 !! options
18214 language=zh variant=zh title=[[ZH]] showtitle
18215 !! wikitext
18216 -{T|TW}-
18217 !! html
18218 ZH
18219 <p>
18220 </p>
18221 !! end
18222
18223 !! test
18224 Raw output of variant escape tags (R flag)
18225 !! options
18226 language=zh variant=zh-tw
18227 !! wikitext
18228 Raw: -{R|zh:China;zh-tw:Taiwan}-
18229 !! html
18230 <p>Raw: zh:China;zh-tw:Taiwan
18231 </p>
18232 !! end
18233
18234 !! test
18235 Nested using of manual convert syntax
18236 !! options
18237 language=zh variant=zh-hk
18238 !! wikitext
18239 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
18240 !! html
18241 <p>Nested: Hello Hong Kong!
18242 </p>
18243 !! end
18244
18245 !! test
18246 Proper conversion of text in external links
18247 !! options
18248 language=sr variant=sr-ec
18249 !! wikitext
18250 http://www.google.com
18251 gopher://www.google.com
18252 [http://www.google.com http://www.google.com]
18253 [gopher://www.google.com gopher://www.google.com]
18254 [https://www.google.com irc://www.google.com]
18255 [ftp://www.google.com www.google.com/ftp://dir]
18256 [//www.google.com www.google.com]
18257 !! html
18258 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
18259 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
18260 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
18261 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
18262 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
18263 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
18264 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
18265 </p>
18266 !! end
18267
18268 !! test
18269 Do not convert roman numbers to language variants
18270 !! options
18271 language=sr variant=sr-ec
18272 !! wikitext
18273 Fridrih IV je car.
18274 !! html
18275 <p>Фридрих IV је цар.
18276 </p>
18277 !! end
18278
18279 !! test
18280 Unclosed language converter markup "-{"
18281 !! options
18282 language=sr
18283 !! wikitext
18284 -{T|hello
18285 !! html
18286 <p>-{T|hello
18287 </p>
18288 !! end
18289
18290 !! test
18291 Don't convert raw rule "-{R|=&gt;}-" to "=>"
18292 !! options
18293 language=sr
18294 !! wikitext
18295 -{R|=&gt;}-
18296 !! html
18297 <p>=&gt;
18298 </p>
18299 !!end
18300
18301 !! test
18302 Don't break link parsing if language converter markup is in the caption.
18303 !! options
18304 language=sr variant=sr-ec
18305 !! wikitext
18306 [[Main Page|-{R|main page}-]]
18307 !! html
18308 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
18309 </p>
18310 !! end
18311
18312 # FIXME: This test is currently broken in the PHP parser (bug 52661)
18313 !! test
18314 Don't break image parsing if language converter markup is in the caption.
18315 !! options
18316 language=sr
18317 !! wikitext
18318 [[File:Foobar.jpg|-{R|caption}-]]
18319 !! html/parsoid
18320 <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>
18321 </p>
18322 !! end
18323
18324 # FIXME: This test is currently broken in the PHP parser (bug 52661)
18325 !! test
18326 Don't break list handling if language converter markup is in the item.
18327 !! options
18328 language=zh variant=zh-cn
18329 !! wikitext
18330 ;-{zh-cn:AAA;zh-tw:BBB}-
18331 !! html/php
18332 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
18333
18334 !! html/parsoid
18335 <dl><dt>AAA
18336 </dt></dl>
18337 !! end
18338
18339 # FIXME: This test is currently broken in the PHP parser (bug 52661)
18340 !! test
18341 Don't break table handling if language converter markup is in the cell.
18342 !! options
18343 language=sr variant=sr-ec
18344 !! wikitext
18345 {|
18346 |-
18347 | -{R|B}-
18348 |}
18349 !! html/php
18350 <table>
18351
18352 <tr>
18353 <td>Б}-
18354 </td></tr></table>
18355
18356 !! html/parsoid
18357 <table>
18358
18359 <tr>
18360 <td> B
18361 </td></tr></table>
18362
18363 !! end
18364
18365 !! test
18366 Bug 529: Uncovered bullet
18367 !! wikitext
18368 * Foo {{bullet}}
18369 !! html
18370 <ul><li> Foo </li>
18371 <li> Bar</li></ul>
18372
18373 !! end
18374
18375 # Plain MediaWiki does not remove empty lists, but tidy actually does.
18376 # Templates in Wikipedia rely on this behavior, as tidy has always been
18377 # enabled there. These tests are normally run *without* tidy, so specify the
18378 # full output here.
18379 # To test realistic parsing behavior, apply a tidy-like transformation to both
18380 # the expected output and your parser's output.
18381 !! test
18382 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
18383 !! wikitext
18384 ******* Foo {{bullet}}
18385 !! html
18386 <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>
18387 <li> Bar</li></ul>
18388
18389 !! end
18390
18391 !! test
18392 Bug 529: Uncovered table already at line-start
18393 !! wikitext
18394 x
18395
18396 {{table}}
18397 y
18398 !! html
18399 <p>x
18400 </p>
18401 <table>
18402 <tr>
18403 <td> 1 </td>
18404 <td> 2
18405 </td></tr>
18406 <tr>
18407 <td> 3 </td>
18408 <td> 4
18409 </td></tr></table>
18410 <p>y
18411 </p>
18412 !! end
18413
18414 !! test
18415 Bug 529: Uncovered bullet in parser function result
18416 !! wikitext
18417 * Foo {{lc:{{bullet}} }}
18418 !! html
18419 <ul><li> Foo </li>
18420 <li> bar</li></ul>
18421
18422 !! end
18423
18424 !! test
18425 Bug 5678: Double-parsed template argument
18426 !! wikitext
18427 {{lc:{{{1}}}|hello}}
18428 !! html
18429 <p>{{{1}}}
18430 </p>
18431 !! end
18432
18433 !! test
18434 Bug 5678: Double-parsed template invocation
18435 !! wikitext
18436 {{lc:{{paramtest {{!}} param = hello }} }}
18437 !! html
18438 <p>{{paramtest | param = hello }}
18439 </p>
18440 !! end
18441
18442 !! test
18443 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
18444 !! options
18445 language=cs
18446 title=[[Main Page]]
18447 !! wikitext
18448 {{PRVNÍVELKÉ:ěščř}}
18449 {{prvnívelké:ěščř}}
18450 {{PRVNÍMALÉ:ěščř}}
18451 {{prvnímalé:ěščř}}
18452 {{MALÁ:ěščř}}
18453 {{malá:ěščř}}
18454 {{VELKÁ:ěščř}}
18455 {{velká:ěščř}}
18456 !! html
18457 <p>Ěščř
18458 Ěščř
18459 ěščř
18460 ěščř
18461 ěščř
18462 ěščř
18463 ĚŠČŘ
18464 ĚŠČŘ
18465 </p>
18466 !! end
18467
18468 !! test
18469 Morwen/13: Unclosed link followed by heading
18470 !! wikitext
18471 [[link
18472 ==heading==
18473 !! html
18474 <p>[[link
18475 </p>
18476 <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>
18477
18478 !! end
18479
18480 !! test
18481 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
18482 !! wikitext
18483 {{foo|
18484 =heading=
18485 !! html
18486 <p>{{foo|
18487 </p>
18488 <h1><span class="mw-headline" id="heading">heading</span></h1>
18489
18490 !! end
18491
18492 !! test
18493 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
18494 !! wikitext
18495 {{foo|
18496 ==heading==
18497 !! html
18498 <p>{{foo|
18499 </p>
18500 <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>
18501
18502 !! end
18503
18504 !! test
18505 Tildes in comments
18506 !! options
18507 pst
18508 !! wikitext
18509 <!-- ~~~~ -->
18510 !! html
18511 <!-- ~~~~ -->
18512 !! end
18513
18514 !! test
18515 Paragraphs inside divs (no extra line breaks)
18516 !! wikitext
18517 <div>Line one
18518
18519 Line two</div>
18520 !! html
18521 <div>Line one
18522 Line two</div>
18523
18524 !! end
18525
18526 !! test
18527 Paragraphs inside divs (extra line break on open)
18528 !! wikitext
18529 <div>
18530 Line one
18531
18532 Line two</div>
18533 !! html
18534 <div>
18535 <p>Line one
18536 </p>
18537 Line two</div>
18538
18539 !! end
18540
18541 !! test
18542 Paragraphs inside divs (extra line break on close)
18543 !! wikitext
18544 <div>Line one
18545
18546 Line two
18547 </div>
18548 !! html
18549 <div>Line one
18550 <p>Line two
18551 </p>
18552 </div>
18553
18554 !! end
18555
18556 !! test
18557 Paragraphs inside divs (extra line break on open and close)
18558 !! wikitext
18559 <div>
18560 Line one
18561
18562 Line two
18563 </div>
18564 !! html
18565 <div>
18566 <p>Line one
18567 </p><p>Line two
18568 </p>
18569 </div>
18570
18571 !! end
18572
18573 !! test
18574 Nesting tags, paragraphs on lines which begin with <div>
18575 !! wikitext
18576 <div></div><strong>A
18577 B</strong>
18578 !! html/php+tidy
18579 <p><strong>A</strong></p>
18580 <p><strong>B</strong></p>
18581 !! html/parsoid
18582 <div></div>
18583 <p><strong>A
18584 B</strong>
18585 </p>
18586 !! end
18587
18588 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
18589 !! test
18590 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
18591 !! wikitext
18592 <blockquote>Line one
18593
18594 Line two</blockquote>
18595 !! html
18596 <blockquote>Line one
18597 Line two</blockquote>
18598
18599 !! html+tidy
18600 <blockquote>
18601 <p>Line one Line two</p>
18602 </blockquote>
18603 !! end
18604
18605 !! test
18606 Bug 6200: paragraphs inside blockquotes (extra line break on open)
18607 !! wikitext
18608 <blockquote>
18609 Line one
18610
18611 Line two</blockquote>
18612 !! html
18613 <blockquote>
18614 <p>Line one
18615 </p>
18616 Line two</blockquote>
18617
18618 !! html+tidy
18619 <blockquote>
18620 <p>Line one</p>
18621 Line two</blockquote>
18622 !! end
18623
18624 !! test
18625 Bug 6200: paragraphs inside blockquotes (extra line break on close)
18626 !! wikitext
18627 <blockquote>Line one
18628
18629 Line two
18630 </blockquote>
18631 !! html
18632 <blockquote>Line one
18633 <p>Line two
18634 </p>
18635 </blockquote>
18636
18637 !! html+tidy
18638 <blockquote>
18639 <p>Line one</p>
18640 <p>Line two</p>
18641 </blockquote>
18642 !! end
18643
18644 !! test
18645 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
18646 !! wikitext
18647 <blockquote>
18648 Line one
18649
18650 Line two
18651 </blockquote>
18652 !! html
18653 <blockquote>
18654 <p>Line one
18655 </p><p>Line two
18656 </p>
18657 </blockquote>
18658
18659 !! html+tidy
18660 <blockquote>
18661 <p>Line one</p>
18662 <p>Line two</p>
18663 </blockquote>
18664 !! end
18665
18666 !! test
18667 Paragraphs inside blockquotes/divs (no extra line breaks)
18668 !! wikitext
18669 <blockquote><div>Line one
18670
18671 Line two</div></blockquote>
18672 !! html
18673 <blockquote><div>Line one
18674 Line two</div></blockquote>
18675
18676 !! end
18677
18678 !! test
18679 Paragraphs inside blockquotes/divs (extra line break on open)
18680 !! wikitext
18681 <blockquote><div>
18682 Line one
18683
18684 Line two</div></blockquote>
18685 !! html
18686 <blockquote><div>
18687 <p>Line one
18688 </p>
18689 Line two</div></blockquote>
18690
18691 !! end
18692
18693 !! test
18694 Paragraphs inside blockquotes/divs (extra line break on close)
18695 !! wikitext
18696 <blockquote><div>Line one
18697
18698 Line two
18699 </div></blockquote>
18700 !! html
18701 <blockquote><div>Line one
18702 <p>Line two
18703 </p>
18704 </div></blockquote>
18705
18706 !! end
18707
18708 !! test
18709 Paragraphs inside blockquotes/divs (extra line break on open and close)
18710 !! wikitext
18711 <blockquote><div>
18712 Line one
18713
18714 Line two
18715 </div></blockquote>
18716 !! html
18717 <blockquote><div>
18718 <p>Line one
18719 </p><p>Line two
18720 </p>
18721 </div></blockquote>
18722
18723 !! end
18724
18725 !! test
18726 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
18727 !! options
18728 wgLinkHolderBatchSize=0
18729 !! wikitext
18730 [[meatball:1]]
18731 [[meatball:2]]
18732 [[meatball:3]]
18733 !! html
18734 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
18735 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
18736 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
18737 </p>
18738 !! end
18739
18740 !! test
18741 Free external link invading image caption
18742 !! wikitext
18743 [[Image:Foobar.jpg|thumb|http://x|hello]]
18744 !! html
18745 <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>
18746
18747 !! end
18748
18749 !! test
18750 Bug 15196: localised external link numbers
18751 !! options
18752 language=fa
18753 !! wikitext
18754 [http://en.wikipedia.org/]
18755 !! html/php
18756 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
18757 </p>
18758 !! html/parsoid
18759 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
18760 !! end
18761
18762 !! test
18763 Multibyte character in padleft
18764 !! wikitext
18765 {{padleft:-Hello|7|Æ}}
18766 !! html
18767 <p>Æ-Hello
18768 </p>
18769 !! end
18770
18771 !! test
18772 Multibyte character in padright
18773 !! wikitext
18774 {{padright:Hello-|7|Æ}}
18775 !! html
18776 <p>Hello-Æ
18777 </p>
18778 !! end
18779
18780 !!test
18781 formatdate parser function
18782 !! wikitext
18783 {{#formatdate:2009-03-24}}
18784 !! html
18785 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
18786 </p>
18787 !! end
18788
18789 !!test
18790 formatdate parser function, with default format
18791 !! wikitext
18792 {{#formatdate:2009-03-24|mdy}}
18793 !! html
18794 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
18795 </p>
18796 !! end
18797
18798 !! test
18799 Spacing of numbers in formatted dates
18800 !! wikitext
18801 {{#formatdate:January 15}}
18802 !! html
18803 <p><span class="mw-formatted-date" title="01-15">January 15</span>
18804 </p>
18805 !! end
18806
18807 !! test
18808 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
18809 !! options
18810 language=nl title=[[MediaWiki:Common.css]]
18811 !! wikitext
18812 {{#formatdate:2009-03-24|dmy}}
18813 !! html
18814 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
18815 </p>
18816 !! end
18817
18818 #
18819 #
18820 #
18821
18822 #
18823 # Edit comments
18824 #
18825
18826 !! test
18827 Edit comment with link
18828 !! options
18829 comment
18830 !! wikitext
18831 I like the [[Main Page]] a lot
18832 !! html
18833 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
18834 !!end
18835
18836 !! test
18837 Edit comment with link and link text
18838 !! options
18839 comment
18840 !! wikitext
18841 I like the [[Main Page|best pages]] a lot
18842 !! html
18843 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
18844 !!end
18845
18846 !! test
18847 Edit comment with link and link text with suffix
18848 !! options
18849 comment
18850 !! wikitext
18851 I like the [[Main Page|best page]]s a lot
18852 !! html
18853 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
18854 !!end
18855
18856 !! test
18857 Edit comment with section link (non-local, eg in history list)
18858 !! options
18859 comment title=[[Main Page]]
18860 !! wikitext
18861 /* External links */ removed bogus entries
18862 !! html
18863 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
18864 !!end
18865
18866 !! test
18867 Edit comment with section link and text before it (non-local, eg in history list)
18868 !! options
18869 comment title=[[Main Page]]
18870 !! wikitext
18871 pre-comment text /* External links */ removed bogus entries
18872 !! html
18873 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>
18874 !!end
18875
18876 !! test
18877 Edit comment with section link (local, eg in diff view)
18878 !! options
18879 comment local title=[[Main Page]]
18880 !! wikitext
18881 /* External links */ removed bogus entries
18882 !! html
18883 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
18884 !!end
18885
18886 !! test
18887 Edit comment with subpage link (bug 14080)
18888 !! options
18889 comment
18890 subpage
18891 title=[[Subpage test]]
18892 !! wikitext
18893 Poked at a [[/subpage]] here...
18894 !! html
18895 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
18896 !!end
18897
18898 !! test
18899 Edit comment with subpage link and link text (bug 14080)
18900 !! options
18901 comment
18902 subpage
18903 title=[[Subpage test]]
18904 !! wikitext
18905 Poked at a [[/subpage|neat little page]] here...
18906 !! html
18907 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
18908 !!end
18909
18910 !! test
18911 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
18912 !! options
18913 comment
18914 title=[[Subpage test]]
18915 !! wikitext
18916 Poked at a [[/subpage]] here...
18917 !! html
18918 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...
18919 !!end
18920
18921 !! test
18922 Edit comment with bare anchor link (local, as on diff)
18923 !! options
18924 comment
18925 local
18926 title=[[Main Page]]
18927 !! wikitext
18928 [[#section]]
18929 !! html
18930 <a href="#section">#section</a>
18931 !! end
18932
18933 !! test
18934 Edit comment with bare anchor link (non-local, as on history)
18935 !! options
18936 comment
18937 title=[[Main Page]]
18938 !! wikitext
18939 [[#section]]
18940 !! html
18941 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
18942 !! end
18943
18944 !! test
18945 Anchor starting with underscore
18946 !! wikitext
18947 [[#_ref|One]]
18948 !! html
18949 <p><a href="#_ref">One</a>
18950 </p>
18951 !! end
18952
18953 !! test
18954 Id starting with underscore
18955 !! wikitext
18956 <div id="_ref"></div>
18957 !! html
18958 <div id="_ref"></div>
18959
18960 !! end
18961
18962 !! test
18963 Space normalisation on autocomment (bug 22784)
18964 !! options
18965 comment
18966 title=[[Main Page]]
18967 !! wikitext
18968 /* __hello__world__ */
18969 !! html
18970 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
18971 !! end
18972
18973 !! test
18974 percent-encoding and + signs in comments (Bug 26410)
18975 !! options
18976 comment
18977 !! wikitext
18978 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
18979 !! html
18980 <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>
18981 !! end
18982
18983 # Parsoid doesn't support this yet: see bug 73581
18984 # but it *should* omit the 'src' attribute if the image is bad.
18985 # PHP side of tests was disabled in
18986 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
18987 # because of issues in the PHP parserTests infrastructure
18988 # (but the output below is indeed what the PHP side emits)
18989 !! test
18990 Bad images - basic functionality
18991 !! wikitext
18992 [[File:Bad.jpg]]
18993 !! DISABLED/html/php
18994 !! html/parsoid
18995 <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>
18996 !! end
18997
18998 !! test
18999 Bad images - bug 16039: text after bad image disappears
19000 !! wikitext
19001 Foo bar
19002 [[File:Bad.jpg]]
19003 Bar foo
19004 !! DISABLED/html/php
19005 <p>Foo bar
19006 </p><p>Bar foo
19007 </p>
19008 !! html/parsoid
19009 <p>Foo bar
19010 <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>
19011 Bar foo</p>
19012 !! end
19013
19014 !! test
19015 Verify that displaytitle works (bug #22501) no displaytitle
19016 !! options
19017 showtitle
19018 !! config
19019 wgAllowDisplayTitle=true
19020 wgRestrictDisplayTitle=false
19021 !! wikitext
19022 this is not the the title
19023 !! html
19024 Parser test
19025 <p>this is not the the title
19026 </p>
19027 !! end
19028
19029 !! test
19030 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
19031 !! options
19032 showtitle
19033 title=[[Screen]]
19034 !! config
19035 wgAllowDisplayTitle=true
19036 wgRestrictDisplayTitle=false
19037 !! wikitext
19038 this is not the the title
19039 {{DISPLAYTITLE:whatever}}
19040 !! html
19041 whatever
19042 <p>this is not the the title
19043 </p>
19044 !! end
19045
19046 !! test
19047 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
19048 !! options
19049 showtitle
19050 title=[[Screen]]
19051 !! config
19052 wgAllowDisplayTitle=true
19053 wgRestrictDisplayTitle=true
19054 !! wikitext
19055 this is not the the title
19056 {{DISPLAYTITLE:whatever}}
19057 !! html
19058 Screen
19059 <p>this is not the the title
19060 </p>
19061 !! end
19062
19063 !! test
19064 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
19065 !! options
19066 showtitle
19067 title=[[Screen]]
19068 !! config
19069 wgAllowDisplayTitle=true
19070 wgRestrictDisplayTitle=true
19071 !! wikitext
19072 this is not the the title
19073 {{DISPLAYTITLE:screen}}
19074 !! html
19075 screen
19076 <p>this is not the the title
19077 </p>
19078 !! end
19079
19080 !! test
19081 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
19082 !! options
19083 showtitle
19084 title=[[Screen]]
19085 !! config
19086 wgAllowDisplayTitle=false
19087 !! wikitext
19088 this is not the the title
19089 {{DISPLAYTITLE:screen}}
19090 !! html
19091 Screen
19092 <p>this is not the the title
19093 <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>
19094 </p>
19095 !! end
19096
19097 !! test
19098 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
19099 !! options
19100 showtitle
19101 title=[[Screen]]
19102 !! config
19103 wgAllowDisplayTitle=false
19104 !! wikitext
19105 this is not the the title
19106 !! html
19107 Screen
19108 <p>this is not the the title
19109 </p>
19110 !! end
19111
19112 !! test
19113 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
19114 !! options
19115 showtitle
19116 title=[[Screen]]
19117 !! config
19118 wgAllowDisplayTitle=true
19119 wgRestrictDisplayTitle=true
19120 !! wikitext
19121 this is not the the title
19122 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
19123 !! html
19124 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
19125 <p>this is not the the title
19126 </p>
19127 !! end
19128
19129 !! test
19130 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
19131 !! options
19132 showtitle
19133 title=[[Screen]]
19134 !! config
19135 wgAllowDisplayTitle=true
19136 wgRestrictDisplayTitle=true
19137 !! wikitext
19138 this is not the the title
19139 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
19140 !! html
19141 <span style="color: red;">s</span>creen
19142 <p>this is not the the title
19143 </p>
19144 !! end
19145
19146 !! test
19147 preload: check <noinclude> and <includeonly>
19148 !! options
19149 preload
19150 !! wikitext
19151 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
19152 !! html
19153 Hello kind world.
19154 !! end
19155
19156 !! test
19157 preload: check <onlyinclude>
19158 !! options
19159 preload
19160 !! wikitext
19161 Goodbye <onlyinclude>Hello world</onlyinclude>
19162 !! html
19163 Hello world
19164 !! end
19165
19166 !! test
19167 preload: can pass tags through if we want to
19168 !! options
19169 preload
19170 !! wikitext
19171 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
19172 !! html
19173 <includeonly>Hello world</includeonly>
19174 !! end
19175
19176 !! test
19177 preload: check that it doesn't try to do tricks
19178 !! options
19179 preload
19180 !! wikitext
19181 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
19182 !! html
19183 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
19184 !! end
19185
19186 !! test
19187 Play a bit with r67090 and bug 3158
19188 !! wikitext
19189 <div style="width:50% !important">&nbsp;</div>
19190 <div style="width:50%&nbsp;!important">&nbsp;</div>
19191 <div style="width:50%&#160;!important">&nbsp;</div>
19192 <div style="border : solid;">&nbsp;</div>
19193 !! html/php
19194 <div style="width:50% !important">&#160;</div>
19195 <div style="width:50% !important">&#160;</div>
19196 <div style="width:50% !important">&#160;</div>
19197 <div style="border&#160;: solid;">&#160;</div>
19198
19199 !! html/parsoid
19200 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
19201 <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>
19202 <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>
19203 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
19204
19205 !! end
19206
19207 !! test
19208 HTML5 data attributes
19209 !! wikitext
19210 <span data-foo="bar">Baz</span>
19211 <p data-abc-def_hij="">Quuz</p>
19212 !! html
19213 <p><span data-foo="bar">Baz</span>
19214 </p>
19215 <p data-abc-def_hij="">Quuz</p>
19216
19217 !! end
19218
19219 !! test
19220 percent-encoding and + signs in internal links (Bug 26410)
19221 !! wikitext
19222 [[User:+%]] [[Page+title%]]
19223 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
19224 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
19225 [[%33%45]] [[%33%45+]]
19226 !! html/php
19227 <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>
19228 <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>
19229 <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>
19230 <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>
19231 </p>
19232 !! html/parsoid
19233 <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>
19234 !! end
19235
19236 !! test
19237 Special characters in embedded file links (bug 27679)
19238 !! wikitext
19239 [[File:Contains & ampersand.jpg]]
19240 [[File:Does not exist.jpg|Title with & ampersand]]
19241 !! html/php
19242 <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>
19243 <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>
19244 </p>
19245 !! html/parsoid
19246 <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>
19247 <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>
19248 !! end
19249
19250 !! test
19251 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
19252 !! wikitext
19253 Text&apos;s been normalized?
19254 !! html
19255 <p>Text&#39;s been normalized?
19256 </p>
19257 !! end
19258
19259 !! test
19260 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
19261 !! wikitext
19262 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
19263 !! html
19264 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
19265 </p>
19266 !! end
19267
19268 !! test
19269 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
19270 !! wikitext
19271 [http://www.example.org/ ideograms]
19272 !! html
19273 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
19274 </p>
19275 !! end
19276
19277 !! test
19278 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
19279 !! wikitext
19280 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
19281 !! html
19282 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
19283 </p>
19284 !! end
19285
19286 !! article
19287 Mediawiki:loop1
19288 !! text
19289 {{Identical|A}}
19290 !! endarticle
19291
19292 !! article
19293 Mediawiki:loop2
19294 !! text
19295 {{Identical|B}}
19296 !! endarticle
19297
19298 !! article
19299 Template:Identical
19300 !! text
19301 {{int:loop1}}
19302 {{int:loop2}}
19303 !! endarticle
19304
19305 !! test
19306 Bug 31098 Template which includes system messages which includes the template
19307 !! wikitext
19308 {{Identical}}
19309 !! html
19310 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
19311 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
19312 </p>
19313 !! end
19314
19315 !! test
19316 Bug31490 Turkish: ucfirst 'blah'
19317 !! options
19318 language=tr
19319 !! wikitext
19320 {{ucfirst:blah}}
19321 !! html
19322 <p>Blah
19323 </p>
19324 !! end
19325
19326 !! test
19327 Bug31490 Turkish: ucfirst 'ix'
19328 !! options
19329 language=tr
19330 !! wikitext
19331 {{ucfirst:ix}}
19332 !! html
19333 <p>İx
19334 </p>
19335 !! end
19336
19337 !! test
19338 Bug31490 Turkish: lcfirst 'BLAH'
19339 !! options
19340 language=tr
19341 !! wikitext
19342 {{lcfirst:BLAH}}
19343 !! html
19344 <p>bLAH
19345 </p>
19346 !! end
19347
19348 !! test
19349 Bug31490 Turkish: ucfırst (with a dotless i)
19350 !! options
19351 language=tr
19352 !! wikitext
19353 {{ucfırst:blah}}
19354 !! html
19355 <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>
19356 </p>
19357 !! end
19358
19359 !! test
19360 Bug31490 ucfırst (with a dotless i) with English language
19361 !! options
19362 language=en
19363 !! wikitext
19364 {{ucfırst:blah}}
19365 !! html
19366 <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>
19367 </p>
19368 !! end
19369
19370 !! test
19371 Bug 26375: TOC with italics
19372 !! options
19373 title=[[Main Page]]
19374 !! wikitext
19375 __TOC__
19376 == ''Lost'' episodes ==
19377 !! html
19378 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19379 <ul>
19380 <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>
19381 </ul>
19382 </div>
19383
19384 <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>
19385
19386 !! end
19387
19388 !! test
19389 Bug 26375: TOC with bold
19390 !! options
19391 title=[[Main Page]]
19392 !! wikitext
19393 __TOC__
19394 == '''should be bold''' then normal text ==
19395 !! html
19396 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19397 <ul>
19398 <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>
19399 </ul>
19400 </div>
19401
19402 <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>
19403
19404 !! end
19405
19406 !! test
19407 Bug 33845: Headings become cursive in TOC when they contain an image
19408 !! options
19409 title=[[Main Page]]
19410 !! wikitext
19411 __TOC__
19412 == Image [[Image:foobar.jpg]] ==
19413 !! html
19414 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19415 <ul>
19416 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
19417 </ul>
19418 </div>
19419
19420 <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>
19421
19422 !! end
19423
19424 !! test
19425 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
19426 !! options
19427 title=[[Main Page]]
19428 !! wikitext
19429 __TOC__
19430 == <blockquote>Quote</blockquote> ==
19431 !! html
19432 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19433 <ul>
19434 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
19435 </ul>
19436 </div>
19437
19438 <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>
19439
19440 !! html+tidy
19441 <p></p>
19442 <div id="toc" class="toc">
19443 <div id="toctitle">
19444 <h2>Contents</h2>
19445 </div>
19446 <ul>
19447 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
19448 </ul>
19449 </div>
19450 <p></p>
19451 <h2><span class="mw-headline" id="Quote"></span></h2>
19452 <blockquote>
19453 <p><span class="mw-headline" id="Quote">Quote</span></p>
19454 </blockquote>
19455 <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>
19456 !! end
19457
19458 !! test
19459 Unclosed tags in TOC
19460 !! options
19461 title=[[Main Page]]
19462 !! wikitext
19463 __TOC__
19464 == Proof: 2 < 3 ==
19465 <small>Hanc marginis exiguitas non caperet.</small>
19466 QED
19467 !! html
19468 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19469 <ul>
19470 <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>
19471 </ul>
19472 </div>
19473
19474 <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>
19475 <p><small>Hanc marginis exiguitas non caperet.</small>
19476 QED
19477 </p>
19478 !! end
19479
19480 !! test
19481 Multiple tags in TOC
19482 !! wikitext
19483 __TOC__
19484 == <i>Foo</i> <b>Bar</b> ==
19485
19486 == <i>Foo</i> <blockquote>Bar</blockquote> ==
19487 !! html
19488 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19489 <ul>
19490 <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>
19491 <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>
19492 </ul>
19493 </div>
19494
19495 <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>
19496 <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>
19497
19498 !! html+tidy
19499 <p></p>
19500 <div id="toc" class="toc">
19501 <div id="toctitle">
19502 <h2>Contents</h2>
19503 </div>
19504 <ul>
19505 <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>
19506 <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>
19507 </ul>
19508 </div>
19509 <p></p>
19510 <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>
19511 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
19512 <blockquote>
19513 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
19514 </blockquote>
19515 <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>
19516 !! end
19517
19518 !! test
19519 Tags with parameters in TOC
19520 !! wikitext
19521 __TOC__
19522 == <sup class="in-h2">Hello</sup> ==
19523
19524 == <sup class="a > b">Evilbye</sup> ==
19525 !! html
19526 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19527 <ul>
19528 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
19529 <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>
19530 </ul>
19531 </div>
19532
19533 <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>
19534 <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;>Evilbye">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
19535
19536 !! end
19537
19538 !! test
19539 span tags with directionality in TOC
19540 !! wikitext
19541 __TOC__
19542 == <span dir="ltr">C++</span> ==
19543
19544 == <span dir="rtl">זבנג!</span> ==
19545
19546 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
19547
19548 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
19549
19550 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
19551 !! html
19552 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19553 <ul>
19554 <li class="toclevel-1 tocsection-1"><a href="#C.2B.2B"><span class="tocnumber">1</span> <span class="toctext"><span dir="ltr">C++</span></span></a></li>
19555 <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>
19556 <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>
19557 <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>
19558 <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>
19559 </ul>
19560 </div>
19561
19562 <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>
19563 <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>
19564 <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>
19565 <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>
19566 <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>
19567
19568 !! end
19569
19570 !! test
19571 Bug 72884: bdi element in ToC
19572 !! wikitext
19573 __TOC__
19574 == <bdi>test</bdi> ==
19575 !! html
19576 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19577 <ul>
19578 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
19579 </ul>
19580 </div>
19581
19582 <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>
19583
19584 !! end
19585
19586 # Note that the html output does not have the <p></p>, but the
19587 # html+tidy output *does*. This is because the empty <p></p> is
19588 # removed by the sanitizer, but only when tidy is *not* enabled (!).
19589 !! test
19590 Empty <p> tag in TOC, removed by Sanitizer (T92892)
19591 !! wikitext
19592 __TOC__
19593 == x ==
19594 !! html
19595 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19596 <ul>
19597 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
19598 </ul>
19599 </div>
19600
19601 <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>
19602
19603 !! html+tidy
19604 <p></p>
19605 <div id="toc" class="toc">
19606 <div id="toctitle">
19607 <h2>Contents</h2>
19608 </div>
19609 <ul>
19610 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
19611 </ul>
19612 </div>
19613 <p></p>
19614 <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>
19615 !! end
19616
19617 !! article
19618 MediaWiki:Bug32057
19619 !! text
19620 == {{int:headline_sample}} ==
19621 !! endarticle
19622
19623 !! test
19624 Bug 32057: Title needed when expanding <h> nodes.
19625 !! options
19626 title=[[Main Page]]
19627 !! wikitext
19628 {{int:Bug32057}}
19629 !! html
19630 <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>
19631
19632 !! end
19633
19634 !! test
19635 Strip marker in urlencode
19636 !! wikitext
19637 {{urlencode:x<nowiki/>y}}
19638 {{urlencode:x<nowiki/>y|wiki}}
19639 {{urlencode:x<nowiki/>y|path}}
19640 !! html
19641 <p>xy
19642 xy
19643 xy
19644 </p>
19645 !! end
19646
19647 !! test
19648 Strip marker in lc
19649 !! wikitext
19650 {{lc:x<nowiki/>y}}
19651 !! html
19652 <p>xy
19653 </p>
19654 !! end
19655
19656 !! test
19657 Strip marker in uc
19658 !! wikitext
19659 {{uc:x<nowiki/>y}}
19660 !! html
19661 <p>XY
19662 </p>
19663 !! end
19664
19665 !! test
19666 Strip marker in formatNum
19667 !! wikitext
19668 {{formatnum:1<nowiki/>2}}
19669 {{formatnum:1<nowiki/>2|R}}
19670 !! html
19671 <p>12
19672 12
19673 </p>
19674 !! end
19675
19676 !! test
19677 Check noCommafy in formatNum
19678 !! options
19679 language=be-tarask
19680 !! wikitext
19681 {{formatnum:123456.78}}
19682 {{formatnum:123456.78|NOSEP}}
19683 !! html
19684 <p>123 456,78
19685 123456.78
19686 </p>
19687 !! end
19688
19689 !! test
19690 Wrong option for formatNum (bug 56199)
19691 !! wikitext
19692 {{formatnum:1,234.56|Random}}
19693 {{formatnum:1,234.56|EVERYTHING}}
19694 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
19695 !! html
19696 <p>1,234.56
19697 1,234.56
19698 1,234.56
19699 </p>
19700 !! end
19701
19702 !! test
19703 Strip marker in grammar
19704 !! options
19705 language=fi
19706 !! wikitext
19707 {{grammar:elative|foo<nowiki/>bar}}
19708 !! html
19709 <p>foobarista
19710 </p>
19711 !! end
19712
19713 !! test
19714 Strip marker in padleft
19715 !! wikitext
19716 {{padleft:|2|x<nowiki/>y}}
19717 !! html
19718 <p>xy
19719 </p>
19720 !! end
19721
19722 !! test
19723 Strip marker in padright
19724 !! wikitext
19725 {{padright:|2|x<nowiki/>y}}
19726 !! html
19727 <p>xy
19728 </p>
19729 !! end
19730
19731 !! test
19732 Strip marker in anchorencode
19733 !! wikitext
19734 {{anchorencode:x<nowiki/>y}}
19735 !! html
19736 <p>xy
19737 </p>
19738 !! end
19739
19740 !! test
19741 nowiki inside link inside heading (bug 18295)
19742 !! wikitext
19743 ==[[foo|x<nowiki>y</nowiki>z]]==
19744 !! html
19745 <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>
19746
19747 !! end
19748
19749 !! test
19750 new support for bdi element (bug 31817)
19751 !! wikitext
19752 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
19753 !! html
19754 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
19755
19756 !!end
19757
19758 !! test
19759 Ignore pipe between table row attributes
19760 !! wikitext
19761 {|
19762 | quux
19763 |- id=foo | style='color: red'
19764 | bar
19765 |}
19766 !! html
19767 <table>
19768 <tr>
19769 <td> quux
19770 </td></tr>
19771 <tr id="foo" style="color: red">
19772 <td> bar
19773 </td></tr></table>
19774
19775 !! end
19776
19777 !!test
19778 Gallery override link with WikiLink (bug 34852)
19779 !! wikitext
19780 <gallery>
19781 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
19782 </gallery>
19783 !! html
19784 <ul class="gallery mw-gallery-traditional">
19785 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19786 <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>
19787 <div class="gallerytext">
19788 <p>caption
19789 </p>
19790 </div>
19791 </div></li>
19792 </ul>
19793
19794 !! end
19795
19796 !!test
19797 Gallery override link with absolute external link (bug 34852)
19798 !! wikitext
19799 <gallery>
19800 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
19801 </gallery>
19802 !! html
19803 <ul class="gallery mw-gallery-traditional">
19804 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19805 <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>
19806 <div class="gallerytext">
19807 <p>caption
19808 </p>
19809 </div>
19810 </div></li>
19811 </ul>
19812
19813 !! end
19814
19815 !!test
19816 Gallery override link with malicious javascript (bug 34852)
19817 !! wikitext
19818 <gallery>
19819 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
19820 </gallery>
19821 !! html
19822 <ul class="gallery mw-gallery-traditional">
19823 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19824 <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>
19825 <div class="gallerytext">
19826 <p>caption
19827 </p>
19828 </div>
19829 </div></li>
19830 </ul>
19831
19832 !! end
19833
19834 !!test
19835 Gallery with invalid title as link (bug 43964)
19836 !! wikitext
19837 <gallery>
19838 File:foobar.jpg|link=<
19839 </gallery>
19840 !! html
19841 <ul class="gallery mw-gallery-traditional">
19842 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19843 <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>
19844 <div class="gallerytext">
19845 </div>
19846 </div></li>
19847 </ul>
19848
19849 !! end
19850
19851 !!test
19852 Language parser function
19853 !! wikitext
19854 {{#language:ar}}
19855 !! html
19856 <p>العربية
19857 </p>
19858 !! end
19859
19860 !!test
19861 Padleft and padright as substr
19862 !! wikitext
19863 {{padleft:|3|abcde}}
19864 {{padright:|3|abcde}}
19865 !! html
19866 <p>abc
19867 abc
19868 </p>
19869 !! end
19870
19871 !!test
19872 Special parser function
19873 !! wikitext
19874 {{#special:RandomPage}}
19875 {{#special:BaDtItLe}}
19876 {{#special:Foobar}}
19877 !! html
19878 <p>Special:Random
19879 Special:Badtitle
19880 Special:Foobar
19881 </p>
19882 !! end
19883
19884 !!test
19885 Bug 34939 - Case insensitive link parsing ([HttP://])
19886 !! wikitext
19887 [HttP://MediaWiki.Org/]
19888 !! html/php
19889 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
19890 </p>
19891 !! html/parsoid
19892 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
19893 !! end
19894
19895 !!test
19896 Bug 34939 - Case insensitive link parsing ([HttP:// title])
19897 !! wikitext
19898 [HttP://MediaWiki.Org/ MediaWiki]
19899 !! html
19900 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
19901 </p>
19902 !! end
19903
19904 !!test
19905 Bug 34939 - Case insensitive link parsing (HttP://)
19906 !! wikitext
19907 HttP://MediaWiki.Org/
19908 !! html/php
19909 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
19910 </p>
19911 !! html/parsoid
19912 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
19913 !! end
19914
19915 !!test
19916 Disable TOC
19917 !! options
19918 notoc
19919 !! wikitext
19920 Lead
19921 == Section 1 ==
19922 == Section 2 ==
19923 == Section 3 ==
19924 == Section 4 ==
19925 == Section 5 ==
19926 !! html
19927 <p>Lead
19928 </p>
19929
19930 <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>
19931 <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>
19932 <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>
19933 <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>
19934 <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>
19935
19936 !! end
19937
19938
19939 ###
19940 ### Parsoid-specific tests
19941 ### Parsoid-PHP parser incompatibilities
19942 ###
19943 !!test
19944 1. SOL-sensitive wikitext tokens as template-args
19945 !!options
19946 parsoid=wt2html,wt2wt
19947 !! wikitext
19948 {{echo|*a}}
19949 {{echo|#a}}
19950 {{echo|:a}}
19951 !! html
19952 <span about="#mwt1" typeof="mw:Transclusion">
19953 </span><ul about="#mwt1"><li>a</li>
19954 </ul>
19955 <span about="#mwt2" typeof="mw:Transclusion">
19956 </span><ol about="#mwt2"><li>a</li>
19957 </ol>
19958 <span about="#mwt3" typeof="mw:Transclusion">
19959 </span><dl about="#mwt3"><dd>a</dd>
19960 </dl>
19961 !!end
19962
19963 #### -----------------------------------------------------------------
19964 #### Parsoid-specific functionality tests
19965 #### -----------------------------------------------------------------
19966
19967 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
19968 # We know wt2wt will fail, but we expect selser to pass.
19969 # Due to the nature of our testing, wt2wt and selser tests will enter the
19970 # blacklist and we'll catch selser regressions based on changes to the
19971 # blacklist entries for selser tests.
19972 !! test
19973 1. Bad treebuilder fixup of formatting elt is cleaned up
19974 !! options
19975 parsoid=wt2html,wt2wt
19976 !! wikitext
19977 {|
19978 |
19979 <small>
19980 [[Image:Foobar.jpg|right|Test]]
19981 </small>
19982 |}
19983 !! html/parsoid
19984 <table>
19985 <tbody><tr><td>
19986 <small>
19987 <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" height="220" width="1941"></a><figcaption>Test</figcaption></figure>
19988 </small>
19989 </td></tr>
19990 </tbody></table>
19991 !! end
19992
19993 !! test
19994 2. Bad treebuilder fixup of formatting elt is cleaned up
19995 !! options
19996 parsoid=wt2html,wt2wt
19997 !! wikitext
19998 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
19999
20000 <small>[[Image:Foobar.jpg|right|300px]]</small>
20001 !! html/parsoid
20002 <p><b>foo</b></p>
20003 <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" height="25" width="220"/></a><figcaption><b>caption</b></figcaption></figure>
20004 <p><b>bar</b></p>
20005 <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" height="34" width="300"/></a></figure></small>
20006 !! end
20007
20008 #### ----------------------------------------------------------------
20009 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
20010 #### tags. Parsoid's output for these tags differs from that of the
20011 #### PHP parser.
20012 #### ----------------------------------------------------------------
20013
20014 !!test
20015 Ref: 1. ref-location should be replaced with an index span
20016 !!options
20017 parsoid
20018 !! wikitext
20019 A <ref>foo</ref>
20020 B <ref name="x">foo</ref>
20021 C <ref name="y" />
20022 <references />
20023 !! html
20024 <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>
20025 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>
20026 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>
20027 <ol class="references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
20028 <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>
20029 <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>
20030 <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>
20031 </ol>
20032 !!end
20033
20034 !!test
20035 Ref: 2. ref-tags with identical names should all get the same index
20036 !!options
20037 parsoid
20038 !! wikitext
20039 A <ref name="x">foo</ref>
20040 B <ref name="x" />
20041 <references />
20042 !! html
20043 <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>
20044 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>
20045 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
20046 <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>
20047 </ol>
20048 !!end
20049
20050 !!test
20051 Ref: 3. spaces in ref-names should be ignored
20052 !!options
20053 parsoid
20054 !! wikitext
20055 A <ref name="x">foo</ref>
20056 B <ref name=" x " />
20057 C <ref name= x />
20058 <references />
20059 !! html
20060 <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>
20061 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>
20062 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>
20063 <ol class="references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
20064 <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>
20065 </ol>
20066 !!end
20067
20068 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
20069 !!test
20070 Ref: 4. 'constructor' should be accepted as a valid ref-name
20071 !!options
20072 parsoid
20073 !! wikitext
20074 A <ref name="constructor">foo</ref>
20075 <references />
20076 !! html
20077 <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>
20078 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20079 <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>
20080 </ol>
20081 !!end
20082
20083 !!test
20084 Ref: 5. body should accept generic wikitext
20085 !!options
20086 parsoid
20087 !! wikitext
20088 A <ref>
20089 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
20090 </ref>
20091
20092 <references />
20093 !! html
20094 <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>
20095
20096 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
20097 <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>
20098 </span></li>
20099 </ol>
20100 !!end
20101
20102 !!test
20103 Ref: 6. indent-pres should not be output in ref-body
20104 !!options
20105 parsoid
20106 !! wikitext
20107 A <ref>
20108 foo
20109 bar
20110 baz
20111 </ref>
20112
20113 <references />
20114 !! html
20115 <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>
20116
20117 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20118 <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
20119 bar
20120 baz
20121 </span></li>
20122 </ol>
20123 !!end
20124
20125 !!test
20126 Ref: 7. No p-wrapping in ref-body
20127 !!options
20128 parsoid
20129 !! wikitext
20130 A <ref>
20131 foo
20132
20133 bar
20134
20135
20136 baz
20137
20138
20139
20140 booz
20141 </ref>
20142
20143 <references />
20144 !! html
20145 <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>
20146
20147 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20148 <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
20149
20150 bar
20151
20152
20153 baz
20154
20155
20156
20157 booz
20158 </span></li>
20159 </ol>
20160 !!end
20161
20162 !!test
20163 Ref: 8. transclusion wikitext has lower precedence
20164 !!options
20165 parsoid
20166 !! wikitext
20167 A <ref> foo {{echo|</ref> B C}}
20168
20169 <references />
20170 !! html
20171 <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>
20172 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20173 <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>
20174 </ol>
20175 !!end
20176
20177 !!test
20178 Ref: 9. unclosed comments should not leak out of ref-body
20179 !!options
20180 parsoid
20181 !! wikitext
20182 A <ref> foo <!--</ref> B C
20183 <references />
20184 !! html
20185 <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>
20186 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20187 <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>
20188 </ol>
20189 !!end
20190
20191 !!test
20192 Ref: 10. Unclosed HTML tags should not leak out of ref-body
20193 !!options
20194 parsoid
20195 !! wikitext
20196 A <ref> <b> foo </ref> B C
20197
20198 <references />
20199 !! html
20200 <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>
20201
20202
20203 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20204 <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>
20205 </ol>
20206 !!end
20207
20208 !!test
20209 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
20210 !!options
20211 parsoid
20212 !! wikitext
20213 A <ref>foo</ref> B
20214 C <ref>bar</ref> D
20215 <references />
20216 !! html
20217 <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
20218 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>
20219 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
20220 <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>
20221 <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>
20222 </ol>
20223 !!end
20224
20225 !!test
20226 Ref: 12. ref-tags act as trailing newline migration barrier
20227 !!options
20228 parsoid
20229 !! wikitext
20230 <!--the newline at the end of this line moves out of the p-tag-->a
20231
20232 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
20233 <ref />
20234
20235 c
20236 <references />
20237 !! html
20238 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
20239
20240
20241 <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>
20242 <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>
20243
20244 <p>c</p>
20245 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
20246 <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>
20247 <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>
20248 !!end
20249
20250 !!test
20251 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
20252 !!options
20253 parsoid
20254 !! wikitext
20255 <ref>foo</ref> A
20256 <ref>bar
20257 </ref> B
20258 <references />
20259 !! html
20260 <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
20261 <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>
20262 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
20263 <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>
20264 <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
20265 </span></li>
20266 </ol>
20267 !!end
20268
20269 !!test
20270 Ref: 14. A nested ref-tag should be emitted as plain text
20271 !!options
20272 parsoid
20273 !! wikitext
20274 <ref>foo <ref>bar</ref> baz</ref>
20275
20276 <references />
20277 !! html
20278 <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>
20279 </p>
20280 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
20281 <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>
20282 </ol>
20283 !!end
20284
20285 !!test
20286 Ref: 15. ref-tags with identical names should get identical indexes
20287 !!options
20288 parsoid
20289 !! wikitext
20290 A1 <ref name="a">foo</ref> A2 <ref name="a" />
20291 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
20292
20293 <references />
20294 !! html
20295 <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>
20296 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>
20297
20298 <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>
20299 </ol>
20300 !!end
20301
20302 ## We don't bother wt2wt-ing non-standard whitespace
20303 !!test
20304 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
20305 !!options
20306 parsoid=wt2html
20307 !! wikitext
20308 A <ref >foo</ref >
20309
20310 <references />
20311 !! html
20312 <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>
20313 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20314 <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>
20315 !!end
20316
20317 !!test
20318 Ref: 17. Generate valid HTML5 id/about attributes
20319 !!options
20320 parsoid
20321 !!wikitext
20322 <ref name="a b">foo</ref>
20323
20324 <references />
20325 !!html
20326 <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>
20327 </p>
20328
20329 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20330 <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>
20331 </ol>
20332 !!end
20333
20334 !!test
20335 Ref: 18. T58916: Extension attributes should be parsed as plain text
20336 !!options
20337 parsoid
20338 !!wikitext
20339 <ref name="{{echo|a}}">foo</ref>
20340
20341 <references />
20342 !!html
20343 <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>
20344 </p>
20345
20346 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20347 <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>
20348 </ol>
20349 !!end
20350
20351 !!test
20352 Ref: 19. ref-tags with identical name encodings should get identical indexes
20353 !!options
20354 parsoid
20355 !! wikitext
20356 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
20357
20358 <references />
20359 !! html
20360 <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>
20361 </p>
20362 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
20363 <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>
20364 </ol>
20365 !!end
20366
20367 !!test
20368 Ref: 20. ref-tags with identical names but different content should keep it
20369 !!options
20370 parsoid
20371 !! wikitext
20372 A <ref name="foo">Foo one</ref>
20373 B <ref name="foo">Foo two</ref>
20374 C <ref name="foo" />
20375
20376 <references />
20377 !! html
20378 <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>
20379 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>
20380 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>
20381
20382 <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>
20383 </ol>
20384 !!end
20385
20386 !!test
20387 References: 1. references tag without any refs should be handled properly
20388 !!options
20389 parsoid
20390 !! wikitext
20391 <references />
20392 !! html
20393 <ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
20394 !!end
20395
20396 !!test
20397 References: 2. references tag with group only outputs references from that group
20398 !!options
20399 parsoid
20400 !! wikitext
20401 A <ref group="a">foo</ref>
20402 B <ref group="b">bar</ref>
20403 C <ref>baz</ref>
20404
20405 <references group="a" />
20406 <references />
20407 <references group="b" />
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":{"group":"a"}}'><a href="#cite_note-1">[a 1]</a></span>
20410 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>
20411 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>
20412
20413 <ol class="references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{"group":"a"}}'>
20414 <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>
20415 </ol>
20416 <ol class="references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'>
20417 <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>
20418 </ol>
20419 <ol class="references" typeof="mw:Extension/references" about="#mwt12" data-mw='{"name":"references","attrs":{"group":"b"}}'>
20420 <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>
20421 </ol>
20422 !!end
20423
20424 !!test
20425 References: 3. ref list should be cleared after processing references
20426 !!options
20427 parsoid
20428 !! wikitext
20429 A <ref>foo</ref>
20430
20431 <references />
20432
20433 B <ref>bar</ref>
20434
20435 <references />
20436 !! html
20437 <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>
20438
20439 <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>
20440 </ol>
20441
20442 <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>
20443
20444 <ol class="references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
20445 <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>
20446 </ol>
20447 !!end
20448
20449 !!test
20450 References: 4. only referenced group should be cleared after processing references
20451 !!options
20452 parsoid
20453 !! wikitext
20454 A <ref group="a">afoo</ref>
20455 B <ref>bfoo</ref>
20456
20457 <references group="a" />
20458
20459 C <ref>cfoo</ref>
20460
20461 <references />
20462 !! html
20463 <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>
20464 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>
20465
20466 <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>
20467 </ol>
20468
20469 <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>
20470
20471 <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>
20472 </ol>
20473 !!end
20474
20475 !!test
20476 References: 5. ref tags in references should be processed while ignoring all other content
20477 !!options
20478 parsoid
20479 !! wikitext
20480 A <ref name="a" />
20481 B <ref name="b">bar</ref>
20482
20483 <references>
20484 <ref name="a">foo</ref>
20485 This should just get lost.
20486 </references>
20487 !! html
20488 <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>
20489 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>
20490
20491
20492 <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>
20493 </ol>
20494 !!end
20495
20496 !!test
20497 References: 6. <references /> from a transclusion
20498 !!options
20499 parsoid
20500 !! wikitext
20501 <ref>Foo</ref> {{echo|<references />}}
20502 !! html
20503 <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>
20504 </ol>
20505 !!end
20506
20507 !! test
20508 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
20509 !! options
20510 parsoid
20511 !! wikitext
20512 A <ref>foo bar for a</ref>
20513 B <ref group="X" name="b" />
20514
20515 <references />
20516
20517 <references group="X">
20518 <ref name="b">foo</ref>
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>
20522 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>
20523 </p>
20524
20525 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
20526 <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>
20527 </ol>
20528
20529 <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"}}'>
20530 <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>
20531 </ol>
20532 !! end
20533
20534 !! test
20535 References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
20536 !! options
20537 parsoid
20538 !! wikitext
20539 X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
20540 <references />
20541 !! html
20542 <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>
20543 <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>
20544 </ol>
20545 !!end
20546
20547 # This test only works in wt2html now as the <references /> are always generated
20548 # unless selser is active. Once T72722 is fixed, we should add a changes test
20549 # here to ensure that unrelated changes don't add the new <references /> in
20550 # wt2wt.
20551 !! test
20552 References: 9. Generate missing references list at the end
20553 !! options
20554 parsoid
20555 !! wikitext
20556 A <ref>foo</ref>
20557 B <ref group="inexistent">bar</ref>
20558 !! html
20559 <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>
20560 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
20561 <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>
20562 </ol>
20563 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{"group":"inexistent"}}'>
20564 <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>
20565 </ol>
20566 !! end
20567
20568 !! test
20569 Entities in ref name
20570 !! options
20571 parsoid
20572 !! wikitext
20573 <ref name="test &amp; me">hi</ref>
20574 <references />
20575 !! html
20576 <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>
20577 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20578 <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>
20579 </ol>
20580 !! end
20581
20582 # This test is wt2html only because we're permitting the serializer to produce
20583 # dirty diffs, normalizing the unclosed references to the self-closed version.
20584 !! test
20585 Generate references for unclosed references tag
20586 !! options
20587 parsoid=wt2html
20588 !! wikitext
20589 a<ref>foo</ref>
20590
20591 <references>
20592 !! html
20593 <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>
20594 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20595 <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>
20596 !! end
20597
20598 !! test
20599 New reference serializes on its own line
20600 !! options
20601 parsoid=wt2wt,html2wt
20602 !! wikitext
20603 foo
20604 <references />
20605 !! html
20606 foo<ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
20607 !! end
20608
20609 #### ----------------------------------------------------------------
20610 #### Parsoid-only testing of Parsoid's impl of LST
20611 #### Not implemented yet, see
20612 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
20613 #### ----------------------------------------------------------------
20614
20615 !!test
20616 LST Sections: 1. Simple section start and end
20617 !! wikitext
20618 <section begin="2011-05-16" />
20619 <section end="2014-04-10 (MW 1.23wmf22)" />
20620 !! html/parsoid
20621 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
20622 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
20623 !! end
20624
20625 #--------- Test stripping of empty nodes in template content ----------
20626 !!test
20627 Empty LI and TR nodes should be stripped from template content
20628 !!wikitext
20629 {{EmptyLITest}}
20630 {{EmptyTRTest}}
20631 !!html/parsoid
20632 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
20633 <li>a</li>
20634 <li>b</li>
20635 </ul>
20636 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
20637 <tbody>
20638 <tr>
20639 <td>foo</td>
20640 </tr>
20641 <tr>
20642 <td>bar</td>
20643 </tr>
20644 </tbody>
20645 </table>
20646 !!end
20647
20648 !!test
20649 Empty LI and TR nodes should not be stripped from top-level content
20650 !!wikitext
20651 * a
20652 *
20653 * b
20654 {|
20655 |-
20656 |-
20657 |foo
20658 |}
20659 !!html/parsoid
20660 <ul>
20661 <li> a</li>
20662 <li></li>
20663 <li> b</li>
20664 </ul>
20665 <table>
20666 <tbody>
20667 <tr></tr>
20668 <tr>
20669 <td>foo</td>
20670 </tr>
20671 </tbody>
20672 </table>
20673 !!end
20674
20675 !!test
20676 Empty TR nodes should not be stripped if they have any attributes set
20677 !!wikitext
20678 {{EmptyTRWithHTMLAttrTest}}
20679 !!html/parsoid
20680 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
20681 <tr align="center"></tr>
20682 <tr><td>foo</td></tr>
20683 <tr align="center"></tr>
20684 <tr><td>bar</td></tr>
20685 </table>
20686 !!end
20687
20688 #### ----------------------------------------------------------------
20689 #### The following section of tests are primarily to test
20690 #### wikitext escaping capabilities of Parsoid. Given that
20691 #### escaping can be done any number of ways, the wikitext (input)
20692 #### is always adjusted to reflect how Parsoid adds nowiki
20693 #### escape tags.
20694 ####
20695 #### We are marking several tests as parsoid-only since the
20696 #### HTML in the result section is different from what the
20697 #### PHP parser generates for it.
20698 #### ----------------------------------------------------------------
20699
20700
20701 #### --------------- Headings ---------------
20702 #### 0. Unnested
20703 #### 1. Nested inside html <h1>=foo=</h1>
20704 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
20705 #### 3. Nested inside html with wikitext split by html tags
20706 #### 4. No escape needed
20707 #### 5. Empty headings <h1></h1>
20708 #### 6. Heading chars in SOL context
20709 #### ----------------------------------------
20710 !! test
20711 Headings: 0. Unnested
20712 !! options
20713 parsoid
20714 !! wikitext
20715 <nowiki>=foo=</nowiki>
20716
20717 <nowiki> =foo= </nowiki>
20718 <!--cmt-->
20719 <nowiki>=foo=</nowiki>
20720
20721 =foo''a''<nowiki>=</nowiki>
20722 !! html
20723 <p><span typeof="mw:Nowiki">=foo=</span></p>
20724
20725 <p><span typeof="mw:Nowiki"> =foo= </span>
20726 <!--cmt-->
20727 <span typeof="mw:Nowiki">=foo=</span></p>
20728
20729 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
20730 !!end
20731
20732 # New headings and existing headings are handled differently
20733 !! test
20734 Headings: 1. Nested inside html
20735 !! options
20736 parsoid=html2wt
20737 !! html
20738 <h1>=foo=</h1>
20739 <h2>=foo=</h2>
20740 <h3>=foo=</h3>
20741
20742 <h1 data-parsoid=''>=foo=</h1>
20743 <h2 data-parsoid=''>=foo=</h2>
20744 <h3 data-parsoid=''>=foo=</h3>
20745 <h4 data-parsoid=''>=foo=</h4>
20746 <h5 data-parsoid=''>=foo=</h5>
20747 <h6 data-parsoid=''>=foo=</h6>
20748 !! wikitext
20749 = =foo= =
20750
20751 == =foo= ==
20752
20753 === =foo= ===
20754
20755 =<nowiki>=foo=</nowiki>=
20756 ==<nowiki>=foo=</nowiki>==
20757 ===<nowiki>=foo=</nowiki>===
20758 ====<nowiki>=foo=</nowiki>====
20759 =====<nowiki>=foo=</nowiki>=====
20760 ======<nowiki>=foo=</nowiki>======
20761
20762 !!end
20763
20764 !! test
20765 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
20766 !! options
20767 parsoid=html2wt
20768 !! html
20769 <h1>foo</h1>*bar
20770 <h1>foo</h1>=bar
20771 <h1>foo</h1>=bar=
20772 !! wikitext
20773 = foo =
20774 <nowiki>*</nowiki>bar
20775
20776 = foo =
20777 =bar
20778
20779 = foo =
20780 <nowiki>=bar=</nowiki>
20781 !!end
20782
20783 !! test
20784 Headings: 3. Nested inside html with wikitext split by html tags
20785 !! options
20786 parsoid=html2wt,wt2wt
20787 !! wikitext
20788 = ='''bold'''<nowiki>foo=</nowiki> =
20789 !! html/parsoid
20790 <h1>=<b>bold</b>foo=</h1>
20791 !!end
20792
20793 !! test
20794 Headings: 4a. No escaping needed (testing just h1 and h2)
20795 !! wikitext
20796 = =foo =
20797
20798 = foo= =
20799
20800 = =foo= =
20801
20802 = =foo= bar =
20803
20804 == =foo ==
20805
20806 == foo= ==
20807
20808 = = =
20809
20810 = ''=''foo= =
20811 !! html/parsoid
20812 <h1>=foo</h1>
20813 <h1>foo=</h1>
20814 <h1> =foo= </h1>
20815 <h1>=foo= bar</h1>
20816 <h2>=foo</h2>
20817 <h2>foo=</h2>
20818 <h1>=</h1>
20819 <h1><i>=</i>foo=</h1>
20820 !!end
20821
20822 !! test
20823 Headings: 4b. No escaping needed (inside p-tags)
20824 !! options
20825 parsoid=html2wt
20826 !! html
20827 <p>===
20828 =foo= x
20829 =foo= <s></s>
20830 </p>
20831 !! wikitext
20832 ===
20833 =foo= x
20834 =foo= <s></s>
20835 !!end
20836
20837 !! test
20838 Headings: 5. Empty headings
20839 !! options
20840 parsoid
20841 !! wikitext
20842 =<nowiki/>=
20843
20844 ==<nowiki/>==
20845
20846 ===<nowiki/>===
20847
20848 ====<nowiki/>====
20849
20850 =====<nowiki/>=====
20851
20852 ======<nowiki/>======
20853 !! html
20854 <h1></h1>
20855 <h2></h2>
20856 <h3></h3>
20857 <h4></h4>
20858 <h5></h5>
20859 <h6></h6>
20860 !!end
20861
20862 !! test
20863 Headings: 6a. Heading chars in SOL context (with trailing spaces)
20864 !! options
20865 parsoid
20866 !! wikitext
20867 <nowiki>=a=</nowiki>
20868
20869 <nowiki>=a=</nowiki>
20870
20871 <nowiki>=a=</nowiki>
20872
20873 <nowiki>=a=</nowiki>
20874 !! html
20875 <p>=a=</p>
20876 <p>=a= </p>
20877 <p>=a= </p>
20878 <p>=a= </p>
20879 !!end
20880
20881 !! test
20882 Headings: 6b. Heading chars in SOL context (with trailing newlines)
20883 !! options
20884 parsoid
20885 !! wikitext
20886 <nowiki>=a=
20887 b</nowiki>
20888
20889 <nowiki>=a=
20890 b</nowiki>
20891
20892 <nowiki>=a=
20893 b</nowiki>
20894
20895 <nowiki>=a=
20896 b</nowiki>
20897 !! html
20898 <p>=a=
20899 b</p>
20900 <p>=a=
20901 b</p>
20902 <p>=a=
20903 b</p>
20904 <p>=a=
20905 b</p>
20906 </p>
20907 !!end
20908
20909 !! test
20910 Headings: 6c. Heading chars in SOL context (leading newline break)
20911 !! options
20912 parsoid
20913 !! wikitext
20914 a
20915 <nowiki>=b=</nowiki>
20916 !! html
20917 <p>a
20918 =b=</p>
20919 !!end
20920
20921 !! test
20922 Headings: 6d. Heading chars in SOL context (with interspersed comments)
20923 !! options
20924 parsoid
20925 !! wikitext
20926 <!--c0--><nowiki>=a=</nowiki>
20927
20928 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
20929 !! html
20930 <p><!--c0-->=a=</p>
20931 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
20932 !!end
20933
20934 !! test
20935 Headings: 6d. Heading chars in SOL context (No escaping needed)
20936 !! options
20937 parsoid=html2wt
20938 !! html
20939 =a=<div>b</div>
20940 !! wikitext
20941 =a=<div>b</div>
20942 !!end
20943
20944 !! test
20945 Headings: 7. Insert a newline between new content and headings
20946 !! options
20947 parsoid=html2wt
20948 !! html
20949 <h2>NEW</h2>
20950 <p>new</p>
20951 <h2 data-parsoid='{"dsr":[0,5,2,2]}'>A</h2>
20952 <p data-parsoid='{"dsr":[6,7,0,0]}'>a</p>
20953 !! wikitext
20954 == NEW ==
20955 new
20956
20957 ==A==
20958 a
20959
20960 !! end
20961
20962 #### --------------- Lists ---------------
20963 #### 0. Outside nests (*foo, etc.)
20964 #### 1. Nested inside html <ul><li>*foo</li></ul>
20965 #### 2. Inside definition lists
20966 #### 3. Only bullets at start should be escaped
20967 #### 4. No escapes needed
20968 #### 5. No unnecessary escapes
20969 #### 6. Escape bullets in SOL position
20970 #### 7. Escape bullets in a multi-line context
20971 #### ----------------------------------------
20972
20973 !! test
20974 Lists: 0. Outside nests
20975 !! wikitext
20976 <nowiki>*</nowiki>foo
20977
20978 <nowiki>#</nowiki>foo
20979
20980 <nowiki>;Foo:</nowiki>bar
20981 !! html
20982 <p>*foo
20983 </p><p>#foo
20984 </p><p>;Foo:bar
20985 </p>
20986 !!end
20987
20988 !! test
20989 Lists: 1. Nested inside html
20990 !! wikitext
20991 *<nowiki>*foo</nowiki>
20992
20993 *<nowiki>#foo</nowiki>
20994
20995 *<nowiki>:foo</nowiki>
20996
20997 *<nowiki>;foo</nowiki>
20998
20999 #<nowiki>*foo</nowiki>
21000
21001 #<nowiki>#foo</nowiki>
21002
21003 #<nowiki>:foo</nowiki>
21004
21005 #<nowiki>;foo</nowiki>
21006 !! html
21007 <ul><li>*foo</li></ul>
21008 <ul><li>#foo</li></ul>
21009 <ul><li>:foo</li></ul>
21010 <ul><li>;foo</li></ul>
21011 <ol><li>*foo</li></ol>
21012 <ol><li>#foo</li></ol>
21013 <ol><li>:foo</li></ol>
21014 <ol><li>;foo</li></ol>
21015
21016 !!end
21017
21018 !! test
21019 Lists: 2. Inside definition lists
21020 !! wikitext
21021 ;<nowiki>;foo</nowiki>
21022
21023 ;<nowiki>:foo</nowiki>
21024
21025 ;<nowiki>:foo</nowiki>
21026 :bar
21027
21028 :<nowiki>:foo</nowiki>
21029 !! html
21030 <dl><dt>;foo</dt></dl>
21031 <dl><dt>:foo</dt></dl>
21032 <dl><dt>:foo</dt>
21033 <dd>bar</dd></dl>
21034 <dl><dd>:foo</dd></dl>
21035
21036 !!end
21037
21038 !! test
21039 Lists: 3. Only bullets at start of text should be escaped
21040 !! wikitext
21041 *<nowiki>*foo*bar</nowiki>
21042
21043 *<nowiki>*foo</nowiki>''it''*bar
21044 !! html
21045 <ul><li>*foo*bar</li></ul>
21046 <ul><li>*foo<i>it</i>*bar</li></ul>
21047
21048 !!end
21049
21050 !! test
21051 Lists: 4. No escapes needed
21052 !! options
21053 parsoid
21054 !! wikitext
21055 *foo*bar
21056
21057 *''foo''*bar
21058
21059 *[[Foo]]: bar
21060
21061 *[[Foo]]*bar
21062 !! html
21063 <ul>
21064 <li>foo*bar
21065 </li>
21066 </ul>
21067 <ul>
21068 <li><i>foo</i>*bar
21069 </li>
21070 </ul>
21071 <ul>
21072 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
21073 </li>
21074 </ul>
21075 <ul>
21076 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
21077 </li>
21078 </ul>
21079 !!end
21080
21081 !! test
21082 Lists: 5. No unnecessary escapes
21083 !! wikitext
21084 * bar <span><nowiki>[[foo]]</nowiki></span>
21085
21086 * =bar <span><nowiki>[[foo]]</nowiki></span>
21087
21088 * [[bar <span><nowiki>[[foo]]</nowiki></span>
21089
21090 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
21091
21092 * =bar <span>foo]]</span>=
21093
21094 * <s></s>: a
21095
21096 * ''* foo''
21097 !! html
21098 <ul><li> bar <span>[[foo]]</span></li></ul>
21099 <ul><li> =bar <span>[[foo]]</span></li></ul>
21100 <ul><li> [[bar <span>[[foo]]</span></li></ul>
21101 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
21102 <ul><li> =bar <span>foo]]</span>=</li></ul>
21103 <ul><li> <s></s>: a</li></ul>
21104 <ul><li> <i>* foo</i></li></ul>
21105
21106 !!end
21107
21108 !! test
21109 Lists: 6. Escape bullets in SOL position
21110 !! options
21111 parsoid=html2wt
21112 !! html
21113 <p><!--cmt-->*foo</p>
21114 !! wikitext
21115 <!--cmt--><nowiki>*</nowiki>foo
21116 !!end
21117
21118 !! test
21119 Lists: 7. Escape bullets in a multi-line context
21120 !! wikitext
21121 a
21122 <nowiki>*</nowiki>b
21123 !! html
21124 <p>a
21125 *b
21126 </p>
21127 !!end
21128
21129 !! test
21130 Lists: 8. Escape colons only if not present in tags
21131 !! options
21132 parsoid=html2wt
21133 !! html
21134 <dl><dt>a:b<i>c:d</i></dt></dl>
21135 !! wikitext
21136 ; <nowiki>a:b</nowiki>''c:d''
21137 !! end
21138
21139 #### --------------- HRs ---------------
21140 #### 1. Single line
21141 #### -----------------------------------
21142
21143 !! test
21144 HRs: 1. Single line
21145 !! wikitext
21146 ----<nowiki>----</nowiki>
21147 ----=foo=
21148 ----*foo
21149 !! html+tidy
21150 <hr />
21151 <p>----</p>
21152 <hr />
21153 <p>=foo=</p>
21154 <hr />
21155 <p>*foo</p>
21156 !! end
21157
21158 #### --------------- Tables ---------------
21159 #### 1a. Simple example
21160 #### 1b. No escaping needed (!foo)
21161 #### 1c. No escaping needed (|foo)
21162 #### 1d. No escaping needed (|}foo)
21163 ####
21164 #### 2a. Nested in td (<td>foo|bar</td>)
21165 #### 2b. Nested in td (<td>foo||bar</td>)
21166 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
21167 ####
21168 #### 3a. Nested in th (<th>foo!bar</th>)
21169 #### 3b. Nested in th (<th>foo!!bar</th>)
21170 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
21171 ####
21172 #### 4a. Escape -
21173 #### 4b. Escape +
21174 #### 4c. No escaping needed
21175 #### --------------------------------------
21176
21177 !! test
21178 Tables: 1a. Simple example
21179 !! wikitext
21180 <nowiki>{|
21181 |}</nowiki>
21182 !! html
21183 <p>{|
21184 |}
21185 </p>
21186 !! end
21187
21188 !! test
21189 Tables: 1b. No escaping needed
21190 !! wikitext
21191 !foo
21192 !! html
21193 <p>!foo
21194 </p>
21195 !! end
21196
21197 !! test
21198 Tables: 1c. No escaping needed
21199 !! wikitext
21200 |foo
21201 !! html
21202 <p>|foo
21203 </p>
21204 !! end
21205
21206 !! test
21207 Tables: 1d. No escaping needed
21208 !! wikitext
21209 |}foo
21210 !! html
21211 <p>|}foo
21212 </p>
21213 !! end
21214
21215 !! test
21216 Tables: 2a. Nested in td
21217 !! options
21218 parsoid=html2wt
21219 !! html/parsoid
21220 <table><tbody><tr>
21221 <td>foo|bar</td></tr>
21222 <tr><td>x<div>a|b</div></td>
21223 </tbody></table>
21224 !! wikitext
21225 {|
21226 |<nowiki>foo|bar</nowiki>
21227 |-
21228 |x<div><nowiki>a|b</nowiki></div>
21229 |}
21230 !! html/php+tidy
21231 <table>
21232 <tr>
21233 <td>foo|bar</td>
21234 </tr>
21235 <tr>
21236 <td>x
21237 <div>a|b</div>
21238 </td>
21239 </tr>
21240 </table>
21241 !! end
21242
21243 !! test
21244 Tables: 2b. Nested in td
21245 !! options
21246 parsoid=html2wt
21247 !! html/parsoid
21248 <table><tbody><tr>
21249 <td>foo||bar</td>
21250 <td>a<i>b||c</i></td>
21251 <td>a<i><div>b||c</div></i></td>
21252 </tr></tbody></table>
21253 !! wikitext
21254 {|
21255 |<nowiki>foo||bar</nowiki>
21256 |a''<nowiki>b||c</nowiki>''
21257 |a''<div><nowiki>b||c</nowiki></div>''
21258 |}
21259 !! html/php
21260 <table>
21261 <tr>
21262 <td>foo||bar
21263 </td>
21264 <td>a<i>b||c</i>
21265 </td>
21266 <td>a<i><div>b||c</div></i>
21267 </td></tr></table>
21268
21269 !! end
21270
21271 !! test
21272 Tables: 2c. Nested in td -- no escaping needed
21273 !! wikitext
21274 {|
21275
21276 |foo!!bar
21277 |}
21278 !! html/*
21279 <table>
21280
21281 <tr>
21282 <td>foo!!bar
21283 </td></tr></table>
21284
21285 !! end
21286
21287 !! test
21288 Tables: 3a. Nested in th
21289 !! wikitext
21290 {|
21291
21292 !foo!bar
21293 |}
21294 !! html/*
21295 <table>
21296
21297 <tr>
21298 <th>foo!bar
21299 </th></tr></table>
21300
21301 !! end
21302
21303 !! test
21304 Tables: 3b. Nested in th
21305 !! options
21306 parsoid=html2wt
21307 !! html/parsoid
21308 <table><tbody>
21309 <tr><th>foo!!bar</th>
21310 <th><i>foo|bar</i></th>
21311 <th><i>foo!!bar</i></th>
21312 <th><i><span>foo!!bar</span></i></th>
21313 </tr></tbody></table>
21314 !! wikitext
21315 {|
21316 !<nowiki>foo!!bar</nowiki>
21317 !''<nowiki>foo|bar</nowiki>''
21318 !''<nowiki>foo!!bar</nowiki>''
21319 !''<span><nowiki>foo!!bar</nowiki></span>''
21320 |}
21321 !! html/php
21322 <table>
21323 <tr>
21324 <th>foo!!bar
21325 </th>
21326 <th><i>foo|bar</i>
21327 </th>
21328 <th><i>foo!!bar</i>
21329 </th>
21330 <th><i><span>foo!!bar</span></i>
21331 </th></tr></table>
21332
21333 !! end
21334
21335 !! test
21336 Tables: 3c. Nested in th
21337 !! options
21338 parsoid=html2wt
21339 !! html/parsoid
21340 <table><tbody>
21341 <tr><th>foo||bar</th>
21342 <th><span typeof="mw:Nowiki">foo||bar</span></th>
21343 </tr></tbody></table>
21344 !! wikitext
21345 {|
21346 !<nowiki>foo||bar</nowiki>
21347 !<nowiki>foo||bar</nowiki>
21348 |}
21349 !! html/php
21350 <table>
21351 <tr>
21352 <th>foo||bar
21353 </th>
21354 <th>foo||bar
21355 </th></tr></table>
21356
21357 !! end
21358
21359 !! test
21360 Tables: 4a. Escape -
21361 !! options
21362 parsoid=html2wt
21363 !! html/*
21364 <table>
21365
21366 <tr>
21367 <th>-bar
21368 </th></tr>
21369 <tr>
21370 <td>-bar
21371 </td></tr></table>
21372
21373 !! wikitext
21374 {|
21375
21376 !-bar
21377
21378 |-
21379 |<nowiki>-bar</nowiki>
21380 |}
21381 !! end
21382
21383 !! test
21384 Tables: 4b. Escape +
21385 !! options
21386 parsoid=html2wt
21387 !! html/*
21388 <table>
21389
21390 <tr>
21391 <th>+bar
21392 </th></tr>
21393 <tr>
21394 <td>+bar
21395 </td></tr></table>
21396
21397 !! wikitext
21398 {|
21399
21400 !+bar
21401
21402 |-
21403 |<nowiki>+bar</nowiki>
21404 |}
21405 !! end
21406
21407 !! test
21408 Tables: 4c. No escaping needed
21409 !! wikitext
21410 {|
21411 |foo-bar
21412 |foo+bar
21413 |-
21414 |''foo''-bar
21415 |''foo''+bar
21416 |-
21417 |foo
21418 bar|baz
21419 +bar
21420 -bar
21421 |-
21422 |x
21423 <div>a|b</div>
21424 |}
21425 !! html/php
21426 <table>
21427 <tr>
21428 <td>foo-bar
21429 </td>
21430 <td>foo+bar
21431 </td></tr>
21432 <tr>
21433 <td><i>foo</i>-bar
21434 </td>
21435 <td><i>foo</i>+bar
21436 </td></tr>
21437 <tr>
21438 <td>foo
21439 <p>bar|baz
21440 +bar
21441 -bar
21442 </p>
21443 </td></tr>
21444 <tr>
21445 <td>x
21446 <div>a|b</div>
21447 </td></tr></table>
21448
21449 !! html/parsoid
21450 <table><tbody>
21451 <tr><td>foo-bar</td><td>foo+bar</td></tr>
21452 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
21453 <tr><td>foo
21454 <p>bar|baz
21455 +bar
21456 -bar</p></td></tr>
21457 <tr><td>x
21458 <div>a|b</div></td>
21459 </tbody></table>
21460 !! end
21461
21462 !! test
21463 Tables: 4d. No escaping needed
21464 !! wikitext
21465 {|
21466 |[[Foo]]-bar
21467 ||+1
21468 ||-2
21469 |}
21470 !! html/php
21471 <table>
21472 <tr>
21473 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
21474 </td>
21475 <td>+1
21476 </td>
21477 <td>-2
21478 </td></tr></table>
21479
21480 !! html/parsoid
21481 <table>
21482 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
21483 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
21484 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
21485 </tbody></table>
21486 !! end
21487
21488 !! test
21489 Tables: Digest broken attributes on table and tr tag
21490 !! options
21491 parsoid=wt2html
21492 !! wikitext
21493 {| || |} ++
21494 |- || || ++ --
21495 |- > [
21496 |}
21497 !! html
21498 <table>
21499 <tbody>
21500 <tr></tr>
21501 <tr></tr>
21502 </tbody></table>
21503 !! end
21504
21505 #### --------------- Links ----------------
21506 #### 1. Quote marks in link text
21507 #### 2. Wikilinks: Escapes needed
21508 #### 3. Wikilinks: No escapes needed
21509 #### 4. Extlinks: Escapes needed
21510 #### 5. Extlinks: No escapes needed
21511 #### --------------------------------------
21512 !! test
21513 Links 1. WikiLinks: No escapes needed
21514 !! wikitext
21515 [[Foo|Foo''boo'']]
21516 [[Foo|[Foobar]]]
21517 [[Foo|x [Foobar] x]]
21518 !! html/php
21519 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
21520 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
21521 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
21522 </p>
21523 !! html/parsoid
21524 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
21525 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
21526 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
21527 !! end
21528
21529 !! test
21530 Links 2. WikiLinks: Escapes needed
21531 !! options
21532 parsoid=html2wt
21533 !! html/parsoid
21534 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
21535 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
21536 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
21537 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
21538 <a href="Foo" rel="mw:WikiLink">|Bar</a>
21539 <a href="Foo" rel="mw:WikiLink">]]bar</a>
21540 <a href="Foo" rel="mw:WikiLink">[[bar</a>
21541 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
21542 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
21543 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
21544 !! wikitext
21545 [[Foo|<nowiki>Foobar]</nowiki>]]
21546 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
21547 [[Foo|<nowiki>[[Bar]]</nowiki>]]
21548 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
21549 [[Foo|<nowiki>|Bar</nowiki>]]
21550 [[Foo|<nowiki>]]bar</nowiki>]]
21551 [[Foo|<nowiki>[[bar</nowiki>]]
21552 [[Foo|<nowiki>x [[ y</nowiki>]]
21553 [[Foo|<nowiki>x ]] y</nowiki>]]
21554 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
21555 !! html/php
21556 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
21557 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
21558 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
21559 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
21560 <a href="/wiki/Foo" title="Foo">|Bar</a>
21561 <a href="/wiki/Foo" title="Foo">]]bar</a>
21562 <a href="/wiki/Foo" title="Foo">[[bar</a>
21563 <a href="/wiki/Foo" title="Foo">x [[ y</a>
21564 <a href="/wiki/Foo" title="Foo">x ]] y</a>
21565 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
21566 </p>
21567 !! end
21568
21569 !! test
21570 Links 3. WikiLinks: No escapes needed
21571 !! wikitext
21572 [[Foo|[Foobar]]
21573 [[Foo|foo|bar]]
21574 !! html/php
21575 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
21576 <a href="/wiki/Foo" title="Foo">foo|bar</a>
21577 </p>
21578 !! html/parsoid
21579 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
21580 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
21581 !! end
21582
21583 !! test
21584 Links 4. ExtLinks: Escapes needed
21585 !! options
21586 parsoid=html2wt
21587 !! html/parsoid
21588 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
21589 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
21590 <p>[http://google.com]</p>
21591 <p>[http://google.com google]</p>
21592 !! wikitext
21593 [http://google.com <nowiki>[google]</nowiki>]
21594 [http://google.com <nowiki>google]</nowiki>]
21595
21596 <nowiki>[http://google.com]</nowiki>
21597
21598 <nowiki>[http://google.com google]</nowiki>
21599
21600 !! html/php
21601 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
21602 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
21603 </p><p>[http://google.com]
21604 </p><p>[http://google.com google]
21605 </p>
21606 !! end
21607
21608 !! test
21609 Links 5. ExtLinks: No escapes needed
21610 !! wikitext
21611 [http://google.com [google]
21612 !! html/php
21613 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
21614 </p>
21615 !! html/parsoid
21616 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
21617 !! end
21618
21619 !! test
21620 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
21621 !! html/parsoid
21622 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
21623 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
21624 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
21625 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
21626 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
21627 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
21628 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
21629 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
21630 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
21631 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
21632 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
21633 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
21634 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
21635 </p>
21636 !! wikitext
21637 x<nowiki/>http://example.com<nowiki/>y
21638 http://example.com<nowiki/>?x
21639 http://example.com<nowiki/>&x
21640 http://example.com<nowiki/>'x
21641 http://example.com<nowiki/>,x
21642 http://example.com<nowiki/>.x
21643 http://example.com<nowiki/>;x
21644 http://example.com<nowiki/>:x
21645 http://example.com<nowiki/>;x
21646 http://example.com<nowiki/>!x
21647 http://example.com<nowiki/>=x
21648 http://example.com<nowiki/>(x)
21649 http://example.com(x<nowiki/>)
21650 !! end
21651
21652 !! test
21653 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
21654 !! html/parsoid
21655 <p>x
21656 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
21657 y
21658 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
21659 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
21660 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
21661 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
21662 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
21663 </p>
21664 !! wikitext
21665 x
21666 http://example.com
21667 y
21668 "http://example.com"
21669 (http://example.com)
21670 (http://example.com) foo
21671 http://example.com,
21672 http://example.com, foo
21673 !! html/php
21674 <p>x
21675 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
21676 y
21677 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
21678 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
21679 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
21680 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
21681 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
21682 </p>
21683 !! end
21684
21685 !! test
21686 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
21687 !! html/parsoid
21688 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
21689 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
21690 !! wikitext
21691 http://example.com.,;:!?\
21692 -http://example.com:
21693 !! html/php
21694 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
21695 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
21696 </p>
21697 !! end
21698
21699 !! test
21700 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
21701 !! html/parsoid
21702 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
21703 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
21704 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
21705 !! wikitext
21706 RFC 123<nowiki/>4
21707 RFC 123<nowiki/>y
21708 X<nowiki/>RFC 123<nowiki/>y
21709 !! end
21710
21711 !! test
21712 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
21713 !! html/parsoid
21714 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
21715 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
21716 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
21717 </p>
21718 !! wikitext
21719 RFC 123?foo
21720 RFC 123&foo
21721 -RFC 123-
21722 !! html/php
21723 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
21724 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
21725 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
21726 </p>
21727 !! end
21728
21729 !! test
21730 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
21731 !! html/parsoid
21732 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
21733 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
21734 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
21735 !! wikitext
21736 PMID 123<nowiki/>4
21737 PMID 123<nowiki/>y
21738 X<nowiki/>PMID 123<nowiki/>y
21739 !! end
21740
21741 !! test
21742 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
21743 !! html/parsoid
21744 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
21745 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
21746 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
21747 </p>
21748 !! wikitext
21749 PMID 123?foo
21750 PMID 123&foo
21751 -PMID 123-
21752 !! html/php
21753 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
21754 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
21755 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
21756 </p>
21757 !! end
21758
21759 !! test
21760 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
21761 !! html/parsoid
21762 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
21763 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
21764 a<a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
21765 </p>
21766 !! wikitext
21767 ISBN 1234567890<nowiki/>1
21768 ISBN 1234567890<nowiki/>x
21769 a<nowiki/>ISBN 1234567890<nowiki/>b
21770 !! end
21771
21772 !! test
21773 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
21774 !! html/parsoid
21775 <p>-<a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
21776 !! wikitext
21777 -ISBN 1234567890's
21778 !! html/php
21779 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
21780 </p>
21781 !! end
21782
21783 !! test
21784 Links 14. Protect link-like plain text. (Parsoid bug T78425)
21785 !! options
21786 parsoid=html2wt
21787 !! html/*
21788 <p>this is not a link: http://example.com
21789 </p>
21790 !! wikitext
21791 this is not a link: <nowiki>http://example.com</nowiki>
21792 !! end
21793
21794 !! test
21795 Links 15. Link trails can't become link prefixes.
21796 !! options
21797 language=is
21798 !! wikitext
21799 [[Söfnuður]]-[[00]]
21800 !! html/php
21801 <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>
21802 </p>
21803 !! html/parsoid
21804 <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>
21805 !! end
21806
21807 #### --------------- Quotes ---------------
21808 #### 1. Quotes inside <b> and <i>
21809 #### 2. Link fragments separated by <i> and <b> tags
21810 #### 3. Link fragments inside <i> and <b>
21811 #### 4. No escaping needed
21812 #### --------------------------------------
21813 !! test
21814 1a. Quotes inside <b> and <i>
21815 !! options
21816 parsoid=html2wt,wt2wt
21817 !! wikitext
21818 ''<nowiki/>'foo'''
21819 ''<nowiki>''foo''</nowiki>''
21820 ''<nowiki>'''foo'''</nowiki>''
21821 ''foo''<nowiki/>'s
21822 '''<nowiki/>'foo''''
21823 '''<nowiki>''foo''</nowiki>'''
21824 '''<nowiki>'''foo'''</nowiki>'''
21825 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
21826 '''foo'''<nowiki/>'s
21827 '''foo''
21828 ''foo''<nowiki/>'
21829 ''foo'''<nowiki/>'
21830 '''foo''<nowiki/>'
21831 ''''foo'''
21832 '''foo'''<nowiki/>'
21833 ''''foo'''<nowiki/>'
21834 ''fools'<span> errand</span>''
21835 ''<span>fool</span>'s errand''
21836 '<nowiki/>''foo'' bar '''baz''
21837 a|!*#-:;+-~[]{}b'''x''
21838 !! html/*
21839 <p><i>'foo'</i>
21840 <i>''foo''</i>
21841 <i>'''foo'''</i>
21842 <i>foo</i>'s
21843 <b>'foo'</b>
21844 <b>''foo''</b>
21845 <b>'''foo'''</b>
21846 <b>foo'<i>bar'</i>baz</b>
21847 <b>foo</b>'s
21848 '<i>foo</i>
21849 <i>foo</i>'
21850 <i>foo'</i>'
21851 '<i>foo</i>'
21852 '<b>foo</b>
21853 <b>foo</b>'
21854 '<b>foo</b>'
21855 <i>fools'<span> errand</span></i>
21856 <i><span>fool</span>'s errand</i>
21857 '<i>foo</i> bar '<i>baz</i>
21858 a|!*#-:;+-~[]{}b'<i>x</i>
21859 </p>
21860 !! end
21861
21862 !! test
21863 1b. Quotes inside <b> and <i> with other tags on same line
21864 !! options
21865 parsoid=html2wt,wt2wt
21866 !! wikitext
21867 '''a'' foo ''[[bar]]''
21868 ''a''' foo ''[[bar]]''
21869 ''a''' foo '''{{echo|[[bar]]}}'''
21870 [[foo]] x'''[[bar]]''
21871 '''foo'' <ref>test</ref>
21872 '''foo'' <div title="name">test</div>
21873 '''foo'' and <br> bar
21874 <references />
21875 !! html
21876 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
21877 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
21878 <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>
21879 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
21880 '<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>
21881 '<i>foo</i> <div title="name">test</div>
21882 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
21883 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21884 <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>
21885 </ol>
21886 !! end
21887
21888 !! test
21889 2. Link fragments separated by <i> and <b> tags
21890 !! wikitext
21891 [[''foo''<nowiki>hello]]</nowiki>
21892
21893 [['''foo'''<nowiki>hello]]</nowiki>
21894 !! html
21895 <p>[[<i>foo</i>hello]]
21896 </p><p>[[<b>foo</b>hello]]
21897 </p>
21898 !! end
21899
21900 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
21901 # this is one of the shortcomings of this format
21902 !! test
21903 3. Link fragments inside <i> and <b>
21904 !! wikitext
21905 ''[[foo''<nowiki>]]</nowiki>
21906
21907 '''[[foo'''<nowiki>]]</nowiki>
21908 !! html
21909 <p><i>[[foo</i>]]
21910 </p><p><b>[[foo</b>]]
21911 </p>
21912 !! end
21913
21914 !! test
21915 4. No escaping needed
21916 !! wikitext
21917 '<span>''bar''</span>'
21918 '<span>'''bar'''</span>'
21919 'a:b'foo
21920 !! html
21921 <p>'<span><i>bar</i></span>'
21922 '<span><b>bar</b></span>'
21923 'a:b'foo
21924 </p>
21925 !! end
21926
21927 #### ----------- Paragraphs ---------------
21928 #### 1. No unnecessary escapes
21929 #### --------------------------------------
21930
21931 !! test
21932 1. No unnecessary escapes
21933 !! wikitext
21934 bar <span><nowiki>[[foo]]</nowiki></span>
21935
21936 =bar <span><nowiki>[[foo]]</nowiki></span>
21937
21938 [[bar <span><nowiki>[[foo]]</nowiki></span>
21939
21940 ]]bar <span><nowiki>[[foo]]</nowiki></span>
21941
21942 =bar <span>foo]]</span><nowiki>=</nowiki>
21943 !! html
21944 <p>bar <span>[[foo]]</span>
21945 </p><p>=bar <span>[[foo]]</span>
21946 </p><p>[[bar <span>[[foo]]</span>
21947 </p><p>]]bar <span>[[foo]]</span>
21948 </p><p>=bar <span>foo]]</span>=
21949 </p>
21950 !!end
21951
21952 #### ----------------------- PRE --------------------------
21953 #### 1. Leading whitespace in SOL context should be escaped
21954 #### ------------------------------------------------------
21955 !! test
21956 1. Leading whitespace in SOL context should be escaped
21957 !! options
21958 parsoid
21959 !! wikitext
21960 <nowiki> </nowiki>a
21961
21962 <nowiki> </nowiki> a
21963
21964 <nowiki> </nowiki>a(tab)
21965
21966 <nowiki> </nowiki> a
21967 <!--cmt-->
21968 <nowiki> </nowiki> a
21969
21970 a
21971 <nowiki> </nowiki>b
21972
21973 a
21974 <nowiki> </nowiki>b
21975
21976 a
21977 <nowiki> </nowiki> b
21978 !! html
21979 <p> a</p>
21980 <p> a</p>
21981 <p> a(tab)</p>
21982 <p> a</p>
21983 <p><!--cmt--> a</p>
21984 <p>a
21985 b</p>
21986 <p>a
21987 b</p>
21988 <p>a
21989 b</p>
21990 !! end
21991
21992 !! test
21993 2. Leading whitespace in non-indent-pre contexts should not be escaped
21994 !! options
21995 parsoid
21996 !! wikitext
21997 foo <ref>''a''
21998 b</ref>
21999 <references />
22000 !! html
22001 <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>
22002 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22003 <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>
22004 b</span></li>
22005 </ol>
22006 !! end
22007
22008 !! test
22009 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
22010 !! options
22011 parsoid
22012 !! wikitext
22013 <blockquote>
22014 a
22015 <span>b</span>
22016 c
22017 </blockquote>
22018 !! html
22019 <blockquote>
22020 <p>
22021 a
22022 <span>b</span>
22023 c</p>
22024 </blockquote>
22025 !! end
22026
22027 !! test
22028 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
22029 !! options
22030 parsoid
22031 !! wikitext
22032 [[File:Foobar.jpg|thumb|caption]]
22033 !! html
22034 !! html/parsoid
22035 <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" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
22036 !! end
22037
22038 !! test
22039 5. Nowiki escaping should account for indent-pres
22040 !! options
22041 parsoid=html2wt
22042 !! html
22043 <pre>==foo==</pre>
22044 !! wikitext
22045 ==foo==
22046 !! end
22047
22048 #### --------------- Behavior Switches --------------------
22049 !! test
22050 1. Valid behavior switches should be escaped
22051 !! options
22052 parsoid=html2wt
22053 !! html
22054 __TOC__
22055 <i>__TOC__</i>
22056 !! wikitext
22057 <nowiki>__TOC__</nowiki>
22058 ''<nowiki>__TOC__</nowiki>''
22059 !! end
22060
22061 !! test
22062 2. Invalid behavior switches should not be escaped
22063 !! options
22064 parsoid=html2wt
22065 !! html
22066 __TOO__
22067 __|__
22068 !! wikitext
22069 __TOO__
22070 __|__
22071 !! end
22072
22073 #### --------------- HTML tags ---------------
22074 #### 1. a tags
22075 #### 2. other tags
22076 #### 3. multi-line html tag
22077 #### 4. extension tags
22078 #### -----------------------------------------
22079 !! test
22080 1. a tags
22081 !! options
22082 parsoid
22083 !! wikitext
22084 <a href="http://google.com">google</a>
22085 !! html
22086 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
22087 !! end
22088
22089 !! test
22090 2. other tags
22091 !! wikitext
22092 * <nowiki><div>foo</div></nowiki>
22093 * <nowiki><div style="color:red">foo</div></nowiki>
22094 * <nowiki><td></nowiki>
22095 !! html
22096 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
22097 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
22098 <li> &lt;td&gt;</li></ul>
22099
22100 !! end
22101
22102 !! test
22103 3. multi-line html tag
22104 !! wikitext
22105 <nowiki><div
22106 >foo</div
22107 ></nowiki>
22108 !! html
22109 <p>&lt;div
22110 &gt;foo&lt;/div
22111 &gt;
22112 </p>
22113 !! end
22114
22115 !! test
22116 4. extension tags
22117 !! wikitext
22118 <nowiki><ref>foo</ref></nowiki>
22119
22120 <nowiki><ref>bar</nowiki>
22121
22122 baz<nowiki></ref></nowiki>
22123 !! html
22124 <p>&lt;ref&gt;foo&lt;/ref&gt;
22125 </p><p>&lt;ref&gt;bar
22126 </p><p>baz&lt;/ref&gt;
22127 </p>
22128 !! end
22129
22130 #### --------------- Others ---------------
22131 !! test
22132 Escaping nowikis
22133 !! wikitext
22134 &lt;nowiki&gt;foo&lt;/nowiki&gt;
22135 !! html
22136 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
22137 </p>
22138 !! end
22139
22140 ## The quote-char in the input is necessary for triggering the bug
22141 !! test
22142 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
22143 !! options
22144 parsoid=wt2wt,html2wt
22145 !! wikitext
22146 foo's bar :
22147 !! html
22148 <p>foo's bar :</p>
22149 !! end
22150
22151 !! test
22152
22153 Tag-like HTML structures are passed through as text
22154 !! wikitext
22155 <x y>
22156
22157 <x.y>
22158
22159 <x-y>
22160
22161 1>2
22162
22163 x<y
22164
22165 a>b
22166
22167 1<d e>f
22168 !! html
22169 <p>&lt;x y&gt;
22170 </p><p>&lt;x.y&gt;
22171 </p><p>&lt;x-y&gt;
22172 </p><p>1&gt;2
22173 </p><p>x&lt;y
22174 </p><p>a&gt;b
22175 </p><p>1&lt;d e&gt;f
22176 </p>
22177 !! end
22178
22179 !! test
22180 HTML tag with necessary entities in attributes
22181 !! wikitext
22182 <span title="&amp;amp;">foo</span>
22183 !! html
22184 <p><span title="&amp;amp;">foo</span>
22185 </p>
22186 !! end
22187
22188 !! test
22189 HTML tag with 'unnecessary' entity encoding in attributes
22190 !! wikitext
22191 <span title="&amp;">foo</span>
22192 !! html
22193 <p><span title="&amp;">foo</span>
22194 </p>
22195 !! end
22196
22197 !! test
22198 HTML tag with broken attribute value quoting
22199 !! wikitext
22200 <span title="Hello world>Foo</span>
22201 !! html/php
22202 <p><span>Foo</span>
22203 </p>
22204 !! html/parsoid
22205 <p><span title="Hello world">Foo</span>
22206 </p>
22207 !! end
22208
22209 !! test
22210 Parsoid-only: HTML tag with broken attribute value quoting
22211 !! options
22212 parsoid
22213 !! wikitext
22214 <span title="Hello world>Foo</span>
22215 !! html
22216 <p><span title="Hello world">Foo</span>
22217 </p>
22218 !! end
22219
22220 !! test
22221 Table with broken attribute value quoting
22222 !! wikitext
22223 {|
22224 | title="Hello world|Foo
22225 |}
22226 !! html/php
22227 <table>
22228 <tr>
22229 <td>Foo
22230 </td></tr></table>
22231
22232 !! html/parsoid
22233 <table>
22234 <tr>
22235 <td title="Hello world">Foo
22236 </td></tr></table>
22237
22238 !! end
22239
22240 !! test
22241 Table with broken attribute value quoting on consecutive lines
22242 !! wikitext
22243 {|
22244 | title="Hello world|Foo
22245 | style="color:red|Bar
22246 |}
22247 !! html/php
22248 <table>
22249 <tr>
22250 <td>Foo
22251 </td>
22252 <td>Bar
22253 </td></tr></table>
22254
22255 !! html/parsoid
22256 <table><tbody>
22257 <tr>
22258 <td title="Hello world">Foo
22259 </td><td style="color: red">Bar
22260 </td></tr></tbody></table>
22261
22262 !! end
22263
22264 !! test
22265 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
22266 !! options
22267 parsoid
22268 !! wikitext
22269 {{}}
22270 !! html
22271 {{}}
22272 !! end
22273
22274 !! test
22275 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
22276 !! options
22277 parsoid
22278 !! wikitext
22279 }}{{
22280 !! html
22281 }}{{
22282 !! end
22283
22284 !!test
22285 Accept empty td cell attribute
22286 !! wikitext
22287 {|
22288 | align="center" | foo || |
22289 |}
22290 !! html
22291 <table>
22292 <tr>
22293 <td align="center"> foo </td>
22294 <td>
22295 </td></tr></table>
22296
22297 !!end
22298
22299 !!test
22300 Non-empty attributes in th-cells
22301 !! wikitext
22302 {|
22303 ! Foo !! style="color: red" | Bar
22304 |}
22305 !! html
22306 <table>
22307 <tr>
22308 <th> Foo </th>
22309 <th style="color: red"> Bar
22310 </th></tr></table>
22311
22312 !!end
22313
22314 !!test
22315 Accept empty attributes in th-cells
22316 !! wikitext
22317 {|
22318 !| foo !!| bar
22319 |}
22320 !! html
22321 <table>
22322 <tr>
22323 <th> foo </th>
22324 <th> bar
22325 </th></tr></table>
22326
22327 !!end
22328
22329 !!test
22330 Empty table rows go away
22331 !! wikitext
22332 {|
22333 | Hello
22334 | there
22335 |- class="foo"
22336 |-
22337 |}
22338 !! html
22339 <table>
22340 <tr>
22341 <td> Hello
22342 </td>
22343 <td> there
22344 </td></tr>
22345
22346 </table>
22347
22348 !! end
22349
22350 ###
22351 ### Parsoid-centric tests for testing RTing of inter-element separators
22352 ### Edge cases not tested by existing parser tests and specific to
22353 ### Parsoid-specific serialization strategies.
22354 ###
22355
22356 !!test
22357 RT-ed inter-element separators should be valid separators
22358 !! wikitext
22359 {|
22360 |- [[foo]]
22361 |}
22362 !! html
22363 <table>
22364
22365 </table>
22366
22367 !!end
22368
22369 # Parsoid-only since PHP parser relies on Tidy for correct output
22370 !!test
22371 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
22372 !!options
22373 parsoid
22374 !! wikitext
22375 {|
22376 |<small>foo
22377 bar
22378 |}
22379
22380 {|
22381 |<small>foo<small>
22382 |}
22383 !! html
22384 <table>
22385 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
22386 <p>bar</p></small></td></tr>
22387 </tbody></table>
22388
22389 <table>
22390 <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>
22391 </tbody></table>
22392 !!end
22393
22394 !!test
22395 Empty TD followed by TD with tpl-generated attribute
22396 !! wikitext
22397 {|
22398 |-
22399 |
22400 |{{echo|style='color:red'}}|foo
22401 |}
22402 !! html
22403 <table>
22404
22405 <tr>
22406 <td>
22407 </td>
22408 <td>foo
22409 </td></tr></table>
22410
22411 !!end
22412
22413 !!test
22414 Indented table with an empty td
22415 !! wikitext
22416 {|
22417 |-
22418 |
22419 |foo
22420 |}
22421 !! html
22422 <table>
22423
22424 <tr>
22425 <td>
22426 </td>
22427 <td>foo
22428 </td></tr></table>
22429
22430 !!end
22431
22432 ## We have some newline diffs RT-ing this edge case
22433 ## and it is not important enough -- we seem to be emitting
22434 ## at most 2 newlines after a </tr> and this is unrelated to
22435 ## the issue from T85627 that this is testing.
22436 !!test
22437 Indented table with blank lines in between (T85627)
22438 !! options
22439 parsoid=wt2html
22440 !! wikitext
22441 {|
22442 |foo
22443
22444
22445 |}
22446 !! html
22447 <table>
22448
22449 <tr>
22450 <td>foo
22451 </td></tr></table>
22452
22453 !!end
22454
22455 !!test
22456 Indented block & table
22457 !! wikitext
22458 <div>foo</div>
22459 {|
22460 |foo
22461 |}
22462 !! html/php
22463 <div>foo</div>
22464 <table>
22465 <tr>
22466 <td>foo
22467 </td></tr></table>
22468
22469 !! html/parsoid
22470 <div data-parsoid='{"stx":"html"}'>foo</div>
22471 <table><tbody>
22472 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
22473 </tbody></table>
22474 !!end
22475
22476 !! test
22477 Indent and comment before table row
22478 !! wikitext
22479 {|
22480 <!--hi-->|-
22481 | there
22482 |}
22483 !! html/php
22484 <table>
22485
22486 <tr>
22487 <td> there
22488 </td></tr></table>
22489
22490 !! html/parsoid
22491 <table>
22492 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
22493 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
22494 </tbody></table>
22495 !! end
22496
22497 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
22498 !!test
22499 Empty TR followed by a template-generated TR
22500 !!options
22501 parsoid
22502 !! wikitext
22503 {|
22504 |-
22505 {{echo|<tr><td>foo</td></tr>}}
22506 |}
22507 !! html
22508 <table>
22509 <tbody>
22510 <tr></tr>
22511 <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}}]}'>
22512 <td>foo</td></tr>
22513 </tbody></table>
22514 !!end
22515
22516 ## PHP and parsoid output differ for this, and since this is primarily
22517 ## for testing Parsoid's serializer, marking this Parsoid only
22518 !!test
22519 Empty TR followed by mixed-ws-comment line should RT correctly
22520 !!options
22521 parsoid
22522 !! wikitext
22523 {|
22524 |-
22525 <!--c-->
22526 |-
22527 <!--c--> <!--d-->
22528 |}
22529 !! html
22530 <table>
22531 <tbody>
22532 <tr></tr>
22533 <!--c-->
22534 <tr>
22535 <!--c--> </tr><!--d-->
22536 </tbody></table>
22537
22538 !!end
22539
22540 !!test
22541 Multi-line image caption generated by templates with/without trailing newlines
22542 !! wikitext
22543 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
22544 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
22545 !! html/parsoid
22546 <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" 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>
22547 <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" 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>
22548 !!end
22549
22550 !! test
22551 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
22552 !! options
22553 parsoid=html2wt
22554 !! html
22555 <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>
22556
22557 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid=''/><h1>new heading</h1>
22558 !! wikitext
22559 <includeonly>foo</includeonly>
22560 new para
22561
22562 [[./Category:Foo]]
22563
22564 = new heading =
22565 !! end
22566
22567 ## PHP emits broken html for this, and since this is primarily
22568 ## a Parsoid serializer test, marking this Parsoid only
22569 !!test
22570 Improperly nested inline or quotes tags with whitespace in between
22571 !!options
22572 parsoid
22573 !! wikitext
22574 <span> <s>x</span> </s>
22575 ''' ''x''' ''
22576 !! html
22577 <p><span> <s>x</s></span><s> </s>
22578 <b> <i>x</i></b><i> </i>
22579 </p>
22580 !!end
22581
22582 !!test
22583 Encapsulate protected attributes from wt
22584 !!options
22585 parsoid
22586 !! wikitext
22587 <div typeof="mw:placeholder stuff" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
22588 !! html
22589 <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>
22590 </body>
22591 !!end
22592
22593 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
22594 ## Having nested or stray pre tags results in the attempt to add duplicates,
22595 ## causing an assertion fail. This test tries to prevent that situation.
22596 !!test
22597 Ensure ParagraphWrapper can deal with stray closing pre tags
22598 !!options
22599 parsoid=wt2html
22600 !! wikitext
22601 plain text</pre>
22602 !! html
22603 plain text
22604 !!end
22605
22606 !!test
22607 1. Ensure fostered text content is wrapped in element nodes
22608 !!options
22609 parsoid=wt2html
22610 !! wikitext
22611 <table>hi</table><table>ho</table>
22612 !! html
22613 <p>hi</p>
22614 <table></table>
22615 <p>ho</p>
22616 <table></table>
22617 !!end
22618
22619 !!test
22620 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
22621 !!options
22622 parsoid=wt2html,wt2wt
22623 !! wikitext
22624 <table>
22625 <tr> || ||
22626 <td> a
22627 </table>
22628 !! html
22629 <p> || ||
22630 </p><table>
22631 <tbody><tr><td> a</td></tr>
22632 </tbody></table>
22633 !!end
22634
22635 !!test
22636 Encapsulation properly handles null DSR information from foster box
22637 !!options
22638 parsoid=wt2html,wt2wt
22639 !! wikitext
22640 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
22641 !! html
22642 <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>
22643 !!end
22644
22645 !!test
22646 1. Encapsulate foster-parented transclusion content
22647 !!options
22648 parsoid=wt2wt,wt2html
22649 !! wikitext
22650 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
22651 !! html
22652 <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>
22653 <tbody>
22654 <tr>
22655 <td>bar</td>
22656 </tr>
22657 </tbody>
22658 </table>
22659 !!end
22660
22661 !!test
22662 2. Encapsulate foster-parented transclusion content
22663 !!options
22664 parsoid=wt2wt,wt2html
22665 !! wikitext
22666 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
22667 !! html
22668 <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>
22669 <table>
22670 <tbody>
22671 <tr>
22672 <td>bar</td>
22673 </tr>
22674 </tbody>
22675 </table>
22676 !!end
22677
22678 !!test
22679 3. Encapsulate foster-parented transclusion content
22680 !!options
22681 parsoid=wt2wt,wt2html
22682 !! wikitext
22683 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
22684 !! html
22685 <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;]}">
22686 <p>foo</p>
22687 </div>
22688 <table>
22689 <tbody>
22690 <tr>
22691 <td>bar</td>
22692 </tr>
22693 </tbody>
22694 </table>
22695 !!end
22696
22697 !!test
22698 4. Encapsulate foster-parented transclusion content
22699 !!options
22700 parsoid=wt2wt,wt2html
22701 !! wikitext
22702 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
22703 !! html
22704 <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;]}">
22705 <p>foo</p>
22706 </div>
22707 <table>
22708 <tbody>
22709 <tr>
22710 <td>bar</td>
22711 </tr>
22712 </tbody>
22713 </table>
22714 !!end
22715
22716 !!test
22717 5. Encapsulate foster-parented transclusion content
22718 !!options
22719 parsoid=wt2wt,wt2html
22720 !! wikitext
22721 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
22722 !! html
22723 <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>
22724 <table>
22725 <tbody>
22726 <tr>
22727 <td>
22728 <div>
22729 <p>foo</p>
22730 </div>
22731 </td>
22732 </tr>
22733 </tbody>
22734 </table>
22735 !!end
22736
22737 !!test
22738 6. Encapsulate foster-parented transclusion content
22739 !!options
22740 parsoid=wt2wt,wt2html
22741 !! wikitext
22742 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
22743 !! html
22744 <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>
22745 <table>
22746 <tbody>
22747 <tr>
22748 <td>
22749 <div>
22750 <p>foo</p>
22751 </div>
22752 </td>
22753 </tr>
22754 </tbody>
22755 </table>
22756 <p>ok</p>
22757 !!end
22758
22759 !!test
22760 7. Encapsulate foster-parented transclusion content
22761 !!options
22762 parsoid=wt2wt,wt2html
22763 !! wikitext
22764 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
22765 !! html
22766 <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>
22767 <table>
22768 <tbody>
22769 <tr>
22770 <td>bar</td>
22771 </tr>
22772 </tbody>
22773 </table>
22774 !!end
22775
22776 !!test
22777 8. Encapsulate foster-parented transclusion content
22778 !!options
22779 parsoid=wt2wt,wt2html
22780 !! wikitext
22781 {{echo|a
22782 }}{|{{echo|style='color:red'}}
22783 |-
22784 |b
22785 |}
22786 !! html
22787 <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>
22788 <tbody>
22789 <tr>
22790 <td>b</td>
22791 </tr>
22792 </tbody>
22793 </table>
22794 !!end
22795
22796 !!test
22797 9. Encapsulate foster-parented transclusion content
22798 !!options
22799 parsoid=wt2wt,wt2html
22800 !! wikitext
22801 <table>{{echo|hi</table>hello}}
22802 !! html
22803 <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>
22804 !!end
22805
22806 !!test
22807 Table in fosterable position
22808 !!options
22809 parsoid=wt2html,wt2wt
22810 !! wikitext
22811 {{OpenTable}}
22812 <div>
22813 {|
22814 |}
22815 </div>
22816 |}
22817 !! html
22818 <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">
22819 </span>
22820 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
22821
22822 <table>
22823 </table>
22824 !!end
22825
22826 # Parsoid only for bug 64747
22827 !! test
22828 Properly encapsulate empty-content transclusions in fosterable positions
22829 !! wikitext
22830 <table>
22831 {{#if:|
22832 <td>foo</td>
22833 }}
22834 </table>
22835 !! html/parsoid
22836 <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":["","","",""]}]]}'>
22837
22838 </table>
22839 !! end
22840
22841 !!test
22842 Support <object> element with .data attribute
22843 !!options
22844 parsoid=html2wt
22845 !! html
22846 <object data="test.swf"></object>
22847 !! wikitext
22848 <object data="test.swf"></object>
22849 !!end
22850
22851 !! test
22852 Don't block XML namespace declaration
22853 !! wikitext
22854 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
22855 !! html/php
22856 <p><span>MediaWiki</span>
22857 </p>
22858 !! html/parsoid
22859 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
22860 !! end
22861
22862 # -----------------------------------------------------------------
22863 # The following section of tests are primarily to spec requirements
22864 # around serialization of new/edited content.
22865 #
22866 # All these tests are marked Parsoid html2wt and html2html only
22867 # ----------------------------------------------------------------
22868
22869 # 'mi' is a localinterwiki prefix as well as a language
22870 !! test
22871 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
22872 !! options
22873 parsoid=html2wt
22874 !! html
22875 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
22876 !! wikitext
22877 [[Foo]]
22878 !! end
22879
22880 !! test
22881 New wiki links (href variations)
22882 !! options
22883 parsoid=html2wt
22884 !! html
22885 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
22886 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
22887 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
22888 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
22889 !! wikitext
22890 [[Foo_bar]]
22891 [[Foo_bar]]
22892 [[Foo_bar]]
22893 [[Toxine bactérienne]]
22894 !! end
22895
22896 !! test
22897 New wiki links (content string variations)
22898 !! options
22899 parsoid=html2wt
22900 !! html
22901 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
22902 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
22903 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
22904 !! wikitext
22905 [[Foo_bar]]
22906 [[Foo bar]]
22907 [[Foo_bar|./Foo_bar]]
22908 !! end
22909
22910 !! test
22911 New category links (href variations)
22912 !! options
22913 parsoid=html2wt
22914 !! html
22915 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
22916 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
22917 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
22918 !! wikitext
22919 [[Category:Toxine bactérienne]]
22920 [[Category:Toxine bactérienne]]
22921 [[Category:Toxine bactérienne]]
22922 !! end
22923
22924 !! test
22925 New sol transparent links don't need indent-pre nowiki protection
22926 !! options
22927 parsoid=html2wt
22928 language=de
22929 !! html
22930 <link rel="mw:PageProp/redirect" href="./Main_Page">
22931 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
22932 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
22933 !! wikitext
22934 #WEITERLEITUNG [[Main Page]]
22935 <!-- this is good --> [[Category:Good]]
22936 <!-- this is great --> [[Kategorie:Great]]
22937 !! end
22938
22939 !! test
22940 New interlanguage links (href variations)
22941 !! options
22942 parsoid=html2wt
22943 !! html
22944 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
22945 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
22946 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
22947 !! wikitext
22948 [[es:Toxine bactérienne]]
22949 [[es:Toxine_bactérienne]]
22950 [[es:Toxine_bactérienne]]
22951 !! end
22952
22953 !! test
22954 Image: Modifying size of an image (1)
22955 !! options
22956 parsoid={
22957 "modes": ["wt2wt"],
22958 "changes": [
22959 ["img[height]", "attr", "height", "22"],
22960 ["img[width]", "attr", "width", "200"]
22961 ]
22962 }
22963 !! wikitext
22964 [[Image:Foobar.jpg|230x230px]]
22965 !! wikitext/edited
22966 [[Image:Foobar.jpg|200x200px]]
22967 !!end
22968
22969 !! test
22970 Image: Modifying size of an image (2)
22971 !! options
22972 parsoid={
22973 "modes": ["wt2wt"],
22974 "changes": [
22975 ["img[height]", "attr", "height", "100"],
22976 ["img[width]", "attr", "width", "500"]
22977 ]
22978 }
22979 !! wikitext
22980 [[Image:Foobar.jpg|230x230px]]
22981 !! wikitext/edited
22982 [[Image:Foobar.jpg|500x500px]]
22983 !!end
22984
22985 # Change in size is ignored so long as class='mw-default-size'
22986 !! test
22987 Image: Modifying size of an image (3)
22988 !! options
22989 parsoid={
22990 "modes": ["wt2wt"],
22991 "changes": [
22992 ["figure[class]", "removeClass", "mw-default-size"],
22993 ["figure img", "attr", "height", "19"],
22994 ["figure img", "attr", "width", "170"]
22995 ]
22996 }
22997 !! wikitext
22998 [[Image:Foobar.jpg|thumb]]
22999 !! wikitext/edited
23000 [[Image:Foobar.jpg|thumb|170x170px]]
23001 !!end
23002
23003 !! test
23004 Image: Modifying alignment of an image (bug 48665)
23005 !! options
23006 parsoid={
23007 "modes": ["wt2wt"],
23008 "changes": [
23009 ["figure[class]", "removeClass", "mw-halign-right"],
23010 ["figure[class]", "addClass", "mw-halign-left"]
23011 ]
23012 }
23013 !! wikitext
23014 [[Image:Foobar.jpg|thumb|caption|right]]
23015 !! wikitext/edited
23016 [[Image:Foobar.jpg|thumb|caption|left]]
23017 !! end
23018
23019 !! test
23020 Image: Modifying mw-default-size of an frameless image (bug 62805)
23021 !! options
23022 parsoid={
23023 "modes": ["wt2wt"],
23024 "changes": [
23025 ["figure.mw-default-size", "removeClass", "mw-default-size"]
23026 ]
23027 }
23028 !! wikitext
23029 [[Image:Foobar.jpg|frameless|right]]
23030 !! wikitext/edited
23031 [[Image:Foobar.jpg|frameless|right|220x220px]]
23032 !! end
23033
23034 !! test
23035 Image: Modifying valign of an image (bug 49221)
23036 !! options
23037 parsoid={
23038 "modes": ["wt2wt"],
23039 "changes": [
23040 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
23041 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
23042 ]
23043 }
23044 !! wikitext
23045 [[File:Foobar.jpg|20px|middle]]
23046 !! wikitext/edited
23047 [[File:Foobar.jpg|20px|text-top]]
23048 !! end
23049
23050 !! test
23051 Image: Modifying alt attribute of an image (bug 56400)
23052 !! options
23053 parsoid={
23054 "modes": ["wt2wt"],
23055 "changes": [
23056 ["img[alt]", "attr", "alt", "some alternate edited text"]
23057 ]
23058 }
23059 !! wikitext
23060 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
23061 !! wikitext/edited
23062 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
23063 !!end
23064
23065 !! test
23066 Image: Modifying caption of an image
23067 !! options
23068 parsoid={
23069 "modes": ["wt2wt"],
23070 "changes": [
23071 ["figcaption", "text", "new caption"]
23072 ]
23073 }
23074 !! wikitext
23075 [[Image:Foobar.jpg|thumb|original caption]]
23076 !! wikitext/edited
23077 [[Image:Foobar.jpg|thumb|new caption]]
23078 !!end
23079
23080 !! test
23081 Image: empty alt attribute (bug 48924)
23082 !! options
23083 parsoid
23084 !! wikitext
23085 [[File:Foobar.jpg|thumb|alt=|bar]]
23086 !! html
23087 <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" 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>
23088 !! end
23089
23090 #!! test
23091 #Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
23092 #!! options
23093 #parsoid=html2wt
23094 #language=ar
23095 #!! html
23096 #<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" height="20" width="180"/></a></figure>
23097 #!! wikitext
23098 #[[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
23099 #!! end
23100
23101 !! test
23102 Image: Block level image should have \n before and after
23103 !! wikitext
23104 123
23105 [[File:Foobar.jpg|right|thumb|150x150px]]
23106 456
23107 !! html/parsoid
23108 <p>123</p>
23109 <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" height="17" width="150"/></a></figure>
23110 <p>456</p>
23111 !!end
23112
23113 !! test
23114 Image: New block level image should have \n before and after (existing content)
23115 !! wikitext
23116 123
23117 [[File:Foobar.jpg|right|thumb|150x150px]]
23118 456
23119 !! html/parsoid
23120 <p>123</p>
23121 <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" height="17" width="150" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"17","width":"150"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure>
23122 <p>456</p>
23123 !!end
23124
23125 !! test
23126 Image: upright option (parsoid)
23127 !! options
23128 parsoid
23129 !! wikitext
23130 [[File:Foobar.jpg|thumb|upright|caption]]
23131 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
23132 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
23133 !! html
23134 <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" height="19" width="170"/></a><figcaption>caption</figcaption></figure>
23135 <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" height="12" width="110"/></a><figcaption>caption</figcaption></figure>
23136 <figure typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="57" width="500"/></a><figcaption>caption</figcaption></figure>
23137 !!end
23138
23139 !! test
23140 Image: upright option is ignored on inline and frame images (parsoid)
23141 !! options
23142 parsoid
23143 !! wikitext
23144 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
23145 !! html
23146 <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" height="57" width="500"/></a></span></p>
23147 !!end
23148
23149 !! test
23150 Image: from basic HTML (1)
23151 !! options
23152 parsoid=html2wt
23153 !! html/parsoid
23154 <span typeof="mw:Image">
23155 <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
23156 </span>
23157 !! wikitext
23158 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
23159 !! end
23160
23161 !! test
23162 Image: from basic HTML (2)
23163 !! options
23164 parsoid=html2wt
23165 !! html/parsoid
23166 <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
23167 !! wikitext
23168 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
23169 !! end
23170
23171 !! test
23172 Image: from basic HTML (3)
23173 !! options
23174 parsoid=html2wt
23175 !! html/parsoid
23176 <a href="Main"><img src="File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
23177 !! wikitext
23178 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
23179 !! end
23180
23181 !! test
23182 Image: from basic HTML (4)
23183 !! options
23184 parsoid=html2wt
23185 !! html/parsoid
23186 <img src="File:Foobar.jpg">
23187 !! wikitext
23188 [[File:Foobar.jpg|link=]]
23189 !! end
23190
23191 !! test
23192 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
23193 !! options
23194 parsoid=html2wt
23195 !! html
23196 <ul>
23197 <li><p>foo</p></li>
23198 </ul>
23199 !! wikitext
23200 * foo
23201 !! end
23202
23203 !! test
23204 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
23205 !! options
23206 parsoid=html2wt
23207 !! html
23208 <ul> <li>foo</li></ul>
23209 !! wikitext
23210 * foo
23211 !! end
23212
23213 !! test
23214 Don't strip leading whitespace when handling indent-pre suppressing tags
23215 !! options
23216 parsoid=html2wt
23217 !! html
23218 <table>
23219 <tr><td> indented row</td></tr>
23220 </table>
23221 <blockquote><p>
23222 <b>This is very bold of you!</b>
23223 </p>
23224 <table><tr><td>
23225 indented cell (no pre-wrapping!)
23226 </td></tr></table>
23227 </blockquote>
23228 <p>foo</p>
23229 <div>bar</div>
23230 !! wikitext
23231 {|
23232 | indented row
23233 |}
23234 <blockquote>
23235 '''This is very bold of you!'''
23236
23237 {|
23238 |
23239 indented cell (no pre-wrapping!)
23240 |}
23241 </blockquote>
23242 foo
23243 <div>bar</div>
23244 !! end
23245
23246 !! test
23247 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
23248 !! options
23249 parsoid=html2wt
23250 !! wikitext
23251 foo
23252 <nowiki> </nowiki><span>bar</span>
23253
23254 <span>foo2
23255 <nowiki> </nowiki></span>bar2
23256
23257 <div>foo</div>
23258 <nowiki> </nowiki><span>bar</span>
23259
23260 <div>
23261 <nowiki> </nowiki><span>foo</span>
23262 </div>
23263 !! html
23264 <p>foo</p>
23265 <span>bar</span>
23266
23267 <span>foo2
23268 </span>bar2
23269
23270 <div>foo</div>
23271 <span>bar</span>
23272
23273 <div>
23274 <span>foo</span>
23275 </div>
23276 !! end
23277
23278 !! test
23279 Lists: Add space after bullets
23280 !! options
23281 parsoid=html2wt
23282 !! html
23283 <ul>
23284 <li>foo</li>
23285 <li> bar</li>
23286 <li><span> baz</span></li>
23287 </ul>
23288 !! wikitext
23289 * foo
23290 * bar
23291 * <span> baz</span>
23292 !! end
23293
23294 !! test
23295 Lists: Dont insert newlines in a serialized list item.
23296 !! options
23297 parsoid=html2wt
23298 !! html
23299 <ul><li>a<br>b</li><li>c</li></ul>
23300 !! wikitext
23301 * a<br>b
23302 * c
23303 !! end
23304
23305 !! test
23306 Headings: Add space before/after == (Bug 51744)
23307 !! options
23308 parsoid=html2wt
23309 !! html
23310 <h2>foo</h2>
23311 <h2> bar</h2>
23312 <h2>baz </h2>
23313 <h2><span> baz</span></h2>
23314 !! wikitext
23315 == foo ==
23316
23317 == bar ==
23318
23319 == baz ==
23320
23321 == <span> baz</span> ==
23322 !! end
23323
23324 !! test
23325 Headings: Force metas to serialize before/after
23326 !! options
23327 parsoid=html2wt
23328 !! html
23329 <h2>hello there<link href="Category:A1" rel="mw:PageProp/Category" /></h2>
23330 <h2><link href="Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
23331
23332 <h2><!--foo--> <link href="Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
23333 !! wikitext
23334 == hello there ==
23335 [[Category:A1]]
23336
23337 [[Category:A2]]
23338 == hi pal ==
23339
23340 <!--foo--> [[Category:A3]]
23341 == how goes it ==
23342 !! end
23343
23344 !! test
23345 Parsoid: Serialize positional parameters with = in them as named parameter
23346 !! options
23347 parsoid=html2wt
23348 !! html
23349 <p about="#mwt1" typeof="mw:Transclusion"
23350 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
23351
23352 <p about="#mwt1" typeof="mw:Transclusion"
23353 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
23354
23355 <!--Orig params with data-parsoid has heuristics for handling = chars-->
23356 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
23357 <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>
23358 !! wikitext
23359 {{echo|1 = f=oo}}
23360
23361 {{echo|1 = f=oo|2 = bar}}
23362
23363 <!--Orig params with data-parsoid has heuristics for handling = chars-->
23364 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
23365 {{echo|<nowiki>f=oo</nowiki>|bar}}
23366 !! end
23367
23368 !! test
23369 Parsoid: Serialize positional parameters with = in extlink as named parameter
23370 !! options
23371 parsoid=html2wt
23372 !! html
23373 <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>
23374 !! wikitext
23375 {{echo|1 = http://stuff?is=ok}}
23376 !! end
23377
23378 !! test
23379 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
23380 !! options
23381 parsoid=html2wt
23382 !! html
23383 <div>a<p>b</p></div>
23384 <div>a
23385 <p>b</p></div>
23386 <div>
23387 a
23388 <p>b</p></div>
23389 !! wikitext
23390 <div>a
23391 b
23392 </div>
23393 <div>a
23394 b
23395 </div>
23396 <div>
23397 a
23398
23399 b
23400 </div>
23401 !! end
23402
23403 !! test
23404 Substrings resembling wikitext in hrefs should not get nowiki escapes
23405 !! options
23406 parsoid=html2wt
23407 !! html
23408 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
23409 !! wikitext
23410 [[Foo''bar''baz]]
23411 !! end
23412
23413 !! test
23414 Enforce single-line context in the serializer
23415 !! options
23416 parsoid=html2wt
23417 !! html
23418 <h2>testing
23419 123</h2>
23420
23421 <ul><li>asd
23422 sdf</li></ul>
23423 !! wikitext
23424 == testing 123 ==
23425
23426 * asd sdf
23427 !! end
23428
23429 #-----------------------------
23430 # I/B quote minimization tests
23431 #-----------------------------
23432
23433 !! test
23434 1. I/B quote minimization: wikitext-only tags should be combined
23435 !! options
23436 parsoid=html2wt
23437 !! html
23438 <p><i>A</i><i>B</i></p>
23439 <p><b>A</b><b>B</b></p>
23440 <p><i>A</i><b><i>B</i></b></p>
23441 <p><b>A</b><i><b>B</b></i></p>
23442 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
23443 <p><i><b>A</b></i><i><b>B</b></i></p>
23444 <p><i><b>A</b></i><b><i>B</i></b></p>
23445 <p><b><i>A</i></b><i><b>B</b></i></p>
23446 !! wikitext
23447 ''AB''
23448
23449 '''AB'''
23450
23451 ''A'''B'''''
23452
23453 '''A''B'''''
23454
23455 '''A''BC''D'''
23456
23457 '''''AB'''''
23458
23459 '''''AB'''''
23460
23461 '''''AB'''''
23462 !! end
23463
23464 !! test
23465 2. I/B quote minimization: wikitext and html tags should not be combined
23466 !! options
23467 parsoid=html2wt
23468 !! html
23469 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
23470 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
23471 !! wikitext
23472 ''A''<i>B</i>
23473
23474 ''A''<nowiki/>'''<i>B</i>'''
23475 !! end
23476
23477 !! test
23478 3. I/B quote minimization: templated content stops minimization
23479 !! options
23480 parsoid=html2wt
23481 !! html
23482 <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>
23483 <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>
23484 !! wikitext
23485 ''A''{{echo|''B''}}
23486
23487 ''A''{{echo|'''''B'''''}}
23488 !! end
23489
23490 !! test
23491 4. I/B quote minimization: new content should be mimimized with adjacent old content
23492 !! options
23493 parsoid=html2wt
23494 !! html
23495 <p><i>A</i><i>B</i></p>
23496 <p><b>A</b><b>B</b></p>
23497 <p><i>A</i><b><i>B</i></b></p>
23498 !! wikitext
23499 ''AB''
23500
23501 '''AB'''
23502
23503 ''A'''B'''''
23504 !! end
23505
23506 !! test
23507 5a. Merge adjacent quote nodes if they've been edited
23508 !! options
23509 parsoid={
23510 "modes": ["wt2wt"],
23511 "changes": [
23512 ["p", "contents", "remove", ":contains('b')"]
23513 ]
23514 }
23515 !! wikitext
23516 ''a''b''c''
23517 !! wikitext/edited
23518 ''ac''
23519 !! end
23520
23521 !! test
23522 5b. Merge adjacent quote nodes if they've been edited
23523 !! options
23524 parsoid={
23525 "modes": ["wt2wt"],
23526 "changes": [
23527 ["#x", "remove"]
23528 ]
23529 }
23530 !! wikitext
23531 ''a''<span id="x">b</span>''c''
23532 !! wikitext/edited
23533 ''ac''
23534 !! end
23535
23536 #------------------------------------
23537 # End of I/B quote minimization tests
23538 #------------------------------------
23539
23540 !!test
23541 Bug 54262: New entities
23542 !! options
23543 parsoid=html2wt
23544 !! wikitext
23545 &nbsp;
23546 !! html
23547 <span typeof="mw:Entity">&nbsp;</span>
23548 !! end
23549
23550 ## Note that there is no wikitext output for 'unknownproperty' ##
23551 ## Unknown magic words are silently dropped ##
23552
23553 !! test
23554 Magic words
23555 !! options
23556 parsoid=html2wt
23557 !! html
23558 <meta property='mw:PageProp/toc' />
23559 <meta property='mw:PageProp/notoc' />
23560 <meta property='mw:PageProp/forcetoc' />
23561 <meta property='mw:PageProp/index' />
23562 <meta property='mw:PageProp/noindex' />
23563 <meta property='mw:PageProp/nogallery' />
23564 <meta property='mw:PageProp/noeditsection' />
23565 <meta property='mw:PageProp/notitleconvert' />
23566 <meta property='mw:PageProp/nocontentconvert' />
23567 <meta property='mw:PageProp/unknownproperty' />
23568 !! wikitext
23569 __TOC__
23570 __NOTOC__
23571 __FORCETOC__
23572 __INDEX__
23573 __NOINDEX__
23574 __NOGALLERY__
23575 __NOEDITSECTION__
23576 __NOTITLECONVERT__
23577 __NOCONTENTCONVERT__
23578 !! end
23579
23580 !! test
23581 Consecutive <pre>s should not get merged
23582 !! options
23583 parsoid=html2wt,html2html
23584 !! html
23585 <pre>a</pre><pre>b</pre>
23586
23587 <pre>c
23588 </pre><pre>
23589 d</pre>
23590
23591 <pre>e
23592
23593 </pre><pre>
23594
23595 f</pre>
23596 !! wikitext
23597 a
23598
23599 b
23600
23601 c
23602
23603 d
23604
23605 e
23606
23607
23608
23609 f
23610 !! end
23611
23612 !! test
23613 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
23614 !! options
23615 parsoid=html2wt
23616 !! html
23617 <a rel="mw:ExtLink" href="./Special:BookSources/1234567890">ISBN 1234567895</a>
23618 !! wikitext
23619 [[Special:BookSources/1234567890|ISBN 1234567895]]
23620 !! end
23621
23622 !! test
23623 Edited RFC links not serializable as RFC links should serialize as extlinks
23624 !! options
23625 parsoid=html2wt
23626 !! html
23627 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
23628 !! wikitext
23629 [//tools.ietf.org/html/rfc123 New RFC]
23630 !! end
23631
23632 !! test
23633 Edited PMID links not serializable as PMID links should serialize as extlinks
23634 !! options
23635 parsoid=html2wt
23636 !! html
23637 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
23638 !! wikitext
23639 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
23640 !! end
23641
23642 !! test
23643 WTS of autolinks with trailing/surrounding context
23644 !! options
23645 parsoid=html2wt
23646 !! html/parsoid
23647 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
23648 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
23649 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
23650 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
23651 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
23652 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
23653 !! wikitext
23654 http://cscott.net<nowiki/>'''foo'''
23655
23656 http://cscott.net<b>foo</b>
23657
23658 '''http://cscott.net<nowiki/>'''
23659
23660 '''http://cscott.net '''
23661
23662 '''http://cscott.net<nowiki/>x'''
23663
23664 http://cscott.net<nowiki/>x
23665 !! end
23666
23667 !! test
23668 WTS of autolinks with nowikis (round-trip)
23669 !! wikitext
23670 x<nowiki/>http://cscott.net<nowiki/>x
23671 !! html/parsoid
23672 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
23673 !! end
23674
23675 # this is the "easy" test because it leaves in place all the
23676 # data-parsoid information indicating this is an autolink
23677 !! test
23678 WTS of autolinks with escapes (editing)
23679 !! options
23680 parsoid={
23681 "modes": ["wt2wt"],
23682 "changes": [
23683 [ "meta", "remove" ]
23684 ]
23685 }
23686 !! wikitext
23687 x<nowiki/>http://cscott.net<nowiki/>x
23688 !! wikitext/edited
23689 x<nowiki/>http://cscott.net<nowiki/>x
23690 !! end
23691
23692 !! test
23693 Edited Redirect link should emit a non-piped wikitext link
23694 !! options
23695 parsoid=html2wt
23696 !! html
23697 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
23698 !! wikitext
23699 #REDIRECT [[Bar]]
23700 !! end
23701
23702 !! test
23703 T75121: Infer extension name from typeOf if data-mw is not present
23704 !! options
23705 parsoid=html2wt
23706 !! html
23707 <div typeOf="mw:Extension/foo"></div>
23708 !! wikitext
23709 <foo />
23710 !! end
23711
23712 # Note that the <p> wrapping isn't present in PHP parser output
23713 # The important thing for this test is that P-wrapping doesn't
23714 # interfere with the <nowiki> protection for leading - in <td>
23715 # (which isn't necessary for <th>).
23716 !! test
23717 T88318: p-wrapped dash in table.
23718 !! options
23719 parsoid=html2wt,wt2wt
23720 !! html/parsoid
23721 <table><tbody>
23722 <tr><th><p>-</p></th><th><p>- </p></th></tr>
23723 <tr><td><p>-</p></td><td><p>- </p></td></tr>
23724 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
23725 </tbody></table>
23726 !! wikitext
23727 {|
23728 !-
23729 !-
23730 |-
23731 |<nowiki>-</nowiki>
23732 |<nowiki>- </nowiki>
23733 |-
23734 |<small>-</small>
23735 |<br>
23736 -
23737 |<br>
23738 -
23739 |}
23740 !! html/php+tidy
23741 <table>
23742 <tr>
23743 <th>-</th>
23744 <th>-</th>
23745 </tr>
23746 <tr>
23747 <td>-</td>
23748 <td>-</td>
23749 </tr>
23750 <tr>
23751 <td><small>-</small></td>
23752 <td><br />
23753 <p>-</p>
23754 </td>
23755 <td><br />
23756 <p>-</p>
23757 </td>
23758 </tr>
23759 </table>
23760 !! end
23761
23762 # -----------------------------------------------------------------
23763 # End of section for Parsoid-only html2wt tests for serialization
23764 # of new content
23765 # -----------------------------------------------------------------
23766
23767 TODO:
23768 more images
23769 more tables
23770 character entities
23771 and much more
23772 Try for 100% code coverage